mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
chore: release sdks
This commit is contained in:
parent
fcb7004c7a
commit
13b30dee9e
8 changed files with 70 additions and 17 deletions
|
|
@ -81,8 +81,29 @@ ts.write_text(
|
||||||
re.sub(r'"version": "[^"]+"', f'"version": "{version}"', ts.read_text(), count=1)
|
re.sub(r'"version": "[^"]+"', f'"version": "{version}"', ts.read_text(), count=1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ts_lock = pathlib.Path("sdk/typescript/package-lock.json")
|
||||||
|
if ts_lock.exists():
|
||||||
|
lock_text = ts_lock.read_text()
|
||||||
|
lock_text = re.sub(
|
||||||
|
r'^ "version": "[^"]+"',
|
||||||
|
f' "version": "{version}"',
|
||||||
|
lock_text,
|
||||||
|
count=1,
|
||||||
|
flags=re.M,
|
||||||
|
)
|
||||||
|
lock_text = re.sub(
|
||||||
|
r'^( "version": ")[^"]+(")',
|
||||||
|
rf'\g<1>{version}\2',
|
||||||
|
lock_text,
|
||||||
|
count=1,
|
||||||
|
flags=re.M,
|
||||||
|
)
|
||||||
|
ts_lock.write_text(lock_text)
|
||||||
|
|
||||||
print(f" pyproject.toml → {version}")
|
print(f" pyproject.toml → {version}")
|
||||||
print(f" package.json → {version}")
|
print(f" package.json → {version}")
|
||||||
|
if ts_lock.exists():
|
||||||
|
print(f" package-lock.json → {version}")
|
||||||
PY
|
PY
|
||||||
|
|
||||||
echo "→ Building Python wheel + sdist..."
|
echo "→ Building Python wheel + sdist..."
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "dograh-sdk"
|
name = "dograh-sdk"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
description = "Typed builder for Dograh voice-AI workflows"
|
description = "Typed builder for Dograh voice-AI workflows"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# generated by datamodel-codegen:
|
# generated by datamodel-codegen:
|
||||||
# filename: dograh-openapi-EZT8BU.json
|
# filename: dograh-openapi-DuffQq.json
|
||||||
# timestamp: 2026-05-31T10:54:36+00:00
|
# timestamp: 2026-05-31T11:41:57+00:00
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
|
||||||
4
sdk/typescript/package-lock.json
generated
4
sdk/typescript/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@dograh/sdk",
|
"name": "@dograh/sdk",
|
||||||
"version": "0.1.3",
|
"version": "0.1.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@dograh/sdk",
|
"name": "@dograh/sdk",
|
||||||
"version": "0.1.3",
|
"version": "0.1.7",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"openapi-typescript": "^7.13.0",
|
"openapi-typescript": "^7.13.0",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@dograh/sdk",
|
"name": "@dograh/sdk",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"description": "Typed builder for Dograh voice-AI workflows",
|
"description": "Typed builder for Dograh voice-AI workflows",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"author": "Zansat Technologies Private Limited",
|
"author": "Zansat Technologies Private Limited",
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,48 @@ import type {
|
||||||
import { ApiError, SpecMismatchError } from "./errors.js";
|
import { ApiError, SpecMismatchError } from "./errors.js";
|
||||||
import { Workflow, type SpecProvider } from "./workflow.js";
|
import { Workflow, type SpecProvider } from "./workflow.js";
|
||||||
|
|
||||||
|
type RuntimeProcess = {
|
||||||
|
env?: Record<string, string | undefined>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface DograhFetchInit {
|
||||||
|
method?: string;
|
||||||
|
headers?: Record<string, string>;
|
||||||
|
body?: string;
|
||||||
|
signal?: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DograhFetchResponse {
|
||||||
|
ok: boolean;
|
||||||
|
status: number;
|
||||||
|
statusText: string;
|
||||||
|
json(): Promise<unknown>;
|
||||||
|
text(): Promise<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DograhFetch = (
|
||||||
|
url: string,
|
||||||
|
init?: DograhFetchInit,
|
||||||
|
) => Promise<DograhFetchResponse>;
|
||||||
|
|
||||||
|
function getRuntimeEnv(name: string): string | undefined {
|
||||||
|
const runtime = globalThis as typeof globalThis & { process?: RuntimeProcess };
|
||||||
|
return runtime.process?.env?.[name];
|
||||||
|
}
|
||||||
|
|
||||||
export interface DograhClientOptions {
|
export interface DograhClientOptions {
|
||||||
baseUrl?: string;
|
baseUrl?: string;
|
||||||
apiKey?: string;
|
apiKey?: string;
|
||||||
/** Request timeout in ms. */
|
/** Request timeout in ms. */
|
||||||
timeoutMs?: number;
|
timeoutMs?: number;
|
||||||
/** Optional fetch override for tests / custom transports. */
|
/** Optional fetch override for tests / custom transports. */
|
||||||
fetch?: typeof globalThis.fetch;
|
fetch?: DograhFetch;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DograhClient extends _GeneratedClient implements SpecProvider {
|
export class DograhClient extends _GeneratedClient implements SpecProvider {
|
||||||
readonly baseUrl: string;
|
readonly baseUrl: string;
|
||||||
readonly apiKey: string | undefined;
|
readonly apiKey: string | undefined;
|
||||||
private readonly fetchImpl: typeof globalThis.fetch;
|
private readonly fetchImpl: DograhFetch;
|
||||||
private readonly timeoutMs: number;
|
private readonly timeoutMs: number;
|
||||||
private readonly headers: Record<string, string>;
|
private readonly headers: Record<string, string>;
|
||||||
private readonly specCache = new Map<string, NodeSpec>();
|
private readonly specCache = new Map<string, NodeSpec>();
|
||||||
|
|
@ -38,13 +67,11 @@ export class DograhClient extends _GeneratedClient implements SpecProvider {
|
||||||
super();
|
super();
|
||||||
const rawBase =
|
const rawBase =
|
||||||
opts.baseUrl ??
|
opts.baseUrl ??
|
||||||
(typeof process !== "undefined" ? process.env.DOGRAH_API_URL : undefined) ??
|
getRuntimeEnv("DOGRAH_API_URL") ??
|
||||||
"http://localhost:8000";
|
"http://localhost:8000";
|
||||||
this.baseUrl = rawBase.replace(/\/+$/, "");
|
this.baseUrl = rawBase.replace(/\/+$/, "");
|
||||||
this.apiKey =
|
this.apiKey = opts.apiKey ?? getRuntimeEnv("DOGRAH_API_KEY");
|
||||||
opts.apiKey ??
|
this.fetchImpl = opts.fetch ?? (globalThis.fetch as unknown as DograhFetch);
|
||||||
(typeof process !== "undefined" ? process.env.DOGRAH_API_KEY : undefined);
|
|
||||||
this.fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
||||||
this.timeoutMs = opts.timeoutMs ?? 30_000;
|
this.timeoutMs = opts.timeoutMs ?? 30_000;
|
||||||
this.headers = { Accept: "application/json" };
|
this.headers = { Accept: "application/json" };
|
||||||
if (this.apiKey) this.headers["X-API-Key"] = this.apiKey;
|
if (this.apiKey) this.headers["X-API-Key"] = this.apiKey;
|
||||||
|
|
@ -126,7 +153,7 @@ export class DograhClient extends _GeneratedClient implements SpecProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasBody = opts?.json !== undefined;
|
const hasBody = opts?.json !== undefined;
|
||||||
const init: RequestInit = {
|
const init: DograhFetchInit = {
|
||||||
method,
|
method,
|
||||||
headers: {
|
headers: {
|
||||||
...this.headers,
|
...this.headers,
|
||||||
|
|
@ -139,7 +166,7 @@ export class DograhClient extends _GeneratedClient implements SpecProvider {
|
||||||
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
||||||
init.signal = controller.signal;
|
init.signal = controller.signal;
|
||||||
|
|
||||||
let resp: Response;
|
let resp: DograhFetchResponse;
|
||||||
try {
|
try {
|
||||||
resp = await this.fetchImpl(url, init);
|
resp = await this.fetchImpl(url, init);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { DograhClient } from "./client.js";
|
export { DograhClient } from "./client.js";
|
||||||
export type { DograhClientOptions } from "./client.js";
|
export type {
|
||||||
|
DograhClientOptions,
|
||||||
|
DograhFetch,
|
||||||
|
DograhFetchInit,
|
||||||
|
DograhFetchResponse,
|
||||||
|
} from "./client.js";
|
||||||
export {
|
export {
|
||||||
ApiError,
|
ApiError,
|
||||||
DograhSdkError,
|
DograhSdkError,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"lib": ["ES2022"],
|
"lib": ["ES2022", "DOM"],
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue