1.4.6 • Published 1 year ago

lightstands-js v1.4.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

lightstands-js

TypeScript/JavaScript LightStands client library

Installation

  • pnpm add lightstands-js
  • yarn add lightstands-js
  • npm i --save lightstands-js

Moving to fetch()

As of 1.4.4, new functions will be written using the Fetch API and the Streams API. There are not changes to the compatibility table.

The Fetch API is natively supported by browsers and provides a clean interface for reqesting remote resources. The axios library, which is the original library used, still uses XMLHTTPRequest because the Fetch API lacks the ability to track upload progress. Since lightstands-js rarely need this feature and the Fetch API has a better performance, we decided to move this step.

Old functions introduced before 1.4.4 still use the code generated by openapi-typescript-codegen (using axios) in 1.4.4. We will start moving old functions with the Fetch API in 1.5.0, and remove all generated code and axios in major version 2. This will be a siginificant reduction in the size of this library's package.

Usage

LightStandsJS is designed in functional programming pattern for better tree-shaking support.

Most supported endpoint will end up a function, and expect a ClientConfig as the first argument.

import { ClientConfig, get204, aeither } from 'lightstands-js';

const client: ClientConfig = {
  endpointBase: 'https://api.lightstands.xyz/moutsea/',
  clientId: '<client id>',
  clientSecret: '<client secret>',
};

aeither(
  {
    left: (e) => console.log('failed to connect LightStands'),
    right: (v) => v,
  },
  get204(client),
);

It's very recommended to use TypeScript since the whole library is bulit around TypeScript type system.

Contributing

You should clone submodules when cloning this repository:

git clone --recursive https://github.com/lightstands/lightstands-js.git

If you already clone without submodules, use git submodule update to clone submodules.

Please install pre-commit hook by pre-commit before doing any contribution:

pre-commit install

Maintainer: Rubicon <rubicon lightstands.xyz> (Replace the space with at symbol)

Versioning

This library uses a strange versioning semantic, see Versioning LightStands-JS.

The version representation still follows "n.n.n", and it's safe to upgrade if the new version is only changed at the last number.

License

MIT License, see LICENSE.

If you contributed any file in this software, you are a "contributor". You, a contributor, hereby be granted:

  • the permission to add your identity to CONTRIBUTORS file, to become a "registered contributor".

You must grant anyone that is:

  • contributing this software
  • using this software under the LICENSE

with:

  • the permission to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this software and to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of any material is required to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this software.
1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.1.1

2 years ago

0.1.0-alpha.9

2 years ago

1.3.2

1 year ago

1.2.3

2 years ago

0.1.0-alpha.8

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

0.1.0-alpha.7

2 years ago

0.1.0-alpha.6

2 years ago

0.1.0-alpha.5

2 years ago

0.1.0-alpha.4

2 years ago

0.1.0-alpha.3

2 years ago

0.1.0-alpha.2

2 years ago

0.1.0-alpha.1

2 years ago

0.1.0-alpha.0

2 years ago