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
2 changes: 2 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Create releases
on:
schedule:
- cron: '0 5 * * *' # every day at 5am UTC
push:
branches:
- main
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"arrowParens": "always",
"experimentalTernaries": true,
"printWidth": 110,
"singleQuote": true,
"trailingComma": "all"
}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.33.0"
".": "1.33.1"
}
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## 1.33.1 (2023-12-26)

Full Changelog: [v1.33.0...v1.33.1](https://github.com/orbcorp/orb-node/compare/v1.33.0...v1.33.1)

### Bug Fixes

* use brackets instead of commas for array query params ([#66](https://github.com/orbcorp/orb-node/issues/66)) ([1bb118c](https://github.com/orbcorp/orb-node/commit/1bb118cf59d4aace1adcdb8f809f3d0daedf0fb2))


### Chores

* **ci:** run release workflow once per day ([#59](https://github.com/orbcorp/orb-node/issues/59)) ([719bda1](https://github.com/orbcorp/orb-node/commit/719bda1f38042a018828838f1a7839845d421226))
* **deps:** update dependency ts-jest to v29.1.1 ([#60](https://github.com/orbcorp/orb-node/issues/60)) ([a011800](https://github.com/orbcorp/orb-node/commit/a0118008c2f18ad16ae93222053d98e40739cdd7))
* **deps:** update jest ([#61](https://github.com/orbcorp/orb-node/issues/61)) ([7c35eb0](https://github.com/orbcorp/orb-node/commit/7c35eb094855e67758614435cec8ebea8ef71d80))
* **internal:** minor updates to pagination ([#64](https://github.com/orbcorp/orb-node/issues/64)) ([993b3d0](https://github.com/orbcorp/orb-node/commit/993b3d0337dce7158ddf3a14668d0ff72af6c8c9))
* update dependencies ([#58](https://github.com/orbcorp/orb-node/issues/58)) ([cea16a0](https://github.com/orbcorp/orb-node/commit/cea16a0f158912dcf840cda52e2fc1d5d1063ee8))


### Documentation

* **api:** updates ([#62](https://github.com/orbcorp/orb-node/issues/62)) ([f601aa0](https://github.com/orbcorp/orb-node/commit/f601aa0d60bb6429259383ec6b57dabf3c3410cf))
* avoid normalizing trailing space ([#56](https://github.com/orbcorp/orb-node/issues/56)) ([e127ac0](https://github.com/orbcorp/orb-node/commit/e127ac017cb0e60eceacf7a3ce71b437067d6065))
* reformat README.md ([#65](https://github.com/orbcorp/orb-node/issues/65)) ([390cb50](https://github.com/orbcorp/orb-node/commit/390cb507d8f45277374b9bc98d70a27041a4db8b))


### Refactors

* write jest config in typescript ([#63](https://github.com/orbcorp/orb-node/issues/63)) ([43d6bf7](https://github.com/orbcorp/orb-node/commit/43d6bf7abf0b7c7adbb337183944641fddf228ae))

## 1.33.0 (2023-12-11)

Full Changelog: [v1.32.0...v1.33.0](https://github.com/orbcorp/orb-node/compare/v1.32.0...v1.33.0)
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ yarn add orb-billing

The full API of this library can be found in [api.md](https://www.github.com/orbcorp/orb-node/blob/main/api.md).

<!-- prettier-ignore -->
```js
import Orb from 'orb-billing';

Expand All @@ -38,6 +39,7 @@ main();

This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:

<!-- prettier-ignore -->
```ts
import Orb from 'orb-billing';

Expand All @@ -61,6 +63,7 @@ When the library is unable to connect to the API,
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
a subclass of `APIError` will be thrown:

<!-- prettier-ignore -->
```ts
async function main() {
const customer = await orb.customers
Expand Down Expand Up @@ -173,6 +176,7 @@ The "raw" `Response` returned by `fetch()` can be accessed through the `.asRespo

You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.

<!-- prettier-ignore -->
```ts
const orb = new Orb();

Expand All @@ -197,12 +201,11 @@ If you would prefer to use a global, web-standards-compliant `fetch` function ev
(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 "Orb"`:

<!-- prettier-ignore -->
```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 "orb-billing/shims/web";
import Orb from "orb-billing";
import 'orb-billing/shims/web';
import Orb from 'orb-billing';
```

To do the inverse, add `import "orb-billing/shims/node"` (which does import polyfills).
Expand Down
9 changes: 6 additions & 3 deletions jest.config.js → jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
import type { JestConfigWithTsJest } from 'ts-jest';

const config: JestConfigWithTsJest = {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
moduleNameMapper: {
'^orb-billing$': '<rootDir>/src/index.ts',
Expand All @@ -14,3 +15,5 @@ module.exports = {
'<rootDir>/deno_tests/',
],
};

export default config;
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orb-billing",
"version": "1.33.0",
"version": "1.33.1",
"description": "The official TypeScript library for the Orb API",
"author": "Orb <team@withorb.com>",
"types": "dist/index.d.ts",
Expand All @@ -15,7 +15,7 @@
"build": "bash ./build",
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if [ $(basename $(dirname $PWD)) = 'node_modules' ]; then npm run build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "eslint --ext ts,js .",
Expand All @@ -39,10 +39,10 @@
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"jest": "^29.4.0",
"prettier": "rattrayalex/prettier#postfix-ternaries",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class APIError extends OrbError {
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
const msg =
error?.message ?
typeof error.message === 'string' ? error.message
typeof error.message === 'string' ?
error.message
: JSON.stringify(error.message)
: error ? JSON.stringify(error)
: message;
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class Orb extends Core.APIClient {
}

protected override stringifyQuery(query: Record<string, unknown>): string {
return qs.stringify(query, { arrayFormat: 'comma' });
return qs.stringify(query, { arrayFormat: 'brackets' });
}

static Orb = this;
Expand Down
15 changes: 11 additions & 4 deletions src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
super(client, response, body, options);

this.data = body.data;
this.data = body.data || [];
this.pagination_metadata = body.pagination_metadata;
}

getPaginatedItems(): Item[] {
return this.data;
return this.data ?? [];
}

// @deprecated Please use `nextPageInfo()` instead
Expand All @@ -56,8 +56,15 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
}

nextPageInfo(): PageInfo | null {
if (!this.pagination_metadata.next_cursor) return null;
const cursor = this.pagination_metadata.next_cursor;
if (!cursor) {
return null;
}

return { params: { cursor: this.pagination_metadata.next_cursor } };
return {
params: {
cursor: cursor,
},
};
}
}
16 changes: 8 additions & 8 deletions src/resources/customers/customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export interface Customer {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -424,7 +424,7 @@ export namespace Customer {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -717,7 +717,7 @@ export interface CustomerCreateParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -860,7 +860,7 @@ export namespace CustomerCreateParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1130,7 +1130,7 @@ export interface CustomerUpdateParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1266,7 +1266,7 @@ export namespace CustomerUpdateParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1546,7 +1546,7 @@ export interface CustomerUpdateByExternalIDParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down Expand Up @@ -1682,7 +1682,7 @@ export namespace CustomerUpdateByExternalIDParams {
* | Netherlands | `eu_vat` | European VAT number |
* | New Zealand | `nz_gst` | New Zealand GST number |
* | Norway | `no_vat` | Norwegian VAT number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Philippines | `ph_tin ` | Philippines Tax Identification Number |
* | Poland | `eu_vat` | European VAT number |
* | Portugal | `eu_vat` | European VAT number |
* | Romania | `eu_vat` | European VAT number |
Expand Down
2 changes: 0 additions & 2 deletions src/resources/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ export class Events extends APIResource {
* - `event_ids`: This is an explicit array of IDs to filter by. Note that an
* event's ID is the `idempotency_key` that was originally used for ingestion.
*
* By default, Orb does not return _deprecated_ events in this endpoint.
*
* By default, Orb will not throw a `404` if no events matched, Orb will return an
* empty array for `data` instead.
*/
Expand Down
Loading