@hautechai/sdk 0.0.1

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.
Files changed (51) hide show
  1. package/.env.example +5 -0
  2. package/.github/workflows/main.yml +43 -0
  3. package/LICENSE +19 -0
  4. package/README.md +62 -0
  5. package/dist/autogenerated/api.d.ts +3347 -0
  6. package/dist/autogenerated/api.js +4118 -0
  7. package/dist/autogenerated/base.d.ts +66 -0
  8. package/dist/autogenerated/base.js +59 -0
  9. package/dist/autogenerated/common.d.ts +65 -0
  10. package/dist/autogenerated/common.js +133 -0
  11. package/dist/autogenerated/configuration.d.ts +91 -0
  12. package/dist/autogenerated/configuration.js +39 -0
  13. package/dist/autogenerated/index.d.ts +13 -0
  14. package/dist/autogenerated/index.js +15 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +3 -0
  17. package/dist/sdk/accounts/index.d.ts +13 -0
  18. package/dist/sdk/accounts/index.js +17 -0
  19. package/dist/sdk/api.d.ts +23 -0
  20. package/dist/sdk/api.js +48 -0
  21. package/dist/sdk/balances/index.d.ts +12 -0
  22. package/dist/sdk/balances/index.js +19 -0
  23. package/dist/sdk/collections/index.d.ts +28 -0
  24. package/dist/sdk/collections/index.js +31 -0
  25. package/dist/sdk/groups/index.d.ts +24 -0
  26. package/dist/sdk/groups/index.js +31 -0
  27. package/dist/sdk/images/index.d.ts +16 -0
  28. package/dist/sdk/images/index.js +36 -0
  29. package/dist/sdk/index.d.ts +167 -0
  30. package/dist/sdk/index.js +35 -0
  31. package/dist/sdk/operations/index.d.ts +42 -0
  32. package/dist/sdk/operations/index.js +64 -0
  33. package/dist/sdk/operations/updater.d.ts +11 -0
  34. package/dist/sdk/operations/updater.js +23 -0
  35. package/dist/sdk/stacks/index.d.ts +25 -0
  36. package/dist/sdk/stacks/index.js +30 -0
  37. package/dist/sdk/storage/index.d.ts +18 -0
  38. package/dist/sdk/storage/index.js +27 -0
  39. package/dist/sdk/utils/index.d.ts +5 -0
  40. package/dist/sdk/utils/index.js +6 -0
  41. package/dist/token/index.d.ts +15 -0
  42. package/dist/token/index.js +38 -0
  43. package/dist/token/permissions.d.ts +3 -0
  44. package/dist/token/permissions.js +40 -0
  45. package/dist/types.d.ts +54 -0
  46. package/dist/types.js +4 -0
  47. package/jest.setup.js +5 -0
  48. package/openapitools.json +7 -0
  49. package/package.json +37 -0
  50. package/scripts/generate.sh +3 -0
  51. package/tsconfig.json +14 -0
package/.env.example ADDED
@@ -0,0 +1,5 @@
1
+ API_CORE_URL=http://localhost:3000
2
+ APP_ID=""
3
+ APP_KEY_ID=""
4
+ APP_KEY_SECRET=""
5
+ SDK_TOKEN=""
@@ -0,0 +1,43 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ build:
8
+ name: Build
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: read
12
+ id-token: write
13
+ environment: main
14
+
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Install node
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '20.x'
23
+ registry-url: 'https://registry.npmjs.org'
24
+
25
+ - name: Install dependencies
26
+ run: yarn install --frozen-lockfile
27
+
28
+ - name: Test
29
+ run: yarn test
30
+ env:
31
+ API_CORE_URL: https://api.dev.hautech.ai
32
+ APP_ID: ${{ secrets.APP_ID }}
33
+ APP_KEY_ID: ${{ secrets.APP_KEY_ID }}
34
+ APP_KEY_SECRET: ${{ secrets.APP_KEY_SECRET }}
35
+ SDK_TOKEN: ${{ secrets.SDK_TOKEN }}
36
+
37
+ - name: Build
38
+ run: yarn build
39
+
40
+ - name: Publish
41
+ run: npm publish --access public
42
+ env:
43
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2024 Hautech AI
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ ![sdk-server](https://github.com/HautechAI/sdk/actions/workflows/main.yml/badge.svg?branch=main)
2
+ ![npm version](https://badge.fury.io/js/%40hautechai%2Fsdk.svg)
3
+
4
+ # Hautech SDK
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @hautechai/sdk
10
+ # or
11
+ yarn add @hautechai/sdk
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ### Creating tokens
17
+
18
+ To use the SDK, first you need to create a token via token signer.
19
+
20
+ ```ts
21
+ // THIS CODE SHOULD BE RUN ON SERVER SIDE ONLY!!!
22
+
23
+ import { createTokenSigner } from '@hautechai/sdk';
24
+
25
+ const signer = createTokenSigner({
26
+ appId: process.env.APP_ID!,
27
+ appKeyId: process.env.APP_KEY_ID!,
28
+ appKeySecret: process.env.APP_KEY_SECRET!,
29
+ });
30
+ ```
31
+
32
+ #### Root token
33
+
34
+ For creating token that can be used on server side, you can create a root token.
35
+
36
+ ```ts
37
+ const rootToken = signer.createRootToken({ expiresInSeconds: 3600 });
38
+ ```
39
+
40
+ It's very not recommended to use root token on client side.
41
+
42
+ #### Account token
43
+
44
+ For creating token that can be used on client side by your users, you can create an account token.
45
+
46
+ ```ts
47
+ const accountToken = signer.createAccountToken({ accountId: 'ACCOUNT_ID', expiresInSeconds: 3600 });
48
+ ```
49
+
50
+ ### Initializing SDK
51
+
52
+ To initialize the SDK, you need to pass the function that returns the token to the `createSDK` function.
53
+
54
+ ```ts
55
+ import { createSDK } from '@hautechai/sdk';
56
+
57
+ const sdk = createSDK({ authToken: () => accountToken }); // you should call the server here for getting the token
58
+ ```
59
+
60
+ ### Using SDK
61
+
62
+ Docs about how to use the SDK are available [here](https://docs.hautech.ai/)