Skip to content
Merged
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
20 changes: 20 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'sfcompute/nodes-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v4

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
Comment on lines +10 to +20

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix the problem, a permissions block should be added to the workflow to explicitly define the minimum required permissions. Based on the workflow's functionality, it appears that it primarily checks the release environment and does not perform write operations. Therefore, the contents permission can be set to read. This block should be added at the root level to apply to all jobs in the workflow, unless individual jobs require different permissions.

Suggested changeset 1
.github/workflows/release-doctor.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -1,3 +1,5 @@
+permissions:
+  contents: read
 name: Release Doctor
 on:
   pull_request:
EOF
@@ -1,3 +1,5 @@
permissions:
contents: read
name: Release Doctor
on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0-alpha.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 10
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
config_hash: ba0ad07ed829c1e78fe717ee17542d69
config_hash: e089259785c0c81187a2b25ae04b8459
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

## 0.1.0-alpha.1 (2025-07-17)

Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/sfcompute/nodes-typescript/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)

### Features

* **api:** update via SDK Studio ([f6fbb21](https://github.com/sfcompute/nodes-typescript/commit/f6fbb21ada6d6b605cdfd650ed5691332852bcc6))
* **api:** update via SDK Studio ([37f8f8a](https://github.com/sfcompute/nodes-typescript/commit/37f8f8a31cac296661e763426063b9c551e75fb0))
* **api:** update via SDK Studio ([23e635b](https://github.com/sfcompute/nodes-typescript/commit/23e635bc0930f62db5f3acfcb8216576e0258d21))
* **api:** update via SDK Studio ([5584f02](https://github.com/sfcompute/nodes-typescript/commit/5584f024bdfd4c27b967db665eddbadb3e2acd8b))


### Chores

* **ts:** reorder package.json imports ([f66c637](https://github.com/sfcompute/nodes-typescript/commit/f66c63722ad817b550485d2edcd3d7ba0734d7c7))
* update SDK settings ([3cc7184](https://github.com/sfcompute/nodes-typescript/commit/3cc71841d6328ad119132b2b7a448076393b9660))
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ If you’d like to use the repository from source, you can either install from g
To install via git:

```sh
$ npm install git+ssh://git@github.com:stainless-sdks/sfc-nodes-typescript.git
$ npm install git+ssh://git@github.com:sfcompute/nodes-typescript.git
```

Alternatively, to link a local copy of the repo:

```sh
# Clone
$ git clone https://www.github.com/stainless-sdks/sfc-nodes-typescript
$ cd sfc-nodes-typescript
$ git clone https://www.github.com/sfcompute/nodes-typescript
$ cd nodes-typescript

# With yarn
$ yarn link
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation

```sh
npm install git+ssh://git@github.com:stainless-sdks/sfc-nodes-typescript.git
npm install git+ssh://git@github.com:sfcompute/nodes-typescript.git
```

> [!NOTE]
Expand All @@ -26,7 +26,7 @@ The full API of this library can be found in [api.md](api.md).
import SFCNodes from 'sfc-nodes';

const client = new SFCNodes({
bearerToken: process.env['SFC_BEARER_TOKEN'], // This is the default and can be omitted
apiKey: process.env['SFC_API_KEY'], // This is the default and can be omitted
});

const nodes = await client.nodes.list();
Expand All @@ -41,7 +41,7 @@ This library includes TypeScript definitions for all request params and response
import SFCNodes from 'sfc-nodes';

const client = new SFCNodes({
bearerToken: process.env['SFC_BEARER_TOKEN'], // This is the default and can be omitted
apiKey: process.env['SFC_API_KEY'], // This is the default and can be omitted
});

const nodes: SFCNodes.NodeListResponse = await client.nodes.list();
Expand Down Expand Up @@ -333,7 +333,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sfc-nodes-typescript/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/sfcompute/nodes-typescript/issues) with questions, bugs, or suggestions.

## Requirements

Expand Down
4 changes: 0 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

Types:

- <code><a href="./src/resources/vms/vms.ts">VmListResponse</a></code>
- <code><a href="./src/resources/vms/vms.ts">VmLogsResponse</a></code>
- <code><a href="./src/resources/vms/vms.ts">VmReplaceResponse</a></code>
- <code><a href="./src/resources/vms/vms.ts">VmSSHResponse</a></code>

Methods:

- <code title="get /v0/vms/instances">client.vms.<a href="./src/resources/vms/vms.ts">list</a>() -> VmListResponse</code>
- <code title="get /v0/vms/logs2">client.vms.<a href="./src/resources/vms/vms.ts">logs</a>({ ...params }) -> VmLogsResponse</code>
- <code title="post /v0/vms/replace">client.vms.<a href="./src/resources/vms/vms.ts">replace</a>({ ...params }) -> VmReplaceResponse</code>
- <code title="get /v0/vms/ssh">client.vms.<a href="./src/resources/vms/vms.ts">ssh</a>({ ...params }) -> VmSSHResponse</code>

## Script
Expand Down
18 changes: 18 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

errors=()

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "sfc-nodes",
"version": "0.0.1-alpha.0",
"version": "0.1.0-alpha.1",
"description": "The official TypeScript library for the SFC Nodes API",
"author": "SFC Nodes <hello@sfcompute.com>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:stainless-sdks/sfc-nodes-typescript",
"repository": "github:sfcompute/nodes-typescript",
"license": "Apache-2.0",
"packageManager": "yarn@1.22.22",
"files": [
Expand All @@ -30,7 +30,6 @@
"@swc/jest": "^0.2.29",
"@types/jest": "^29.4.0",
"@types/node": "^20.17.6",
"typescript-eslint": "8.31.1",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
Expand All @@ -44,7 +43,8 @@
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
"imports": {
"sfc-nodes": ".",
Expand Down
64 changes: 64 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"versioning": "prerelease",
"prerelease": true,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": false,
"pull-request-header": "Automated Release PR",
"pull-request-title-pattern": "release: ${version}",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "node",
"extra-files": ["src/version.ts", "README.md"]
}
38 changes: 13 additions & 25 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@ import {
Nodes,
UpdateNode,
} from './resources/nodes';
import {
VmListResponse,
VmLogsParams,
VmLogsResponse,
VmReplaceParams,
VmReplaceResponse,
VmSSHParams,
VmSSHResponse,
Vms,
} from './resources/vms/vms';
import { VmLogsParams, VmLogsResponse, VmSSHParams, VmSSHResponse, Vms } from './resources/vms/vms';
import { type Fetch } from './internal/builtin-types';
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
Expand All @@ -52,9 +43,9 @@ import { isEmptyObj } from './internal/utils/values';

export interface ClientOptions {
/**
* Defaults to process.env['SFC_BEARER_TOKEN'].
* Defaults to process.env['SFC_API_KEY'].
*/
bearerToken?: string | null | undefined;
apiKey?: string | null | undefined;

/**
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
Expand Down Expand Up @@ -129,7 +120,7 @@ export interface ClientOptions {
* API Client for interfacing with the SFC Nodes API.
*/
export class SFCNodes {
bearerToken: string | null;
apiKey: string | null;

baseURL: string;
maxRetries: number;
Expand All @@ -146,7 +137,7 @@ export class SFCNodes {
/**
* API Client for interfacing with the SFC Nodes API.
*
* @param {string | null | undefined} [opts.bearerToken=process.env['SFC_BEARER_TOKEN'] ?? null]
* @param {string | null | undefined} [opts.apiKey=process.env['SFC_API_KEY'] ?? null]
* @param {string} [opts.baseURL=process.env['SFC_NODES_BASE_URL'] ?? https://api.sfcompute.com] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
Expand All @@ -157,11 +148,11 @@ export class SFCNodes {
*/
constructor({
baseURL = readEnv('SFC_NODES_BASE_URL'),
bearerToken = readEnv('SFC_BEARER_TOKEN') ?? null,
apiKey = readEnv('SFC_API_KEY') ?? null,
...opts
}: ClientOptions = {}) {
const options: ClientOptions = {
bearerToken,
apiKey,
...opts,
baseURL: baseURL || `https://api.sfcompute.com`,
};
Expand All @@ -183,7 +174,7 @@ export class SFCNodes {

this._options = options;

this.bearerToken = bearerToken;
this.apiKey = apiKey;
}

/**
Expand All @@ -199,7 +190,7 @@ export class SFCNodes {
logLevel: this.logLevel,
fetch: this.fetch,
fetchOptions: this.fetchOptions,
bearerToken: this.bearerToken,
apiKey: this.apiKey,
...options,
});
return client;
Expand All @@ -217,23 +208,23 @@ export class SFCNodes {
}

protected validateHeaders({ values, nulls }: NullableHeaders) {
if (this.bearerToken && values.get('authorization')) {
if (this.apiKey && values.get('authorization')) {
return;
}
if (nulls.has('authorization')) {
return;
}

throw new Error(
'Could not resolve authentication method. Expected the bearerToken to be set. Or for the "Authorization" headers to be explicitly omitted',
'Could not resolve authentication method. Expected the apiKey to be set. Or for the "Authorization" headers to be explicitly omitted',
);
}

protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
if (this.bearerToken == null) {
if (this.apiKey == null) {
return undefined;
}
return buildHeaders([{ Authorization: `Bearer ${this.bearerToken}` }]);
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
}

/**
Expand Down Expand Up @@ -750,12 +741,9 @@ export declare namespace SFCNodes {

export {
Vms as Vms,
type VmListResponse as VmListResponse,
type VmLogsResponse as VmLogsResponse,
type VmReplaceResponse as VmReplaceResponse,
type VmSSHResponse as VmSSHResponse,
type VmLogsParams as VmLogsParams,
type VmReplaceParams as VmReplaceParams,
type VmSSHParams as VmSSHParams,
};

Expand Down
11 changes: 1 addition & 10 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,4 @@ export {
type NodeExtendParams,
type NodeReleaseParams,
} from './nodes';
export {
Vms,
type VmListResponse,
type VmLogsResponse,
type VmReplaceResponse,
type VmSSHResponse,
type VmLogsParams,
type VmReplaceParams,
type VmSSHParams,
} from './vms/vms';
export { Vms, type VmLogsResponse, type VmSSHResponse, type VmLogsParams, type VmSSHParams } from './vms/vms';
11 changes: 1 addition & 10 deletions src/resources/vms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,4 @@ export {
type ScriptRetrieveResponse,
type ScriptCreateParams,
} from './script';
export {
Vms,
type VmListResponse,
type VmLogsResponse,
type VmReplaceResponse,
type VmSSHResponse,
type VmLogsParams,
type VmReplaceParams,
type VmSSHParams,
} from './vms';
export { Vms, type VmLogsResponse, type VmSSHResponse, type VmLogsParams, type VmSSHParams } from './vms';
Loading