From 2385c20dfac27fa1376439e43e13162fc7e8197d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:26:51 +0000 Subject: [PATCH] chore: go live (#48) --- .github/workflows/ci.yml | 4 +- .github/workflows/publish-npm.yml | 32 +++++++++++ .github/workflows/release-doctor.yml | 19 +++++++ .release-please-manifest.json | 3 ++ CONTRIBUTING.md | 12 ++--- README.md | 22 ++++---- bin/check-release-environment | 32 +++++++++++ build | 6 +-- jest.config.ts | 6 +-- package.json | 8 +-- release-please-config.json | 67 ++++++++++++++++++++++++ scripts/postprocess-files.cjs | 4 +- src/_shims/README.md | 32 +++++------ src/_shims/index-deno.ts | 2 +- 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 | 8 +-- src/core.ts | 12 ++--- src/index.ts | 2 +- src/resources/accounts.ts | 8 +-- src/resources/transactions.ts | 8 +-- src/version.ts | 2 +- tests/api-resources/accounts.test.ts | 2 +- tests/api-resources/transactions.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 +-- 35 files changed, 251 insertions(+), 96 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/ci.yml b/.github/workflows/ci.yml index 2e6d1af63..401794067 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,10 +2,10 @@ name: CI on: push: branches: - - main + - stainless pull_request: branches: - - main + - stainless jobs: lint: diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 000000000..bdf129238 --- /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/midday-ai/midday/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@v3 + + - 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.MIDDAY_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 000000000..2ecbca379 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,19 @@ +name: Release Doctor +on: + pull_request: + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'midday-ai/midday' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v3 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + NPM_TOKEN: ${{ secrets.MIDDAY_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..67dcd73f9 --- /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 a46857ae9..41805ae7b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,25 +42,25 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```bash -npm install git+ssh://git@github.com:stainless-sdks/midday-node.git +npm install git+ssh://git@github.com:midday-ai/midday.git ``` Alternatively, to link a local copy of the repo: ```bash # Clone -git clone https://www.github.com/stainless-sdks/midday-node -cd midday-node +git clone https://www.github.com/midday-ai/midday +cd midday # With yarn yarn link cd ../my-package -yarn link midday +yarn link @midday/engine-sdk # With pnpm pnpm link --global cd ../my-package -pnpm link -—global midday +pnpm link -—global @midday/engine-sdk ``` ## Running tests @@ -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/midday-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/midday-ai/midday/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 7fc9dee80..4bf4a06da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Midday Node API Library -[![NPM version](https://img.shields.io/npm/v/midday.svg)](https://npmjs.org/package/midday) +[![NPM version](https://img.shields.io/npm/v/@midday/engine-sdk.svg)](https://npmjs.org/package/@midday/engine-sdk) This library provides convenient access to the Midday REST API from server-side TypeScript or JavaScript. @@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/). ## Installation ```sh -npm install midday +npm install @midday/engine-sdk ``` ## Usage @@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md). ```js -import Midday from 'midday'; +import Midday from '@midday/engine-sdk'; const midday = new Midday(); @@ -39,7 +39,7 @@ This library includes TypeScript definitions for all request params and response ```ts -import Midday from 'midday'; +import Midday from '@midday/engine-sdk'; const midday = new Midday(); @@ -206,12 +206,12 @@ add the following import before your first import `from "Midday"`: ```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 'midday/shims/web'; -import Midday from 'midday'; +import '@midday/engine-sdk/shims/web'; +import Midday from '@midday/engine-sdk'; ``` -To do the inverse, add `import "midday/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/tree/main/src/_shims#readme)). +To do the inverse, add `import "@midday/engine-sdk/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/midday-ai/midday/tree/stainless/src/_shims#readme)). ### Logging and middleware @@ -220,7 +220,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 Midday from 'midday'; +import Midday from '@midday/engine-sdk'; const client = new Midday({ fetch: async (url: RequestInfo, init?: RequestInit): Promise => { @@ -267,7 +267,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/midday-node/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/midday-ai/midday/issues) with questions, bugs, or suggestions. ## Requirements @@ -276,7 +276,7 @@ TypeScript >= 4.5 is supported. The following runtimes are supported: - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. -- Deno v1.28.0 or higher, using `import Midday from "npm:midday"`. +- Deno v1.28.0 or higher, using `import Midday from "npm:@midday/engine-sdk"`. - Bun 1.0 or later. - Cloudflare Workers. - Vercel Edge Runtime. diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 000000000..f967a0f8a --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +warnings=() +errors=() + +if [ -z "${NPM_TOKEN}" ]; then + warnings+=("The MIDDAY_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenWarnings=${#warnings[@]} + +if [[ lenWarnings -gt 0 ]]; then + echo -e "Found the following warnings in the release environment:\n" + + for warning in "${warnings[@]}"; do + echo -e "- $warning\n" + done +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/build b/build index 42a82ae9f..f5ae213dd 100755 --- a/build +++ b/build @@ -5,7 +5,7 @@ node scripts/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 `"midday/resources/foo"` works +# This way importing from `"@midday/engine-sdk/resources/foo"` works # even with `"moduleResolution": "node"` rm -rf dist; mkdir dist @@ -44,8 +44,8 @@ node scripts/postprocess-files.cjs # make sure that nothing crashes when we require the output CJS or # import the output ESM -(cd dist && node -e 'require("midday")') -(cd dist && node -e 'import("midday")' --input-type=module) +(cd dist && node -e 'require("@midday/engine-sdk")') +(cd dist && node -e 'import("@midday/engine-sdk")' --input-type=module) if command -v deno &> /dev/null && [ -e ./build-deno ] then diff --git a/jest.config.ts b/jest.config.ts index 745d96f1b..b78189922 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -4,9 +4,9 @@ const config: JestConfigWithTsJest = { preset: 'ts-jest/presets/default-esm', testEnvironment: 'node', moduleNameMapper: { - '^midday$': '/src/index.ts', - '^midday/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', - '^midday/(.*)$': '/src/$1', + '^@midday/engine-sdk$': '/src/index.ts', + '^@midday/engine-sdk/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', + '^@midday/engine-sdk/(.*)$': '/src/$1', }, modulePathIgnorePatterns: [ '/ecosystem-tests/', diff --git a/package.json b/package.json index d93d2c985..7a93613fc 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "midday", + "name": "@midday/engine-sdk", "version": "0.0.1-alpha.0", "description": "The official TypeScript library for the Midday API", "author": "Midday ", "types": "dist/index.d.ts", "main": "dist/index.js", "type": "commonjs", - "repository": "github:stainless-sdks/midday-node", + "repository": "github:midday-ai/midday", "license": "Apache-2.0", "packageManager": "yarn@1.22.21", "files": [ @@ -60,8 +60,8 @@ "./shims/web.mjs" ], "imports": { - "midday": ".", - "midday/*": "./src/*" + "@midday/engine-sdk": ".", + "@midday/engine-sdk/*": "./src/*" }, "exports": { "./_shims/auto/*": { diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..624ed99ec --- /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/scripts/postprocess-files.cjs b/scripts/postprocess-files.cjs index 41b67f56a..227e9a107 100644 --- a/scripts/postprocess-files.cjs +++ b/scripts/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'] ?? 'midday/' +const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? '@midday/engine-sdk/' 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 'midday/_shims/index'`, + // if we have `import { type Readable } from '@midday/engine-sdk/_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 47e3c29d7..a5d207846 100644 --- a/src/_shims/README.md +++ b/src/_shims/README.md @@ -1,9 +1,9 @@ # 👋 Wondering what everything in here does? -`midday` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various +`@midday/engine-sdk` 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, `midday` 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, `@midday/engine-sdk` 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 'midday/shims/node'` -- `import 'midday/shims/web'` +- `import '@midday/engine-sdk/shims/node'` +- `import '@midday/engine-sdk/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 `midday/_shims/registry`. +Runtime shims get installed by calling `setShims` exported by `@midday/engine-sdk/_shims/registry`. -Manually importing `midday/shims/node` or `midday/shims/web`, calls `setShims` with the respective runtime shims. +Manually importing `@midday/engine-sdk/shims/node` or `@midday/engine-sdk/shims/web`, calls `setShims` with the respective runtime shims. -All client code imports shims from `midday/_shims/index`, which: +All client code imports shims from `@midday/engine-sdk/_shims/index`, which: - checks if shims have been set manually -- if not, calls `setShims` with the shims from `midday/_shims/auto/runtime` -- re-exports the installed shims from `midday/_shims/registry`. +- if not, calls `setShims` with the shims from `@midday/engine-sdk/_shims/auto/runtime` +- re-exports the installed shims from `@midday/engine-sdk/_shims/registry`. -`midday/_shims/auto/runtime` exports web runtime shims. -If the `node` export condition is set, the export map replaces it with `midday/_shims/auto/runtime-node`. +`@midday/engine-sdk/_shims/auto/runtime` exports web runtime shims. +If the `node` export condition is set, the export map replaces it with `@midday/engine-sdk/_shims/auto/runtime-node`. ### How it works - Type time -All client code imports shim types from `midday/_shims/index`, which selects the manual types from `midday/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `midday/_shims/auto/types`. +All client code imports shim types from `@midday/engine-sdk/_shims/index`, which selects the manual types from `@midday/engine-sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@midday/engine-sdk/_shims/auto/types`. -`midday/_shims/manual-types` exports an empty namespace. -Manually importing `midday/shims/node` or `midday/shims/web` merges declarations into this empty namespace, so they get picked up by `midday/_shims/index`. +`@midday/engine-sdk/_shims/manual-types` exports an empty namespace. +Manually importing `@midday/engine-sdk/shims/node` or `@midday/engine-sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@midday/engine-sdk/_shims/index`. -`midday/_shims/auto/types` exports web type definitions. -If the `node` export condition is set, the export map replaces it with `midday/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. +`@midday/engine-sdk/_shims/auto/types` exports web type definitions. +If the `node` export condition is set, the export map replaces it with `@midday/engine-sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index e2b6dea84..ccdc8df9e 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/midday-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/midday-ai/midday#file-uploads', ); } diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts index a150ef9c2..760f319b8 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 'midday/_shims/auto/types'; +import * as auto from '@midday/engine-sdk/_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 aaa4a0b06..3653895aa 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('midday/_shims/auto/runtime'); +const auto = require('@midday/engine-sdk/_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 719159367..77607883a 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 'midday/_shims/auto/runtime'; +import * as auto from '@midday/engine-sdk/_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 db81dbc7e..5f22a9fec 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 'midday/shims/node' - * import 'midday/shims/web' + * import '@midday/engine-sdk/shims/node' + * import '@midday/engine-sdk/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 46f0fde55..b082d1e47 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 'midday/shims/${shims.kind}'\` before importing anything else from midday`, + `you must \`import '@midday/engine-sdk/shims/${shims.kind}'\` before importing anything else from @midday/engine-sdk`, ); } if (kind) { - throw new Error(`can't \`import 'midday/shims/${shims.kind}'\` after \`import 'midday/shims/${kind}'\``); + throw new Error( + `can't \`import '@midday/engine-sdk/shims/${shims.kind}'\` after \`import '@midday/engine-sdk/shims/${kind}'\``, + ); } auto = options.auto; kind = shims.kind; diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts index 71ade8964..c27ae0a1c 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 'midday'\`: -- \`import 'midday/shims/node'\` (if you're running on Node) -- \`import 'midday/shims/web'\` (otherwise) + : `Add one of these imports before your first \`import … from '@midday/engine-sdk'\`: +- \`import '@midday/engine-sdk/shims/node'\` (if you're running on Node) +- \`import '@midday/engine-sdk/shims/web'\` (otherwise) `; let _fetch, _Request, _Response, _Headers; @@ -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/midday-node#file-uploads', + 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/midday-ai/midday#file-uploads', ); }, isFsReadStream: (value: any) => false, diff --git a/src/core.ts b/src/core.ts index 72898e223..df7934b28 100644 --- a/src/core.ts +++ b/src/core.ts @@ -97,9 +97,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 'midday'`: - * - `import 'midday/shims/node'` (if you're running on Node) - * - `import 'midday/shims/web'` (otherwise) + * or add one of these imports before your first `import … from '@midday/engine-sdk'`: + * - `import '@midday/engine-sdk/shims/node'` (if you're running on Node) + * - `import '@midday/engine-sdk/shims/web'` (otherwise) */ asResponse(): Promise { return this.responsePromise.then((p) => p.response); @@ -113,9 +113,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 'midday'`: - * - `import 'midday/shims/node'` (if you're running on Node) - * - `import 'midday/shims/web'` (otherwise) + * or add one of these imports before your first `import … from '@midday/engine-sdk'`: + * - `import '@midday/engine-sdk/shims/node'` (if you're running on Node) + * - `import '@midday/engine-sdk/shims/web'` (otherwise) */ async withResponse(): Promise<{ data: T; response: Response }> { const [data, response] = await Promise.all([this.parse(), this.asResponse()]); diff --git a/src/index.ts b/src/index.ts index c90b9a95f..b32433de7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import * as Core from './core'; import * as Errors from './error'; import { type Agent } from './_shims/index'; import * as Uploads from './uploads'; -import * as API from 'midday/resources/index'; +import * as API from '@midday/engine-sdk/resources/index'; export interface ClientOptions { /** diff --git a/src/resources/accounts.ts b/src/resources/accounts.ts index e2bac2aa2..05bc480f8 100644 --- a/src/resources/accounts.ts +++ b/src/resources/accounts.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from 'midday/core'; -import { APIResource } from 'midday/resource'; -import { isRequestOptions } from 'midday/core'; -import * as AccountsAPI from 'midday/resources/accounts'; +import * as Core from '@midday/engine-sdk/core'; +import { APIResource } from '@midday/engine-sdk/resource'; +import { isRequestOptions } from '@midday/engine-sdk/core'; +import * as AccountsAPI from '@midday/engine-sdk/resources/accounts'; export class Accounts extends APIResource { list(query?: AccountListParams, options?: Core.RequestOptions): Core.APIPromise; diff --git a/src/resources/transactions.ts b/src/resources/transactions.ts index c30077df5..a33707623 100644 --- a/src/resources/transactions.ts +++ b/src/resources/transactions.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from 'midday/core'; -import { APIResource } from 'midday/resource'; -import { isRequestOptions } from 'midday/core'; -import * as TransactionsAPI from 'midday/resources/transactions'; +import * as Core from '@midday/engine-sdk/core'; +import { APIResource } from '@midday/engine-sdk/resource'; +import { isRequestOptions } from '@midday/engine-sdk/core'; +import * as TransactionsAPI from '@midday/engine-sdk/resources/transactions'; export class Transactions extends APIResource { list(query?: TransactionListParams, options?: Core.RequestOptions): Core.APIPromise; diff --git a/src/version.ts b/src/version.ts index 55a1a5276..db692bc99 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 diff --git a/tests/api-resources/accounts.test.ts b/tests/api-resources/accounts.test.ts index b218aa668..d355a343f 100644 --- a/tests/api-resources/accounts.test.ts +++ b/tests/api-resources/accounts.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Midday from 'midday'; +import Midday from '@midday/engine-sdk'; import { Response } from 'node-fetch'; const midday = new Midday({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); diff --git a/tests/api-resources/transactions.test.ts b/tests/api-resources/transactions.test.ts index 241e94772..9446540fc 100644 --- a/tests/api-resources/transactions.test.ts +++ b/tests/api-resources/transactions.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import Midday from 'midday'; +import Midday from '@midday/engine-sdk'; import { Response } from 'node-fetch'; const midday = new Midday({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); diff --git a/tests/form.test.ts b/tests/form.test.ts index 9d374f294..c37f4450a 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -1,6 +1,6 @@ -import { multipartFormRequestOptions, createForm } from 'midday/core'; -import { Blob } from 'midday/_shims/index'; -import { toFile } from 'midday'; +import { multipartFormRequestOptions, createForm } from '@midday/engine-sdk/core'; +import { Blob } from '@midday/engine-sdk/_shims/index'; +import { toFile } from '@midday/engine-sdk'; describe('form data validation', () => { test('valid values do not error', async () => { diff --git a/tests/index.test.ts b/tests/index.test.ts index e82e833bb..1a5385080 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 Midday from 'midday'; -import { APIUserAbortError } from 'midday'; -import { Headers } from 'midday/core'; +import Midday from '@midday/engine-sdk'; +import { APIUserAbortError } from '@midday/engine-sdk'; +import { Headers } from '@midday/engine-sdk/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 657cf0395..32d068536 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -1,5 +1,5 @@ -import { createResponseHeaders } from 'midday/core'; -import { Headers } from 'midday/_shims/index'; +import { createResponseHeaders } from '@midday/engine-sdk/core'; +import { Headers } from '@midday/engine-sdk/_shims/index'; describe('response parsing', () => { // TODO: test unicode characters diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index 9ff156113..c26c16665 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,4 +1,4 @@ -import { APIClient } from 'midday/core'; +import { APIClient } from '@midday/engine-sdk/core'; const { stringifyQuery } = APIClient.prototype as any; diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index c3b1ccd8a..e5ae12f96 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; -import { toFile, type ResponseLike } from 'midday/uploads'; -import { File } from 'midday/_shims/index'; +import { toFile, type ResponseLike } from '@midday/engine-sdk/uploads'; +import { File } from '@midday/engine-sdk/_shims/index'; class MyClass { name: string = 'foo'; diff --git a/tsconfig.build.json b/tsconfig.build.json index 61239f361..71b7a9e79 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,8 +5,8 @@ "compilerOptions": { "rootDir": "./dist/src", "paths": { - "midday/*": ["dist/src/*"], - "midday": ["dist/src/index.ts"], + "@midday/engine-sdk/*": ["dist/src/*"], + "@midday/engine-sdk": ["dist/src/index.ts"], "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": false, diff --git a/tsconfig.deno.json b/tsconfig.deno.json index 86311bcaf..bdd4c91f9 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -6,9 +6,9 @@ "rootDir": "./deno", "lib": ["es2020", "DOM"], "paths": { - "midday/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "midday/*": ["deno/*"], - "midday": ["deno/index.ts"], + "@midday/engine-sdk/_shims/auto/*": ["deno/_shims/auto/*-deno"], + "@midday/engine-sdk/*": ["deno/*"], + "@midday/engine-sdk": ["deno/index.ts"], "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": true, diff --git a/tsconfig.json b/tsconfig.json index cc73f98bd..587bb867f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,9 +9,9 @@ "esModuleInterop": true, "baseUrl": "./", "paths": { - "midday/_shims/auto/*": ["src/_shims/auto/*-node"], - "midday/*": ["src/*"], - "midday": ["src/index.ts"], + "@midday/engine-sdk/_shims/auto/*": ["src/_shims/auto/*-node"], + "@midday/engine-sdk/*": ["src/*"], + "@midday/engine-sdk": ["src/index.ts"], "digest-fetch": ["./typings/digest-fetch"] }, "noEmit": true,