@absolutejs/deploy 0.14.0 → 0.14.1

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/gcp.d.ts CHANGED
@@ -6,6 +6,16 @@ export type GcpComputeRequest = <T>(options: {
6
6
  }) => Promise<{
7
7
  data: T;
8
8
  }>;
9
+ export type GcpIdentityTokenRequest = (audience: string, url: string, init: NonNullable<Parameters<typeof fetch>[1]>) => Promise<Response>;
10
+ export type GcpIdentityAuth = {
11
+ getIdTokenClient: (audience: string) => Promise<{
12
+ getRequestHeaders: (url: string) => Promise<Headers>;
13
+ }>;
14
+ };
15
+ export declare const createGcpIdentityTokenRequest: (dependencies?: {
16
+ auth?: GcpIdentityAuth;
17
+ fetch?: typeof fetch;
18
+ }) => GcpIdentityTokenRequest;
9
19
  export type GcpInfrastructureProviderOptions = {
10
20
  agentAudience?: string;
11
21
  agentAudienceMetadataKey?: string;
package/dist/gcp.js CHANGED
@@ -10352,6 +10352,18 @@ var DEFAULT_AGENT_URL_METADATA_KEY = "absolutejs-agent-url";
10352
10352
  var DEFAULT_NODE_PREFIX = "absolutejs-node";
10353
10353
  var NODE_NAME_SUFFIX_LENGTH = 8;
10354
10354
  var NODE_NAME_MATCH = /^gcp:([a-z0-9-]+):([a-z]([-a-z0-9]*[a-z0-9])?)$/;
10355
+ var createGcpIdentityTokenRequest = (dependencies = {}) => {
10356
+ const auth = dependencies.auth ?? new import_google_auth_library.GoogleAuth;
10357
+ const request = dependencies.fetch ?? fetch;
10358
+ return async (audience, url, init) => {
10359
+ const client = await auth.getIdTokenClient(audience);
10360
+ const headers = await client.getRequestHeaders(url);
10361
+ return request(url, {
10362
+ ...init,
10363
+ headers: { ...Object.fromEntries(headers), ...init.headers }
10364
+ });
10365
+ };
10366
+ };
10355
10367
 
10356
10368
  class GcpInfrastructureError extends Error {
10357
10369
  }
@@ -10467,8 +10479,9 @@ var createGcpNodeName = (prefix = DEFAULT_NODE_PREFIX) => `${prefix}-${crypto.ra
10467
10479
  export {
10468
10480
  createGcpNodeName,
10469
10481
  createGcpInfrastructureProvider,
10482
+ createGcpIdentityTokenRequest,
10470
10483
  GcpInfrastructureError
10471
10484
  };
10472
10485
 
10473
- //# debugId=38D753E6DE7833FE64756E2164756E21
10486
+ //# debugId=FD4D7CAA2707CCB764756E2164756E21
10474
10487
  //# sourceMappingURL=gcp.js.map