Skip to content

Commit

Permalink
feat(api): manual updates
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed May 22, 2024
1 parent c835e8f commit a9edb6f
Show file tree
Hide file tree
Showing 40 changed files with 233 additions and 236 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://[email protected]:stainless-api/meorphis-test.git
npm install git+ssh://[email protected]:meorphis/meorphis-test.git
```

Alternatively, to link a local copy of the repo:

```bash
# Clone
git clone https://www.github.com/stainless-api/meorphis-test
git clone https://www.github.com/meorphis/meorphis-test
cd meorphis-test

# With yarn
yarn link
cd ../my-package
yarn link meorphis-test-41
yarn link test-repo-1

# With pnpm
pnpm link --global
cd ../my-package
pnpm link -—global meorphis-test-41
pnpm link -—global test-repo-1
```

## Running tests
Expand Down Expand Up @@ -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-api/meorphis-test/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/meorphis/meorphis-test/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Meorphis Test 41
Copyright 2024 Meorphis Test 40

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
67 changes: 32 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Meorphis Test 41 Node API Library
# Meorphis Test 40 Node API Library

[![NPM version](https://img.shields.io/npm/v/meorphis-test-41.svg)](https://npmjs.org/package/meorphis-test-41)
[![NPM version](https://img.shields.io/npm/v/test-repo-1.svg)](https://npmjs.org/package/test-repo-1)

This library provides convenient access to the Meorphis Test 41 REST API from server-side TypeScript or JavaScript.
This library provides convenient access to the Meorphis Test 40 REST API from server-side TypeScript or JavaScript.

The REST API documentation can be found [on help.bolt.com](https://help.bolt.com/api-bolt/). The full API of this library can be found in [api.md](api.md).

Expand All @@ -11,27 +11,24 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
## Installation

```sh
npm install git+ssh://[email protected]:stainless-api/meorphis-test.git
npm install test-repo-1
```

> [!NOTE]
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install meorphis-test-41`
## Usage

The full API of this library can be found in [api.md](api.md).

<!-- prettier-ignore -->
```js
import MeorphisTest41 from 'meorphis-test-41';
import MeorphisTest40 from 'test-repo-1';

const meorphisTest41 = new MeorphisTest41({
const meorphisTest40 = new MeorphisTest40({
environment: 'environment_1', // defaults to 'production'
apiKey: 'My API Key',
});

async function main() {
const accountAccountGetResponse = await meorphisTest41.accounts.accountGet({
const accountAccountGetResponse = await meorphisTest40.accounts.accountGet({
'X-Publishable-Key': 'string',
});

Expand All @@ -47,17 +44,17 @@ This library includes TypeScript definitions for all request params and response

<!-- prettier-ignore -->
```ts
import MeorphisTest41 from 'meorphis-test-41';
import MeorphisTest40 from 'test-repo-1';

