norc-cli 0.3.3 → 0.4.1
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/README.md +2 -0
- package/dist/index.js +580 -268
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -569,9 +569,9 @@ var init_tslib_es6 = __esm({
|
|
|
569
569
|
}
|
|
570
570
|
});
|
|
571
571
|
|
|
572
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
572
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/helper.js
|
|
573
573
|
var require_helper = __commonJS({
|
|
574
|
-
"../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
574
|
+
"../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/helper.js"(exports2) {
|
|
575
575
|
"use strict";
|
|
576
576
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
577
577
|
exports2.resolveFetch = void 0;
|
|
@@ -585,9 +585,9 @@ var require_helper = __commonJS({
|
|
|
585
585
|
}
|
|
586
586
|
});
|
|
587
587
|
|
|
588
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
588
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/types.js
|
|
589
589
|
var require_types = __commonJS({
|
|
590
|
-
"../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
590
|
+
"../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/types.js"(exports2) {
|
|
591
591
|
"use strict";
|
|
592
592
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
593
593
|
exports2.FunctionRegion = exports2.FunctionsHttpError = exports2.FunctionsRelayError = exports2.FunctionsFetchError = exports2.FunctionsError = void 0;
|
|
@@ -645,9 +645,9 @@ var require_types = __commonJS({
|
|
|
645
645
|
}
|
|
646
646
|
});
|
|
647
647
|
|
|
648
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
648
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
|
|
649
649
|
var require_FunctionsClient = __commonJS({
|
|
650
|
-
"../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
650
|
+
"../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js"(exports2) {
|
|
651
651
|
"use strict";
|
|
652
652
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
653
653
|
exports2.FunctionsClient = void 0;
|
|
@@ -931,9 +931,9 @@ var require_FunctionsClient = __commonJS({
|
|
|
931
931
|
}
|
|
932
932
|
});
|
|
933
933
|
|
|
934
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
934
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/index.js
|
|
935
935
|
var require_main = __commonJS({
|
|
936
|
-
"../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
936
|
+
"../../node_modules/.pnpm/@supabase+functions-js@2.119.2/node_modules/@supabase/functions-js/dist/main/index.js"(exports2) {
|
|
937
937
|
"use strict";
|
|
938
938
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
939
939
|
exports2.FunctionRegion = exports2.FunctionsRelayError = exports2.FunctionsHttpError = exports2.FunctionsFetchError = exports2.FunctionsError = exports2.FunctionsClient = void 0;
|
|
@@ -960,9 +960,9 @@ var require_main = __commonJS({
|
|
|
960
960
|
}
|
|
961
961
|
});
|
|
962
962
|
|
|
963
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
963
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
|
|
964
964
|
var require_websocket_factory = __commonJS({
|
|
965
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
965
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js"(exports2) {
|
|
966
966
|
"use strict";
|
|
967
967
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
968
968
|
exports2.WebSocketFactory = void 0;
|
|
@@ -1071,19 +1071,19 @@ Suggested solution: ${env.workaround}`;
|
|
|
1071
1071
|
}
|
|
1072
1072
|
});
|
|
1073
1073
|
|
|
1074
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1074
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/version.js
|
|
1075
1075
|
var require_version = __commonJS({
|
|
1076
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1076
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/version.js"(exports2) {
|
|
1077
1077
|
"use strict";
|
|
1078
1078
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1079
1079
|
exports2.version = void 0;
|
|
1080
|
-
exports2.version = "2.
|
|
1080
|
+
exports2.version = "2.119.2";
|
|
1081
1081
|
}
|
|
1082
1082
|
});
|
|
1083
1083
|
|
|
1084
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1084
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
|
|
1085
1085
|
var require_constants = __commonJS({
|
|
1086
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1086
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/constants.js"(exports2) {
|
|
1087
1087
|
"use strict";
|
|
1088
1088
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1089
1089
|
exports2.CONNECTION_STATE = exports2.TRANSPORTS = exports2.CHANNEL_EVENTS = exports2.CHANNEL_STATES = exports2.SOCKET_STATES = exports2.MAX_PUSH_BUFFER_SIZE = exports2.WS_CLOSE_NORMAL = exports2.POSTGRES_CHANGES_WAIT_ERROR_GRACE = exports2.DEFAULT_POSTGRES_CHANGES_WAIT_TIMEOUT = exports2.DEFAULT_TIMEOUT = exports2.VERSION = exports2.DEFAULT_VSN = exports2.VSN_2_0_0 = exports2.VSN_1_0_0 = exports2.DEFAULT_VERSION = void 0;
|
|
@@ -1131,12 +1131,12 @@ var require_constants = __commonJS({
|
|
|
1131
1131
|
}
|
|
1132
1132
|
});
|
|
1133
1133
|
|
|
1134
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1134
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
|
|
1135
1135
|
var require_serializer = __commonJS({
|
|
1136
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1136
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js"(exports2) {
|
|
1137
1137
|
"use strict";
|
|
1138
1138
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1139
|
-
var Serializer = class {
|
|
1139
|
+
var Serializer = class _Serializer {
|
|
1140
1140
|
constructor(allowedMetadataKeys) {
|
|
1141
1141
|
this.HEADER_LENGTH = 1;
|
|
1142
1142
|
this.USER_BROADCAST_PUSH_META_LENGTH = 6;
|
|
@@ -1144,8 +1144,8 @@ var require_serializer = __commonJS({
|
|
|
1144
1144
|
this.BINARY_ENCODING = 0;
|
|
1145
1145
|
this.JSON_ENCODING = 1;
|
|
1146
1146
|
this.BROADCAST_EVENT = "broadcast";
|
|
1147
|
-
this.allowedMetadataKeys =
|
|
1148
|
-
this.allowedMetadataKeys = allowedMetadataKeys !== null && allowedMetadataKeys !== void 0 ? allowedMetadataKeys :
|
|
1147
|
+
this.allowedMetadataKeys = _Serializer.DEFAULT_METADATA_KEYS;
|
|
1148
|
+
this.allowedMetadataKeys = allowedMetadataKeys !== null && allowedMetadataKeys !== void 0 ? allowedMetadataKeys : _Serializer.DEFAULT_METADATA_KEYS;
|
|
1149
1149
|
}
|
|
1150
1150
|
encode(msg, callback) {
|
|
1151
1151
|
if (msg.event === this.BROADCAST_EVENT && !(msg.payload instanceof ArrayBuffer) && typeof msg.payload.event === "string") {
|
|
@@ -1281,13 +1281,14 @@ var require_serializer = __commonJS({
|
|
|
1281
1281
|
return Object.fromEntries(Object.entries(obj2).filter(([key]) => keys.includes(key)));
|
|
1282
1282
|
}
|
|
1283
1283
|
};
|
|
1284
|
+
Serializer.DEFAULT_METADATA_KEYS = ["persist"];
|
|
1284
1285
|
exports2.default = Serializer;
|
|
1285
1286
|
}
|
|
1286
1287
|
});
|
|
1287
1288
|
|
|
1288
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1289
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
|
|
1289
1290
|
var require_transformers = __commonJS({
|
|
1290
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1291
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js"(exports2) {
|
|
1291
1292
|
"use strict";
|
|
1292
1293
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1293
1294
|
exports2.httpEndpointURL = exports2.toTimestampString = exports2.toArray = exports2.toJson = exports2.toNumber = exports2.toBoolean = exports2.convertCell = exports2.convertColumn = exports2.convertChangeData = exports2.PostgresTypes = void 0;
|
|
@@ -3316,9 +3317,9 @@ var require_phoenix_cjs = __commonJS({
|
|
|
3316
3317
|
}
|
|
3317
3318
|
});
|
|
3318
3319
|
|
|
3319
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3320
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
|
|
3320
3321
|
var require_presenceAdapter = __commonJS({
|
|
3321
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3322
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js"(exports2) {
|
|
3322
3323
|
"use strict";
|
|
3323
3324
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3324
3325
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -3416,9 +3417,9 @@ var require_presenceAdapter = __commonJS({
|
|
|
3416
3417
|
}
|
|
3417
3418
|
});
|
|
3418
3419
|
|
|
3419
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3420
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
|
|
3420
3421
|
var require_RealtimePresence = __commonJS({
|
|
3421
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3422
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js"(exports2) {
|
|
3422
3423
|
"use strict";
|
|
3423
3424
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3424
3425
|
exports2.REALTIME_PRESENCE_LISTEN_EVENTS = void 0;
|
|
@@ -3460,9 +3461,9 @@ var require_RealtimePresence = __commonJS({
|
|
|
3460
3461
|
}
|
|
3461
3462
|
});
|
|
3462
3463
|
|
|
3463
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3464
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
|
|
3464
3465
|
var require_normalizeChannelError = __commonJS({
|
|
3465
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3466
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js"(exports2) {
|
|
3466
3467
|
"use strict";
|
|
3467
3468
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3468
3469
|
exports2.normalizeChannelError = normalizeChannelError;
|
|
@@ -3486,9 +3487,9 @@ var require_normalizeChannelError = __commonJS({
|
|
|
3486
3487
|
}
|
|
3487
3488
|
});
|
|
3488
3489
|
|
|
3489
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3490
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
|
|
3490
3491
|
var require_channelAdapter = __commonJS({
|
|
3491
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3492
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js"(exports2) {
|
|
3492
3493
|
"use strict";
|
|
3493
3494
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3494
3495
|
var constants_1 = require_constants();
|
|
@@ -3593,9 +3594,9 @@ var require_channelAdapter = __commonJS({
|
|
|
3593
3594
|
}
|
|
3594
3595
|
});
|
|
3595
3596
|
|
|
3596
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3597
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js
|
|
3597
3598
|
var require_RealtimePostgresFilterBuilder = __commonJS({
|
|
3598
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3599
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimePostgresFilterBuilder.js"(exports2) {
|
|
3599
3600
|
"use strict";
|
|
3600
3601
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3601
3602
|
exports2.postgresChangesFilter = exports2.RealtimePostgresFilterBuilder = void 0;
|
|
@@ -3717,9 +3718,9 @@ var require_RealtimePostgresFilterBuilder = __commonJS({
|
|
|
3717
3718
|
}
|
|
3718
3719
|
});
|
|
3719
3720
|
|
|
3720
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3721
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
|
|
3721
3722
|
var require_RealtimeChannel = __commonJS({
|
|
3722
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
3723
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js"(exports2) {
|
|
3723
3724
|
"use strict";
|
|
3724
3725
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3725
3726
|
exports2.REALTIME_CHANNEL_STATES = exports2.REALTIME_SUBSCRIBE_STATES = exports2.REALTIME_LISTEN_TYPES = exports2.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports2.postgresChangesFilter = exports2.RealtimePostgresFilterBuilder = void 0;
|
|
@@ -4137,7 +4138,7 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4137
4138
|
*
|
|
4138
4139
|
* @param event The name of the broadcast event
|
|
4139
4140
|
* @param payload Payload to be sent (required)
|
|
4140
|
-
* @param opts Options including timeout
|
|
4141
|
+
* @param opts Options including timeout and persist
|
|
4141
4142
|
* @returns Promise resolving to object with success status, and error details if failed
|
|
4142
4143
|
*
|
|
4143
4144
|
* @category Realtime
|
|
@@ -4160,6 +4161,17 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4160
4161
|
if (this.private) {
|
|
4161
4162
|
url.searchParams.set("private", "true");
|
|
4162
4163
|
}
|
|
4164
|
+
if (opts.persist) {
|
|
4165
|
+
if (!this.private) {
|
|
4166
|
+
return Promise.reject(new Error("Realtime httpSend() cannot store a message on a public channel."));
|
|
4167
|
+
}
|
|
4168
|
+
const ttl = typeof opts.persist === "object" ? opts.persist.ttl : void 0;
|
|
4169
|
+
if (ttl === void 0) {
|
|
4170
|
+
url.searchParams.set("persist", "true");
|
|
4171
|
+
} else {
|
|
4172
|
+
url.searchParams.set("persist[ttl]", String(ttl));
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4163
4175
|
const options = {
|
|
4164
4176
|
method: "POST",
|
|
4165
4177
|
headers,
|
|
@@ -4187,6 +4199,7 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4187
4199
|
* @param args.type The type of event to send
|
|
4188
4200
|
* @param args.event The name of the event being sent
|
|
4189
4201
|
* @param args.payload Payload to be sent
|
|
4202
|
+
* @param args.persist Stores the broadcast for replay on a private channel
|
|
4190
4203
|
* @param opts Options to be used during the send process
|
|
4191
4204
|
*
|
|
4192
4205
|
* @category Realtime
|
|
@@ -4230,6 +4243,15 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4230
4243
|
*/
|
|
4231
4244
|
async send(args, opts = {}) {
|
|
4232
4245
|
var _a, _b;
|
|
4246
|
+
if (args.type === "broadcast" && args.persist && (!this.private || this.socket.vsn === constants_1.VSN_1_0_0)) {
|
|
4247
|
+
const persistError = this.private ? "Realtime send() cannot store a message with protocol 1.0.0. Use httpSend() or connect with vsn 2.0.0." : "Realtime send() cannot store a message on a public channel.";
|
|
4248
|
+
if (this.socket.hasLogger()) {
|
|
4249
|
+
this.socket.log("channel", persistError);
|
|
4250
|
+
} else {
|
|
4251
|
+
console.error(persistError);
|
|
4252
|
+
}
|
|
4253
|
+
return "error";
|
|
4254
|
+
}
|
|
4233
4255
|
if (!this.channelAdapter.canPush() && args.type === "broadcast") {
|
|
4234
4256
|
const fallbackWarning = "Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.";
|
|
4235
4257
|
if (this.socket.hasLogger()) {
|
|
@@ -4238,6 +4260,15 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4238
4260
|
console.warn(fallbackWarning);
|
|
4239
4261
|
}
|
|
4240
4262
|
const { event, payload: endpoint_payload } = args;
|
|
4263
|
+
if (args.persist) {
|
|
4264
|
+
const persistError = "Realtime send() fell back to REST and cannot store this message. The batch endpoint does not support persistence. Use httpSend() or send after the channel is connected and subscribed.";
|
|
4265
|
+
if (this.socket.hasLogger()) {
|
|
4266
|
+
this.socket.log("channel", persistError);
|
|
4267
|
+
} else {
|
|
4268
|
+
console.error(persistError);
|
|
4269
|
+
}
|
|
4270
|
+
return "error";
|
|
4271
|
+
}
|
|
4241
4272
|
const headers = {
|
|
4242
4273
|
apikey: this.socket.apiKey ? this.socket.apiKey : "",
|
|
4243
4274
|
"Content-Type": "application/json"
|
|
@@ -4278,7 +4309,7 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4278
4309
|
resolve("ok");
|
|
4279
4310
|
}
|
|
4280
4311
|
push.receive("ok", () => resolve("ok"));
|
|
4281
|
-
push.receive("error", () => resolve("error"));
|
|
4312
|
+
push.receive("error", (response) => resolve(args.persist && typeof (response === null || response === void 0 ? void 0 : response.error) === "string" ? response.error : "error"));
|
|
4282
4313
|
push.receive("timeout", () => resolve("timed out"));
|
|
4283
4314
|
});
|
|
4284
4315
|
}
|
|
@@ -4472,9 +4503,9 @@ var require_RealtimeChannel = __commonJS({
|
|
|
4472
4503
|
}
|
|
4473
4504
|
});
|
|
4474
4505
|
|
|
4475
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
4506
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
|
|
4476
4507
|
var require_socketAdapter = __commonJS({
|
|
4477
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
4508
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js"(exports2) {
|
|
4478
4509
|
"use strict";
|
|
4479
4510
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4480
4511
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -4593,9 +4624,9 @@ var require_socketAdapter = __commonJS({
|
|
|
4593
4624
|
}
|
|
4594
4625
|
});
|
|
4595
4626
|
|
|
4596
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
4627
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
|
|
4597
4628
|
var require_RealtimeClient = __commonJS({
|
|
4598
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
4629
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js"(exports2) {
|
|
4599
4630
|
"use strict";
|
|
4600
4631
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4601
4632
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -5242,7 +5273,7 @@ var require_RealtimeClient = __commonJS({
|
|
|
5242
5273
|
defaultDecode = this.serializer.decode.bind(this.serializer);
|
|
5243
5274
|
break;
|
|
5244
5275
|
default:
|
|
5245
|
-
throw new Error(`Unsupported serializer version: ${
|
|
5276
|
+
throw new Error(`Unsupported serializer version: ${vsn}`);
|
|
5246
5277
|
}
|
|
5247
5278
|
result.vsn = vsn;
|
|
5248
5279
|
result.encode = (_l = options === null || options === void 0 ? void 0 : options.encode) !== null && _l !== void 0 ? _l : defaultEncode;
|
|
@@ -5273,9 +5304,9 @@ var require_RealtimeClient = __commonJS({
|
|
|
5273
5304
|
}
|
|
5274
5305
|
});
|
|
5275
5306
|
|
|
5276
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5307
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/index.js
|
|
5277
5308
|
var require_main2 = __commonJS({
|
|
5278
|
-
"../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5309
|
+
"../../node_modules/.pnpm/@supabase+realtime-js@2.119.2/node_modules/@supabase/realtime-js/dist/main/index.js"(exports2) {
|
|
5279
5310
|
"use strict";
|
|
5280
5311
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5281
5312
|
exports2.WebSocketFactory = exports2.REALTIME_CHANNEL_STATES = exports2.REALTIME_SUBSCRIBE_STATES = exports2.REALTIME_PRESENCE_LISTEN_EVENTS = exports2.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports2.REALTIME_LISTEN_TYPES = exports2.postgresChangesFilter = exports2.RealtimePostgresFilterBuilder = exports2.RealtimeClient = exports2.RealtimeChannel = exports2.RealtimePresence = void 0;
|
|
@@ -5312,19 +5343,19 @@ var require_main2 = __commonJS({
|
|
|
5312
5343
|
}
|
|
5313
5344
|
});
|
|
5314
5345
|
|
|
5315
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5346
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/version.js
|
|
5316
5347
|
var require_version2 = __commonJS({
|
|
5317
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5348
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/version.js"(exports2) {
|
|
5318
5349
|
"use strict";
|
|
5319
5350
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5320
5351
|
exports2.version = void 0;
|
|
5321
|
-
exports2.version = "2.
|
|
5352
|
+
exports2.version = "2.119.2";
|
|
5322
5353
|
}
|
|
5323
5354
|
});
|
|
5324
5355
|
|
|
5325
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5356
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/constants.js
|
|
5326
5357
|
var require_constants2 = __commonJS({
|
|
5327
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5358
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/constants.js"(exports2) {
|
|
5328
5359
|
"use strict";
|
|
5329
5360
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5330
5361
|
exports2.JWKS_TTL = exports2.PKCE_MAX_CONCURRENT_FLOWS = exports2.PKCE_FLOW_ID_PARAM = exports2.BASE64URL_REGEX = exports2.API_VERSIONS = exports2.API_VERSION_HEADER_NAME = exports2.NETWORK_FAILURE = exports2.DEFAULT_HEADERS = exports2.AUDIENCE = exports2.STORAGE_KEY = exports2.GOTRUE_URL = exports2.REFRESH_FAILURE_COOLDOWN_MS = exports2.EXPIRY_MARGIN_MS = exports2.AUTO_REFRESH_TICK_THRESHOLD = exports2.AUTO_REFRESH_TICK_DURATION_MS = void 0;
|
|
@@ -5356,9 +5387,9 @@ var require_constants2 = __commonJS({
|
|
|
5356
5387
|
}
|
|
5357
5388
|
});
|
|
5358
5389
|
|
|
5359
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5390
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/errors.js
|
|
5360
5391
|
var require_errors = __commonJS({
|
|
5361
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5392
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/errors.js"(exports2) {
|
|
5362
5393
|
"use strict";
|
|
5363
5394
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5364
5395
|
exports2.AuthInvalidJwtError = exports2.AuthWeakPasswordError = exports2.AuthRefreshDiscardedError = exports2.AuthRetryableFetchError = exports2.AuthPKCECodeVerifierMissingError = exports2.AuthPKCEGrantCodeExchangeError = exports2.AuthImplicitGrantRedirectError = exports2.AuthInvalidCredentialsError = exports2.AuthInvalidTokenResponseError = exports2.AuthSessionMissingError = exports2.CustomAuthError = exports2.AuthUnknownError = exports2.AuthApiError = exports2.AuthError = void 0;
|
|
@@ -5514,9 +5545,9 @@ var require_errors = __commonJS({
|
|
|
5514
5545
|
}
|
|
5515
5546
|
});
|
|
5516
5547
|
|
|
5517
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5548
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
|
|
5518
5549
|
var require_base64url = __commonJS({
|
|
5519
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5550
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/base64url.js"(exports2) {
|
|
5520
5551
|
"use strict";
|
|
5521
5552
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5522
5553
|
exports2.byteToBase64URL = byteToBase64URL;
|
|
@@ -5704,9 +5735,9 @@ var require_base64url = __commonJS({
|
|
|
5704
5735
|
}
|
|
5705
5736
|
});
|
|
5706
5737
|
|
|
5707
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5738
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
|
|
5708
5739
|
var require_helpers = __commonJS({
|
|
5709
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
5740
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/helpers.js"(exports2) {
|
|
5710
5741
|
"use strict";
|
|
5711
5742
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
5712
5743
|
exports2.pkceVerifierSlotKey = exports2.Deferred = exports2.removeItemAsync = exports2.getItemAsync = exports2.setItemAsync = exports2.looksLikeFetchResponse = exports2.resolveFetch = exports2.supportsLocalStorage = exports2.isBrowser = void 0;
|
|
@@ -6120,9 +6151,9 @@ var require_helpers = __commonJS({
|
|
|
6120
6151
|
}
|
|
6121
6152
|
});
|
|
6122
6153
|
|
|
6123
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6154
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
|
|
6124
6155
|
var require_fetch = __commonJS({
|
|
6125
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6156
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/fetch.js"(exports2) {
|
|
6126
6157
|
"use strict";
|
|
6127
6158
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6128
6159
|
exports2.handleError = handleError2;
|
|
@@ -6307,9 +6338,9 @@ var require_fetch = __commonJS({
|
|
|
6307
6338
|
}
|
|
6308
6339
|
});
|
|
6309
6340
|
|
|
6310
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6341
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/types.js
|
|
6311
6342
|
var require_types2 = __commonJS({
|
|
6312
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6343
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/types.js"(exports2) {
|
|
6313
6344
|
"use strict";
|
|
6314
6345
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6315
6346
|
exports2.SIGN_OUT_SCOPES = void 0;
|
|
@@ -6317,9 +6348,9 @@ var require_types2 = __commonJS({
|
|
|
6317
6348
|
}
|
|
6318
6349
|
});
|
|
6319
6350
|
|
|
6320
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6351
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
|
|
6321
6352
|
var require_GoTrueAdminApi = __commonJS({
|
|
6322
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6353
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js"(exports2) {
|
|
6323
6354
|
"use strict";
|
|
6324
6355
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
6325
6356
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -7015,6 +7046,8 @@ var require_GoTrueAdminApi = __commonJS({
|
|
|
7015
7046
|
}
|
|
7016
7047
|
/**
|
|
7017
7048
|
* Delete a user. Requires a `service_role` key.
|
|
7049
|
+
* Returns the user that was deleted. In cases of concurrent updates, the user object returned
|
|
7050
|
+
* might not accurately reflect the user information at the time of deletion.
|
|
7018
7051
|
*
|
|
7019
7052
|
* @param id The user id you want to remove.
|
|
7020
7053
|
* @param shouldSoftDelete If true, then the user will be soft-deleted from the auth schema. Soft deletion allows user identification from the hashed user ID but is not reversible.
|
|
@@ -7039,7 +7072,14 @@ var require_GoTrueAdminApi = __commonJS({
|
|
|
7039
7072
|
* ```json
|
|
7040
7073
|
* {
|
|
7041
7074
|
* "data": {
|
|
7042
|
-
* "user": {
|
|
7075
|
+
* "user": {
|
|
7076
|
+
* "id": "715ed5db-f090-4b8c-a067-640ecee36aa0",
|
|
7077
|
+
* "aud": "authenticated",
|
|
7078
|
+
* "role": "authenticated",
|
|
7079
|
+
* "email": "example@email.com",
|
|
7080
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
7081
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
7082
|
+
* }
|
|
7043
7083
|
* },
|
|
7044
7084
|
* "error": null
|
|
7045
7085
|
* }
|
|
@@ -7048,13 +7088,18 @@ var require_GoTrueAdminApi = __commonJS({
|
|
|
7048
7088
|
async deleteUser(id, shouldSoftDelete = false) {
|
|
7049
7089
|
(0, helpers_1.validateUUID)(id);
|
|
7050
7090
|
try {
|
|
7051
|
-
|
|
7091
|
+
const { data, error } = await this.getUserById(id);
|
|
7092
|
+
if (error) {
|
|
7093
|
+
return { data: { user: null }, error };
|
|
7094
|
+
}
|
|
7095
|
+
await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/admin/users/${id}`, {
|
|
7052
7096
|
headers: this.headers,
|
|
7053
7097
|
body: {
|
|
7054
7098
|
should_soft_delete: shouldSoftDelete
|
|
7055
7099
|
},
|
|
7056
|
-
|
|
7100
|
+
noResolveJson: true
|
|
7057
7101
|
});
|
|
7102
|
+
return { data, error: null };
|
|
7058
7103
|
} catch (error) {
|
|
7059
7104
|
if ((0, errors_1.isAuthError)(error)) {
|
|
7060
7105
|
return { data: { user: null }, error };
|
|
@@ -7397,9 +7442,9 @@ var require_GoTrueAdminApi = __commonJS({
|
|
|
7397
7442
|
}
|
|
7398
7443
|
});
|
|
7399
7444
|
|
|
7400
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7445
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
|
|
7401
7446
|
var require_local_storage = __commonJS({
|
|
7402
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7447
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js"(exports2) {
|
|
7403
7448
|
"use strict";
|
|
7404
7449
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7405
7450
|
exports2.memoryLocalStorageAdapter = memoryLocalStorageAdapter;
|
|
@@ -7419,9 +7464,9 @@ var require_local_storage = __commonJS({
|
|
|
7419
7464
|
}
|
|
7420
7465
|
});
|
|
7421
7466
|
|
|
7422
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7467
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/locks.js
|
|
7423
7468
|
var require_locks = __commonJS({
|
|
7424
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7469
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/locks.js"(exports2) {
|
|
7425
7470
|
"use strict";
|
|
7426
7471
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7427
7472
|
exports2.ProcessLockAcquireTimeoutError = exports2.NavigatorLockAcquireTimeoutError = exports2.LockAcquireTimeoutError = exports2.internals = void 0;
|
|
@@ -7595,9 +7640,9 @@ var require_locks = __commonJS({
|
|
|
7595
7640
|
}
|
|
7596
7641
|
});
|
|
7597
7642
|
|
|
7598
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7643
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
|
|
7599
7644
|
var require_polyfills = __commonJS({
|
|
7600
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7645
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js"(exports2) {
|
|
7601
7646
|
"use strict";
|
|
7602
7647
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7603
7648
|
exports2.polyfillGlobalThis = polyfillGlobalThis;
|
|
@@ -7622,9 +7667,9 @@ var require_polyfills = __commonJS({
|
|
|
7622
7667
|
}
|
|
7623
7668
|
});
|
|
7624
7669
|
|
|
7625
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7670
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
|
|
7626
7671
|
var require_ethereum = __commonJS({
|
|
7627
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7672
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js"(exports2) {
|
|
7628
7673
|
"use strict";
|
|
7629
7674
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7630
7675
|
exports2.getAddress = getAddress;
|
|
@@ -7700,9 +7745,9 @@ ${suffix}`;
|
|
|
7700
7745
|
}
|
|
7701
7746
|
});
|
|
7702
7747
|
|
|
7703
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7748
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
|
|
7704
7749
|
var require_webauthn_errors = __commonJS({
|
|
7705
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7750
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js"(exports2) {
|
|
7706
7751
|
"use strict";
|
|
7707
7752
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7708
7753
|
exports2.WebAuthnUnknownError = exports2.WebAuthnError = void 0;
|
|
@@ -7891,9 +7936,9 @@ var require_webauthn_errors = __commonJS({
|
|
|
7891
7936
|
}
|
|
7892
7937
|
});
|
|
7893
7938
|
|
|
7894
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7939
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
|
|
7895
7940
|
var require_webauthn = __commonJS({
|
|
7896
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7941
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js"(exports2) {
|
|
7897
7942
|
"use strict";
|
|
7898
7943
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
7899
7944
|
exports2.WebAuthnApi = exports2.DEFAULT_REQUEST_OPTIONS = exports2.DEFAULT_CREATION_OPTIONS = exports2.webAuthnAbortService = exports2.WebAuthnAbortService = exports2.identifyAuthenticationError = exports2.identifyRegistrationError = exports2.isWebAuthnError = exports2.WebAuthnError = void 0;
|
|
@@ -8450,9 +8495,9 @@ var require_webauthn = __commonJS({
|
|
|
8450
8495
|
}
|
|
8451
8496
|
});
|
|
8452
8497
|
|
|
8453
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
8498
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
|
|
8454
8499
|
var require_GoTrueClient = __commonJS({
|
|
8455
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
8500
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js"(exports2) {
|
|
8456
8501
|
"use strict";
|
|
8457
8502
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
8458
8503
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -9136,7 +9181,7 @@ var require_GoTrueClient = __commonJS({
|
|
|
9136
9181
|
* Be aware that you may get back an error message that will not distinguish
|
|
9137
9182
|
* between the cases where the account does not exist or that the
|
|
9138
9183
|
* email/phone and password combination is wrong or that the account can only
|
|
9139
|
-
* be accessed via social
|
|
9184
|
+
* be accessed via social sign-in.
|
|
9140
9185
|
*
|
|
9141
9186
|
* @category Auth
|
|
9142
9187
|
*
|
|
@@ -9319,7 +9364,7 @@ var require_GoTrueClient = __commonJS({
|
|
|
9319
9364
|
* @category Auth
|
|
9320
9365
|
*
|
|
9321
9366
|
* @remarks
|
|
9322
|
-
* - This method is used for signing in using [
|
|
9367
|
+
* - This method is used for signing in using [social sign-in (OAuth) providers](/docs/guides/auth/social-sign-in).
|
|
9323
9368
|
* - It works by redirecting your application to the provider's authorization screen, before bringing back the user to your app.
|
|
9324
9369
|
*
|
|
9325
9370
|
* @example Sign in using a third-party provider
|
|
@@ -10051,7 +10096,7 @@ var require_GoTrueClient = __commonJS({
|
|
|
10051
10096
|
*
|
|
10052
10097
|
* Be aware that you may get back an error message that will not distinguish
|
|
10053
10098
|
* between the cases where the account does not exist or, that the account
|
|
10054
|
-
* can only be accessed via social
|
|
10099
|
+
* can only be accessed via social sign-in.
|
|
10055
10100
|
*
|
|
10056
10101
|
* Do note that you will need to configure a Whatsapp sender on Twilio
|
|
10057
10102
|
* if you are using phone sign in with the 'whatsapp' channel. The whatsapp
|
|
@@ -11566,12 +11611,31 @@ var require_GoTrueClient = __commonJS({
|
|
|
11566
11611
|
return !!currentStorageContent;
|
|
11567
11612
|
}
|
|
11568
11613
|
/**
|
|
11569
|
-
* Inside a browser context, `signOut()` will remove the logged in user from the browser session
|
|
11614
|
+
* Inside a browser context, `signOut()` will remove the logged in user from the browser session
|
|
11615
|
+
* and log them out - removing all items from localstorage and then trigger a `"SIGNED_OUT"`
|
|
11616
|
+
* event.
|
|
11617
|
+
*
|
|
11618
|
+
* For server-side management, you can revoke all refresh tokens for a user by passing a user's
|
|
11619
|
+
* JWT through to `auth.api.signOut(JWT: string)`.
|
|
11620
|
+
*
|
|
11621
|
+
* There is no way to revoke a user's access token jwt until it expires. It is recommended to set
|
|
11622
|
+
* a shorter expiry on the jwt for this reason.
|
|
11570
11623
|
*
|
|
11571
|
-
*
|
|
11572
|
-
* There is no way to revoke a user's access token jwt until it expires. It is recommended to set a shorter expiry on the jwt for this reason.
|
|
11624
|
+
* `signOut` behavior depends on the selected scope:
|
|
11573
11625
|
*
|
|
11574
|
-
*
|
|
11626
|
+
* - `local`: The local session is removed first and a `SIGNED_OUT` event is fired, then the client
|
|
11627
|
+
* makes a best-effort request to revoke the refresh token on the server. If the request fails,
|
|
11628
|
+
* the client is still signed out locally and the error is returned, but the server may retain
|
|
11629
|
+
* the refresh token until it expires.
|
|
11630
|
+
*
|
|
11631
|
+
* - `global`: All of the user's sessions are first invalidated on the server. Once the server
|
|
11632
|
+
* acknowledges the request, the local session is cleared. If server logout fails, the local
|
|
11633
|
+
* session is retained, no `SIGNED_OUT` event is triggered, and the server or network error is
|
|
11634
|
+
* returned. A 401, 403, or 404 response counts as a successful sign-out.
|
|
11635
|
+
*
|
|
11636
|
+
* - `others`: All other sessions are invalidated when the server accepts the request; the
|
|
11637
|
+
* current local session remains unchanged. In case of server or network failures, the error is
|
|
11638
|
+
* returned. A `SIGNED_OUT` event is never triggered, regardless of the outcome.
|
|
11575
11639
|
*
|
|
11576
11640
|
* **Warning:** the default `scope` is `'global'`. This signs the user out of
|
|
11577
11641
|
* **every device they are currently signed in on**, not just the current
|
|
@@ -11589,7 +11653,13 @@ var require_GoTrueClient = __commonJS({
|
|
|
11589
11653
|
* usually what apps want on a "Sign out" button, especially when users
|
|
11590
11654
|
* sign in from multiple devices and do not expect signing out of one to
|
|
11591
11655
|
* terminate the others.
|
|
11592
|
-
* -
|
|
11656
|
+
* - With the default `global` scope, `signOut()` while offline returns an error and keeps the user
|
|
11657
|
+
* signed in. To sign out regardless, fall back to `signOut({ scope: 'local' })` when the call
|
|
11658
|
+
* returns an error.
|
|
11659
|
+
* - Since Supabase Auth uses JWTs for authentication, the access token JWT will be valid until
|
|
11660
|
+
* it's expired. When the user signs out, Supabase revokes the refresh token and deletes the
|
|
11661
|
+
* JWT from the client-side. This does not revoke the JWT and it will still be valid until it
|
|
11662
|
+
* expires.
|
|
11593
11663
|
*
|
|
11594
11664
|
* @example Sign out of every device (global – default)
|
|
11595
11665
|
* ```js
|
|
@@ -11615,7 +11685,7 @@ var require_GoTrueClient = __commonJS({
|
|
|
11615
11685
|
}
|
|
11616
11686
|
return await this._signOut(options);
|
|
11617
11687
|
}
|
|
11618
|
-
async _signOut({ scope
|
|
11688
|
+
async _signOut({ scope = "global" } = {}) {
|
|
11619
11689
|
return await this._useSession(async (result) => {
|
|
11620
11690
|
var _a;
|
|
11621
11691
|
const removeCurrentSession = async () => {
|
|
@@ -11623,24 +11693,36 @@ var require_GoTrueClient = __commonJS({
|
|
|
11623
11693
|
};
|
|
11624
11694
|
const { data, error: sessionError } = result;
|
|
11625
11695
|
if (sessionError && !(0, errors_1.isAuthSessionMissingError)(sessionError)) {
|
|
11696
|
+
if (scope === "local" && (0, errors_1.isAuthRetryableFetchError)(sessionError)) {
|
|
11697
|
+
await removeCurrentSession();
|
|
11698
|
+
}
|
|
11626
11699
|
return this._returnResult({ error: sessionError });
|
|
11627
11700
|
}
|
|
11628
11701
|
const accessToken = (_a = data.session) === null || _a === void 0 ? void 0 : _a.access_token;
|
|
11702
|
+
let removeError = null;
|
|
11703
|
+
const finish = (value) => {
|
|
11704
|
+
if (removeError) {
|
|
11705
|
+
throw removeError.thrown;
|
|
11706
|
+
}
|
|
11707
|
+
return value;
|
|
11708
|
+
};
|
|
11709
|
+
if (scope === "local") {
|
|
11710
|
+
try {
|
|
11711
|
+
await removeCurrentSession();
|
|
11712
|
+
} catch (thrown) {
|
|
11713
|
+
removeError = { thrown };
|
|
11714
|
+
}
|
|
11715
|
+
}
|
|
11629
11716
|
if (accessToken) {
|
|
11630
11717
|
const { error } = await this.admin.signOut(accessToken, scope);
|
|
11631
|
-
if (error) {
|
|
11632
|
-
|
|
11633
|
-
if (scope !== "others") {
|
|
11634
|
-
await removeCurrentSession();
|
|
11635
|
-
}
|
|
11636
|
-
return this._returnResult({ error });
|
|
11637
|
-
}
|
|
11718
|
+
if (error && !((0, errors_1.isAuthApiError)(error) && (error.status === 404 || error.status === 401 || error.status === 403) || (0, errors_1.isAuthSessionMissingError)(error))) {
|
|
11719
|
+
return finish(this._returnResult({ error }));
|
|
11638
11720
|
}
|
|
11639
11721
|
}
|
|
11640
|
-
if (scope
|
|
11722
|
+
if (scope === "global") {
|
|
11641
11723
|
await removeCurrentSession();
|
|
11642
11724
|
}
|
|
11643
|
-
return this._returnResult({ error: null });
|
|
11725
|
+
return finish(this._returnResult({ error: null }));
|
|
11644
11726
|
});
|
|
11645
11727
|
}
|
|
11646
11728
|
/** *
|
|
@@ -11728,9 +11810,9 @@ var require_GoTrueClient = __commonJS({
|
|
|
11728
11810
|
* ```
|
|
11729
11811
|
*
|
|
11730
11812
|
* @exampleDescription Store OAuth provider tokens on sign in
|
|
11731
|
-
* When using [OAuth (
|
|
11813
|
+
* When using [OAuth (social sign-in)](/docs/guides/auth/social-sign-in) you sometimes wish to get access to the provider's access token and refresh token, in order to call provider APIs in the name of the user.
|
|
11732
11814
|
*
|
|
11733
|
-
* For example, if you are using [Sign in with Google](/docs/guides/auth/social-
|
|
11815
|
+
* For example, if you are using [Sign in with Google](/docs/guides/auth/social-sign-in/auth-google) you may want to use the provider token to call Google APIs on behalf of the user. Supabase Auth does not keep track of the provider access and refresh token, but does return them for you once, immediately after sign in. You can use the `onAuthStateChange` method to listen for the presence of the provider tokens and store them in local storage. You can further send them to your server's APIs for use on the backend.
|
|
11734
11816
|
*
|
|
11735
11817
|
* Finally, make sure you remove them from local storage on the `SIGNED_OUT` event. If the OAuth provider supports token revocation, make sure you call those APIs either from the frontend or schedule them to be called on the backend.
|
|
11736
11818
|
*
|
|
@@ -13849,9 +13931,9 @@ var require_GoTrueClient = __commonJS({
|
|
|
13849
13931
|
}
|
|
13850
13932
|
});
|
|
13851
13933
|
|
|
13852
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13934
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
|
|
13853
13935
|
var require_AuthAdminApi = __commonJS({
|
|
13854
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13936
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js"(exports2) {
|
|
13855
13937
|
"use strict";
|
|
13856
13938
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13857
13939
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -13861,9 +13943,9 @@ var require_AuthAdminApi = __commonJS({
|
|
|
13861
13943
|
}
|
|
13862
13944
|
});
|
|
13863
13945
|
|
|
13864
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13946
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/AuthClient.js
|
|
13865
13947
|
var require_AuthClient = __commonJS({
|
|
13866
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13948
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/AuthClient.js"(exports2) {
|
|
13867
13949
|
"use strict";
|
|
13868
13950
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13869
13951
|
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
@@ -13873,9 +13955,9 @@ var require_AuthClient = __commonJS({
|
|
|
13873
13955
|
}
|
|
13874
13956
|
});
|
|
13875
13957
|
|
|
13876
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13958
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/index.js
|
|
13877
13959
|
var require_main3 = __commonJS({
|
|
13878
|
-
"../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13960
|
+
"../../node_modules/.pnpm/@supabase+auth-js@2.119.2/node_modules/@supabase/auth-js/dist/main/index.js"(exports2) {
|
|
13879
13961
|
"use strict";
|
|
13880
13962
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13881
13963
|
exports2.processLock = exports2.lockInternals = exports2.NavigatorLockAcquireTimeoutError = exports2.navigatorLock = exports2.AuthClient = exports2.AuthAdminApi = exports2.GoTrueClient = exports2.GoTrueAdminApi = void 0;
|
|
@@ -33550,7 +33632,7 @@ var import_promises8 = require("node:readline/promises");
|
|
|
33550
33632
|
var import_promises9 = require("node:fs/promises");
|
|
33551
33633
|
var import_node_os10 = require("node:os");
|
|
33552
33634
|
|
|
33553
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
33635
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.119.2_@opentelemetry+api@1.10.0/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
33554
33636
|
var dist_exports = {};
|
|
33555
33637
|
__export(dist_exports, {
|
|
33556
33638
|
FunctionRegion: () => import_functions_js.FunctionRegion,
|
|
@@ -33564,16 +33646,16 @@ __export(dist_exports, {
|
|
|
33564
33646
|
createClient: () => createClient
|
|
33565
33647
|
});
|
|
33566
33648
|
|
|
33567
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
33649
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.119.2_@opentelemetry+api@1.10.0/node_modules/@supabase/supabase-js/dist/tracingRegistry.mjs
|
|
33568
33650
|
var EXTRACTOR_KEY = /* @__PURE__ */ Symbol.for("@supabase/supabase-js.traceContextExtractor");
|
|
33569
33651
|
function getTraceContextExtractor() {
|
|
33570
33652
|
return globalThis[EXTRACTOR_KEY];
|
|
33571
33653
|
}
|
|
33572
33654
|
|
|
33573
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
33655
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.119.2_@opentelemetry+api@1.10.0/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
33574
33656
|
var import_functions_js = __toESM(require_main(), 1);
|
|
33575
33657
|
|
|
33576
|
-
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.
|
|
33658
|
+
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.119.2/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
33577
33659
|
var PostgrestError = class extends Error {
|
|
33578
33660
|
/**
|
|
33579
33661
|
* @example
|
|
@@ -37106,6 +37188,30 @@ function toTransportFailure(cause, status, statusText) {
|
|
|
37106
37188
|
statusText
|
|
37107
37189
|
};
|
|
37108
37190
|
}
|
|
37191
|
+
function withTimeout(fetch$1, timeout) {
|
|
37192
|
+
if (timeout === void 0 || timeout <= 0) return fetch$1;
|
|
37193
|
+
return (input, init) => {
|
|
37194
|
+
const controller = new AbortController();
|
|
37195
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
37196
|
+
const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
|
|
37197
|
+
if (existingSignal) {
|
|
37198
|
+
if (existingSignal.aborted) {
|
|
37199
|
+
clearTimeout(timeoutId);
|
|
37200
|
+
return fetch$1(input, init);
|
|
37201
|
+
}
|
|
37202
|
+
const abortHandler = () => {
|
|
37203
|
+
clearTimeout(timeoutId);
|
|
37204
|
+
controller.abort();
|
|
37205
|
+
};
|
|
37206
|
+
existingSignal.addEventListener("abort", abortHandler, { once: true });
|
|
37207
|
+
return fetch$1(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
|
|
37208
|
+
clearTimeout(timeoutId);
|
|
37209
|
+
existingSignal.removeEventListener("abort", abortHandler);
|
|
37210
|
+
});
|
|
37211
|
+
}
|
|
37212
|
+
return fetch$1(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
|
|
37213
|
+
};
|
|
37214
|
+
}
|
|
37109
37215
|
var PostgrestClient = class PostgrestClient2 {
|
|
37110
37216
|
/**
|
|
37111
37217
|
* Creates a PostgREST client.
|
|
@@ -37121,6 +37227,10 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
37121
37227
|
* When enabled, idempotent requests (GET, HEAD, OPTIONS) that fail with network
|
|
37122
37228
|
* errors or HTTP 503/520 responses will be automatically retried up to 3 times
|
|
37123
37229
|
* with exponential backoff (1s, 2s, 4s). Defaults to `true`.
|
|
37230
|
+
* @param options.wrapFetch - Wraps every fetch this client uses, including a per-request
|
|
37231
|
+
* `fetch` passed to `from()`, and is carried over to clients returned by `schema()`.
|
|
37232
|
+
* Use it for headers or instrumentation that must reach every request regardless of
|
|
37233
|
+
* which fetch performs it.
|
|
37124
37234
|
* @example Using supabase-js (recommended)
|
|
37125
37235
|
* ```ts
|
|
37126
37236
|
* import { createClient } from '@supabase/supabase-js'
|
|
@@ -37146,44 +37256,35 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
37146
37256
|
* })
|
|
37147
37257
|
* ```
|
|
37148
37258
|
*/
|
|
37149
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3, retry } = {}) {
|
|
37259
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3, retry, wrapFetch } = {}) {
|
|
37150
37260
|
this.url = url;
|
|
37151
37261
|
this.headers = new Headers(headers);
|
|
37152
37262
|
this.schemaName = schema;
|
|
37153
37263
|
this.urlLengthLimit = urlLengthLimit;
|
|
37154
|
-
|
|
37155
|
-
|
|
37156
|
-
|
|
37157
|
-
|
|
37158
|
-
const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
|
|
37159
|
-
if (existingSignal) {
|
|
37160
|
-
if (existingSignal.aborted) {
|
|
37161
|
-
clearTimeout(timeoutId);
|
|
37162
|
-
return originalFetch(input, init);
|
|
37163
|
-
}
|
|
37164
|
-
const abortHandler = () => {
|
|
37165
|
-
clearTimeout(timeoutId);
|
|
37166
|
-
controller.abort();
|
|
37167
|
-
};
|
|
37168
|
-
existingSignal.addEventListener("abort", abortHandler, { once: true });
|
|
37169
|
-
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
|
|
37170
|
-
clearTimeout(timeoutId);
|
|
37171
|
-
existingSignal.removeEventListener("abort", abortHandler);
|
|
37172
|
-
});
|
|
37173
|
-
}
|
|
37174
|
-
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
|
|
37175
|
-
};
|
|
37176
|
-
else this.fetch = originalFetch;
|
|
37264
|
+
this.timeout = timeout;
|
|
37265
|
+
this.wrapFetch = wrapFetch;
|
|
37266
|
+
this.baseFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
|
|
37267
|
+
this.fetch = this.baseFetch ? this.decorateFetch(this.baseFetch) : void 0;
|
|
37177
37268
|
this.retry = retry;
|
|
37178
37269
|
}
|
|
37179
|
-
|
|
37270
|
+
/**
|
|
37271
|
+
* Applies the client's decorations to a fetch implementation: `wrapFetch`
|
|
37272
|
+
* first, then the timeout guard, so the timeout bounds the whole wrapped call.
|
|
37273
|
+
* The client-level fetch and every per-request `fetch` passed to `from()` go
|
|
37274
|
+
* through this.
|
|
37275
|
+
*/
|
|
37276
|
+
decorateFetch(fetch$1) {
|
|
37277
|
+
return withTimeout(this.wrapFetch ? this.wrapFetch(fetch$1) : fetch$1, this.timeout);
|
|
37278
|
+
}
|
|
37279
|
+
from(relation, options) {
|
|
37280
|
+
var _options$urlLengthLim, _options$retry;
|
|
37180
37281
|
if (!relation || typeof relation !== "string" || relation.trim() === "") throw new Error("Invalid relation name: relation must be a non-empty string.");
|
|
37181
37282
|
return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
|
|
37182
37283
|
headers: new Headers(this.headers),
|
|
37183
37284
|
schema: this.schemaName,
|
|
37184
|
-
fetch: this.fetch,
|
|
37185
|
-
urlLengthLimit: this.urlLengthLimit,
|
|
37186
|
-
retry: this.retry
|
|
37285
|
+
fetch: (options === null || options === void 0 ? void 0 : options.fetch) ? this.decorateFetch(options.fetch) : this.fetch,
|
|
37286
|
+
urlLengthLimit: (_options$urlLengthLim = options === null || options === void 0 ? void 0 : options.urlLengthLimit) !== null && _options$urlLengthLim !== void 0 ? _options$urlLengthLim : this.urlLengthLimit,
|
|
37287
|
+
retry: (_options$retry = options === null || options === void 0 ? void 0 : options.retry) !== null && _options$retry !== void 0 ? _options$retry : this.retry
|
|
37187
37288
|
});
|
|
37188
37289
|
}
|
|
37189
37290
|
/**
|
|
@@ -37199,7 +37300,9 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
37199
37300
|
return new PostgrestClient2(this.url, {
|
|
37200
37301
|
headers: this.headers,
|
|
37201
37302
|
schema,
|
|
37202
|
-
fetch: this.
|
|
37303
|
+
fetch: this.baseFetch,
|
|
37304
|
+
timeout: this.timeout,
|
|
37305
|
+
wrapFetch: this.wrapFetch,
|
|
37203
37306
|
urlLengthLimit: this.urlLengthLimit,
|
|
37204
37307
|
retry: this.retry
|
|
37205
37308
|
});
|
|
@@ -37472,7 +37575,7 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
37472
37575
|
}
|
|
37473
37576
|
};
|
|
37474
37577
|
|
|
37475
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
37578
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.119.2_@opentelemetry+api@1.10.0/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
37476
37579
|
var import_realtime_js = __toESM(require_main2(), 1);
|
|
37477
37580
|
|
|
37478
37581
|
// ../../node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
|
|
@@ -38008,7 +38111,7 @@ var IcebergRestCatalog = class {
|
|
|
38008
38111
|
}
|
|
38009
38112
|
};
|
|
38010
38113
|
|
|
38011
|
-
// ../../node_modules/.pnpm/@supabase+storage-js@2.
|
|
38114
|
+
// ../../node_modules/.pnpm/@supabase+storage-js@2.119.2/node_modules/@supabase/storage-js/dist/index.mjs
|
|
38012
38115
|
function _typeof2(o) {
|
|
38013
38116
|
"@babel/helpers - typeof";
|
|
38014
38117
|
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -38380,6 +38483,12 @@ var BlobDownloadBuilder = class {
|
|
|
38380
38483
|
}
|
|
38381
38484
|
}
|
|
38382
38485
|
};
|
|
38486
|
+
function validateStorageUrl(input, expected) {
|
|
38487
|
+
const url = new URL(input);
|
|
38488
|
+
const prefix = expected.pathname.endsWith("/") ? expected.pathname : `${expected.pathname}/`;
|
|
38489
|
+
if (url.origin !== expected.origin || !url.pathname.startsWith(prefix)) throw new StorageError("Object path escapes the intended bucket endpoint");
|
|
38490
|
+
return url.href;
|
|
38491
|
+
}
|
|
38383
38492
|
var DEFAULT_SEARCH_OPTIONS = {
|
|
38384
38493
|
limit: 100,
|
|
38385
38494
|
offset: 0,
|
|
@@ -38393,6 +38502,10 @@ var DEFAULT_FILE_OPTIONS = {
|
|
|
38393
38502
|
contentType: "text/plain;charset=UTF-8",
|
|
38394
38503
|
upsert: false
|
|
38395
38504
|
};
|
|
38505
|
+
function mergeFileOptions(fileOptions) {
|
|
38506
|
+
const definedOptions = Object.fromEntries(Object.entries(fileOptions !== null && fileOptions !== void 0 ? fileOptions : {}).filter(([, value]) => value !== void 0));
|
|
38507
|
+
return _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), definedOptions);
|
|
38508
|
+
}
|
|
38396
38509
|
var StorageFileApi = class extends BaseApiClient {
|
|
38397
38510
|
constructor(url, headers = {}, bucketId, fetch$1) {
|
|
38398
38511
|
super(url, headers, fetch$1, "storage");
|
|
@@ -38409,7 +38522,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38409
38522
|
var _this = this;
|
|
38410
38523
|
return _this.handleOperation(async () => {
|
|
38411
38524
|
let body;
|
|
38412
|
-
const options =
|
|
38525
|
+
const options = mergeFileOptions(fileOptions);
|
|
38413
38526
|
let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
|
|
38414
38527
|
const metadata = options.metadata;
|
|
38415
38528
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob || typeof FormData !== "undefined" && fileBody instanceof FormData) body = _this.prepareUploadFormData(fileBody, options);
|
|
@@ -38423,8 +38536,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38423
38536
|
}
|
|
38424
38537
|
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
38425
38538
|
const cleanPath = _this._removeEmptyFolders(path);
|
|
38426
|
-
const
|
|
38427
|
-
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
|
|
38539
|
+
const data = await (method == "PUT" ? put : post)(_this.fetch, _this._getRequestUrl("object", cleanPath), body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
|
|
38428
38540
|
return {
|
|
38429
38541
|
path: cleanPath,
|
|
38430
38542
|
id: data.Id,
|
|
@@ -38543,12 +38655,11 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38543
38655
|
async uploadToSignedUrl(path, token, fileBody, fileOptions) {
|
|
38544
38656
|
var _this3 = this;
|
|
38545
38657
|
const cleanPath = _this3._removeEmptyFolders(path);
|
|
38546
|
-
const _path = _this3._getFinalPath(cleanPath);
|
|
38547
|
-
const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
|
|
38548
|
-
url.searchParams.set("token", token);
|
|
38549
38658
|
return _this3.handleOperation(async () => {
|
|
38659
|
+
const url = new URL(_this3._getRequestUrl("object/upload/sign", cleanPath));
|
|
38660
|
+
url.searchParams.set("token", token);
|
|
38550
38661
|
let body;
|
|
38551
|
-
const options =
|
|
38662
|
+
const options = mergeFileOptions(fileOptions);
|
|
38552
38663
|
let headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
38553
38664
|
const metadata = options.metadata;
|
|
38554
38665
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob || typeof FormData !== "undefined" && fileBody instanceof FormData) body = _this3.prepareUploadFormData(fileBody, options);
|
|
@@ -38607,10 +38718,9 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38607
38718
|
async createSignedUploadUrl(path, options) {
|
|
38608
38719
|
var _this4 = this;
|
|
38609
38720
|
return _this4.handleOperation(async () => {
|
|
38610
|
-
let _path = _this4._getFinalPath(path);
|
|
38611
38721
|
const headers = _objectSpread22({}, _this4.headers);
|
|
38612
38722
|
if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
|
|
38613
|
-
const data = await post(_this4.fetch,
|
|
38723
|
+
const data = await post(_this4.fetch, _this4._getRequestUrl("object/upload/sign", path), {}, { headers });
|
|
38614
38724
|
const url = new URL(_this4.url + data.url);
|
|
38615
38725
|
const token = url.searchParams.get("token");
|
|
38616
38726
|
if (!token) throw new StorageError("No token returned by API");
|
|
@@ -38853,9 +38963,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38853
38963
|
async createSignedUrl(path, expiresIn, options) {
|
|
38854
38964
|
var _this8 = this;
|
|
38855
38965
|
return _this8.handleOperation(async () => {
|
|
38856
|
-
let _path = _this8._getFinalPath(path);
|
|
38857
38966
|
const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
|
|
38858
|
-
let data = await post(_this8.fetch,
|
|
38967
|
+
let data = await post(_this8.fetch, _this8._getRequestUrl("object/sign", path), _objectSpread22(_objectSpread22({ expiresIn }, hasTransform ? { transform: options.transform } : {}), (options === null || options === void 0 ? void 0 : options.versionId) != null ? { versionId: options.versionId } : {}), { headers: _this8.headers });
|
|
38859
38968
|
const query = new URLSearchParams();
|
|
38860
38969
|
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
38861
38970
|
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
@@ -38995,8 +39104,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
38995
39104
|
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
38996
39105
|
if ((options === null || options === void 0 ? void 0 : options.versionId) != null) query.set("versionId", String(options.versionId));
|
|
38997
39106
|
const queryString = query.toString();
|
|
38998
|
-
const
|
|
38999
|
-
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
|
|
39107
|
+
const downloadFn = () => get(this.fetch, this._getRequestUrl(renderPath, path, { queryString }), {
|
|
39000
39108
|
headers: this.headers,
|
|
39001
39109
|
noResolveJson: true
|
|
39002
39110
|
}, parameters);
|
|
@@ -39029,17 +39137,24 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
39029
39137
|
*/
|
|
39030
39138
|
async info(path, options) {
|
|
39031
39139
|
var _this10 = this;
|
|
39032
|
-
const _path = _this10._getFinalPath(path);
|
|
39033
39140
|
const query = new URLSearchParams();
|
|
39034
39141
|
if ((options === null || options === void 0 ? void 0 : options.versionId) != null) query.set("versionId", String(options.versionId));
|
|
39035
39142
|
const queryString = query.toString();
|
|
39036
39143
|
return _this10.handleOperation(async () => {
|
|
39037
|
-
return recursiveToCamel(await get(_this10.fetch,
|
|
39144
|
+
return recursiveToCamel(await get(_this10.fetch, _this10._getRequestUrl("object/info", path, { queryString }), { headers: _this10.headers }));
|
|
39038
39145
|
});
|
|
39039
39146
|
}
|
|
39040
39147
|
/**
|
|
39041
39148
|
* Checks the existence of a file.
|
|
39042
39149
|
*
|
|
39150
|
+
* This reads the object's metadata, so the result is `false` only when Storage reports that the
|
|
39151
|
+
* key does not exist: an error with code `NoSuchKey`, or an HTTP 404 with no error code. In that
|
|
39152
|
+
* case `data` is `false` and `error` holds the original error.
|
|
39153
|
+
*
|
|
39154
|
+
* Every other failure throws instead of returning `false`, including an invalid or expired JWT
|
|
39155
|
+
* (`InvalidJWT`), a missing bucket (`NoSuchBucket`) and network errors. With `throwOnError()`,
|
|
39156
|
+
* a missing key throws as well.
|
|
39157
|
+
*
|
|
39043
39158
|
* @category Storage
|
|
39044
39159
|
* @subcategory File Buckets
|
|
39045
39160
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
@@ -39054,26 +39169,16 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
39054
39169
|
* ```
|
|
39055
39170
|
*/
|
|
39056
39171
|
async exists(path) {
|
|
39057
|
-
|
|
39058
|
-
|
|
39059
|
-
|
|
39060
|
-
|
|
39061
|
-
|
|
39062
|
-
|
|
39063
|
-
|
|
39064
|
-
|
|
39065
|
-
}
|
|
39066
|
-
|
|
39067
|
-
if (isStorageError(error)) {
|
|
39068
|
-
var _error$originalError;
|
|
39069
|
-
const status = error instanceof StorageApiError ? error.status : error instanceof StorageUnknownError ? (_error$originalError = error.originalError) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status : void 0;
|
|
39070
|
-
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
39071
|
-
data: false,
|
|
39072
|
-
error
|
|
39073
|
-
};
|
|
39074
|
-
}
|
|
39075
|
-
throw error;
|
|
39076
|
-
}
|
|
39172
|
+
const { error } = await this.info(path);
|
|
39173
|
+
if (!error) return {
|
|
39174
|
+
data: true,
|
|
39175
|
+
error: null
|
|
39176
|
+
};
|
|
39177
|
+
if (error instanceof StorageApiError && (error.code === "NoSuchKey" || error.status === 404 && error.code === void 0)) return {
|
|
39178
|
+
data: false,
|
|
39179
|
+
error
|
|
39180
|
+
};
|
|
39181
|
+
throw error;
|
|
39077
39182
|
}
|
|
39078
39183
|
/**
|
|
39079
39184
|
* A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
|
|
@@ -39239,11 +39344,13 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
39239
39344
|
async purgeCache(path, options, parameters) {
|
|
39240
39345
|
var _this13 = this;
|
|
39241
39346
|
return _this13.handleOperation(async () => {
|
|
39242
|
-
const _path = encodeStoragePath(_this13._getFinalPath(path));
|
|
39243
39347
|
const query = new URLSearchParams();
|
|
39244
39348
|
if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true");
|
|
39245
39349
|
const queryString = query.toString();
|
|
39246
|
-
return await remove(_this13.fetch,
|
|
39350
|
+
return await remove(_this13.fetch, _this13._getRequestUrl("cdn", path, {
|
|
39351
|
+
encodePath: true,
|
|
39352
|
+
queryString
|
|
39353
|
+
}), {}, { headers: _this13.headers }, parameters);
|
|
39247
39354
|
});
|
|
39248
39355
|
}
|
|
39249
39356
|
/**
|
|
@@ -39423,6 +39530,20 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
39423
39530
|
if (typeof Buffer !== "undefined") return Buffer.from(data).toString("base64");
|
|
39424
39531
|
return btoa(data);
|
|
39425
39532
|
}
|
|
39533
|
+
/** Builds a request URL and checks that it stays within the intended Storage route and bucket. */
|
|
39534
|
+
_getRequestUrl(route, path, { encodePath = false, queryString = "" } = {}) {
|
|
39535
|
+
const finalPath = this._getFinalPath(path);
|
|
39536
|
+
const bucket = encodePath ? encodeStoragePath(String(this.bucketId)) : this.bucketId;
|
|
39537
|
+
const url = `${this.url}/${route}/${encodePath ? encodeStoragePath(finalPath) : finalPath}${queryString ? `?${queryString}` : ""}`;
|
|
39538
|
+
const routeUrl = new URL(`${this.url}/${route}/`);
|
|
39539
|
+
const requestUrl = validateStorageUrl(url, routeUrl);
|
|
39540
|
+
const bucketUrl = new URL(`${this.url}/${route}/${bucket}/`);
|
|
39541
|
+
if (bucketUrl.pathname.startsWith(routeUrl.pathname)) {
|
|
39542
|
+
const bucketSegment = bucketUrl.pathname.slice(routeUrl.pathname.length).split("/")[0];
|
|
39543
|
+
if (bucketSegment) bucketUrl.pathname = `${routeUrl.pathname}${bucketSegment}/`;
|
|
39544
|
+
}
|
|
39545
|
+
return validateStorageUrl(requestUrl, bucketUrl);
|
|
39546
|
+
}
|
|
39426
39547
|
_getFinalPath(path) {
|
|
39427
39548
|
return `${this.bucketId}/${path.replace(/^\/+/, "")}`;
|
|
39428
39549
|
}
|
|
@@ -39439,7 +39560,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
39439
39560
|
return query;
|
|
39440
39561
|
}
|
|
39441
39562
|
};
|
|
39442
|
-
var version = "2.
|
|
39563
|
+
var version = "2.119.2";
|
|
39443
39564
|
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version}` };
|
|
39444
39565
|
var StorageBucketApi = class extends BaseApiClient {
|
|
39445
39566
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -40996,28 +41117,120 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
40996
41117
|
}
|
|
40997
41118
|
};
|
|
40998
41119
|
|
|
40999
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
41120
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.119.2_@opentelemetry+api@1.10.0/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
41000
41121
|
var import_auth_js = __toESM(require_main3(), 1);
|
|
41001
41122
|
__reExport(dist_exports, __toESM(require_main2(), 1));
|
|
41002
41123
|
__reExport(dist_exports, __toESM(require_main3(), 1));
|
|
41003
|
-
var version2 = "2.
|
|
41004
|
-
|
|
41005
|
-
|
|
41006
|
-
|
|
41007
|
-
|
|
41008
|
-
|
|
41009
|
-
|
|
41010
|
-
|
|
41011
|
-
|
|
41012
|
-
|
|
41013
|
-
|
|
41014
|
-
|
|
41124
|
+
var version2 = "2.119.2";
|
|
41125
|
+
function _typeof3(o) {
|
|
41126
|
+
"@babel/helpers - typeof";
|
|
41127
|
+
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
41128
|
+
return typeof o$1;
|
|
41129
|
+
} : function(o$1) {
|
|
41130
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
41131
|
+
}, _typeof3(o);
|
|
41132
|
+
}
|
|
41133
|
+
function toPrimitive3(t, r) {
|
|
41134
|
+
if ("object" != _typeof3(t) || !t) return t;
|
|
41135
|
+
var e = t[Symbol.toPrimitive];
|
|
41136
|
+
if (void 0 !== e) {
|
|
41137
|
+
var i = e.call(t, r || "default");
|
|
41138
|
+
if ("object" != _typeof3(i)) return i;
|
|
41139
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41140
|
+
}
|
|
41141
|
+
return ("string" === r ? String : Number)(t);
|
|
41142
|
+
}
|
|
41143
|
+
function toPropertyKey3(t) {
|
|
41144
|
+
var i = toPrimitive3(t, "string");
|
|
41145
|
+
return "symbol" == _typeof3(i) ? i : i + "";
|
|
41146
|
+
}
|
|
41147
|
+
function _defineProperty3(e, r, t) {
|
|
41148
|
+
return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
|
|
41149
|
+
value: t,
|
|
41150
|
+
enumerable: true,
|
|
41151
|
+
configurable: true,
|
|
41152
|
+
writable: true
|
|
41153
|
+
}) : e[r] = t, e;
|
|
41154
|
+
}
|
|
41155
|
+
function ownKeys4(e, r) {
|
|
41156
|
+
var t = Object.keys(e);
|
|
41157
|
+
if (Object.getOwnPropertySymbols) {
|
|
41158
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
41159
|
+
r && (o = o.filter(function(r$1) {
|
|
41160
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
41161
|
+
})), t.push.apply(t, o);
|
|
41162
|
+
}
|
|
41163
|
+
return t;
|
|
41164
|
+
}
|
|
41165
|
+
function _objectSpread23(e) {
|
|
41166
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
41167
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
41168
|
+
r % 2 ? ownKeys4(Object(t), true).forEach(function(r$1) {
|
|
41169
|
+
_defineProperty3(e, r$1, t[r$1]);
|
|
41170
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys4(Object(t)).forEach(function(r$1) {
|
|
41171
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
41172
|
+
});
|
|
41173
|
+
}
|
|
41174
|
+
return e;
|
|
41175
|
+
}
|
|
41176
|
+
function asString(value) {
|
|
41177
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
41015
41178
|
}
|
|
41016
|
-
|
|
41017
|
-
|
|
41018
|
-
|
|
41019
|
-
|
|
41020
|
-
|
|
41179
|
+
function detectDenoPlatform(globals) {
|
|
41180
|
+
if (typeof globals.EdgeRuntime === "object" && globals.EdgeRuntime !== null) return {
|
|
41181
|
+
platform: "edge-runtime",
|
|
41182
|
+
platformVersion: asString(globals.SUPABASE_VERSION)
|
|
41183
|
+
};
|
|
41184
|
+
if (typeof globals.Netlify !== "undefined") return { platform: "netlify-edge" };
|
|
41185
|
+
return {};
|
|
41186
|
+
}
|
|
41187
|
+
function detectElectronFromUserAgent(userAgent) {
|
|
41188
|
+
var _userAgent$match;
|
|
41189
|
+
const electronVersion = userAgent === null || userAgent === void 0 || (_userAgent$match = userAgent.match(/\bElectron\/([\w.-]+)/)) === null || _userAgent$match === void 0 ? void 0 : _userAgent$match[1];
|
|
41190
|
+
return electronVersion ? {
|
|
41191
|
+
framework: "electron",
|
|
41192
|
+
frameworkVersion: electronVersion
|
|
41193
|
+
} : {};
|
|
41194
|
+
}
|
|
41195
|
+
function detectClientEnvironment(globals = globalThis) {
|
|
41196
|
+
var _globals$navigator, _globals$navigator2, _globals$process, _asString, _globals$process2;
|
|
41197
|
+
const userAgent = asString((_globals$navigator = globals.navigator) === null || _globals$navigator === void 0 ? void 0 : _globals$navigator.userAgent);
|
|
41198
|
+
if (userAgent === "Cloudflare-Workers") return { platform: "cloudflare-workers" };
|
|
41199
|
+
if (typeof globals.Deno !== "undefined") {
|
|
41200
|
+
var _globals$Deno$version;
|
|
41201
|
+
return _objectSpread23(_objectSpread23({}, detectDenoPlatform(globals)), {}, {
|
|
41202
|
+
runtime: "deno",
|
|
41203
|
+
runtimeVersion: asString((_globals$Deno$version = globals.Deno.version) === null || _globals$Deno$version === void 0 ? void 0 : _globals$Deno$version.deno)
|
|
41204
|
+
});
|
|
41205
|
+
}
|
|
41206
|
+
if (typeof globals.Bun !== "undefined") return {
|
|
41207
|
+
runtime: "bun",
|
|
41208
|
+
runtimeVersion: asString(globals.Bun.version)
|
|
41209
|
+
};
|
|
41210
|
+
if (typeof globals.EdgeRuntime === "string") return { platform: "vercel-edge-runtime" };
|
|
41211
|
+
if (((_globals$navigator2 = globals.navigator) === null || _globals$navigator2 === void 0 ? void 0 : _globals$navigator2.product) === "ReactNative") return { framework: "react-native" };
|
|
41212
|
+
if (typeof globals.document !== "undefined" || typeof globals.WorkerGlobalScope !== "undefined") return _objectSpread23({ platform: "browser" }, detectElectronFromUserAgent(userAgent));
|
|
41213
|
+
const processVersions = (_globals$process = globals.process) === null || _globals$process === void 0 ? void 0 : _globals$process["versions"];
|
|
41214
|
+
const electronVersion = asString(processVersions === null || processVersions === void 0 ? void 0 : processVersions["electron"]);
|
|
41215
|
+
return _objectSpread23({
|
|
41216
|
+
runtime: "node",
|
|
41217
|
+
runtimeVersion: (_asString = asString((_globals$process2 = globals.process) === null || _globals$process2 === void 0 ? void 0 : _globals$process2["version"])) === null || _asString === void 0 ? void 0 : _asString.replace(/^v/, "")
|
|
41218
|
+
}, electronVersion ? {
|
|
41219
|
+
framework: "electron",
|
|
41220
|
+
frameworkVersion: electronVersion
|
|
41221
|
+
} : {});
|
|
41222
|
+
}
|
|
41223
|
+
function formatClientEnvironment(environment) {
|
|
41224
|
+
return [
|
|
41225
|
+
["platform", environment.platform],
|
|
41226
|
+
["platform-version", environment.platformVersion],
|
|
41227
|
+
["runtime", environment.runtime],
|
|
41228
|
+
["runtime-version", environment.runtimeVersion],
|
|
41229
|
+
["framework", environment.framework],
|
|
41230
|
+
["framework-version", environment.frameworkVersion]
|
|
41231
|
+
].filter(([, value]) => value).map(([key, value]) => `${key}=${value}`);
|
|
41232
|
+
}
|
|
41233
|
+
var DEFAULT_HEADERS2 = { "X-Client-Info": [`supabase-js/${version2}`, ...formatClientEnvironment(detectClientEnvironment())].join("; ") };
|
|
41021
41234
|
var DEFAULT_GLOBAL_OPTIONS = { headers: DEFAULT_HEADERS2 };
|
|
41022
41235
|
var DEFAULT_DB_OPTIONS = { schema: "public" };
|
|
41023
41236
|
var DEFAULT_AUTH_OPTIONS = {
|
|
@@ -41091,57 +41304,6 @@ function getDefaultPropagationTargets(supabaseUrl2) {
|
|
|
41091
41304
|
targets.push("localhost", "127.0.0.1", "[::1]");
|
|
41092
41305
|
return targets;
|
|
41093
41306
|
}
|
|
41094
|
-
function _typeof3(o) {
|
|
41095
|
-
"@babel/helpers - typeof";
|
|
41096
|
-
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
41097
|
-
return typeof o$1;
|
|
41098
|
-
} : function(o$1) {
|
|
41099
|
-
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
41100
|
-
}, _typeof3(o);
|
|
41101
|
-
}
|
|
41102
|
-
function toPrimitive3(t, r) {
|
|
41103
|
-
if ("object" != _typeof3(t) || !t) return t;
|
|
41104
|
-
var e = t[Symbol.toPrimitive];
|
|
41105
|
-
if (void 0 !== e) {
|
|
41106
|
-
var i = e.call(t, r || "default");
|
|
41107
|
-
if ("object" != _typeof3(i)) return i;
|
|
41108
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41109
|
-
}
|
|
41110
|
-
return ("string" === r ? String : Number)(t);
|
|
41111
|
-
}
|
|
41112
|
-
function toPropertyKey3(t) {
|
|
41113
|
-
var i = toPrimitive3(t, "string");
|
|
41114
|
-
return "symbol" == _typeof3(i) ? i : i + "";
|
|
41115
|
-
}
|
|
41116
|
-
function _defineProperty3(e, r, t) {
|
|
41117
|
-
return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
|
|
41118
|
-
value: t,
|
|
41119
|
-
enumerable: true,
|
|
41120
|
-
configurable: true,
|
|
41121
|
-
writable: true
|
|
41122
|
-
}) : e[r] = t, e;
|
|
41123
|
-
}
|
|
41124
|
-
function ownKeys4(e, r) {
|
|
41125
|
-
var t = Object.keys(e);
|
|
41126
|
-
if (Object.getOwnPropertySymbols) {
|
|
41127
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
41128
|
-
r && (o = o.filter(function(r$1) {
|
|
41129
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
41130
|
-
})), t.push.apply(t, o);
|
|
41131
|
-
}
|
|
41132
|
-
return t;
|
|
41133
|
-
}
|
|
41134
|
-
function _objectSpread23(e) {
|
|
41135
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
41136
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
41137
|
-
r % 2 ? ownKeys4(Object(t), true).forEach(function(r$1) {
|
|
41138
|
-
_defineProperty3(e, r$1, t[r$1]);
|
|
41139
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys4(Object(t)).forEach(function(r$1) {
|
|
41140
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
41141
|
-
});
|
|
41142
|
-
}
|
|
41143
|
-
return e;
|
|
41144
|
-
}
|
|
41145
41307
|
var resolveFetch2 = (customFetch) => {
|
|
41146
41308
|
if (customFetch) return (...args) => customFetch(...args);
|
|
41147
41309
|
return (...args) => fetch(...args);
|
|
@@ -41524,7 +41686,8 @@ var SupabaseClient = class {
|
|
|
41524
41686
|
this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
|
|
41525
41687
|
headers: this.headers,
|
|
41526
41688
|
schema: settings.db.schema,
|
|
41527
|
-
fetch:
|
|
41689
|
+
fetch: resolveFetch2(settings.global.fetch),
|
|
41690
|
+
wrapFetch: (fetch$1) => fetchWithAuth(supabaseKey, supabaseUrl2, this._getSessionToken.bind(this), fetch$1, settings.tracePropagation),
|
|
41528
41691
|
timeout: settings.db.timeout,
|
|
41529
41692
|
urlLengthLimit: settings.db.urlLengthLimit,
|
|
41530
41693
|
retry: settings.db.retry
|
|
@@ -41544,10 +41707,24 @@ var SupabaseClient = class {
|
|
|
41544
41707
|
/**
|
|
41545
41708
|
* Perform a query on a table or a view.
|
|
41546
41709
|
*
|
|
41710
|
+
* A per-request `fetch` is wrapped the same way as the client-level fetch: the
|
|
41711
|
+
* `apikey`, `Authorization` and trace headers are added before it is called.
|
|
41712
|
+
* The same applies to clients returned by `.schema()`.
|
|
41713
|
+
*
|
|
41547
41714
|
* @param relation - The table or view name to query
|
|
41715
|
+
* @param options - Per-request options that override client-level defaults
|
|
41716
|
+
*
|
|
41717
|
+
* @example Per-request fetch options
|
|
41718
|
+
* ```ts
|
|
41719
|
+
* const { data } = await supabase
|
|
41720
|
+
* .from('countries', {
|
|
41721
|
+
* fetch: (input, init) => fetch(input, { ...init, cache: 'force-cache' }),
|
|
41722
|
+
* })
|
|
41723
|
+
* .select('*')
|
|
41724
|
+
* ```
|
|
41548
41725
|
*/
|
|
41549
|
-
from(relation) {
|
|
41550
|
-
return this.rest.from(relation);
|
|
41726
|
+
from(relation, options) {
|
|
41727
|
+
return this.rest.from(relation, options);
|
|
41551
41728
|
}
|
|
41552
41729
|
/**
|
|
41553
41730
|
* Select a schema to query or perform an function (rpc) call.
|
|
@@ -41818,6 +41995,10 @@ function validateField(field, raw) {
|
|
|
41818
41995
|
errors.push({ field, message: `invalid step "${part.slice(slash + 1)}"` });
|
|
41819
41996
|
}
|
|
41820
41997
|
body = part.slice(0, slash);
|
|
41998
|
+
if (body !== "*" && !body.includes("-")) {
|
|
41999
|
+
errors.push({ field, message: `step needs * or a range before it, not "${body}"` });
|
|
42000
|
+
continue;
|
|
42001
|
+
}
|
|
41821
42002
|
}
|
|
41822
42003
|
if (body === "*" || body === "") continue;
|
|
41823
42004
|
if (body.includes("-")) {
|
|
@@ -42761,6 +42942,33 @@ function activeTrustedKeys(list = CAPABILITY_TRUST_LIST) {
|
|
|
42761
42942
|
return list.filter((e) => e.status === "active" && e.kid && e.jwk.kty === "EC" && e.jwk.crv === "P-256" && !("d" in e.jwk)).map((e) => ({ ...e.jwk, kid: e.kid }));
|
|
42762
42943
|
}
|
|
42763
42944
|
|
|
42945
|
+
// ../../packages/bridge/src/heartbeat.ts
|
|
42946
|
+
var MINT_BEFORE_EXPIRY_MS = 5 * 6e4;
|
|
42947
|
+
function sessionFresh(expiresAt, now = Date.now()) {
|
|
42948
|
+
const t = expiresAt ? Date.parse(expiresAt) : NaN;
|
|
42949
|
+
return Number.isFinite(t) && t - now > MINT_BEFORE_EXPIRY_MS;
|
|
42950
|
+
}
|
|
42951
|
+
async function heartbeatTick(deps) {
|
|
42952
|
+
const mintAndRenew = async (force, ok) => {
|
|
42953
|
+
try {
|
|
42954
|
+
const s = await deps.mint(force);
|
|
42955
|
+
if (!s) return "failed";
|
|
42956
|
+
deps.onRenewed(s.token);
|
|
42957
|
+
return ok;
|
|
42958
|
+
} catch {
|
|
42959
|
+
return "failed";
|
|
42960
|
+
}
|
|
42961
|
+
};
|
|
42962
|
+
if (!sessionFresh(deps.expiresAt(), deps.now)) return mintAndRenew(false, "renewed");
|
|
42963
|
+
let accepted;
|
|
42964
|
+
try {
|
|
42965
|
+
accepted = await deps.beat();
|
|
42966
|
+
} catch {
|
|
42967
|
+
return mintAndRenew(true, "minted-after-error");
|
|
42968
|
+
}
|
|
42969
|
+
return accepted ? "beat" : mintAndRenew(true, "minted-after-refusal");
|
|
42970
|
+
}
|
|
42971
|
+
|
|
42764
42972
|
// src/supabase-config.ts
|
|
42765
42973
|
var DEFAULT_SUPABASE_URL = "https://eiuegfdaddrisfboijyy.supabase.co";
|
|
42766
42974
|
var DEFAULT_SUPABASE_ANON_KEY = "sb_publishable_qGCC0eLvfmXwL86zA1SLHA_q8rFMCcG";
|
|
@@ -43168,8 +43376,8 @@ function warnOnce(reason) {
|
|
|
43168
43376
|
console.error(`norc: OS keychain unavailable (${reason.replace(/\s+/g, " ").trim()}); keeping the device token and relay key in the 0600 config file.`);
|
|
43169
43377
|
}
|
|
43170
43378
|
async function getSecret(store, account, what) {
|
|
43171
|
-
const
|
|
43172
|
-
if (
|
|
43379
|
+
const cached3 = secretCache.get(account);
|
|
43380
|
+
if (cached3 !== void 0) return cached3;
|
|
43173
43381
|
if (!store) return null;
|
|
43174
43382
|
try {
|
|
43175
43383
|
return await store.get(account);
|
|
@@ -43549,8 +43757,8 @@ function promptSecret(question, { stdin, stdout } = { stdin: process.stdin, stdo
|
|
|
43549
43757
|
let input = "";
|
|
43550
43758
|
let carry = "";
|
|
43551
43759
|
const onData = (chunk) => {
|
|
43552
|
-
const { ready, pending } = stripPasteMarkers(carry + chunk.toString());
|
|
43553
|
-
carry =
|
|
43760
|
+
const { ready, pending: pending2 } = stripPasteMarkers(carry + chunk.toString());
|
|
43761
|
+
carry = pending2;
|
|
43554
43762
|
for (const char of ready) {
|
|
43555
43763
|
if (char === "\n" || char === "\r") {
|
|
43556
43764
|
if (isTTY) stdout.write("\n");
|
|
@@ -44193,7 +44401,7 @@ var import_node_os5 = require("node:os");
|
|
|
44193
44401
|
var import_node_path3 = require("node:path");
|
|
44194
44402
|
|
|
44195
44403
|
// src/version.ts
|
|
44196
|
-
var VERSION2 = "0.
|
|
44404
|
+
var VERSION2 = "0.4.1";
|
|
44197
44405
|
|
|
44198
44406
|
// src/host-details.ts
|
|
44199
44407
|
var ARCH = { x64: "x86_64", arm64: "arm64", ia32: "x86", arm: "arm" };
|
|
@@ -44372,6 +44580,44 @@ async function deviceSession(supabaseUrl2, anonKey, signal, encPublicJwk, cacheP
|
|
|
44372
44580
|
return null;
|
|
44373
44581
|
}
|
|
44374
44582
|
}
|
|
44583
|
+
var cached2 = null;
|
|
44584
|
+
var pending = null;
|
|
44585
|
+
var cachedFor = null;
|
|
44586
|
+
var pendingFor = null;
|
|
44587
|
+
var latest = null;
|
|
44588
|
+
var mustRegister = null;
|
|
44589
|
+
async function cachedDeviceSession(supabaseUrl2, anonKey, encPublicJwk, opts = {}) {
|
|
44590
|
+
const key = JSON.stringify(encPublicJwk ?? null);
|
|
44591
|
+
latest = { key, jwk: encPublicJwk };
|
|
44592
|
+
if (mustRegister === key) opts = { ...opts, force: true };
|
|
44593
|
+
if (cached2 && cachedFor === key && !opts.force && sessionFresh(cached2.expires_at)) return cached2;
|
|
44594
|
+
if (!opts.force && pending && pendingFor === key) return pending;
|
|
44595
|
+
const run2 = (async () => {
|
|
44596
|
+
const s = await deviceSession(supabaseUrl2, anonKey, void 0, encPublicJwk);
|
|
44597
|
+
if (latest && latest.key !== key) {
|
|
44598
|
+
mustRegister = latest.key;
|
|
44599
|
+
void cachedDeviceSession(supabaseUrl2, anonKey, latest.jwk, { force: true });
|
|
44600
|
+
return s;
|
|
44601
|
+
}
|
|
44602
|
+
if (s) {
|
|
44603
|
+
cached2 = s;
|
|
44604
|
+
cachedFor = key;
|
|
44605
|
+
if (mustRegister === key) mustRegister = null;
|
|
44606
|
+
} else if (revoked) cached2 = null;
|
|
44607
|
+
return s;
|
|
44608
|
+
})();
|
|
44609
|
+
if (opts.force) return run2;
|
|
44610
|
+
pending = run2;
|
|
44611
|
+
pendingFor = key;
|
|
44612
|
+
const clear = () => {
|
|
44613
|
+
if (pending === run2) {
|
|
44614
|
+
pending = null;
|
|
44615
|
+
pendingFor = null;
|
|
44616
|
+
}
|
|
44617
|
+
};
|
|
44618
|
+
run2.then(clear, clear);
|
|
44619
|
+
return run2;
|
|
44620
|
+
}
|
|
44375
44621
|
async function mint(supabaseUrl2, anonKey, signal, encPublicJwk, cachePath, cfgPath) {
|
|
44376
44622
|
const config = await loadConfig(cfgPath, { enc: false });
|
|
44377
44623
|
const device = config.device;
|
|
@@ -44534,6 +44780,27 @@ async function pullEnv(fetchFn, session, timeoutMs, path, clear) {
|
|
|
44534
44780
|
async function pullEnvNames(fetchFn, session, timeoutMs, path = envCachePath()) {
|
|
44535
44781
|
return (await pullEnv(fetchFn, session, timeoutMs, path, clearEnvCache)).body?.jobs ?? null;
|
|
44536
44782
|
}
|
|
44783
|
+
async function pollEnvState(sb, timeoutMs = 1e4) {
|
|
44784
|
+
let timer;
|
|
44785
|
+
try {
|
|
44786
|
+
const timeout = new Promise((_, reject) => {
|
|
44787
|
+
timer = setTimeout(() => reject(new Error("timeout")), timeoutMs);
|
|
44788
|
+
});
|
|
44789
|
+
const { data, error } = await Promise.race([sb.rpc("env_state_for_current_machine"), timeout]);
|
|
44790
|
+
if (error) return null;
|
|
44791
|
+
if (data === null) return "not-live";
|
|
44792
|
+
const d = data;
|
|
44793
|
+
if (typeof d !== "object" || typeof d.fingerprint !== "string") return null;
|
|
44794
|
+
const names = d.names;
|
|
44795
|
+
if (typeof names !== "object" || names === null || Array.isArray(names)) return null;
|
|
44796
|
+
for (const v of Object.values(names)) if (!Array.isArray(v) || !v.every((n) => typeof n === "string")) return null;
|
|
44797
|
+
return { names, fingerprint: d.fingerprint };
|
|
44798
|
+
} catch {
|
|
44799
|
+
return null;
|
|
44800
|
+
} finally {
|
|
44801
|
+
clearTimeout(timer);
|
|
44802
|
+
}
|
|
44803
|
+
}
|
|
44537
44804
|
var REFRESH_BUDGET_MS = 3e3;
|
|
44538
44805
|
function createJobEnvLoader(getSession, path = envCachePath(), fetchFn = fetch, clear = clearEnvCache) {
|
|
44539
44806
|
return async (jobId, envNames) => {
|
|
@@ -44719,9 +44986,9 @@ function createSessionCache(anonKey, lockWaitMs = () => void 0) {
|
|
|
44719
44986
|
let sessionPromise;
|
|
44720
44987
|
return async function getSession() {
|
|
44721
44988
|
if (sessionPromise) {
|
|
44722
|
-
const
|
|
44723
|
-
const expiresAt =
|
|
44724
|
-
if (!
|
|
44989
|
+
const cached3 = await sessionPromise;
|
|
44990
|
+
const expiresAt = cached3 ? new Date(cached3.expires_at).getTime() : 0;
|
|
44991
|
+
if (!cached3 || expiresAt - Date.now() < SESSION_REFRESH_BUFFER_MS) sessionPromise = void 0;
|
|
44725
44992
|
}
|
|
44726
44993
|
sessionPromise ??= deviceSession(supabaseUrl(), anonKey, void 0, void 0, void 0, void 0, lockWaitMs());
|
|
44727
44994
|
return sessionPromise;
|
|
@@ -45165,7 +45432,7 @@ function renderUsage(s, opts) {
|
|
|
45165
45432
|
];
|
|
45166
45433
|
for (const m of f.messages) lines.push(amber(m));
|
|
45167
45434
|
lines.push(...wrap(f.note, colW).map(dim));
|
|
45168
|
-
if (f.showUpgrade) lines.push(`Upgrade: ${cyan(`${opts.vaultUrl ?? "https://vault.norc.app"}/settings/
|
|
45435
|
+
if (f.showUpgrade) lines.push(`Upgrade: ${cyan(`${opts.vaultUrl ?? "https://vault.norc.app"}/settings/plan`)}`);
|
|
45169
45436
|
if (f.messages.length) lines.push("Need more? Email hello@norc.app");
|
|
45170
45437
|
return lines;
|
|
45171
45438
|
};
|
|
@@ -45632,6 +45899,10 @@ function findManagedJob(currentCrontab, jobId) {
|
|
|
45632
45899
|
const entry = parseCrontab(currentCrontab).find((e) => e.kind === "job" && e.id === jobId);
|
|
45633
45900
|
return entry ? { id: jobId, command: unwrapCommand(entry.command), envNames: wrappedEnvNames(entry.command) ?? [] } : null;
|
|
45634
45901
|
}
|
|
45902
|
+
var sameNames = (a, b) => {
|
|
45903
|
+
const ka = Object.keys(a);
|
|
45904
|
+
return ka.length === Object.keys(b).length && ka.every((k) => b[k] !== void 0 && a[k].length === b[k].length && a[k].every((n, i) => n === b[k][i]));
|
|
45905
|
+
};
|
|
45635
45906
|
function reprojectEnvNames(currentCrontab, names) {
|
|
45636
45907
|
const want = /* @__PURE__ */ new Map();
|
|
45637
45908
|
for (const e of parseCrontab(currentCrontab)) {
|
|
@@ -45732,15 +46003,16 @@ async function runBridge(env, crontabIo) {
|
|
|
45732
46003
|
});
|
|
45733
46004
|
try {
|
|
45734
46005
|
state = reduceConn(state, "connect");
|
|
45735
|
-
const sess = await
|
|
46006
|
+
const sess = await cachedDeviceSession(env.supabaseUrl, env.anonKey, keyPair.publicJwk, { force: true });
|
|
45736
46007
|
if (!sess) {
|
|
45737
46008
|
console.error("[norc bridge] device session mint failed");
|
|
45738
46009
|
await wait(backoffDelay(attempt++));
|
|
45739
46010
|
continue;
|
|
45740
46011
|
}
|
|
46012
|
+
let current = sess;
|
|
45741
46013
|
sb = createClient(env.supabaseUrl, env.anonKey, {
|
|
45742
46014
|
auth: { persistSession: false },
|
|
45743
|
-
|
|
46015
|
+
accessToken: async () => current.token,
|
|
45744
46016
|
realtime: { params: { eventsPerSecond: 5 } }
|
|
45745
46017
|
});
|
|
45746
46018
|
sb.realtime.setAuth(sess.token);
|
|
@@ -45756,7 +46028,7 @@ async function runBridge(env, crontabIo) {
|
|
|
45756
46028
|
await refreshRemote(config);
|
|
45757
46029
|
return remoteEnabled(config);
|
|
45758
46030
|
}, "remote reads are disabled on this host (run `norc remote enable`)") });
|
|
45759
|
-
const pullNames = () =>
|
|
46031
|
+
const pullNames = () => cachedDeviceSession(env.supabaseUrl, env.anonKey, keyPair.publicJwk).then((s) => pullEnvNames(fetch, s, 1e4)).catch(() => null);
|
|
45760
46032
|
const deps = buildWriteIntentDeps(config, machineId, crontabIo, () => void persistConfig(), refreshRemote, pullNames);
|
|
45761
46033
|
const rawDeps = buildRawWriteIntentDeps(config, machineId, crontabIo, () => void persistConfig(), refreshRemote);
|
|
45762
46034
|
sec.on("write-intent", (payload, from) => {
|
|
@@ -45872,9 +46144,9 @@ async function runBridge(env, crontabIo) {
|
|
|
45872
46144
|
}
|
|
45873
46145
|
for (let attempt2 = 0; attempt2 < 3; attempt2++) {
|
|
45874
46146
|
try {
|
|
45875
|
-
const
|
|
45876
|
-
const next = projectJobsRemoved(
|
|
45877
|
-
if (next !==
|
|
46147
|
+
const current2 = await crontabIo.read();
|
|
46148
|
+
const next = projectJobsRemoved(current2, gone);
|
|
46149
|
+
if (next !== current2) console.log(`[norc bridge] jobs-deleted (${sanitize(config.remote?.account ?? "", 80)}): removing ${gone.length} job(s) the server no longer has`);
|
|
45878
46150
|
await crontabIo.write(next);
|
|
45879
46151
|
queueSyncJobs();
|
|
45880
46152
|
return;
|
|
@@ -45898,12 +46170,45 @@ async function runBridge(env, crontabIo) {
|
|
|
45898
46170
|
if (envRefresh) clearInterval(envRefresh);
|
|
45899
46171
|
heartbeat = setInterval(() => {
|
|
45900
46172
|
void watchIdentity().then((ok) => {
|
|
45901
|
-
if (ok) return
|
|
46173
|
+
if (!ok) return;
|
|
46174
|
+
return heartbeatTick({
|
|
46175
|
+
expiresAt: () => current.expires_at,
|
|
46176
|
+
beat: async () => {
|
|
46177
|
+
const { data, error } = await sb.rpc("machine_heartbeat");
|
|
46178
|
+
if (error) throw new Error(error.message);
|
|
46179
|
+
return data === true;
|
|
46180
|
+
},
|
|
46181
|
+
mint: async (force) => {
|
|
46182
|
+
const s = await cachedDeviceSession(env.supabaseUrl, env.anonKey, keyPair.publicJwk, { force });
|
|
46183
|
+
if (s) current = s;
|
|
46184
|
+
return s;
|
|
46185
|
+
},
|
|
46186
|
+
// setAuth may throw or reject; neither may escape (heartbeatTick would report a good mint as failed).
|
|
46187
|
+
onRenewed: (token) => {
|
|
46188
|
+
void Promise.resolve().then(() => sb.realtime.setAuth(token)).catch((e) => console.warn("[norc bridge] could not hand the renewed token to Realtime:", e instanceof Error ? e.message : "unknown error"));
|
|
46189
|
+
}
|
|
46190
|
+
});
|
|
45902
46191
|
});
|
|
45903
46192
|
}, 6e4);
|
|
46193
|
+
let lastFingerprint = null;
|
|
45904
46194
|
const pullEnv2 = () => enqueueMutation(async () => {
|
|
45905
|
-
const
|
|
45906
|
-
if (
|
|
46195
|
+
const state2 = await pollEnvState(sb);
|
|
46196
|
+
if (!await watchIdentity()) return;
|
|
46197
|
+
if (state2 === null) {
|
|
46198
|
+
const names = await pullNames();
|
|
46199
|
+
if (names) await applyEnvNames(crontabIo, names);
|
|
46200
|
+
return;
|
|
46201
|
+
}
|
|
46202
|
+
if (state2 === "not-live") {
|
|
46203
|
+
const s2 = await cachedDeviceSession(env.supabaseUrl, env.anonKey, keyPair.publicJwk, { force: true }).catch(() => null);
|
|
46204
|
+
if (s2) current = s2;
|
|
46205
|
+
return;
|
|
46206
|
+
}
|
|
46207
|
+
if (state2.fingerprint === lastFingerprint) return;
|
|
46208
|
+
const s = await cachedDeviceSession(env.supabaseUrl, env.anonKey, keyPair.publicJwk).catch(() => null);
|
|
46209
|
+
const pulled = await pullEnvNames(fetch, s, 1e4);
|
|
46210
|
+
if (!pulled) return;
|
|
46211
|
+
if (await applyEnvNames(crontabIo, pulled) && sameNames(pulled, state2.names)) lastFingerprint = state2.fingerprint;
|
|
45907
46212
|
});
|
|
45908
46213
|
pullEnv2();
|
|
45909
46214
|
envRefresh = setInterval(pullEnv2, 5 * 6e4);
|
|
@@ -45946,11 +46251,13 @@ async function applyEnvNames(crontabIo, names) {
|
|
|
45946
46251
|
try {
|
|
45947
46252
|
const current = await crontabIo.read();
|
|
45948
46253
|
const next = reprojectEnvNames(current, names);
|
|
45949
|
-
if (next === current) return;
|
|
46254
|
+
if (next === current) return true;
|
|
45950
46255
|
await crontabIo.write(next);
|
|
45951
46256
|
console.log("[norc bridge] updated the env var names on managed crontab lines");
|
|
46257
|
+
return true;
|
|
45952
46258
|
} catch (e) {
|
|
45953
46259
|
console.error("[norc bridge] updating env var names failed:", e instanceof Error ? e.message : e);
|
|
46260
|
+
return false;
|
|
45954
46261
|
}
|
|
45955
46262
|
}
|
|
45956
46263
|
var IDLE_POLL_MS = 3e4;
|
|
@@ -46039,13 +46346,16 @@ async function installService(deps = defaultServiceDeps(process.execPath)) {
|
|
|
46039
46346
|
await deps.mkdir((0, import_node_path8.join)(deps.home, ".config", "systemd", "user"), { recursive: true });
|
|
46040
46347
|
await deps.writeFile(path, systemdUnit(deps.binaryPath));
|
|
46041
46348
|
await deps.exec("systemctl", ["--user", "daemon-reload"]);
|
|
46042
|
-
await deps.exec("systemctl", ["--user", "enable", "
|
|
46349
|
+
await deps.exec("systemctl", ["--user", "enable", "norc.service"]);
|
|
46350
|
+
await deps.exec("systemctl", ["--user", "restart", "norc.service"]);
|
|
46043
46351
|
return;
|
|
46044
46352
|
}
|
|
46045
46353
|
case "darwin": {
|
|
46046
46354
|
const path = launchdPlistPath(deps.home);
|
|
46047
46355
|
await deps.mkdir((0, import_node_path8.join)(deps.home, "Library", "LaunchAgents"), { recursive: true });
|
|
46048
46356
|
await deps.writeFile(path, launchdPlist(deps.binaryPath));
|
|
46357
|
+
await deps.exec("launchctl", ["unload", path]).catch(() => {
|
|
46358
|
+
});
|
|
46049
46359
|
await deps.exec("launchctl", ["load", "-w", path]);
|
|
46050
46360
|
return;
|
|
46051
46361
|
}
|
|
@@ -46062,6 +46372,8 @@ async function installService(deps = defaultServiceDeps(process.execPath)) {
|
|
|
46062
46372
|
"LIMITED",
|
|
46063
46373
|
"/F"
|
|
46064
46374
|
]);
|
|
46375
|
+
await deps.exec("schtasks", ["/End", "/TN", SCHEDULED_TASK_NAME]).catch(() => {
|
|
46376
|
+
});
|
|
46065
46377
|
await deps.exec("schtasks", ["/Run", "/TN", SCHEDULED_TASK_NAME]);
|
|
46066
46378
|
return;
|
|
46067
46379
|
}
|