@deepraxis/sdk 0.2.0-dev.8d58e29 → 0.2.0-dev.8f994de
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 +205 -63
- package/README.md +1 -1
- package/dist/automation.d.ts +683 -64
- package/dist/core/bindings.d.ts +13 -0
- package/dist/core/bindings.js +17 -0
- package/dist/core/client.js +1 -0
- package/dist/core/retry.js +2 -0
- package/dist/core/transport.js +15 -3
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/index.js +1 -1
- package/dist/generated/sdk.gen.d.ts +347 -32
- package/dist/generated/sdk.gen.js +877 -95
- package/dist/generated/types.gen.d.ts +6433 -1073
- package/dist/helpers/browser-actions.d.ts +4 -0
- package/dist/helpers/browser-actions.js +7 -1
- package/dist/helpers/browser-connect-error.d.ts +22 -4
- package/dist/helpers/browser-connect-error.js +45 -9
- package/dist/helpers/browser-connect.d.ts +23 -2
- package/dist/helpers/browser-connect.js +56 -9
- package/dist/helpers/browser-decisions.d.ts +5 -0
- package/dist/helpers/browser-decisions.js +12 -0
- package/dist/helpers/browser-documentation.d.ts +1 -1
- package/dist/helpers/browser-documentation.js +4 -0
- package/dist/operations.generated.js +1742 -271
- package/dist/resources.generated.d.ts +985 -66
- package/dist/resources.generated.js +248 -78
- package/package.json +1 -1
package/dist/core/bindings.d.ts
CHANGED
|
@@ -22,4 +22,17 @@ export type RenameParameters<D, A extends AliasMap> = {
|
|
|
22
22
|
[K in keyof D]: K extends keyof A ? RenameFields<D[K], A[K]> : D[K];
|
|
23
23
|
};
|
|
24
24
|
export declare function aliasOperation(operation: Operation, aliases: AliasMap): Operation;
|
|
25
|
+
/**
|
|
26
|
+
* Path keys an older caller still spells (#5154): `ns` for `namespace`, `id` for `run_id`. The map is canonical name to
|
|
27
|
+
* legacy name. The wire only ever sees the canonical key; both spellings at once is a caller bug and is refused.
|
|
28
|
+
*/
|
|
29
|
+
type LegacyPathMap = Record<string, string>;
|
|
30
|
+
export type AcceptLegacyPath<D, M extends LegacyPathMap> = D extends {
|
|
31
|
+
path: infer P;
|
|
32
|
+
} ? Omit<D, 'path'> & {
|
|
33
|
+
path: P | (Omit<P, keyof M & keyof P> & {
|
|
34
|
+
[K in keyof M & keyof P as M[K]]: P[K];
|
|
35
|
+
});
|
|
36
|
+
} : D;
|
|
37
|
+
export declare function acceptLegacyPath(operation: Operation, legacy: LegacyPathMap): Operation;
|
|
25
38
|
export {};
|
package/dist/core/bindings.js
CHANGED
|
@@ -43,3 +43,20 @@ export function aliasOperation(operation, aliases) {
|
|
|
43
43
|
return operation(mapped);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
export function acceptLegacyPath(operation, legacy) {
|
|
47
|
+
return options => {
|
|
48
|
+
const path = options?.path;
|
|
49
|
+
if (path === undefined || path === null || typeof path !== 'object')
|
|
50
|
+
return operation(options);
|
|
51
|
+
const mapped = { ...path };
|
|
52
|
+
for (const [canonical, old] of Object.entries(legacy)) {
|
|
53
|
+
if (!Object.hasOwn(mapped, old))
|
|
54
|
+
continue;
|
|
55
|
+
if (Object.hasOwn(mapped, canonical))
|
|
56
|
+
throw new TypeError(`Use only path.${canonical}; path.${old} is its deprecated alias`);
|
|
57
|
+
mapped[canonical] = mapped[old];
|
|
58
|
+
delete mapped[old];
|
|
59
|
+
}
|
|
60
|
+
return operation({ ...options, path: mapped });
|
|
61
|
+
};
|
|
62
|
+
}
|
package/dist/core/client.js
CHANGED
|
@@ -22,6 +22,7 @@ export class Praxis {
|
|
|
22
22
|
const host = globalThis.process;
|
|
23
23
|
Object.assign(resource, { connect: (options) => connectBrowser({
|
|
24
24
|
contexts: resource.contexts,
|
|
25
|
+
sessions: resource.sessions,
|
|
25
26
|
env: host?.env ?? {},
|
|
26
27
|
builtin: host?.getBuiltinModule?.bind(host),
|
|
27
28
|
}, options) });
|
package/dist/core/retry.js
CHANGED
|
@@ -37,6 +37,8 @@ export async function fetchWithRetry(request, fetcher, options) {
|
|
|
37
37
|
let response;
|
|
38
38
|
try {
|
|
39
39
|
// Preserve a replayable request; never reuse a consumed body on the next attempt.
|
|
40
|
+
// `Request` is generic over the request-init type (`Request<CfHostMetadata, Cf>` under the Workers types), which
|
|
41
|
+
// `RequestInfo` does not name; the clone is still the same request the platform accepts.
|
|
40
42
|
response = await abortable(fetcher(request.clone()), options.signal);
|
|
41
43
|
}
|
|
42
44
|
catch (cause) {
|
package/dist/core/transport.js
CHANGED
|
@@ -7,9 +7,17 @@ import { isBinaryOperation } from "./binary-operations.js";
|
|
|
7
7
|
import { envSilencesDeprecations } from "./deprecation.js";
|
|
8
8
|
/** Our own per-call keys, beyond what the generated hey-api client accepts. */
|
|
9
9
|
const SDK_OPTION_KEYS = ['timeoutMs', 'maxRetries', 'stream', 'lastEventId'];
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
/**
|
|
11
|
+
* Every key of the generated client's per-call RequestOptions (request parts, fetch/RequestInit, serializers,
|
|
12
|
+
* auth, SSE hooks, ...), classified by whether the guard below should accept it. The exhaustiveness check after the
|
|
13
|
+
* literal is what keeps this true: a regenerated client that adds a key leaves it out of `HeyApiOptionKey` and fails
|
|
14
|
+
* to typecheck here, instead of being rejected at runtime by the guard.
|
|
15
|
+
*
|
|
16
|
+
* Written as a plain literal plus a mapped assertion rather than as a `Record<keyof GeneratedRequestOptions, true>`:
|
|
17
|
+
* the generated type's key set differs with the compiler's lib (the Workers types add `cf`, hey-api's Config adds
|
|
18
|
+
* `fetcher` and `encodeResponseBody`), so a total Record literal is rejected as excess in one configuration and as
|
|
19
|
+
* incomplete in the other.
|
|
20
|
+
*/
|
|
13
21
|
const HEY_API_OPTION_KEYS = {
|
|
14
22
|
body: true, path: true, query: true, headers: true, security: true, baseUrl: true, fetch: true, parseAs: true,
|
|
15
23
|
responseStyle: true, throwOnError: true, auth: true, bodySerializer: true, querySerializer: true,
|
|
@@ -18,7 +26,11 @@ const HEY_API_OPTION_KEYS = {
|
|
|
18
26
|
// Config extends RequestInit (minus body/headers/method).
|
|
19
27
|
signal: true, cache: true, credentials: true, integrity: true, keepalive: true, mode: true, priority: true,
|
|
20
28
|
redirect: true, referrer: true, referrerPolicy: true, window: true,
|
|
29
|
+
// hey-api's own transport hooks: the fetch implementation, the Workers `cf` bag and the body encoder.
|
|
30
|
+
fetcher: true, cf: true, encodeResponseBody: true,
|
|
21
31
|
};
|
|
32
|
+
const classified = {};
|
|
33
|
+
void classified;
|
|
22
34
|
const OPTION_KEYS = new Set([...Object.keys(HEY_API_OPTION_KEYS), ...SDK_OPTION_KEYS]);
|
|
23
35
|
/** Client-side guard: flat params like `{ limit: 20 }` would otherwise be silently dropped by the generated client. */
|
|
24
36
|
function assertKnownOptions(options) {
|