const meorphisTest41 = new MeorphisTest41({
const meorphisTest40 = new MeorphisTest40({
environment: 'environment_1', // defaults to 'production'
apiKey: 'My API Key',
});

async function main() {
const params: MeorphisTest41.AccountAccountGetParams = { 'X-Publishable-Key': 'string' };
const accountAccountGetResponse: MeorphisTest41.AccountAccountGetResponse =
await meorphisTest41.accounts.accountGet(params);
const params: MeorphisTest40.AccountAccountGetParams = { 'X-Publishable-Key': 'string' };
const accountAccountGetResponse: MeorphisTest40.AccountAccountGetResponse =
await meorphisTest40.accounts.accountGet(params);
}

main();
Expand All @@ -74,10 +71,10 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const accountAccountGetResponse = await meorphisTest41.accounts
const accountAccountGetResponse = await meorphisTest40.accounts
.accountGet({ 'X-Publishable-Key': 'string' })
.catch(async (err) => {
if (err instanceof MeorphisTest41.APIError) {
if (err instanceof MeorphisTest40.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
Expand Down Expand Up @@ -114,13 +111,13 @@ You can use the `maxRetries` option to configure or disable this:
<!-- prettier-ignore -->
```js
// Configure the default for all requests:
const meorphisTest41 = new MeorphisTest41({
const meorphisTest40 = new MeorphisTest40({
maxRetries: 0, // default is 2
apiKey: 'My API Key',
});

// Or, configure per-request:
await meorphisTest41.accounts.accountGet({ 'X-Publishable-Key': 'string' }, {
await meorphisTest40.accounts.accountGet({ 'X-Publishable-Key': 'string' }, {
maxRetries: 5,
});
```
Expand All @@ -132,13 +129,13 @@ Requests time out after 1 minute by default. You can configure this with a `time
<!-- prettier-ignore -->
```ts
// Configure the default for all requests:
const meorphisTest41 = new MeorphisTest41({
const meorphisTest40 = new MeorphisTest40({
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
apiKey: 'My API Key',
});

// Override per-request:
await meorphisTest41.accounts.accountGet({ 'X-Publishable-Key': 'string' }, {
await meorphisTest40.accounts.accountGet({ 'X-Publishable-Key': 'string' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -157,13 +154,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi

<!-- prettier-ignore -->
```ts
const meorphisTest41 = new MeorphisTest41();
const meorphisTest40 = new MeorphisTest40();

const response = await meorphisTest41.accounts.accountGet({ 'X-Publishable-Key': 'string' }).asResponse();
const response = await meorphisTest40.accounts.accountGet({ 'X-Publishable-Key': 'string' }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: accountAccountGetResponse, response: raw } = await meorphisTest41.accounts
const { data: accountAccountGetResponse, response: raw } = await meorphisTest40.accounts
.accountGet({ 'X-Publishable-Key': 'string' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
Expand Down Expand Up @@ -220,17 +217,17 @@ By default, this library uses `node-fetch` in Node, and expects a global `fetch`

If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
add the following import before your first import `from "MeorphisTest41"`:
add the following import before your first import `from "MeorphisTest40"`:

```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 'meorphis-test-41/shims/web';
import MeorphisTest41 from 'meorphis-test-41';
import 'test-repo-1/shims/web';
import MeorphisTest40 from 'test-repo-1';
```

To do the inverse, add `import "meorphis-test-41/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-api/meorphis-test/tree/main/src/_shims#readme)).
To do the inverse, add `import "test-repo-1/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/meorphis/meorphis-test/tree/main/src/_shims#readme)).

### Logging and middleware

Expand All @@ -239,9 +236,9 @@ which can be used to inspect or alter the `Request` or `Response` before/after e

```ts
import { fetch } from 'undici'; // as one example
import MeorphisTest41 from 'meorphis-test-41';
import MeorphisTest40 from 'test-repo-1';

const client = new MeorphisTest41({
const client = new MeorphisTest40({
fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
console.log('About to make a request', url, init);
const response = await fetch(url, init);
Expand All @@ -266,13 +263,13 @@ import http from 'http';
import { HttpsProxyAgent } from 'https-proxy-agent';

// Configure the default for all requests:
const meorphisTest41 = new MeorphisTest41({
const meorphisTest40 = new MeorphisTest40({
httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
apiKey: 'My API Key',
});

// Override per-request:
await meorphisTest41.accounts.accountGet(
await meorphisTest40.accounts.accountGet(
{ 'X-Publishable-Key': 'string' },
{
httpAgent: new http.Agent({ keepAlive: false }),
Expand All @@ -290,7 +287,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-api/meorphis-test/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/meorphis/meorphis-test/issues) with questions, bugs, or suggestions.

## Requirements

Expand All @@ -299,7 +296,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 MeorphisTest41 from "npm:meorphis-test-41"`.
- Deno v1.28.0 or higher, using `import MeorphisTest40 from "npm:test-repo-1"`.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
Expand Down
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Meorphis Test 41 please follow the respective company's security reporting guidelines.
or products provided by Meorphis Test 40 please follow the respective company's security reporting guidelines.

### Meorphis Test 41 Terms and Policies
### Meorphis Test 40 Terms and Policies

Please contact api-help1@bolt.com for any questions or concerns regarding security of our services.
Please contact api-help2@bolt.com for any questions or concerns regarding security of our services.

---

Expand Down
6 changes: 3 additions & 3 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const config: JestConfigWithTsJest = {
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
},
moduleNameMapper: {
'^meorphis-test-41$': '<rootDir>/src/index.ts',
'^meorphis-test-41/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
'^meorphis-test-41/(.*)$': '<rootDir>/src/$1',
'^test-repo-1$': '<rootDir>/src/index.ts',
'^test-repo-1/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
'^test-repo-1/(.*)$': '<rootDir>/src/$1',
},
modulePathIgnorePatterns: [
'<rootDir>/ecosystem-tests/',
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "meorphis-test-41",
"name": "test-repo-1",
"version": "0.0.1-alpha.0",
"description": "The official TypeScript library for the Meorphis Test 41 API",
"author": "Meorphis Test 41 <api-help1@bolt.com>",
"description": "The official TypeScript library for the Meorphis Test 40 API",
"author": "Meorphis Test 40 <api-help2@bolt.com>",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"type": "commonjs",
"repository": "github:stainless-api/meorphis-test",
"repository": "github:meorphis/meorphis-test",
"license": "Apache-2.0",
"packageManager": "[email protected]",
"files": [
Expand Down Expand Up @@ -63,8 +63,8 @@
"./shims/web.mjs"
],
"imports": {
"meorphis-test-41": ".",
"meorphis-test-41/*": "./src/*"
"test-repo-1": ".",
"test-repo-1/*": "./src/*"
},
"exports": {
"./_shims/auto/*": {
Expand Down
8 changes: 4 additions & 4 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -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 <package root>/resources/foo.js
# This way importing from `"meorphis-test-41/resources/foo"` works
# This way importing from `"test-repo-1/resources/foo"` works
# even with `"moduleResolution": "node"`

rm -rf dist; mkdir dist
Expand All @@ -32,7 +32,7 @@ npm exec tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
# we need to add exports = module.exports = Meorphis Test 41 Node to index.js;
# we need to add exports = module.exports = Meorphis Test 40 Node to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
node scripts/utils/fix-index-exports.cjs
Expand All @@ -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("meorphis-test-41")')
(cd dist && node -e 'import("meorphis-test-41")' --input-type=module)
(cd dist && node -e 'require("test-repo-1")')
(cd dist && node -e 'import("test-repo-1")' --input-type=module)

if command -v deno &> /dev/null && [ -e ./scripts/build-deno ]
then
Expand Down
4 changes: 2 additions & 2 deletions scripts/utils/postprocess-files.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ?? 'meorphis-test-41/';
const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'test-repo-1/';

const distDir =
process.env['DIST_PATH'] ?
Expand Down Expand Up @@ -142,7 +142,7 @@ async function postprocess() {

if (file.endsWith('.d.ts')) {
// work around bad tsc behavior
// if we have `import { type Readable } from 'meorphis-test-41/_shims/index'`,
// if we have `import { type Readable } from 'test-repo-1/_shims/index'`,
// tsc sometimes replaces `Readable` with `import("stream").Readable` inline
// in the output .d.ts
transformed = transformed.replace(/import\("stream"\).Readable/g, 'Readable');
Expand Down
Loading

0 comments on commit a9edb6f

Please sign in to comment.