Skip to content

release: 0.6.1 #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.0"
".": "0.6.1"
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.6.1 (2025-06-14)

Full Changelog: [v0.6.0...v0.6.1](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.6.0...v0.6.1)

### Bug Fixes

* publish script — handle NPM errors correctly ([be3283b](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/be3283b4cfb44646b33bf364fb5380d3a226f6a0))


### Chores

* **internal:** add pure annotations, make base APIResource abstract ([e489880](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/e48988064ee76b254985960b3c8c7c649d47398e))
* **internal:** version bump ([94014af](https://github.com/gitpod-io/gitpod-sdk-typescript/commit/94014af9bfcfcf6e676dcc7934687db8704b429f))

## 0.6.0 (2025-06-06)

Full Changelog: [v0.5.0...v0.6.0](https://github.com/gitpod-io/gitpod-sdk-typescript/compare/v0.5.0...v0.6.0)
Expand Down
34 changes: 27 additions & 7 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,35 @@ npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
yarn build
cd dist

# Get package name and version from package.json
PACKAGE_NAME="$(jq -r -e '.name' ./package.json)"
VERSION="$(jq -r -e '.version' ./package.json)"

# Get latest version from npm
#
# If the package doesn't exist, yarn will return
# {"type":"error","data":"Received invalid response from npm."}
# where .data.version doesn't exist so LAST_VERSION will be an empty string.
LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')"

# Get current version from package.json
VERSION="$(node -p "require('./package.json').version")"
# If the package doesn't exist, npm will return:
# {
# "error": {
# "code": "E404",
# "summary": "Unpublished on 2025-06-05T09:54:53.528Z",
# "detail": "'the_package' is not in this registry..."
# }
# }
NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)"

# Check if we got an E404 error
if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then
# Package doesn't exist yet, no last version
LAST_VERSION=""
elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then
# Report other errors
echo "ERROR: npm returned unexpected data:"
echo "$NPM_INFO"
exit 1
else
# Success - get the version
LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes
fi

# Check if current version is pre-release (e.g. alpha / beta / rc)
CURRENT_IS_PRERELEASE=false
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gitpod/sdk",
"version": "0.6.0",
"version": "0.6.1",
"description": "The official TypeScript library for the Gitpod API",
"author": "Gitpod <dev-feedback@gitpod.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -45,7 +45,7 @@
"sshpk": "^1.18.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
node scripts/utils/make-dist-package-json.cjs > dist/package.json

# build to .js/.mjs/.d.ts files
npm exec tsc-multi
./node_modules/.bin/tsc-multi
# we need to patch index.js so that `new module.exports()` works for cjs backwards
# compat. No way to get that from index.ts because it would cause compile errors
# when building .mjs
Expand Down
2 changes: 1 addition & 1 deletion src/core/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { Gitpod } from '../client';

export class APIResource {
export abstract class APIResource {
protected _client: Gitpod;

constructor(client: Gitpod) {
Expand Down
10 changes: 5 additions & 5 deletions src/internal/headers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { isReadonlyArray } from './utils/values';

type HeaderValue = string | undefined | null;
export type HeadersLike =
| Headers
Expand All @@ -9,7 +11,7 @@ export type HeadersLike =
| null
| NullableHeaders;

const brand_privateNullableHeaders = Symbol('brand.privateNullableHeaders');
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');

/**
* @internal
Expand All @@ -25,8 +27,6 @@ export type NullableHeaders = {
nulls: Set<string>;
};

const isArray = Array.isArray as (val: unknown) => val is readonly unknown[];

function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [string, string | null]> {
if (!headers) return;

Expand All @@ -43,7 +43,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
let iter: Iterable<readonly (HeaderValue | readonly HeaderValue[])[]>;
if (headers instanceof Headers) {
iter = headers.entries();
} else if (isArray(headers)) {
} else if (isReadonlyArray(headers)) {
iter = headers;
} else {
shouldClear = true;
Expand All @@ -52,7 +52,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
for (let row of iter) {
const name = row[0];
if (typeof name !== 'string') throw new TypeError('expected header name to be a string');
const values = isArray(row[1]) ? row[1] : [row[1]];
const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
let didClear = false;
for (const value of values) {
if (value === undefined) continue;
Expand Down
4 changes: 2 additions & 2 deletions src/internal/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async (
return { ...opts, body: await createForm(opts.body, fetch) };
};

const supportsFormDataMap = new WeakMap<Fetch, Promise<boolean>>();
const supportsFormDataMap = /** @__PURE__ */ new WeakMap<Fetch, Promise<boolean>>();

/**
* node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
Expand Down Expand Up @@ -138,7 +138,7 @@ export const createForm = async <T = Record<string, unknown>>(

// We check for Blob not File because Bun.File doesn't inherit from File,
// but they both inherit from Blob and have a `name` property at runtime.
const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value;
const isNamedBlob = (value: unknown) => value instanceof Blob && 'name' in value;

const isUploadable = (value: unknown) =>
typeof value === 'object' &&
Expand Down
2 changes: 1 addition & 1 deletion src/internal/utils/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const noopLogger = {
debug: noop,
};

let cachedLoggers = new WeakMap<Logger, [LogLevel, Logger]>();
let cachedLoggers = /** @__PURE__ */ new WeakMap<Logger, [LogLevel, Logger]>();

export function loggerFor(client: Gitpod): Logger {
const logger = client.logger;
Expand Down
2 changes: 1 addition & 1 deletion src/internal/utils/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) =>
/**
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
*/
export const path = createPathTagFunction(encodeURIPath);
export const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
3 changes: 3 additions & 0 deletions src/internal/utils/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export const isAbsoluteURL = (url: string): boolean => {
return startsWithSchemeRegexp.test(url);
};

export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val));
export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[];

/** Returns an object if the given value isn't an object, otherwise returns as-is */
export function maybeObj(x: unknown): object {
if (typeof x !== 'object') {
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.6.0'; // x-release-please-version
export const VERSION = '0.6.1'; // x-release-please-version
12 changes: 10 additions & 2 deletions tsc-multi.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"targets": [
{ "extname": ".js", "module": "commonjs", "shareHelpers": "internal/tslib.js" },
{ "extname": ".mjs", "module": "esnext", "shareHelpers": "internal/tslib.mjs" }
{
"extname": ".js",
"module": "commonjs",
"shareHelpers": "internal/tslib.js"
},
{
"extname": ".mjs",
"module": "esnext",
"shareHelpers": "internal/tslib.mjs"
}
],
"projects": ["tsconfig.build.json"]
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3402,9 +3402,9 @@ ts-node@^10.5.0:
v8-compile-cache-lib "^3.0.0"
yn "3.1.1"

"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz":
version "1.1.4"
resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz#cbed459a9e902f5295ec3daaf1c7aa3b10427e55"
"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz":
version "1.1.7"
resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz#52f40adf8b808bd0b633346d11cc4a8aeea465cd"
dependencies:
debug "^4.3.7"
fast-glob "^3.3.2"
Expand Down