@generacy-ai/generacy-plugin-cloud-build 0.0.0-preview-20260304013206
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/LICENSE +191 -0
- package/README.md +228 -0
- package/dist/auth/auth-provider.d.ts +26 -0
- package/dist/auth/auth-provider.d.ts.map +1 -0
- package/dist/auth/auth-provider.js +72 -0
- package/dist/auth/auth-provider.js.map +1 -0
- package/dist/auth/types.d.ts +26 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +5 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/client.d.ts +43 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +87 -0
- package/dist/client.js.map +1 -0
- package/dist/config/schema.d.ts +73 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +32 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +30 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +11 -0
- package/dist/config/types.js.map +1 -0
- package/dist/errors.d.ts +75 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +144 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/artifacts.d.ts +35 -0
- package/dist/operations/artifacts.d.ts.map +1 -0
- package/dist/operations/artifacts.js +168 -0
- package/dist/operations/artifacts.js.map +1 -0
- package/dist/operations/builds.d.ts +91 -0
- package/dist/operations/builds.d.ts.map +1 -0
- package/dist/operations/builds.js +397 -0
- package/dist/operations/builds.js.map +1 -0
- package/dist/operations/logs.d.ts +56 -0
- package/dist/operations/logs.d.ts.map +1 -0
- package/dist/operations/logs.js +207 -0
- package/dist/operations/logs.js.map +1 -0
- package/dist/operations/triggers.d.ts +76 -0
- package/dist/operations/triggers.d.ts.map +1 -0
- package/dist/operations/triggers.js +308 -0
- package/dist/operations/triggers.js.map +1 -0
- package/dist/plugin.d.ts +156 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +270 -0
- package/dist/plugin.js.map +1 -0
- package/dist/streaming/log-stream.d.ts +34 -0
- package/dist/streaming/log-stream.d.ts.map +1 -0
- package/dist/streaming/log-stream.js +89 -0
- package/dist/streaming/log-stream.js.map +1 -0
- package/dist/streaming/types.d.ts +27 -0
- package/dist/streaming/types.d.ts.map +1 -0
- package/dist/streaming/types.js +6 -0
- package/dist/streaming/types.js.map +1 -0
- package/dist/types/artifacts.d.ts +46 -0
- package/dist/types/artifacts.d.ts.map +1 -0
- package/dist/types/artifacts.js +6 -0
- package/dist/types/artifacts.js.map +1 -0
- package/dist/types/builds.d.ts +134 -0
- package/dist/types/builds.d.ts.map +1 -0
- package/dist/types/builds.js +5 -0
- package/dist/types/builds.js.map +1 -0
- package/dist/types/logs.d.ts +18 -0
- package/dist/types/logs.d.ts.map +1 -0
- package/dist/types/logs.js +5 -0
- package/dist/types/logs.js.map +1 -0
- package/dist/types/triggers.d.ts +71 -0
- package/dist/types/triggers.d.ts.map +1 -0
- package/dist/types/triggers.js +5 -0
- package/dist/types/triggers.js.map +1 -0
- package/dist/utils/retry.d.ts +41 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +107 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/validation.d.ts +53 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +75 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +58 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud Build API client wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Wraps @google-cloud/cloudbuild with:
|
|
5
|
+
* - Authentication integration
|
|
6
|
+
* - Error handling
|
|
7
|
+
* - Retry logic for transient failures
|
|
8
|
+
*/
|
|
9
|
+
import { createAuthProvider } from './auth/auth-provider.js';
|
|
10
|
+
import { withRetry, shouldRetryError } from './utils/retry.js';
|
|
11
|
+
import { CloudBuildError, NotFoundError, RateLimitError, ServiceUnavailableError, AuthError, mapStatusToErrorCode, wrapError, } from './errors.js';
|
|
12
|
+
export class DefaultCloudBuildClient {
|
|
13
|
+
cloudBuild;
|
|
14
|
+
storage;
|
|
15
|
+
projectId;
|
|
16
|
+
location;
|
|
17
|
+
config;
|
|
18
|
+
logger;
|
|
19
|
+
constructor(config, logger, authProvider) {
|
|
20
|
+
this.config = config;
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.projectId = config.projectId;
|
|
23
|
+
this.location = config.location;
|
|
24
|
+
const provider = authProvider ?? createAuthProvider({
|
|
25
|
+
projectId: config.projectId,
|
|
26
|
+
serviceAccountKey: config.serviceAccountKey,
|
|
27
|
+
});
|
|
28
|
+
this.cloudBuild = provider.getCloudBuildClient();
|
|
29
|
+
this.storage = provider.getStorageClient();
|
|
30
|
+
}
|
|
31
|
+
async withRetry(operation, operationName) {
|
|
32
|
+
return withRetry(operation, {
|
|
33
|
+
...this.config.retry,
|
|
34
|
+
shouldRetry: shouldRetryError,
|
|
35
|
+
onRetry: (error, attempt, delayMs) => {
|
|
36
|
+
this.logger.warn({ error, attempt, delayMs, operation: operationName }, `Retrying ${operationName} after transient error`);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a Cloud Build client wrapper.
|
|
43
|
+
*/
|
|
44
|
+
export function createCloudBuildClient(config, logger, authProvider) {
|
|
45
|
+
return new DefaultCloudBuildClient(config, logger, authProvider);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Map Google Cloud API errors to CloudBuildError.
|
|
49
|
+
*/
|
|
50
|
+
export function mapApiError(error, context) {
|
|
51
|
+
if (error instanceof CloudBuildError) {
|
|
52
|
+
return error;
|
|
53
|
+
}
|
|
54
|
+
// Handle gRPC errors from Google Cloud libraries
|
|
55
|
+
if (error && typeof error === 'object') {
|
|
56
|
+
const err = error;
|
|
57
|
+
// gRPC status code
|
|
58
|
+
if ('code' in err && typeof err.code === 'number') {
|
|
59
|
+
const code = err.code;
|
|
60
|
+
const message = 'message' in err ? String(err.message) : 'Unknown error';
|
|
61
|
+
switch (code) {
|
|
62
|
+
case 3: // INVALID_ARGUMENT
|
|
63
|
+
return new CloudBuildError(message, 'INVALID_ARGUMENT', false, context);
|
|
64
|
+
case 5: // NOT_FOUND
|
|
65
|
+
return new NotFoundError('Resource', 'unknown');
|
|
66
|
+
case 7: // PERMISSION_DENIED
|
|
67
|
+
return new CloudBuildError(message, 'PERMISSION_DENIED', false, context);
|
|
68
|
+
case 8: // RESOURCE_EXHAUSTED
|
|
69
|
+
return new RateLimitError(message);
|
|
70
|
+
case 14: // UNAVAILABLE
|
|
71
|
+
return new ServiceUnavailableError(message);
|
|
72
|
+
case 16: // UNAUTHENTICATED
|
|
73
|
+
return new AuthError(message, context);
|
|
74
|
+
default:
|
|
75
|
+
return new CloudBuildError(message, mapStatusToErrorCode(code), code === 14 || code === 8, context);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// HTTP status code
|
|
79
|
+
if ('status' in err && typeof err.status === 'number') {
|
|
80
|
+
const status = err.status;
|
|
81
|
+
const message = 'message' in err ? String(err.message) : 'Unknown error';
|
|
82
|
+
return new CloudBuildError(message, mapStatusToErrorCode(status), status === 429 || status === 503 || status === 504, context);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return wrapError(error);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC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kB;oBACzB,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBACzC;oBACE,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;YACxG,CAAC;QACH,CAAC;QAED,mBAAmB;QACnB,IAAI,QAAQ,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;YAC1B,MAAM,OAAO,GAAG,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;YAEzE,OAAO,IAAI,eAAe,CACxB,OAAO,EACP,oBAAoB,CAAC,MAAM,CAAC,EAC5B,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAClD,OAAO,CACR,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod validation schemas for Cloud Build plugin configuration.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const RetryConfigSchema: z.ZodObject<{
|
|
6
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
maxAttempts: number;
|
|
11
|
+
initialDelayMs: number;
|
|
12
|
+
maxDelayMs: number;
|
|
13
|
+
}, {
|
|
14
|
+
maxAttempts?: number | undefined;
|
|
15
|
+
initialDelayMs?: number | undefined;
|
|
16
|
+
maxDelayMs?: number | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const CloudBuildConfigSchema: z.ZodObject<{
|
|
19
|
+
projectId: z.ZodString;
|
|
20
|
+
location: z.ZodDefault<z.ZodString>;
|
|
21
|
+
serviceAccountKey: z.ZodOptional<z.ZodString>;
|
|
22
|
+
defaultTrigger: z.ZodOptional<z.ZodString>;
|
|
23
|
+
artifactBucket: z.ZodOptional<z.ZodString>;
|
|
24
|
+
retry: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
25
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
maxAttempts: number;
|
|
30
|
+
initialDelayMs: number;
|
|
31
|
+
maxDelayMs: number;
|
|
32
|
+
}, {
|
|
33
|
+
maxAttempts?: number | undefined;
|
|
34
|
+
initialDelayMs?: number | undefined;
|
|
35
|
+
maxDelayMs?: number | undefined;
|
|
36
|
+
}>>>;
|
|
37
|
+
logPollingIntervalMs: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
projectId: string;
|
|
40
|
+
location: string;
|
|
41
|
+
retry: {
|
|
42
|
+
maxAttempts: number;
|
|
43
|
+
initialDelayMs: number;
|
|
44
|
+
maxDelayMs: number;
|
|
45
|
+
};
|
|
46
|
+
logPollingIntervalMs: number;
|
|
47
|
+
serviceAccountKey?: string | undefined;
|
|
48
|
+
defaultTrigger?: string | undefined;
|
|
49
|
+
artifactBucket?: string | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
projectId: string;
|
|
52
|
+
location?: string | undefined;
|
|
53
|
+
serviceAccountKey?: string | undefined;
|
|
54
|
+
defaultTrigger?: string | undefined;
|
|
55
|
+
artifactBucket?: string | undefined;
|
|
56
|
+
retry?: {
|
|
57
|
+
maxAttempts?: number | undefined;
|
|
58
|
+
initialDelayMs?: number | undefined;
|
|
59
|
+
maxDelayMs?: number | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
logPollingIntervalMs?: number | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
export type CloudBuildConfigInput = z.input<typeof CloudBuildConfigSchema>;
|
|
64
|
+
export type CloudBuildConfigOutput = z.output<typeof CloudBuildConfigSchema>;
|
|
65
|
+
/**
|
|
66
|
+
* Parse and validate Cloud Build configuration.
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseConfig(input: CloudBuildConfigInput): CloudBuildConfigOutput;
|
|
69
|
+
/**
|
|
70
|
+
* Safely parse configuration, returning validation errors if invalid.
|
|
71
|
+
*/
|
|
72
|
+
export declare function safeParseConfig(input: unknown): z.SafeParseReturnType<CloudBuildConfigInput, CloudBuildConfigOutput>;
|
|
73
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQjC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,qBAAqB,GAAG,sBAAsB,CAEhF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAEpH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod validation schemas for Cloud Build plugin configuration.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { DEFAULT_RETRY_CONFIG, DEFAULT_LOG_POLLING_INTERVAL_MS, DEFAULT_LOCATION, } from './types.js';
|
|
6
|
+
export const RetryConfigSchema = z.object({
|
|
7
|
+
maxAttempts: z.number().int().min(0).max(10).default(DEFAULT_RETRY_CONFIG.maxAttempts),
|
|
8
|
+
initialDelayMs: z.number().int().min(100).default(DEFAULT_RETRY_CONFIG.initialDelayMs),
|
|
9
|
+
maxDelayMs: z.number().int().min(1000).default(DEFAULT_RETRY_CONFIG.maxDelayMs),
|
|
10
|
+
});
|
|
11
|
+
export const CloudBuildConfigSchema = z.object({
|
|
12
|
+
projectId: z.string().min(1, 'projectId is required'),
|
|
13
|
+
location: z.string().default(DEFAULT_LOCATION),
|
|
14
|
+
serviceAccountKey: z.string().optional(),
|
|
15
|
+
defaultTrigger: z.string().optional(),
|
|
16
|
+
artifactBucket: z.string().optional(),
|
|
17
|
+
retry: RetryConfigSchema.optional().default(DEFAULT_RETRY_CONFIG),
|
|
18
|
+
logPollingIntervalMs: z.number().int().min(500).default(DEFAULT_LOG_POLLING_INTERVAL_MS),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Parse and validate Cloud Build configuration.
|
|
22
|
+
*/
|
|
23
|
+
export function parseConfig(input) {
|
|
24
|
+
return CloudBuildConfigSchema.parse(input);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Safely parse configuration, returning validation errors if invalid.
|
|
28
|
+
*/
|
|
29
|
+
export function safeParseConfig(input) {
|
|
30
|
+
return CloudBuildConfigSchema.safeParse(input);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|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BAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,+BAA+B,CAAC;CACzF,CAAC,CAAC;AAKH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAA4B;IACtD,OAAO,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for the Cloud Build plugin.
|
|
3
|
+
*/
|
|
4
|
+
export interface RetryConfig {
|
|
5
|
+
maxAttempts: number;
|
|
6
|
+
initialDelayMs: number;
|
|
7
|
+
maxDelayMs: number;
|
|
8
|
+
}
|
|
9
|
+
export interface CloudBuildConfig {
|
|
10
|
+
projectId: string;
|
|
11
|
+
location: string;
|
|
12
|
+
serviceAccountKey?: string;
|
|
13
|
+
defaultTrigger?: string;
|
|
14
|
+
artifactBucket?: string;
|
|
15
|
+
retry: RetryConfig;
|
|
16
|
+
logPollingIntervalMs: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CloudBuildConfigInput {
|
|
19
|
+
projectId: string;
|
|
20
|
+
location?: string;
|
|
21
|
+
serviceAccountKey?: string;
|
|
22
|
+
defaultTrigger?: string;
|
|
23
|
+
artifactBucket?: string;
|
|
24
|
+
retry?: Partial<RetryConfig>;
|
|
25
|
+
logPollingIntervalMs?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
28
|
+
export declare const DEFAULT_LOG_POLLING_INTERVAL_MS = 2000;
|
|
29
|
+
export declare const DEFAULT_LOCATION = "global";
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,WAAW,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,oBAAoB,EAAE,WAIlC,CAAC;AAEF,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,gBAAgB,WAAW,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for the Cloud Build plugin.
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_RETRY_CONFIG = {
|
|
5
|
+
maxAttempts: 3,
|
|
6
|
+
initialDelayMs: 1000,
|
|
7
|
+
maxDelayMs: 30000,
|
|
8
|
+
};
|
|
9
|
+
export const DEFAULT_LOG_POLLING_INTERVAL_MS = 2000;
|
|
10
|
+
export const DEFAULT_LOCATION = 'global';
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4BH,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,WAAW,EAAE,CAAC;IACd,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-cloud-build
|
|
3
|
+
*
|
|
4
|
+
* Custom error classes for the Cloud Build plugin.
|
|
5
|
+
* Implements error classification for retry decisions.
|
|
6
|
+
*/
|
|
7
|
+
export type CloudBuildErrorCode = 'AUTH_FAILED' | 'PERMISSION_DENIED' | 'NOT_FOUND' | 'ALREADY_EXISTS' | 'INVALID_ARGUMENT' | 'RESOURCE_EXHAUSTED' | 'FAILED_PRECONDITION' | 'UNAVAILABLE' | 'INTERNAL' | 'DEADLINE_EXCEEDED' | 'CANCELLED' | 'UNKNOWN';
|
|
8
|
+
/**
|
|
9
|
+
* Base error class for all Cloud Build plugin errors.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CloudBuildError extends Error {
|
|
12
|
+
readonly code: CloudBuildErrorCode;
|
|
13
|
+
readonly isTransient: boolean;
|
|
14
|
+
readonly details?: Record<string, unknown>;
|
|
15
|
+
constructor(message: string, code: CloudBuildErrorCode, isTransient: boolean, details?: Record<string, unknown>);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when authentication fails.
|
|
19
|
+
*/
|
|
20
|
+
export declare class AuthError extends CloudBuildError {
|
|
21
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when a resource is not found.
|
|
25
|
+
*/
|
|
26
|
+
export declare class NotFoundError extends CloudBuildError {
|
|
27
|
+
readonly resourceType: string;
|
|
28
|
+
readonly resourceId: string;
|
|
29
|
+
constructor(resourceType: string, resourceId: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Error thrown when rate limited by the API.
|
|
33
|
+
*/
|
|
34
|
+
export declare class RateLimitError extends CloudBuildError {
|
|
35
|
+
readonly retryAfterMs?: number;
|
|
36
|
+
constructor(message: string, retryAfterMs?: number);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Error thrown when an operation times out.
|
|
40
|
+
*/
|
|
41
|
+
export declare class TimeoutError extends CloudBuildError {
|
|
42
|
+
readonly timeoutMs: number;
|
|
43
|
+
readonly operation: string;
|
|
44
|
+
constructor(operation: string, timeoutMs: number);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Error thrown when the service is unavailable.
|
|
48
|
+
*/
|
|
49
|
+
export declare class ServiceUnavailableError extends CloudBuildError {
|
|
50
|
+
constructor(message: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Error thrown for invalid arguments.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ValidationError extends CloudBuildError {
|
|
56
|
+
readonly field?: string;
|
|
57
|
+
constructor(message: string, field?: string);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if an error is a CloudBuildError.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isCloudBuildError(error: unknown): error is CloudBuildError;
|
|
63
|
+
/**
|
|
64
|
+
* Check if an error is transient (retryable).
|
|
65
|
+
*/
|
|
66
|
+
export declare function isTransientError(error: unknown): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Map a gRPC/HTTP status code to a CloudBuildErrorCode.
|
|
69
|
+
*/
|
|
70
|
+
export declare function mapStatusToErrorCode(status: number): CloudBuildErrorCode;
|
|
71
|
+
/**
|
|
72
|
+
* Wrap any error as a CloudBuildError.
|
|
73
|
+
*/
|
|
74
|
+
export declare function wrapError(error: unknown): CloudBuildError;
|
|
75
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,mBAAmB,GAC3B,aAAa,GACb,mBAAmB,GACnB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,qBAAqB,GACrB,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,WAAW,GACX,SAAS,CAAC;AAEd;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGzC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,mBAAmB,EACzB,WAAW,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CASpC;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,eAAe;gBAChC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,eAAe;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAWrD;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,eAAe;IACjD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;CAUnD;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAWjD;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;gBAC9C,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,eAAe;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAK5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKxD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAuBxE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAWzD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-cloud-build
|
|
3
|
+
*
|
|
4
|
+
* Custom error classes for the Cloud Build plugin.
|
|
5
|
+
* Implements error classification for retry decisions.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base error class for all Cloud Build plugin errors.
|
|
9
|
+
*/
|
|
10
|
+
export class CloudBuildError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
isTransient;
|
|
13
|
+
details;
|
|
14
|
+
constructor(message, code, isTransient, details) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = 'CloudBuildError';
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.isTransient = isTransient;
|
|
19
|
+
this.details = details;
|
|
20
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when authentication fails.
|
|
25
|
+
*/
|
|
26
|
+
export class AuthError extends CloudBuildError {
|
|
27
|
+
constructor(message, details) {
|
|
28
|
+
super(message, 'AUTH_FAILED', false, details);
|
|
29
|
+
this.name = 'AuthError';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Error thrown when a resource is not found.
|
|
34
|
+
*/
|
|
35
|
+
export class NotFoundError extends CloudBuildError {
|
|
36
|
+
resourceType;
|
|
37
|
+
resourceId;
|
|
38
|
+
constructor(resourceType, resourceId) {
|
|
39
|
+
super(`${resourceType} not found: ${resourceId}`, 'NOT_FOUND', false, { resourceType, resourceId });
|
|
40
|
+
this.name = 'NotFoundError';
|
|
41
|
+
this.resourceType = resourceType;
|
|
42
|
+
this.resourceId = resourceId;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Error thrown when rate limited by the API.
|
|
47
|
+
*/
|
|
48
|
+
export class RateLimitError extends CloudBuildError {
|
|
49
|
+
retryAfterMs;
|
|
50
|
+
constructor(message, retryAfterMs) {
|
|
51
|
+
super(message, 'RESOURCE_EXHAUSTED', true, { retryAfterMs });
|
|
52
|
+
this.name = 'RateLimitError';
|
|
53
|
+
this.retryAfterMs = retryAfterMs;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Error thrown when an operation times out.
|
|
58
|
+
*/
|
|
59
|
+
export class TimeoutError extends CloudBuildError {
|
|
60
|
+
timeoutMs;
|
|
61
|
+
operation;
|
|
62
|
+
constructor(operation, timeoutMs) {
|
|
63
|
+
super(`Operation '${operation}' timed out after ${timeoutMs}ms`, 'DEADLINE_EXCEEDED', true, { operation, timeoutMs });
|
|
64
|
+
this.name = 'TimeoutError';
|
|
65
|
+
this.timeoutMs = timeoutMs;
|
|
66
|
+
this.operation = operation;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Error thrown when the service is unavailable.
|
|
71
|
+
*/
|
|
72
|
+
export class ServiceUnavailableError extends CloudBuildError {
|
|
73
|
+
constructor(message) {
|
|
74
|
+
super(message, 'UNAVAILABLE', true);
|
|
75
|
+
this.name = 'ServiceUnavailableError';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Error thrown for invalid arguments.
|
|
80
|
+
*/
|
|
81
|
+
export class ValidationError extends CloudBuildError {
|
|
82
|
+
field;
|
|
83
|
+
constructor(message, field) {
|
|
84
|
+
super(message, 'INVALID_ARGUMENT', false, { field });
|
|
85
|
+
this.name = 'ValidationError';
|
|
86
|
+
this.field = field;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Check if an error is a CloudBuildError.
|
|
91
|
+
*/
|
|
92
|
+
export function isCloudBuildError(error) {
|
|
93
|
+
return error instanceof CloudBuildError;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if an error is transient (retryable).
|
|
97
|
+
*/
|
|
98
|
+
export function isTransientError(error) {
|
|
99
|
+
if (error instanceof CloudBuildError) {
|
|
100
|
+
return error.isTransient;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Map a gRPC/HTTP status code to a CloudBuildErrorCode.
|
|
106
|
+
*/
|
|
107
|
+
export function mapStatusToErrorCode(status) {
|
|
108
|
+
switch (status) {
|
|
109
|
+
case 400:
|
|
110
|
+
return 'INVALID_ARGUMENT';
|
|
111
|
+
case 401:
|
|
112
|
+
return 'AUTH_FAILED';
|
|
113
|
+
case 403:
|
|
114
|
+
return 'PERMISSION_DENIED';
|
|
115
|
+
case 404:
|
|
116
|
+
return 'NOT_FOUND';
|
|
117
|
+
case 409:
|
|
118
|
+
return 'ALREADY_EXISTS';
|
|
119
|
+
case 429:
|
|
120
|
+
return 'RESOURCE_EXHAUSTED';
|
|
121
|
+
case 500:
|
|
122
|
+
return 'INTERNAL';
|
|
123
|
+
case 503:
|
|
124
|
+
return 'UNAVAILABLE';
|
|
125
|
+
case 504:
|
|
126
|
+
return 'DEADLINE_EXCEEDED';
|
|
127
|
+
default:
|
|
128
|
+
return 'UNKNOWN';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Wrap any error as a CloudBuildError.
|
|
133
|
+
*/
|
|
134
|
+
export function wrapError(error) {
|
|
135
|
+
if (error instanceof CloudBuildError) {
|
|
136
|
+
return error;
|
|
137
|
+
}
|
|
138
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
139
|
+
const context = error instanceof Error
|
|
140
|
+
? { originalError: error.name, stack: error.stack }
|
|
141
|
+
: undefined;
|
|
142
|
+
return new CloudBuildError(message, 'UNKNOWN', false, context);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAsB;IAC1B,WAAW,CAAU;IACrB,OAAO,CAA2B;IAE3C,YACE,OAAe,EACf,IAAyB,EACzB,WAAoB,EACpB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD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B,KAAK,GAAG;YACN,OAAO,mBAAmB,CAAC;QAC7B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,eAAe,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK;QACpC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;QACnD,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-cloud-build
|
|
3
|
+
*
|
|
4
|
+
* Google Cloud Build integration plugin for Generacy.
|
|
5
|
+
* Provides a typed interface for triggering builds, monitoring status,
|
|
6
|
+
* streaming logs, accessing artifacts, and managing triggers.
|
|
7
|
+
*/
|
|
8
|
+
export { CloudBuildPlugin } from './plugin.js';
|
|
9
|
+
export type { CloudBuildPluginOptions, CloudBuildPluginInterface } from './plugin.js';
|
|
10
|
+
export { CloudBuildConfigSchema, RetryConfigSchema, parseConfig, safeParseConfig } from './config/schema.js';
|
|
11
|
+
export type { CloudBuildConfig, CloudBuildConfigInput, RetryConfig } from './config/types.js';
|
|
12
|
+
export { DEFAULT_RETRY_CONFIG, DEFAULT_LOG_POLLING_INTERVAL_MS, DEFAULT_LOCATION, } from './config/types.js';
|
|
13
|
+
export type { Build, BuildConfig, BuildFilter, BuildSource, BuildStatus, BuildStep, BuildStepConfig, BuildStepStatus, BuildResults, BuiltImage, PaginatedResult, TimeSpan, Volume, MachineType, StorageSource, RepoSource, GitSource, ArtifactsConfig, } from './types/builds.js';
|
|
14
|
+
export type { BuildTrigger, TriggerConfig, GitHubConfig, PullRequestFilter, PushFilter, PubsubConfig, WebhookConfig, GitRepoSource, } from './types/triggers.js';
|
|
15
|
+
export type { Artifact, BuildArtifacts } from './types/artifacts.js';
|
|
16
|
+
export { MAX_ARTIFACT_SIZE_BYTES } from './types/artifacts.js';
|
|
17
|
+
export type { LogEntry, LogSeverity } from './types/logs.js';
|
|
18
|
+
export type { LogStreamOptions } from './streaming/types.js';
|
|
19
|
+
export { CloudBuildError, AuthError, NotFoundError, RateLimitError, TimeoutError, ServiceUnavailableError, ValidationError, isCloudBuildError, isTransientError, mapStatusToErrorCode, wrapError, } from './errors.js';
|
|
20
|
+
export type { CloudBuildErrorCode } from './errors.js';
|
|
21
|
+
export { BuildIdSchema, TriggerIdSchema, TriggerNameSchema, TimeoutSchema, PageSizeSchema, SubstitutionKeySchema, validate, safeValidate, } from './utils/validation.js';
|
|
22
|
+
export { withRetry, calculateDelay, sleep, isRetryableStatusCode, shouldRetryError, createRetryWrapper, } from './utils/retry.js';
|
|
23
|
+
export type { RetryOptions } from './utils/retry.js';
|
|
24
|
+
export { LogStream, createLogStream, collectLogs } from './streaming/log-stream.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGtF,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC7G,YAAY,E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YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generacy-ai/generacy-plugin-cloud-build
|
|
3
|
+
*
|
|
4
|
+
* Google Cloud Build integration plugin for Generacy.
|
|
5
|
+
* Provides a typed interface for triggering builds, monitoring status,
|
|
6
|
+
* streaming logs, accessing artifacts, and managing triggers.
|
|
7
|
+
*/
|
|
8
|
+
// Main plugin
|
|
9
|
+
export { CloudBuildPlugin } from './plugin.js';
|
|
10
|
+
// Configuration
|
|
11
|
+
export { CloudBuildConfigSchema, RetryConfigSchema, parseConfig, safeParseConfig } from './config/schema.js';
|
|
12
|
+
export { DEFAULT_RETRY_CONFIG, DEFAULT_LOG_POLLING_INTERVAL_MS, DEFAULT_LOCATION, } from './config/types.js';
|
|
13
|
+
export { MAX_ARTIFACT_SIZE_BYTES } from './types/artifacts.js';
|
|
14
|
+
// Errors
|
|
15
|
+
export { CloudBuildError, AuthError, NotFoundError, RateLimitError, TimeoutError, ServiceUnavailableError, ValidationError, isCloudBuildError, isTransientError, mapStatusToErrorCode, wrapError, } from './errors.js';
|
|
16
|
+
// Validation utilities
|
|
17
|
+
export { BuildIdSchema, TriggerIdSchema, TriggerNameSchema, TimeoutSchema, PageSizeSchema, SubstitutionKeySchema, validate, safeValidate, } from './utils/validation.js';
|
|
18
|
+
// Retry utilities
|
|
19
|
+
export { withRetry, calculateDelay, sleep, isRetryableStatusCode, shouldRetryError, createRetryWrapper, } from './utils/retry.js';
|
|
20
|
+
// Log streaming utilities
|
|
21
|
+
export { LogStream, createLogStream, collectLogs } from './streaming/log-stream.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc;AACd,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,gBAAgB;AAChB,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE7G,OAAO,EACL,oBAAoB,EACpB,+BAA+B,EAC/B,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAsC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,SAAS;AACT,OAAO,EACL,eAAe,EACf,SAAS,EACT,aAAa,EACb,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,GACV,MAAM,aAAa,CAAC;AAGrB,uBAAuB;AACvB,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,kBAAkB;AAClB,OAAO,EACL,SAAS,EACT,cAAc,EACd,KAAK,EACL,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,0BAA0B;AAC1B,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifact operations for the Cloud Build plugin.
|
|
3
|
+
*
|
|
4
|
+
* Handles:
|
|
5
|
+
* - Listing build artifacts
|
|
6
|
+
* - Downloading artifacts (Buffer mode for ≤100MB)
|
|
7
|
+
* - Streaming artifacts (ReadableStream for large files)
|
|
8
|
+
*/
|
|
9
|
+
import type { CloudBuildClient } from '@google-cloud/cloudbuild';
|
|
10
|
+
import type { Storage } from '@google-cloud/storage';
|
|
11
|
+
import type { Logger } from 'pino';
|
|
12
|
+
import type { CloudBuildConfig } from '../config/types.js';
|
|
13
|
+
import type { Artifact } from '../types/artifacts.js';
|
|
14
|
+
export declare class ArtifactOperations {
|
|
15
|
+
private readonly cloudBuildClient;
|
|
16
|
+
private readonly storage;
|
|
17
|
+
private readonly config;
|
|
18
|
+
private readonly logger;
|
|
19
|
+
constructor(cloudBuildClient: CloudBuildClient, storage: Storage, config: CloudBuildConfig, logger: Logger);
|
|
20
|
+
/**
|
|
21
|
+
* List artifacts for a build.
|
|
22
|
+
*/
|
|
23
|
+
listArtifacts(buildId: string): Promise<Artifact[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Download an artifact as a Buffer.
|
|
26
|
+
* Throws if artifact exceeds 100MB.
|
|
27
|
+
*/
|
|
28
|
+
getArtifact(buildId: string, path: string): Promise<Buffer>;
|
|
29
|
+
/**
|
|
30
|
+
* Download an artifact as a ReadableStream.
|
|
31
|
+
* Use for large files that exceed the 100MB Buffer limit.
|
|
32
|
+
*/
|
|
33
|
+
getArtifactStream(buildId: string, path: string): Promise<ReadableStream>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/operations/artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM;IAGjC;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IA2FzD;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BjE;;;OAGG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CA0ChF"}
|