@ateam-ai-mobile/expo 0.1.11 → 0.1.13
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/bootstrap.js +44 -27
- package/dist/bootstrap.js.map +1 -1
- package/dist/bootstrap.mjs +3 -3
- package/dist/{chunk-C7M5WAHA.mjs → chunk-42FP5DTO.mjs} +17 -5
- package/dist/chunk-42FP5DTO.mjs.map +1 -0
- package/dist/{chunk-PCAEUX2N.mjs → chunk-6JX222YX.mjs} +21 -10
- package/dist/chunk-6JX222YX.mjs.map +1 -0
- package/dist/{chunk-GF2MPTAB.mjs → chunk-DLDG77DX.mjs} +2 -2
- package/dist/device/createDeviceProvider.js +28 -23
- package/dist/device/createDeviceProvider.js.map +1 -1
- package/dist/device/createDeviceProvider.mjs +2 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/vision/index.d.mts +10 -3
- package/dist/vision/index.d.ts +10 -3
- package/dist/vision/index.js +20 -9
- package/dist/vision/index.js.map +1 -1
- package/dist/vision/index.mjs +1 -1
- package/ios/AdaVisionModule.swift +55 -13
- package/package.json +4 -4
- package/src/device-state/domains/visual.ts +7 -2
- package/src/device-state/visualEngine.ts +15 -2
- package/src/vision/index.ts +34 -10
- package/dist/chunk-C7M5WAHA.mjs.map +0 -1
- package/dist/chunk-PCAEUX2N.mjs.map +0 -1
- /package/dist/{chunk-GF2MPTAB.mjs.map → chunk-DLDG77DX.mjs.map} +0 -0
|
@@ -289,6 +289,14 @@ var CameraPreview = (() => {
|
|
|
289
289
|
}
|
|
290
290
|
})();
|
|
291
291
|
var native = (0, import_expo_modules_core.requireOptionalNativeModule)("AdaVision");
|
|
292
|
+
function verb(name) {
|
|
293
|
+
if (!native) throw new Error("ada-vision native module not present in this build");
|
|
294
|
+
const fn = native[name];
|
|
295
|
+
if (typeof fn !== "function") {
|
|
296
|
+
throw Object.assign(new Error(`UNAVAILABLE: ada-vision ${String(name)} is not implemented on this platform (iOS only)`), { code: "UNAVAILABLE" });
|
|
297
|
+
}
|
|
298
|
+
return fn.bind(native);
|
|
299
|
+
}
|
|
292
300
|
function isSupported() {
|
|
293
301
|
try {
|
|
294
302
|
return native?.isSupported() ?? false;
|
|
@@ -300,16 +308,13 @@ function qualityById(id) {
|
|
|
300
308
|
return native?.qualityById?.(id) ?? null;
|
|
301
309
|
}
|
|
302
310
|
async function readText(id, languages) {
|
|
303
|
-
|
|
304
|
-
return native.readText(id, languages ?? null);
|
|
311
|
+
return verb("readText")(id, languages ?? null);
|
|
305
312
|
}
|
|
306
313
|
async function describe(id, maxLabels = 5) {
|
|
307
|
-
|
|
308
|
-
return native.describe(id, maxLabels);
|
|
314
|
+
return verb("describe")(id, maxLabels);
|
|
309
315
|
}
|
|
310
316
|
async function detectObjects(id, maxItems = 10, minConfidence = 0.25) {
|
|
311
|
-
|
|
312
|
-
return native.detectObjects(id, maxItems, minConfidence);
|
|
317
|
+
return verb("detectObjects")(id, maxItems, minConfidence);
|
|
313
318
|
}
|
|
314
319
|
|
|
315
320
|
// src/maps/index.ts
|
|
@@ -342,22 +347,22 @@ var shown = (v) => {
|
|
|
342
347
|
s = s ?? String(v);
|
|
343
348
|
return s.length > 80 ? `${s.slice(0, 77)}...` : s;
|
|
344
349
|
};
|
|
345
|
-
function refuseArgument(capability,
|
|
346
|
-
const e = new Error(`${capability}.${
|
|
350
|
+
function refuseArgument(capability, verb2, problem, nothing) {
|
|
351
|
+
const e = new Error(`${capability}.${verb2}: ${problem}; ${nothing}.`);
|
|
347
352
|
e.code = "INVALID_ARGUMENT";
|
|
348
353
|
return e;
|
|
349
354
|
}
|
|
350
|
-
function countArg(capability,
|
|
355
|
+
function countArg(capability, verb2, name, value, def, max, nothing) {
|
|
351
356
|
const v = value ?? def;
|
|
352
357
|
if (typeof v !== "number" || !Number.isFinite(v) || v < 1) {
|
|
353
|
-
throw refuseArgument(capability,
|
|
358
|
+
throw refuseArgument(capability, verb2, `${name} must be a number from 1 (at most ${max} are used), not ${shown(value)}`, nothing);
|
|
354
359
|
}
|
|
355
360
|
return Math.min(max, Math.floor(v));
|
|
356
361
|
}
|
|
357
|
-
function fractionArg(capability,
|
|
362
|
+
function fractionArg(capability, verb2, name, value, def, nothing) {
|
|
358
363
|
const v = value ?? def;
|
|
359
364
|
if (typeof v !== "number" || !Number.isFinite(v) || v < 0 || v > 1) {
|
|
360
|
-
throw refuseArgument(capability,
|
|
365
|
+
throw refuseArgument(capability, verb2, `${name} must be a number from 0 to 1, not ${shown(value)}`, nothing);
|
|
361
366
|
}
|
|
362
367
|
return v;
|
|
363
368
|
}
|
|
@@ -368,15 +373,15 @@ var SEARCH_RADIUS_MAX_M = 1e5;
|
|
|
368
373
|
var SEARCH_LIMIT_DEFAULT = 8;
|
|
369
374
|
var SEARCH_LIMIT_MAX = 25;
|
|
370
375
|
var text = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
|
|
371
|
-
var refuseArgument2 = (
|
|
372
|
-
function coordinateArg(
|
|
376
|
+
var refuseArgument2 = (verb2, problem, nothing) => refuseArgument("maps", verb2, problem, nothing);
|
|
377
|
+
function coordinateArg(verb2, name, value, nothing) {
|
|
373
378
|
const c = value;
|
|
374
379
|
const latitude = c?.latitude, longitude = c?.longitude;
|
|
375
380
|
if (typeof latitude === "number" && Number.isFinite(latitude) && Math.abs(latitude) <= 90 && typeof longitude === "number" && Number.isFinite(longitude) && Math.abs(longitude) <= 180) {
|
|
376
381
|
return { latitude, longitude };
|
|
377
382
|
}
|
|
378
383
|
throw refuseArgument2(
|
|
379
|
-
|
|
384
|
+
verb2,
|
|
380
385
|
`${name} must be { latitude, longitude } numbers (latitude -90..90, longitude -180..180), not ${shown(value)}`,
|
|
381
386
|
nothing
|
|
382
387
|
);
|
|
@@ -456,7 +461,7 @@ function toMapsRoute(raw) {
|
|
|
456
461
|
polyline: (raw.polyline ?? []).map(point)
|
|
457
462
|
};
|
|
458
463
|
}
|
|
459
|
-
function mapsFailure(
|
|
464
|
+
function mapsFailure(verb2, err) {
|
|
460
465
|
const nativeCode = String(err?.code ?? "");
|
|
461
466
|
const detail = String(err?.message ?? err ?? "").trim();
|
|
462
467
|
let code;
|
|
@@ -475,7 +480,7 @@ function mapsFailure(verb, err) {
|
|
|
475
480
|
why = "the map service failed";
|
|
476
481
|
}
|
|
477
482
|
const failure = new Error(
|
|
478
|
-
`maps.${
|
|
483
|
+
`maps.${verb2} could not look: ${why}. This is not "found nothing".` + (detail ? ` (${nativeCode ? nativeCode + ": " : ""}${detail})` : "")
|
|
479
484
|
);
|
|
480
485
|
failure.code = code;
|
|
481
486
|
return failure;
|
|
@@ -803,15 +808,15 @@ function createStorageAPI(pluginId) {
|
|
|
803
808
|
delete: (k) => import_async_storage3.default.removeItem(key(k)),
|
|
804
809
|
db: {
|
|
805
810
|
async execute(sql, params) {
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
811
|
+
const verb2 = sqlLeadingKeyword(sql);
|
|
812
|
+
if (verb2 === "ATTACH" || verb2 === "DETACH" || verb2 === "VACUUM") {
|
|
808
813
|
throw new CapabilityUnavailableError(
|
|
809
814
|
"storage.db",
|
|
810
|
-
`SQL '${
|
|
815
|
+
`SQL '${verb2}' is not permitted: a plugin's storage is confined to its own database and cannot reach another file.`
|
|
811
816
|
);
|
|
812
817
|
}
|
|
813
818
|
const db = await openPluginDb(dbFile);
|
|
814
|
-
const returnsRows =
|
|
819
|
+
const returnsRows = verb2 === "SELECT" || verb2 === "PRAGMA" || verb2 === "WITH";
|
|
815
820
|
if (returnsRows) {
|
|
816
821
|
const rows = await db.getAllAsync(sql, params ?? []);
|
|
817
822
|
return { rows, changes: 0 };
|
|
@@ -1146,10 +1151,10 @@ function createVisionAPI() {
|
|
|
1146
1151
|
};
|
|
1147
1152
|
}
|
|
1148
1153
|
function createMapsAPI() {
|
|
1149
|
-
const refuseIfMissing = (
|
|
1154
|
+
const refuseIfMissing = (verb2, nothing) => {
|
|
1150
1155
|
const missing = missingReason();
|
|
1151
1156
|
if (missing) {
|
|
1152
|
-
throw new CapabilityUnavailableError(`maps.${
|
|
1157
|
+
throw new CapabilityUnavailableError(`maps.${verb2}`, `maps.${verb2} needs ${missing}; ${nothing}.`);
|
|
1153
1158
|
}
|
|
1154
1159
|
};
|
|
1155
1160
|
return {
|