@lifesi/genesis 0.0.0-stage → 0.1.0
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/beacons.d.ts +19 -0
- package/dist/beacons.js +10 -0
- package/dist/client.d.ts +7254 -0
- package/dist/client.js +94 -0
- package/dist/dials.d.ts +51 -0
- package/dist/dials.js +18 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +35 -0
- package/dist/fleets.d.ts +71 -0
- package/dist/fleets.js +44 -0
- package/dist/generated/operations.d.ts +7209 -0
- package/dist/generated/operations.js +8447 -0
- package/dist/generated/schema.d.ts +11416 -0
- package/dist/generated/schema.js +1 -0
- package/dist/genesis.d.ts +545 -0
- package/dist/genesis.js +111 -0
- package/dist/genesis.openapi.json +15411 -0
- package/dist/henry.d.ts +155 -0
- package/dist/henry.js +14 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/runner.d.ts +52 -0
- package/dist/runner.js +112 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +1 -0
- package/package.json +19 -3
- package/README.md +0 -3
package/dist/henry.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { OperationInput } from './types.js';
|
|
3
|
+
/** Henry always derives its organization from the gateway's verified caller. */
|
|
4
|
+
export declare function henryModule(client: GenesisClient): {
|
|
5
|
+
config: () => Promise<{
|
|
6
|
+
credential_configured: boolean;
|
|
7
|
+
models: {
|
|
8
|
+
id: string;
|
|
9
|
+
}[];
|
|
10
|
+
}>;
|
|
11
|
+
credential: (api_key: string) => Promise<{
|
|
12
|
+
credential_configured: boolean;
|
|
13
|
+
models: {
|
|
14
|
+
id: string;
|
|
15
|
+
}[];
|
|
16
|
+
}>;
|
|
17
|
+
runs: {
|
|
18
|
+
list: (page_token?: string) => Promise<{
|
|
19
|
+
runs: import("./index.js").components["schemas"]["Henry.Run"][];
|
|
20
|
+
next_page_token?: string | null;
|
|
21
|
+
}>;
|
|
22
|
+
create: (body: NonNullable<OperationInput<"henry_createRun">["body"]>) => Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
task: string;
|
|
25
|
+
model: string;
|
|
26
|
+
status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
|
|
27
|
+
created_at: string;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
activity: {
|
|
30
|
+
id: string;
|
|
31
|
+
at: string;
|
|
32
|
+
type: string;
|
|
33
|
+
detail: string;
|
|
34
|
+
}[];
|
|
35
|
+
approvals: {
|
|
36
|
+
id: string;
|
|
37
|
+
action: string;
|
|
38
|
+
url: string;
|
|
39
|
+
status: string;
|
|
40
|
+
requested_at: string;
|
|
41
|
+
}[];
|
|
42
|
+
phases: {
|
|
43
|
+
id?: string;
|
|
44
|
+
code?: number;
|
|
45
|
+
receipt?: Record<string, never>;
|
|
46
|
+
usage?: Record<string, never> | null;
|
|
47
|
+
}[];
|
|
48
|
+
messages: ({
|
|
49
|
+
role: string;
|
|
50
|
+
content?: string | null;
|
|
51
|
+
} & {
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
})[];
|
|
54
|
+
}>;
|
|
55
|
+
get: (run_id: string) => Promise<{
|
|
56
|
+
id: string;
|
|
57
|
+
task: string;
|
|
58
|
+
model: string;
|
|
59
|
+
status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
|
|
60
|
+
created_at: string;
|
|
61
|
+
updated_at: string;
|
|
62
|
+
activity: {
|
|
63
|
+
id: string;
|
|
64
|
+
at: string;
|
|
65
|
+
type: string;
|
|
66
|
+
detail: string;
|
|
67
|
+
}[];
|
|
68
|
+
approvals: {
|
|
69
|
+
id: string;
|
|
70
|
+
action: string;
|
|
71
|
+
url: string;
|
|
72
|
+
status: string;
|
|
73
|
+
requested_at: string;
|
|
74
|
+
}[];
|
|
75
|
+
phases: {
|
|
76
|
+
id?: string;
|
|
77
|
+
code?: number;
|
|
78
|
+
receipt?: Record<string, never>;
|
|
79
|
+
usage?: Record<string, never> | null;
|
|
80
|
+
}[];
|
|
81
|
+
messages: ({
|
|
82
|
+
role: string;
|
|
83
|
+
content?: string | null;
|
|
84
|
+
} & {
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
})[];
|
|
87
|
+
}>;
|
|
88
|
+
command: (run_id: string, action: "pause" | "resume" | "cancel" | "input", text?: string) => Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
task: string;
|
|
91
|
+
model: string;
|
|
92
|
+
status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
|
|
93
|
+
created_at: string;
|
|
94
|
+
updated_at: string;
|
|
95
|
+
activity: {
|
|
96
|
+
id: string;
|
|
97
|
+
at: string;
|
|
98
|
+
type: string;
|
|
99
|
+
detail: string;
|
|
100
|
+
}[];
|
|
101
|
+
approvals: {
|
|
102
|
+
id: string;
|
|
103
|
+
action: string;
|
|
104
|
+
url: string;
|
|
105
|
+
status: string;
|
|
106
|
+
requested_at: string;
|
|
107
|
+
}[];
|
|
108
|
+
phases: {
|
|
109
|
+
id?: string;
|
|
110
|
+
code?: number;
|
|
111
|
+
receipt?: Record<string, never>;
|
|
112
|
+
usage?: Record<string, never> | null;
|
|
113
|
+
}[];
|
|
114
|
+
messages: ({
|
|
115
|
+
role: string;
|
|
116
|
+
content?: string | null;
|
|
117
|
+
} & {
|
|
118
|
+
[key: string]: unknown;
|
|
119
|
+
})[];
|
|
120
|
+
}>;
|
|
121
|
+
approval: (run_id: string, approval_id: string, decision: "approve" | "reject") => Promise<{
|
|
122
|
+
id: string;
|
|
123
|
+
task: string;
|
|
124
|
+
model: string;
|
|
125
|
+
status: "ready" | "running" | "acting" | "paused" | "awaiting_approval" | "completed" | "cancelled" | "failed" | "waiting_input";
|
|
126
|
+
created_at: string;
|
|
127
|
+
updated_at: string;
|
|
128
|
+
activity: {
|
|
129
|
+
id: string;
|
|
130
|
+
at: string;
|
|
131
|
+
type: string;
|
|
132
|
+
detail: string;
|
|
133
|
+
}[];
|
|
134
|
+
approvals: {
|
|
135
|
+
id: string;
|
|
136
|
+
action: string;
|
|
137
|
+
url: string;
|
|
138
|
+
status: string;
|
|
139
|
+
requested_at: string;
|
|
140
|
+
}[];
|
|
141
|
+
phases: {
|
|
142
|
+
id?: string;
|
|
143
|
+
code?: number;
|
|
144
|
+
receipt?: Record<string, never>;
|
|
145
|
+
usage?: Record<string, never> | null;
|
|
146
|
+
}[];
|
|
147
|
+
messages: ({
|
|
148
|
+
role: string;
|
|
149
|
+
content?: string | null;
|
|
150
|
+
} & {
|
|
151
|
+
[key: string]: unknown;
|
|
152
|
+
})[];
|
|
153
|
+
}>;
|
|
154
|
+
};
|
|
155
|
+
};
|
package/dist/henry.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Henry always derives its organization from the gateway's verified caller. */
|
|
2
|
+
export function henryModule(client) {
|
|
3
|
+
return {
|
|
4
|
+
config: () => client.request('henry_getConfig'),
|
|
5
|
+
credential: (api_key) => client.request('henry_putCredential', { body: { api_key } }),
|
|
6
|
+
runs: {
|
|
7
|
+
list: (page_token) => client.request('henry_listRuns', page_token ? { page_token } : {}),
|
|
8
|
+
create: (body) => client.request('henry_createRun', { body: { ...body, run_id: body.run_id ?? globalThis.crypto.randomUUID() } }),
|
|
9
|
+
get: (run_id) => client.request('henry_getRun', { run_id }),
|
|
10
|
+
command: (run_id, action, text) => client.request('henry_commandRun', { run_id, body: { action, ...(text === undefined ? {} : { text }) } }),
|
|
11
|
+
approval: (run_id, approval_id, decision) => client.request('henry_decideApproval', { run_id, approval_id, body: { decision } }),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Genesis, type ChatMessage } from './genesis.js';
|
|
2
|
+
export { GenesisClient, DEFAULT_BASE_URL, type GenesisOptions, type CredentialProvider } from './client.js';
|
|
3
|
+
export { GenesisError } from './errors.js';
|
|
4
|
+
export { operationTable, services, type OperationId } from './generated/operations.js';
|
|
5
|
+
export type { OperationInput, OperationOutput, OperationMeta, ServiceMeta } from './types.js';
|
|
6
|
+
export type { paths, operations, components } from './generated/schema.js';
|
|
7
|
+
export { runnerModule, type RunnerStartInput, type RunnerSnapshot, type RunnerCatalog, type RunnerEvent, type RunnerProviderResult, type RunnerRequestOptions } from './runner.js';
|
|
8
|
+
export { beaconsModule } from './beacons.js';
|
|
9
|
+
export { dialsModule, type DialsScope, type DialsOutboundCall, type DialsCallControl, type DialsEmergencyAddress } from './dials.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Genesis } from './genesis.js';
|
|
2
|
+
export { GenesisClient, DEFAULT_BASE_URL } from './client.js';
|
|
3
|
+
export { GenesisError } from './errors.js';
|
|
4
|
+
export { operationTable, services } from './generated/operations.js';
|
|
5
|
+
export { runnerModule } from './runner.js';
|
|
6
|
+
export { beaconsModule } from './beacons.js';
|
|
7
|
+
export { dialsModule } from './dials.js';
|
package/dist/runner.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { GenesisClient } from './client.js';
|
|
2
|
+
import type { components } from './generated/schema.js';
|
|
3
|
+
type Schemas = components['schemas'];
|
|
4
|
+
export type RunnerStartInput = Schemas['Runner.StartInput'];
|
|
5
|
+
export type RunnerSnapshot = Schemas['Runner.Snapshot'];
|
|
6
|
+
export type RunnerCatalog = Schemas['Runner.Catalog'];
|
|
7
|
+
export type RunnerEvent = Schemas['Runner.Event'];
|
|
8
|
+
export type RunnerProviderResult = Schemas['Runner.ProviderResult'];
|
|
9
|
+
export type RunnerRequestOptions = {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
};
|
|
12
|
+
/** Runner routes use the Genesis client's credential; the backend owns org/subject scoping. */
|
|
13
|
+
export declare function runnerModule(client: GenesisClient): Readonly<{
|
|
14
|
+
catalog: (opts?: RunnerRequestOptions) => Promise<{
|
|
15
|
+
workspaces: {
|
|
16
|
+
key: components["schemas"]["Runner.SafeOpaqueRef"];
|
|
17
|
+
label: string;
|
|
18
|
+
}[];
|
|
19
|
+
routes: {
|
|
20
|
+
routeId: components["schemas"]["Runner.SafeOpaqueRef"];
|
|
21
|
+
kind: "external-harness" | "internal-model";
|
|
22
|
+
name: string;
|
|
23
|
+
via: string;
|
|
24
|
+
state: "synthetic" | "bound" | "unbound";
|
|
25
|
+
default: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
28
|
+
jobs: Readonly<{
|
|
29
|
+
list: (opts?: RunnerRequestOptions) => Promise<{
|
|
30
|
+
jobs: components["schemas"]["Runner.Snapshot"][];
|
|
31
|
+
}>;
|
|
32
|
+
start: (input: RunnerStartInput, opts?: RunnerRequestOptions) => Promise<{
|
|
33
|
+
jobId: components["schemas"]["Runner.SafeOpaqueRef"];
|
|
34
|
+
snapshot: components["schemas"]["Runner.Snapshot"];
|
|
35
|
+
}>;
|
|
36
|
+
get: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
|
|
37
|
+
snapshot: components["schemas"]["Runner.Snapshot"];
|
|
38
|
+
}>;
|
|
39
|
+
events: (jobId: string, afterSeq?: number, opts?: RunnerRequestOptions) => Promise<{
|
|
40
|
+
events: components["schemas"]["Runner.Event"][];
|
|
41
|
+
nextAfterSeq: number;
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
result: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
|
|
45
|
+
result: components["schemas"]["Runner.ProviderResult"];
|
|
46
|
+
}>;
|
|
47
|
+
cancel: (jobId: string, opts?: RunnerRequestOptions) => Promise<{
|
|
48
|
+
snapshot: components["schemas"]["Runner.Snapshot"];
|
|
49
|
+
}>;
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
52
|
+
export {};
|
package/dist/runner.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const requestOptions = (options) => ({ signal: options.signal });
|
|
2
|
+
const opaqueId = (v) => typeof v === 'string' && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(v);
|
|
3
|
+
const pathLike = (v) => /^[A-Za-z]:/.test(v) || v.includes('..');
|
|
4
|
+
const invalid = () => new TypeError('Runner input must match the bounded runner/task-client/v0 contract');
|
|
5
|
+
function checkedJobId(value) {
|
|
6
|
+
if (!opaqueId(value) || pathLike(value)
|
|
7
|
+
|| /^(?:https?|ftp|file|data|javascript|bearer|basic):|^(?:sk[-_]|pk[-_]|gh[pousr]_|github_pat_|xox[baprs]-|eyJ)/i.test(value)) {
|
|
8
|
+
throw invalid();
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function closed(value, required, optional = []) {
|
|
13
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
14
|
+
&& required.every((key) => Object.hasOwn(value, key))
|
|
15
|
+
&& Object.keys(value).every((key) => required.includes(key) || optional.includes(key));
|
|
16
|
+
}
|
|
17
|
+
// Match the core's input bounds and copy once so a caller cannot mutate a validated request
|
|
18
|
+
// while the asynchronous credential provider runs. Identity is never an input property.
|
|
19
|
+
function copyBoundedInput(value) {
|
|
20
|
+
let nodes = 0;
|
|
21
|
+
let chars = 0;
|
|
22
|
+
const ancestors = new Set();
|
|
23
|
+
const countText = (text) => {
|
|
24
|
+
chars += text.length;
|
|
25
|
+
if (text.length > 32768 || chars > 65536)
|
|
26
|
+
throw invalid();
|
|
27
|
+
return text;
|
|
28
|
+
};
|
|
29
|
+
const walk = (v, depth) => {
|
|
30
|
+
if (++nodes > 256)
|
|
31
|
+
throw invalid();
|
|
32
|
+
if (v === null || typeof v === 'boolean')
|
|
33
|
+
return v;
|
|
34
|
+
if (typeof v === 'string')
|
|
35
|
+
return countText(v);
|
|
36
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
37
|
+
return v;
|
|
38
|
+
if (typeof v !== 'object' || depth >= 6 || ancestors.has(v))
|
|
39
|
+
throw invalid();
|
|
40
|
+
ancestors.add(v);
|
|
41
|
+
try {
|
|
42
|
+
if (Array.isArray(v)) {
|
|
43
|
+
if (Object.getPrototypeOf(v) !== Array.prototype || v.length > 64 || Reflect.ownKeys(v).length !== v.length + 1)
|
|
44
|
+
throw invalid();
|
|
45
|
+
return Array.from({ length: v.length }, (_, index) => {
|
|
46
|
+
const d = Object.getOwnPropertyDescriptor(v, String(index));
|
|
47
|
+
if (!d || !('value' in d) || !d.enumerable)
|
|
48
|
+
throw invalid();
|
|
49
|
+
return walk(d.value, depth + 1);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const prototype = Object.getPrototypeOf(v);
|
|
53
|
+
if (prototype !== null && prototype !== Object.prototype)
|
|
54
|
+
throw invalid();
|
|
55
|
+
const keys = Reflect.ownKeys(v);
|
|
56
|
+
if (keys.length > 32)
|
|
57
|
+
throw invalid();
|
|
58
|
+
const out = Object.create(null);
|
|
59
|
+
for (const key of keys) {
|
|
60
|
+
if (typeof key !== 'string')
|
|
61
|
+
throw invalid();
|
|
62
|
+
countText(key);
|
|
63
|
+
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
64
|
+
if (!('value' in d) || !d.enumerable)
|
|
65
|
+
throw invalid();
|
|
66
|
+
out[key] = walk(d.value, depth + 1);
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
ancestors.delete(v);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return walk(value, 0);
|
|
75
|
+
}
|
|
76
|
+
function checkedStartInput(input) {
|
|
77
|
+
const v = copyBoundedInput(input);
|
|
78
|
+
if (!closed(v, ['task', 'workspaceRef', 'executionRef', 'limits', 'idempotencyKey'])
|
|
79
|
+
|| !closed(v.task, ['id', 'text'], ['meta']) || !opaqueId(v.task.id)
|
|
80
|
+
|| typeof v.task.text !== 'string' || !v.task.text.trim()
|
|
81
|
+
|| (Object.hasOwn(v.task, 'meta') && (v.task.meta === null || typeof v.task.meta !== 'object' || Array.isArray(v.task.meta)))
|
|
82
|
+
|| !opaqueId(v.workspaceRef) || pathLike(v.workspaceRef)
|
|
83
|
+
|| !closed(v.executionRef, ['kind', 'routeId'])
|
|
84
|
+
|| !['external-harness', 'internal-model'].includes(v.executionRef.kind) || !opaqueId(v.executionRef.routeId)
|
|
85
|
+
|| !closed(v.limits, ['maxDurationMs', 'maxOutputBytes'], ['maxEvents']) || !opaqueId(v.idempotencyKey))
|
|
86
|
+
throw invalid();
|
|
87
|
+
const limit = (n, maximum) => Number.isInteger(n) && n > 0 && n <= maximum;
|
|
88
|
+
if (!limit(v.limits.maxDurationMs, 86400000) || !limit(v.limits.maxOutputBytes, 67108864)
|
|
89
|
+
|| (Object.hasOwn(v.limits, 'maxEvents') && !limit(v.limits.maxEvents, 1000)))
|
|
90
|
+
throw invalid();
|
|
91
|
+
if (new TextEncoder().encode(JSON.stringify(v)).byteLength > 65536)
|
|
92
|
+
throw invalid();
|
|
93
|
+
return v;
|
|
94
|
+
}
|
|
95
|
+
/** Runner routes use the Genesis client's credential; the backend owns org/subject scoping. */
|
|
96
|
+
export function runnerModule(client) {
|
|
97
|
+
return Object.freeze({
|
|
98
|
+
catalog: (opts = {}) => client.request('runner_getCatalog', undefined, requestOptions(opts)),
|
|
99
|
+
jobs: Object.freeze({
|
|
100
|
+
list: (opts = {}) => client.request('runner_listJobs', undefined, requestOptions(opts)),
|
|
101
|
+
start: (input, opts = {}) => client.request('runner_startJob', { body: checkedStartInput(input) }, requestOptions(opts)),
|
|
102
|
+
get: (jobId, opts = {}) => client.request('runner_getJob', { jobId: checkedJobId(jobId) }, requestOptions(opts)),
|
|
103
|
+
events: (jobId, afterSeq = 0, opts = {}) => {
|
|
104
|
+
if (!Number.isSafeInteger(afterSeq) || afterSeq < 0)
|
|
105
|
+
throw invalid();
|
|
106
|
+
return client.request('runner_getJobEvents', { jobId: checkedJobId(jobId), afterSeq }, requestOptions(opts));
|
|
107
|
+
},
|
|
108
|
+
result: (jobId, opts = {}) => client.request('runner_getJobResult', { jobId: checkedJobId(jobId) }, requestOptions(opts)),
|
|
109
|
+
cancel: (jobId, opts = {}) => client.request('runner_cancelJob', { jobId: checkedJobId(jobId) }, requestOptions(opts)),
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { operations } from './generated/schema.js';
|
|
2
|
+
export interface ServiceMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
title: string;
|
|
5
|
+
upstream: string;
|
|
6
|
+
status: string;
|
|
7
|
+
statusNote?: string;
|
|
8
|
+
operations: number;
|
|
9
|
+
}
|
|
10
|
+
export interface OperationMeta {
|
|
11
|
+
method: string;
|
|
12
|
+
path: string;
|
|
13
|
+
service: string;
|
|
14
|
+
summary: string;
|
|
15
|
+
upstream: {
|
|
16
|
+
base: string;
|
|
17
|
+
method: string;
|
|
18
|
+
path: string;
|
|
19
|
+
status: string;
|
|
20
|
+
};
|
|
21
|
+
mcp: boolean;
|
|
22
|
+
internal: boolean;
|
|
23
|
+
public: boolean;
|
|
24
|
+
pathParams: readonly string[];
|
|
25
|
+
queryParams: readonly string[];
|
|
26
|
+
hasBody: boolean;
|
|
27
|
+
inputSchema: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
type Ops = operations;
|
|
30
|
+
type Clean<T> = [T] extends [never] ? {} : [NonNullable<T>] extends [never] ? {} : NonNullable<T>;
|
|
31
|
+
type Part<K extends keyof Ops, L extends 'path' | 'query'> = Ops[K] extends {
|
|
32
|
+
parameters: infer P;
|
|
33
|
+
} ? (P extends {
|
|
34
|
+
[X in L]?: infer T;
|
|
35
|
+
} ? Clean<T> : {}) : {};
|
|
36
|
+
type Body<K extends keyof Ops> = Ops[K] extends {
|
|
37
|
+
requestBody?: infer B;
|
|
38
|
+
} ? [NonNullable<B>] extends [never] ? {} : NonNullable<B> extends {
|
|
39
|
+
content: {
|
|
40
|
+
'application/json': infer J;
|
|
41
|
+
};
|
|
42
|
+
} ? (undefined extends B ? {
|
|
43
|
+
body?: J;
|
|
44
|
+
} : {
|
|
45
|
+
body: J;
|
|
46
|
+
}) : {} : {};
|
|
47
|
+
/** Flat input for an operation: path params + query params + `body`. */
|
|
48
|
+
export type OperationInput<K extends keyof Ops> = Part<K, 'path'> & Part<K, 'query'> & Body<K>;
|
|
49
|
+
type Ok<R> = R extends {
|
|
50
|
+
200: infer X;
|
|
51
|
+
} ? X : R extends {
|
|
52
|
+
201: infer X;
|
|
53
|
+
} ? X : R extends {
|
|
54
|
+
202: infer X;
|
|
55
|
+
} ? X : R extends {
|
|
56
|
+
204: unknown;
|
|
57
|
+
} ? {
|
|
58
|
+
content: {
|
|
59
|
+
'application/json': void;
|
|
60
|
+
};
|
|
61
|
+
} : unknown;
|
|
62
|
+
/** Parsed JSON success body for an operation. */
|
|
63
|
+
export type OperationOutput<K extends keyof Ops> = Ops[K] extends {
|
|
64
|
+
responses: infer R;
|
|
65
|
+
} ? (Ok<R> extends {
|
|
66
|
+
content: {
|
|
67
|
+
'application/json': infer J;
|
|
68
|
+
};
|
|
69
|
+
} ? J : unknown) : unknown;
|
|
70
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifesi/genesis",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One typed SDK for every Genesis service (Foundry, Hives, Relays, IAM...) via the Genesis API gateway",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./spec.json": "./dist/genesis.openapi.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"gen": "node scripts/gen.mjs",
|
|
20
|
+
"build": "tsc -p tsconfig.json && cp ../../openapi/genesis.openapi.json dist/"
|
|
21
|
+
}
|
|
6
22
|
}
|
package/README.md
DELETED