Skip to content

AWS.CodeArtifact reference

Source: src/AWS/CodeArtifact/CopyPackageVersions.ts

Runtime binding for codeartifact:CopyPackageVersions.

Copies package versions from another repository in the same domain into the bound repository (the destination) — the standard promotion flow from a staging repository to a release repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.CopyPackageVersionsHttp).

const copyVersions = yield* AWS.CodeArtifact.CopyPackageVersions(releaseRepo);
const res = yield* copyVersions({
sourceRepository: "staging",
format: "generic",
namespace: "my-ns",
package: "my-package",
versions: ["1.0.0"],
});
console.log(res.successfulVersions);

Source: src/AWS/CodeArtifact/DeletePackage.ts

Runtime binding for codeartifact:DeletePackage.

Deletes a package and all of its versions from the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.DeletePackageHttp).

const deletePackage = yield* AWS.CodeArtifact.DeletePackage(repo);
yield* deletePackage({
format: "generic",
namespace: "my-ns",
package: "my-package",
});

Source: src/AWS/CodeArtifact/DeletePackageVersions.ts

Runtime binding for codeartifact:DeletePackageVersions.

Deletes specific versions of a package from the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.DeletePackageVersionsHttp).

const deleteVersions = yield* AWS.CodeArtifact.DeletePackageVersions(repo);
const res = yield* deleteVersions({
format: "generic",
namespace: "my-ns",
package: "my-package",
versions: ["1.0.0"],
});
console.log(res.successfulVersions);

Source: src/AWS/CodeArtifact/DescribePackage.ts

Runtime binding for codeartifact:DescribePackage.

Reads a package’s description, including its origin configuration, from the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.DescribePackageHttp).

const describePackage = yield* AWS.CodeArtifact.DescribePackage(repo);
const res = yield* describePackage({
format: "generic",
namespace: "my-ns",
package: "my-package",
});
console.log(res.package?.originConfiguration);

Source: src/AWS/CodeArtifact/DescribePackageVersion.ts

Runtime binding for codeartifact:DescribePackageVersion.

Reads a single package version’s description — status, revision, origin, and license metadata. Provide the implementation with Effect.provide(AWS.CodeArtifact.DescribePackageVersionHttp).

DescribePackageVersion: Inspecting Package Versions

Section titled “DescribePackageVersion: Inspecting Package Versions”
const describeVersion = yield* AWS.CodeArtifact.DescribePackageVersion(repo);
const res = yield* describeVersion({
format: "generic",
namespace: "my-ns",
package: "my-package",
packageVersion: "1.0.0",
});
console.log(res.packageVersion?.status);

Source: src/AWS/CodeArtifact/DisposePackageVersions.ts

Runtime binding for codeartifact:DisposePackageVersions.

Disposes package versions — deletes their assets and pins the version status to Disposed so the version number can never be reused with different content. Provide the implementation with Effect.provide(AWS.CodeArtifact.DisposePackageVersionsHttp).

const dispose = yield* AWS.CodeArtifact.DisposePackageVersions(repo);
const res = yield* dispose({
format: "generic",
namespace: "my-ns",
package: "my-package",
versions: ["1.0.0"],
});
console.log(res.successfulVersions);

Source: src/AWS/CodeArtifact/Domain.ts

An AWS CodeArtifact domain — the top-level container that groups a set of package repositories and provides a single point for encryption, ownership and cross-account access control.

Basic Domain

const domain = yield* CodeArtifact.Domain("packages", {});

Domain with a customer-managed KMS key

const domain = yield* CodeArtifact.Domain("packages", {
domainName: "my-org",
encryptionKey: key.keyArn,
tags: { team: "platform" },
});

Source: src/AWS/CodeArtifact/GetAuthorizationToken.ts

Runtime binding for codeartifact:GetAuthorizationToken.

Mints a temporary authorization token for the bound domain — the credential package managers (npm, pip, maven, …) present to a CodeArtifact repository endpoint. The deploy-time half grants codeartifact:GetAuthorizationToken on the domain plus the sts:GetServiceBearerToken call CodeArtifact performs on the caller’s behalf. Provide the implementation with Effect.provide(AWS.CodeArtifact.GetAuthorizationTokenHttp).

