@cerefox/memory 0.9.10 → 0.10.0
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/bin/cerefox.js +367 -169
- package/dist/frontend/assets/{index-AFUS7_0T.js → index-DVXDQ7__.js} +2 -2
- package/dist/frontend/assets/{index-AFUS7_0T.js.map → index-DVXDQ7__.js.map} +1 -1
- package/dist/frontend/index.html +1 -1
- package/docs/guides/quickstart.md +5 -0
- package/docs/guides/setup-local.md +85 -120
- package/package.json +1 -1
package/dist/bin/cerefox.js
CHANGED
|
@@ -7184,7 +7184,7 @@ var exports_meta = {};
|
|
|
7184
7184
|
__export(exports_meta, {
|
|
7185
7185
|
PKG_VERSION: () => PKG_VERSION
|
|
7186
7186
|
});
|
|
7187
|
-
var PKG_VERSION = "0.
|
|
7187
|
+
var PKG_VERSION = "0.10.0";
|
|
7188
7188
|
var init_meta = () => {};
|
|
7189
7189
|
|
|
7190
7190
|
// ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.js
|
|
@@ -7792,7 +7792,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
7792
7792
|
});
|
|
7793
7793
|
});
|
|
7794
7794
|
|
|
7795
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7795
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.107.0/node_modules/@supabase/functions-js/dist/main/helper.js
|
|
7796
7796
|
var require_helper = __commonJS((exports) => {
|
|
7797
7797
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7798
7798
|
exports.resolveFetch = undefined;
|
|
@@ -7805,7 +7805,7 @@ var require_helper = __commonJS((exports) => {
|
|
|
7805
7805
|
exports.resolveFetch = resolveFetch;
|
|
7806
7806
|
});
|
|
7807
7807
|
|
|
7808
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7808
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.107.0/node_modules/@supabase/functions-js/dist/main/types.js
|
|
7809
7809
|
var require_types = __commonJS((exports) => {
|
|
7810
7810
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7811
7811
|
exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = undefined;
|
|
@@ -7866,7 +7866,7 @@ var require_types = __commonJS((exports) => {
|
|
|
7866
7866
|
})(FunctionRegion || (exports.FunctionRegion = FunctionRegion = {}));
|
|
7867
7867
|
});
|
|
7868
7868
|
|
|
7869
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7869
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.107.0/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
|
|
7870
7870
|
var require_FunctionsClient = __commonJS((exports) => {
|
|
7871
7871
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7872
7872
|
exports.FunctionsClient = undefined;
|
|
@@ -7979,7 +7979,7 @@ var require_FunctionsClient = __commonJS((exports) => {
|
|
|
7979
7979
|
exports.FunctionsClient = FunctionsClient;
|
|
7980
7980
|
});
|
|
7981
7981
|
|
|
7982
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7982
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.107.0/node_modules/@supabase/functions-js/dist/main/index.js
|
|
7983
7983
|
var require_main = __commonJS((exports) => {
|
|
7984
7984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7985
7985
|
exports.FunctionRegion = exports.FunctionsRelayError = exports.FunctionsHttpError = exports.FunctionsFetchError = exports.FunctionsError = exports.FunctionsClient = undefined;
|
|
@@ -8005,7 +8005,7 @@ var require_main = __commonJS((exports) => {
|
|
|
8005
8005
|
} });
|
|
8006
8006
|
});
|
|
8007
8007
|
|
|
8008
|
-
// ../../node_modules/.bun/@supabase+postgrest-js@2.
|
|
8008
|
+
// ../../node_modules/.bun/@supabase+postgrest-js@2.107.0/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
8009
8009
|
function sleep(ms, signal) {
|
|
8010
8010
|
return new Promise((resolve) => {
|
|
8011
8011
|
if (signal === null || signal === undefined ? undefined : signal.aborted) {
|
|
@@ -8250,7 +8250,19 @@ ${cause.stack}`;
|
|
|
8250
8250
|
else if (_this2.headers.get("Accept") && ((_this$headers$get = _this2.headers.get("Accept")) === null || _this$headers$get === undefined ? undefined : _this$headers$get.includes("application/vnd.pgrst.plan+text")))
|
|
8251
8251
|
data = body;
|
|
8252
8252
|
else
|
|
8253
|
-
|
|
8253
|
+
try {
|
|
8254
|
+
data = JSON.parse(body);
|
|
8255
|
+
} catch (_unused) {
|
|
8256
|
+
error = { message: body };
|
|
8257
|
+
data = null;
|
|
8258
|
+
if (_this2.shouldThrowOnError)
|
|
8259
|
+
throw new PostgrestError({
|
|
8260
|
+
message: body,
|
|
8261
|
+
details: "",
|
|
8262
|
+
hint: "",
|
|
8263
|
+
code: ""
|
|
8264
|
+
});
|
|
8265
|
+
}
|
|
8254
8266
|
}
|
|
8255
8267
|
const countHeader = (_this$headers$get2 = _this2.headers.get("Prefer")) === null || _this$headers$get2 === undefined ? undefined : _this$headers$get2.match(/count=(exact|planned|estimated)/);
|
|
8256
8268
|
const contentRange = (_res$headers$get2 = res.headers.get("content-range")) === null || _res$headers$get2 === undefined ? undefined : _res$headers$get2.split("/");
|
|
@@ -8282,7 +8294,7 @@ ${cause.stack}`;
|
|
|
8282
8294
|
status = 200;
|
|
8283
8295
|
statusText = "OK";
|
|
8284
8296
|
}
|
|
8285
|
-
} catch (
|
|
8297
|
+
} catch (_unused2) {
|
|
8286
8298
|
if (res.status === 404 && body === "") {
|
|
8287
8299
|
status = 204;
|
|
8288
8300
|
statusText = "No Content";
|
|
@@ -8795,7 +8807,7 @@ var init_dist = __esm(() => {
|
|
|
8795
8807
|
};
|
|
8796
8808
|
});
|
|
8797
8809
|
|
|
8798
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8810
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
|
|
8799
8811
|
var require_websocket_factory = __commonJS((exports) => {
|
|
8800
8812
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8801
8813
|
exports.WebSocketFactory = undefined;
|
|
@@ -8886,14 +8898,14 @@ Suggested solution: ${env.workaround}`;
|
|
|
8886
8898
|
exports.default = WebSocketFactory;
|
|
8887
8899
|
});
|
|
8888
8900
|
|
|
8889
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8901
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/version.js
|
|
8890
8902
|
var require_version = __commonJS((exports) => {
|
|
8891
8903
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8892
8904
|
exports.version = undefined;
|
|
8893
|
-
exports.version = "2.
|
|
8905
|
+
exports.version = "2.107.0";
|
|
8894
8906
|
});
|
|
8895
8907
|
|
|
8896
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8908
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
|
|
8897
8909
|
var require_constants = __commonJS((exports) => {
|
|
8898
8910
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8899
8911
|
exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.MAX_PUSH_BUFFER_SIZE = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VERSION = exports.DEFAULT_VSN = exports.VSN_2_0_0 = exports.VSN_1_0_0 = exports.DEFAULT_VERSION = undefined;
|
|
@@ -8938,7 +8950,7 @@ var require_constants = __commonJS((exports) => {
|
|
|
8938
8950
|
};
|
|
8939
8951
|
});
|
|
8940
8952
|
|
|
8941
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8953
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
|
|
8942
8954
|
var require_serializer = __commonJS((exports) => {
|
|
8943
8955
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8944
8956
|
|
|
@@ -9083,7 +9095,7 @@ var require_serializer = __commonJS((exports) => {
|
|
|
9083
9095
|
exports.default = Serializer;
|
|
9084
9096
|
});
|
|
9085
9097
|
|
|
9086
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
9098
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
|
|
9087
9099
|
var require_transformers = __commonJS((exports) => {
|
|
9088
9100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9089
9101
|
exports.httpEndpointURL = exports.toTimestampString = exports.toArray = exports.toJson = exports.toNumber = exports.toBoolean = exports.convertCell = exports.convertColumn = exports.convertChangeData = exports.PostgresTypes = undefined;
|
|
@@ -10630,7 +10642,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
|
|
|
10630
10642
|
};
|
|
10631
10643
|
});
|
|
10632
10644
|
|
|
10633
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10645
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
|
|
10634
10646
|
var require_presenceAdapter = __commonJS((exports) => {
|
|
10635
10647
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10636
10648
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -10703,7 +10715,7 @@ var require_presenceAdapter = __commonJS((exports) => {
|
|
|
10703
10715
|
}
|
|
10704
10716
|
});
|
|
10705
10717
|
|
|
10706
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10718
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
|
|
10707
10719
|
var require_RealtimePresence = __commonJS((exports) => {
|
|
10708
10720
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10709
10721
|
exports.REALTIME_PRESENCE_LISTEN_EVENTS = undefined;
|
|
@@ -10728,7 +10740,7 @@ var require_RealtimePresence = __commonJS((exports) => {
|
|
|
10728
10740
|
exports.default = RealtimePresence;
|
|
10729
10741
|
});
|
|
10730
10742
|
|
|
10731
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10743
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
|
|
10732
10744
|
var require_normalizeChannelError = __commonJS((exports) => {
|
|
10733
10745
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10734
10746
|
exports.normalizeChannelError = normalizeChannelError;
|
|
@@ -10751,7 +10763,7 @@ var require_normalizeChannelError = __commonJS((exports) => {
|
|
|
10751
10763
|
}
|
|
10752
10764
|
});
|
|
10753
10765
|
|
|
10754
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10766
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
|
|
10755
10767
|
var require_channelAdapter = __commonJS((exports) => {
|
|
10756
10768
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10757
10769
|
var constants_1 = require_constants();
|
|
@@ -10853,7 +10865,7 @@ var require_channelAdapter = __commonJS((exports) => {
|
|
|
10853
10865
|
}
|
|
10854
10866
|
});
|
|
10855
10867
|
|
|
10856
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10868
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
|
|
10857
10869
|
var require_RealtimeChannel = __commonJS((exports) => {
|
|
10858
10870
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10859
10871
|
exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_LISTEN_TYPES = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = undefined;
|
|
@@ -11027,28 +11039,25 @@ var require_RealtimeChannel = __commonJS((exports) => {
|
|
|
11027
11039
|
if (payload === undefined || payload === null) {
|
|
11028
11040
|
return Promise.reject(new Error("Payload is required for httpSend()"));
|
|
11029
11041
|
}
|
|
11042
|
+
const isBinary = payload instanceof ArrayBuffer || ArrayBuffer.isView(payload);
|
|
11030
11043
|
const headers = {
|
|
11031
11044
|
apikey: this.socket.apiKey ? this.socket.apiKey : "",
|
|
11032
|
-
"Content-Type": "application/json"
|
|
11045
|
+
"Content-Type": isBinary ? "application/octet-stream" : "application/json"
|
|
11033
11046
|
};
|
|
11034
11047
|
if (this.socket.accessTokenValue) {
|
|
11035
11048
|
headers["Authorization"] = `Bearer ${this.socket.accessTokenValue}`;
|
|
11036
11049
|
}
|
|
11050
|
+
const url = new URL(this.broadcastEndpointURL);
|
|
11051
|
+
url.pathname += `/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(event)}`;
|
|
11052
|
+
if (this.private) {
|
|
11053
|
+
url.searchParams.set("private", "true");
|
|
11054
|
+
}
|
|
11037
11055
|
const options = {
|
|
11038
11056
|
method: "POST",
|
|
11039
11057
|
headers,
|
|
11040
|
-
body: JSON.stringify(
|
|
11041
|
-
messages: [
|
|
11042
|
-
{
|
|
11043
|
-
topic: this.subTopic,
|
|
11044
|
-
event,
|
|
11045
|
-
payload,
|
|
11046
|
-
private: this.private
|
|
11047
|
-
}
|
|
11048
|
-
]
|
|
11049
|
-
})
|
|
11058
|
+
body: isBinary ? payload : JSON.stringify(payload)
|
|
11050
11059
|
};
|
|
11051
|
-
const response = await this._fetchWithTimeout(
|
|
11060
|
+
const response = await this._fetchWithTimeout(url.toString(), options, (_a = opts.timeout) !== null && _a !== undefined ? _a : this.timeout);
|
|
11052
11061
|
if (response.status === 202) {
|
|
11053
11062
|
return { success: true };
|
|
11054
11063
|
}
|
|
@@ -11231,7 +11240,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
|
|
|
11231
11240
|
exports.default = RealtimeChannel;
|
|
11232
11241
|
});
|
|
11233
11242
|
|
|
11234
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11243
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
|
|
11235
11244
|
var require_socketAdapter = __commonJS((exports) => {
|
|
11236
11245
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11237
11246
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -11344,7 +11353,7 @@ var require_socketAdapter = __commonJS((exports) => {
|
|
|
11344
11353
|
exports.default = SocketAdapter;
|
|
11345
11354
|
});
|
|
11346
11355
|
|
|
11347
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11356
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
|
|
11348
11357
|
var require_RealtimeClient = __commonJS((exports) => {
|
|
11349
11358
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11350
11359
|
var tslib_1 = require_tslib();
|
|
@@ -11811,7 +11820,7 @@ var require_RealtimeClient = __commonJS((exports) => {
|
|
|
11811
11820
|
exports.default = RealtimeClient;
|
|
11812
11821
|
});
|
|
11813
11822
|
|
|
11814
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11823
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.107.0/node_modules/@supabase/realtime-js/dist/main/index.js
|
|
11815
11824
|
var require_main2 = __commonJS((exports) => {
|
|
11816
11825
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11817
11826
|
exports.WebSocketFactory = exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_PRESENCE_LISTEN_EVENTS = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.REALTIME_LISTEN_TYPES = exports.RealtimeClient = exports.RealtimeChannel = exports.RealtimePresence = undefined;
|
|
@@ -12141,7 +12150,7 @@ var init_dist2 = __esm(() => {
|
|
|
12141
12150
|
};
|
|
12142
12151
|
});
|
|
12143
12152
|
|
|
12144
|
-
// ../../node_modules/.bun/@supabase+storage-js@2.
|
|
12153
|
+
// ../../node_modules/.bun/@supabase+storage-js@2.107.0/node_modules/@supabase/storage-js/dist/index.mjs
|
|
12145
12154
|
function _typeof2(o) {
|
|
12146
12155
|
"@babel/helpers - typeof";
|
|
12147
12156
|
return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o$1) {
|
|
@@ -12449,7 +12458,7 @@ var StorageError, StorageApiError, StorageUnknownError, resolveFetch = (customFe
|
|
|
12449
12458
|
throw error;
|
|
12450
12459
|
}
|
|
12451
12460
|
}
|
|
12452
|
-
}, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.
|
|
12461
|
+
}, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.107.0", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
|
|
12453
12462
|
var init_dist3 = __esm(() => {
|
|
12454
12463
|
init_dist2();
|
|
12455
12464
|
StorageError = class extends Error {
|
|
@@ -13157,14 +13166,14 @@ var init_dist3 = __esm(() => {
|
|
|
13157
13166
|
};
|
|
13158
13167
|
});
|
|
13159
13168
|
|
|
13160
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13169
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/version.js
|
|
13161
13170
|
var require_version2 = __commonJS((exports) => {
|
|
13162
13171
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13163
13172
|
exports.version = undefined;
|
|
13164
|
-
exports.version = "2.
|
|
13173
|
+
exports.version = "2.107.0";
|
|
13165
13174
|
});
|
|
13166
13175
|
|
|
13167
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13176
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/constants.js
|
|
13168
13177
|
var require_constants2 = __commonJS((exports) => {
|
|
13169
13178
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13170
13179
|
exports.JWKS_TTL = exports.BASE64URL_REGEX = exports.API_VERSIONS = exports.API_VERSION_HEADER_NAME = exports.NETWORK_FAILURE = exports.DEFAULT_HEADERS = exports.AUDIENCE = exports.STORAGE_KEY = exports.GOTRUE_URL = exports.EXPIRY_MARGIN_MS = exports.AUTO_REFRESH_TICK_THRESHOLD = exports.AUTO_REFRESH_TICK_DURATION_MS = undefined;
|
|
@@ -13191,16 +13200,17 @@ var require_constants2 = __commonJS((exports) => {
|
|
|
13191
13200
|
exports.JWKS_TTL = 10 * 60 * 1000;
|
|
13192
13201
|
});
|
|
13193
13202
|
|
|
13194
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13203
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/errors.js
|
|
13195
13204
|
var require_errors = __commonJS((exports) => {
|
|
13196
13205
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13197
|
-
exports.AuthInvalidJwtError = exports.AuthWeakPasswordError = exports.AuthRetryableFetchError = exports.AuthPKCECodeVerifierMissingError = exports.AuthPKCEGrantCodeExchangeError = exports.AuthImplicitGrantRedirectError = exports.AuthInvalidCredentialsError = exports.AuthInvalidTokenResponseError = exports.AuthSessionMissingError = exports.CustomAuthError = exports.AuthUnknownError = exports.AuthApiError = exports.AuthError = undefined;
|
|
13206
|
+
exports.AuthInvalidJwtError = exports.AuthWeakPasswordError = exports.AuthRefreshDiscardedError = exports.AuthRetryableFetchError = exports.AuthPKCECodeVerifierMissingError = exports.AuthPKCEGrantCodeExchangeError = exports.AuthImplicitGrantRedirectError = exports.AuthInvalidCredentialsError = exports.AuthInvalidTokenResponseError = exports.AuthSessionMissingError = exports.CustomAuthError = exports.AuthUnknownError = exports.AuthApiError = exports.AuthError = undefined;
|
|
13198
13207
|
exports.isAuthError = isAuthError;
|
|
13199
13208
|
exports.isAuthApiError = isAuthApiError;
|
|
13200
13209
|
exports.isAuthSessionMissingError = isAuthSessionMissingError;
|
|
13201
13210
|
exports.isAuthImplicitGrantRedirectError = isAuthImplicitGrantRedirectError;
|
|
13202
13211
|
exports.isAuthPKCECodeVerifierMissingError = isAuthPKCECodeVerifierMissingError;
|
|
13203
13212
|
exports.isAuthRetryableFetchError = isAuthRetryableFetchError;
|
|
13213
|
+
exports.isAuthRefreshDiscardedError = isAuthRefreshDiscardedError;
|
|
13204
13214
|
exports.isAuthWeakPasswordError = isAuthWeakPasswordError;
|
|
13205
13215
|
|
|
13206
13216
|
class AuthError extends Error {
|
|
@@ -13327,6 +13337,16 @@ var require_errors = __commonJS((exports) => {
|
|
|
13327
13337
|
return isAuthError(error) && error.name === "AuthRetryableFetchError";
|
|
13328
13338
|
}
|
|
13329
13339
|
|
|
13340
|
+
class AuthRefreshDiscardedError extends CustomAuthError {
|
|
13341
|
+
constructor(message = "Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)") {
|
|
13342
|
+
super(message, "AuthRefreshDiscardedError", 409, undefined);
|
|
13343
|
+
}
|
|
13344
|
+
}
|
|
13345
|
+
exports.AuthRefreshDiscardedError = AuthRefreshDiscardedError;
|
|
13346
|
+
function isAuthRefreshDiscardedError(error) {
|
|
13347
|
+
return isAuthError(error) && error.name === "AuthRefreshDiscardedError";
|
|
13348
|
+
}
|
|
13349
|
+
|
|
13330
13350
|
class AuthWeakPasswordError extends CustomAuthError {
|
|
13331
13351
|
constructor(message, status, reasons) {
|
|
13332
13352
|
super(message, "AuthWeakPasswordError", status, "weak_password");
|
|
@@ -13349,7 +13369,7 @@ var require_errors = __commonJS((exports) => {
|
|
|
13349
13369
|
exports.AuthInvalidJwtError = AuthInvalidJwtError;
|
|
13350
13370
|
});
|
|
13351
13371
|
|
|
13352
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13372
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
|
|
13353
13373
|
var require_base64url = __commonJS((exports) => {
|
|
13354
13374
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13355
13375
|
exports.byteToBase64URL = byteToBase64URL;
|
|
@@ -13537,7 +13557,7 @@ var require_base64url = __commonJS((exports) => {
|
|
|
13537
13557
|
}
|
|
13538
13558
|
});
|
|
13539
13559
|
|
|
13540
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13560
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
|
|
13541
13561
|
var require_helpers = __commonJS((exports) => {
|
|
13542
13562
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13543
13563
|
exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.supportsLocalStorage = exports.isBrowser = undefined;
|
|
@@ -13852,7 +13872,7 @@ var require_helpers = __commonJS((exports) => {
|
|
|
13852
13872
|
}
|
|
13853
13873
|
});
|
|
13854
13874
|
|
|
13855
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13875
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
|
|
13856
13876
|
var require_fetch = __commonJS((exports) => {
|
|
13857
13877
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13858
13878
|
exports.handleError = handleError2;
|
|
@@ -14017,14 +14037,14 @@ var require_fetch = __commonJS((exports) => {
|
|
|
14017
14037
|
}
|
|
14018
14038
|
});
|
|
14019
14039
|
|
|
14020
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14040
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/types.js
|
|
14021
14041
|
var require_types2 = __commonJS((exports) => {
|
|
14022
14042
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14023
14043
|
exports.SIGN_OUT_SCOPES = undefined;
|
|
14024
14044
|
exports.SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
14025
14045
|
});
|
|
14026
14046
|
|
|
14027
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14047
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
|
|
14028
14048
|
var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
14029
14049
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14030
14050
|
var tslib_1 = require_tslib();
|
|
@@ -14034,12 +14054,6 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14034
14054
|
var errors_1 = require_errors();
|
|
14035
14055
|
|
|
14036
14056
|
class GoTrueAdminApi {
|
|
14037
|
-
_encodePathSegment(segment) {
|
|
14038
|
-
if (segment === "." || segment === "..") {
|
|
14039
|
-
throw new errors_1.AuthError("Invalid path segment");
|
|
14040
|
-
}
|
|
14041
|
-
return encodeURIComponent(segment);
|
|
14042
|
-
}
|
|
14043
14057
|
constructor({ url = "", headers = {}, fetch: fetch2, experimental }) {
|
|
14044
14058
|
this.url = url;
|
|
14045
14059
|
this.headers = headers;
|
|
@@ -14307,8 +14321,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14307
14321
|
}
|
|
14308
14322
|
async _getOAuthClient(clientId) {
|
|
14309
14323
|
try {
|
|
14310
|
-
|
|
14311
|
-
return await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14324
|
+
return await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
14312
14325
|
headers: this.headers,
|
|
14313
14326
|
xform: (client) => {
|
|
14314
14327
|
return { data: client, error: null };
|
|
@@ -14323,8 +14336,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14323
14336
|
}
|
|
14324
14337
|
async _updateOAuthClient(clientId, params) {
|
|
14325
14338
|
try {
|
|
14326
|
-
|
|
14327
|
-
return await (0, fetch_1._request)(this.fetch, "PUT", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14339
|
+
return await (0, fetch_1._request)(this.fetch, "PUT", `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
14328
14340
|
body: params,
|
|
14329
14341
|
headers: this.headers,
|
|
14330
14342
|
xform: (client) => {
|
|
@@ -14340,8 +14352,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14340
14352
|
}
|
|
14341
14353
|
async _deleteOAuthClient(clientId) {
|
|
14342
14354
|
try {
|
|
14343
|
-
|
|
14344
|
-
await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14355
|
+
await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/admin/oauth/clients/${clientId}`, {
|
|
14345
14356
|
headers: this.headers,
|
|
14346
14357
|
noResolveJson: true
|
|
14347
14358
|
});
|
|
@@ -14355,8 +14366,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14355
14366
|
}
|
|
14356
14367
|
async _regenerateOAuthClientSecret(clientId) {
|
|
14357
14368
|
try {
|
|
14358
|
-
|
|
14359
|
-
return await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/admin/oauth/clients/${encodedClientId}/regenerate_secret`, {
|
|
14369
|
+
return await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/admin/oauth/clients/${clientId}/regenerate_secret`, {
|
|
14360
14370
|
headers: this.headers,
|
|
14361
14371
|
xform: (client) => {
|
|
14362
14372
|
return { data: client, error: null };
|
|
@@ -14408,8 +14418,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14408
14418
|
}
|
|
14409
14419
|
async _getCustomProvider(identifier) {
|
|
14410
14420
|
try {
|
|
14411
|
-
|
|
14412
|
-
return await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14421
|
+
return await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
14413
14422
|
headers: this.headers,
|
|
14414
14423
|
xform: (provider) => {
|
|
14415
14424
|
return { data: provider, error: null };
|
|
@@ -14424,8 +14433,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14424
14433
|
}
|
|
14425
14434
|
async _updateCustomProvider(identifier, params) {
|
|
14426
14435
|
try {
|
|
14427
|
-
|
|
14428
|
-
return await (0, fetch_1._request)(this.fetch, "PUT", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14436
|
+
return await (0, fetch_1._request)(this.fetch, "PUT", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
14429
14437
|
body: params,
|
|
14430
14438
|
headers: this.headers,
|
|
14431
14439
|
xform: (provider) => {
|
|
@@ -14441,8 +14449,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14441
14449
|
}
|
|
14442
14450
|
async _deleteCustomProvider(identifier) {
|
|
14443
14451
|
try {
|
|
14444
|
-
|
|
14445
|
-
await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14452
|
+
await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
14446
14453
|
headers: this.headers,
|
|
14447
14454
|
noResolveJson: true
|
|
14448
14455
|
});
|
|
@@ -14484,7 +14491,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14484
14491
|
exports.default = GoTrueAdminApi;
|
|
14485
14492
|
});
|
|
14486
14493
|
|
|
14487
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14494
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
|
|
14488
14495
|
var require_local_storage = __commonJS((exports) => {
|
|
14489
14496
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14490
14497
|
exports.memoryLocalStorageAdapter = memoryLocalStorageAdapter;
|
|
@@ -14503,7 +14510,7 @@ var require_local_storage = __commonJS((exports) => {
|
|
|
14503
14510
|
}
|
|
14504
14511
|
});
|
|
14505
14512
|
|
|
14506
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14513
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/locks.js
|
|
14507
14514
|
var require_locks = __commonJS((exports) => {
|
|
14508
14515
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14509
14516
|
exports.ProcessLockAcquireTimeoutError = exports.NavigatorLockAcquireTimeoutError = exports.LockAcquireTimeoutError = exports.internals = undefined;
|
|
@@ -14677,7 +14684,7 @@ var require_locks = __commonJS((exports) => {
|
|
|
14677
14684
|
}
|
|
14678
14685
|
});
|
|
14679
14686
|
|
|
14680
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14687
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
|
|
14681
14688
|
var require_polyfills = __commonJS((exports) => {
|
|
14682
14689
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14683
14690
|
exports.polyfillGlobalThis = polyfillGlobalThis;
|
|
@@ -14701,7 +14708,7 @@ var require_polyfills = __commonJS((exports) => {
|
|
|
14701
14708
|
}
|
|
14702
14709
|
});
|
|
14703
14710
|
|
|
14704
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14711
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
|
|
14705
14712
|
var require_ethereum = __commonJS((exports) => {
|
|
14706
14713
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14707
14714
|
exports.getAddress = getAddress;
|
|
@@ -14778,7 +14785,7 @@ ${suffix}`;
|
|
|
14778
14785
|
}
|
|
14779
14786
|
});
|
|
14780
14787
|
|
|
14781
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14788
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
|
|
14782
14789
|
var require_webauthn_errors = __commonJS((exports) => {
|
|
14783
14790
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14784
14791
|
exports.WebAuthnUnknownError = exports.WebAuthnError = undefined;
|
|
@@ -14965,7 +14972,7 @@ var require_webauthn_errors = __commonJS((exports) => {
|
|
|
14965
14972
|
}
|
|
14966
14973
|
});
|
|
14967
14974
|
|
|
14968
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14975
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
|
|
14969
14976
|
var require_webauthn = __commonJS((exports) => {
|
|
14970
14977
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14971
14978
|
exports.WebAuthnApi = exports.DEFAULT_REQUEST_OPTIONS = exports.DEFAULT_CREATION_OPTIONS = exports.webAuthnAbortService = exports.WebAuthnAbortService = exports.identifyAuthenticationError = exports.identifyRegistrationError = exports.isWebAuthnError = exports.WebAuthnError = undefined;
|
|
@@ -15419,7 +15426,7 @@ var require_webauthn = __commonJS((exports) => {
|
|
|
15419
15426
|
exports.WebAuthnApi = WebAuthnApi;
|
|
15420
15427
|
});
|
|
15421
15428
|
|
|
15422
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
15429
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
|
|
15423
15430
|
var require_GoTrueClient = __commonJS((exports) => {
|
|
15424
15431
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15425
15432
|
var tslib_1 = require_tslib();
|
|
@@ -15451,9 +15458,6 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15451
15458
|
skipAutoInitialize: false,
|
|
15452
15459
|
experimental: {}
|
|
15453
15460
|
};
|
|
15454
|
-
async function lockNoOp(name, acquireTimeout, fn) {
|
|
15455
|
-
return await fn();
|
|
15456
|
-
}
|
|
15457
15461
|
var GLOBAL_JWKS = {};
|
|
15458
15462
|
|
|
15459
15463
|
class GoTrueClient {
|
|
@@ -15472,7 +15476,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15472
15476
|
GLOBAL_JWKS[this.storageKey] = Object.assign(Object.assign({}, GLOBAL_JWKS[this.storageKey]), { cachedAt: value });
|
|
15473
15477
|
}
|
|
15474
15478
|
constructor(options) {
|
|
15475
|
-
var _a, _b, _c
|
|
15479
|
+
var _a, _b, _c;
|
|
15476
15480
|
this.userStorage = null;
|
|
15477
15481
|
this.memoryStorage = null;
|
|
15478
15482
|
this.stateChangeEmitters = new Map;
|
|
@@ -15480,10 +15484,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15480
15484
|
this.autoRefreshTickTimeout = null;
|
|
15481
15485
|
this.visibilityChangedCallback = null;
|
|
15482
15486
|
this.refreshingDeferred = null;
|
|
15487
|
+
this._sessionRemovalEpoch = 0;
|
|
15483
15488
|
this.initializePromise = null;
|
|
15484
15489
|
this.detectSessionInUrl = true;
|
|
15485
15490
|
this.hasCustomAuthorizationHeader = false;
|
|
15486
15491
|
this.suppressGetSessionWarning = false;
|
|
15492
|
+
this.lock = null;
|
|
15487
15493
|
this.lockAcquired = false;
|
|
15488
15494
|
this.pendingInLock = [];
|
|
15489
15495
|
this.broadcastChannel = null;
|
|
@@ -15515,18 +15521,13 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15515
15521
|
this.url = settings.url;
|
|
15516
15522
|
this.headers = settings.headers;
|
|
15517
15523
|
this.fetch = (0, helpers_1.resolveFetch)(settings.fetch);
|
|
15518
|
-
this.lock = settings.lock || lockNoOp;
|
|
15519
15524
|
this.detectSessionInUrl = settings.detectSessionInUrl;
|
|
15520
15525
|
this.flowType = settings.flowType;
|
|
15521
15526
|
this.hasCustomAuthorizationHeader = settings.hasCustomAuthorizationHeader;
|
|
15522
15527
|
this.throwOnError = settings.throwOnError;
|
|
15523
15528
|
this.lockAcquireTimeout = settings.lockAcquireTimeout;
|
|
15524
|
-
if (settings.lock) {
|
|
15529
|
+
if (settings.lock != null) {
|
|
15525
15530
|
this.lock = settings.lock;
|
|
15526
|
-
} else if (this.persistSession && (0, helpers_1.isBrowser)() && ((_c = globalThis === null || globalThis === undefined ? undefined : globalThis.navigator) === null || _c === undefined ? undefined : _c.locks)) {
|
|
15527
|
-
this.lock = locks_1.navigatorLock;
|
|
15528
|
-
} else {
|
|
15529
|
-
this.lock = lockNoOp;
|
|
15530
15531
|
}
|
|
15531
15532
|
if (!this.jwks) {
|
|
15532
15533
|
this.jwks = { keys: [] };
|
|
@@ -15582,7 +15583,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15582
15583
|
} catch (e) {
|
|
15583
15584
|
console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available", e);
|
|
15584
15585
|
}
|
|
15585
|
-
(
|
|
15586
|
+
(_c = this.broadcastChannel) === null || _c === undefined || _c.addEventListener("message", async (event) => {
|
|
15586
15587
|
this._debug("received broadcast notification from other tab or client", event);
|
|
15587
15588
|
try {
|
|
15588
15589
|
await this._notifyAllSubscribers(event.data.event, event.data.session, false);
|
|
@@ -15620,9 +15621,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15620
15621
|
return await this.initializePromise;
|
|
15621
15622
|
}
|
|
15622
15623
|
this.initializePromise = (async () => {
|
|
15623
|
-
|
|
15624
|
-
return await this.
|
|
15625
|
-
|
|
15624
|
+
if (this.lock != null) {
|
|
15625
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
15626
|
+
return await this._initialize();
|
|
15627
|
+
});
|
|
15628
|
+
}
|
|
15629
|
+
return await this._initialize();
|
|
15626
15630
|
})();
|
|
15627
15631
|
return await this.initializePromise;
|
|
15628
15632
|
}
|
|
@@ -15827,9 +15831,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
15827
15831
|
}
|
|
15828
15832
|
async exchangeCodeForSession(authCode) {
|
|
15829
15833
|
await this.initializePromise;
|
|
15830
|
-
|
|
15831
|
-
return this.
|
|
15832
|
-
|
|
15834
|
+
if (this.lock != null) {
|
|
15835
|
+
return this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
15836
|
+
return this._exchangeCodeForSession(authCode);
|
|
15837
|
+
});
|
|
15838
|
+
}
|
|
15839
|
+
return this._exchangeCodeForSession(authCode);
|
|
15833
15840
|
}
|
|
15834
15841
|
async signInWithWeb3(credentials) {
|
|
15835
15842
|
const { chain } = credentials;
|
|
@@ -16221,9 +16228,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16221
16228
|
}
|
|
16222
16229
|
async reauthenticate() {
|
|
16223
16230
|
await this.initializePromise;
|
|
16224
|
-
|
|
16225
|
-
return await this.
|
|
16226
|
-
|
|
16231
|
+
if (this.lock != null) {
|
|
16232
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16233
|
+
return await this._reauthenticate();
|
|
16234
|
+
});
|
|
16235
|
+
}
|
|
16236
|
+
return await this._reauthenticate();
|
|
16227
16237
|
}
|
|
16228
16238
|
async _reauthenticate() {
|
|
16229
16239
|
try {
|
|
@@ -16286,12 +16296,16 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16286
16296
|
}
|
|
16287
16297
|
async getSession() {
|
|
16288
16298
|
await this.initializePromise;
|
|
16289
|
-
|
|
16290
|
-
return this.
|
|
16291
|
-
return
|
|
16299
|
+
if (this.lock != null) {
|
|
16300
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16301
|
+
return this._useSession(async (result) => {
|
|
16302
|
+
return result;
|
|
16303
|
+
});
|
|
16292
16304
|
});
|
|
16305
|
+
}
|
|
16306
|
+
return await this._useSession(async (result) => {
|
|
16307
|
+
return result;
|
|
16293
16308
|
});
|
|
16294
|
-
return result;
|
|
16295
16309
|
}
|
|
16296
16310
|
async _acquireLock(acquireTimeout, fn) {
|
|
16297
16311
|
this._debug("#_acquireLock", "begin", acquireTimeout);
|
|
@@ -16346,7 +16360,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16346
16360
|
}
|
|
16347
16361
|
async __loadSession() {
|
|
16348
16362
|
this._debug("#__loadSession()", "begin");
|
|
16349
|
-
if (!this.lockAcquired) {
|
|
16363
|
+
if (this.lock != null && !this.lockAcquired) {
|
|
16350
16364
|
this._debug("#__loadSession()", "used outside of an acquired lock!", new Error().stack);
|
|
16351
16365
|
}
|
|
16352
16366
|
try {
|
|
@@ -16398,9 +16412,14 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16398
16412
|
return await this._getUser(jwt);
|
|
16399
16413
|
}
|
|
16400
16414
|
await this.initializePromise;
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16415
|
+
let result;
|
|
16416
|
+
if (this.lock != null) {
|
|
16417
|
+
result = await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16418
|
+
return await this._getUser();
|
|
16419
|
+
});
|
|
16420
|
+
} else {
|
|
16421
|
+
result = await this._getUser();
|
|
16422
|
+
}
|
|
16404
16423
|
if (result.data.user) {
|
|
16405
16424
|
this.suppressGetSessionWarning = true;
|
|
16406
16425
|
}
|
|
@@ -16443,9 +16462,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16443
16462
|
}
|
|
16444
16463
|
async updateUser(attributes, options = {}) {
|
|
16445
16464
|
await this.initializePromise;
|
|
16446
|
-
|
|
16447
|
-
return await this.
|
|
16448
|
-
|
|
16465
|
+
if (this.lock != null) {
|
|
16466
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16467
|
+
return await this._updateUser(attributes, options);
|
|
16468
|
+
});
|
|
16469
|
+
}
|
|
16470
|
+
return await this._updateUser(attributes, options);
|
|
16449
16471
|
}
|
|
16450
16472
|
async _updateUser(attributes, options = {}) {
|
|
16451
16473
|
try {
|
|
@@ -16488,9 +16510,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16488
16510
|
}
|
|
16489
16511
|
async setSession(currentSession) {
|
|
16490
16512
|
await this.initializePromise;
|
|
16491
|
-
|
|
16492
|
-
return await this.
|
|
16493
|
-
|
|
16513
|
+
if (this.lock != null) {
|
|
16514
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16515
|
+
return await this._setSession(currentSession);
|
|
16516
|
+
});
|
|
16517
|
+
}
|
|
16518
|
+
return await this._setSession(currentSession);
|
|
16494
16519
|
}
|
|
16495
16520
|
async _setSession(currentSession) {
|
|
16496
16521
|
try {
|
|
@@ -16541,9 +16566,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16541
16566
|
}
|
|
16542
16567
|
async refreshSession(currentSession) {
|
|
16543
16568
|
await this.initializePromise;
|
|
16544
|
-
|
|
16545
|
-
return await this.
|
|
16546
|
-
|
|
16569
|
+
if (this.lock != null) {
|
|
16570
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16571
|
+
return await this._refreshSession(currentSession);
|
|
16572
|
+
});
|
|
16573
|
+
}
|
|
16574
|
+
return await this._refreshSession(currentSession);
|
|
16547
16575
|
}
|
|
16548
16576
|
async _refreshSession(currentSession) {
|
|
16549
16577
|
try {
|
|
@@ -16661,7 +16689,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16661
16689
|
if (typeof this.detectSessionInUrl === "function") {
|
|
16662
16690
|
return this.detectSessionInUrl(new URL(window.location.href), params);
|
|
16663
16691
|
}
|
|
16664
|
-
return Boolean(params.access_token || params.error_description);
|
|
16692
|
+
return Boolean(params.access_token || params.error || params.error_description || params.error_code);
|
|
16665
16693
|
}
|
|
16666
16694
|
async _isPKCECallback(params) {
|
|
16667
16695
|
const currentStorageContent = await (0, helpers_1.getItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
@@ -16669,9 +16697,12 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16669
16697
|
}
|
|
16670
16698
|
async signOut(options = { scope: "global" }) {
|
|
16671
16699
|
await this.initializePromise;
|
|
16672
|
-
|
|
16673
|
-
return await this.
|
|
16674
|
-
|
|
16700
|
+
if (this.lock != null) {
|
|
16701
|
+
return await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16702
|
+
return await this._signOut(options);
|
|
16703
|
+
});
|
|
16704
|
+
}
|
|
16705
|
+
return await this._signOut(options);
|
|
16675
16706
|
}
|
|
16676
16707
|
async _signOut({ scope } = { scope: "global" }) {
|
|
16677
16708
|
return await this._useSession(async (result) => {
|
|
@@ -16710,9 +16741,13 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16710
16741
|
this.stateChangeEmitters.set(id, subscription);
|
|
16711
16742
|
(async () => {
|
|
16712
16743
|
await this.initializePromise;
|
|
16713
|
-
|
|
16714
|
-
this.
|
|
16715
|
-
|
|
16744
|
+
if (this.lock != null) {
|
|
16745
|
+
await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
16746
|
+
this._emitInitialSession(id);
|
|
16747
|
+
});
|
|
16748
|
+
} else {
|
|
16749
|
+
await this._emitInitialSession(id);
|
|
16750
|
+
}
|
|
16716
16751
|
})();
|
|
16717
16752
|
return { data: { subscription } };
|
|
16718
16753
|
}
|
|
@@ -16881,7 +16916,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16881
16916
|
}
|
|
16882
16917
|
}
|
|
16883
16918
|
async _refreshAccessToken(refreshToken) {
|
|
16884
|
-
const debugName = `#_refreshAccessToken(
|
|
16919
|
+
const debugName = `#_refreshAccessToken()`;
|
|
16885
16920
|
this._debug(debugName, "begin");
|
|
16886
16921
|
try {
|
|
16887
16922
|
const startedAt = Date.now();
|
|
@@ -16964,10 +16999,14 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16964
16999
|
if (this.autoRefreshToken && currentSession.refresh_token) {
|
|
16965
17000
|
const { error } = await this._callRefreshToken(currentSession.refresh_token);
|
|
16966
17001
|
if (error) {
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
|
|
16970
|
-
|
|
17002
|
+
if ((0, errors_1.isAuthRefreshDiscardedError)(error)) {
|
|
17003
|
+
this._debug(debugName, "refresh discarded by commit guard", error);
|
|
17004
|
+
} else {
|
|
17005
|
+
console.error(error);
|
|
17006
|
+
if (!(0, errors_1.isAuthRetryableFetchError)(error)) {
|
|
17007
|
+
this._debug(debugName, "refresh failed with a non-retryable error, removing the session", error);
|
|
17008
|
+
await this._removeSession();
|
|
17009
|
+
}
|
|
16971
17010
|
}
|
|
16972
17011
|
}
|
|
16973
17012
|
}
|
|
@@ -17004,16 +17043,45 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17004
17043
|
if (this.refreshingDeferred) {
|
|
17005
17044
|
return this.refreshingDeferred.promise;
|
|
17006
17045
|
}
|
|
17007
|
-
const debugName = `#_callRefreshToken(
|
|
17046
|
+
const debugName = `#_callRefreshToken()`;
|
|
17008
17047
|
this._debug(debugName, "begin");
|
|
17009
17048
|
try {
|
|
17010
17049
|
this.refreshingDeferred = new helpers_1.Deferred;
|
|
17050
|
+
const storedAtStart = await (0, helpers_1.getItemAsync)(this.storage, this.storageKey);
|
|
17011
17051
|
const { data, error } = await this._refreshAccessToken(refreshToken);
|
|
17012
17052
|
if (error)
|
|
17013
17053
|
throw error;
|
|
17014
17054
|
if (!data.session)
|
|
17015
17055
|
throw new errors_1.AuthSessionMissingError;
|
|
17056
|
+
const storedAfter = await (0, helpers_1.getItemAsync)(this.storage, this.storageKey);
|
|
17057
|
+
const storageChangedUnderUs = storedAtStart !== null && (storedAfter === null || storedAfter.refresh_token !== storedAtStart.refresh_token);
|
|
17058
|
+
if (storageChangedUnderUs) {
|
|
17059
|
+
this._debug(debugName, "commit guard: storage changed since refresh started, discarding rotated tokens", {
|
|
17060
|
+
startedWith: "present",
|
|
17061
|
+
nowHolds: storedAfter ? "replaced" : "cleared"
|
|
17062
|
+
});
|
|
17063
|
+
const discarded = {
|
|
17064
|
+
data: null,
|
|
17065
|
+
error: new errors_1.AuthRefreshDiscardedError
|
|
17066
|
+
};
|
|
17067
|
+
this.refreshingDeferred.resolve(discarded);
|
|
17068
|
+
return discarded;
|
|
17069
|
+
}
|
|
17070
|
+
const epochBeforeSave = this._sessionRemovalEpoch;
|
|
17016
17071
|
await this._saveSession(data.session);
|
|
17072
|
+
if (this._sessionRemovalEpoch !== epochBeforeSave) {
|
|
17073
|
+
this._debug(debugName, "commit guard (post-save): _removeSession ran during _saveSession, undoing write");
|
|
17074
|
+
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey);
|
|
17075
|
+
if (this.userStorage) {
|
|
17076
|
+
await (0, helpers_1.removeItemAsync)(this.userStorage, this.storageKey + "-user");
|
|
17077
|
+
}
|
|
17078
|
+
const discarded = {
|
|
17079
|
+
data: null,
|
|
17080
|
+
error: new errors_1.AuthRefreshDiscardedError
|
|
17081
|
+
};
|
|
17082
|
+
this.refreshingDeferred.resolve(discarded);
|
|
17083
|
+
return discarded;
|
|
17084
|
+
}
|
|
17017
17085
|
await this._notifyAllSubscribers("TOKEN_REFRESHED", data.session);
|
|
17018
17086
|
const result = { data: data.session, error: null };
|
|
17019
17087
|
this.refreshingDeferred.resolve(result);
|
|
@@ -17083,6 +17151,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17083
17151
|
}
|
|
17084
17152
|
}
|
|
17085
17153
|
async _removeSession() {
|
|
17154
|
+
this._sessionRemovalEpoch += 1;
|
|
17086
17155
|
this._debug("#_removeSession()");
|
|
17087
17156
|
this.suppressGetSessionWarning = false;
|
|
17088
17157
|
await (0, helpers_1.removeItemAsync)(this.storage, this.storageKey);
|
|
@@ -17147,38 +17216,74 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17147
17216
|
this._removeVisibilityChangedCallback();
|
|
17148
17217
|
await this._stopAutoRefresh();
|
|
17149
17218
|
}
|
|
17219
|
+
async dispose() {
|
|
17220
|
+
var _a;
|
|
17221
|
+
this._removeVisibilityChangedCallback();
|
|
17222
|
+
await this._stopAutoRefresh();
|
|
17223
|
+
(_a = this.broadcastChannel) === null || _a === undefined || _a.close();
|
|
17224
|
+
this.broadcastChannel = null;
|
|
17225
|
+
this.stateChangeEmitters.clear();
|
|
17226
|
+
}
|
|
17150
17227
|
async _autoRefreshTokenTick() {
|
|
17151
17228
|
this._debug("#_autoRefreshTokenTick()", "begin");
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
const now = Date.now();
|
|
17229
|
+
if (this.lock != null) {
|
|
17230
|
+
try {
|
|
17231
|
+
await this._acquireLock(0, async () => {
|
|
17156
17232
|
try {
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17169
|
-
|
|
17170
|
-
|
|
17233
|
+
const now = Date.now();
|
|
17234
|
+
try {
|
|
17235
|
+
return await this._useSession(async (result) => {
|
|
17236
|
+
const { data: { session } } = result;
|
|
17237
|
+
if (!session || !session.refresh_token || !session.expires_at) {
|
|
17238
|
+
this._debug("#_autoRefreshTokenTick()", "no session");
|
|
17239
|
+
return;
|
|
17240
|
+
}
|
|
17241
|
+
const expiresInTicks = Math.floor((session.expires_at * 1000 - now) / constants_1.AUTO_REFRESH_TICK_DURATION_MS);
|
|
17242
|
+
this._debug("#_autoRefreshTokenTick()", `access token expires in ${expiresInTicks} ticks, a tick lasts ${constants_1.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${constants_1.AUTO_REFRESH_TICK_THRESHOLD} ticks`);
|
|
17243
|
+
if (expiresInTicks <= constants_1.AUTO_REFRESH_TICK_THRESHOLD) {
|
|
17244
|
+
await this._callRefreshToken(session.refresh_token);
|
|
17245
|
+
}
|
|
17246
|
+
});
|
|
17247
|
+
} catch (e) {
|
|
17248
|
+
console.error("Auto refresh tick failed with error. This is likely a transient error.", e);
|
|
17249
|
+
}
|
|
17250
|
+
} finally {
|
|
17251
|
+
this._debug("#_autoRefreshTokenTick()", "end");
|
|
17171
17252
|
}
|
|
17172
|
-
}
|
|
17173
|
-
|
|
17253
|
+
});
|
|
17254
|
+
} catch (e) {
|
|
17255
|
+
if (e instanceof locks_1.LockAcquireTimeoutError) {
|
|
17256
|
+
this._debug("auto refresh token tick lock not available");
|
|
17257
|
+
} else {
|
|
17258
|
+
throw e;
|
|
17174
17259
|
}
|
|
17175
|
-
});
|
|
17176
|
-
} catch (e) {
|
|
17177
|
-
if (e instanceof locks_1.LockAcquireTimeoutError) {
|
|
17178
|
-
this._debug("auto refresh token tick lock not available");
|
|
17179
|
-
} else {
|
|
17180
|
-
throw e;
|
|
17181
17260
|
}
|
|
17261
|
+
return;
|
|
17262
|
+
}
|
|
17263
|
+
if (this.refreshingDeferred !== null) {
|
|
17264
|
+
this._debug("#_autoRefreshTokenTick()", "refresh already in flight, skipping");
|
|
17265
|
+
return;
|
|
17266
|
+
}
|
|
17267
|
+
try {
|
|
17268
|
+
const now = Date.now();
|
|
17269
|
+
try {
|
|
17270
|
+
await this._useSession(async (result) => {
|
|
17271
|
+
const { data: { session } } = result;
|
|
17272
|
+
if (!session || !session.refresh_token || !session.expires_at) {
|
|
17273
|
+
this._debug("#_autoRefreshTokenTick()", "no session");
|
|
17274
|
+
return;
|
|
17275
|
+
}
|
|
17276
|
+
const expiresInTicks = Math.floor((session.expires_at * 1000 - now) / constants_1.AUTO_REFRESH_TICK_DURATION_MS);
|
|
17277
|
+
this._debug("#_autoRefreshTokenTick()", `access token expires in ${expiresInTicks} ticks, a tick lasts ${constants_1.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${constants_1.AUTO_REFRESH_TICK_THRESHOLD} ticks`);
|
|
17278
|
+
if (expiresInTicks <= constants_1.AUTO_REFRESH_TICK_THRESHOLD) {
|
|
17279
|
+
await this._callRefreshToken(session.refresh_token);
|
|
17280
|
+
}
|
|
17281
|
+
});
|
|
17282
|
+
} catch (e) {
|
|
17283
|
+
console.error("Auto refresh tick failed with error. This is likely a transient error.", e);
|
|
17284
|
+
}
|
|
17285
|
+
} finally {
|
|
17286
|
+
this._debug("#_autoRefreshTokenTick()", "end");
|
|
17182
17287
|
}
|
|
17183
17288
|
}
|
|
17184
17289
|
async _handleVisibilityChange() {
|
|
@@ -17212,13 +17317,21 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17212
17317
|
}
|
|
17213
17318
|
if (!calledFromInitialize) {
|
|
17214
17319
|
await this.initializePromise;
|
|
17215
|
-
|
|
17320
|
+
if (this.lock != null) {
|
|
17321
|
+
await this._acquireLock(this.lockAcquireTimeout, async () => {
|
|
17322
|
+
if (document.visibilityState !== "visible") {
|
|
17323
|
+
this._debug(methodName, "acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");
|
|
17324
|
+
return;
|
|
17325
|
+
}
|
|
17326
|
+
await this._recoverAndRefresh();
|
|
17327
|
+
});
|
|
17328
|
+
} else {
|
|
17216
17329
|
if (document.visibilityState !== "visible") {
|
|
17217
|
-
this._debug(methodName, "
|
|
17330
|
+
this._debug(methodName, "visibilityState is no longer visible, skipping recovery");
|
|
17218
17331
|
return;
|
|
17219
17332
|
}
|
|
17220
17333
|
await this._recoverAndRefresh();
|
|
17221
|
-
}
|
|
17334
|
+
}
|
|
17222
17335
|
}
|
|
17223
17336
|
} else if (document.visibilityState === "hidden") {
|
|
17224
17337
|
if (this.autoRefreshToken) {
|
|
@@ -17301,7 +17414,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17301
17414
|
}
|
|
17302
17415
|
}
|
|
17303
17416
|
async _verify(params) {
|
|
17304
|
-
|
|
17417
|
+
const run = async () => {
|
|
17305
17418
|
try {
|
|
17306
17419
|
return await this._useSession(async (result) => {
|
|
17307
17420
|
var _a;
|
|
@@ -17330,10 +17443,14 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17330
17443
|
}
|
|
17331
17444
|
throw error;
|
|
17332
17445
|
}
|
|
17333
|
-
}
|
|
17446
|
+
};
|
|
17447
|
+
if (this.lock != null) {
|
|
17448
|
+
return this._acquireLock(this.lockAcquireTimeout, run);
|
|
17449
|
+
}
|
|
17450
|
+
return run();
|
|
17334
17451
|
}
|
|
17335
17452
|
async _challenge(params) {
|
|
17336
|
-
|
|
17453
|
+
const run = async () => {
|
|
17337
17454
|
try {
|
|
17338
17455
|
return await this._useSession(async (result) => {
|
|
17339
17456
|
var _a;
|
|
@@ -17372,7 +17489,11 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17372
17489
|
}
|
|
17373
17490
|
throw error;
|
|
17374
17491
|
}
|
|
17375
|
-
}
|
|
17492
|
+
};
|
|
17493
|
+
if (this.lock != null) {
|
|
17494
|
+
return this._acquireLock(this.lockAcquireTimeout, run);
|
|
17495
|
+
}
|
|
17496
|
+
return run();
|
|
17376
17497
|
}
|
|
17377
17498
|
async _challengeAndVerify(params) {
|
|
17378
17499
|
const { data: challengeData, error: challengeError } = await this._challenge({
|
|
@@ -17630,7 +17751,11 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17630
17751
|
}
|
|
17631
17752
|
const { header, payload, signature, raw: { header: rawHeader, payload: rawPayload } } = (0, helpers_1.decodeJWT)(token);
|
|
17632
17753
|
if (!(options === null || options === undefined ? undefined : options.allowExpired)) {
|
|
17633
|
-
|
|
17754
|
+
try {
|
|
17755
|
+
(0, helpers_1.validateExp)(payload.exp);
|
|
17756
|
+
} catch (e) {
|
|
17757
|
+
throw new errors_1.AuthInvalidJwtError(e instanceof Error ? e.message : "JWT validation failed");
|
|
17758
|
+
}
|
|
17634
17759
|
}
|
|
17635
17760
|
const signingKey = !header.alg || header.alg.startsWith("HS") || !header.kid || !(("crypto" in globalThis) && ("subtle" in globalThis.crypto)) ? null : await this.fetchJwk(header.kid, (options === null || options === undefined ? undefined : options.keys) ? { keys: options.keys } : options === null || options === undefined ? undefined : options.jwks);
|
|
17636
17761
|
if (!signingKey) {
|
|
@@ -17943,7 +18068,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17943
18068
|
exports.default = GoTrueClient;
|
|
17944
18069
|
});
|
|
17945
18070
|
|
|
17946
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18071
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
|
|
17947
18072
|
var require_AuthAdminApi = __commonJS((exports) => {
|
|
17948
18073
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17949
18074
|
var tslib_1 = require_tslib();
|
|
@@ -17952,7 +18077,7 @@ var require_AuthAdminApi = __commonJS((exports) => {
|
|
|
17952
18077
|
exports.default = AuthAdminApi;
|
|
17953
18078
|
});
|
|
17954
18079
|
|
|
17955
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18080
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/AuthClient.js
|
|
17956
18081
|
var require_AuthClient = __commonJS((exports) => {
|
|
17957
18082
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17958
18083
|
var tslib_1 = require_tslib();
|
|
@@ -17961,7 +18086,7 @@ var require_AuthClient = __commonJS((exports) => {
|
|
|
17961
18086
|
exports.default = AuthClient;
|
|
17962
18087
|
});
|
|
17963
18088
|
|
|
17964
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18089
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.107.0/node_modules/@supabase/auth-js/dist/main/index.js
|
|
17965
18090
|
var require_main3 = __commonJS((exports) => {
|
|
17966
18091
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17967
18092
|
exports.processLock = exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = undefined;
|
|
@@ -17991,7 +18116,7 @@ var require_main3 = __commonJS((exports) => {
|
|
|
17991
18116
|
} });
|
|
17992
18117
|
});
|
|
17993
18118
|
|
|
17994
|
-
// ../../node_modules/.bun/@supabase+supabase-js@2.
|
|
18119
|
+
// ../../node_modules/.bun/@supabase+supabase-js@2.107.0/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
17995
18120
|
var exports_dist = {};
|
|
17996
18121
|
__export(exports_dist, {
|
|
17997
18122
|
createClient: () => createClient,
|
|
@@ -18252,7 +18377,7 @@ function shouldShowDeprecationWarning() {
|
|
|
18252
18377
|
return false;
|
|
18253
18378
|
return parseInt(versionMatch[1], 10) <= 18;
|
|
18254
18379
|
}
|
|
18255
|
-
var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.
|
|
18380
|
+
var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.107.0", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
|
|
18256
18381
|
if (customFetch)
|
|
18257
18382
|
return (...args) => customFetch(...args);
|
|
18258
18383
|
return (...args) => fetch(...args);
|
|
@@ -18432,15 +18557,21 @@ var init_dist4 = __esm(() => {
|
|
|
18432
18557
|
import_auth_js = __toESM(require_main3(), 1);
|
|
18433
18558
|
__reExport(exports_dist, __toESM(require_main2(), 1));
|
|
18434
18559
|
__reExport(exports_dist, __toESM(require_main3(), 1));
|
|
18435
|
-
if (typeof Deno !== "undefined")
|
|
18560
|
+
if (typeof Deno !== "undefined") {
|
|
18436
18561
|
JS_ENV = "deno";
|
|
18437
|
-
|
|
18562
|
+
JS_RUNTIME_VERSION = (_Deno$version = Deno.version) === null || _Deno$version === undefined ? undefined : _Deno$version.deno;
|
|
18563
|
+
} else if (typeof document !== "undefined")
|
|
18438
18564
|
JS_ENV = "web";
|
|
18439
18565
|
else if (typeof navigator !== "undefined" && navigator.product === "ReactNative")
|
|
18440
18566
|
JS_ENV = "react-native";
|
|
18441
|
-
else
|
|
18567
|
+
else {
|
|
18442
18568
|
JS_ENV = "node";
|
|
18443
|
-
|
|
18569
|
+
JS_RUNTIME_VERSION = typeof process !== "undefined" ? (_process$version = process.version) === null || _process$version === undefined ? undefined : _process$version.replace(/^v/, "") : undefined;
|
|
18570
|
+
}
|
|
18571
|
+
_runtimeMeta = [`runtime=${JS_ENV}`];
|
|
18572
|
+
if (JS_RUNTIME_VERSION)
|
|
18573
|
+
_runtimeMeta.push(`runtime-version=${JS_RUNTIME_VERSION}`);
|
|
18574
|
+
DEFAULT_HEADERS2 = { "X-Client-Info": `supabase-js/${version2}; ${_runtimeMeta.join("; ")}` };
|
|
18444
18575
|
DEFAULT_GLOBAL_OPTIONS = { headers: DEFAULT_HEADERS2 };
|
|
18445
18576
|
DEFAULT_DB_OPTIONS = { schema: "public" };
|
|
18446
18577
|
DEFAULT_AUTH_OPTIONS = {
|
|
@@ -79881,6 +80012,19 @@ function registerConfigRoutes(app, ctx) {
|
|
|
79881
80012
|
return c2.json({ key, value });
|
|
79882
80013
|
});
|
|
79883
80014
|
}
|
|
80015
|
+
// src/web/usage.ts
|
|
80016
|
+
function logWebUsage(ctx, params) {
|
|
80017
|
+
Promise.resolve(ctx.supabase.rpc("cerefox_log_usage", {
|
|
80018
|
+
p_operation: params.operation,
|
|
80019
|
+
p_access_path: "webapp",
|
|
80020
|
+
p_requestor: params.requestor ?? "web-ui",
|
|
80021
|
+
p_document_id: params.document_id ?? null,
|
|
80022
|
+
p_project_id: params.project_id ?? null,
|
|
80023
|
+
p_query_text: params.query_text ?? null,
|
|
80024
|
+
p_result_count: params.result_count ?? null,
|
|
80025
|
+
p_extra: {}
|
|
80026
|
+
})).catch(() => {});
|
|
80027
|
+
}
|
|
79884
80028
|
|
|
79885
80029
|
// src/web/routes/discovery.ts
|
|
79886
80030
|
var UUID_RE3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -80207,6 +80351,7 @@ function registerDiscoveryRoutes(app, ctx) {
|
|
|
80207
80351
|
results = results.filter((r) => statusMap.get(r.document_id) === reviewStatus);
|
|
80208
80352
|
}
|
|
80209
80353
|
}
|
|
80354
|
+
logWebUsage(ctx, { operation: "search", query_text: q, result_count: results.length });
|
|
80210
80355
|
return c2.json({
|
|
80211
80356
|
results,
|
|
80212
80357
|
query: q,
|
|
@@ -80504,6 +80649,7 @@ function registerDocumentReadRoutes(app, ctx) {
|
|
|
80504
80649
|
const meta = await getDocumentRow(ctx, documentId);
|
|
80505
80650
|
const projectIds = await listDocumentProjectIds(ctx, documentId);
|
|
80506
80651
|
const versions3 = await listDocumentVersions(ctx, documentId);
|
|
80652
|
+
logWebUsage(ctx, { operation: "get-document", document_id: documentId });
|
|
80507
80653
|
return c2.json({
|
|
80508
80654
|
document_id: documentId,
|
|
80509
80655
|
full_content: doc2.full_content ?? "",
|
|
@@ -80848,6 +80994,7 @@ function registerIngestRoutes(app, ctx) {
|
|
|
80848
80994
|
};
|
|
80849
80995
|
if (result.note)
|
|
80850
80996
|
resp.note = result.note;
|
|
80997
|
+
logWebUsage(ctx, { operation: "ingest", document_id: result.documentId });
|
|
80851
80998
|
return c2.json(resp, 200);
|
|
80852
80999
|
} catch (err) {
|
|
80853
81000
|
return c2.json(notReady(err instanceof Error ? err.message : String(err)), 200);
|
|
@@ -80903,6 +81050,7 @@ function registerIngestRoutes(app, ctx) {
|
|
|
80903
81050
|
authorType: "user"
|
|
80904
81051
|
});
|
|
80905
81052
|
const skipped = result.action === "skipped";
|
|
81053
|
+
logWebUsage(ctx, { operation: "ingest", document_id: result.documentId });
|
|
80906
81054
|
return c2.json({
|
|
80907
81055
|
success: !skipped,
|
|
80908
81056
|
document_id: result.documentId,
|
|
@@ -80951,6 +81099,7 @@ function registerIngestRoutes(app, ctx) {
|
|
|
80951
81099
|
author: "web-ui",
|
|
80952
81100
|
authorType: "user"
|
|
80953
81101
|
});
|
|
81102
|
+
logWebUsage(ctx, { operation: "ingest", document_id: result.documentId });
|
|
80954
81103
|
return c2.json({
|
|
80955
81104
|
success: true,
|
|
80956
81105
|
document_id: result.documentId,
|
|
@@ -81174,6 +81323,51 @@ function registerMetaRoutes(app, ctx) {
|
|
|
81174
81323
|
});
|
|
81175
81324
|
}
|
|
81176
81325
|
|
|
81326
|
+
// src/web/routes/postgrest-proxy.ts
|
|
81327
|
+
var STRIP_RESPONSE_HEADERS = [
|
|
81328
|
+
"connection",
|
|
81329
|
+
"keep-alive",
|
|
81330
|
+
"transfer-encoding",
|
|
81331
|
+
"content-length",
|
|
81332
|
+
"content-encoding",
|
|
81333
|
+
"te",
|
|
81334
|
+
"trailer",
|
|
81335
|
+
"upgrade",
|
|
81336
|
+
"proxy-authenticate",
|
|
81337
|
+
"proxy-authorization"
|
|
81338
|
+
];
|
|
81339
|
+
function registerPostgrestProxy(app) {
|
|
81340
|
+
const upstream = (process.env.CEREFOX_POSTGREST_UPSTREAM ?? "").trim().replace(/\/+$/, "");
|
|
81341
|
+
if (!upstream)
|
|
81342
|
+
return;
|
|
81343
|
+
app.all("/rest/v1/*", async (c2) => {
|
|
81344
|
+
const url = new URL(c2.req.url);
|
|
81345
|
+
const path = url.pathname.replace(/^\/rest\/v1/, "");
|
|
81346
|
+
const target = `${upstream}${path}${url.search}`;
|
|
81347
|
+
const headers = new Headers(c2.req.raw.headers);
|
|
81348
|
+
headers.delete("host");
|
|
81349
|
+
headers.delete("accept-encoding");
|
|
81350
|
+
const method = c2.req.method;
|
|
81351
|
+
const init = { method, headers };
|
|
81352
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
81353
|
+
init.body = c2.req.raw.body;
|
|
81354
|
+
init.duplex = "half";
|
|
81355
|
+
}
|
|
81356
|
+
let resp;
|
|
81357
|
+
try {
|
|
81358
|
+
resp = await fetch(target, init);
|
|
81359
|
+
} catch (err) {
|
|
81360
|
+
return c2.json({
|
|
81361
|
+
detail: `PostgREST upstream unreachable: ${err instanceof Error ? err.message : String(err)}`
|
|
81362
|
+
}, 502);
|
|
81363
|
+
}
|
|
81364
|
+
const respHeaders = new Headers(resp.headers);
|
|
81365
|
+
for (const h of STRIP_RESPONSE_HEADERS)
|
|
81366
|
+
respHeaders.delete(h);
|
|
81367
|
+
return new Response(resp.body, { status: resp.status, headers: respHeaders });
|
|
81368
|
+
});
|
|
81369
|
+
}
|
|
81370
|
+
|
|
81177
81371
|
// src/web/routes/preferences.ts
|
|
81178
81372
|
init_config();
|
|
81179
81373
|
import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
@@ -81371,6 +81565,7 @@ function buildApp(ctx = buildWebContext()) {
|
|
|
81371
81565
|
app.post("/api/v1/ingest/file", ingest503);
|
|
81372
81566
|
app.post("/api/v1/documents/:document_id/upload", ingest503);
|
|
81373
81567
|
}
|
|
81568
|
+
registerPostgrestProxy(app);
|
|
81374
81569
|
const staticDir = resolveStaticDir();
|
|
81375
81570
|
if (staticDir) {
|
|
81376
81571
|
app.use("/static/*", serveStatic({
|
|
@@ -81744,7 +81939,10 @@ function registerRenameHusks(program2) {
|
|
|
81744
81939
|
}
|
|
81745
81940
|
}
|
|
81746
81941
|
function buildProgram() {
|
|
81747
|
-
const
|
|
81942
|
+
const progName = process.env.CEREFOX_PROG_NAME || "cerefox";
|
|
81943
|
+
const program2 = new Command(progName).description("Cerefox — user-owned shared memory for AI agents.").version(PKG_VERSION, "-v, --version", `Print the ${progName} version and exit.`).addOption(new Option("--json", "Emit machine-readable JSON on stdout instead of the default human text. " + "Available on read commands; ignored on commands without a JSON shape.").hideHelp()).showHelpAfterError(`(run \`${progName} --help\` for usage)`).enablePositionalOptions().addHelpText("after", `
|
|
81944
|
+
Resource groups (run \`${progName} <group> --help\`):
|
|
81945
|
+
` + ` document get · list · edit · delete · restore · ingest · ingest-dir · version {list·archive·unarchive}
|
|
81748
81946
|
` + ` project list · create · edit · delete
|
|
81749
81947
|
` + ` metadata keys · search
|
|
81750
81948
|
` + ` audit list
|
|
@@ -81766,8 +81964,8 @@ Exit codes:
|
|
|
81766
81964
|
` + ` 1 user error 3 not found (document / version / project)
|
|
81767
81965
|
` + `
|
|
81768
81966
|
Learn more:
|
|
81769
|
-
` + `
|
|
81770
|
-
` + `
|
|
81967
|
+
` + ` ${progName} guides list # bundled docs (offline)
|
|
81968
|
+
` + ` ${progName} doctor # diagnose your install
|
|
81771
81969
|
` + ` https://github.com/fstamatelopoulos/cerefox
|
|
81772
81970
|
`);
|
|
81773
81971
|
registerSearch(program2);
|