Versions

envless.versions.iterateEntries()

Stream version entries one at a time

ts
iterateEntries(project: string, environment: string, options?: ScopedListOptions): AsyncGenerator<VersionEntryResource, void, undefined>

Yields version entries individually, fetching the next page only once the current one is drained. Use it to rotate a large environment without holding its whole encrypted history in memory.

It returns an async generator, not a promise, so put the call straight into a for await loop rather than awaiting it. reencryptEntries rewrites only value and defaultValue and never adds or removes rows, so writing back mid stream does not shift the window. Publishing a version mid walk does shift it, because the new entries land in the same flat set.

Example

ts
const batch = []

for await (const entry of envless.versions.iterateEntries('api', 'production')) {
    if (entry.value) batch.push(entry.id)
}

console.log(batch.length)

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug or project uniqueId.
environmentstringYesEnvironment slug, since an environment uniqueId will not resolve here.
options.productstringNoProduct slug used to disambiguate a project slug shared across products.
options.limitnumberNoPage size fetched behind the scenes, clamped to 100.
options.offsetnumberNoRow to start streaming from.
options.signalAbortSignalNoCancels the in flight page request and ends the stream.

Returns

An AsyncGenerator that yields VersionEntryResource values until the pages run out.

Reads the entries collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • Buffer the yielded entries and write them back in batches. One reencryptEntries call per entry works but costs a request each.
  • Freeze publishing while a rotation walk is in flight, otherwise a new version adds entries encrypted under the old key after you have already passed that offset.

Required scopes

versions:read and variables:read

Underlying endpoint

GET /projects/{slug}/environments/{environmentSlug}/versions/entries

Request and response schema, every error code, and a live playground.

In Python

envless.versions.iterate_entries()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.versions.iterate_entries

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->versions->iterateEntries()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.