The returned authorizationToken is wrapped in Redacted so it never leaks into logs — unwrap with Redacted.value(...) at the point of use.

GetAuthorizationToken: Authenticating Package Managers

Section titled “GetAuthorizationToken: Authenticating Package Managers”
import * as Redacted from "effect/Redacted";
const getToken = yield* AWS.CodeArtifact.GetAuthorizationToken(domain);
const res = yield* getToken({ duration: "1 hour" });
const token = Redacted.isRedacted(res.authorizationToken)
? Redacted.value(res.authorizationToken)
: res.authorizationToken; // pass to `npm config set //…:_authToken=`

Source: src/AWS/CodeArtifact/GetPackageVersionAsset.ts

Runtime binding for codeartifact:GetPackageVersionAsset.

Downloads one asset (file) of a package version from the bound repository. The result’s asset is a Stream of bytes. Provide the implementation with Effect.provide(AWS.CodeArtifact.GetPackageVersionAssetHttp).

import * as Stream from "effect/Stream";
const getAsset = yield* AWS.CodeArtifact.GetPackageVersionAsset(repo);
const res = yield* getAsset({
format: "generic",
namespace: "my-ns",
package: "my-package",
packageVersion: "1.0.0",
asset: "artifact.bin",
});
const bytes = yield* Stream.mkString(
Stream.decodeText(res.asset!),
);

Source: src/AWS/CodeArtifact/GetPackageVersionReadme.ts

Runtime binding for codeartifact:GetPackageVersionReadme.

Reads a package version’s readme, where the format supports one. Provide the implementation with Effect.provide(AWS.CodeArtifact.GetPackageVersionReadmeHttp).

GetPackageVersionReadme: Inspecting Package Versions

Section titled “GetPackageVersionReadme: Inspecting Package Versions”
const getReadme = yield* AWS.CodeArtifact.GetPackageVersionReadme(repo);
const res = yield* getReadme({
format: "npm",
package: "left-pad",
packageVersion: "1.3.0",
});
console.log(res.readme);

Source: src/AWS/CodeArtifact/GetRepositoryEndpoint.ts

Runtime binding for codeartifact:GetRepositoryEndpoint.

Resolves the URL package managers (npm, pip, maven, …) use to talk to the bound repository for a given package format. Provide the implementation with Effect.provide(AWS.CodeArtifact.GetRepositoryEndpointHttp).

GetRepositoryEndpoint: Resolving the Registry Endpoint

Section titled “GetRepositoryEndpoint: Resolving the Registry Endpoint”
const getEndpoint = yield* AWS.CodeArtifact.GetRepositoryEndpoint(repo);
const res = yield* getEndpoint({ format: "npm" });
console.log(res.repositoryEndpoint);

Source: src/AWS/CodeArtifact/ListPackages.ts

Runtime binding for codeartifact:ListPackages.

Lists the packages stored in the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.ListPackagesHttp).

const listPackages = yield* AWS.CodeArtifact.ListPackages(repo);
const res = yield* listPackages({ packagePrefix: "my-" });
for (const pkg of res.packages ?? []) console.log(pkg.package);

Source: src/AWS/CodeArtifact/ListPackageVersionAssets.ts

Runtime binding for codeartifact:ListPackageVersionAssets.

Lists the assets (files) attached to a package version in the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.ListPackageVersionAssetsHttp).

const listAssets = yield* AWS.CodeArtifact.ListPackageVersionAssets(repo);
const res = yield* listAssets({
format: "generic",
namespace: "my-ns",
package: "my-package",
packageVersion: "1.0.0",
});
console.log(res.assets?.map((a) => a.name));

Source: src/AWS/CodeArtifact/ListPackageVersionDependencies.ts

Runtime binding for codeartifact:ListPackageVersionDependencies.

Lists the direct dependencies recorded in a package version’s manifest (npm package.json, maven pom.xml, …). Provide the implementation with Effect.provide(AWS.CodeArtifact.ListPackageVersionDependenciesHttp).

ListPackageVersionDependencies: Inspecting Package Versions

