@skypath-io/web-sdk 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +115 -24
- package/dist/bundle.cjs.js +2 -2
- package/dist/bundle.es.js +2 -2
- package/dist/bundle.iife.js +2 -2
- package/dist/types/src/core/auth/consts.d.ts +0 -1
- package/dist/types/src/features/forecast/consts.d.ts +0 -6
- package/dist/types/src/features/forecast/service.d.ts +1 -2
- package/dist/types/src/index.d.ts +1 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @skypath-io/web-sdk
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3e26952: Remove the GTG flow: `createGtgFlow` and `IS_GTG_ENABLED` are no longer exposed by the SDK. Breaking for anyone who used `createGtgFlow`. There is no replacement because the GTG service was retired.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 11c7907: Prefix request error messages with the HTTP status code (e.g. `[503] Request failed`) instead of "Unknown error".
|
|
12
|
+
|
|
3
13
|
## 1.0.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,43 +1,134 @@
|
|
|
1
|
-
# SkyPath
|
|
1
|
+
# SkyPath Web SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@skypath-io/web-sdk)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The SkyPath JavaScript SDK for web clients. It signs in to the SkyPath platform and gives you ready flows for turbulence observations, forecast, OneLayer and ADS-B data.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| | |
|
|
8
|
+
| ----------------- | ------------------------------------------------------------------------------- |
|
|
9
|
+
| **Documentation** | [docs.skypath.io/js](https://docs.skypath.io/js/introduction) |
|
|
10
|
+
| **Demo app** | [skypath-web-sdk-demo](https://github.com/Yamasee/skypath-web-sdk-demo) (React) |
|
|
11
|
+
| **Changelog** | [CHANGELOG.md](./CHANGELOG.md) |
|
|
12
|
+
| **Node** | `>= 22.14.0` |
|
|
13
|
+
| **Builds** | ES module, CommonJS and IIFE, with TypeScript types |
|
|
8
14
|
|
|
9
|
-
##
|
|
15
|
+
## Install
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
```bash
|
|
18
|
+
npm install @skypath-io/web-sdk
|
|
19
|
+
```
|
|
12
20
|
|
|
13
|
-
##
|
|
21
|
+
## Quick start
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
```js
|
|
24
|
+
import createSkyPathSDK from "@skypath-io/web-sdk";
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
const sdk = await createSkyPathSDK({
|
|
27
|
+
apiKey: "YOUR_API_KEY",
|
|
28
|
+
userId: "YOUR_USER_ID",
|
|
29
|
+
companyName: "YOUR_COMPANY_NAME",
|
|
30
|
+
});
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# Create an RC branch
|
|
22
|
-
git checkout -b rc/your-feature
|
|
32
|
+
const observationsFlow = sdk.createObservationsFlow();
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
observationsFlow.onData((data) => {
|
|
35
|
+
// update your map layer
|
|
36
|
+
});
|
|
37
|
+
observationsFlow.start();
|
|
38
|
+
```
|
|
26
39
|
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
> **`apiKey` is for development only.** In production, sign a JWT on your server and pass it through `authCallback`, so the API key never reaches the browser. See [Configuration](https://docs.skypath.io/js/configuration).
|
|
41
|
+
|
|
42
|
+
<details>
|
|
43
|
+
<summary><b>Sign in with a signed JWT</b></summary>
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const sdk = await createSkyPathSDK({
|
|
47
|
+
authCallback: async () => ({
|
|
48
|
+
jwt: await getSignedJwtFromYourServer(),
|
|
49
|
+
partnerId: "YOUR_PARTNER_ID",
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
### Options
|
|
57
|
+
|
|
58
|
+
| Option | Type | Description |
|
|
59
|
+
| -------------- | ------------------------------------------------------- | --------------------------------------------- |
|
|
60
|
+
| `apiKey` | `string` | API key, used with `userId` and `companyName` |
|
|
61
|
+
| `userId` | `string` | The current user ID |
|
|
62
|
+
| `companyName` | `string` | Your company name |
|
|
63
|
+
| `authCallback` | `() => Promise<{ jwt, partnerId }>` | Returns a signed JWT, instead of `apiKey` |
|
|
64
|
+
| `environment` | `"local" \| "development" \| "staging" \| "production"` | Default: `"staging"` |
|
|
65
|
+
| `proxyUrl` | `string` | Send API requests through your own proxy |
|
|
66
|
+
|
|
67
|
+
### Flows
|
|
68
|
+
|
|
69
|
+
| Flow | Created with | Available when |
|
|
70
|
+
| --------------------------------------------------------------------- | -------------------------- | --------------------- |
|
|
71
|
+
| [Observations](https://docs.skypath.io/js/features/observations-flow) | `createObservationsFlow()` | always |
|
|
72
|
+
| [Forecast](https://docs.skypath.io/js/features/forecast-flow) | `createForecastFlow()` | `IS_FORECAST_ENABLED` |
|
|
73
|
+
| [OneLayer](https://docs.skypath.io/js/features/onelayer-flow) | `createOneLayerFlow()` | `IS_ONELAYER_ENABLED` |
|
|
74
|
+
| [ADS-B](https://docs.skypath.io/js/features/adsb-flow) | `createAdsbFlow()` | `IS_ADSB_ENABLED` |
|
|
75
|
+
|
|
76
|
+
The flags are set per user by SkyPath; check them before creating a flow. OneLayer already includes observations, so run OneLayer or Observations, not both.
|
|
77
|
+
|
|
78
|
+
Utilities and constants are described in the [documentation](https://docs.skypath.io/js/features/utilities).
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary><b>Setup, scripts and releases</b></summary>
|
|
84
|
+
|
|
85
|
+
### Setup
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
nvm use # Node version from .nvmrc
|
|
89
|
+
npm install # also installs the Husky pre-commit hook
|
|
90
|
+
npm run dev # rebuilds dist/ and the types on every change
|
|
29
91
|
```
|
|
30
92
|
|
|
31
|
-
|
|
93
|
+
### Scripts
|
|
94
|
+
|
|
95
|
+
| Command | What it does |
|
|
96
|
+
| ------------------- | ------------------------------------------------- |
|
|
97
|
+
| `npm run dev` | Rollup in watch mode, types regenerated on change |
|
|
98
|
+
| `npm run build` | Production build and types into `dist/` |
|
|
99
|
+
| `npm run test` | Unit tests (Vitest) |
|
|
100
|
+
| `npm run lint` | ESLint over `src/` |
|
|
101
|
+
| `npm run format` | Prettier over `src/` |
|
|
102
|
+
| `npm run changeset` | Adds a changeset for the next release |
|
|
103
|
+
|
|
104
|
+
Every pull request runs lint, tests and the build.
|
|
105
|
+
|
|
106
|
+
### Releasing a version
|
|
107
|
+
|
|
108
|
+
Versions and the changelog are managed by [Changesets](https://github.com/changesets/changesets).
|
|
109
|
+
|
|
110
|
+
1. Add a changeset to your pull request: `npm run changeset`, pick the bump (patch, minor or major) and write one line for the changelog.
|
|
111
|
+
2. Merge the pull request into `master`. The release workflow opens a **Version Packages** pull request with the new version and changelog.
|
|
112
|
+
3. Merge **Version Packages**. The workflow publishes the new version to npm under the `latest` tag.
|
|
32
113
|
|
|
33
|
-
|
|
114
|
+
### Alpha versions
|
|
34
115
|
|
|
35
|
-
|
|
116
|
+
To try a change in another project before a release, publish it under the `alpha` tag from an `rc/*` branch:
|
|
36
117
|
|
|
37
|
-
|
|
118
|
+
```bash
|
|
119
|
+
git checkout -b rc/your-feature
|
|
120
|
+
npm run changeset
|
|
121
|
+
git push origin rc/your-feature
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The workflow versions the package (for example `1.0.2-alpha.0`), publishes it, and pushes the version commits back to the branch, so pull before your next push. Install it with:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npm install @skypath-io/web-sdk@alpha
|
|
128
|
+
```
|
|
38
129
|
|
|
39
|
-
|
|
130
|
+
</details>
|
|
40
131
|
|
|
41
|
-
|
|
132
|
+
## License
|
|
42
133
|
|
|
43
|
-
|
|
134
|
+
Copyright © SkyPath. All rights reserved. See [LICENSE.txt](./LICENSE.txt) and the [SkyPath Terms of Use](https://skypath.io/terms/).
|