@supabase/supabase-js 2.111.1-canary.1 → 2.112.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cors.cjs +0 -1
- package/dist/cors.cjs.map +1 -1
- package/dist/index.cjs +151 -800
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +26 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +17 -71
- package/dist/index.mjs.map +1 -1
- package/dist/tracing.cjs +59 -0
- package/dist/tracing.cjs.map +1 -0
- package/dist/tracing.d.cts +1 -0
- package/dist/tracing.d.mts +1 -0
- package/dist/tracing.mjs +60 -0
- package/dist/tracing.mjs.map +1 -0
- package/dist/tracingRegistry.cjs +32 -0
- package/dist/tracingRegistry.cjs.map +1 -0
- package/dist/tracingRegistry.mjs +20 -0
- package/dist/tracingRegistry.mjs.map +1 -0
- package/dist/umd/supabase.js +4 -4
- package/package.json +39 -12
- package/src/SupabaseClient.ts +3 -1
- package/src/lib/fetch.ts +37 -5
- package/src/lib/tracingRegistry.ts +42 -0
- package/src/lib/types.ts +23 -7
- package/src/lib/version.ts +1 -1
- package/src/tracing.ts +26 -0
package/dist/index.cjs
CHANGED
|
@@ -1,40 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
7
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
|
-
var __exportAll = (all, symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
__defProp(target, name, {
|
|
12
|
-
get: all[name],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
-
key = keys[i];
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
-
__defProp(to, key, {
|
|
27
|
-
get: ((k) => from[k]).bind(null, key),
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
1
|
+
const require_tracingRegistry = require('./tracingRegistry.cjs');
|
|
38
2
|
let _supabase_functions_js = require("@supabase/functions-js");
|
|
39
3
|
let _supabase_postgrest_js = require("@supabase/postgrest-js");
|
|
40
4
|
let _supabase_realtime_js = require("@supabase/realtime-js");
|
|
@@ -42,7 +6,7 @@ let _supabase_storage_js = require("@supabase/storage-js");
|
|
|
42
6
|
let _supabase_auth_js = require("@supabase/auth-js");
|
|
43
7
|
|
|
44
8
|
//#region src/lib/version.ts
|
|
45
|
-
const version = "2.
|
|
9
|
+
const version = "2.112.0-beta.0";
|
|
46
10
|
|
|
47
11
|
//#endregion
|
|
48
12
|
//#region src/lib/constants.ts
|
|
@@ -78,775 +42,152 @@ const DEFAULT_TRACE_PROPAGATION_OPTIONS = {
|
|
|
78
42
|
};
|
|
79
43
|
|
|
80
44
|
//#endregion
|
|
81
|
-
//#region
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
function __rest(s, e) {
|
|
126
|
-
var t = {};
|
|
127
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
128
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
129
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
130
|
-
}
|
|
131
|
-
return t;
|
|
132
|
-
}
|
|
133
|
-
function __decorate(decorators, target, key, desc) {
|
|
134
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
135
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
136
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
137
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
138
|
-
}
|
|
139
|
-
function __param(paramIndex, decorator) {
|
|
140
|
-
return function(target, key) {
|
|
141
|
-
decorator(target, key, paramIndex);
|
|
45
|
+
//#region ../../shared/tracing/dist/module/parse.js
|
|
46
|
+
/**
|
|
47
|
+
* Parse W3C traceparent header according to the specification.
|
|
48
|
+
*
|
|
49
|
+
* The traceparent header format is: version-traceid-parentid-traceflags
|
|
50
|
+
* - version: 2 hex digits (currently always "00")
|
|
51
|
+
* - traceid: 32 hex digits (128-bit trace identifier)
|
|
52
|
+
* - parentid: 16 hex digits (64-bit span/parent identifier)
|
|
53
|
+
* - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag)
|
|
54
|
+
*
|
|
55
|
+
* @param traceparent - The traceparent header value
|
|
56
|
+
* @returns Parsed traceparent object, or null if invalid format
|
|
57
|
+
*
|
|
58
|
+
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01')
|
|
63
|
+
*
|
|
64
|
+
* console.log(parsed)
|
|
65
|
+
* // {
|
|
66
|
+
* // version: '00',
|
|
67
|
+
* // traceId: '0af7651916cd43dd8448eb211c80319c',
|
|
68
|
+
* // parentId: 'b7ad6b7169203331',
|
|
69
|
+
* // traceFlags: '01',
|
|
70
|
+
* // isSampled: true
|
|
71
|
+
* // }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function parseTraceParent(traceparent) {
|
|
75
|
+
if (!traceparent || typeof traceparent !== "string") return null;
|
|
76
|
+
const parts = traceparent.split("-");
|
|
77
|
+
if (parts.length !== 4) return null;
|
|
78
|
+
const [version$1, traceId, parentId, traceFlags] = parts;
|
|
79
|
+
if (version$1.length !== 2 || traceId.length !== 32 || parentId.length !== 16 || traceFlags.length !== 2) return null;
|
|
80
|
+
const hexRegex = /^[0-9a-f]+$/i;
|
|
81
|
+
if (!hexRegex.test(version$1) || !hexRegex.test(traceId) || !hexRegex.test(parentId) || !hexRegex.test(traceFlags)) return null;
|
|
82
|
+
if (traceId === "00000000000000000000000000000000" || parentId === "0000000000000000") return null;
|
|
83
|
+
return {
|
|
84
|
+
version: version$1,
|
|
85
|
+
traceId,
|
|
86
|
+
parentId,
|
|
87
|
+
traceFlags,
|
|
88
|
+
isSampled: (parseInt(traceFlags, 16) & 1) === 1
|
|
142
89
|
};
|
|
143
90
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
function __propKey(x) {
|
|
183
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
184
|
-
}
|
|
185
|
-
function __setFunctionName(f, name, prefix) {
|
|
186
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
187
|
-
return Object.defineProperty(f, "name", {
|
|
188
|
-
configurable: true,
|
|
189
|
-
value: prefix ? "".concat(prefix, " ", name) : name
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
function __metadata(metadataKey, metadataValue) {
|
|
193
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
194
|
-
}
|
|
195
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
196
|
-
function adopt(value) {
|
|
197
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
198
|
-
resolve(value);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
202
|
-
function fulfilled(value) {
|
|
203
|
-
try {
|
|
204
|
-
step(generator.next(value));
|
|
205
|
-
} catch (e) {
|
|
206
|
-
reject(e);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function rejected(value) {
|
|
210
|
-
try {
|
|
211
|
-
step(generator["throw"](value));
|
|
212
|
-
} catch (e) {
|
|
213
|
-
reject(e);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function step(result) {
|
|
217
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
218
|
-
}
|
|
219
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
function __generator(thisArg, body) {
|
|
223
|
-
var _ = {
|
|
224
|
-
label: 0,
|
|
225
|
-
sent: function() {
|
|
226
|
-
if (t[0] & 1) throw t[1];
|
|
227
|
-
return t[1];
|
|
228
|
-
},
|
|
229
|
-
trys: [],
|
|
230
|
-
ops: []
|
|
231
|
-
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
232
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
233
|
-
return this;
|
|
234
|
-
}), g;
|
|
235
|
-
function verb(n) {
|
|
236
|
-
return function(v) {
|
|
237
|
-
return step([n, v]);
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
function step(op) {
|
|
241
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
242
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
243
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
244
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
245
|
-
switch (op[0]) {
|
|
246
|
-
case 0:
|
|
247
|
-
case 1:
|
|
248
|
-
t = op;
|
|
249
|
-
break;
|
|
250
|
-
case 4:
|
|
251
|
-
_.label++;
|
|
252
|
-
return {
|
|
253
|
-
value: op[1],
|
|
254
|
-
done: false
|
|
255
|
-
};
|
|
256
|
-
case 5:
|
|
257
|
-
_.label++;
|
|
258
|
-
y = op[1];
|
|
259
|
-
op = [0];
|
|
260
|
-
continue;
|
|
261
|
-
case 7:
|
|
262
|
-
op = _.ops.pop();
|
|
263
|
-
_.trys.pop();
|
|
264
|
-
continue;
|
|
265
|
-
default:
|
|
266
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
267
|
-
_ = 0;
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
271
|
-
_.label = op[1];
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
275
|
-
_.label = t[1];
|
|
276
|
-
t = op;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
if (t && _.label < t[2]) {
|
|
280
|
-
_.label = t[2];
|
|
281
|
-
_.ops.push(op);
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
if (t[2]) _.ops.pop();
|
|
285
|
-
_.trys.pop();
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
op = body.call(thisArg, _);
|
|
289
|
-
} catch (e) {
|
|
290
|
-
op = [6, e];
|
|
291
|
-
y = 0;
|
|
292
|
-
} finally {
|
|
293
|
-
f = t = 0;
|
|
294
|
-
}
|
|
295
|
-
if (op[0] & 5) throw op[1];
|
|
296
|
-
return {
|
|
297
|
-
value: op[0] ? op[1] : void 0,
|
|
298
|
-
done: true
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function __exportStar(m, o) {
|
|
303
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
304
|
-
}
|
|
305
|
-
function __values(o) {
|
|
306
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
307
|
-
if (m) return m.call(o);
|
|
308
|
-
if (o && typeof o.length === "number") return { next: function() {
|
|
309
|
-
if (o && i >= o.length) o = void 0;
|
|
310
|
-
return {
|
|
311
|
-
value: o && o[i++],
|
|
312
|
-
done: !o
|
|
313
|
-
};
|
|
314
|
-
} };
|
|
315
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
316
|
-
}
|
|
317
|
-
function __read(o, n) {
|
|
318
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
319
|
-
if (!m) return o;
|
|
320
|
-
var i = m.call(o), r, ar = [], e;
|
|
321
|
-
try {
|
|
322
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region ../../shared/tracing/dist/module/validate.js
|
|
94
|
+
/**
|
|
95
|
+
* Check if trace context should be propagated to the target URL.
|
|
96
|
+
*
|
|
97
|
+
* This function checks if the target URL matches any of the configured
|
|
98
|
+
* propagation targets. Targets can be:
|
|
99
|
+
* - String: Exact hostname match or wildcard domain (*.example.com)
|
|
100
|
+
* - RegExp: Pattern matching hostname
|
|
101
|
+
* - Function: Custom logic to determine if URL should receive trace context
|
|
102
|
+
*
|
|
103
|
+
* @param targetUrl - The URL to check
|
|
104
|
+
* @param targets - Array of propagation targets
|
|
105
|
+
* @returns True if trace context should be propagated, false otherwise
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const targets = [
|
|
110
|
+
* 'myproject.supabase.co', // Exact match
|
|
111
|
+
* '*.supabase.co', // Wildcard domain
|
|
112
|
+
* /.*\.supabase\.co$/, // Regex pattern
|
|
113
|
+
* (url) => url.hostname === 'localhost' // Custom function
|
|
114
|
+
* ]
|
|
115
|
+
*
|
|
116
|
+
* shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets)
|
|
117
|
+
* // true
|
|
118
|
+
*
|
|
119
|
+
* shouldPropagateToTarget('https://evil.com/api', targets)
|
|
120
|
+
* // false
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
function shouldPropagateToTarget(targetUrl, targets) {
|
|
124
|
+
if (!targetUrl || !targets || targets.length === 0) return false;
|
|
125
|
+
let url;
|
|
126
|
+
if (targetUrl instanceof URL) url = targetUrl;
|
|
127
|
+
else try {
|
|
128
|
+
url = new URL(targetUrl);
|
|
323
129
|
} catch (error) {
|
|
324
|
-
|
|
325
|
-
} finally {
|
|
326
|
-
try {
|
|
327
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
328
|
-
} finally {
|
|
329
|
-
if (e) throw e.error;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
return ar;
|
|
333
|
-
}
|
|
334
|
-
/** @deprecated */
|
|
335
|
-
function __spread() {
|
|
336
|
-
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
337
|
-
return ar;
|
|
338
|
-
}
|
|
339
|
-
/** @deprecated */
|
|
340
|
-
function __spreadArrays() {
|
|
341
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
342
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
|
|
343
|
-
return r;
|
|
344
|
-
}
|
|
345
|
-
function __spreadArray(to, from, pack) {
|
|
346
|
-
if (pack || arguments.length === 2) {
|
|
347
|
-
for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
|
|
348
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
349
|
-
ar[i] = from[i];
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
353
|
-
}
|
|
354
|
-
function __await(v) {
|
|
355
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
356
|
-
}
|
|
357
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
358
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
359
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
360
|
-
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
361
|
-
return this;
|
|
362
|
-
}, i;
|
|
363
|
-
function awaitReturn(f) {
|
|
364
|
-
return function(v) {
|
|
365
|
-
return Promise.resolve(v).then(f, reject);
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
function verb(n, f) {
|
|
369
|
-
if (g[n]) {
|
|
370
|
-
i[n] = function(v) {
|
|
371
|
-
return new Promise(function(a, b) {
|
|
372
|
-
q.push([
|
|
373
|
-
n,
|
|
374
|
-
v,
|
|
375
|
-
a,
|
|
376
|
-
b
|
|
377
|
-
]) > 1 || resume(n, v);
|
|
378
|
-
});
|
|
379
|
-
};
|
|
380
|
-
if (f) i[n] = f(i[n]);
|
|
381
|
-
}
|
|
130
|
+
return false;
|
|
382
131
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
132
|
+
for (const target of targets) try {
|
|
133
|
+
if (typeof target === "string") {
|
|
134
|
+
if (matchStringTarget(url.hostname, target)) return true;
|
|
135
|
+
} else if (target instanceof RegExp) {
|
|
136
|
+
if (target.test(url.hostname)) return true;
|
|
137
|
+
} else if (typeof target === "function") {
|
|
138
|
+
if (target(url)) return true;
|
|
388
139
|
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
continue;
|
|
389
142
|
}
|
|
390
|
-
|
|
391
|
-
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
392
|
-
}
|
|
393
|
-
function fulfill(value) {
|
|
394
|
-
resume("next", value);
|
|
395
|
-
}
|
|
396
|
-
function reject(value) {
|
|
397
|
-
resume("throw", value);
|
|
398
|
-
}
|
|
399
|
-
function settle(f, v) {
|
|
400
|
-
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function __asyncDelegator(o) {
|
|
404
|
-
var i, p;
|
|
405
|
-
return i = {}, verb("next"), verb("throw", function(e) {
|
|
406
|
-
throw e;
|
|
407
|
-
}), verb("return"), i[Symbol.iterator] = function() {
|
|
408
|
-
return this;
|
|
409
|
-
}, i;
|
|
410
|
-
function verb(n, f) {
|
|
411
|
-
i[n] = o[n] ? function(v) {
|
|
412
|
-
return (p = !p) ? {
|
|
413
|
-
value: __await(o[n](v)),
|
|
414
|
-
done: false
|
|
415
|
-
} : f ? f(v) : v;
|
|
416
|
-
} : f;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function __asyncValues(o) {
|
|
420
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
421
|
-
var m = o[Symbol.asyncIterator], i;
|
|
422
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
423
|
-
return this;
|
|
424
|
-
}, i);
|
|
425
|
-
function verb(n) {
|
|
426
|
-
i[n] = o[n] && function(v) {
|
|
427
|
-
return new Promise(function(resolve, reject) {
|
|
428
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
function settle(resolve, reject, d, v) {
|
|
433
|
-
Promise.resolve(v).then(function(v$1) {
|
|
434
|
-
resolve({
|
|
435
|
-
value: v$1,
|
|
436
|
-
done: d
|
|
437
|
-
});
|
|
438
|
-
}, reject);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
function __makeTemplateObject(cooked, raw) {
|
|
442
|
-
if (Object.defineProperty) Object.defineProperty(cooked, "raw", { value: raw });
|
|
443
|
-
else cooked.raw = raw;
|
|
444
|
-
return cooked;
|
|
445
|
-
}
|
|
446
|
-
function __importStar(mod) {
|
|
447
|
-
if (mod && mod.__esModule) return mod;
|
|
448
|
-
var result = {};
|
|
449
|
-
if (mod != null) {
|
|
450
|
-
for (var k = ownKeys$1(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
451
|
-
}
|
|
452
|
-
__setModuleDefault(result, mod);
|
|
453
|
-
return result;
|
|
454
|
-
}
|
|
455
|
-
function __importDefault(mod) {
|
|
456
|
-
return mod && mod.__esModule ? mod : { default: mod };
|
|
457
|
-
}
|
|
458
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
459
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
460
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
461
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
143
|
+
return false;
|
|
462
144
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
var dispose, inner;
|
|
477
|
-
if (async) {
|
|
478
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
479
|
-
dispose = value[Symbol.asyncDispose];
|
|
480
|
-
}
|
|
481
|
-
if (dispose === void 0) {
|
|
482
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
483
|
-
dispose = value[Symbol.dispose];
|
|
484
|
-
if (async) inner = dispose;
|
|
485
|
-
}
|
|
486
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
487
|
-
if (inner) dispose = function() {
|
|
488
|
-
try {
|
|
489
|
-
inner.call(this);
|
|
490
|
-
} catch (e) {
|
|
491
|
-
return Promise.reject(e);
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
env.stack.push({
|
|
495
|
-
value,
|
|
496
|
-
dispose,
|
|
497
|
-
async
|
|
498
|
-
});
|
|
499
|
-
} else if (async) env.stack.push({ async: true });
|
|
500
|
-
return value;
|
|
501
|
-
}
|
|
502
|
-
function __disposeResources(env) {
|
|
503
|
-
function fail(e) {
|
|
504
|
-
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
505
|
-
env.hasError = true;
|
|
506
|
-
}
|
|
507
|
-
var r, s = 0;
|
|
508
|
-
function next() {
|
|
509
|
-
while (r = env.stack.pop()) try {
|
|
510
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
511
|
-
if (r.dispose) {
|
|
512
|
-
var result = r.dispose.call(r.value);
|
|
513
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
514
|
-
fail(e);
|
|
515
|
-
return next();
|
|
516
|
-
});
|
|
517
|
-
} else s |= 1;
|
|
518
|
-
} catch (e) {
|
|
519
|
-
fail(e);
|
|
145
|
+
/**
|
|
146
|
+
* Match hostname against string target (exact match or wildcard)
|
|
147
|
+
*
|
|
148
|
+
* @param hostname - The hostname to check
|
|
149
|
+
* @param target - The target pattern (exact or wildcard)
|
|
150
|
+
* @returns True if hostname matches target
|
|
151
|
+
*/
|
|
152
|
+
function matchStringTarget(hostname, target) {
|
|
153
|
+
if (target === hostname) return true;
|
|
154
|
+
if (target.startsWith("*.")) {
|
|
155
|
+
const domain = target.slice(2);
|
|
156
|
+
if (hostname.endsWith(domain)) {
|
|
157
|
+
if (hostname === domain || hostname.endsWith("." + domain)) return true;
|
|
520
158
|
}
|
|
521
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
522
|
-
if (env.hasError) throw env.error;
|
|
523
159
|
}
|
|
524
|
-
return
|
|
160
|
+
return false;
|
|
525
161
|
}
|
|
526
|
-
function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
527
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
528
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
529
|
-
});
|
|
530
|
-
return path;
|
|
531
|
-
}
|
|
532
|
-
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys$1, _SuppressedError, tslib_es6_default;
|
|
533
|
-
var init_tslib_es6 = __esmMin((() => {
|
|
534
|
-
extendStatics = function(d, b) {
|
|
535
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d$1, b$1) {
|
|
536
|
-
d$1.__proto__ = b$1;
|
|
537
|
-
} || function(d$1, b$1) {
|
|
538
|
-
for (var p in b$1) if (Object.prototype.hasOwnProperty.call(b$1, p)) d$1[p] = b$1[p];
|
|
539
|
-
};
|
|
540
|
-
return extendStatics(d, b);
|
|
541
|
-
};
|
|
542
|
-
__assign = function() {
|
|
543
|
-
__assign = Object.assign || function __assign$1(t) {
|
|
544
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
545
|
-
s = arguments[i];
|
|
546
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
547
|
-
}
|
|
548
|
-
return t;
|
|
549
|
-
};
|
|
550
|
-
return __assign.apply(this, arguments);
|
|
551
|
-
};
|
|
552
|
-
__createBinding = Object.create ? (function(o, m, k, k2) {
|
|
553
|
-
if (k2 === void 0) k2 = k;
|
|
554
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
555
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
556
|
-
enumerable: true,
|
|
557
|
-
get: function() {
|
|
558
|
-
return m[k];
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
Object.defineProperty(o, k2, desc);
|
|
562
|
-
}) : (function(o, m, k, k2) {
|
|
563
|
-
if (k2 === void 0) k2 = k;
|
|
564
|
-
o[k2] = m[k];
|
|
565
|
-
});
|
|
566
|
-
__setModuleDefault = Object.create ? (function(o, v) {
|
|
567
|
-
Object.defineProperty(o, "default", {
|
|
568
|
-
enumerable: true,
|
|
569
|
-
value: v
|
|
570
|
-
});
|
|
571
|
-
}) : function(o, v) {
|
|
572
|
-
o["default"] = v;
|
|
573
|
-
};
|
|
574
|
-
ownKeys$1 = function(o) {
|
|
575
|
-
ownKeys$1 = Object.getOwnPropertyNames || function(o$1) {
|
|
576
|
-
var ar = [];
|
|
577
|
-
for (var k in o$1) if (Object.prototype.hasOwnProperty.call(o$1, k)) ar[ar.length] = k;
|
|
578
|
-
return ar;
|
|
579
|
-
};
|
|
580
|
-
return ownKeys$1(o);
|
|
581
|
-
};
|
|
582
|
-
_SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
583
|
-
var e = new Error(message);
|
|
584
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
585
|
-
};
|
|
586
|
-
tslib_es6_default = {
|
|
587
|
-
__extends,
|
|
588
|
-
__assign,
|
|
589
|
-
__rest,
|
|
590
|
-
__decorate,
|
|
591
|
-
__param,
|
|
592
|
-
__esDecorate,
|
|
593
|
-
__runInitializers,
|
|
594
|
-
__propKey,
|
|
595
|
-
__setFunctionName,
|
|
596
|
-
__metadata,
|
|
597
|
-
__awaiter,
|
|
598
|
-
__generator,
|
|
599
|
-
__createBinding,
|
|
600
|
-
__exportStar,
|
|
601
|
-
__values,
|
|
602
|
-
__read,
|
|
603
|
-
__spread,
|
|
604
|
-
__spreadArrays,
|
|
605
|
-
__spreadArray,
|
|
606
|
-
__await,
|
|
607
|
-
__asyncGenerator,
|
|
608
|
-
__asyncDelegator,
|
|
609
|
-
__asyncValues,
|
|
610
|
-
__makeTemplateObject,
|
|
611
|
-
__importStar,
|
|
612
|
-
__importDefault,
|
|
613
|
-
__classPrivateFieldGet,
|
|
614
|
-
__classPrivateFieldSet,
|
|
615
|
-
__classPrivateFieldIn,
|
|
616
|
-
__addDisposableResource,
|
|
617
|
-
__disposeResources,
|
|
618
|
-
__rewriteRelativeImportExtension
|
|
619
|
-
};
|
|
620
|
-
}));
|
|
621
|
-
|
|
622
|
-
//#endregion
|
|
623
|
-
//#region ../../shared/tracing/dist/main/types.js
|
|
624
|
-
var require_types = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
625
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
626
|
-
}));
|
|
627
162
|
|
|
628
163
|
//#endregion
|
|
629
|
-
//#region ../../shared/tracing/dist/
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
* trace context. The dynamic import is cached after the first call.
|
|
654
|
-
*
|
|
655
|
-
* @returns Trace context with traceparent, tracestate, and baggage headers, or null if unavailable
|
|
656
|
-
*/
|
|
657
|
-
function extractTraceContext() {
|
|
658
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
659
|
-
try {
|
|
660
|
-
const otel = yield loadOtel();
|
|
661
|
-
if (!otel || !otel.propagation || !otel.context) return null;
|
|
662
|
-
const carrier = {};
|
|
663
|
-
otel.propagation.inject(otel.context.active(), carrier);
|
|
664
|
-
const traceparent = carrier["traceparent"];
|
|
665
|
-
if (!traceparent) return null;
|
|
666
|
-
return {
|
|
667
|
-
traceparent,
|
|
668
|
-
tracestate: carrier["tracestate"],
|
|
669
|
-
baggage: carrier["baggage"]
|
|
670
|
-
};
|
|
671
|
-
} catch (_a) {
|
|
672
|
-
return null;
|
|
673
|
-
}
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
}));
|
|
677
|
-
|
|
678
|
-
//#endregion
|
|
679
|
-
//#region ../../shared/tracing/dist/main/parse.js
|
|
680
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
681
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
682
|
-
exports.parseTraceParent = parseTraceParent;
|
|
683
|
-
/**
|
|
684
|
-
* Parse W3C traceparent header according to the specification.
|
|
685
|
-
*
|
|
686
|
-
* The traceparent header format is: version-traceid-parentid-traceflags
|
|
687
|
-
* - version: 2 hex digits (currently always "00")
|
|
688
|
-
* - traceid: 32 hex digits (128-bit trace identifier)
|
|
689
|
-
* - parentid: 16 hex digits (64-bit span/parent identifier)
|
|
690
|
-
* - traceflags: 2 hex digits (8-bit flags, bit 0 is sampled flag)
|
|
691
|
-
*
|
|
692
|
-
* @param traceparent - The traceparent header value
|
|
693
|
-
* @returns Parsed traceparent object, or null if invalid format
|
|
694
|
-
*
|
|
695
|
-
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
696
|
-
*
|
|
697
|
-
* @example
|
|
698
|
-
* ```typescript
|
|
699
|
-
* const parsed = parseTraceParent('00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01')
|
|
700
|
-
*
|
|
701
|
-
* console.log(parsed)
|
|
702
|
-
* // {
|
|
703
|
-
* // version: '00',
|
|
704
|
-
* // traceId: '0af7651916cd43dd8448eb211c80319c',
|
|
705
|
-
* // parentId: 'b7ad6b7169203331',
|
|
706
|
-
* // traceFlags: '01',
|
|
707
|
-
* // isSampled: true
|
|
708
|
-
* // }
|
|
709
|
-
* ```
|
|
710
|
-
*/
|
|
711
|
-
function parseTraceParent(traceparent) {
|
|
712
|
-
if (!traceparent || typeof traceparent !== "string") return null;
|
|
713
|
-
const parts = traceparent.split("-");
|
|
714
|
-
if (parts.length !== 4) return null;
|
|
715
|
-
const [version$1, traceId, parentId, traceFlags] = parts;
|
|
716
|
-
if (version$1.length !== 2 || traceId.length !== 32 || parentId.length !== 16 || traceFlags.length !== 2) return null;
|
|
717
|
-
const hexRegex = /^[0-9a-f]+$/i;
|
|
718
|
-
if (!hexRegex.test(version$1) || !hexRegex.test(traceId) || !hexRegex.test(parentId) || !hexRegex.test(traceFlags)) return null;
|
|
719
|
-
if (traceId === "00000000000000000000000000000000" || parentId === "0000000000000000") return null;
|
|
720
|
-
return {
|
|
721
|
-
version: version$1,
|
|
722
|
-
traceId,
|
|
723
|
-
parentId,
|
|
724
|
-
traceFlags,
|
|
725
|
-
isSampled: (parseInt(traceFlags, 16) & 1) === 1
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
}));
|
|
729
|
-
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region ../../shared/tracing/dist/main/validate.js
|
|
732
|
-
var require_validate = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
733
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
734
|
-
exports.shouldPropagateToTarget = shouldPropagateToTarget;
|
|
735
|
-
/**
|
|
736
|
-
* Check if trace context should be propagated to the target URL.
|
|
737
|
-
*
|
|
738
|
-
* This function checks if the target URL matches any of the configured
|
|
739
|
-
* propagation targets. Targets can be:
|
|
740
|
-
* - String: Exact hostname match or wildcard domain (*.example.com)
|
|
741
|
-
* - RegExp: Pattern matching hostname
|
|
742
|
-
* - Function: Custom logic to determine if URL should receive trace context
|
|
743
|
-
*
|
|
744
|
-
* @param targetUrl - The URL to check
|
|
745
|
-
* @param targets - Array of propagation targets
|
|
746
|
-
* @returns True if trace context should be propagated, false otherwise
|
|
747
|
-
*
|
|
748
|
-
* @example
|
|
749
|
-
* ```typescript
|
|
750
|
-
* const targets = [
|
|
751
|
-
* 'myproject.supabase.co', // Exact match
|
|
752
|
-
* '*.supabase.co', // Wildcard domain
|
|
753
|
-
* /.*\.supabase\.co$/, // Regex pattern
|
|
754
|
-
* (url) => url.hostname === 'localhost' // Custom function
|
|
755
|
-
* ]
|
|
756
|
-
*
|
|
757
|
-
* shouldPropagateToTarget('https://myproject.supabase.co/rest/v1/table', targets)
|
|
758
|
-
* // true
|
|
759
|
-
*
|
|
760
|
-
* shouldPropagateToTarget('https://evil.com/api', targets)
|
|
761
|
-
* // false
|
|
762
|
-
* ```
|
|
763
|
-
*/
|
|
764
|
-
function shouldPropagateToTarget(targetUrl, targets) {
|
|
765
|
-
if (!targetUrl || !targets || targets.length === 0) return false;
|
|
766
|
-
let url;
|
|
767
|
-
if (targetUrl instanceof URL) url = targetUrl;
|
|
768
|
-
else try {
|
|
769
|
-
url = new URL(targetUrl);
|
|
770
|
-
} catch (error) {
|
|
771
|
-
return false;
|
|
772
|
-
}
|
|
773
|
-
for (const target of targets) try {
|
|
774
|
-
if (typeof target === "string") {
|
|
775
|
-
if (matchStringTarget(url.hostname, target)) return true;
|
|
776
|
-
} else if (target instanceof RegExp) {
|
|
777
|
-
if (target.test(url.hostname)) return true;
|
|
778
|
-
} else if (typeof target === "function") {
|
|
779
|
-
if (target(url)) return true;
|
|
780
|
-
}
|
|
781
|
-
} catch (error) {
|
|
782
|
-
continue;
|
|
783
|
-
}
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
/**
|
|
787
|
-
* Match hostname against string target (exact match or wildcard)
|
|
788
|
-
*
|
|
789
|
-
* @param hostname - The hostname to check
|
|
790
|
-
* @param target - The target pattern (exact or wildcard)
|
|
791
|
-
* @returns True if hostname matches target
|
|
792
|
-
*/
|
|
793
|
-
function matchStringTarget(hostname, target) {
|
|
794
|
-
if (target === hostname) return true;
|
|
795
|
-
if (target.startsWith("*.")) {
|
|
796
|
-
const domain = target.slice(2);
|
|
797
|
-
if (hostname.endsWith(domain)) {
|
|
798
|
-
if (hostname === domain || hostname.endsWith("." + domain)) return true;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
return false;
|
|
802
|
-
}
|
|
803
|
-
}));
|
|
804
|
-
|
|
805
|
-
//#endregion
|
|
806
|
-
//#region ../../shared/tracing/dist/main/defaults.js
|
|
807
|
-
var require_defaults = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
808
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
809
|
-
exports.getDefaultPropagationTargets = getDefaultPropagationTargets;
|
|
810
|
-
/**
|
|
811
|
-
* Generate default propagation targets based on the Supabase project URL.
|
|
812
|
-
*
|
|
813
|
-
* By default, trace context is only propagated to Supabase domains for
|
|
814
|
-
* security. This prevents leaking trace context to potentially malicious
|
|
815
|
-
* third-party services.
|
|
816
|
-
*
|
|
817
|
-
* Wildcard strings (e.g. `*.supabase.co`) are matched with linear string
|
|
818
|
-
* operations rather than regex, avoiding ReDoS risk.
|
|
819
|
-
*
|
|
820
|
-
* @param supabaseUrl - The Supabase project URL
|
|
821
|
-
* @returns Array of default propagation targets
|
|
822
|
-
*/
|
|
823
|
-
function getDefaultPropagationTargets(supabaseUrl) {
|
|
824
|
-
const targets = [];
|
|
825
|
-
try {
|
|
826
|
-
const url = new URL(supabaseUrl);
|
|
827
|
-
targets.push(url.hostname);
|
|
828
|
-
} catch (error) {}
|
|
829
|
-
targets.push("*.supabase.co", "*.supabase.in");
|
|
830
|
-
targets.push("localhost", "127.0.0.1", "[::1]");
|
|
831
|
-
return targets;
|
|
832
|
-
}
|
|
833
|
-
}));
|
|
834
|
-
|
|
835
|
-
//#endregion
|
|
836
|
-
//#region ../../shared/tracing/dist/main/index.js
|
|
837
|
-
var require_main = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
838
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
839
|
-
const tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
840
|
-
tslib_1.__exportStar(require_types(), exports);
|
|
841
|
-
tslib_1.__exportStar(require_extract(), exports);
|
|
842
|
-
tslib_1.__exportStar(require_parse(), exports);
|
|
843
|
-
tslib_1.__exportStar(require_validate(), exports);
|
|
844
|
-
tslib_1.__exportStar(require_defaults(), exports);
|
|
845
|
-
}));
|
|
164
|
+
//#region ../../shared/tracing/dist/module/defaults.js
|
|
165
|
+
/**
|
|
166
|
+
* Generate default propagation targets based on the Supabase project URL.
|
|
167
|
+
*
|
|
168
|
+
* By default, trace context is only propagated to Supabase domains for
|
|
169
|
+
* security. This prevents leaking trace context to potentially malicious
|
|
170
|
+
* third-party services.
|
|
171
|
+
*
|
|
172
|
+
* Wildcard strings (e.g. `*.supabase.co`) are matched with linear string
|
|
173
|
+
* operations rather than regex, avoiding ReDoS risk.
|
|
174
|
+
*
|
|
175
|
+
* @param supabaseUrl - The Supabase project URL
|
|
176
|
+
* @returns Array of default propagation targets
|
|
177
|
+
*/
|
|
178
|
+
function getDefaultPropagationTargets(supabaseUrl) {
|
|
179
|
+
const targets = [];
|
|
180
|
+
try {
|
|
181
|
+
const url = new URL(supabaseUrl);
|
|
182
|
+
targets.push(url.hostname);
|
|
183
|
+
} catch (error) {}
|
|
184
|
+
targets.push("*.supabase.co", "*.supabase.in");
|
|
185
|
+
targets.push("localhost", "127.0.0.1", "[::1]");
|
|
186
|
+
return targets;
|
|
187
|
+
}
|
|
846
188
|
|
|
847
189
|
//#endregion
|
|
848
190
|
//#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js
|
|
849
|
-
var import_main = require_main();
|
|
850
191
|
function _typeof(o) {
|
|
851
192
|
"@babel/helpers - typeof";
|
|
852
193
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -947,7 +288,7 @@ const fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tr
|
|
|
947
288
|
const HeadersConstructor = resolveHeadersConstructor();
|
|
948
289
|
const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) === true;
|
|
949
290
|
const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== false;
|
|
950
|
-
const traceTargets = traceEnabled ?
|
|
291
|
+
const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null;
|
|
951
292
|
const allowKeyAsBearer = !((options === null || options === void 0 ? void 0 : options.omitApiKeyAsBearer) && isNewApiKey(supabaseKey));
|
|
952
293
|
return async (input, init) => {
|
|
953
294
|
const realToken = await getAccessToken();
|
|
@@ -958,7 +299,7 @@ const fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tr
|
|
|
958
299
|
if (bearer) headers.set("Authorization", `Bearer ${bearer}`);
|
|
959
300
|
}
|
|
960
301
|
if (traceTargets) {
|
|
961
|
-
const traceHeaders =
|
|
302
|
+
const traceHeaders = getTraceHeaders(input, traceTargets, respectSampling);
|
|
962
303
|
if (traceHeaders) {
|
|
963
304
|
if (traceHeaders.traceparent && !headers.has("traceparent")) headers.set("traceparent", traceHeaders.traceparent);
|
|
964
305
|
if (traceHeaders.tracestate && !headers.has("tracestate")) headers.set("tracestate", traceHeaders.tracestate);
|
|
@@ -968,12 +309,21 @@ const fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tr
|
|
|
968
309
|
return fetch$1(input, _objectSpread2(_objectSpread2({}, init), {}, { headers }));
|
|
969
310
|
};
|
|
970
311
|
};
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
const
|
|
312
|
+
let warnedMissingTracingRuntime = false;
|
|
313
|
+
function getTraceHeaders(input, targets, respectSampling) {
|
|
314
|
+
const extractTraceContext = require_tracingRegistry.getTraceContextExtractor();
|
|
315
|
+
if (!extractTraceContext) {
|
|
316
|
+
if (!warnedMissingTracingRuntime) {
|
|
317
|
+
warnedMissingTracingRuntime = true;
|
|
318
|
+
console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation.");
|
|
319
|
+
}
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
if (!shouldPropagateToTarget(typeof input === "string" ? input : input instanceof URL ? input : input.url, targets)) return null;
|
|
323
|
+
const traceContext = extractTraceContext();
|
|
974
324
|
if (!traceContext || !traceContext.traceparent) return null;
|
|
975
325
|
if (respectSampling) {
|
|
976
|
-
const parsed =
|
|
326
|
+
const parsed = parseTraceParent(traceContext.traceparent);
|
|
977
327
|
if (parsed && !parsed.isSampled) return null;
|
|
978
328
|
}
|
|
979
329
|
return traceContext;
|
|
@@ -1235,10 +585,12 @@ var SupabaseClient = class {
|
|
|
1235
585
|
* Opt in to W3C trace context propagation so the `trace_id` from your
|
|
1236
586
|
* client-side spans is attached to Supabase requests and appears in API
|
|
1237
587
|
* Gateway and Edge Function logs. Requires `@opentelemetry/api` to be
|
|
1238
|
-
* installed in your application
|
|
588
|
+
* installed in your application and the tracing runtime to be loaded via
|
|
589
|
+
* `import '@supabase/supabase-js/tracing'`. See [Tracing with the JS SDK](https://supabase.com/docs/guides/telemetry/client-side-tracing).
|
|
1239
590
|
*
|
|
1240
591
|
* @example With OpenTelemetry tracing
|
|
1241
592
|
* ```ts
|
|
593
|
+
* import '@supabase/supabase-js/tracing'
|
|
1242
594
|
* import { createClient } from '@supabase/supabase-js'
|
|
1243
595
|
* import { trace } from '@opentelemetry/api'
|
|
1244
596
|
*
|
|
@@ -1557,7 +909,6 @@ Object.defineProperty(exports, 'StorageApiError', {
|
|
|
1557
909
|
}
|
|
1558
910
|
});
|
|
1559
911
|
exports.SupabaseClient = SupabaseClient;
|
|
1560
|
-
exports.__toCommonJS = __toCommonJS;
|
|
1561
912
|
exports.createClient = createClient;
|
|
1562
913
|
Object.keys(_supabase_auth_js).forEach(function (k) {
|
|
1563
914
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|