@deepraxis/sdk 0.1.1-dev.cfc116e → 0.1.1-dev.d03c066
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/METHODS.md +342 -148
- package/README.md +5 -4
- package/dist/core/binary-operations.d.ts +3 -0
- package/dist/core/binary-operations.js +14 -0
- package/dist/core/transport.js +8 -4
- package/dist/generated/binary-operations.gen.d.ts +3 -0
- package/dist/generated/binary-operations.gen.js +14 -0
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +417 -115
- package/dist/generated/sdk.gen.js +1248 -385
- package/dist/generated/types.gen.d.ts +15729 -8993
- package/dist/helpers/application-publish.js +16 -2
- package/dist/helpers/browser-connect-error.d.ts +28 -0
- package/dist/helpers/browser-connect-error.js +74 -0
- package/dist/helpers/browser-connect.d.ts +2 -0
- package/dist/helpers/browser-connect.js +36 -42
- package/dist/helpers/browser-decisions.d.ts +13 -0
- package/dist/helpers/browser-decisions.js +11 -0
- package/dist/helpers/browser-documentation.d.ts +1 -1
- package/dist/helpers/browser-documentation.js +4 -2
- package/dist/operations.generated.d.ts +1 -0
- package/dist/operations.generated.js +8306 -6382
- package/dist/resources.generated.d.ts +1121 -354
- package/dist/resources.generated.js +209 -94
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The official TypeScript SDK for [Praxis](https://deepraxis.com), the cloud where
|
|
|
10
10
|
[](https://bundlephobia.com/package/@deepraxis/sdk)
|
|
11
11
|
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
12
12
|
|
|
13
|
-
[Website](https://deepraxis.com) · [Documentation](https://docs.deepraxis.com) · [API reference](https://docs.deepraxis.com/
|
|
13
|
+
[Website](https://deepraxis.com) · [Documentation](https://docs.deepraxis.com) · [API reference](https://docs.deepraxis.com/api) · [Console](https://console.deepraxis.com)
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -262,13 +262,14 @@ export default async (input: { prompt: string }) => {
|
|
|
262
262
|
|
|
263
263
|
Keep your code and point the official SDK at Praxis by changing `baseURL`, for example
|
|
264
264
|
`https://api.deepraxis.com/openai/v1` for the OpenAI SDK. The
|
|
265
|
-
[
|
|
266
|
-
Anthropic
|
|
265
|
+
[OpenAI-compatible](https://docs.deepraxis.com/en/developers/model/guides/openai-compatible) and
|
|
266
|
+
[Anthropic-compatible](https://docs.deepraxis.com/en/developers/model/guides/anthropic-compatible)
|
|
267
|
+
guides have the details. This SDK covers what those don't: agents,
|
|
267
268
|
sandboxes, search, data, automation and the rest of the platform.
|
|
268
269
|
|
|
269
270
|
## Resources
|
|
270
271
|
|
|
271
|
-
- [Documentation](https://docs.deepraxis.com) and [API reference](https://docs.deepraxis.com/
|
|
272
|
+
- [Documentation](https://docs.deepraxis.com) and [API reference](https://docs.deepraxis.com/api)
|
|
272
273
|
- [METHODS.md](https://unpkg.com/@deepraxis/sdk/METHODS.md): every method, its HTTP route, and whether it streams or paginates
|
|
273
274
|
- [Praxis CLI](https://www.npmjs.com/package/@deepraxis/cli): the same API from your terminal
|
|
274
275
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as sdk from "../generated/sdk.gen.js";
|
|
2
|
+
import { binaryOperations } from "../generated/binary-operations.gen.js";
|
|
3
|
+
/**
|
|
4
|
+
* The generated SDK operations whose success response the OpenAPI declares as binary bytes
|
|
5
|
+
* (generated from the spec into `binary-operations.gen.ts`). Resolved by function identity, so
|
|
6
|
+
* wrapping, renaming or minification cannot change the answer.
|
|
7
|
+
*/
|
|
8
|
+
const binary = new Set(binaryOperations
|
|
9
|
+
.map(name => sdk[name])
|
|
10
|
+
.filter((operation) => typeof operation === 'function'));
|
|
11
|
+
/** Whether this operation's 200 response is the declared bytes of the resource, not a JSON body. */
|
|
12
|
+
export function isBinaryOperation(operation) {
|
|
13
|
+
return binary.has(operation);
|
|
14
|
+
}
|
package/dist/core/transport.js
CHANGED
|
@@ -3,6 +3,7 @@ import { PraxisError, PraxisTimeoutError } from "./errors.js";
|
|
|
3
3
|
import { abortable, fetchWithRetry } from "./retry.js";
|
|
4
4
|
import { parseSSE } from "./sse.js";
|
|
5
5
|
import { resolveDefaultCredentials } from "./credentials.js";
|
|
6
|
+
import { isBinaryOperation } from "./binary-operations.js";
|
|
6
7
|
/** Our own per-call keys, beyond what the generated hey-api client accepts. */
|
|
7
8
|
const SDK_OPTION_KEYS = ['timeoutMs', 'maxRetries', 'stream', 'lastEventId'];
|
|
8
9
|
/** Every key of the generated client's per-call RequestOptions (request parts, fetch/RequestInit, serializers,
|
|
@@ -55,7 +56,7 @@ export class Transport {
|
|
|
55
56
|
if (!Number.isSafeInteger(retries) || retries < 0)
|
|
56
57
|
throw new RangeError('maxRetries must be a non-negative integer');
|
|
57
58
|
}
|
|
58
|
-
scope(options, streaming) {
|
|
59
|
+
scope(operation, options, streaming) {
|
|
59
60
|
assertKnownOptions(options);
|
|
60
61
|
const timeoutMs = options.timeoutMs ?? Math.max(this.config.timeoutMs, serverDeadlineMs(options));
|
|
61
62
|
const maxRetries = options.maxRetries ?? this.config.maxRetries;
|
|
@@ -98,7 +99,10 @@ export class Transport {
|
|
|
98
99
|
}
|
|
99
100
|
return {
|
|
100
101
|
signal,
|
|
101
|
-
|
|
102
|
+
// A binary operation is parsed as a Blob whatever the server says in Content-Type: the runtime
|
|
103
|
+
// value must match the declared `Blob | File`, and JSON bytes must survive as bytes.
|
|
104
|
+
options: { ...options, headers: Object.fromEntries(headers), client, signal, throwOnError: true, responseStyle: 'fields',
|
|
105
|
+
...(streaming ? { parseAs: 'stream' } : isBinaryOperation(operation) ? { parseAs: 'blob' } : {}) },
|
|
102
106
|
close() { clearTimeout(timer); external?.removeEventListener('abort', abort); },
|
|
103
107
|
};
|
|
104
108
|
}
|
|
@@ -107,7 +111,7 @@ export class Transport {
|
|
|
107
111
|
}
|
|
108
112
|
/** Internal helper access to response metadata, with the same request policy. */
|
|
109
113
|
async requestWithResponse(operation, options = {}) {
|
|
110
|
-
const scope = this.scope(options, false);
|
|
114
|
+
const scope = this.scope(operation, options, false);
|
|
111
115
|
try {
|
|
112
116
|
const result = await abortable(operation(scope.options), scope.signal);
|
|
113
117
|
return { data: result.data, response: result.response };
|
|
@@ -117,7 +121,7 @@ export class Transport {
|
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
async *stream(operation, options = {}) {
|
|
120
|
-
const scope = this.scope(options, true);
|
|
124
|
+
const scope = this.scope(operation, options, true);
|
|
121
125
|
try {
|
|
122
126
|
const result = await abortable(operation(scope.options), scope.signal);
|
|
123
127
|
if (!result.response.headers.get('content-type')?.split(';')[0]?.trim().toLowerCase().includes('text/event-stream')) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Generated by scripts/resources.ts. DO NOT EDIT.
|
|
2
|
+
/** Exported SDK operations whose 2xx response the OpenAPI declares as binary bytes: the core
|
|
3
|
+
* transport resolves them to a Blob whatever the response Content-Type says. */
|
|
4
|
+
export const binaryOperations = [
|
|
5
|
+
'browserGetSessionFrame',
|
|
6
|
+
'computersFilesContent',
|
|
7
|
+
'createAudioSpeech',
|
|
8
|
+
'downloadVideoContent',
|
|
9
|
+
'fileRetrieveFileContent',
|
|
10
|
+
'registryGitFilesRetrieve',
|
|
11
|
+
'registryPackagesVersionsArchive',
|
|
12
|
+
'registryPackagesVersionsFilesRetrieve',
|
|
13
|
+
'skillsVersionsDownload',
|
|
14
|
+
];
|