@aerostack/sdk-web 0.8.8 → 0.8.9

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 (106) hide show
  1. package/package.json +9 -2
  2. package/FUNCTIONS.md +0 -95
  3. package/RUNTIMES.md +0 -48
  4. package/examples/aiAIChat.example.ts +0 -31
  5. package/examples/databaseDbQuery.example.ts +0 -34
  6. package/examples/e2e/__tests__/e2e.test.ts +0 -69
  7. package/examples/e2e/package.json +0 -15
  8. package/examples/e2e/vitest.config.ts +0 -8
  9. package/examples/package.json +0 -18
  10. package/jsr.json +0 -27
  11. package/src/__tests__/realtime.test.ts +0 -388
  12. package/src/__tests__/sdk.test.ts +0 -181
  13. package/src/_generated/apis/AIApi.ts +0 -477
  14. package/src/_generated/apis/AuthenticationApi.ts +0 -121
  15. package/src/_generated/apis/CacheApi.ts +0 -551
  16. package/src/_generated/apis/DatabaseApi.ts +0 -138
  17. package/src/_generated/apis/GatewayApi.ts +0 -204
  18. package/src/_generated/apis/QueueApi.ts +0 -218
  19. package/src/_generated/apis/ServicesApi.ts +0 -74
  20. package/src/_generated/apis/StorageApi.ts +0 -476
  21. package/src/_generated/apis/index.ts +0 -10
  22. package/src/_generated/index.ts +0 -5
  23. package/src/_generated/models/AuthResponse.ts +0 -88
  24. package/src/_generated/models/AuthSigninRequest.ts +0 -75
  25. package/src/_generated/models/AuthSignupRequest.ts +0 -91
  26. package/src/_generated/models/CacheDeleteMany200Response.ts +0 -81
  27. package/src/_generated/models/CacheDeleteManyRequest.ts +0 -66
  28. package/src/_generated/models/CacheExpireRequest.ts +0 -75
  29. package/src/_generated/models/CacheFlush200Response.ts +0 -73
  30. package/src/_generated/models/CacheFlushRequest.ts +0 -65
  31. package/src/_generated/models/CacheGet200Response.ts +0 -73
  32. package/src/_generated/models/CacheGetMany200Response.ts +0 -72
  33. package/src/_generated/models/CacheGetManyEntry.ts +0 -81
  34. package/src/_generated/models/CacheGetManyRequest.ts +0 -66
  35. package/src/_generated/models/CacheGetRequest.ts +0 -66
  36. package/src/_generated/models/CacheIncrement200Response.ts +0 -65
  37. package/src/_generated/models/CacheIncrementRequest.ts +0 -90
  38. package/src/_generated/models/CacheKeyEntry.ts +0 -73
  39. package/src/_generated/models/CacheKeys200Response.ts +0 -73
  40. package/src/_generated/models/CacheKeysRequest.ts +0 -65
  41. package/src/_generated/models/CacheListRequest.ts +0 -81
  42. package/src/_generated/models/CacheListResult.ts +0 -88
  43. package/src/_generated/models/CacheSet200Response.ts +0 -65
  44. package/src/_generated/models/CacheSetEntry.ts +0 -83
  45. package/src/_generated/models/CacheSetMany200Response.ts +0 -73
  46. package/src/_generated/models/CacheSetManyRequest.ts +0 -73
  47. package/src/_generated/models/CacheSetRequest.ts +0 -83
  48. package/src/_generated/models/ChatCompletionRequest.ts +0 -130
  49. package/src/_generated/models/ChatCompletionRequestStreamOptions.ts +0 -67
  50. package/src/_generated/models/ChatCompletionResponse.ts +0 -128
  51. package/src/_generated/models/ChatCompletionResponseChoicesInner.ts +0 -100
  52. package/src/_generated/models/ChatMessage.ts +0 -87
  53. package/src/_generated/models/ConfigureRequest.ts +0 -77
  54. package/src/_generated/models/DbBatchRequest.ts +0 -73
  55. package/src/_generated/models/DbBatchRequestQueriesInner.ts +0 -74
  56. package/src/_generated/models/DbBatchResult.ts +0 -80
  57. package/src/_generated/models/DbBatchResultResultsInner.ts +0 -81
  58. package/src/_generated/models/DbQueryRequest.ts +0 -74
  59. package/src/_generated/models/DbQueryResult.ts +0 -73
  60. package/src/_generated/models/DeleteByTypeRequest.ts +0 -66
  61. package/src/_generated/models/DeleteRequest.ts +0 -66
  62. package/src/_generated/models/ErrorResponse.ts +0 -99
  63. package/src/_generated/models/GatewayBillingLog200Response.ts +0 -73
  64. package/src/_generated/models/GatewayBillingLogRequest.ts +0 -92
  65. package/src/_generated/models/GatewayGetWallet200Response.ts +0 -72
  66. package/src/_generated/models/IngestRequest.ts +0 -91
  67. package/src/_generated/models/JobRecord.ts +0 -119
  68. package/src/_generated/models/ListTypes200Response.ts +0 -72
  69. package/src/_generated/models/Query200Response.ts +0 -72
  70. package/src/_generated/models/QueryRequest.ts +0 -90
  71. package/src/_generated/models/QueueCancelJob200Response.ts +0 -73
  72. package/src/_generated/models/QueueEnqueue201Response.ts +0 -73
  73. package/src/_generated/models/QueueEnqueueRequest.ts +0 -83
  74. package/src/_generated/models/QueueGetJob200Response.ts +0 -80
  75. package/src/_generated/models/QueueGetJobRequest.ts +0 -66
  76. package/src/_generated/models/QueueListJobs200Response.ts +0 -88
  77. package/src/_generated/models/QueueListJobsRequest.ts +0 -103
  78. package/src/_generated/models/SearchCount200Response.ts +0 -65
  79. package/src/_generated/models/SearchCountRequest.ts +0 -65
  80. package/src/_generated/models/SearchGet200Response.ts +0 -80
  81. package/src/_generated/models/SearchGetRequest.ts +0 -66
  82. package/src/_generated/models/SearchResult.ts +0 -97
  83. package/src/_generated/models/SearchUpdateRequest.ts +0 -91
  84. package/src/_generated/models/ServicesInvoke200Response.ts +0 -73
  85. package/src/_generated/models/ServicesInvokeRequest.ts +0 -75
  86. package/src/_generated/models/StorageCopy200Response.ts +0 -73
  87. package/src/_generated/models/StorageCopyRequest.ts +0 -75
  88. package/src/_generated/models/StorageExists200Response.ts +0 -65
  89. package/src/_generated/models/StorageGetRequest.ts +0 -66
  90. package/src/_generated/models/StorageListRequest.ts +0 -81
  91. package/src/_generated/models/StorageListResult.ts +0 -88
  92. package/src/_generated/models/StorageMetadata.ts +0 -97
  93. package/src/_generated/models/StorageMove200Response.ts +0 -73
  94. package/src/_generated/models/StorageMoveRequest.ts +0 -75
  95. package/src/_generated/models/StorageObject.ts +0 -97
  96. package/src/_generated/models/StorageUpload200Response.ts +0 -65
  97. package/src/_generated/models/TokenUsage.ts +0 -81
  98. package/src/_generated/models/TokenWallet.ts +0 -73
  99. package/src/_generated/models/TypeStats.ts +0 -73
  100. package/src/_generated/models/User.ts +0 -97
  101. package/src/_generated/models/index.ts +0 -80
  102. package/src/_generated/runtime.ts +0 -431
  103. package/src/index.ts +0 -3
  104. package/src/realtime.ts +0 -456
  105. package/src/sdk.ts +0 -197
  106. package/tsconfig.json +0 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aerostack/sdk-web",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "author": "Aerostack",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -61,5 +61,12 @@
