@blinkdotnew/dev-sdk 2.1.2 → 2.1.3
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/index.d.mts +291 -9
- package/dist/index.d.ts +291 -9
- package/dist/index.js +475 -143
- package/dist/index.mjs +473 -144
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -7,6 +7,33 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
7
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
+
// ../core/src/platform.ts
|
|
11
|
+
function detectPlatform() {
|
|
12
|
+
if (typeof Deno !== "undefined") {
|
|
13
|
+
return "deno";
|
|
14
|
+
}
|
|
15
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
16
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
17
|
+
return "react-native";
|
|
18
|
+
}
|
|
19
|
+
return "node";
|
|
20
|
+
}
|
|
21
|
+
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
22
|
+
return "react-native";
|
|
23
|
+
}
|
|
24
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
25
|
+
return "web";
|
|
26
|
+
}
|
|
27
|
+
return "node";
|
|
28
|
+
}
|
|
29
|
+
var platform = detectPlatform();
|
|
30
|
+
var isWeb = platform === "web";
|
|
31
|
+
var isReactNative = platform === "react-native";
|
|
32
|
+
var isNode = platform === "node";
|
|
33
|
+
var isDeno = platform === "deno";
|
|
34
|
+
var isBrowser = isWeb || isReactNative;
|
|
35
|
+
var isServer = isNode || isDeno;
|
|
36
|
+
|
|
10
37
|
// ../core/src/storage-adapter.ts
|
|
11
38
|
var WebStorageAdapter = class {
|
|
12
39
|
getItem(key) {
|
|
@@ -92,6 +119,9 @@ var NoOpStorageAdapter = class {
|
|
|
92
119
|
}
|
|
93
120
|
};
|
|
94
121
|
function getDefaultStorageAdapter() {
|
|
122
|
+
if (isDeno) {
|
|
123
|
+
return new NoOpStorageAdapter();
|
|
124
|
+
}
|
|
95
125
|
if (typeof window !== "undefined" && typeof localStorage !== "undefined") {
|
|
96
126
|
try {
|
|
97
127
|
localStorage.setItem("__test__", "test");
|
|
@@ -103,28 +133,6 @@ function getDefaultStorageAdapter() {
|
|
|
103
133
|
return new NoOpStorageAdapter();
|
|
104
134
|
}
|
|
105
135
|
|
|
106
|
-
// ../core/src/platform.ts
|
|
107
|
-
function detectPlatform() {
|
|
108
|
-
if (typeof process !== "undefined" && process.versions?.node) {
|
|
109
|
-
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
110
|
-
return "react-native";
|
|
111
|
-
}
|
|
112
|
-
return "node";
|
|
113
|
-
}
|
|
114
|
-
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
115
|
-
return "react-native";
|
|
116
|
-
}
|
|
117
|
-
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
118
|
-
return "web";
|
|
119
|
-
}
|
|
120
|
-
return "node";
|
|
121
|
-
}
|
|
122
|
-
var platform = detectPlatform();
|
|
123
|
-
var isWeb = platform === "web";
|
|
124
|
-
var isReactNative = platform === "react-native";
|
|
125
|
-
var isNode = platform === "node";
|
|
126
|
-
var isBrowser = isWeb || isReactNative;
|
|
127
|
-
|
|
128
136
|
// ../core/src/types.ts
|
|
129
137
|
var BlinkError = class extends Error {
|
|
130
138
|
constructor(message, code, status, details) {
|
|
@@ -388,17 +396,44 @@ function convertKeysToCamelCase(obj) {
|
|
|
388
396
|
return converted;
|
|
389
397
|
}
|
|
390
398
|
var HttpClient = class {
|
|
391
|
-
authUrl;
|
|
392
|
-
coreUrl;
|
|
399
|
+
authUrl = "https://blink.new";
|
|
400
|
+
coreUrl = "https://core.blink.new";
|
|
393
401
|
projectId;
|
|
402
|
+
publishableKey;
|
|
403
|
+
secretKey;
|
|
404
|
+
// Permanent, non-expiring key (like Stripe's sk_live_...)
|
|
394
405
|
getToken;
|
|
395
406
|
getValidToken;
|
|
396
407
|
constructor(config, getToken, getValidToken) {
|
|
397
408
|
this.projectId = config.projectId;
|
|
409
|
+
this.publishableKey = config.publishableKey;
|
|
410
|
+
this.secretKey = config.secretKey || config.serviceToken;
|
|
398
411
|
this.getToken = getToken;
|
|
399
412
|
this.getValidToken = getValidToken;
|
|
400
|
-
|
|
401
|
-
|
|
413
|
+
}
|
|
414
|
+
shouldAttachPublishableKey(path, method) {
|
|
415
|
+
if (method !== "GET" && method !== "POST") return false;
|
|
416
|
+
if (path.includes("/api/analytics/")) return true;
|
|
417
|
+
if (path.includes("/api/storage/")) return true;
|
|
418
|
+
if (path.includes("/api/db/") && path.includes("/rest/v1/")) return method === "GET";
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
shouldSkipSecretKey(url) {
|
|
422
|
+
try {
|
|
423
|
+
const parsed = new URL(url);
|
|
424
|
+
return parsed.hostname.endsWith(".functions.blink.new");
|
|
425
|
+
} catch {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
getAuthorizationHeader(url, token) {
|
|
430
|
+
if (this.secretKey && !this.shouldSkipSecretKey(url)) {
|
|
431
|
+
return `Bearer ${this.secretKey}`;
|
|
432
|
+
}
|
|
433
|
+
if (token) {
|
|
434
|
+
return `Bearer ${token}`;
|
|
435
|
+
}
|
|
436
|
+
return null;
|
|
402
437
|
}
|
|
403
438
|
/**
|
|
404
439
|
* Make an authenticated request to the Blink API
|
|
@@ -406,19 +441,23 @@ var HttpClient = class {
|
|
|
406
441
|
async request(path, options = {}) {
|
|
407
442
|
const url = this.buildUrl(path, options.searchParams);
|
|
408
443
|
const token = this.getValidToken ? await this.getValidToken() : this.getToken();
|
|
444
|
+
const method = options.method || "GET";
|
|
409
445
|
const headers = {
|
|
410
446
|
"Content-Type": "application/json",
|
|
411
447
|
...options.headers
|
|
412
448
|
};
|
|
413
|
-
|
|
414
|
-
|
|
449
|
+
const auth = this.getAuthorizationHeader(url, token);
|
|
450
|
+
if (auth) {
|
|
451
|
+
headers.Authorization = auth;
|
|
452
|
+
} else if (this.publishableKey && !headers["x-blink-publishable-key"] && this.shouldAttachPublishableKey(path, method)) {
|
|
453
|
+
headers["x-blink-publishable-key"] = this.publishableKey;
|
|
415
454
|
}
|
|
416
455
|
const requestInit = {
|
|
417
|
-
method
|
|
456
|
+
method,
|
|
418
457
|
headers,
|
|
419
458
|
signal: options.signal
|
|
420
459
|
};
|
|
421
|
-
if (options.body &&
|
|
460
|
+
if (options.body && method !== "GET") {
|
|
422
461
|
requestInit.body = typeof options.body === "string" ? options.body : JSON.stringify(options.body);
|
|
423
462
|
}
|
|
424
463
|
try {
|
|
@@ -572,12 +611,12 @@ var HttpClient = class {
|
|
|
572
611
|
throw new BlinkValidationError("Unsupported file type");
|
|
573
612
|
}
|
|
574
613
|
formData.append("path", filePath);
|
|
575
|
-
if (options.upsert !== void 0) {
|
|
576
|
-
formData.append("options", JSON.stringify({ upsert: options.upsert }));
|
|
577
|
-
}
|
|
578
614
|
const headers = {};
|
|
579
|
-
|
|
580
|
-
|
|
615
|
+
const auth = this.getAuthorizationHeader(url, token);
|
|
616
|
+
if (auth) {
|
|
617
|
+
headers.Authorization = auth;
|
|
618
|
+
} else if (this.publishableKey && path.includes("/api/storage/") && !headers["x-blink-publishable-key"]) {
|
|
619
|
+
headers["x-blink-publishable-key"] = this.publishableKey;
|
|
581
620
|
}
|
|
582
621
|
try {
|
|
583
622
|
if (typeof XMLHttpRequest !== "undefined" && options.onProgress) {
|
|
@@ -678,7 +717,7 @@ var HttpClient = class {
|
|
|
678
717
|
});
|
|
679
718
|
}
|
|
680
719
|
/**
|
|
681
|
-
* Stream AI text generation
|
|
720
|
+
* Stream AI text generation - uses Vercel AI SDK's pipeUIMessageStreamToResponse (Data Stream Protocol)
|
|
682
721
|
*/
|
|
683
722
|
async streamAiText(prompt, options = {}, onChunk) {
|
|
684
723
|
const url = this.buildUrl(`/api/ai/${this.projectId}/text`);
|
|
@@ -686,9 +725,8 @@ var HttpClient = class {
|
|
|
686
725
|
const headers = {
|
|
687
726
|
"Content-Type": "application/json"
|
|
688
727
|
};
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
728
|
+
const auth = this.getAuthorizationHeader(url, token);
|
|
729
|
+
if (auth) headers.Authorization = auth;
|
|
692
730
|
const body = {
|
|
693
731
|
prompt,
|
|
694
732
|
stream: true,
|
|
@@ -708,7 +746,7 @@ var HttpClient = class {
|
|
|
708
746
|
if (!response.body) {
|
|
709
747
|
throw new BlinkNetworkError("No response body for streaming");
|
|
710
748
|
}
|
|
711
|
-
return this.
|
|
749
|
+
return this.parseDataStreamProtocol(response.body, onChunk);
|
|
712
750
|
} catch (error) {
|
|
713
751
|
if (error instanceof BlinkError) {
|
|
714
752
|
throw error;
|
|
@@ -733,7 +771,7 @@ var HttpClient = class {
|
|
|
733
771
|
});
|
|
734
772
|
}
|
|
735
773
|
/**
|
|
736
|
-
* Stream AI object generation
|
|
774
|
+
* Stream AI object generation - uses Vercel AI SDK's pipeTextStreamToResponse
|
|
737
775
|
*/
|
|
738
776
|
async streamAiObject(prompt, options = {}, onPartial) {
|
|
739
777
|
const url = this.buildUrl(`/api/ai/${this.projectId}/object`);
|
|
@@ -741,9 +779,8 @@ var HttpClient = class {
|
|
|
741
779
|
const headers = {
|
|
742
780
|
"Content-Type": "application/json"
|
|
743
781
|
};
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
782
|
+
const auth = this.getAuthorizationHeader(url, token);
|
|
783
|
+
if (auth) headers.Authorization = auth;
|
|
747
784
|
const body = {
|
|
748
785
|
prompt,
|
|
749
786
|
stream: true,
|
|
@@ -763,7 +800,35 @@ var HttpClient = class {
|
|
|
763
800
|
if (!response.body) {
|
|
764
801
|
throw new BlinkNetworkError("No response body for streaming");
|
|
765
802
|
}
|
|
766
|
-
|
|
803
|
+
const reader = response.body.getReader();
|
|
804
|
+
const decoder = new TextDecoder();
|
|
805
|
+
let buffer = "";
|
|
806
|
+
let latestObject = {};
|
|
807
|
+
try {
|
|
808
|
+
while (true) {
|
|
809
|
+
const { done, value } = await reader.read();
|
|
810
|
+
if (done) break;
|
|
811
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
812
|
+
buffer += chunk;
|
|
813
|
+
try {
|
|
814
|
+
const parsed = JSON.parse(buffer);
|
|
815
|
+
latestObject = parsed;
|
|
816
|
+
if (onPartial) {
|
|
817
|
+
onPartial(parsed);
|
|
818
|
+
}
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (buffer) {
|
|
823
|
+
try {
|
|
824
|
+
latestObject = JSON.parse(buffer);
|
|
825
|
+
} catch {
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return { object: latestObject };
|
|
829
|
+
} finally {
|
|
830
|
+
reader.releaseLock();
|
|
831
|
+
}
|
|
767
832
|
} catch (error) {
|
|
768
833
|
if (error instanceof BlinkError) {
|
|
769
834
|
throw error;
|
|
@@ -820,6 +885,17 @@ var HttpClient = class {
|
|
|
820
885
|
signal
|
|
821
886
|
});
|
|
822
887
|
}
|
|
888
|
+
async aiVideo(prompt, options = {}) {
|
|
889
|
+
const { signal, ...body } = options;
|
|
890
|
+
return this.request(`/api/ai/${this.projectId}/video`, {
|
|
891
|
+
method: "POST",
|
|
892
|
+
body: {
|
|
893
|
+
prompt,
|
|
894
|
+
...body
|
|
895
|
+
},
|
|
896
|
+
signal
|
|
897
|
+
});
|
|
898
|
+
}
|
|
823
899
|
/**
|
|
824
900
|
* Data-specific requests
|
|
825
901
|
*/
|
|
@@ -861,6 +937,38 @@ var HttpClient = class {
|
|
|
861
937
|
async dataSearch(projectId, request) {
|
|
862
938
|
return this.post(`/api/data/${projectId}/search`, request);
|
|
863
939
|
}
|
|
940
|
+
/**
|
|
941
|
+
* Connector requests
|
|
942
|
+
*/
|
|
943
|
+
formatProviderForPath(provider) {
|
|
944
|
+
return provider.replace("_", "-");
|
|
945
|
+
}
|
|
946
|
+
async connectorStatus(provider) {
|
|
947
|
+
return this.request(`/api/connectors/${this.formatProviderForPath(provider)}/${this.projectId}/status`, {
|
|
948
|
+
method: "GET"
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
async connectorExecute(provider, request) {
|
|
952
|
+
const path = request.method.startsWith("/") ? request.method : `/${request.method}`;
|
|
953
|
+
const url = `/api/connectors/${this.formatProviderForPath(provider)}/${this.projectId}${path}`;
|
|
954
|
+
const method = (request.http_method || "GET").toUpperCase();
|
|
955
|
+
if (method === "GET") {
|
|
956
|
+
return this.request(url, {
|
|
957
|
+
method: "GET",
|
|
958
|
+
searchParams: request.params
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
return this.request(url, {
|
|
962
|
+
method,
|
|
963
|
+
body: request.params || {}
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
async connectorSaveApiKey(provider, request) {
|
|
967
|
+
return this.request(`/api/connectors/${this.formatProviderForPath(provider)}/${this.projectId}/api-key`, {
|
|
968
|
+
method: "POST",
|
|
969
|
+
body: request
|
|
970
|
+
});
|
|
971
|
+
}
|
|
864
972
|
/**
|
|
865
973
|
* Realtime-specific requests
|
|
866
974
|
*/
|
|
@@ -926,93 +1034,94 @@ var HttpClient = class {
|
|
|
926
1034
|
}
|
|
927
1035
|
}
|
|
928
1036
|
/**
|
|
929
|
-
* Parse Vercel AI SDK
|
|
930
|
-
*
|
|
1037
|
+
* Parse Vercel AI SDK v5 Data Stream Protocol (Server-Sent Events)
|
|
1038
|
+
* Supports all event types from the UI Message Stream protocol
|
|
931
1039
|
*/
|
|
932
|
-
async
|
|
1040
|
+
async parseDataStreamProtocol(body, onChunk) {
|
|
933
1041
|
const reader = body.getReader();
|
|
934
1042
|
const decoder = new TextDecoder();
|
|
1043
|
+
const finalResult = {
|
|
1044
|
+
text: "",
|
|
1045
|
+
toolCalls: [],
|
|
1046
|
+
toolResults: [],
|
|
1047
|
+
sources: [],
|
|
1048
|
+
files: [],
|
|
1049
|
+
reasoning: []
|
|
1050
|
+
};
|
|
935
1051
|
let buffer = "";
|
|
936
|
-
let finalResult = {};
|
|
937
1052
|
try {
|
|
938
1053
|
while (true) {
|
|
939
1054
|
const { done, value } = await reader.read();
|
|
940
1055
|
if (done) break;
|
|
941
1056
|
buffer += decoder.decode(value, { stream: true });
|
|
942
|
-
const lines = buffer.split(
|
|
1057
|
+
const lines = buffer.split("\n");
|
|
943
1058
|
buffer = lines.pop() || "";
|
|
944
1059
|
for (const line of lines) {
|
|
945
1060
|
if (!line.trim()) continue;
|
|
1061
|
+
if (line === "[DONE]") {
|
|
1062
|
+
continue;
|
|
1063
|
+
}
|
|
1064
|
+
if (!line.startsWith("data: ")) continue;
|
|
946
1065
|
try {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
} else if (line.startsWith("2:")) {
|
|
957
|
-
const data = JSON.parse(line.slice(2));
|
|
958
|
-
if (Array.isArray(data) && data.length > 0) {
|
|
959
|
-
const item = data[0];
|
|
960
|
-
if (typeof item === "string") {
|
|
961
|
-
finalResult.status = item;
|
|
962
|
-
} else if (typeof item === "object") {
|
|
963
|
-
if (onPartial) {
|
|
964
|
-
onPartial(item);
|
|
965
|
-
}
|
|
966
|
-
finalResult.object = item;
|
|
1066
|
+
const jsonStr = line.slice(6);
|
|
1067
|
+
const part = JSON.parse(jsonStr);
|
|
1068
|
+
switch (part.type) {
|
|
1069
|
+
case "text-start":
|
|
1070
|
+
break;
|
|
1071
|
+
case "text-delta":
|
|
1072
|
+
if (part.delta) {
|
|
1073
|
+
finalResult.text += part.delta;
|
|
1074
|
+
if (onChunk) onChunk(part.delta);
|
|
967
1075
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
if (metadata.usage) {
|
|
972
|
-
finalResult.usage = metadata.usage;
|
|
973
|
-
}
|
|
974
|
-
if (metadata.finishReason) {
|
|
975
|
-
finalResult.finishReason = metadata.finishReason;
|
|
976
|
-
}
|
|
977
|
-
} else if (line.startsWith("e:")) {
|
|
978
|
-
const errorData = JSON.parse(line.slice(2));
|
|
979
|
-
finalResult.error = errorData;
|
|
980
|
-
}
|
|
981
|
-
} catch (error) {
|
|
982
|
-
console.warn("Failed to parse stream line:", line, error);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
if (buffer.trim()) {
|
|
987
|
-
try {
|
|
988
|
-
if (buffer.startsWith("0:")) {
|
|
989
|
-
const textChunk = JSON.parse(buffer.slice(2));
|
|
990
|
-
if (onChunk) {
|
|
991
|
-
onChunk(textChunk);
|
|
992
|
-
}
|
|
993
|
-
finalResult.text = (finalResult.text || "") + textChunk;
|
|
994
|
-
} else if (buffer.startsWith("2:")) {
|
|
995
|
-
const data = JSON.parse(buffer.slice(2));
|
|
996
|
-
if (Array.isArray(data) && data.length > 0) {
|
|
997
|
-
const item = data[0];
|
|
998
|
-
if (typeof item === "object") {
|
|
999
|
-
if (onPartial) {
|
|
1000
|
-
onPartial(item);
|
|
1076
|
+
if (part.textDelta) {
|
|
1077
|
+
finalResult.text += part.textDelta;
|
|
1078
|
+
if (onChunk) onChunk(part.textDelta);
|
|
1001
1079
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1080
|
+
break;
|
|
1081
|
+
case "text-end":
|
|
1082
|
+
break;
|
|
1083
|
+
case "tool-call":
|
|
1084
|
+
finalResult.toolCalls.push({
|
|
1085
|
+
toolCallId: part.toolCallId,
|
|
1086
|
+
toolName: part.toolName,
|
|
1087
|
+
args: part.args
|
|
1088
|
+
});
|
|
1089
|
+
break;
|
|
1090
|
+
case "tool-result":
|
|
1091
|
+
finalResult.toolResults.push({
|
|
1092
|
+
toolCallId: part.toolCallId,
|
|
1093
|
+
toolName: part.toolName,
|
|
1094
|
+
result: part.result
|
|
1095
|
+
});
|
|
1096
|
+
break;
|
|
1097
|
+
case "source-url":
|
|
1098
|
+
finalResult.sources.push({
|
|
1099
|
+
id: part.id,
|
|
1100
|
+
url: part.url,
|
|
1101
|
+
title: part.title
|
|
1102
|
+
});
|
|
1103
|
+
break;
|
|
1104
|
+
case "file":
|
|
1105
|
+
finalResult.files.push(part.file);
|
|
1106
|
+
break;
|
|
1107
|
+
case "reasoning":
|
|
1108
|
+
finalResult.reasoning.push(part.content);
|
|
1109
|
+
break;
|
|
1110
|
+
case "finish":
|
|
1111
|
+
finalResult.finishReason = part.finishReason;
|
|
1112
|
+
finalResult.usage = part.usage;
|
|
1113
|
+
if (part.response) finalResult.response = part.response;
|
|
1114
|
+
break;
|
|
1115
|
+
case "error":
|
|
1116
|
+
finalResult.error = part.error;
|
|
1117
|
+
throw new Error(part.error);
|
|
1118
|
+
case "data":
|
|
1119
|
+
if (!finalResult.customData) finalResult.customData = [];
|
|
1120
|
+
finalResult.customData.push(part.value);
|
|
1121
|
+
break;
|
|
1012
1122
|
}
|
|
1123
|
+
} catch (e) {
|
|
1013
1124
|
}
|
|
1014
|
-
} catch (error) {
|
|
1015
|
-
console.warn("Failed to parse final buffer:", buffer, error);
|
|
1016
1125
|
}
|
|
1017
1126
|
}
|
|
1018
1127
|
return finalResult;
|
|
@@ -1176,17 +1285,46 @@ var BlinkAuth = class {
|
|
|
1176
1285
|
if (!config.projectId) {
|
|
1177
1286
|
throw new Error("projectId is required for authentication");
|
|
1178
1287
|
}
|
|
1288
|
+
const detectAuthUrl = () => {
|
|
1289
|
+
if (typeof window !== "undefined") {
|
|
1290
|
+
const referrer = document.referrer;
|
|
1291
|
+
if (referrer?.includes("dev.blink.new")) {
|
|
1292
|
+
console.log("\u{1F527} Dev environment detected via referrer, using dev.blink.new for auth");
|
|
1293
|
+
return "https://dev.blink.new";
|
|
1294
|
+
}
|
|
1295
|
+
try {
|
|
1296
|
+
if (window.parent !== window) {
|
|
1297
|
+
const parentOrigin = window.parent.location.origin;
|
|
1298
|
+
if (parentOrigin?.includes("dev.blink.new")) {
|
|
1299
|
+
console.log("\u{1F527} Dev environment detected via parent origin, using dev.blink.new for auth");
|
|
1300
|
+
return "https://dev.blink.new";
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
} catch {
|
|
1304
|
+
}
|
|
1305
|
+
try {
|
|
1306
|
+
const opener = window.opener?.location?.origin;
|
|
1307
|
+
if (opener?.includes("dev.blink.new")) {
|
|
1308
|
+
console.log("\u{1F527} Dev environment detected via opener, using dev.blink.new for auth");
|
|
1309
|
+
return "https://dev.blink.new";
|
|
1310
|
+
}
|
|
1311
|
+
} catch {
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
return "https://blink.new";
|
|
1315
|
+
};
|
|
1316
|
+
const defaultAuthUrl = detectAuthUrl();
|
|
1179
1317
|
this.authConfig = {
|
|
1180
1318
|
mode: "managed",
|
|
1181
1319
|
// Default mode
|
|
1182
|
-
authUrl:
|
|
1183
|
-
coreUrl: "https://
|
|
1320
|
+
authUrl: defaultAuthUrl,
|
|
1321
|
+
coreUrl: "https://core.blink.new",
|
|
1184
1322
|
detectSessionInUrl: true,
|
|
1185
1323
|
// Default to true for web compatibility
|
|
1186
1324
|
...config.auth
|
|
1187
1325
|
};
|
|
1188
|
-
this.authUrl = this.authConfig.authUrl ||
|
|
1189
|
-
this.coreUrl = this.authConfig.coreUrl || "https://
|
|
1326
|
+
this.authUrl = this.authConfig.authUrl || defaultAuthUrl;
|
|
1327
|
+
this.coreUrl = this.authConfig.coreUrl || "https://core.blink.new";
|
|
1190
1328
|
const hostname = getLocationHostname();
|
|
1191
1329
|
if (hostname && this.authUrl === "https://blink.new" && (hostname === "localhost" || hostname === "127.0.0.1")) {
|
|
1192
1330
|
console.warn("\u26A0\uFE0F Using default authUrl in development. Set auth.authUrl to your app origin for headless auth endpoints to work.");
|
|
@@ -1240,7 +1378,7 @@ var BlinkAuth = class {
|
|
|
1240
1378
|
setupParentWindowListener() {
|
|
1241
1379
|
if (!isWeb || !this.isIframe || !hasWindow()) return;
|
|
1242
1380
|
window.addEventListener("message", (event) => {
|
|
1243
|
-
if (event.origin !== "https://blink.new" && event.origin !== "http://localhost:3000" && event.origin !== "http://localhost:3001") {
|
|
1381
|
+
if (event.origin !== "https://blink.new" && event.origin !== "https://dev.blink.new" && event.origin !== "http://localhost:3000" && event.origin !== "http://localhost:3001") {
|
|
1244
1382
|
return;
|
|
1245
1383
|
}
|
|
1246
1384
|
if (event.data?.type === "BLINK_AUTH_TOKENS") {
|
|
@@ -2939,6 +3077,11 @@ var BlinkAuth = class {
|
|
|
2939
3077
|
};
|
|
2940
3078
|
|
|
2941
3079
|
// src/database.ts
|
|
3080
|
+
function assertServerOnly(methodName) {
|
|
3081
|
+
if (typeof window !== "undefined") {
|
|
3082
|
+
throw new Error(`${methodName} is server-only. Use Blink CRUD methods (blink.db.<table>.*) instead.`);
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
2942
3085
|
function camelToSnake3(str) {
|
|
2943
3086
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
2944
3087
|
}
|
|
@@ -3157,6 +3300,7 @@ var BlinkTable = class {
|
|
|
3157
3300
|
* Raw SQL query on this table (for advanced use cases)
|
|
3158
3301
|
*/
|
|
3159
3302
|
async sql(query, params) {
|
|
3303
|
+
assertServerOnly("blink.db.<table>.sql");
|
|
3160
3304
|
const response = await this.httpClient.dbSql(query, params);
|
|
3161
3305
|
return response.data;
|
|
3162
3306
|
}
|
|
@@ -3205,6 +3349,7 @@ var BlinkDatabase = class {
|
|
|
3205
3349
|
* Execute raw SQL query
|
|
3206
3350
|
*/
|
|
3207
3351
|
async sql(query, params) {
|
|
3352
|
+
assertServerOnly("blink.db.sql");
|
|
3208
3353
|
const response = await this.httpClient.dbSql(query, params);
|
|
3209
3354
|
return response.data;
|
|
3210
3355
|
}
|
|
@@ -3212,6 +3357,7 @@ var BlinkDatabase = class {
|
|
|
3212
3357
|
* Execute batch SQL operations
|
|
3213
3358
|
*/
|
|
3214
3359
|
async batch(statements, mode = "write") {
|
|
3360
|
+
assertServerOnly("blink.db.batch");
|
|
3215
3361
|
const response = await this.httpClient.dbBatch(statements, mode);
|
|
3216
3362
|
return response.data;
|
|
3217
3363
|
}
|
|
@@ -3274,7 +3420,6 @@ var BlinkStorageImpl = class {
|
|
|
3274
3420
|
correctedPath,
|
|
3275
3421
|
// Use corrected path with proper extension
|
|
3276
3422
|
{
|
|
3277
|
-
upsert: options.upsert,
|
|
3278
3423
|
onProgress: options.onProgress,
|
|
3279
3424
|
contentType: detectedContentType
|
|
3280
3425
|
// Pass detected content type
|
|
@@ -3294,7 +3439,7 @@ var BlinkStorageImpl = class {
|
|
|
3294
3439
|
if (error instanceof Error && "status" in error) {
|
|
3295
3440
|
const status = error.status;
|
|
3296
3441
|
if (status === 409) {
|
|
3297
|
-
throw new BlinkStorageError("File already exists.
|
|
3442
|
+
throw new BlinkStorageError("File already exists.", 409);
|
|
3298
3443
|
}
|
|
3299
3444
|
if (status === 400) {
|
|
3300
3445
|
throw new BlinkStorageError("Invalid request parameters", 400);
|
|
@@ -3339,7 +3484,6 @@ var BlinkStorageImpl = class {
|
|
|
3339
3484
|
detectedContentType
|
|
3340
3485
|
};
|
|
3341
3486
|
} catch (error) {
|
|
3342
|
-
console.warn("File type detection failed, using original path:", error);
|
|
3343
3487
|
return {
|
|
3344
3488
|
correctedPath: originalPath,
|
|
3345
3489
|
detectedContentType: "application/octet-stream"
|
|
@@ -3729,13 +3873,7 @@ var BlinkAIImpl = class {
|
|
|
3729
3873
|
options.prompt || "",
|
|
3730
3874
|
requestBody
|
|
3731
3875
|
);
|
|
3732
|
-
|
|
3733
|
-
return response.data.result;
|
|
3734
|
-
} else if (response.data?.text) {
|
|
3735
|
-
return response.data;
|
|
3736
|
-
} else {
|
|
3737
|
-
throw new BlinkAIError("Invalid response format: missing text");
|
|
3738
|
-
}
|
|
3876
|
+
return response.data;
|
|
3739
3877
|
} catch (error) {
|
|
3740
3878
|
if (error instanceof BlinkAIError) {
|
|
3741
3879
|
throw error;
|
|
@@ -3804,9 +3942,14 @@ var BlinkAIImpl = class {
|
|
|
3804
3942
|
);
|
|
3805
3943
|
return {
|
|
3806
3944
|
text: result.text || "",
|
|
3807
|
-
finishReason: "stop",
|
|
3945
|
+
finishReason: result.finishReason || "stop",
|
|
3808
3946
|
usage: result.usage,
|
|
3809
|
-
|
|
3947
|
+
toolCalls: result.toolCalls,
|
|
3948
|
+
toolResults: result.toolResults,
|
|
3949
|
+
sources: result.sources,
|
|
3950
|
+
files: result.files,
|
|
3951
|
+
reasoningDetails: result.reasoning,
|
|
3952
|
+
response: result.response
|
|
3810
3953
|
};
|
|
3811
3954
|
} catch (error) {
|
|
3812
3955
|
if (error instanceof BlinkAIError) {
|
|
@@ -3885,13 +4028,7 @@ var BlinkAIImpl = class {
|
|
|
3885
4028
|
signal: options.signal
|
|
3886
4029
|
}
|
|
3887
4030
|
);
|
|
3888
|
-
|
|
3889
|
-
return response.data.result;
|
|
3890
|
-
} else if (response.data?.object) {
|
|
3891
|
-
return response.data;
|
|
3892
|
-
} else {
|
|
3893
|
-
throw new BlinkAIError("Invalid response format: missing object");
|
|
3894
|
-
}
|
|
4031
|
+
return response.data;
|
|
3895
4032
|
} catch (error) {
|
|
3896
4033
|
if (error instanceof BlinkAIError) {
|
|
3897
4034
|
throw error;
|
|
@@ -3953,8 +4090,7 @@ var BlinkAIImpl = class {
|
|
|
3953
4090
|
return {
|
|
3954
4091
|
object: result.object || {},
|
|
3955
4092
|
finishReason: "stop",
|
|
3956
|
-
usage: result.usage
|
|
3957
|
-
...result
|
|
4093
|
+
usage: result.usage
|
|
3958
4094
|
};
|
|
3959
4095
|
} catch (error) {
|
|
3960
4096
|
if (error instanceof BlinkAIError) {
|
|
@@ -4215,6 +4351,131 @@ var BlinkAIImpl = class {
|
|
|
4215
4351
|
);
|
|
4216
4352
|
}
|
|
4217
4353
|
}
|
|
4354
|
+
/**
|
|
4355
|
+
* Generates videos from text prompts or images using AI video generation models.
|
|
4356
|
+
*
|
|
4357
|
+
* @param options - Object containing:
|
|
4358
|
+
* - `prompt`: Text description of the video to generate (required)
|
|
4359
|
+
* - `model`: Video model to use (optional). Available models:
|
|
4360
|
+
* **Text-to-Video Models:**
|
|
4361
|
+
* - `"fal-ai/veo3.1"` - Google Veo 3.1 (best quality)
|
|
4362
|
+
* - `"fal-ai/veo3.1/fast"` (default) - Veo 3.1 fast mode (faster, cheaper)
|
|
4363
|
+
* - `"fal-ai/sora-2/text-to-video/pro"` - OpenAI Sora 2
|
|
4364
|
+
* - `"fal-ai/kling-video/v2.6/pro/text-to-video"` - Kling 2.6
|
|
4365
|
+
* **Image-to-Video Models:**
|
|
4366
|
+
* - `"fal-ai/veo3.1/image-to-video"` - Veo 3.1 I2V
|
|
4367
|
+
* - `"fal-ai/veo3.1/fast/image-to-video"` - Veo 3.1 fast I2V
|
|
4368
|
+
* - `"fal-ai/sora-2/image-to-video/pro"` - Sora 2 I2V
|
|
4369
|
+
* - `"fal-ai/kling-video/v2.6/pro/image-to-video"` - Kling 2.6 I2V
|
|
4370
|
+
* - `image_url`: Source image URL for image-to-video (required for I2V models)
|
|
4371
|
+
* - `duration`: Video duration ("4s", "5s", "6s", "8s", "10s", "12s")
|
|
4372
|
+
* - `aspect_ratio`: Aspect ratio ("16:9", "9:16", "1:1")
|
|
4373
|
+
* - `resolution`: Resolution ("720p", "1080p") - Veo/Sora only
|
|
4374
|
+
* - `negative_prompt`: What to avoid in generation - Veo/Kling only
|
|
4375
|
+
* - `generate_audio`: Generate audio with video (default: true)
|
|
4376
|
+
* - `seed`: For reproducibility - Veo only
|
|
4377
|
+
* - `cfg_scale`: Guidance scale (0-1) - Kling only
|
|
4378
|
+
* - Plus optional signal parameter
|
|
4379
|
+
*
|
|
4380
|
+
* @example
|
|
4381
|
+
* ```ts
|
|
4382
|
+
* // Basic text-to-video generation (uses default fast model)
|
|
4383
|
+
* const { result } = await blink.ai.generateVideo({
|
|
4384
|
+
* prompt: "A serene sunset over the ocean with gentle waves"
|
|
4385
|
+
* });
|
|
4386
|
+
* console.log("Video URL:", result.video.url);
|
|
4387
|
+
*
|
|
4388
|
+
* // High quality with Veo 3.1
|
|
4389
|
+
* const { result } = await blink.ai.generateVideo({
|
|
4390
|
+
* prompt: "A cinematic shot of a futuristic city at night",
|
|
4391
|
+
* model: "fal-ai/veo3.1",
|
|
4392
|
+
* resolution: "1080p",
|
|
4393
|
+
* aspect_ratio: "16:9"
|
|
4394
|
+
* });
|
|
4395
|
+
*
|
|
4396
|
+
* // Image-to-video animation
|
|
4397
|
+
* const { result } = await blink.ai.generateVideo({
|
|
4398
|
+
* prompt: "Animate this image with gentle camera movement",
|
|
4399
|
+
* model: "fal-ai/veo3.1/fast/image-to-video",
|
|
4400
|
+
* image_url: "https://example.com/my-image.jpg",
|
|
4401
|
+
* duration: "5s"
|
|
4402
|
+
* });
|
|
4403
|
+
*
|
|
4404
|
+
* // Using Sora 2 for creative videos
|
|
4405
|
+
* const { result } = await blink.ai.generateVideo({
|
|
4406
|
+
* prompt: "A magical forest with glowing fireflies",
|
|
4407
|
+
* model: "fal-ai/sora-2/text-to-video/pro",
|
|
4408
|
+
* duration: "8s"
|
|
4409
|
+
* });
|
|
4410
|
+
*
|
|
4411
|
+
* // Using Kling for detailed videos
|
|
4412
|
+
* const { result, usage } = await blink.ai.generateVideo({
|
|
4413
|
+
* prompt: "A professional cooking tutorial scene",
|
|
4414
|
+
* model: "fal-ai/kling-video/v2.6/pro/text-to-video",
|
|
4415
|
+
* negative_prompt: "blur, distort, low quality",
|
|
4416
|
+
* cfg_scale: 0.7
|
|
4417
|
+
* });
|
|
4418
|
+
* console.log("Credits charged:", usage?.creditsCharged);
|
|
4419
|
+
* ```
|
|
4420
|
+
*
|
|
4421
|
+
* @returns Promise<VideoGenerationResponse> - Object containing:
|
|
4422
|
+
* - `result.video.url`: URL to the generated video
|
|
4423
|
+
* - `result.video.content_type`: MIME type (video/mp4)
|
|
4424
|
+
* - `result.video.file_name`: Generated filename
|
|
4425
|
+
* - `result.video.file_size`: File size in bytes
|
|
4426
|
+
* - `metadata`: Generation metadata (projectId, timestamp, model)
|
|
4427
|
+
* - `usage`: Credits charged and cost information
|
|
4428
|
+
*/
|
|
4429
|
+
async generateVideo(options) {
|
|
4430
|
+
try {
|
|
4431
|
+
if (!options.prompt) {
|
|
4432
|
+
throw new BlinkAIError("Prompt is required");
|
|
4433
|
+
}
|
|
4434
|
+
const i2vModels = [
|
|
4435
|
+
"fal-ai/veo3.1/image-to-video",
|
|
4436
|
+
"fal-ai/veo3.1/fast/image-to-video",
|
|
4437
|
+
"fal-ai/sora-2/image-to-video/pro",
|
|
4438
|
+
"fal-ai/kling-video/v2.6/pro/image-to-video"
|
|
4439
|
+
];
|
|
4440
|
+
if (options.model && i2vModels.includes(options.model) && !options.image_url) {
|
|
4441
|
+
throw new BlinkAIError("image_url is required for image-to-video models");
|
|
4442
|
+
}
|
|
4443
|
+
if (options.image_url) {
|
|
4444
|
+
const validation = this.validateImageUrl(options.image_url);
|
|
4445
|
+
if (!validation.isValid) {
|
|
4446
|
+
throw new BlinkAIError(`Invalid image_url: ${validation.error}`);
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
const response = await this.httpClient.aiVideo(
|
|
4450
|
+
options.prompt,
|
|
4451
|
+
{
|
|
4452
|
+
model: options.model,
|
|
4453
|
+
image_url: options.image_url,
|
|
4454
|
+
duration: options.duration,
|
|
4455
|
+
aspect_ratio: options.aspect_ratio,
|
|
4456
|
+
resolution: options.resolution,
|
|
4457
|
+
negative_prompt: options.negative_prompt,
|
|
4458
|
+
generate_audio: options.generate_audio,
|
|
4459
|
+
seed: options.seed,
|
|
4460
|
+
cfg_scale: options.cfg_scale,
|
|
4461
|
+
signal: options.signal
|
|
4462
|
+
}
|
|
4463
|
+
);
|
|
4464
|
+
if (!response.data?.result?.video?.url) {
|
|
4465
|
+
throw new BlinkAIError("Invalid response format: missing video URL");
|
|
4466
|
+
}
|
|
4467
|
+
return response.data;
|
|
4468
|
+
} catch (error) {
|
|
4469
|
+
if (error instanceof BlinkAIError) {
|
|
4470
|
+
throw error;
|
|
4471
|
+
}
|
|
4472
|
+
throw new BlinkAIError(
|
|
4473
|
+
`Video generation failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
4474
|
+
void 0,
|
|
4475
|
+
{ originalError: error }
|
|
4476
|
+
);
|
|
4477
|
+
}
|
|
4478
|
+
}
|
|
4218
4479
|
/**
|
|
4219
4480
|
* Converts text to speech using AI voice synthesis models.
|
|
4220
4481
|
*
|
|
@@ -4804,7 +5065,7 @@ var BlinkRealtimeChannel = class {
|
|
|
4804
5065
|
return new Promise((resolve, reject) => {
|
|
4805
5066
|
try {
|
|
4806
5067
|
const httpClient = this.httpClient;
|
|
4807
|
-
const coreUrl = httpClient.coreUrl || "https://
|
|
5068
|
+
const coreUrl = httpClient.coreUrl || "https://core.blink.new";
|
|
4808
5069
|
const baseUrl = coreUrl.replace("https://", "wss://").replace("http://", "ws://");
|
|
4809
5070
|
const wsUrl = `${baseUrl}?project_id=${this.projectId}`;
|
|
4810
5071
|
console.log(`\u{1F517} Attempting WebSocket connection to: ${wsUrl}`);
|
|
@@ -5273,7 +5534,6 @@ var BlinkAnalyticsImpl = class {
|
|
|
5273
5534
|
} catch (error) {
|
|
5274
5535
|
this.queue = [...events, ...this.queue];
|
|
5275
5536
|
this.persistQueue();
|
|
5276
|
-
console.error("Failed to send analytics events:", error);
|
|
5277
5537
|
}
|
|
5278
5538
|
if (this.queue.length > 0) {
|
|
5279
5539
|
this.timer = setTimeout(() => this.flush(), BATCH_TIMEOUT);
|
|
@@ -5464,6 +5724,64 @@ var BlinkAnalyticsImpl = class {
|
|
|
5464
5724
|
}
|
|
5465
5725
|
};
|
|
5466
5726
|
|
|
5727
|
+
// src/connectors.ts
|
|
5728
|
+
var BlinkConnectorsImpl = class {
|
|
5729
|
+
constructor(httpClient) {
|
|
5730
|
+
this.httpClient = httpClient;
|
|
5731
|
+
}
|
|
5732
|
+
async status(provider, options) {
|
|
5733
|
+
const response = await this.httpClient.connectorStatus(provider);
|
|
5734
|
+
return response.data;
|
|
5735
|
+
}
|
|
5736
|
+
async execute(provider, request) {
|
|
5737
|
+
const response = await this.httpClient.connectorExecute(provider, request);
|
|
5738
|
+
return response.data;
|
|
5739
|
+
}
|
|
5740
|
+
async saveApiKey(provider, request) {
|
|
5741
|
+
const response = await this.httpClient.connectorSaveApiKey(provider, request);
|
|
5742
|
+
return response.data;
|
|
5743
|
+
}
|
|
5744
|
+
};
|
|
5745
|
+
|
|
5746
|
+
// src/functions.ts
|
|
5747
|
+
var BlinkFunctionsImpl = class {
|
|
5748
|
+
httpClient;
|
|
5749
|
+
projectId;
|
|
5750
|
+
constructor(httpClient, projectId, _getToken) {
|
|
5751
|
+
this.httpClient = httpClient;
|
|
5752
|
+
this.projectId = projectId;
|
|
5753
|
+
}
|
|
5754
|
+
/**
|
|
5755
|
+
* Get the project suffix from the full project ID.
|
|
5756
|
+
* Project IDs are formatted as: prj_xxxxx
|
|
5757
|
+
* The suffix is the last 8 characters used in function URLs.
|
|
5758
|
+
*/
|
|
5759
|
+
getProjectSuffix() {
|
|
5760
|
+
return this.projectId.slice(-8);
|
|
5761
|
+
}
|
|
5762
|
+
/**
|
|
5763
|
+
* Build the full function URL
|
|
5764
|
+
*/
|
|
5765
|
+
buildFunctionUrl(functionSlug, searchParams) {
|
|
5766
|
+
const suffix = this.getProjectSuffix();
|
|
5767
|
+
const baseUrl = `https://${suffix}--${functionSlug}.functions.blink.new`;
|
|
5768
|
+
if (!searchParams || Object.keys(searchParams).length === 0) {
|
|
5769
|
+
return baseUrl;
|
|
5770
|
+
}
|
|
5771
|
+
const url = new URL(baseUrl);
|
|
5772
|
+
Object.entries(searchParams).forEach(([key, value]) => {
|
|
5773
|
+
url.searchParams.set(key, value);
|
|
5774
|
+
});
|
|
5775
|
+
return url.toString();
|
|
5776
|
+
}
|
|
5777
|
+
async invoke(functionSlug, options = {}) {
|
|
5778
|
+
const { method = "POST", body, headers = {}, searchParams } = options;
|
|
5779
|
+
const url = this.buildFunctionUrl(functionSlug, searchParams);
|
|
5780
|
+
const res = await this.httpClient.request(url, { method, body, headers });
|
|
5781
|
+
return { data: res.data, status: res.status, headers: res.headers };
|
|
5782
|
+
}
|
|
5783
|
+
};
|
|
5784
|
+
|
|
5467
5785
|
// src/client.ts
|
|
5468
5786
|
var BlinkClientImpl = class {
|
|
5469
5787
|
auth;
|
|
@@ -5474,8 +5792,13 @@ var BlinkClientImpl = class {
|
|
|
5474
5792
|
realtime;
|
|
5475
5793
|
notifications;
|
|
5476
5794
|
analytics;
|
|
5795
|
+
connectors;
|
|
5796
|
+
functions;
|
|
5477
5797
|
httpClient;
|
|
5478
5798
|
constructor(config) {
|
|
5799
|
+
if ((config.secretKey || config.serviceToken) && isBrowser) {
|
|
5800
|
+
throw new Error("secretKey/serviceToken is server-only. Do not provide it in browser/React Native clients.");
|
|
5801
|
+
}
|
|
5479
5802
|
this.auth = new BlinkAuth(config);
|
|
5480
5803
|
this.httpClient = new HttpClient(
|
|
5481
5804
|
config,
|
|
@@ -5489,6 +5812,12 @@ var BlinkClientImpl = class {
|
|
|
5489
5812
|
this.realtime = new BlinkRealtimeImpl(this.httpClient, config.projectId);
|
|
5490
5813
|
this.notifications = new BlinkNotificationsImpl(this.httpClient);
|
|
5491
5814
|
this.analytics = new BlinkAnalyticsImpl(this.httpClient, config.projectId);
|
|
5815
|
+
this.connectors = new BlinkConnectorsImpl(this.httpClient);
|
|
5816
|
+
this.functions = new BlinkFunctionsImpl(
|
|
5817
|
+
this.httpClient,
|
|
5818
|
+
config.projectId,
|
|
5819
|
+
() => this.auth.getValidToken()
|
|
5820
|
+
);
|
|
5492
5821
|
this.auth.onAuthStateChanged((state) => {
|
|
5493
5822
|
if (state.isAuthenticated && state.user) {
|
|
5494
5823
|
this.analytics.setUserId(state.user.id);
|
|
@@ -5510,6 +5839,7 @@ function createClient(config) {
|
|
|
5510
5839
|
exports.AsyncStorageAdapter = AsyncStorageAdapter;
|
|
5511
5840
|
exports.BlinkAIImpl = BlinkAIImpl;
|
|
5512
5841
|
exports.BlinkAnalyticsImpl = BlinkAnalyticsImpl;
|
|
5842
|
+
exports.BlinkConnectorsImpl = BlinkConnectorsImpl;
|
|
5513
5843
|
exports.BlinkDataImpl = BlinkDataImpl;
|
|
5514
5844
|
exports.BlinkDatabase = BlinkDatabase;
|
|
5515
5845
|
exports.BlinkRealtimeChannel = BlinkRealtimeChannel;
|
|
@@ -5521,8 +5851,10 @@ exports.WebStorageAdapter = WebStorageAdapter;
|
|
|
5521
5851
|
exports.createClient = createClient;
|
|
5522
5852
|
exports.getDefaultStorageAdapter = getDefaultStorageAdapter;
|
|
5523
5853
|
exports.isBrowser = isBrowser;
|
|
5854
|
+
exports.isDeno = isDeno;
|
|
5524
5855
|
exports.isNode = isNode;
|
|
5525
5856
|
exports.isReactNative = isReactNative;
|
|
5857
|
+
exports.isServer = isServer;
|
|
5526
5858
|
exports.isWeb = isWeb;
|
|
5527
5859
|
exports.platform = platform;
|
|
5528
5860
|
//# sourceMappingURL=index.js.map
|