Section titled “ListPackageVersionDependencies: Inspecting Package Versions”
const listDeps = yield* AWS.CodeArtifact.ListPackageVersionDependencies(repo);
const res = yield* listDeps({
format: "npm",
package: "left-pad",
packageVersion: "1.3.0",
});
console.log(res.dependencies?.map((d) => d.package));

Source: src/AWS/CodeArtifact/ListPackageVersions.ts

Runtime binding for codeartifact:ListPackageVersions.

Lists a package’s versions in the bound repository. Provide the implementation with Effect.provide(AWS.CodeArtifact.ListPackageVersionsHttp).

ListPackageVersions: Browsing Package Versions

Section titled “ListPackageVersions: Browsing Package Versions”
const listVersions = yield* AWS.CodeArtifact.ListPackageVersions(repo);
const res = yield* listVersions({
format: "generic",
namespace: "my-ns",
package: "my-package",
status: "Published",
});
console.log(res.versions?.map((v) => v.version));

Source: src/AWS/CodeArtifact/PublishPackageVersion.ts

Runtime binding for codeartifact:PublishPackageVersion.

Publishes a new package version (generic-format packages) by uploading an asset with its SHA-256 checksum. Provide the implementation with Effect.provide(AWS.CodeArtifact.PublishPackageVersionHttp).

PublishPackageVersion: Publishing Packages

Section titled “PublishPackageVersion: Publishing Packages”
const publish = yield* AWS.CodeArtifact.PublishPackageVersion(repo);
const res = yield* publish({
format: "generic",
namespace: "my-ns",
package: "my-package",
packageVersion: "1.0.0",
assetName: "artifact.bin",
assetContent: bytes,
assetSHA256: sha256HexOfBytes,
});
console.log(res.status);

Source: src/AWS/CodeArtifact/PutPackageOriginConfiguration.ts

Runtime binding for codeartifact:PutPackageOriginConfiguration.

Sets a package’s origin controls — whether new versions can be published directly and whether versions can be ingested from upstream/external sources. Provide the implementation with Effect.provide(AWS.CodeArtifact.PutPackageOriginConfigurationHttp).

PutPackageOriginConfiguration: Managing Package Origins

Section titled “PutPackageOriginConfiguration: Managing Package Origins”
const putOrigin = yield* AWS.CodeArtifact.PutPackageOriginConfiguration(repo);
const res = yield* putOrigin({
format: "generic",
namespace: "my-ns",
package: "my-package",
restrictions: { publish: "ALLOW", upstream: "BLOCK" },
});
console.log(res.originConfiguration?.restrictions);

Source: src/AWS/CodeArtifact/Repository.ts

An AWS CodeArtifact repository — a package store inside a Domain. Repositories host packages (npm, PyPI, Maven, NuGet, etc.) and can chain to upstream repositories and a single external connection to a public registry.

Basic Repository

const domain = yield* CodeArtifact.Domain("packages", {});
const repo = yield* CodeArtifact.Repository("npm-store", {
domain: domain.domainName,
});

Repository with an external connection to npmjs

const repo = yield* CodeArtifact.Repository("npm-store", {
domain: domain.domainName,
description: "Proxy of the public npm registry",
externalConnection: "public:npmjs",
});

Repository with an upstream

const shared = yield* CodeArtifact.Repository("shared", {
domain: domain.domainName,
});
const app = yield* CodeArtifact.Repository("app", {
domain: domain.domainName,
upstreams: [shared.repositoryName],
});

Source: src/AWS/CodeArtifact/UpdatePackageVersionsStatus.ts

Runtime binding for codeartifact:UpdatePackageVersionsStatus.

Transitions package versions between statuses (e.g. UnfinishedPublished, or PublishedArchived to hide them from installs). Provide the implementation with Effect.provide(AWS.CodeArtifact.UpdatePackageVersionsStatusHttp).

UpdatePackageVersionsStatus: Managing Version Status

Section titled “UpdatePackageVersionsStatus: Managing Version Status”
const updateStatus = yield* AWS.CodeArtifact.UpdatePackageVersionsStatus(repo);
const res = yield* updateStatus({
format: "generic",
namespace: "my-ns",
package: "my-package",
versions: ["1.0.0"],
targetStatus: "Published",
});
console.log(res.successfulVersions);