61
61
  },
62
62
  "main": "./dist/commonjs/index.js",
63
63
  "types": "./dist/commonjs/index.d.ts",
64
- "module": "./dist/esm/index.js"
64
+ "module": "./dist/esm/index.js",
65
+ "files": [
66
+ "dist",
67
+ "README.md"
68
+ ],
69
+ "publishConfig": {
70
+ "access": "public"
71
+ }
65
72
  }
package/FUNCTIONS.md DELETED
@@ -1,95 +0,0 @@
1
- # Standalone Functions
2
-
3
- > [!NOTE]
4
- > This section is useful if you are using a bundler and targetting browsers and
5
- > runtimes where the size of an application affects performance and load times.
6
-
7
- Every method in this SDK is also available as a standalone function. This
8
- alternative API is suitable when targetting the browser or serverless runtimes
9
- and using a bundler to build your application since all unused functionality
10
- will be tree-shaken away. This includes code for unused methods, Zod schemas,
11
- encoding helpers and response handlers. The result is dramatically smaller
12
- impact on the application's final bundle size which grows very slowly as you use
13
- more and more functionality from this SDK.
14
-
15
- Calling methods through the main SDK class remains a valid and generally more
16
- more ergonomic option. Standalone functions represent an optimisation for a
17
- specific category of applications.
18
-
19
- ## Example
20
-
21
- ```typescript
22
- import { SDKCore } from "@aerostack/sdk-web/core.js";
23
- import { databaseDbQuery } from "@aerostack/sdk-web/funcs/databaseDbQuery.js";
24
-
25
- // Use `SDKCore` for best tree-shaking performance.
26
- // You can create one instance of it to use across an application.
27
- const sdk = new SDKCore({
28
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
29
- });
30
-
31
- async function run() {
32
- const res = await databaseDbQuery(sdk, {
33
- xSDKVersion: "0.1.0",
34
- requestBody: {
35
- sql: "SELECT * FROM users WHERE active = ?",
36
- params: [
37
- true,
38
- ],
39
- },
40
- });
41
- if (res.ok) {
42
- const { value: result } = res;
43
- console.log(result);
44
- } else {
45
- console.log("databaseDbQuery failed:", res.error);
46
- }
47
- }
48
-
49
- run();
50
- ```
51
-
52
- ## Result types
53
-
54
- Standalone functions differ from SDK methods in that they return a
55
- `Result<Value, Error>` type to capture _known errors_ and document them using
56
- the type system. By avoiding throwing errors, application code maintains clear
57
- control flow and error-handling become part of the regular flow of application
58
- code.
59
-
60
- > We use the term "known errors" because standalone functions, and JavaScript
61
- > code in general, can still throw unexpected errors such as `TypeError`s,
62
- > `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
63
- > something this SDK addresses in the future. Nevertheless, there is still a lot
64
- > of benefit from capturing most errors and turning them into values.
65
-
66
- The second reason for this style of programming is because these functions will
67
- typically be used in front-end applications where exception throwing is
68
- sometimes discouraged or considered unidiomatic. React and similar ecosystems
69
- and libraries tend to promote this style of programming so that components
70
- render useful content under all states (loading, success, error and so on).
71
-
72
- The general pattern when calling standalone functions looks like this:
73
-
74
- ```typescript
75
- import { Core } from "<sdk-package-name>";
76
- import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";
77
-
78
- const client = new Core();
79
-
80
- async function run() {
81
- const result = await fetchSomething(client, { id: "123" });
82
- if (!result.ok) {
83
- // You can throw the error or handle it. It's your choice now.
84
- throw result.error;
85
- }
86
-
87
- console.log(result.value);
88
- }
89
-
90
- run();
91
- ```
92
-
93
- Notably, `result.error` above will have an explicit type compared to a try-catch
94
- variation where the error in the catch block can only be of type `unknown` (or
95
- `any` depending on your TypeScript settings).
package/RUNTIMES.md DELETED
@@ -1,48 +0,0 @@
1
- # Supported JavaScript runtimes
2
-
3
- This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
4
-
5
- - [Web Fetch API][web-fetch]
6
- - [Web Streams API][web-streams] and in particular `ReadableStream`
7
- - [Async iterables][async-iter] using `Symbol.asyncIterator`
8
-
9
- [web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
10
- [web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
11
- [async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
12
-
13
- Runtime environments that are explicitly supported are:
14
-
15
- - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
- - Node.js active and maintenance LTS releases
17
- - Currently, this is v18 and v20
18
- - Bun v1 and above
19
- - Deno v1.39
20
- - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
21
-
22
- [deno-file-streaming]: https://github.com/denoland/deno/issues/11018
23
-
24
- ## Recommended TypeScript compiler options
25
-
26
- The following `tsconfig.json` options are recommended for projects using this
27
- SDK in order to get static type support for features like async iterables,
28
- streams and `fetch`-related APIs ([`for await...of`][for-await-of],
29
- [`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
30
- so on):
31
-
32
- [for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
33
- [abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
34
- [request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
35
- [response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
36
-
37
- ```jsonc
38
- {
39
- "compilerOptions": {
40
- "target": "es2020", // or higher
41
- "lib": ["es2020", "dom", "dom.iterable"]
42
- }
43
- }
44
- ```
45
-
46
- While `target` can be set to older ECMAScript versions, it may result in extra,
47
- unnecessary compatibility code being generated if you are not targeting old
48
- runtimes.
@@ -1,31 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import dotenv from "dotenv";
6
- dotenv.config();
7
- /**
8
- * Example usage of the @aerostack/sdk-web SDK
9
- *
10
- * To run this example from the examples directory:
11
- * npm run build && npx tsx aiAIChat.example.ts
12
- */
13
-
14
- import { SDK } from "@aerostack/sdk-web";
15
-
16
- const sdk = new SDK({
17
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
18
- });
19
-
20
- async function main() {
21
- const result = await sdk.ai.aiChat({
22
- messages: [
23
- {},
24
- ],
25
- model: "@cf/meta/llama-3-8b-instruct",
26
- });
27
-
28
- console.log(result);
29
- }
30
-
31
- main().catch(console.error);
@@ -1,34 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import dotenv from "dotenv";
6
- dotenv.config();
7
- /**
8
- * Example usage of the @aerostack/sdk-web SDK
9
- *
10
- * To run this example from the examples directory:
11
- * npm run build && npx tsx databaseDbQuery.example.ts
12
- */
13
-
14
- import { SDK } from "@aerostack/sdk-web";
15
-
16
- const sdk = new SDK({
17
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
18
- });
19
-
20
- async function main() {
21
- const result = await sdk.database.dbQuery({
22
- xSDKVersion: "0.1.0",
23
- requestBody: {
24
- sql: "SELECT * FROM users WHERE active = ?",
25
- params: [
26
- true,
27
- ],
28
- },
29
- });
30
-
31
- console.log(result);
32
- }
33
-
34
- main().catch(console.error);
@@ -1,69 +0,0 @@
1
- /**
2
- * Web SDK E2E Tests
3
- *
4
- * Verifies SDK initialization and client-safe surface.
5
- */
6
- import { describe, it, expect } from 'vitest';
7
- import { SDK, Aerostack, createClient, RealtimeClient } from '@aerostack/sdk-web';
8
-
9
- describe('Web SDK E2E', () => {
10
- describe('SDK initialization', () => {
11
- it('should create SDK instance with default options', () => {
12
- const sdk = new SDK();
13
- expect(sdk).toBeDefined();
14
- expect(sdk.auth).toBeDefined();
15
- expect(sdk.ai).toBeDefined();
16
- expect(sdk.storage).toBeDefined();
17
- expect(sdk.database).toBeDefined();
18
- expect(sdk.realtime).toBeDefined();
19
- });
20
-
21
- it('should create SDK with api key', () => {
22
- const sdk = new SDK({
23
- apiKey: 'ac_public_test_key',
24
- serverUrl: 'https://custom.api.com/v1',
25
- });
26
- expect(sdk).toBeDefined();
27
- });
28
-
29
- it('should not expose server-side APIs', () => {
30
- const sdk = new SDK() as any;
31
- expect(sdk.queue).toBeUndefined();
32
- expect(sdk.services).toBeUndefined();
33
- expect(sdk.gateway).toBeUndefined();
34
- expect(sdk.cache).toBeUndefined();
35
- });
36
-
37
- it('should export Aerostack as deprecated alias', () => {
38
- expect(Aerostack).toBe(SDK);
39
- });
40
-
41
- it('should export createClient factory', () => {
42
- const sdk = createClient({ apiKey: 'key' });
43
- expect(sdk).toBeInstanceOf(SDK);
44
- });
45
- });
46
-
47
- describe('setApiKey', () => {
48
- it('should update API key', () => {
49
- const sdk = new SDK({ apiKey: 'old-key' });
50
- sdk.setApiKey('new-key');
51
- expect(sdk.auth).toBeDefined();
52
- });
53
- });
54
-
55
- describe('RealtimeClient export', () => {
56
- it('should export RealtimeClient', () => {
57
- expect(RealtimeClient).toBeDefined();
58
- expect(typeof RealtimeClient).toBe('function');
59
- });
60
-
61
- it('should create realtime client', () => {
62
- const client = new RealtimeClient({
63
- baseUrl: 'https://api.test.com/v1',
64
- projectId: 'proj-1',
65
- });
66
- expect(client.status).toBe('idle');
67
- });
68
- });
69
- });
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@aerostack/web-e2e",
3
- "version": "1.0.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "test": "vitest run"
8
- },
9
- "dependencies": {
10
- "@aerostack/sdk-web": "file:../../"
11
- },
12
- "devDependencies": {
13
- "vitest": "^1.0.0"
14
- }
15
- }
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- },
8
- });
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@aerostack/sdk-web-examples",
3
- "version": "1.0.0",
4
- "private": true,
5
- "scripts": {
6
- "build:parent": "cd .. && npm i && npm run build && cd -",
7
- "build:examples": "npm i",
8
- "build": "npm run build:parent && npm run build:examples"
9
- },
10
- "devDependencies": {
11
- "@types/node": "^20.0.0",
12
- "dotenv": "^16.4.5",
13
- "tsx": "^4.19.2"
14
- },
15
- "dependencies": {
16
- "@aerostack/sdk-web": "file:.."
17
- }
18
- }
package/jsr.json DELETED
@@ -1,27 +0,0 @@
1
-
2
-
3
- {
4
- "name": "@aerostack/sdk-web",
5
- "version": "0.3.3",
6
- "exports": {
7
- ".": "./src/index.ts",
8
- "./sdk/models/errors": "./src/sdk/models/errors/index.ts",
9
- "./sdk/models/shared": "./src/sdk/models/shared/index.ts",
10
- "./sdk/models/operations": "./src/sdk/models/operations/index.ts",
11
- "./lib/config": "./src/lib/config.ts",
12
- "./lib/http": "./src/lib/http.ts",
13
- "./lib/retries": "./src/lib/retries.ts",
14
- "./lib/sdks": "./src/lib/sdks.ts",
15
- "./types": "./src/sdk/types/index.ts"
16
- },
17
- "publish": {
18
- "include": [
19
- "LICENSE",
20
- "README.md",
21
- "RUNTIMES.md",
22
- "USAGE.md",
23
- "jsr.json",
24
- "src/**/*.ts"
25
- ]
26
- }
27
- }