@anuma/sdk 9.1.6 → 9.1.7
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/index.cjs +106 -94
- package/dist/client/index.mjs +106 -94
- package/dist/expo/index.cjs +15 -3
- package/dist/expo/index.mjs +15 -3
- package/dist/index.cjs +47 -35
- package/dist/index.mjs +47 -35
- package/dist/react/index.cjs +29 -8
- package/dist/react/index.mjs +29 -8
- package/dist/server/index.cjs +23 -2
- package/dist/server/index.mjs +23 -2
- package/dist/tools/selection/index.cjs +14 -2
- package/dist/tools/selection/index.mjs +14 -2
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -15987,7 +15987,14 @@ function cosineSimilarity(a, b) {
|
|
|
15987
15987
|
|
|
15988
15988
|
// src/lib/processors/encoding.ts
|
|
15989
15989
|
var B64_ENCODE_CHUNK = 32768 * 3;
|
|
15990
|
+
function assertFileUrlAllowed(dataUrl) {
|
|
15991
|
+
const isNode = typeof process !== "undefined" && Boolean(process.versions?.node);
|
|
15992
|
+
if (isNode && !dataUrl.startsWith("data:") && !dataUrl.startsWith("blob:")) {
|
|
15993
|
+
throw new Error("Server file preprocessing requires a data URL or blob URL.");
|
|
15994
|
+
}
|
|
15995
|
+
}
|
|
15990
15996
|
async function dataUrlToArrayBuffer(dataUrl) {
|
|
15997
|
+
assertFileUrlAllowed(dataUrl);
|
|
15991
15998
|
if (dataUrl.startsWith("blob:") || dataUrl.startsWith("http://") || dataUrl.startsWith("https://")) {
|
|
15992
15999
|
const response = await fetch(dataUrl);
|
|
15993
16000
|
return response.arrayBuffer();
|
|
@@ -18311,7 +18318,7 @@ var mergeHeaders = (...headers) => {
|
|
|
18311
18318
|
if (!header || typeof header !== "object") {
|
|
18312
18319
|
continue;
|
|
18313
18320
|
}
|
|
18314
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
18321
|
+
const iterator = Array.isArray(header) || header instanceof Headers ? headersEntries(new Headers(header)) : Object.entries(header);
|
|
18315
18322
|
for (const [key, value] of iterator) {
|
|
18316
18323
|
if (value === null) {
|
|
18317
18324
|
mergedHeaders.delete(key);
|
|
@@ -18586,13 +18593,25 @@ var createClient = (config = {}) => {
|
|
|
18586
18593
|
// src/client/client.gen.ts
|
|
18587
18594
|
var client = createClient(createClientConfig(createConfig()));
|
|
18588
18595
|
|
|
18596
|
+
// src/clientHeaders.ts
|
|
18597
|
+
function normalizeHeaders(headers) {
|
|
18598
|
+
if (headers instanceof Headers || Array.isArray(headers)) {
|
|
18599
|
+
const normalized = /* @__PURE__ */ Object.create(null);
|
|
18600
|
+
new Headers(headers).forEach((value, name) => {
|
|
18601
|
+
normalized[name] = value;
|
|
18602
|
+
});
|
|
18603
|
+
return normalized;
|
|
18604
|
+
}
|
|
18605
|
+
return headers;
|
|
18606
|
+
}
|
|
18607
|
+
|
|
18589
18608
|
// src/client/sdk.gen.ts
|
|
18590
18609
|
var postApiV1Embeddings = (options) => (options.client ?? client).post({
|
|
18591
18610
|
url: "/api/v1/embeddings",
|
|
18592
18611
|
...options,
|
|
18593
18612
|
headers: {
|
|
18594
18613
|
"Content-Type": "application/json",
|
|
18595
|
-
...options.headers
|
|
18614
|
+
...normalizeHeaders(options.headers)
|
|
18596
18615
|
}
|
|
18597
18616
|
});
|
|
18598
18617
|
|
|
@@ -37286,6 +37305,7 @@ async function getPdfjs() {
|
|
|
37286
37305
|
return pdfjsModule;
|
|
37287
37306
|
}
|
|
37288
37307
|
async function withPdfDocument(pdfDataUrl, fn) {
|
|
37308
|
+
assertFileUrlAllowed(pdfDataUrl);
|
|
37289
37309
|
const pdfjs = await getPdfjs();
|
|
37290
37310
|
const loadingTask = pdfjs.getDocument(pdfDataUrl);
|
|
37291
37311
|
let pdf;
|
|
@@ -38074,6 +38094,7 @@ async function preprocessFiles(files, options = {}) {
|
|
|
38074
38094
|
skip("no_data");
|
|
38075
38095
|
continue;
|
|
38076
38096
|
}
|
|
38097
|
+
assertFileUrlAllowed(file.url);
|
|
38077
38098
|
const fileWithData = {
|
|
38078
38099
|
...file,
|
|
38079
38100
|
dataUrl: file.url
|
|
@@ -643,7 +643,7 @@ var mergeHeaders = (...headers) => {
|
|
|
643
643
|
if (!header || typeof header !== "object") {
|
|
644
644
|
continue;
|
|
645
645
|
}
|
|
646
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
646
|
+
const iterator = Array.isArray(header) || header instanceof Headers ? headersEntries(new Headers(header)) : Object.entries(header);
|
|
647
647
|
for (const [key, value] of iterator) {
|
|
648
648
|
if (value === null) {
|
|
649
649
|
mergedHeaders.delete(key);
|
|
@@ -919,13 +919,25 @@ var createClient = (config = {}) => {
|
|
|
919
919
|
init_clientConfig();
|
|
920
920
|
var client = createClient(createClientConfig(createConfig()));
|
|
921
921
|
|
|
922
|
+
// src/clientHeaders.ts
|
|
923
|
+
function normalizeHeaders(headers) {
|
|
924
|
+
if (headers instanceof Headers || Array.isArray(headers)) {
|
|
925
|
+
const normalized = /* @__PURE__ */ Object.create(null);
|
|
926
|
+
new Headers(headers).forEach((value, name) => {
|
|
927
|
+
normalized[name] = value;
|
|
928
|
+
});
|
|
929
|
+
return normalized;
|
|
930
|
+
}
|
|
931
|
+
return headers;
|
|
932
|
+
}
|
|
933
|
+
|
|
922
934
|
// src/client/sdk.gen.ts
|
|
923
935
|
var postApiV1Embeddings = (options) => (options.client ?? client).post({
|
|
924
936
|
url: "/api/v1/embeddings",
|
|
925
937
|
...options,
|
|
926
938
|
headers: {
|
|
927
939
|
"Content-Type": "application/json",
|
|
928
|
-
...options.headers
|
|
940
|
+
...normalizeHeaders(options.headers)
|
|
929
941
|
}
|
|
930
942
|
});
|
|
931
943
|
|
|
@@ -525,7 +525,7 @@ var mergeHeaders = (...headers) => {
|
|
|
525
525
|
if (!header || typeof header !== "object") {
|
|
526
526
|
continue;
|
|
527
527
|
}
|
|
528
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
528
|
+
const iterator = Array.isArray(header) || header instanceof Headers ? headersEntries(new Headers(header)) : Object.entries(header);
|
|
529
529
|
for (const [key, value] of iterator) {
|
|
530
530
|
if (value === null) {
|
|
531
531
|
mergedHeaders.delete(key);
|
|
@@ -800,13 +800,25 @@ var createClient = (config = {}) => {
|
|
|
800
800
|
// src/client/client.gen.ts
|
|
801
801
|
var client = createClient(createClientConfig(createConfig()));
|
|
802
802
|
|
|
803
|
+
// src/clientHeaders.ts
|
|
804
|
+
function normalizeHeaders(headers) {
|
|
805
|
+
if (headers instanceof Headers || Array.isArray(headers)) {
|
|
806
|
+
const normalized = /* @__PURE__ */ Object.create(null);
|
|
807
|
+
new Headers(headers).forEach((value, name) => {
|
|
808
|
+
normalized[name] = value;
|
|
809
|
+
});
|
|
810
|
+
return normalized;
|
|
811
|
+
}
|
|
812
|
+
return headers;
|
|
813
|
+
}
|
|
814
|
+
|
|
803
815
|
// src/client/sdk.gen.ts
|
|
804
816
|
var postApiV1Embeddings = (options) => (options.client ?? client).post({
|
|
805
817
|
url: "/api/v1/embeddings",
|
|
806
818
|
...options,
|
|
807
819
|
headers: {
|
|
808
820
|
"Content-Type": "application/json",
|
|
809
|
-
...options.headers
|
|
821
|
+
...normalizeHeaders(options.headers)
|
|
810
822
|
}
|
|
811
823
|
});
|
|
812
824
|
|