@indexable/sdk 0.2.0 → 0.2.1
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.
|
Binary file
|
|
Binary file
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexable/sdk-linux-x64-gnu",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"os": [
|
|
5
5
|
"linux"
|
|
6
6
|
],
|
|
7
7
|
"cpu": [
|
|
8
8
|
"x64"
|
|
9
9
|
],
|
|
10
|
+
"main": "ix-sdk.linux-x64-gnu.node",
|
|
10
11
|
"files": [
|
|
12
|
+
"ix-sdk.linux-x64-gnu.node",
|
|
11
13
|
"libix_sdk_ffi.so"
|
|
12
14
|
],
|
|
13
15
|
"license": "MIT",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexable/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "bunx tsc --noEmit",
|
|
15
|
+
"build:native": "RUSTFLAGS='--cfg reqwest_unstable' cargo build -p ix-sdk-napi -p ix-sdk-ffi --profile release-external --target x86_64-unknown-linux-gnu && cp ../../target/x86_64-unknown-linux-gnu/release-external/libix_sdk_napi.so npm/linux-x64-gnu/ix-sdk.linux-x64-gnu.node && cp ../../target/x86_64-unknown-linux-gnu/release-external/libix_sdk_ffi.so npm/linux-x64-gnu/libix_sdk_ffi.so",
|
|
15
16
|
"typecheck": "bunx tsc --noEmit"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
package/src/bindings.ts
CHANGED
|
@@ -1,9 +1,174 @@
|
|
|
1
|
-
// UniFFI-generated TypeScript bindings for ix-sdk-ffi.
|
|
2
|
-
//
|
|
3
|
-
// These bindings are generated by uniffi-bindgen from the Rust
|
|
4
|
-
// ix-sdk-ffi crate. Do not edit manually — regenerate with:
|
|
5
|
-
//
|
|
6
|
-
// ./crates/ix/sdk/ffi/scripts/generate-ts-bindings.sh
|
|
1
|
+
// UniFFI-generated TypeScript bindings for ix-sdk-ffi remain the public API.
|
|
7
2
|
//
|
|
3
|
+
// On Linux, Bun crashes in the koffi/UniFFI path for a narrow set of async VM
|
|
4
|
+
// methods. Those methods are patched to a napi-rs backend built from the same
|
|
5
|
+
// Rust SDK so Rust remains the single behavior owner.
|
|
6
|
+
|
|
7
|
+
import { existsSync } from 'node:fs'
|
|
8
|
+
import { createRequire } from 'node:module'
|
|
9
|
+
import path from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
IxSdkClient as GeneratedIxSdkClient,
|
|
14
|
+
type FfiBillingStatus,
|
|
15
|
+
type FfiCreateVmResult,
|
|
16
|
+
type FfiExecResult,
|
|
17
|
+
type FfiSpawnOptions,
|
|
18
|
+
} from './generated/ix_sdk_ffi'
|
|
8
19
|
|
|
9
20
|
export * from './generated/ix_sdk_ffi'
|
|
21
|
+
|
|
22
|
+
type NativeIxSdkLinuxClient = {
|
|
23
|
+
billingStatus(): Promise<FfiBillingStatus>
|
|
24
|
+
spawn(
|
|
25
|
+
image: string,
|
|
26
|
+
name: string | null,
|
|
27
|
+
memoryMib: bigint | null,
|
|
28
|
+
cpuCores: bigint | null,
|
|
29
|
+
ipv4: boolean | null
|
|
30
|
+
): Promise<string>
|
|
31
|
+
createVm(
|
|
32
|
+
id: string | null,
|
|
33
|
+
image: string,
|
|
34
|
+
name: string | null,
|
|
35
|
+
maxMemoryMib: bigint | null,
|
|
36
|
+
maxCpuCores: bigint | null,
|
|
37
|
+
enableIpv4: boolean | null,
|
|
38
|
+
waitUntilReady: boolean | null,
|
|
39
|
+
region: string | null
|
|
40
|
+
): Promise<FfiCreateVmResult>
|
|
41
|
+
execVm(
|
|
42
|
+
vmId: string,
|
|
43
|
+
command: string[],
|
|
44
|
+
workingDir: string | null
|
|
45
|
+
): Promise<FfiExecResult>
|
|
46
|
+
deleteVm(vmId: string): Promise<void>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type NativeAddon = {
|
|
50
|
+
IxSdkLinuxClient: new (server: string, token: string) => NativeIxSdkLinuxClient
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const isLinux = process.platform === 'linux'
|
|
54
|
+
const isBun = typeof process.versions?.bun === 'string'
|
|
55
|
+
const linuxTripleDir = `${process.platform}-${process.arch}-gnu`
|
|
56
|
+
const linuxAddonName = `ix-sdk.${linuxTripleDir}.node`
|
|
57
|
+
const nativeClients = new WeakMap<GeneratedIxSdkClient, NativeIxSdkLinuxClient>()
|
|
58
|
+
|
|
59
|
+
function loadNativeAddon(): NativeAddon {
|
|
60
|
+
const require = createRequire(import.meta.url)
|
|
61
|
+
const filename = fileURLToPath(import.meta.url)
|
|
62
|
+
const dirname = path.dirname(filename)
|
|
63
|
+
const addonPath = path.resolve(
|
|
64
|
+
dirname,
|
|
65
|
+
'..',
|
|
66
|
+
'npm',
|
|
67
|
+
linuxTripleDir,
|
|
68
|
+
linuxAddonName
|
|
69
|
+
)
|
|
70
|
+
if (!existsSync(addonPath)) {
|
|
71
|
+
throw new Error(`Missing Linux SDK addon at ${addonPath}`)
|
|
72
|
+
}
|
|
73
|
+
return require(addonPath) as NativeAddon
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function nativeClient(client: GeneratedIxSdkClient): NativeIxSdkLinuxClient {
|
|
77
|
+
const native = nativeClients.get(client)
|
|
78
|
+
if (native) {
|
|
79
|
+
return native
|
|
80
|
+
}
|
|
81
|
+
throw new Error('Linux native SDK backend not initialized; use IxSdkClient.create()')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (isLinux) {
|
|
85
|
+
const addon = loadNativeAddon()
|
|
86
|
+
const create = GeneratedIxSdkClient.create.bind(GeneratedIxSdkClient)
|
|
87
|
+
const supportedBunLinuxMethods = new Set([
|
|
88
|
+
'billingStatus',
|
|
89
|
+
'close',
|
|
90
|
+
'constructor',
|
|
91
|
+
'createVm',
|
|
92
|
+
'deleteVm',
|
|
93
|
+
'describe',
|
|
94
|
+
'execVm',
|
|
95
|
+
'filter',
|
|
96
|
+
'getFs',
|
|
97
|
+
'spawn',
|
|
98
|
+
])
|
|
99
|
+
|
|
100
|
+
GeneratedIxSdkClient.create = (server: string, token: string): GeneratedIxSdkClient => {
|
|
101
|
+
const client = create(server, token)
|
|
102
|
+
nativeClients.set(client, new addon.IxSdkLinuxClient(server, token))
|
|
103
|
+
return client
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
GeneratedIxSdkClient.prototype.billingStatus = function (): Promise<FfiBillingStatus> {
|
|
107
|
+
return nativeClient(this).billingStatus()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
GeneratedIxSdkClient.prototype.spawn = function (
|
|
111
|
+
image: string,
|
|
112
|
+
options: FfiSpawnOptions | null
|
|
113
|
+
): Promise<string> {
|
|
114
|
+
return nativeClient(this).spawn(
|
|
115
|
+
image,
|
|
116
|
+
options?.name ?? null,
|
|
117
|
+
options?.memoryMib ?? null,
|
|
118
|
+
options?.cpuCores ?? null,
|
|
119
|
+
options?.ipv4 ?? null
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
GeneratedIxSdkClient.prototype.createVm = function (
|
|
124
|
+
id: string | null,
|
|
125
|
+
image: string,
|
|
126
|
+
name: string | null,
|
|
127
|
+
maxMemoryMib: bigint | null,
|
|
128
|
+
maxCpuCores: bigint | null,
|
|
129
|
+
enableIpv4: boolean | null,
|
|
130
|
+
waitUntilReady: boolean | null,
|
|
131
|
+
region: string | null
|
|
132
|
+
): Promise<FfiCreateVmResult> {
|
|
133
|
+
return nativeClient(this).createVm(
|
|
134
|
+
id,
|
|
135
|
+
image,
|
|
136
|
+
name,
|
|
137
|
+
maxMemoryMib,
|
|
138
|
+
maxCpuCores,
|
|
139
|
+
enableIpv4,
|
|
140
|
+
waitUntilReady,
|
|
141
|
+
region
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
GeneratedIxSdkClient.prototype.execVm = function (
|
|
146
|
+
vmId: string,
|
|
147
|
+
command: string[],
|
|
148
|
+
workingDir: string | null
|
|
149
|
+
): Promise<FfiExecResult> {
|
|
150
|
+
return nativeClient(this).execVm(vmId, command, workingDir)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
GeneratedIxSdkClient.prototype.deleteVm = function (vmId: string): Promise<void> {
|
|
154
|
+
return nativeClient(this).deleteVm(vmId)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (isBun) {
|
|
158
|
+
const prototype = GeneratedIxSdkClient.prototype as unknown as Record<string, unknown>
|
|
159
|
+
for (const methodName of Object.getOwnPropertyNames(prototype)) {
|
|
160
|
+
if (supportedBunLinuxMethods.has(methodName)) {
|
|
161
|
+
continue
|
|
162
|
+
}
|
|
163
|
+
const method = prototype[methodName]
|
|
164
|
+
if (typeof method !== 'function') {
|
|
165
|
+
continue
|
|
166
|
+
}
|
|
167
|
+
prototype[methodName] = function (): never {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`IxSdkClient.${methodName} is disabled on Bun/Linux until it is ported to the native backend`
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -10,13 +10,13 @@ import { fileURLToPath } from 'node:url';
|
|
|
10
10
|
// ---- Rust buffer types ----
|
|
11
11
|
|
|
12
12
|
const RustBufferByValue = koffi.struct('RustBuffer', {
|
|
13
|
-
capacity: '
|
|
14
|
-
len: '
|
|
13
|
+
capacity: 'int64',
|
|
14
|
+
len: 'int64',
|
|
15
15
|
data: 'uint8 *',
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
const ForeignBytesByValue = koffi.struct('ForeignBytes', {
|
|
19
|
-
len: '
|
|
19
|
+
len: 'int64',
|
|
20
20
|
data: 'const uint8 *',
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -52,6 +52,8 @@ function findLibrary(): string {
|
|
|
52
52
|
const pkgRoot = path.resolve(__dirname, '..', '..');
|
|
53
53
|
const npmDir = path.join(pkgRoot, 'npm', `${process.platform}-${process.arch}`, name);
|
|
54
54
|
if (existsSync(npmDir)) return npmDir;
|
|
55
|
+
const npmDirGnu = path.join(pkgRoot, 'npm', `${process.platform}-${process.arch}-gnu`, name);
|
|
56
|
+
if (existsSync(npmDirGnu)) return npmDirGnu;
|
|
55
57
|
|
|
56
58
|
// 4. Cargo target/release (development)
|
|
57
59
|
const cargoRelease = path.resolve(pkgRoot, '..', '..', 'target', 'release', name);
|
|
@@ -248,6 +250,12 @@ const uniffiIxSdkFfiFnMethodIxsdkclientSpawn = lib.func('uniffi_ix_sdk_ffi_fn_me
|
|
|
248
250
|
RustBufferByValue,
|
|
249
251
|
RustBufferByValue,
|
|
250
252
|
]);
|
|
253
|
+
const uniffiIxSdkFfiFnMethodIxsdkclientSpawnBlocking = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_spawn_blocking', RustBufferByValue, [
|
|
254
|
+
'uint64',
|
|
255
|
+
RustBufferByValue,
|
|
256
|
+
RustBufferByValue,
|
|
257
|
+
koffi.out(koffi.pointer(RustCallStatus)),
|
|
258
|
+
]);
|
|
251
259
|
const uniffiIxSdkFfiFnMethodIxsdkclientCancelMigration = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_cancel_migration', 'uint64', [
|
|
252
260
|
'uint64',
|
|
253
261
|
RustBufferByValue,
|
|
@@ -321,10 +329,27 @@ const uniffiIxSdkFfiFnMethodIxsdkclientCreateVm = lib.func('uniffi_ix_sdk_ffi_fn
|
|
|
321
329
|
RustBufferByValue,
|
|
322
330
|
RustBufferByValue,
|
|
323
331
|
]);
|
|
332
|
+
const uniffiIxSdkFfiFnMethodIxsdkclientCreateVmBlocking = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_create_vm_blocking', RustBufferByValue, [
|
|
333
|
+
'uint64',
|
|
334
|
+
RustBufferByValue,
|
|
335
|
+
RustBufferByValue,
|
|
336
|
+
RustBufferByValue,
|
|
337
|
+
RustBufferByValue,
|
|
338
|
+
RustBufferByValue,
|
|
339
|
+
RustBufferByValue,
|
|
340
|
+
RustBufferByValue,
|
|
341
|
+
RustBufferByValue,
|
|
342
|
+
koffi.out(koffi.pointer(RustCallStatus)),
|
|
343
|
+
]);
|
|
324
344
|
const uniffiIxSdkFfiFnMethodIxsdkclientDeleteVm = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_delete_vm', 'uint64', [
|
|
325
345
|
'uint64',
|
|
326
346
|
RustBufferByValue,
|
|
327
347
|
]);
|
|
348
|
+
const uniffiIxSdkFfiFnMethodIxsdkclientDeleteVmBlocking = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_delete_vm_blocking', 'void', [
|
|
349
|
+
'uint64',
|
|
350
|
+
RustBufferByValue,
|
|
351
|
+
koffi.out(koffi.pointer(RustCallStatus)),
|
|
352
|
+
]);
|
|
328
353
|
const uniffiIxSdkFfiFnMethodIxsdkclientDeleteVmSecret = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_delete_vm_secret', 'uint64', [
|
|
329
354
|
'uint64',
|
|
330
355
|
RustBufferByValue,
|
|
@@ -336,6 +361,13 @@ const uniffiIxSdkFfiFnMethodIxsdkclientExecVm = lib.func('uniffi_ix_sdk_ffi_fn_m
|
|
|
336
361
|
RustBufferByValue,
|
|
337
362
|
RustBufferByValue,
|
|
338
363
|
]);
|
|
364
|
+
const uniffiIxSdkFfiFnMethodIxsdkclientExecVmBlocking = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_exec_vm_blocking', RustBufferByValue, [
|
|
365
|
+
'uint64',
|
|
366
|
+
RustBufferByValue,
|
|
367
|
+
RustBufferByValue,
|
|
368
|
+
RustBufferByValue,
|
|
369
|
+
koffi.out(koffi.pointer(RustCallStatus)),
|
|
370
|
+
]);
|
|
339
371
|
const uniffiIxSdkFfiFnMethodIxsdkclientForkVm = lib.func('uniffi_ix_sdk_ffi_fn_method_ixsdkclient_fork_vm', 'uint64', [
|
|
340
372
|
'uint64',
|
|
341
373
|
RustBufferByValue,
|
|
@@ -590,6 +622,8 @@ const uniffiIxSdkFfiChecksumMethodIxsdkclientSnapshots = lib.func('uniffi_ix_sdk
|
|
|
590
622
|
]);
|
|
591
623
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientSpawn = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_spawn', 'uint16', [
|
|
592
624
|
]);
|
|
625
|
+
const uniffiIxSdkFfiChecksumMethodIxsdkclientSpawnBlocking = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_spawn_blocking', 'uint16', [
|
|
626
|
+
]);
|
|
593
627
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientCancelMigration = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_cancel_migration', 'uint16', [
|
|
594
628
|
]);
|
|
595
629
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientMigrateVm = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_migrate_vm', 'uint16', [
|
|
@@ -622,12 +656,18 @@ const uniffiIxSdkFfiChecksumMethodIxsdkclientCheckpointVm = lib.func('uniffi_ix_
|
|
|
622
656
|
]);
|
|
623
657
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientCreateVm = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_create_vm', 'uint16', [
|
|
624
658
|
]);
|
|
659
|
+
const uniffiIxSdkFfiChecksumMethodIxsdkclientCreateVmBlocking = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_create_vm_blocking', 'uint16', [
|
|
660
|
+
]);
|
|
625
661
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientDeleteVm = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_delete_vm', 'uint16', [
|
|
626
662
|
]);
|
|
663
|
+
const uniffiIxSdkFfiChecksumMethodIxsdkclientDeleteVmBlocking = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_delete_vm_blocking', 'uint16', [
|
|
664
|
+
]);
|
|
627
665
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientDeleteVmSecret = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_delete_vm_secret', 'uint16', [
|
|
628
666
|
]);
|
|
629
667
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientExecVm = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_exec_vm', 'uint16', [
|
|
630
668
|
]);
|
|
669
|
+
const uniffiIxSdkFfiChecksumMethodIxsdkclientExecVmBlocking = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_exec_vm_blocking', 'uint16', [
|
|
670
|
+
]);
|
|
631
671
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientForkVm = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_fork_vm', 'uint16', [
|
|
632
672
|
]);
|
|
633
673
|
const uniffiIxSdkFfiChecksumMethodIxsdkclientForkVmAtTimestampMs = lib.func('uniffi_ix_sdk_ffi_checksum_method_ixsdkclient_fork_vm_at_timestamp_ms', 'uint16', [
|
|
@@ -705,7 +745,7 @@ const ffiIxSdkFfiUniffiContractVersion = lib.func('ffi_ix_sdk_ffi_uniffi_contrac
|
|
|
705
745
|
const UniffiRustFutureContinuationCallback = koffi.proto('UniffiRustFutureContinuationCallback', 'void', ['uint64', 'int8']);
|
|
706
746
|
const ffiIxSdkFfiRustFuturePollU8 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_u8', 'void', [
|
|
707
747
|
'uint64',
|
|
708
|
-
'
|
|
748
|
+
'void *',
|
|
709
749
|
'uint64',
|
|
710
750
|
]);
|
|
711
751
|
const ffiIxSdkFfiRustFutureCancelU8 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_u8', 'void', [
|
|
@@ -720,7 +760,7 @@ const ffiIxSdkFfiRustFutureCompleteU8 = lib.func('ffi_ix_sdk_ffi_rust_future_com
|
|
|
720
760
|
]);
|
|
721
761
|
const ffiIxSdkFfiRustFuturePollI8 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_i8', 'void', [
|
|
722
762
|
'uint64',
|
|
723
|
-
'
|
|
763
|
+
'void *',
|
|
724
764
|
'uint64',
|
|
725
765
|
]);
|
|
726
766
|
const ffiIxSdkFfiRustFutureCancelI8 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_i8', 'void', [
|
|
@@ -735,7 +775,7 @@ const ffiIxSdkFfiRustFutureCompleteI8 = lib.func('ffi_ix_sdk_ffi_rust_future_com
|
|
|
735
775
|
]);
|
|
736
776
|
const ffiIxSdkFfiRustFuturePollU16 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_u16', 'void', [
|
|
737
777
|
'uint64',
|
|
738
|
-
'
|
|
778
|
+
'void *',
|
|
739
779
|
'uint64',
|
|
740
780
|
]);
|
|
741
781
|
const ffiIxSdkFfiRustFutureCancelU16 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_u16', 'void', [
|
|
@@ -750,7 +790,7 @@ const ffiIxSdkFfiRustFutureCompleteU16 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
750
790
|
]);
|
|
751
791
|
const ffiIxSdkFfiRustFuturePollI16 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_i16', 'void', [
|
|
752
792
|
'uint64',
|
|
753
|
-
'
|
|
793
|
+
'void *',
|
|
754
794
|
'uint64',
|
|
755
795
|
]);
|
|
756
796
|
const ffiIxSdkFfiRustFutureCancelI16 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_i16', 'void', [
|
|
@@ -765,7 +805,7 @@ const ffiIxSdkFfiRustFutureCompleteI16 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
765
805
|
]);
|
|
766
806
|
const ffiIxSdkFfiRustFuturePollU32 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_u32', 'void', [
|
|
767
807
|
'uint64',
|
|
768
|
-
'
|
|
808
|
+
'void *',
|
|
769
809
|
'uint64',
|
|
770
810
|
]);
|
|
771
811
|
const ffiIxSdkFfiRustFutureCancelU32 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_u32', 'void', [
|
|
@@ -780,7 +820,7 @@ const ffiIxSdkFfiRustFutureCompleteU32 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
780
820
|
]);
|
|
781
821
|
const ffiIxSdkFfiRustFuturePollI32 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_i32', 'void', [
|
|
782
822
|
'uint64',
|
|
783
|
-
'
|
|
823
|
+
'void *',
|
|
784
824
|
'uint64',
|
|
785
825
|
]);
|
|
786
826
|
const ffiIxSdkFfiRustFutureCancelI32 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_i32', 'void', [
|
|
@@ -795,7 +835,7 @@ const ffiIxSdkFfiRustFutureCompleteI32 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
795
835
|
]);
|
|
796
836
|
const ffiIxSdkFfiRustFuturePollU64 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_u64', 'void', [
|
|
797
837
|
'uint64',
|
|
798
|
-
'
|
|
838
|
+
'void *',
|
|
799
839
|
'uint64',
|
|
800
840
|
]);
|
|
801
841
|
const ffiIxSdkFfiRustFutureCancelU64 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_u64', 'void', [
|
|
@@ -810,7 +850,7 @@ const ffiIxSdkFfiRustFutureCompleteU64 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
810
850
|
]);
|
|
811
851
|
const ffiIxSdkFfiRustFuturePollI64 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_i64', 'void', [
|
|
812
852
|
'uint64',
|
|
813
|
-
'
|
|
853
|
+
'void *',
|
|
814
854
|
'uint64',
|
|
815
855
|
]);
|
|
816
856
|
const ffiIxSdkFfiRustFutureCancelI64 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_i64', 'void', [
|
|
@@ -825,7 +865,7 @@ const ffiIxSdkFfiRustFutureCompleteI64 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
825
865
|
]);
|
|
826
866
|
const ffiIxSdkFfiRustFuturePollF32 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_f32', 'void', [
|
|
827
867
|
'uint64',
|
|
828
|
-
'
|
|
868
|
+
'void *',
|
|
829
869
|
'uint64',
|
|
830
870
|
]);
|
|
831
871
|
const ffiIxSdkFfiRustFutureCancelF32 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_f32', 'void', [
|
|
@@ -840,7 +880,7 @@ const ffiIxSdkFfiRustFutureCompleteF32 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
840
880
|
]);
|
|
841
881
|
const ffiIxSdkFfiRustFuturePollF64 = lib.func('ffi_ix_sdk_ffi_rust_future_poll_f64', 'void', [
|
|
842
882
|
'uint64',
|
|
843
|
-
'
|
|
883
|
+
'void *',
|
|
844
884
|
'uint64',
|
|
845
885
|
]);
|
|
846
886
|
const ffiIxSdkFfiRustFutureCancelF64 = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_f64', 'void', [
|
|
@@ -855,7 +895,7 @@ const ffiIxSdkFfiRustFutureCompleteF64 = lib.func('ffi_ix_sdk_ffi_rust_future_co
|
|
|
855
895
|
]);
|
|
856
896
|
const ffiIxSdkFfiRustFuturePollRustBuffer = lib.func('ffi_ix_sdk_ffi_rust_future_poll_rust_buffer', 'void', [
|
|
857
897
|
'uint64',
|
|
858
|
-
'
|
|
898
|
+
'void *',
|
|
859
899
|
'uint64',
|
|
860
900
|
]);
|
|
861
901
|
const ffiIxSdkFfiRustFutureCancelRustBuffer = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_rust_buffer', 'void', [
|
|
@@ -870,7 +910,7 @@ const ffiIxSdkFfiRustFutureCompleteRustBuffer = lib.func('ffi_ix_sdk_ffi_rust_fu
|
|
|
870
910
|
]);
|
|
871
911
|
const ffiIxSdkFfiRustFuturePollVoid = lib.func('ffi_ix_sdk_ffi_rust_future_poll_void', 'void', [
|
|
872
912
|
'uint64',
|
|
873
|
-
'
|
|
913
|
+
'void *',
|
|
874
914
|
'uint64',
|
|
875
915
|
]);
|
|
876
916
|
const ffiIxSdkFfiRustFutureCancelVoid = lib.func('ffi_ix_sdk_ffi_rust_future_cancel_void', 'void', [
|
|
@@ -1170,10 +1210,11 @@ let nextContinuationHandle = BigInt(1);
|
|
|
1170
1210
|
const continuationMap = new Map<bigint, (pollResult: number) => void>();
|
|
1171
1211
|
|
|
1172
1212
|
const uniffiContinuationCallback = koffi.register(
|
|
1173
|
-
(handle: bigint, pollResult: number) => {
|
|
1174
|
-
const
|
|
1213
|
+
(handle: bigint | number, pollResult: number) => {
|
|
1214
|
+
const key = typeof handle === 'bigint' ? handle : BigInt(handle);
|
|
1215
|
+
const resolve = continuationMap.get(key);
|
|
1175
1216
|
if (resolve) {
|
|
1176
|
-
continuationMap.delete(
|
|
1217
|
+
continuationMap.delete(key);
|
|
1177
1218
|
resolve(pollResult);
|
|
1178
1219
|
}
|
|
1179
1220
|
},
|
|
@@ -1417,9 +1458,8 @@ export interface FfiCompute {
|
|
|
1417
1458
|
exposedPorts: bigint[];
|
|
1418
1459
|
cpuCores: bigint;
|
|
1419
1460
|
memoryMib: bigint;
|
|
1420
|
-
|
|
1461
|
+
ephemeral: boolean;
|
|
1421
1462
|
enableSnapshots: boolean;
|
|
1422
|
-
volumeMode: FfiVolumeMode;
|
|
1423
1463
|
idleTimeoutSecs: bigint;
|
|
1424
1464
|
enableIpv4: boolean;
|
|
1425
1465
|
egressProxy: boolean;
|
|
@@ -1438,9 +1478,8 @@ function readFfiCompute(reader: BufReader): FfiCompute {
|
|
|
1438
1478
|
exposedPorts: readSequence(reader, (r) => r.readI64()),
|
|
1439
1479
|
cpuCores: reader.readI64(),
|
|
1440
1480
|
memoryMib: reader.readI64(),
|
|
1441
|
-
|
|
1481
|
+
ephemeral: reader.readBool(),
|
|
1442
1482
|
enableSnapshots: reader.readBool(),
|
|
1443
|
-
volumeMode: readFfiVolumeMode(reader),
|
|
1444
1483
|
idleTimeoutSecs: reader.readI64(),
|
|
1445
1484
|
enableIpv4: reader.readBool(),
|
|
1446
1485
|
egressProxy: reader.readBool(),
|
|
@@ -1459,9 +1498,8 @@ function writeFfiCompute(writer: BufWriter, value: FfiCompute): void {
|
|
|
1459
1498
|
writeSequence(writer, value.exposedPorts, (w, v) => w.writeI64(v));
|
|
1460
1499
|
writer.writeI64(value.cpuCores);
|
|
1461
1500
|
writer.writeI64(value.memoryMib);
|
|
1462
|
-
writer.writeBool(value.
|
|
1501
|
+
writer.writeBool(value.ephemeral);
|
|
1463
1502
|
writer.writeBool(value.enableSnapshots);
|
|
1464
|
-
writeFfiVolumeMode(writer, value.volumeMode);
|
|
1465
1503
|
writer.writeI64(value.idleTimeoutSecs);
|
|
1466
1504
|
writer.writeBool(value.enableIpv4);
|
|
1467
1505
|
writer.writeBool(value.egressProxy);
|
|
@@ -1539,14 +1577,12 @@ export interface FfiCreateComputeInput {
|
|
|
1539
1577
|
idleTimeoutSecs: bigint;
|
|
1540
1578
|
enableSnapshots: boolean;
|
|
1541
1579
|
enableIpv4: boolean;
|
|
1542
|
-
|
|
1580
|
+
ephemeral: boolean;
|
|
1543
1581
|
imageRef: string;
|
|
1544
1582
|
healthCheckPath: string | null;
|
|
1545
1583
|
healthCheckIntervalSecs: bigint;
|
|
1546
1584
|
healthCheckTimeoutSecs: bigint;
|
|
1547
|
-
stateful: boolean;
|
|
1548
1585
|
region: string | null;
|
|
1549
|
-
dockerfilePath: string | null;
|
|
1550
1586
|
}
|
|
1551
1587
|
|
|
1552
1588
|
function readFfiCreateComputeInput(reader: BufReader): FfiCreateComputeInput {
|
|
@@ -1559,14 +1595,12 @@ function readFfiCreateComputeInput(reader: BufReader): FfiCreateComputeInput {
|
|
|
1559
1595
|
idleTimeoutSecs: reader.readI64(),
|
|
1560
1596
|
enableSnapshots: reader.readBool(),
|
|
1561
1597
|
enableIpv4: reader.readBool(),
|
|
1562
|
-
|
|
1598
|
+
ephemeral: reader.readBool(),
|
|
1563
1599
|
imageRef: reader.readString(),
|
|
1564
1600
|
healthCheckPath: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1565
1601
|
healthCheckIntervalSecs: reader.readI64(),
|
|
1566
1602
|
healthCheckTimeoutSecs: reader.readI64(),
|
|
1567
|
-
stateful: reader.readBool(),
|
|
1568
1603
|
region: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1569
|
-
dockerfilePath: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1570
1604
|
};
|
|
1571
1605
|
}
|
|
1572
1606
|
|
|
@@ -1579,14 +1613,12 @@ function writeFfiCreateComputeInput(writer: BufWriter, value: FfiCreateComputeIn
|
|
|
1579
1613
|
writer.writeI64(value.idleTimeoutSecs);
|
|
1580
1614
|
writer.writeBool(value.enableSnapshots);
|
|
1581
1615
|
writer.writeBool(value.enableIpv4);
|
|
1582
|
-
|
|
1616
|
+
writer.writeBool(value.ephemeral);
|
|
1583
1617
|
writer.writeString(value.imageRef);
|
|
1584
1618
|
if (value.healthCheckPath === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.healthCheckPath) };
|
|
1585
1619
|
writer.writeI64(value.healthCheckIntervalSecs);
|
|
1586
1620
|
writer.writeI64(value.healthCheckTimeoutSecs);
|
|
1587
|
-
writer.writeBool(value.stateful);
|
|
1588
1621
|
if (value.region === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.region) };
|
|
1589
|
-
if (value.dockerfilePath === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.dockerfilePath) };
|
|
1590
1622
|
}
|
|
1591
1623
|
|
|
1592
1624
|
export interface FfiEnvVar {
|
|
@@ -1676,19 +1708,17 @@ export interface FfiUpdateComputeInput {
|
|
|
1676
1708
|
computeId: string;
|
|
1677
1709
|
name: string | null;
|
|
1678
1710
|
subdomain: string | null;
|
|
1679
|
-
dockerfilePath: string | null;
|
|
1680
1711
|
exposedPorts: bigint[] | null;
|
|
1681
1712
|
cpuCores: bigint | null;
|
|
1682
1713
|
memoryMib: bigint | null;
|
|
1683
1714
|
idleTimeoutSecs: bigint | null;
|
|
1684
1715
|
enableSnapshots: boolean | null;
|
|
1685
1716
|
enableIpv4: boolean | null;
|
|
1686
|
-
|
|
1717
|
+
ephemeral: boolean | null;
|
|
1687
1718
|
imageRef: string | null;
|
|
1688
1719
|
healthCheckPath: string | null;
|
|
1689
1720
|
healthCheckIntervalSecs: bigint | null;
|
|
1690
1721
|
healthCheckTimeoutSecs: bigint | null;
|
|
1691
|
-
stateful: boolean | null;
|
|
1692
1722
|
}
|
|
1693
1723
|
|
|
1694
1724
|
function readFfiUpdateComputeInput(reader: BufReader): FfiUpdateComputeInput {
|
|
@@ -1696,19 +1726,17 @@ function readFfiUpdateComputeInput(reader: BufReader): FfiUpdateComputeInput {
|
|
|
1696
1726
|
computeId: reader.readString(),
|
|
1697
1727
|
name: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1698
1728
|
subdomain: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1699
|
-
dockerfilePath: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1700
1729
|
exposedPorts: (reader.readU8() === 0 ? null : readSequence(reader, (r) => r.readI64())),
|
|
1701
1730
|
cpuCores: (reader.readU8() === 0 ? null : reader.readI64()),
|
|
1702
1731
|
memoryMib: (reader.readU8() === 0 ? null : reader.readI64()),
|
|
1703
1732
|
idleTimeoutSecs: (reader.readU8() === 0 ? null : reader.readI64()),
|
|
1704
1733
|
enableSnapshots: (reader.readU8() === 0 ? null : reader.readBool()),
|
|
1705
1734
|
enableIpv4: (reader.readU8() === 0 ? null : reader.readBool()),
|
|
1706
|
-
|
|
1735
|
+
ephemeral: (reader.readU8() === 0 ? null : reader.readBool()),
|
|
1707
1736
|
imageRef: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1708
1737
|
healthCheckPath: (reader.readU8() === 0 ? null : reader.readString()),
|
|
1709
1738
|
healthCheckIntervalSecs: (reader.readU8() === 0 ? null : reader.readI64()),
|
|
1710
1739
|
healthCheckTimeoutSecs: (reader.readU8() === 0 ? null : reader.readI64()),
|
|
1711
|
-
stateful: (reader.readU8() === 0 ? null : reader.readBool()),
|
|
1712
1740
|
};
|
|
1713
1741
|
}
|
|
1714
1742
|
|
|
@@ -1716,19 +1744,17 @@ function writeFfiUpdateComputeInput(writer: BufWriter, value: FfiUpdateComputeIn
|
|
|
1716
1744
|
writer.writeString(value.computeId);
|
|
1717
1745
|
if (value.name === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.name) };
|
|
1718
1746
|
if (value.subdomain === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.subdomain) };
|
|
1719
|
-
if (value.dockerfilePath === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.dockerfilePath) };
|
|
1720
1747
|
if (value.exposedPorts === null) { writer.writeU8(0); } else { writer.writeU8(1); writeSequence(writer, value.exposedPorts, (w, v) => w.writeI64(v)) };
|
|
1721
1748
|
if (value.cpuCores === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeI64(value.cpuCores) };
|
|
1722
1749
|
if (value.memoryMib === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeI64(value.memoryMib) };
|
|
1723
1750
|
if (value.idleTimeoutSecs === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeI64(value.idleTimeoutSecs) };
|
|
1724
1751
|
if (value.enableSnapshots === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeBool(value.enableSnapshots) };
|
|
1725
1752
|
if (value.enableIpv4 === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeBool(value.enableIpv4) };
|
|
1726
|
-
if (value.
|
|
1753
|
+
if (value.ephemeral === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeBool(value.ephemeral) };
|
|
1727
1754
|
if (value.imageRef === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.imageRef) };
|
|
1728
1755
|
if (value.healthCheckPath === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.healthCheckPath) };
|
|
1729
1756
|
if (value.healthCheckIntervalSecs === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeI64(value.healthCheckIntervalSecs) };
|
|
1730
1757
|
if (value.healthCheckTimeoutSecs === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeI64(value.healthCheckTimeoutSecs) };
|
|
1731
|
-
if (value.stateful === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeBool(value.stateful) };
|
|
1732
1758
|
}
|
|
1733
1759
|
|
|
1734
1760
|
export interface FfiCreateVmGroupInput {
|
|
@@ -2086,7 +2112,7 @@ export interface FfiVm {
|
|
|
2086
2112
|
subdomain: string | null;
|
|
2087
2113
|
maxMemoryMib: bigint;
|
|
2088
2114
|
maxCpuCores: bigint;
|
|
2089
|
-
|
|
2115
|
+
ephemeral: boolean;
|
|
2090
2116
|
forkParentVmId: string | null;
|
|
2091
2117
|
forkBaseLsnNs: string | null;
|
|
2092
2118
|
createdAt: string;
|
|
@@ -2103,7 +2129,7 @@ function readFfiVm(reader: BufReader): FfiVm {
|
|
|
2103
2129
|
subdomain: (reader.readU8() === 0 ? null : reader.readString()),
|
|
2104
2130
|
maxMemoryMib: reader.readI64(),
|
|
2105
2131
|
maxCpuCores: reader.readI64(),
|
|
2106
|
-
|
|
2132
|
+
ephemeral: reader.readBool(),
|
|
2107
2133
|
forkParentVmId: (reader.readU8() === 0 ? null : reader.readString()),
|
|
2108
2134
|
forkBaseLsnNs: (reader.readU8() === 0 ? null : reader.readString()),
|
|
2109
2135
|
createdAt: reader.readString(),
|
|
@@ -2120,7 +2146,7 @@ function writeFfiVm(writer: BufWriter, value: FfiVm): void {
|
|
|
2120
2146
|
if (value.subdomain === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.subdomain) };
|
|
2121
2147
|
writer.writeI64(value.maxMemoryMib);
|
|
2122
2148
|
writer.writeI64(value.maxCpuCores);
|
|
2123
|
-
|
|
2149
|
+
writer.writeBool(value.ephemeral);
|
|
2124
2150
|
if (value.forkParentVmId === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.forkParentVmId) };
|
|
2125
2151
|
if (value.forkBaseLsnNs === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.forkBaseLsnNs) };
|
|
2126
2152
|
writer.writeString(value.createdAt);
|
|
@@ -2136,7 +2162,7 @@ export interface FfiCreateVmResult {
|
|
|
2136
2162
|
subdomain: string | null;
|
|
2137
2163
|
maxMemoryMib: bigint;
|
|
2138
2164
|
maxCpuCores: bigint;
|
|
2139
|
-
|
|
2165
|
+
ephemeral: boolean;
|
|
2140
2166
|
createdAt: string;
|
|
2141
2167
|
}
|
|
2142
2168
|
|
|
@@ -2151,7 +2177,7 @@ function readFfiCreateVmResult(reader: BufReader): FfiCreateVmResult {
|
|
|
2151
2177
|
subdomain: (reader.readU8() === 0 ? null : reader.readString()),
|
|
2152
2178
|
maxMemoryMib: reader.readI64(),
|
|
2153
2179
|
maxCpuCores: reader.readI64(),
|
|
2154
|
-
|
|
2180
|
+
ephemeral: reader.readBool(),
|
|
2155
2181
|
createdAt: reader.readString(),
|
|
2156
2182
|
};
|
|
2157
2183
|
}
|
|
@@ -2166,7 +2192,7 @@ function writeFfiCreateVmResult(writer: BufWriter, value: FfiCreateVmResult): vo
|
|
|
2166
2192
|
if (value.subdomain === null) { writer.writeU8(0); } else { writer.writeU8(1); writer.writeString(value.subdomain) };
|
|
2167
2193
|
writer.writeI64(value.maxMemoryMib);
|
|
2168
2194
|
writer.writeI64(value.maxCpuCores);
|
|
2169
|
-
|
|
2195
|
+
writer.writeBool(value.ephemeral);
|
|
2170
2196
|
writer.writeString(value.createdAt);
|
|
2171
2197
|
}
|
|
2172
2198
|
|
|
@@ -2761,6 +2787,10 @@ export interface FfiSdkErrorParseError {
|
|
|
2761
2787
|
export interface FfiSdkErrorNoData {
|
|
2762
2788
|
tag: 'NoData';
|
|
2763
2789
|
}
|
|
2790
|
+
export interface FfiSdkErrorCapacityExhausted {
|
|
2791
|
+
tag: 'CapacityExhausted';
|
|
2792
|
+
message: string;
|
|
2793
|
+
}
|
|
2764
2794
|
export interface FfiSdkErrorInternal {
|
|
2765
2795
|
tag: 'Internal';
|
|
2766
2796
|
msg: string;
|
|
@@ -2776,6 +2806,7 @@ export type FfiSdkError =
|
|
|
2776
2806
|
| FfiSdkErrorRequestFailed
|
|
2777
2807
|
| FfiSdkErrorParseError
|
|
2778
2808
|
| FfiSdkErrorNoData
|
|
2809
|
+
| FfiSdkErrorCapacityExhausted
|
|
2779
2810
|
| FfiSdkErrorInternal;
|
|
2780
2811
|
|
|
2781
2812
|
function readFfiSdkError(reader: BufReader): FfiSdkError {
|
|
@@ -2827,6 +2858,11 @@ function readFfiSdkError(reader: BufReader): FfiSdkError {
|
|
|
2827
2858
|
tag: 'NoData' as const,
|
|
2828
2859
|
};
|
|
2829
2860
|
case 10:
|
|
2861
|
+
return {
|
|
2862
|
+
tag: 'CapacityExhausted' as const,
|
|
2863
|
+
message: reader.readString(),
|
|
2864
|
+
};
|
|
2865
|
+
case 11:
|
|
2830
2866
|
return {
|
|
2831
2867
|
tag: 'Internal' as const,
|
|
2832
2868
|
msg: reader.readString(),
|
|
@@ -2873,8 +2909,12 @@ function writeFfiSdkError(writer: BufWriter, value: FfiSdkError): void {
|
|
|
2873
2909
|
case 'NoData':
|
|
2874
2910
|
writer.writeI32(9);
|
|
2875
2911
|
break;
|
|
2876
|
-
case '
|
|
2912
|
+
case 'CapacityExhausted':
|
|
2877
2913
|
writer.writeI32(10);
|
|
2914
|
+
writer.writeString(value.message);
|
|
2915
|
+
break;
|
|
2916
|
+
case 'Internal':
|
|
2917
|
+
writer.writeI32(11);
|
|
2878
2918
|
writer.writeString(value.msg);
|
|
2879
2919
|
break;
|
|
2880
2920
|
}
|
|
@@ -2907,17 +2947,15 @@ function writeFfiComputeStatus(writer: BufWriter, value: FfiComputeStatus): void
|
|
|
2907
2947
|
}
|
|
2908
2948
|
|
|
2909
2949
|
export enum FfiImageSource {
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
System = 3,
|
|
2950
|
+
External = 1,
|
|
2951
|
+
System = 2,
|
|
2913
2952
|
}
|
|
2914
2953
|
|
|
2915
2954
|
function readFfiImageSource(reader: BufReader): FfiImageSource {
|
|
2916
2955
|
const variant = reader.readI32();
|
|
2917
2956
|
switch (variant) {
|
|
2918
|
-
case 1: return FfiImageSource.
|
|
2919
|
-
case 2: return FfiImageSource.
|
|
2920
|
-
case 3: return FfiImageSource.System;
|
|
2957
|
+
case 1: return FfiImageSource.External;
|
|
2958
|
+
case 2: return FfiImageSource.System;
|
|
2921
2959
|
default: throw new UniffiError(`Unexpected enum variant: ${variant}`);
|
|
2922
2960
|
}
|
|
2923
2961
|
}
|
|
@@ -3044,26 +3082,6 @@ function writeFfiVmStatus(writer: BufWriter, value: FfiVmStatus): void {
|
|
|
3044
3082
|
writer.writeI32(value);
|
|
3045
3083
|
}
|
|
3046
3084
|
|
|
3047
|
-
export enum FfiVolumeMode {
|
|
3048
|
-
None = 1,
|
|
3049
|
-
Shared = 2,
|
|
3050
|
-
PerReplica = 3,
|
|
3051
|
-
}
|
|
3052
|
-
|
|
3053
|
-
function readFfiVolumeMode(reader: BufReader): FfiVolumeMode {
|
|
3054
|
-
const variant = reader.readI32();
|
|
3055
|
-
switch (variant) {
|
|
3056
|
-
case 1: return FfiVolumeMode.None;
|
|
3057
|
-
case 2: return FfiVolumeMode.Shared;
|
|
3058
|
-
case 3: return FfiVolumeMode.PerReplica;
|
|
3059
|
-
default: throw new UniffiError(`Unexpected enum variant: ${variant}`);
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
function writeFfiVolumeMode(writer: BufWriter, value: FfiVolumeMode): void {
|
|
3064
|
-
writer.writeI32(value);
|
|
3065
|
-
}
|
|
3066
|
-
|
|
3067
3085
|
// ---- Error types ----
|
|
3068
3086
|
|
|
3069
3087
|
export class FfiMountErrorError extends Error {
|
|
@@ -3673,6 +3691,9 @@ export class IxSdkClient {
|
|
|
3673
3691
|
image: string,
|
|
3674
3692
|
options: FfiSpawnOptions | null
|
|
3675
3693
|
): Promise<string> {
|
|
3694
|
+
if (process.platform === 'linux') {
|
|
3695
|
+
return this.spawnBlocking(image, options);
|
|
3696
|
+
}
|
|
3676
3697
|
return await uniffiRustCallAsync(
|
|
3677
3698
|
() => uniffiIxSdkFfiFnMethodIxsdkclientSpawn(this.handle,
|
|
3678
3699
|
lowerString(image),
|
|
@@ -3685,6 +3706,20 @@ export class IxSdkClient {
|
|
|
3685
3706
|
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3686
3707
|
);
|
|
3687
3708
|
}
|
|
3709
|
+
spawnBlocking(
|
|
3710
|
+
image: string,
|
|
3711
|
+
options: FfiSpawnOptions | null
|
|
3712
|
+
): string {
|
|
3713
|
+
const result = rustCallWithError(
|
|
3714
|
+
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3715
|
+
(cs: any) => uniffiIxSdkFfiFnMethodIxsdkclientSpawnBlocking(this.handle,
|
|
3716
|
+
lowerString(image),
|
|
3717
|
+
lowerIntoBuffer(options, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); writeFfiSpawnOptions(w, v) } }, false),
|
|
3718
|
+
cs
|
|
3719
|
+
)
|
|
3720
|
+
);
|
|
3721
|
+
return liftString(result);
|
|
3722
|
+
}
|
|
3688
3723
|
async cancelMigration(
|
|
3689
3724
|
migrationId: string
|
|
3690
3725
|
): Promise<void> {
|
|
@@ -3891,6 +3926,9 @@ export class IxSdkClient {
|
|
|
3891
3926
|
waitUntilReady: boolean | null,
|
|
3892
3927
|
region: string | null
|
|
3893
3928
|
): Promise<FfiCreateVmResult> {
|
|
3929
|
+
if (process.platform === 'linux') {
|
|
3930
|
+
return this.createVmBlocking(id, image, name, maxMemoryMib, maxCpuCores, enableIpv4, waitUntilReady, region);
|
|
3931
|
+
}
|
|
3894
3932
|
return await uniffiRustCallAsync(
|
|
3895
3933
|
() => uniffiIxSdkFfiFnMethodIxsdkclientCreateVm(this.handle,
|
|
3896
3934
|
lowerIntoBuffer(id, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeString(v) } }, false),
|
|
@@ -3909,9 +3947,38 @@ export class IxSdkClient {
|
|
|
3909
3947
|
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3910
3948
|
);
|
|
3911
3949
|
}
|
|
3950
|
+
createVmBlocking(
|
|
3951
|
+
id: string | null,
|
|
3952
|
+
image: string,
|
|
3953
|
+
name: string | null,
|
|
3954
|
+
maxMemoryMib: bigint | null,
|
|
3955
|
+
maxCpuCores: bigint | null,
|
|
3956
|
+
enableIpv4: boolean | null,
|
|
3957
|
+
waitUntilReady: boolean | null,
|
|
3958
|
+
region: string | null
|
|
3959
|
+
): FfiCreateVmResult {
|
|
3960
|
+
const result = rustCallWithError(
|
|
3961
|
+
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3962
|
+
(cs: any) => uniffiIxSdkFfiFnMethodIxsdkclientCreateVmBlocking(this.handle,
|
|
3963
|
+
lowerIntoBuffer(id, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeString(v) } }, false),
|
|
3964
|
+
lowerString(image),
|
|
3965
|
+
lowerIntoBuffer(name, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeString(v) } }, false),
|
|
3966
|
+
lowerIntoBuffer(maxMemoryMib, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeI64(v) } }, false),
|
|
3967
|
+
lowerIntoBuffer(maxCpuCores, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeI64(v) } }, false),
|
|
3968
|
+
lowerIntoBuffer(enableIpv4, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeBool(v) } }, false),
|
|
3969
|
+
lowerIntoBuffer(waitUntilReady, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeBool(v) } }, false),
|
|
3970
|
+
lowerIntoBuffer(region, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeString(v) } }, false),
|
|
3971
|
+
cs
|
|
3972
|
+
)
|
|
3973
|
+
);
|
|
3974
|
+
return liftFromBuffer(result, (r) => readFfiCreateVmResult(r));
|
|
3975
|
+
}
|
|
3912
3976
|
async deleteVm(
|
|
3913
3977
|
vmId: string
|
|
3914
3978
|
): Promise<void> {
|
|
3979
|
+
if (process.platform === 'linux') {
|
|
3980
|
+
return this.deleteVmBlocking(vmId);
|
|
3981
|
+
}
|
|
3915
3982
|
return await uniffiRustCallAsync(
|
|
3916
3983
|
() => uniffiIxSdkFfiFnMethodIxsdkclientDeleteVm(this.handle,
|
|
3917
3984
|
lowerString(vmId),
|
|
@@ -3923,6 +3990,17 @@ export class IxSdkClient {
|
|
|
3923
3990
|
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3924
3991
|
);
|
|
3925
3992
|
}
|
|
3993
|
+
deleteVmBlocking(
|
|
3994
|
+
vmId: string
|
|
3995
|
+
): void {
|
|
3996
|
+
rustCallWithError(
|
|
3997
|
+
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3998
|
+
(cs: any) => uniffiIxSdkFfiFnMethodIxsdkclientDeleteVmBlocking(this.handle,
|
|
3999
|
+
lowerString(vmId),
|
|
4000
|
+
cs
|
|
4001
|
+
)
|
|
4002
|
+
);
|
|
4003
|
+
}
|
|
3926
4004
|
async deleteVmSecret(
|
|
3927
4005
|
vmId: string,
|
|
3928
4006
|
key: string
|
|
@@ -3944,6 +4022,9 @@ export class IxSdkClient {
|
|
|
3944
4022
|
command: string[],
|
|
3945
4023
|
workingDir: string | null
|
|
3946
4024
|
): Promise<FfiExecResult> {
|
|
4025
|
+
if (process.platform === 'linux') {
|
|
4026
|
+
return this.execVmBlocking(vmId, command, workingDir);
|
|
4027
|
+
}
|
|
3947
4028
|
return await uniffiRustCallAsync(
|
|
3948
4029
|
() => uniffiIxSdkFfiFnMethodIxsdkclientExecVm(this.handle,
|
|
3949
4030
|
lowerString(vmId),
|
|
@@ -3957,6 +4038,22 @@ export class IxSdkClient {
|
|
|
3957
4038
|
(buf: any) => liftFfiSdkErrorError(buf),
|
|
3958
4039
|
);
|
|
3959
4040
|
}
|
|
4041
|
+
execVmBlocking(
|
|
4042
|
+
vmId: string,
|
|
4043
|
+
command: string[],
|
|
4044
|
+
workingDir: string | null
|
|
4045
|
+
): FfiExecResult {
|
|
4046
|
+
const result = rustCallWithError(
|
|
4047
|
+
(buf: any) => liftFfiSdkErrorError(buf),
|
|
4048
|
+
(cs: any) => uniffiIxSdkFfiFnMethodIxsdkclientExecVmBlocking(this.handle,
|
|
4049
|
+
lowerString(vmId),
|
|
4050
|
+
lowerIntoBuffer(command, (w, v) => { w.writeI32(v.length); for (const item of v) { w.writeString(item) } }, false),
|
|
4051
|
+
lowerIntoBuffer(workingDir, (w, v) => { if (v === null) { w.writeU8(0); } else { w.writeU8(1); w.writeString(v) } }, false),
|
|
4052
|
+
cs
|
|
4053
|
+
)
|
|
4054
|
+
);
|
|
4055
|
+
return liftFromBuffer(result, (r) => readFfiExecResult(r));
|
|
4056
|
+
}
|
|
3960
4057
|
async forkVm(
|
|
3961
4058
|
vmId: string,
|
|
3962
4059
|
name: string | null,
|