@trylimbo/sdk-plugin-mxf 0.2.25-canary.37 → 0.2.25-canary.38
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/gen/ffi/index.js +66 -8
- package/package.json +3 -3
package/gen/ffi/index.js
CHANGED
|
@@ -658,10 +658,17 @@ const UNIFFI_FOREIGN_FUTURE_HANDLE_MAP = new UniffiHandleMap();
|
|
|
658
658
|
function uniffiTraitInterfaceCallAsyncWithError(makeCall, handleSuccess, handleError, isErrorType, lowerError, lowerString, alloc) {
|
|
659
659
|
const settledHolder = { settled: false };
|
|
660
660
|
const abortController = new AbortController();
|
|
661
|
+
let onRejected;
|
|
661
662
|
const promiseHelper = {
|
|
662
663
|
abortController,
|
|
663
664
|
settledHolder,
|
|
664
|
-
promise: makeCall(abortController.signal).finally(() => settledHolder.settled = true).then(
|
|
665
|
+
promise: makeCall(abortController.signal).finally(() => settledHolder.settled = true).then((value) => {
|
|
666
|
+
try {
|
|
667
|
+
handleSuccess(value);
|
|
668
|
+
} catch (error) {
|
|
669
|
+
onRejected(error);
|
|
670
|
+
}
|
|
671
|
+
}, onRejected = (error) => {
|
|
665
672
|
let message = error.message ? error.message : error.toString();
|
|
666
673
|
if (isErrorType(error)) try {
|
|
667
674
|
handleError(1, lowerError(error, alloc));
|
|
@@ -906,16 +913,58 @@ var Cursor = class Cursor {
|
|
|
906
913
|
};
|
|
907
914
|
//#endregion
|
|
908
915
|
//#region ../../../../../node_modules/@ubjs/core/dist/esm/ffi-converters.js
|
|
916
|
+
function uniffiInvalid(message) {
|
|
917
|
+
return SdkError.Invalid.new({
|
|
918
|
+
code: Code.InvalidArgument,
|
|
919
|
+
message,
|
|
920
|
+
fieldViolations: []
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
const uniffiUnsignedBounds = {
|
|
924
|
+
UInt8: 255,
|
|
925
|
+
UInt16: 65535,
|
|
926
|
+
UInt32: 4294967295
|
|
927
|
+
};
|
|
928
|
+
function uniffiChecked(kind, converter) {
|
|
929
|
+
const unsigned = kind.startsWith("UInt");
|
|
930
|
+
const bits = Number(kind.replace(/\D/g, ""));
|
|
931
|
+
const wide = bits === 64;
|
|
932
|
+
const lower = wide ? unsigned ? BigInt("0") : -(BigInt("1") << BigInt("63")) : unsigned ? 0 : -(2 ** (bits - 1));
|
|
933
|
+
const upper = wide ? unsigned ? (BigInt("1") << BigInt("64")) - BigInt("1") : (BigInt("1") << BigInt("63")) - BigInt("1") : unsigned ? uniffiUnsignedBounds[kind] : 2 ** (bits - 1) - 1;
|
|
934
|
+
return {
|
|
935
|
+
...converter,
|
|
936
|
+
lower: (v, _alloc) => {
|
|
937
|
+
if (wide ? typeof v !== "bigint" : typeof v !== "number" || !Number.isInteger(v)) throw uniffiInvalid(`expected ${wide ? "a bigint" : "an integer number"} for a ${kind}, got ${typeof v === "number" ? v : typeof v}`);
|
|
938
|
+
if (v < lower || v > upper) throw uniffiInvalid(`${v} is outside the range of a ${kind}`);
|
|
939
|
+
return v;
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
function uniffiMillis(value) {
|
|
944
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw uniffiInvalid(`a duration is a non-negative whole number of milliseconds, got ${typeof value === "number" ? value : typeof value}`);
|
|
945
|
+
return value;
|
|
946
|
+
}
|
|
947
|
+
function uniffiObject(value) {
|
|
948
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") throw uniffiInvalid(`expected an object, got ${value === null ? "null" : typeof value}`);
|
|
949
|
+
}
|
|
950
|
+
function uniffiBytes(value) {
|
|
951
|
+
if (!(value instanceof ArrayBuffer || value instanceof Uint8Array)) throw uniffiInvalid(`expected an ArrayBuffer or Uint8Array, got ${value === null ? "null" : typeof value}`);
|
|
952
|
+
}
|
|
909
953
|
var AbstractFfiConverterByteArray = class {
|
|
910
954
|
lift(value) {
|
|
911
955
|
const c = Cursor.fromUint8Array(value);
|
|
912
956
|
return this.readFromCursor(c);
|
|
913
957
|
}
|
|
914
958
|
lower(value, alloc) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
959
|
+
try {
|
|
960
|
+
const view = alloc(this.allocationSize(value));
|
|
961
|
+
const c = Cursor.fromUint8Array(view);
|
|
962
|
+
this.writeIntoCursor(value, c);
|
|
963
|
+
return view;
|
|
964
|
+
} catch (error) {
|
|
965
|
+
if (error != null && SdkError.instanceOf(error)) throw error;
|
|
966
|
+
throw uniffiInvalid(error instanceof Error ? error.message : String(error));
|
|
967
|
+
}
|
|
919
968
|
}
|
|
920
969
|
};
|
|
921
970
|
/**
|
|
@@ -935,8 +984,14 @@ function makePrimitive(read, write, byteSize) {
|
|
|
935
984
|
writeIntoCursor: write
|
|
936
985
|
};
|
|
937
986
|
}
|
|
938
|
-
|
|
939
|
-
|
|
987
|
+
uniffiChecked("Int8", makePrimitive((c) => c.readI8(), (v, c) => c.writeI8(v), 1));
|
|
988
|
+
uniffiChecked("Int16", makePrimitive((c) => c.readI16(), (v, c) => c.writeI16(v), 2));
|
|
989
|
+
uniffiChecked("Int32", makePrimitive((c) => c.readI32(), (v, c) => c.writeI32(v), 4));
|
|
990
|
+
uniffiChecked("Int64", makePrimitive((c) => c.readI64(), (v, c) => c.writeI64(v), 8));
|
|
991
|
+
uniffiChecked("UInt8", makePrimitive((c) => c.readU8(), (v, c) => c.writeU8(v), 1));
|
|
992
|
+
uniffiChecked("UInt16", makePrimitive((c) => c.readU16(), (v, c) => c.writeU16(v), 2));
|
|
993
|
+
const FfiConverterUInt32 = uniffiChecked("UInt32", makePrimitive((c) => c.readU32(), (v, c) => c.writeU32(v), 4));
|
|
994
|
+
const FfiConverterUInt64 = uniffiChecked("UInt64", makePrimitive((c) => c.readU64(), (v, c) => c.writeU64(v), 8));
|
|
940
995
|
(() => {
|
|
941
996
|
const msPerSecBigInt = BigInt("1000");
|
|
942
997
|
const nanosPerMs = 1e6;
|
|
@@ -949,7 +1004,7 @@ const FfiConverterUInt64 = makePrimitive((c) => c.readU64(), (v, c) => c.writeU6
|
|
|
949
1004
|
return ms + nanos / nanosPerMs;
|
|
950
1005
|
}
|
|
951
1006
|
writeIntoCursor(value, c) {
|
|
952
|
-
const ms = value
|
|
1007
|
+
const ms = uniffiMillis(value);
|
|
953
1008
|
const secsBigInt = BigInt(Math.trunc(ms)) / msPerSecBigInt;
|
|
954
1009
|
const remainingNanos = ms % 1e3 * nanosPerMs;
|
|
955
1010
|
c.writeU64(secsBigInt);
|
|
@@ -1071,6 +1126,7 @@ const FfiConverterArrayBuffer = (() => {
|
|
|
1071
1126
|
c.writeBytes(new Uint8Array(value));
|
|
1072
1127
|
}
|
|
1073
1128
|
allocationSize(value) {
|
|
1129
|
+
uniffiBytes(value);
|
|
1074
1130
|
return 4 + value.byteLength;
|
|
1075
1131
|
}
|
|
1076
1132
|
}
|
|
@@ -1144,6 +1200,7 @@ var FfiConverterCallback = class {
|
|
|
1144
1200
|
return this.handleMap.get(value);
|
|
1145
1201
|
}
|
|
1146
1202
|
lower(value, _alloc) {
|
|
1203
|
+
uniffiObject(value);
|
|
1147
1204
|
return this.handleMap.insert(value);
|
|
1148
1205
|
}
|
|
1149
1206
|
readFromCursor(c) {
|
|
@@ -1206,6 +1263,7 @@ var FfiConverterObject = class {
|
|
|
1206
1263
|
pointerConverter.writeIntoCursor(this.lowerHandle(value), c);
|
|
1207
1264
|
}
|
|
1208
1265
|
lowerHandle(value) {
|
|
1266
|
+
uniffiObject(value);
|
|
1209
1267
|
if (this.factory.isConcreteType(value)) return this.factory.clonePointer(value);
|
|
1210
1268
|
else throw new Error("Cannot lower this object to a pointer");
|
|
1211
1269
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"optionalDependencies": {
|
|
3
|
-
"@trylimbo/sdk-plugin-mxf-linux-arm64-gnu": "0.2.25-canary.
|
|
4
|
-
"@trylimbo/sdk-plugin-mxf-linux-x64-gnu": "0.2.25-canary.
|
|
3
|
+
"@trylimbo/sdk-plugin-mxf-linux-arm64-gnu": "0.2.25-canary.38",
|
|
4
|
+
"@trylimbo/sdk-plugin-mxf-linux-x64-gnu": "0.2.25-canary.38",
|
|
5
5
|
"@ubjs/node-linux-arm64-gnu": "0.31.0-5",
|
|
6
6
|
"@ubjs/node-linux-x64-gnu": "0.31.0-5"
|
|
7
7
|
},
|
|
8
8
|
"name": "@trylimbo/sdk-plugin-mxf",
|
|
9
|
-
"version": "0.2.25-canary.
|
|
9
|
+
"version": "0.2.25-canary.38",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|