From 9e7d1ac28875aca0edda778691dfb9657669603c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:28:14 +0000 Subject: [PATCH 1/3] chore: go live (#1) --- .github/workflows/publish-npm.yml | 32 +++++++++++++ .github/workflows/release-doctor.yml | 22 +++++++++ .release-please-manifest.json | 3 ++ CONTRIBUTING.md | 6 +-- README.md | 6 +-- bin/check-release-environment | 22 +++++++++ package.json | 2 +- release-please-config.json | 67 ++++++++++++++++++++++++++++ src/_shims/index-deno.ts | 2 +- src/_shims/web-runtime.ts | 2 +- src/version.ts | 2 +- 11 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/publish-npm.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .release-please-manifest.json create mode 100644 bin/check-release-environment create mode 100644 release-please-config.json diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..469e114 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,32 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to NPM in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/sentdm/sent-node/actions/workflows/publish-npm.yml +name: Publish NPM +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: | + yarn install + + - name: Publish to NPM + run: | + bash ./bin/publish-npm + env: + NPM_TOKEN: ${{ secrets.SENT_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..6a6b3ae --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'sentdm/sent-node' && (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: + NPM_TOKEN: ${{ secrets.SENT_NPM_TOKEN || secrets.NPM_TOKEN }} + diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..67dcd73 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1-alpha.0" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81420b9..a4e425f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,14 +42,14 @@ 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/sent-node.git +$ npm install git+ssh://git@github.com:sentdm/sent-node.git ``` Alternatively, to link a local copy of the repo: ```sh # Clone -$ git clone https://www.github.com/stainless-sdks/sent-node +$ git clone https://www.github.com/sentdm/sent-node $ cd sent-node # With yarn @@ -99,7 +99,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/stainless-sdks/sent-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/sentdm/sent-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index be9bed1..0e05d64 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/). ## Installation ```sh -npm install git+ssh://git@github.com:stainless-sdks/sent-node.git +npm install git+ssh://git@github.com:sentdm/sent-node.git ``` > [!NOTE] @@ -212,7 +212,7 @@ import Sent from 'sent'; ``` To do the inverse, add `import "sent/shims/node"` (which does import polyfills). -This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/stainless-sdks/sent-node/tree/main/src/_shims#readme)). +This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/sentdm/sent-node/tree/main/src/_shims#readme)). ### Logging and middleware @@ -268,7 +268,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/sent-node/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/sentdm/sent-node/issues) with questions, bugs, or suggestions. ## Requirements diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..16465d8 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${NPM_TOKEN}" ]; then + errors+=("The SENT_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +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!" + diff --git a/package.json b/package.json index 098ac89..ddc4ac3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", - "repository": "github:stainless-sdks/sent-node", + "repository": "github:sentdm/sent-node", "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..624ed99 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "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" + ] +} diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index faed8ee..3624181 100644 --- a/src/_shims/index-deno.ts +++ b/src/_shims/index-deno.ts @@ -79,7 +79,7 @@ export function getDefaultAgent(url: string) { } export function fileFromPath() { throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/stainless-sdks/sent-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/sentdm/sent-node#file-uploads', ); } diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts index f6c6720..3340238 100644 --- a/src/_shims/web-runtime.ts +++ b/src/_shims/web-runtime.ts @@ -95,7 +95,7 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean } getDefaultAgent: (url: string) => undefined, fileFromPath: () => { throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/stainless-sdks/sent-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/sentdm/sent-node#file-uploads', ); }, isFsReadStream: (value: any) => false, diff --git a/src/version.ts b/src/version.ts index 55a1a52..db692bc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.0.1-alpha.0'; +export const VERSION = '0.0.1-alpha.0'; // x-release-please-version From 637e82433f081d79e7d8172aa8901731eec5a050 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:40:28 +0000 Subject: [PATCH 2/3] chore: update SDK settings (#3) --- CONTRIBUTING.md | 4 +-- README.md | 19 +++++------ jest.config.ts | 6 ++-- package.json | 6 ++-- scripts/build | 6 ++-- scripts/utils/postprocess-files.cjs | 4 +-- src/_shims/README.md | 32 +++++++++---------- src/_shims/index.d.ts | 2 +- src/_shims/index.js | 2 +- src/_shims/index.mjs | 2 +- src/_shims/manual-types.d.ts | 4 +-- src/_shims/registry.ts | 6 ++-- src/_shims/web-runtime.ts | 6 ++-- src/core.ts | 12 +++---- tests/api-resources/contacts/contacts.test.ts | 2 +- tests/api-resources/contacts/id.test.ts | 2 +- tests/api-resources/contacts/phone.test.ts | 2 +- tests/api-resources/customers.test.ts | 2 +- tests/api-resources/messages.test.ts | 2 +- tests/api-resources/sms.test.ts | 2 +- tests/api-resources/templates.test.ts | 2 +- tests/api-resources/whatsapp.test.ts | 2 +- tests/form.test.ts | 6 ++-- tests/index.test.ts | 6 ++-- tests/responses.test.ts | 4 +-- tests/stringifyQuery.test.ts | 2 +- tests/uploads.test.ts | 4 +-- tsconfig.build.json | 4 +-- tsconfig.deno.json | 6 ++-- tsconfig.json | 6 ++-- 30 files changed, 82 insertions(+), 83 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a4e425f..4780d61 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,12 +55,12 @@ $ cd sent-node # With yarn $ yarn link $ cd ../my-package -$ yarn link sent +$ yarn link @sent/node # With pnpm $ pnpm link --global $ cd ../my-package -$ pnpm link -—global sent +$ pnpm link -—global @sent/node ``` ## Running tests diff --git a/README.md b/README.md index 0e05d64..c02398a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sent Node API Library -[![NPM version](https://img.shields.io/npm/v/sent.svg)](https://npmjs.org/package/sent) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/sent) +[![NPM version](https://img.shields.io/npm/v/@sent/node.svg)](https://npmjs.org/package/@sent/node) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@sent/node) This library provides convenient access to the Sent REST API from server-side TypeScript or JavaScript. @@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainlessapi.com/). ## Installation ```sh -npm install git+ssh://git@github.com:sentdm/sent-node.git +npm install @sent/node ``` -> [!NOTE] -> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install sent` - ## Usage The full API of this library can be found in [api.md](api.md). ```js -import Sent from 'sent'; +import Sent from '@sent/node'; const client = new Sent(); @@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response ```ts -import Sent from 'sent'; +import Sent from '@sent/node'; const client = new Sent(); @@ -207,11 +204,11 @@ add the following import before your first import `from "Sent"`: ```ts // Tell TypeScript and the package to use the global web fetch instead of node-fetch. // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed. -import 'sent/shims/web'; -import Sent from 'sent'; +import '@sent/node/shims/web'; +import Sent from '@sent/node'; ``` -To do the inverse, add `import "sent/shims/node"` (which does import polyfills). +To do the inverse, add `import "@sent/node/shims/node"` (which does import polyfills). This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/sentdm/sent-node/tree/main/src/_shims#readme)). ### Logging and middleware @@ -221,7 +218,7 @@ which can be used to inspect or alter the `Request` or `Response` before/after e ```ts import { fetch } from 'undici'; // as one example -import Sent from 'sent'; +import Sent from '@sent/node'; const client = new Sent({ fetch: async (url: RequestInfo, init?: RequestInit): Promise => { diff --git a/jest.config.ts b/jest.config.ts index a6f9317..afc18f0 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -7,9 +7,9 @@ const config: JestConfigWithTsJest = { '^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }], }, moduleNameMapper: { - '^sent$': '/src/index.ts', - '^sent/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', - '^sent/(.*)$': '/src/$1', + '^@sent/node$': '/src/index.ts', + '^@sent/node/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', + '^@sent/node/(.*)$': '/src/$1', }, modulePathIgnorePatterns: [ '/ecosystem-tests/', diff --git a/package.json b/package.json index ddc4ac3..6c48c63 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "sent", + "name": "@sent/node", "version": "0.0.1-alpha.0", "description": "The official TypeScript library for the Sent API", "author": "Sent ", @@ -60,8 +60,8 @@ "./shims/web.mjs" ], "imports": { - "sent": ".", - "sent/*": "./src/*" + "@sent/node": ".", + "@sent/node/*": "./src/*" }, "exports": { "./_shims/auto/*": { diff --git a/scripts/build b/scripts/build index 68e7837..e5ab626 100755 --- a/scripts/build +++ b/scripts/build @@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs # Build into dist and will publish the package from there, # so that src/resources/foo.ts becomes /resources/foo.js -# This way importing from `"sent/resources/foo"` works +# This way importing from `"@sent/node/resources/foo"` works # even with `"moduleResolution": "node"` rm -rf dist; mkdir dist @@ -47,8 +47,8 @@ node scripts/utils/postprocess-files.cjs # make sure that nothing crashes when we require the output CJS or # import the output ESM -(cd dist && node -e 'require("sent")') -(cd dist && node -e 'import("sent")' --input-type=module) +(cd dist && node -e 'require("@sent/node")') +(cd dist && node -e 'import("@sent/node")' --input-type=module) if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] then diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index 6121383..bc76423 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); const { parse } = require('@typescript-eslint/parser'); -const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'sent/'; +const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? '@sent/node/'; const distDir = process.env['DIST_PATH'] ? @@ -142,7 +142,7 @@ async function postprocess() { if (file.endsWith('.d.ts')) { // work around bad tsc behavior - // if we have `import { type Readable } from 'sent/_shims/index'`, + // if we have `import { type Readable } from '@sent/node/_shims/index'`, // tsc sometimes replaces `Readable` with `import("stream").Readable` inline // in the output .d.ts transformed = transformed.replace(/import\("stream"\).Readable/g, 'Readable'); diff --git a/src/_shims/README.md b/src/_shims/README.md index 39e3d90..09f2418 100644 --- a/src/_shims/README.md +++ b/src/_shims/README.md @@ -1,9 +1,9 @@ # 👋 Wondering what everything in here does? -`sent` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various +`@sent/node` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM). -To do this, `sent` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node. +To do this, `@sent/node` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node. It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to automatically select the correct shims for each environment. However, conditional exports are a fairly new @@ -15,32 +15,32 @@ getting the wrong raw `Response` type from `.asResponse()`, for example. The user can work around these issues by manually importing one of: -- `import 'sent/shims/node'` -- `import 'sent/shims/web'` +- `import '@sent/node/shims/node'` +- `import '@sent/node/shims/web'` All of the code here in `_shims` handles selecting the automatic default shims or manual overrides. ### How it works - Runtime -Runtime shims get installed by calling `setShims` exported by `sent/_shims/registry`. +Runtime shims get installed by calling `setShims` exported by `@sent/node/_shims/registry`. -Manually importing `sent/shims/node` or `sent/shims/web`, calls `setShims` with the respective runtime shims. +Manually importing `@sent/node/shims/node` or `@sent/node/shims/web`, calls `setShims` with the respective runtime shims. -All client code imports shims from `sent/_shims/index`, which: +All client code imports shims from `@sent/node/_shims/index`, which: - checks if shims have been set manually -- if not, calls `setShims` with the shims from `sent/_shims/auto/runtime` -- re-exports the installed shims from `sent/_shims/registry`. +- if not, calls `setShims` with the shims from `@sent/node/_shims/auto/runtime` +- re-exports the installed shims from `@sent/node/_shims/registry`. -`sent/_shims/auto/runtime` exports web runtime shims. -If the `node` export condition is set, the export map replaces it with `sent/_shims/auto/runtime-node`. +`@sent/node/_shims/auto/runtime` exports web runtime shims. +If the `node` export condition is set, the export map replaces it with `@sent/node/_shims/auto/runtime-node`. ### How it works - Type time -All client code imports shim types from `sent/_shims/index`, which selects the manual types from `sent/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `sent/_shims/auto/types`. +All client code imports shim types from `@sent/node/_shims/index`, which selects the manual types from `@sent/node/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@sent/node/_shims/auto/types`. -`sent/_shims/manual-types` exports an empty namespace. -Manually importing `sent/shims/node` or `sent/shims/web` merges declarations into this empty namespace, so they get picked up by `sent/_shims/index`. +`@sent/node/_shims/manual-types` exports an empty namespace. +Manually importing `@sent/node/shims/node` or `@sent/node/shims/web` merges declarations into this empty namespace, so they get picked up by `@sent/node/_shims/index`. -`sent/_shims/auto/types` exports web type definitions. -If the `node` export condition is set, the export map replaces it with `sent/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. +`@sent/node/_shims/auto/types` exports web type definitions. +If the `node` export condition is set, the export map replaces it with `@sent/node/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts index 2c8f369..107d461 100644 --- a/src/_shims/index.d.ts +++ b/src/_shims/index.d.ts @@ -2,7 +2,7 @@ * Disclaimer: modules in _shims aren't intended to be imported by SDK users. */ import { manual } from './manual-types'; -import * as auto from 'sent/_shims/auto/types'; +import * as auto from '@sent/node/_shims/auto/types'; import { type RequestOptions } from '../core'; type SelectType = unknown extends Manual ? Auto : Manual; diff --git a/src/_shims/index.js b/src/_shims/index.js index 55c8f63..e42d919 100644 --- a/src/_shims/index.js +++ b/src/_shims/index.js @@ -2,7 +2,7 @@ * Disclaimer: modules in _shims aren't intended to be imported by SDK users. */ const shims = require('./registry'); -const auto = require('sent/_shims/auto/runtime'); +const auto = require('@sent/node/_shims/auto/runtime'); if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); for (const property of Object.keys(shims)) { Object.defineProperty(exports, property, { diff --git a/src/_shims/index.mjs b/src/_shims/index.mjs index 35b3969..3ecc65e 100644 --- a/src/_shims/index.mjs +++ b/src/_shims/index.mjs @@ -2,6 +2,6 @@ * Disclaimer: modules in _shims aren't intended to be imported by SDK users. */ import * as shims from './registry.mjs'; -import * as auto from 'sent/_shims/auto/runtime'; +import * as auto from '@sent/node/_shims/auto/runtime'; if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); export * from './registry.mjs'; diff --git a/src/_shims/manual-types.d.ts b/src/_shims/manual-types.d.ts index 8d09eee..f2d4fdc 100644 --- a/src/_shims/manual-types.d.ts +++ b/src/_shims/manual-types.d.ts @@ -4,8 +4,8 @@ /** * Types will get added to this namespace when you import one of the following: * - * import 'sent/shims/node' - * import 'sent/shims/web' + * import '@sent/node/shims/node' + * import '@sent/node/shims/web' * * Importing more than one will cause type and runtime errors. */ diff --git a/src/_shims/registry.ts b/src/_shims/registry.ts index badaca9..e8ae322 100644 --- a/src/_shims/registry.ts +++ b/src/_shims/registry.ts @@ -42,11 +42,13 @@ export let isFsReadStream: Shims['isFsReadStream'] | undefined = undefined; export function setShims(shims: Shims, options: { auto: boolean } = { auto: false }) { if (auto) { throw new Error( - `you must \`import 'sent/shims/${shims.kind}'\` before importing anything else from sent`, + `you must \`import '@sent/node/shims/${shims.kind}'\` before importing anything else from @sent/node`, ); } if (kind) { - throw new Error(`can't \`import 'sent/shims/${shims.kind}'\` after \`import 'sent/shims/${kind}'\``); + throw new Error( + `can't \`import '@sent/node/shims/${shims.kind}'\` after \`import '@sent/node/shims/${kind}'\``, + ); } auto = options.auto; kind = shims.kind; diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts index 3340238..0585369 100644 --- a/src/_shims/web-runtime.ts +++ b/src/_shims/web-runtime.ts @@ -9,9 +9,9 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean } const recommendation = manuallyImported ? `You may need to use polyfills` - : `Add one of these imports before your first \`import … from 'sent'\`: -- \`import 'sent/shims/node'\` (if you're running on Node) -- \`import 'sent/shims/web'\` (otherwise) + : `Add one of these imports before your first \`import … from '@sent/node'\`: +- \`import '@sent/node/shims/node'\` (if you're running on Node) +- \`import '@sent/node/shims/web'\` (otherwise) `; let _fetch, _Request, _Response, _Headers; diff --git a/src/core.ts b/src/core.ts index cba9306..9b44a7f 100644 --- a/src/core.ts +++ b/src/core.ts @@ -99,9 +99,9 @@ export class APIPromise extends Promise { * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` if you can, - * or add one of these imports before your first `import … from 'sent'`: - * - `import 'sent/shims/node'` (if you're running on Node) - * - `import 'sent/shims/web'` (otherwise) + * or add one of these imports before your first `import … from '@sent/node'`: + * - `import '@sent/node/shims/node'` (if you're running on Node) + * - `import '@sent/node/shims/web'` (otherwise) */ asResponse(): Promise { return this.responsePromise.then((p) => p.response); @@ -115,9 +115,9 @@ export class APIPromise extends Promise { * * 👋 Getting the wrong TypeScript type for `Response`? * Try setting `"moduleResolution": "NodeNext"` if you can, - * or add one of these imports before your first `import … from 'sent'`: - * - `import 'sent/shims/node'` (if you're running on Node) - * - `import 'sent/shims/web'` (otherwise) + * or add one of these imports before your first `import … from '@sent/node'`: + * - `import '@sent/node/shims/node'` (if you're running on Node) + * - `import '@sent/node/shims/web'` (otherwise) */ async withResponse(): Promise<{ data: T; response: Response }> { const [data, response] = await Promise.all([this.parse(), this.asResponse()]); diff --git a/tests/api-resources/contacts/contacts.test.ts b/tests/api-resources/contacts/contacts.test.ts index 19e2950..fcac05e 100644 --- a/tests/api-resources/contacts/contacts.test.ts +++ b/tests/api-resources/contacts/contacts.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/contacts/id.test.ts b/tests/api-resources/contacts/id.test.ts index 3f356af..4b9b298 100644 --- a/tests/api-resources/contacts/id.test.ts +++ b/tests/api-resources/contacts/id.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/contacts/phone.test.ts b/tests/api-resources/contacts/phone.test.ts index 25db392..ab998b1 100644 --- a/tests/api-resources/contacts/phone.test.ts +++ b/tests/api-resources/contacts/phone.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/customers.test.ts b/tests/api-resources/customers.test.ts index 7955fc5..1ac58eb 100644 --- a/tests/api-resources/customers.test.ts +++ b/tests/api-resources/customers.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/messages.test.ts b/tests/api-resources/messages.test.ts index a50c3ed..8e3159f 100644 --- a/tests/api-resources/messages.test.ts +++ b/tests/api-resources/messages.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/sms.test.ts b/tests/api-resources/sms.test.ts index 6df652f..4a82e55 100644 --- a/tests/api-resources/sms.test.ts +++ b/tests/api-resources/sms.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/templates.test.ts b/tests/api-resources/templates.test.ts index 8ea1703..16ffa95 100644 --- a/tests/api-resources/templates.test.ts +++ b/tests/api-resources/templates.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/api-resources/whatsapp.test.ts b/tests/api-resources/whatsapp.test.ts index 4fbd952..c58a5d6 100644 --- a/tests/api-resources/whatsapp.test.ts +++ b/tests/api-resources/whatsapp.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; +import Sent from '@sent/node'; import { Response } from 'node-fetch'; const client = new Sent({ diff --git a/tests/form.test.ts b/tests/form.test.ts index b7f7b88..a196511 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -1,6 +1,6 @@ -import { multipartFormRequestOptions, createForm } from 'sent/core'; -import { Blob } from 'sent/_shims/index'; -import { toFile } from 'sent'; +import { multipartFormRequestOptions, createForm } from '@sent/node/core'; +import { Blob } from '@sent/node/_shims/index'; +import { toFile } from '@sent/node'; describe('form data validation', () => { test('valid values do not error', async () => { diff --git a/tests/index.test.ts b/tests/index.test.ts index a712430..df64e8b 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Sent from 'sent'; -import { APIUserAbortError } from 'sent'; -import { Headers } from 'sent/core'; +import Sent from '@sent/node'; +import { APIUserAbortError } from '@sent/node'; +import { Headers } from '@sent/node/core'; import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch'; describe('instantiate client', () => { diff --git a/tests/responses.test.ts b/tests/responses.test.ts index 7e063e8..cce2861 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -1,5 +1,5 @@ -import { createResponseHeaders } from 'sent/core'; -import { Headers } from 'sent/_shims/index'; +import { createResponseHeaders } from '@sent/node/core'; +import { Headers } from '@sent/node/_shims/index'; describe('response parsing', () => { // TODO: test unicode characters diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index 347c22c..8a6fb87 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { Sent } from 'sent'; +import { Sent } from '@sent/node'; const { stringifyQuery } = Sent.prototype as any; diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 4128f37..2f4a6f3 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; -import { toFile, type ResponseLike } from 'sent/uploads'; -import { File } from 'sent/_shims/index'; +import { toFile, type ResponseLike } from '@sent/node/uploads'; +import { File } from '@sent/node/_shims/index'; class MyClass { name: string = 'foo'; diff --git a/tsconfig.build.json b/tsconfig.build.json index b2f2d62..5488377 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,8 +5,8 @@ "compilerOptions": { "rootDir": "./dist/src", "paths": { - "sent/*": ["dist/src/*"], - "sent": ["dist/src/index.ts"], + "@sent/node/*": ["dist/src/*"], + "@sent/node": ["dist/src/index.ts"], }, "noEmit": false, "declaration": true, diff --git a/tsconfig.deno.json b/tsconfig.deno.json index 6d3e23d..0232d2d 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -6,9 +6,9 @@ "rootDir": "./deno", "lib": ["es2020", "DOM"], "paths": { - "sent/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "sent/*": ["deno/*"], - "sent": ["deno/index.ts"], + "@sent/node/_shims/auto/*": ["deno/_shims/auto/*-deno"], + "@sent/node/*": ["deno/*"], + "@sent/node": ["deno/index.ts"], }, "noEmit": true, "declaration": true, diff --git a/tsconfig.json b/tsconfig.json index 64f10e1..98662bb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,9 +9,9 @@ "esModuleInterop": true, "baseUrl": "./", "paths": { - "sent/_shims/auto/*": ["src/_shims/auto/*-node"], - "sent/*": ["src/*"], - "sent": ["src/index.ts"], + "@sent/node/_shims/auto/*": ["src/_shims/auto/*-node"], + "@sent/node/*": ["src/*"], + "@sent/node": ["src/index.ts"], }, "noEmit": true, From 974d4443b134fd161b186b6e60a8c02844c9c611 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:40:40 +0000 Subject: [PATCH 3/3] release: 0.1.0-alpha.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 67dcd73..d7a8735 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1-alpha.0" + ".": "0.1.0-alpha.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c1e5283 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +## 0.1.0-alpha.1 (2024-10-31) + +Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/sentdm/sent-node/compare/v0.0.1-alpha.0...v0.1.0-alpha.1) + +### Features + +* **api:** update via SDK Studio ([e1371cc](https://github.com/sentdm/sent-node/commit/e1371cc5662176feb85abd05b4a2a37e3aaa0960)) +* **api:** update via SDK Studio ([28ff778](https://github.com/sentdm/sent-node/commit/28ff77860ad89c13f096c3c3d2007dce1f9bac65)) + + +### Chores + +* go live ([#1](https://github.com/sentdm/sent-node/issues/1)) ([9e7d1ac](https://github.com/sentdm/sent-node/commit/9e7d1ac28875aca0edda778691dfb9657669603c)) +* update SDK settings ([#3](https://github.com/sentdm/sent-node/issues/3)) ([637e824](https://github.com/sentdm/sent-node/commit/637e82433f081d79e7d8172aa8901731eec5a050)) diff --git a/package.json b/package.json index 6c48c63..780b555 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sent/node", - "version": "0.0.1-alpha.0", + "version": "0.1.0-alpha.1", "description": "The official TypeScript library for the Sent API", "author": "Sent ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index db692bc..b0bfd9e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.0.1-alpha.0'; // x-release-please-version +export const VERSION = '0.1.0-alpha.1'; // x-release-please-version