@synsci/sdk 1.1.145 → 1.2.2
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/dist/client.d.ts +4 -4
- package/dist/client.js +5 -5
- package/dist/gen/sdk.gen.d.ts +1 -1
- package/dist/gen/sdk.gen.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/v2/client.d.ts +4 -4
- package/dist/v2/client.js +5 -5
- package/dist/v2/gen/sdk.gen.d.ts +278 -146
- package/dist/v2/gen/sdk.gen.js +552 -281
- package/dist/v2/gen/types.gen.d.ts +894 -341
- package/dist/v2/index.d.ts +2 -2
- package/dist/v2/index.js +5 -5
- package/dist/v2/server.d.ts +2 -2
- package/dist/v2/server.js +7 -7
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
2
|
import { type Config } from "./gen/client/types.gen.js";
|
|
3
|
-
import {
|
|
4
|
-
export { type Config as
|
|
5
|
-
export declare function
|
|
3
|
+
import { OpenScienceClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { type Config as OpenScienceClientConfig, OpenScienceClient };
|
|
5
|
+
export declare function createOpenScienceClient(config?: Config & {
|
|
6
6
|
directory?: string;
|
|
7
|
-
}):
|
|
7
|
+
}): OpenScienceClient;
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
2
|
import { createClient } from "./gen/client/client.gen.js";
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export function
|
|
3
|
+
import { OpenScienceClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { OpenScienceClient };
|
|
5
|
+
export function createOpenScienceClient(config) {
|
|
6
6
|
if (!config?.fetch) {
|
|
7
7
|
const customFetch = (req) => {
|
|
8
8
|
// @ts-ignore
|
|
@@ -17,9 +17,9 @@ export function createSynSciClient(config) {
|
|
|
17
17
|
if (config?.directory) {
|
|
18
18
|
config.headers = {
|
|
19
19
|
...config.headers,
|
|
20
|
-
"x-
|
|
20
|
+
"x-openscience-directory": config.directory,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
const client = createClient(config);
|
|
24
|
-
return new
|
|
24
|
+
return new OpenScienceClient({ client });
|
|
25
25
|
}
|
package/dist/gen/sdk.gen.d.ts
CHANGED
|
@@ -374,7 +374,7 @@ declare class Event extends _HeyApiClient {
|
|
|
374
374
|
*/
|
|
375
375
|
subscribe<ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<EventSubscribeResponses, unknown>>;
|
|
376
376
|
}
|
|
377
|
-
export declare class
|
|
377
|
+
export declare class OpenScienceClient extends _HeyApiClient {
|
|
378
378
|
/**
|
|
379
379
|
* Respond to a permission request
|
|
380
380
|
*/
|
package/dist/gen/sdk.gen.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./client.js";
|
|
2
2
|
export * from "./server.js";
|
|
3
3
|
import type { ServerOptions } from "./server.js";
|
|
4
|
-
export declare function
|
|
5
|
-
client: import("./client.js").
|
|
4
|
+
export declare function createOpenScience(options?: ServerOptions): Promise<{
|
|
5
|
+
client: import("./client.js").OpenScienceClient;
|
|
6
6
|
server: {
|
|
7
7
|
url: string;
|
|
8
8
|
close(): void;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export * from "./client.js";
|
|
2
2
|
export * from "./server.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export async function
|
|
6
|
-
const server = await
|
|
3
|
+
import { createOpenScienceClient } from "./client.js";
|
|
4
|
+
import { createOpenScienceServer } from "./server.js";
|
|
5
|
+
export async function createOpenScience(options) {
|
|
6
|
+
const server = await createOpenScienceServer({
|
|
7
7
|
...options,
|
|
8
8
|
});
|
|
9
|
-
const client =
|
|
9
|
+
const client = createOpenScienceClient({
|
|
10
10
|
baseUrl: server.url,
|
|
11
11
|
});
|
|
12
12
|
return {
|
package/dist/server.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ export type TuiOptions = {
|
|
|
14
14
|
signal?: AbortSignal;
|
|
15
15
|
config?: Config;
|
|
16
16
|
};
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function createOpenScienceServer(options?: ServerOptions): Promise<{
|
|
18
18
|
url: string;
|
|
19
19
|
close(): void;
|
|
20
20
|
}>;
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function createOpenScienceTui(options?: TuiOptions): {
|
|
22
22
|
close(): void;
|
|
23
23
|
};
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
export async function
|
|
2
|
+
export async function createOpenScienceServer(options) {
|
|
3
3
|
options = Object.assign({
|
|
4
4
|
hostname: "127.0.0.1",
|
|
5
5
|
port: 4096,
|
|
@@ -8,11 +8,11 @@ export async function createSynSciServer(options) {
|
|
|
8
8
|
const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
|
|
9
9
|
if (options.config?.logLevel)
|
|
10
10
|
args.push(`--log-level=${options.config.logLevel}`);
|
|
11
|
-
const proc = spawn(`
|
|
11
|
+
const proc = spawn(`openscience`, args, {
|
|
12
12
|
signal: options.signal,
|
|
13
13
|
env: {
|
|
14
14
|
...process.env,
|
|
15
|
-
|
|
15
|
+
OPENSCIENCE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
const url = await new Promise((resolve, reject) => {
|
|
@@ -24,7 +24,7 @@ export async function createSynSciServer(options) {
|
|
|
24
24
|
output += chunk.toString();
|
|
25
25
|
const lines = output.split("\n");
|
|
26
26
|
for (const line of lines) {
|
|
27
|
-
if (line.startsWith("
|
|
27
|
+
if (line.startsWith("openscience server listening")) {
|
|
28
28
|
const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
|
|
29
29
|
if (!match) {
|
|
30
30
|
throw new Error(`Failed to parse server url from output: ${line}`);
|
|
@@ -64,7 +64,7 @@ export async function createSynSciServer(options) {
|
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
export function
|
|
67
|
+
export function createOpenScienceTui(options) {
|
|
68
68
|
const args = [];
|
|
69
69
|
if (options?.project) {
|
|
70
70
|
args.push(`--project=${options.project}`);
|
|
@@ -78,12 +78,12 @@ export function createSynSciTui(options) {
|
|
|
78
78
|
if (options?.agent) {
|
|
79
79
|
args.push(`--agent=${options.agent}`);
|
|
80
80
|
}
|
|
81
|
-
const proc = spawn(`
|
|
81
|
+
const proc = spawn(`openscience`, args, {
|
|
82
82
|
signal: options?.signal,
|
|
83
83
|
stdio: "inherit",
|
|
84
84
|
env: {
|
|
85
85
|
...process.env,
|
|
86
|
-
|
|
86
|
+
OPENSCIENCE_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
|
|
87
87
|
},
|
|
88
88
|
});
|
|
89
89
|
return {
|
package/dist/v2/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
2
|
import { type Config } from "./gen/client/types.gen.js";
|
|
3
|
-
import {
|
|
4
|
-
export { type Config as
|
|
5
|
-
export declare function
|
|
3
|
+
import { OpenScienceClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { type Config as OpenScienceClientConfig, OpenScienceClient };
|
|
5
|
+
export declare function createOpenScienceClient(config?: Config & {
|
|
6
6
|
directory?: string;
|
|
7
|
-
}):
|
|
7
|
+
}): OpenScienceClient;
|
package/dist/v2/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./gen/types.gen.js";
|
|
2
2
|
import { createClient } from "./gen/client/client.gen.js";
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export function
|
|
3
|
+
import { OpenScienceClient } from "./gen/sdk.gen.js";
|
|
4
|
+
export { OpenScienceClient };
|
|
5
|
+
export function createOpenScienceClient(config) {
|
|
6
6
|
if (!config?.fetch) {
|
|
7
7
|
const customFetch = (req) => {
|
|
8
8
|
// @ts-ignore
|
|
@@ -19,9 +19,9 @@ export function createSynSciClient(config) {
|
|
|
19
19
|
const encodedDirectory = isNonASCII ? encodeURIComponent(config.directory) : config.directory;
|
|
20
20
|
config.headers = {
|
|
21
21
|
...config.headers,
|
|
22
|
-
"x-
|
|
22
|
+
"x-openscience-directory": encodedDirectory,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
const client = createClient(config);
|
|
26
|
-
return new
|
|
26
|
+
return new OpenScienceClient({ client });
|
|
27
27
|
}
|