@grekt/cli 6.32.0 → 6.33.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/dist/index.js +1104 -733
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -15751,8 +15751,8 @@ var require_tslib = __commonJS((exports2, module2) => {
|
|
|
15751
15751
|
try {
|
|
15752
15752
|
while ((n === undefined || n-- > 0) && !(r = i.next()).done)
|
|
15753
15753
|
ar.push(r.value);
|
|
15754
|
-
} catch (
|
|
15755
|
-
e = { error:
|
|
15754
|
+
} catch (error3) {
|
|
15755
|
+
e = { error: error3 };
|
|
15756
15756
|
} finally {
|
|
15757
15757
|
try {
|
|
15758
15758
|
if (r && !r.done && (m = i["return"]))
|
|
@@ -15960,9 +15960,9 @@ var require_tslib = __commonJS((exports2, module2) => {
|
|
|
15960
15960
|
}
|
|
15961
15961
|
return value;
|
|
15962
15962
|
};
|
|
15963
|
-
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(
|
|
15963
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error3, suppressed, message) {
|
|
15964
15964
|
var e = new Error(message);
|
|
15965
|
-
return e.name = "SuppressedError", e.error =
|
|
15965
|
+
return e.name = "SuppressedError", e.error = error3, e.suppressed = suppressed, e;
|
|
15966
15966
|
};
|
|
15967
15967
|
__disposeResources = function(env2) {
|
|
15968
15968
|
function fail(e) {
|
|
@@ -16201,11 +16201,11 @@ var require_FunctionsClient = __commonJS((exports2) => {
|
|
|
16201
16201
|
data = yield response.text();
|
|
16202
16202
|
}
|
|
16203
16203
|
return { data, error: null, response };
|
|
16204
|
-
} catch (
|
|
16204
|
+
} catch (error3) {
|
|
16205
16205
|
return {
|
|
16206
16206
|
data: null,
|
|
16207
|
-
error:
|
|
16208
|
-
response:
|
|
16207
|
+
error: error3,
|
|
16208
|
+
response: error3 instanceof types_1.FunctionsHttpError || error3 instanceof types_1.FunctionsRelayError ? error3.context : undefined
|
|
16209
16209
|
};
|
|
16210
16210
|
} finally {
|
|
16211
16211
|
if (timeoutId) {
|
|
@@ -17155,9 +17155,9 @@ var require_RealtimeChannel = __commonJS((exports2) => {
|
|
|
17155
17155
|
callback && callback(REALTIME_SUBSCRIBE_STATES.SUBSCRIBED);
|
|
17156
17156
|
return;
|
|
17157
17157
|
}
|
|
17158
|
-
}).receive("error", (
|
|
17158
|
+
}).receive("error", (error3) => {
|
|
17159
17159
|
this.state = constants_1.CHANNEL_STATES.errored;
|
|
17160
|
-
callback === null || callback === undefined || callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(JSON.stringify(Object.values(
|
|
17160
|
+
callback === null || callback === undefined || callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(JSON.stringify(Object.values(error3).join(", ") || "error")));
|
|
17161
17161
|
return;
|
|
17162
17162
|
}).receive("timeout", () => {
|
|
17163
17163
|
callback === null || callback === undefined || callback(REALTIME_SUBSCRIBE_STATES.TIMED_OUT);
|
|
@@ -17256,8 +17256,8 @@ var require_RealtimeChannel = __commonJS((exports2) => {
|
|
|
17256
17256
|
const response = await this._fetchWithTimeout(this.broadcastEndpointURL, options2, (_a = opts.timeout) !== null && _a !== undefined ? _a : this.timeout);
|
|
17257
17257
|
await ((_b = response.body) === null || _b === undefined ? undefined : _b.cancel());
|
|
17258
17258
|
return response.ok ? "ok" : "error";
|
|
17259
|
-
} catch (
|
|
17260
|
-
if (
|
|
17259
|
+
} catch (error3) {
|
|
17260
|
+
if (error3.name === "AbortError") {
|
|
17261
17261
|
return "timed out";
|
|
17262
17262
|
} else {
|
|
17263
17263
|
return "error";
|
|
@@ -17356,8 +17356,8 @@ var require_RealtimeChannel = __commonJS((exports2) => {
|
|
|
17356
17356
|
_trigger(type, payload, ref) {
|
|
17357
17357
|
var _a, _b;
|
|
17358
17358
|
const typeLower = type.toLocaleLowerCase();
|
|
17359
|
-
const { close, error:
|
|
17360
|
-
const events = [close,
|
|
17359
|
+
const { close, error: error3, leave, join: join6 } = constants_1.CHANNEL_EVENTS;
|
|
17360
|
+
const events = [close, error3, leave, join6];
|
|
17361
17361
|
if (ref && events.indexOf(typeLower) >= 0 && ref !== this._joinRef()) {
|
|
17362
17362
|
return;
|
|
17363
17363
|
}
|
|
@@ -17588,9 +17588,9 @@ var require_RealtimeClient = __commonJS((exports2) => {
|
|
|
17588
17588
|
} else {
|
|
17589
17589
|
try {
|
|
17590
17590
|
this.conn = websocket_factory_1.default.createWebSocket(this.endpointURL());
|
|
17591
|
-
} catch (
|
|
17591
|
+
} catch (error3) {
|
|
17592
17592
|
this._setConnectionState("disconnected");
|
|
17593
|
-
const errorMessage =
|
|
17593
|
+
const errorMessage = error3.message;
|
|
17594
17594
|
if (errorMessage.includes("Node.js")) {
|
|
17595
17595
|
throw new Error(`${errorMessage}
|
|
17596
17596
|
|
|
@@ -17829,7 +17829,7 @@ var require_RealtimeClient = __commonJS((exports2) => {
|
|
|
17829
17829
|
this.conn.binaryType = "arraybuffer";
|
|
17830
17830
|
}
|
|
17831
17831
|
this.conn.onopen = () => this._onConnOpen();
|
|
17832
|
-
this.conn.onerror = (
|
|
17832
|
+
this.conn.onerror = (error3) => this._onConnError(error3);
|
|
17833
17833
|
this.conn.onmessage = (event) => this._onConnMessage(event);
|
|
17834
17834
|
this.conn.onclose = (event) => this._onConnClose(event);
|
|
17835
17835
|
if (this.conn.readyState === constants_1.SOCKET_STATES.open) {
|
|
@@ -17887,8 +17887,8 @@ var require_RealtimeClient = __commonJS((exports2) => {
|
|
|
17887
17887
|
}
|
|
17888
17888
|
const objectUrl = this._workerObjectUrl(this.workerUrl);
|
|
17889
17889
|
this.workerRef = new Worker(objectUrl);
|
|
17890
|
-
this.workerRef.onerror = (
|
|
17891
|
-
this.log("worker", "worker error",
|
|
17890
|
+
this.workerRef.onerror = (error3) => {
|
|
17891
|
+
this.log("worker", "worker error", error3.message);
|
|
17892
17892
|
this._terminateWorker();
|
|
17893
17893
|
};
|
|
17894
17894
|
this.workerRef.onmessage = (event) => {
|
|
@@ -17919,11 +17919,11 @@ var require_RealtimeClient = __commonJS((exports2) => {
|
|
|
17919
17919
|
}
|
|
17920
17920
|
this._triggerStateCallbacks("close", event);
|
|
17921
17921
|
}
|
|
17922
|
-
_onConnError(
|
|
17922
|
+
_onConnError(error3) {
|
|
17923
17923
|
this._setConnectionState("disconnected");
|
|
17924
|
-
this.log("transport", `${
|
|
17924
|
+
this.log("transport", `${error3}`);
|
|
17925
17925
|
this._triggerChanError();
|
|
17926
|
-
this._triggerStateCallbacks("error",
|
|
17926
|
+
this._triggerStateCallbacks("error", error3);
|
|
17927
17927
|
try {
|
|
17928
17928
|
this.heartbeatCallback("error");
|
|
17929
17929
|
} catch (e) {
|
|
@@ -18164,8 +18164,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18164
18164
|
}
|
|
18165
18165
|
}
|
|
18166
18166
|
exports2.AuthError = AuthError;
|
|
18167
|
-
function isAuthError(
|
|
18168
|
-
return typeof
|
|
18167
|
+
function isAuthError(error3) {
|
|
18168
|
+
return typeof error3 === "object" && error3 !== null && "__isAuthError" in error3;
|
|
18169
18169
|
}
|
|
18170
18170
|
|
|
18171
18171
|
class AuthApiError extends AuthError {
|
|
@@ -18177,8 +18177,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18177
18177
|
}
|
|
18178
18178
|
}
|
|
18179
18179
|
exports2.AuthApiError = AuthApiError;
|
|
18180
|
-
function isAuthApiError(
|
|
18181
|
-
return isAuthError(
|
|
18180
|
+
function isAuthApiError(error3) {
|
|
18181
|
+
return isAuthError(error3) && error3.name === "AuthApiError";
|
|
18182
18182
|
}
|
|
18183
18183
|
|
|
18184
18184
|
class AuthUnknownError extends AuthError {
|
|
@@ -18205,8 +18205,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18205
18205
|
}
|
|
18206
18206
|
}
|
|
18207
18207
|
exports2.AuthSessionMissingError = AuthSessionMissingError;
|
|
18208
|
-
function isAuthSessionMissingError(
|
|
18209
|
-
return isAuthError(
|
|
18208
|
+
function isAuthSessionMissingError(error3) {
|
|
18209
|
+
return isAuthError(error3) && error3.name === "AuthSessionMissingError";
|
|
18210
18210
|
}
|
|
18211
18211
|
|
|
18212
18212
|
class AuthInvalidTokenResponseError extends CustomAuthError {
|
|
@@ -18239,8 +18239,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18239
18239
|
}
|
|
18240
18240
|
}
|
|
18241
18241
|
exports2.AuthImplicitGrantRedirectError = AuthImplicitGrantRedirectError;
|
|
18242
|
-
function isAuthImplicitGrantRedirectError(
|
|
18243
|
-
return isAuthError(
|
|
18242
|
+
function isAuthImplicitGrantRedirectError(error3) {
|
|
18243
|
+
return isAuthError(error3) && error3.name === "AuthImplicitGrantRedirectError";
|
|
18244
18244
|
}
|
|
18245
18245
|
|
|
18246
18246
|
class AuthPKCEGrantCodeExchangeError extends CustomAuthError {
|
|
@@ -18266,8 +18266,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18266
18266
|
}
|
|
18267
18267
|
}
|
|
18268
18268
|
exports2.AuthPKCECodeVerifierMissingError = AuthPKCECodeVerifierMissingError;
|
|
18269
|
-
function isAuthPKCECodeVerifierMissingError(
|
|
18270
|
-
return isAuthError(
|
|
18269
|
+
function isAuthPKCECodeVerifierMissingError(error3) {
|
|
18270
|
+
return isAuthError(error3) && error3.name === "AuthPKCECodeVerifierMissingError";
|
|
18271
18271
|
}
|
|
18272
18272
|
|
|
18273
18273
|
class AuthRetryableFetchError extends CustomAuthError {
|
|
@@ -18276,8 +18276,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18276
18276
|
}
|
|
18277
18277
|
}
|
|
18278
18278
|
exports2.AuthRetryableFetchError = AuthRetryableFetchError;
|
|
18279
|
-
function isAuthRetryableFetchError(
|
|
18280
|
-
return isAuthError(
|
|
18279
|
+
function isAuthRetryableFetchError(error3) {
|
|
18280
|
+
return isAuthError(error3) && error3.name === "AuthRetryableFetchError";
|
|
18281
18281
|
}
|
|
18282
18282
|
|
|
18283
18283
|
class AuthWeakPasswordError extends CustomAuthError {
|
|
@@ -18287,8 +18287,8 @@ var require_errors3 = __commonJS((exports2) => {
|
|
|
18287
18287
|
}
|
|
18288
18288
|
}
|
|
18289
18289
|
exports2.AuthWeakPasswordError = AuthWeakPasswordError;
|
|
18290
|
-
function isAuthWeakPasswordError(
|
|
18291
|
-
return isAuthError(
|
|
18290
|
+
function isAuthWeakPasswordError(error3) {
|
|
18291
|
+
return isAuthError(error3) && error3.name === "AuthWeakPasswordError";
|
|
18292
18292
|
}
|
|
18293
18293
|
|
|
18294
18294
|
class AuthInvalidJwtError extends CustomAuthError {
|
|
@@ -18813,22 +18813,22 @@ var require_fetch = __commonJS((exports2) => {
|
|
|
18813
18813
|
var errors_1 = require_errors3();
|
|
18814
18814
|
var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
|
|
18815
18815
|
var NETWORK_ERROR_CODES = [502, 503, 504];
|
|
18816
|
-
async function handleError2(
|
|
18816
|
+
async function handleError2(error3) {
|
|
18817
18817
|
var _a;
|
|
18818
|
-
if (!(0, helpers_1.looksLikeFetchResponse)(
|
|
18819
|
-
throw new errors_1.AuthRetryableFetchError(_getErrorMessage2(
|
|
18818
|
+
if (!(0, helpers_1.looksLikeFetchResponse)(error3)) {
|
|
18819
|
+
throw new errors_1.AuthRetryableFetchError(_getErrorMessage2(error3), 0);
|
|
18820
18820
|
}
|
|
18821
|
-
if (NETWORK_ERROR_CODES.includes(
|
|
18822
|
-
throw new errors_1.AuthRetryableFetchError(_getErrorMessage2(
|
|
18821
|
+
if (NETWORK_ERROR_CODES.includes(error3.status)) {
|
|
18822
|
+
throw new errors_1.AuthRetryableFetchError(_getErrorMessage2(error3), error3.status);
|
|
18823
18823
|
}
|
|
18824
18824
|
let data;
|
|
18825
18825
|
try {
|
|
18826
|
-
data = await
|
|
18826
|
+
data = await error3.json();
|
|
18827
18827
|
} catch (e) {
|
|
18828
18828
|
throw new errors_1.AuthUnknownError(_getErrorMessage2(e), e);
|
|
18829
18829
|
}
|
|
18830
18830
|
let errorCode = undefined;
|
|
18831
|
-
const responseAPIVersion = (0, helpers_1.parseResponseAPIVersion)(
|
|
18831
|
+
const responseAPIVersion = (0, helpers_1.parseResponseAPIVersion)(error3);
|
|
18832
18832
|
if (responseAPIVersion && responseAPIVersion.getTime() >= constants_1.API_VERSIONS["2024-01-01"].timestamp && typeof data === "object" && data && typeof data.code === "string") {
|
|
18833
18833
|
errorCode = data.code;
|
|
18834
18834
|
} else if (typeof data === "object" && data && typeof data.error_code === "string") {
|
|
@@ -18836,14 +18836,14 @@ var require_fetch = __commonJS((exports2) => {
|
|
|
18836
18836
|
}
|
|
18837
18837
|
if (!errorCode) {
|
|
18838
18838
|
if (typeof data === "object" && data && typeof data.weak_password === "object" && data.weak_password && Array.isArray(data.weak_password.reasons) && data.weak_password.reasons.length && data.weak_password.reasons.reduce((a, i) => a && typeof i === "string", true)) {
|
|
18839
|
-
throw new errors_1.AuthWeakPasswordError(_getErrorMessage2(data),
|
|
18839
|
+
throw new errors_1.AuthWeakPasswordError(_getErrorMessage2(data), error3.status, data.weak_password.reasons);
|
|
18840
18840
|
}
|
|
18841
18841
|
} else if (errorCode === "weak_password") {
|
|
18842
|
-
throw new errors_1.AuthWeakPasswordError(_getErrorMessage2(data),
|
|
18842
|
+
throw new errors_1.AuthWeakPasswordError(_getErrorMessage2(data), error3.status, ((_a = data.weak_password) === null || _a === undefined ? undefined : _a.reasons) || []);
|
|
18843
18843
|
} else if (errorCode === "session_not_found") {
|
|
18844
18844
|
throw new errors_1.AuthSessionMissingError;
|
|
18845
18845
|
}
|
|
18846
|
-
throw new errors_1.AuthApiError(_getErrorMessage2(data),
|
|
18846
|
+
throw new errors_1.AuthApiError(_getErrorMessage2(data), error3.status || 500, errorCode);
|
|
18847
18847
|
}
|
|
18848
18848
|
var _getRequestParams2 = (method, options2, parameters, body) => {
|
|
18849
18849
|
const params = { method, headers: (options2 === null || options2 === undefined ? undefined : options2.headers) || {} };
|
|
@@ -18993,11 +18993,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
18993
18993
|
noResolveJson: true
|
|
18994
18994
|
});
|
|
18995
18995
|
return { data: null, error: null };
|
|
18996
|
-
} catch (
|
|
18997
|
-
if ((0, errors_1.isAuthError)(
|
|
18998
|
-
return { data: null, error:
|
|
18996
|
+
} catch (error3) {
|
|
18997
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
18998
|
+
return { data: null, error: error3 };
|
|
18999
18999
|
}
|
|
19000
|
-
throw
|
|
19000
|
+
throw error3;
|
|
19001
19001
|
}
|
|
19002
19002
|
}
|
|
19003
19003
|
async inviteUserByEmail(email, options2 = {}) {
|
|
@@ -19008,11 +19008,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19008
19008
|
redirectTo: options2.redirectTo,
|
|
19009
19009
|
xform: fetch_1._userResponse
|
|
19010
19010
|
});
|
|
19011
|
-
} catch (
|
|
19012
|
-
if ((0, errors_1.isAuthError)(
|
|
19013
|
-
return { data: { user: null }, error:
|
|
19011
|
+
} catch (error3) {
|
|
19012
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19013
|
+
return { data: { user: null }, error: error3 };
|
|
19014
19014
|
}
|
|
19015
|
-
throw
|
|
19015
|
+
throw error3;
|
|
19016
19016
|
}
|
|
19017
19017
|
}
|
|
19018
19018
|
async generateLink(params) {
|
|
@@ -19029,17 +19029,17 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19029
19029
|
xform: fetch_1._generateLinkResponse,
|
|
19030
19030
|
redirectTo: options2 === null || options2 === undefined ? undefined : options2.redirectTo
|
|
19031
19031
|
});
|
|
19032
|
-
} catch (
|
|
19033
|
-
if ((0, errors_1.isAuthError)(
|
|
19032
|
+
} catch (error3) {
|
|
19033
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19034
19034
|
return {
|
|
19035
19035
|
data: {
|
|
19036
19036
|
properties: null,
|
|
19037
19037
|
user: null
|
|
19038
19038
|
},
|
|
19039
|
-
error:
|
|
19039
|
+
error: error3
|
|
19040
19040
|
};
|
|
19041
19041
|
}
|
|
19042
|
-
throw
|
|
19042
|
+
throw error3;
|
|
19043
19043
|
}
|
|
19044
19044
|
}
|
|
19045
19045
|
async createUser(attributes) {
|
|
@@ -19049,11 +19049,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19049
19049
|
headers: this.headers,
|
|
19050
19050
|
xform: fetch_1._userResponse
|
|
19051
19051
|
});
|
|
19052
|
-
} catch (
|
|
19053
|
-
if ((0, errors_1.isAuthError)(
|
|
19054
|
-
return { data: { user: null }, error:
|
|
19052
|
+
} catch (error3) {
|
|
19053
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19054
|
+
return { data: { user: null }, error: error3 };
|
|
19055
19055
|
}
|
|
19056
|
-
throw
|
|
19056
|
+
throw error3;
|
|
19057
19057
|
}
|
|
19058
19058
|
}
|
|
19059
19059
|
async listUsers(params) {
|
|
@@ -19083,11 +19083,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19083
19083
|
pagination.total = parseInt(total);
|
|
19084
19084
|
}
|
|
19085
19085
|
return { data: Object.assign(Object.assign({}, users), pagination), error: null };
|
|
19086
|
-
} catch (
|
|
19087
|
-
if ((0, errors_1.isAuthError)(
|
|
19088
|
-
return { data: { users: [] }, error:
|
|
19086
|
+
} catch (error3) {
|
|
19087
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19088
|
+
return { data: { users: [] }, error: error3 };
|
|
19089
19089
|
}
|
|
19090
|
-
throw
|
|
19090
|
+
throw error3;
|
|
19091
19091
|
}
|
|
19092
19092
|
}
|
|
19093
19093
|
async getUserById(uid) {
|
|
@@ -19097,11 +19097,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19097
19097
|
headers: this.headers,
|
|
19098
19098
|
xform: fetch_1._userResponse
|
|
19099
19099
|
});
|
|
19100
|
-
} catch (
|
|
19101
|
-
if ((0, errors_1.isAuthError)(
|
|
19102
|
-
return { data: { user: null }, error:
|
|
19100
|
+
} catch (error3) {
|
|
19101
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19102
|
+
return { data: { user: null }, error: error3 };
|
|
19103
19103
|
}
|
|
19104
|
-
throw
|
|
19104
|
+
throw error3;
|
|
19105
19105
|
}
|
|
19106
19106
|
}
|
|
19107
19107
|
async updateUserById(uid, attributes) {
|
|
@@ -19112,11 +19112,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19112
19112
|
headers: this.headers,
|
|
19113
19113
|
xform: fetch_1._userResponse
|
|
19114
19114
|
});
|
|
19115
|
-
} catch (
|
|
19116
|
-
if ((0, errors_1.isAuthError)(
|
|
19117
|
-
return { data: { user: null }, error:
|
|
19115
|
+
} catch (error3) {
|
|
19116
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19117
|
+
return { data: { user: null }, error: error3 };
|
|
19118
19118
|
}
|
|
19119
|
-
throw
|
|
19119
|
+
throw error3;
|
|
19120
19120
|
}
|
|
19121
19121
|
}
|
|
19122
19122
|
async deleteUser(id, shouldSoftDelete = false) {
|
|
@@ -19129,28 +19129,28 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19129
19129
|
},
|
|
19130
19130
|
xform: fetch_1._userResponse
|
|
19131
19131
|
});
|
|
19132
|
-
} catch (
|
|
19133
|
-
if ((0, errors_1.isAuthError)(
|
|
19134
|
-
return { data: { user: null }, error:
|
|
19132
|
+
} catch (error3) {
|
|
19133
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19134
|
+
return { data: { user: null }, error: error3 };
|
|
19135
19135
|
}
|
|
19136
|
-
throw
|
|
19136
|
+
throw error3;
|
|
19137
19137
|
}
|
|
19138
19138
|
}
|
|
19139
19139
|
async _listFactors(params) {
|
|
19140
19140
|
(0, helpers_1.validateUUID)(params.userId);
|
|
19141
19141
|
try {
|
|
19142
|
-
const { data, error:
|
|
19142
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/admin/users/${params.userId}/factors`, {
|
|
19143
19143
|
headers: this.headers,
|
|
19144
19144
|
xform: (factors) => {
|
|
19145
19145
|
return { data: { factors }, error: null };
|
|
19146
19146
|
}
|
|
19147
19147
|
});
|
|
19148
|
-
return { data, error:
|
|
19149
|
-
} catch (
|
|
19150
|
-
if ((0, errors_1.isAuthError)(
|
|
19151
|
-
return { data: null, error:
|
|
19148
|
+
return { data, error: error3 };
|
|
19149
|
+
} catch (error3) {
|
|
19150
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19151
|
+
return { data: null, error: error3 };
|
|
19152
19152
|
}
|
|
19153
|
-
throw
|
|
19153
|
+
throw error3;
|
|
19154
19154
|
}
|
|
19155
19155
|
}
|
|
19156
19156
|
async _deleteFactor(params) {
|
|
@@ -19161,11 +19161,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19161
19161
|
headers: this.headers
|
|
19162
19162
|
});
|
|
19163
19163
|
return { data, error: null };
|
|
19164
|
-
} catch (
|
|
19165
|
-
if ((0, errors_1.isAuthError)(
|
|
19166
|
-
return { data: null, error:
|
|
19164
|
+
} catch (error3) {
|
|
19165
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19166
|
+
return { data: null, error: error3 };
|
|
19167
19167
|
}
|
|
19168
|
-
throw
|
|
19168
|
+
throw error3;
|
|
19169
19169
|
}
|
|
19170
19170
|
}
|
|
19171
19171
|
async _listOAuthClients(params) {
|
|
@@ -19195,11 +19195,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19195
19195
|
pagination.total = parseInt(total);
|
|
19196
19196
|
}
|
|
19197
19197
|
return { data: Object.assign(Object.assign({}, clients), pagination), error: null };
|
|
19198
|
-
} catch (
|
|
19199
|
-
if ((0, errors_1.isAuthError)(
|
|
19200
|
-
return { data: { clients: [] }, error:
|
|
19198
|
+
} catch (error3) {
|
|
19199
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19200
|
+
return { data: { clients: [] }, error: error3 };
|
|
19201
19201
|
}
|
|
19202
|
-
throw
|
|
19202
|
+
throw error3;
|
|
19203
19203
|
}
|
|
19204
19204
|
}
|
|
19205
19205
|
async _createOAuthClient(params) {
|
|
@@ -19211,11 +19211,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19211
19211
|
return { data: client, error: null };
|
|
19212
19212
|
}
|
|
19213
19213
|
});
|
|
19214
|
-
} catch (
|
|
19215
|
-
if ((0, errors_1.isAuthError)(
|
|
19216
|
-
return { data: null, error:
|
|
19214
|
+
} catch (error3) {
|
|
19215
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19216
|
+
return { data: null, error: error3 };
|
|
19217
19217
|
}
|
|
19218
|
-
throw
|
|
19218
|
+
throw error3;
|
|
19219
19219
|
}
|
|
19220
19220
|
}
|
|
19221
19221
|
async _getOAuthClient(clientId) {
|
|
@@ -19226,11 +19226,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19226
19226
|
return { data: client, error: null };
|
|
19227
19227
|
}
|
|
19228
19228
|
});
|
|
19229
|
-
} catch (
|
|
19230
|
-
if ((0, errors_1.isAuthError)(
|
|
19231
|
-
return { data: null, error:
|
|
19229
|
+
} catch (error3) {
|
|
19230
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19231
|
+
return { data: null, error: error3 };
|
|
19232
19232
|
}
|
|
19233
|
-
throw
|
|
19233
|
+
throw error3;
|
|
19234
19234
|
}
|
|
19235
19235
|
}
|
|
19236
19236
|
async _updateOAuthClient(clientId, params) {
|
|
@@ -19242,11 +19242,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19242
19242
|
return { data: client, error: null };
|
|
19243
19243
|
}
|
|
19244
19244
|
});
|
|
19245
|
-
} catch (
|
|
19246
|
-
if ((0, errors_1.isAuthError)(
|
|
19247
|
-
return { data: null, error:
|
|
19245
|
+
} catch (error3) {
|
|
19246
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19247
|
+
return { data: null, error: error3 };
|
|
19248
19248
|
}
|
|
19249
|
-
throw
|
|
19249
|
+
throw error3;
|
|
19250
19250
|
}
|
|
19251
19251
|
}
|
|
19252
19252
|
async _deleteOAuthClient(clientId) {
|
|
@@ -19256,11 +19256,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19256
19256
|
noResolveJson: true
|
|
19257
19257
|
});
|
|
19258
19258
|
return { data: null, error: null };
|
|
19259
|
-
} catch (
|
|
19260
|
-
if ((0, errors_1.isAuthError)(
|
|
19261
|
-
return { data: null, error:
|
|
19259
|
+
} catch (error3) {
|
|
19260
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19261
|
+
return { data: null, error: error3 };
|
|
19262
19262
|
}
|
|
19263
|
-
throw
|
|
19263
|
+
throw error3;
|
|
19264
19264
|
}
|
|
19265
19265
|
}
|
|
19266
19266
|
async _regenerateOAuthClientSecret(clientId) {
|
|
@@ -19271,11 +19271,11 @@ var require_GoTrueAdminApi = __commonJS((exports2) => {
|
|
|
19271
19271
|
return { data: client, error: null };
|
|
19272
19272
|
}
|
|
19273
19273
|
});
|
|
19274
|
-
} catch (
|
|
19275
|
-
if ((0, errors_1.isAuthError)(
|
|
19276
|
-
return { data: null, error:
|
|
19274
|
+
} catch (error3) {
|
|
19275
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
19276
|
+
return { data: null, error: error3 };
|
|
19277
19277
|
}
|
|
19278
|
-
throw
|
|
19278
|
+
throw error3;
|
|
19279
19279
|
}
|
|
19280
19280
|
}
|
|
19281
19281
|
}
|
|
@@ -19545,150 +19545,150 @@ var require_webauthn_errors = __commonJS((exports2) => {
|
|
|
19545
19545
|
}
|
|
19546
19546
|
}
|
|
19547
19547
|
exports2.WebAuthnUnknownError = WebAuthnUnknownError;
|
|
19548
|
-
function isWebAuthnError(
|
|
19549
|
-
return typeof
|
|
19548
|
+
function isWebAuthnError(error3) {
|
|
19549
|
+
return typeof error3 === "object" && error3 !== null && "__isWebAuthnError" in error3;
|
|
19550
19550
|
}
|
|
19551
|
-
function identifyRegistrationError({ error:
|
|
19551
|
+
function identifyRegistrationError({ error: error3, options: options2 }) {
|
|
19552
19552
|
var _a, _b, _c;
|
|
19553
19553
|
const { publicKey } = options2;
|
|
19554
19554
|
if (!publicKey) {
|
|
19555
19555
|
throw Error("options was missing required publicKey property");
|
|
19556
19556
|
}
|
|
19557
|
-
if (
|
|
19557
|
+
if (error3.name === "AbortError") {
|
|
19558
19558
|
if (options2.signal instanceof AbortSignal) {
|
|
19559
19559
|
return new WebAuthnError({
|
|
19560
19560
|
message: "Registration ceremony was sent an abort signal",
|
|
19561
19561
|
code: "ERROR_CEREMONY_ABORTED",
|
|
19562
|
-
cause:
|
|
19562
|
+
cause: error3
|
|
19563
19563
|
});
|
|
19564
19564
|
}
|
|
19565
|
-
} else if (
|
|
19565
|
+
} else if (error3.name === "ConstraintError") {
|
|
19566
19566
|
if (((_a = publicKey.authenticatorSelection) === null || _a === undefined ? undefined : _a.requireResidentKey) === true) {
|
|
19567
19567
|
return new WebAuthnError({
|
|
19568
19568
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
19569
19569
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
19570
|
-
cause:
|
|
19570
|
+
cause: error3
|
|
19571
19571
|
});
|
|
19572
19572
|
} else if (options2.mediation === "conditional" && ((_b = publicKey.authenticatorSelection) === null || _b === undefined ? undefined : _b.userVerification) === "required") {
|
|
19573
19573
|
return new WebAuthnError({
|
|
19574
19574
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
19575
19575
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
19576
|
-
cause:
|
|
19576
|
+
cause: error3
|
|
19577
19577
|
});
|
|
19578
19578
|
} else if (((_c = publicKey.authenticatorSelection) === null || _c === undefined ? undefined : _c.userVerification) === "required") {
|
|
19579
19579
|
return new WebAuthnError({
|
|
19580
19580
|
message: "User verification was required but no available authenticator supported it",
|
|
19581
19581
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
19582
|
-
cause:
|
|
19582
|
+
cause: error3
|
|
19583
19583
|
});
|
|
19584
19584
|
}
|
|
19585
|
-
} else if (
|
|
19585
|
+
} else if (error3.name === "InvalidStateError") {
|
|
19586
19586
|
return new WebAuthnError({
|
|
19587
19587
|
message: "The authenticator was previously registered",
|
|
19588
19588
|
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
19589
|
-
cause:
|
|
19589
|
+
cause: error3
|
|
19590
19590
|
});
|
|
19591
|
-
} else if (
|
|
19591
|
+
} else if (error3.name === "NotAllowedError") {
|
|
19592
19592
|
return new WebAuthnError({
|
|
19593
|
-
message:
|
|
19593
|
+
message: error3.message,
|
|
19594
19594
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
19595
|
-
cause:
|
|
19595
|
+
cause: error3
|
|
19596
19596
|
});
|
|
19597
|
-
} else if (
|
|
19597
|
+
} else if (error3.name === "NotSupportedError") {
|
|
19598
19598
|
const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === "public-key");
|
|
19599
19599
|
if (validPubKeyCredParams.length === 0) {
|
|
19600
19600
|
return new WebAuthnError({
|
|
19601
19601
|
message: 'No entry in pubKeyCredParams was of type "public-key"',
|
|
19602
19602
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
19603
|
-
cause:
|
|
19603
|
+
cause: error3
|
|
19604
19604
|
});
|
|
19605
19605
|
}
|
|
19606
19606
|
return new WebAuthnError({
|
|
19607
19607
|
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
19608
19608
|
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
19609
|
-
cause:
|
|
19609
|
+
cause: error3
|
|
19610
19610
|
});
|
|
19611
|
-
} else if (
|
|
19611
|
+
} else if (error3.name === "SecurityError") {
|
|
19612
19612
|
const effectiveDomain = window.location.hostname;
|
|
19613
19613
|
if (!(0, webauthn_1.isValidDomain)(effectiveDomain)) {
|
|
19614
19614
|
return new WebAuthnError({
|
|
19615
19615
|
message: `${window.location.hostname} is an invalid domain`,
|
|
19616
19616
|
code: "ERROR_INVALID_DOMAIN",
|
|
19617
|
-
cause:
|
|
19617
|
+
cause: error3
|
|
19618
19618
|
});
|
|
19619
19619
|
} else if (publicKey.rp.id !== effectiveDomain) {
|
|
19620
19620
|
return new WebAuthnError({
|
|
19621
19621
|
message: `The RP ID "${publicKey.rp.id}" is invalid for this domain`,
|
|
19622
19622
|
code: "ERROR_INVALID_RP_ID",
|
|
19623
|
-
cause:
|
|
19623
|
+
cause: error3
|
|
19624
19624
|
});
|
|
19625
19625
|
}
|
|
19626
|
-
} else if (
|
|
19626
|
+
} else if (error3.name === "TypeError") {
|
|
19627
19627
|
if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {
|
|
19628
19628
|
return new WebAuthnError({
|
|
19629
19629
|
message: "User ID was not between 1 and 64 characters",
|
|
19630
19630
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
19631
|
-
cause:
|
|
19631
|
+
cause: error3
|
|
19632
19632
|
});
|
|
19633
19633
|
}
|
|
19634
|
-
} else if (
|
|
19634
|
+
} else if (error3.name === "UnknownError") {
|
|
19635
19635
|
return new WebAuthnError({
|
|
19636
19636
|
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
19637
19637
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
19638
|
-
cause:
|
|
19638
|
+
cause: error3
|
|
19639
19639
|
});
|
|
19640
19640
|
}
|
|
19641
19641
|
return new WebAuthnError({
|
|
19642
19642
|
message: "a Non-Webauthn related error has occurred",
|
|
19643
19643
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
19644
|
-
cause:
|
|
19644
|
+
cause: error3
|
|
19645
19645
|
});
|
|
19646
19646
|
}
|
|
19647
|
-
function identifyAuthenticationError({ error:
|
|
19647
|
+
function identifyAuthenticationError({ error: error3, options: options2 }) {
|
|
19648
19648
|
const { publicKey } = options2;
|
|
19649
19649
|
if (!publicKey) {
|
|
19650
19650
|
throw Error("options was missing required publicKey property");
|
|
19651
19651
|
}
|
|
19652
|
-
if (
|
|
19652
|
+
if (error3.name === "AbortError") {
|
|
19653
19653
|
if (options2.signal instanceof AbortSignal) {
|
|
19654
19654
|
return new WebAuthnError({
|
|
19655
19655
|
message: "Authentication ceremony was sent an abort signal",
|
|
19656
19656
|
code: "ERROR_CEREMONY_ABORTED",
|
|
19657
|
-
cause:
|
|
19657
|
+
cause: error3
|
|
19658
19658
|
});
|
|
19659
19659
|
}
|
|
19660
|
-
} else if (
|
|
19660
|
+
} else if (error3.name === "NotAllowedError") {
|
|
19661
19661
|
return new WebAuthnError({
|
|
19662
|
-
message:
|
|
19662
|
+
message: error3.message,
|
|
19663
19663
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
19664
|
-
cause:
|
|
19664
|
+
cause: error3
|
|
19665
19665
|
});
|
|
19666
|
-
} else if (
|
|
19666
|
+
} else if (error3.name === "SecurityError") {
|
|
19667
19667
|
const effectiveDomain = window.location.hostname;
|
|
19668
19668
|
if (!(0, webauthn_1.isValidDomain)(effectiveDomain)) {
|
|
19669
19669
|
return new WebAuthnError({
|
|
19670
19670
|
message: `${window.location.hostname} is an invalid domain`,
|
|
19671
19671
|
code: "ERROR_INVALID_DOMAIN",
|
|
19672
|
-
cause:
|
|
19672
|
+
cause: error3
|
|
19673
19673
|
});
|
|
19674
19674
|
} else if (publicKey.rpId !== effectiveDomain) {
|
|
19675
19675
|
return new WebAuthnError({
|
|
19676
19676
|
message: `The RP ID "${publicKey.rpId}" is invalid for this domain`,
|
|
19677
19677
|
code: "ERROR_INVALID_RP_ID",
|
|
19678
|
-
cause:
|
|
19678
|
+
cause: error3
|
|
19679
19679
|
});
|
|
19680
19680
|
}
|
|
19681
|
-
} else if (
|
|
19681
|
+
} else if (error3.name === "UnknownError") {
|
|
19682
19682
|
return new WebAuthnError({
|
|
19683
19683
|
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
19684
19684
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
19685
|
-
cause:
|
|
19685
|
+
cause: error3
|
|
19686
19686
|
});
|
|
19687
19687
|
}
|
|
19688
19688
|
return new WebAuthnError({
|
|
19689
19689
|
message: "a Non-Webauthn related error has occurred",
|
|
19690
19690
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
19691
|
-
cause:
|
|
19691
|
+
cause: error3
|
|
19692
19692
|
});
|
|
19693
19693
|
}
|
|
19694
19694
|
});
|
|
@@ -19989,7 +19989,7 @@ var require_webauthn = __commonJS((exports2) => {
|
|
|
19989
19989
|
switch (challengeResponse.webauthn.type) {
|
|
19990
19990
|
case "create": {
|
|
19991
19991
|
const options2 = mergeCredentialCreationOptions(challengeResponse.webauthn.credential_options.publicKey, overrides === null || overrides === undefined ? undefined : overrides.create);
|
|
19992
|
-
const { data, error:
|
|
19992
|
+
const { data, error: error3 } = await createCredential({
|
|
19993
19993
|
publicKey: options2,
|
|
19994
19994
|
signal: abortSignal
|
|
19995
19995
|
});
|
|
@@ -20006,11 +20006,11 @@ var require_webauthn = __commonJS((exports2) => {
|
|
|
20006
20006
|
error: null
|
|
20007
20007
|
};
|
|
20008
20008
|
}
|
|
20009
|
-
return { data: null, error:
|
|
20009
|
+
return { data: null, error: error3 };
|
|
20010
20010
|
}
|
|
20011
20011
|
case "request": {
|
|
20012
20012
|
const options2 = mergeCredentialRequestOptions(challengeResponse.webauthn.credential_options.publicKey, overrides === null || overrides === undefined ? undefined : overrides.request);
|
|
20013
|
-
const { data, error:
|
|
20013
|
+
const { data, error: error3 } = await getCredential(Object.assign(Object.assign({}, challengeResponse.webauthn.credential_options), { publicKey: options2, signal: abortSignal }));
|
|
20014
20014
|
if (data) {
|
|
20015
20015
|
return {
|
|
20016
20016
|
data: {
|
|
@@ -20024,16 +20024,16 @@ var require_webauthn = __commonJS((exports2) => {
|
|
|
20024
20024
|
error: null
|
|
20025
20025
|
};
|
|
20026
20026
|
}
|
|
20027
|
-
return { data: null, error:
|
|
20027
|
+
return { data: null, error: error3 };
|
|
20028
20028
|
}
|
|
20029
20029
|
}
|
|
20030
|
-
} catch (
|
|
20031
|
-
if ((0, errors_1.isAuthError)(
|
|
20032
|
-
return { data: null, error:
|
|
20030
|
+
} catch (error3) {
|
|
20031
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20032
|
+
return { data: null, error: error3 };
|
|
20033
20033
|
}
|
|
20034
20034
|
return {
|
|
20035
20035
|
data: null,
|
|
20036
|
-
error: new errors_1.AuthUnknownError("Unexpected error in challenge",
|
|
20036
|
+
error: new errors_1.AuthUnknownError("Unexpected error in challenge", error3)
|
|
20037
20037
|
};
|
|
20038
20038
|
}
|
|
20039
20039
|
}
|
|
@@ -20077,13 +20077,13 @@ var require_webauthn = __commonJS((exports2) => {
|
|
|
20077
20077
|
credential_response: webauthn.credential_response
|
|
20078
20078
|
}
|
|
20079
20079
|
});
|
|
20080
|
-
} catch (
|
|
20081
|
-
if ((0, errors_1.isAuthError)(
|
|
20082
|
-
return { data: null, error:
|
|
20080
|
+
} catch (error3) {
|
|
20081
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20082
|
+
return { data: null, error: error3 };
|
|
20083
20083
|
}
|
|
20084
20084
|
return {
|
|
20085
20085
|
data: null,
|
|
20086
|
-
error: new errors_1.AuthUnknownError("Unexpected error in authenticate",
|
|
20086
|
+
error: new errors_1.AuthUnknownError("Unexpected error in authenticate", error3)
|
|
20087
20087
|
};
|
|
20088
20088
|
}
|
|
20089
20089
|
}
|
|
@@ -20132,13 +20132,13 @@ var require_webauthn = __commonJS((exports2) => {
|
|
|
20132
20132
|
credential_response: challengeResponse.webauthn.credential_response
|
|
20133
20133
|
}
|
|
20134
20134
|
});
|
|
20135
|
-
} catch (
|
|
20136
|
-
if ((0, errors_1.isAuthError)(
|
|
20137
|
-
return { data: null, error:
|
|
20135
|
+
} catch (error3) {
|
|
20136
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20137
|
+
return { data: null, error: error3 };
|
|
20138
20138
|
}
|
|
20139
20139
|
return {
|
|
20140
20140
|
data: null,
|
|
20141
|
-
error: new errors_1.AuthUnknownError("Unexpected error in register",
|
|
20141
|
+
error: new errors_1.AuthUnknownError("Unexpected error in register", error3)
|
|
20142
20142
|
};
|
|
20143
20143
|
}
|
|
20144
20144
|
}
|
|
@@ -20300,13 +20300,13 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20300
20300
|
this._debug("received broadcast notification from other tab or client", event);
|
|
20301
20301
|
try {
|
|
20302
20302
|
await this._notifyAllSubscribers(event.data.event, event.data.session, false);
|
|
20303
|
-
} catch (
|
|
20304
|
-
this._debug("#broadcastChannel", "error",
|
|
20303
|
+
} catch (error3) {
|
|
20304
|
+
this._debug("#broadcastChannel", "error", error3);
|
|
20305
20305
|
}
|
|
20306
20306
|
});
|
|
20307
20307
|
}
|
|
20308
|
-
this.initialize().catch((
|
|
20309
|
-
this._debug("#initialize()", "error",
|
|
20308
|
+
this.initialize().catch((error3) => {
|
|
20309
|
+
this._debug("#initialize()", "error", error3);
|
|
20310
20310
|
});
|
|
20311
20311
|
}
|
|
20312
20312
|
isThrowOnErrorEnabled() {
|
|
@@ -20352,16 +20352,16 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20352
20352
|
}
|
|
20353
20353
|
}
|
|
20354
20354
|
if ((0, helpers_1.isBrowser)() && this.detectSessionInUrl && callbackUrlType !== "none") {
|
|
20355
|
-
const { data, error:
|
|
20356
|
-
if (
|
|
20357
|
-
this._debug("#_initialize()", "error detecting session from URL",
|
|
20358
|
-
if ((0, errors_1.isAuthImplicitGrantRedirectError)(
|
|
20359
|
-
const errorCode = (_a =
|
|
20355
|
+
const { data, error: error3 } = await this._getSessionFromURL(params, callbackUrlType);
|
|
20356
|
+
if (error3) {
|
|
20357
|
+
this._debug("#_initialize()", "error detecting session from URL", error3);
|
|
20358
|
+
if ((0, errors_1.isAuthImplicitGrantRedirectError)(error3)) {
|
|
20359
|
+
const errorCode = (_a = error3.details) === null || _a === undefined ? undefined : _a.code;
|
|
20360
20360
|
if (errorCode === "identity_already_exists" || errorCode === "identity_not_found" || errorCode === "single_identity_not_deletable") {
|
|
20361
|
-
return { error:
|
|
20361
|
+
return { error: error3 };
|
|
20362
20362
|
}
|
|
20363
20363
|
}
|
|
20364
|
-
return { error:
|
|
20364
|
+
return { error: error3 };
|
|
20365
20365
|
}
|
|
20366
20366
|
const { session, redirectType } = data;
|
|
20367
20367
|
this._debug("#_initialize()", "detected session in URL", session, "redirect type", redirectType);
|
|
@@ -20377,12 +20377,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20377
20377
|
}
|
|
20378
20378
|
await this._recoverAndRefresh();
|
|
20379
20379
|
return { error: null };
|
|
20380
|
-
} catch (
|
|
20381
|
-
if ((0, errors_1.isAuthError)(
|
|
20382
|
-
return this._returnResult({ error:
|
|
20380
|
+
} catch (error3) {
|
|
20381
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20382
|
+
return this._returnResult({ error: error3 });
|
|
20383
20383
|
}
|
|
20384
20384
|
return this._returnResult({
|
|
20385
|
-
error: new errors_1.AuthUnknownError("Unexpected error during initialization",
|
|
20385
|
+
error: new errors_1.AuthUnknownError("Unexpected error during initialization", error3)
|
|
20386
20386
|
});
|
|
20387
20387
|
} finally {
|
|
20388
20388
|
await this._handleVisibilityChange();
|
|
@@ -20400,9 +20400,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20400
20400
|
},
|
|
20401
20401
|
xform: fetch_1._sessionResponse
|
|
20402
20402
|
});
|
|
20403
|
-
const { data, error:
|
|
20404
|
-
if (
|
|
20405
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20403
|
+
const { data, error: error3 } = res;
|
|
20404
|
+
if (error3 || !data) {
|
|
20405
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20406
20406
|
}
|
|
20407
20407
|
const session = data.session;
|
|
20408
20408
|
const user = data.user;
|
|
@@ -20411,11 +20411,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20411
20411
|
await this._notifyAllSubscribers("SIGNED_IN", session);
|
|
20412
20412
|
}
|
|
20413
20413
|
return this._returnResult({ data: { user, session }, error: null });
|
|
20414
|
-
} catch (
|
|
20415
|
-
if ((0, errors_1.isAuthError)(
|
|
20416
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20414
|
+
} catch (error3) {
|
|
20415
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20416
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20417
20417
|
}
|
|
20418
|
-
throw
|
|
20418
|
+
throw error3;
|
|
20419
20419
|
}
|
|
20420
20420
|
}
|
|
20421
20421
|
async signUp(credentials) {
|
|
@@ -20458,10 +20458,10 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20458
20458
|
} else {
|
|
20459
20459
|
throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");
|
|
20460
20460
|
}
|
|
20461
|
-
const { data, error:
|
|
20462
|
-
if (
|
|
20461
|
+
const { data, error: error3 } = res;
|
|
20462
|
+
if (error3 || !data) {
|
|
20463
20463
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20464
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20464
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20465
20465
|
}
|
|
20466
20466
|
const session = data.session;
|
|
20467
20467
|
const user = data.user;
|
|
@@ -20470,12 +20470,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20470
20470
|
await this._notifyAllSubscribers("SIGNED_IN", session);
|
|
20471
20471
|
}
|
|
20472
20472
|
return this._returnResult({ data: { user, session }, error: null });
|
|
20473
|
-
} catch (
|
|
20473
|
+
} catch (error3) {
|
|
20474
20474
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20475
|
-
if ((0, errors_1.isAuthError)(
|
|
20476
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20475
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20476
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20477
20477
|
}
|
|
20478
|
-
throw
|
|
20478
|
+
throw error3;
|
|
20479
20479
|
}
|
|
20480
20480
|
}
|
|
20481
20481
|
async signInWithPassword(credentials) {
|
|
@@ -20506,9 +20506,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20506
20506
|
} else {
|
|
20507
20507
|
throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");
|
|
20508
20508
|
}
|
|
20509
|
-
const { data, error:
|
|
20510
|
-
if (
|
|
20511
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20509
|
+
const { data, error: error3 } = res;
|
|
20510
|
+
if (error3) {
|
|
20511
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20512
20512
|
} else if (!data || !data.session || !data.user) {
|
|
20513
20513
|
const invalidTokenError = new errors_1.AuthInvalidTokenResponseError;
|
|
20514
20514
|
return this._returnResult({ data: { user: null, session: null }, error: invalidTokenError });
|
|
@@ -20519,13 +20519,13 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20519
20519
|
}
|
|
20520
20520
|
return this._returnResult({
|
|
20521
20521
|
data: Object.assign({ user: data.user, session: data.session }, data.weak_password ? { weakPassword: data.weak_password } : null),
|
|
20522
|
-
error:
|
|
20522
|
+
error: error3
|
|
20523
20523
|
});
|
|
20524
|
-
} catch (
|
|
20525
|
-
if ((0, errors_1.isAuthError)(
|
|
20526
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20524
|
+
} catch (error3) {
|
|
20525
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20526
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20527
20527
|
}
|
|
20528
|
-
throw
|
|
20528
|
+
throw error3;
|
|
20529
20529
|
}
|
|
20530
20530
|
}
|
|
20531
20531
|
async signInWithOAuth(credentials) {
|
|
@@ -20617,7 +20617,7 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20617
20617
|
});
|
|
20618
20618
|
}
|
|
20619
20619
|
try {
|
|
20620
|
-
const { data, error:
|
|
20620
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
|
|
20621
20621
|
headers: this.headers,
|
|
20622
20622
|
body: Object.assign({
|
|
20623
20623
|
chain: "ethereum",
|
|
@@ -20626,8 +20626,8 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20626
20626
|
}, ((_k = credentials.options) === null || _k === undefined ? undefined : _k.captchaToken) ? { gotrue_meta_security: { captcha_token: (_l = credentials.options) === null || _l === undefined ? undefined : _l.captchaToken } } : null),
|
|
20627
20627
|
xform: fetch_1._sessionResponse
|
|
20628
20628
|
});
|
|
20629
|
-
if (
|
|
20630
|
-
throw
|
|
20629
|
+
if (error3) {
|
|
20630
|
+
throw error3;
|
|
20631
20631
|
}
|
|
20632
20632
|
if (!data || !data.session || !data.user) {
|
|
20633
20633
|
const invalidTokenError = new errors_1.AuthInvalidTokenResponseError;
|
|
@@ -20637,12 +20637,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20637
20637
|
await this._saveSession(data.session);
|
|
20638
20638
|
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20639
20639
|
}
|
|
20640
|
-
return this._returnResult({ data: Object.assign({}, data), error:
|
|
20641
|
-
} catch (
|
|
20642
|
-
if ((0, errors_1.isAuthError)(
|
|
20643
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20640
|
+
return this._returnResult({ data: Object.assign({}, data), error: error3 });
|
|
20641
|
+
} catch (error3) {
|
|
20642
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20643
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20644
20644
|
}
|
|
20645
|
-
throw
|
|
20645
|
+
throw error3;
|
|
20646
20646
|
}
|
|
20647
20647
|
}
|
|
20648
20648
|
async signInWithSolana(credentials) {
|
|
@@ -20721,13 +20721,13 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20721
20721
|
}
|
|
20722
20722
|
}
|
|
20723
20723
|
try {
|
|
20724
|
-
const { data, error:
|
|
20724
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
|
|
20725
20725
|
headers: this.headers,
|
|
20726
20726
|
body: Object.assign({ chain: "solana", message, signature: (0, base64url_1.bytesToBase64URL)(signature) }, ((_l = credentials.options) === null || _l === undefined ? undefined : _l.captchaToken) ? { gotrue_meta_security: { captcha_token: (_m = credentials.options) === null || _m === undefined ? undefined : _m.captchaToken } } : null),
|
|
20727
20727
|
xform: fetch_1._sessionResponse
|
|
20728
20728
|
});
|
|
20729
|
-
if (
|
|
20730
|
-
throw
|
|
20729
|
+
if (error3) {
|
|
20730
|
+
throw error3;
|
|
20731
20731
|
}
|
|
20732
20732
|
if (!data || !data.session || !data.user) {
|
|
20733
20733
|
const invalidTokenError = new errors_1.AuthInvalidTokenResponseError;
|
|
@@ -20737,12 +20737,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20737
20737
|
await this._saveSession(data.session);
|
|
20738
20738
|
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20739
20739
|
}
|
|
20740
|
-
return this._returnResult({ data: Object.assign({}, data), error:
|
|
20741
|
-
} catch (
|
|
20742
|
-
if ((0, errors_1.isAuthError)(
|
|
20743
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20740
|
+
return this._returnResult({ data: Object.assign({}, data), error: error3 });
|
|
20741
|
+
} catch (error3) {
|
|
20742
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20743
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20744
20744
|
}
|
|
20745
|
-
throw
|
|
20745
|
+
throw error3;
|
|
20746
20746
|
}
|
|
20747
20747
|
}
|
|
20748
20748
|
async _exchangeCodeForSession(authCode) {
|
|
@@ -20752,7 +20752,7 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20752
20752
|
if (!codeVerifier && this.flowType === "pkce") {
|
|
20753
20753
|
throw new errors_1.AuthPKCECodeVerifierMissingError;
|
|
20754
20754
|
}
|
|
20755
|
-
const { data, error:
|
|
20755
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/token?grant_type=pkce`, {
|
|
20756
20756
|
headers: this.headers,
|
|
20757
20757
|
body: {
|
|
20758
20758
|
auth_code: authCode,
|
|
@@ -20761,8 +20761,8 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20761
20761
|
xform: fetch_1._sessionResponse
|
|
20762
20762
|
});
|
|
20763
20763
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20764
|
-
if (
|
|
20765
|
-
throw
|
|
20764
|
+
if (error3) {
|
|
20765
|
+
throw error3;
|
|
20766
20766
|
}
|
|
20767
20767
|
if (!data || !data.session || !data.user) {
|
|
20768
20768
|
const invalidTokenError = new errors_1.AuthInvalidTokenResponseError;
|
|
@@ -20775,16 +20775,16 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20775
20775
|
await this._saveSession(data.session);
|
|
20776
20776
|
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20777
20777
|
}
|
|
20778
|
-
return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== undefined ? redirectType : null }), error:
|
|
20779
|
-
} catch (
|
|
20778
|
+
return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== undefined ? redirectType : null }), error: error3 });
|
|
20779
|
+
} catch (error3) {
|
|
20780
20780
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20781
|
-
if ((0, errors_1.isAuthError)(
|
|
20781
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20782
20782
|
return this._returnResult({
|
|
20783
20783
|
data: { user: null, session: null, redirectType: null },
|
|
20784
|
-
error:
|
|
20784
|
+
error: error3
|
|
20785
20785
|
});
|
|
20786
20786
|
}
|
|
20787
|
-
throw
|
|
20787
|
+
throw error3;
|
|
20788
20788
|
}
|
|
20789
20789
|
}
|
|
20790
20790
|
async signInWithIdToken(credentials) {
|
|
@@ -20801,9 +20801,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20801
20801
|
},
|
|
20802
20802
|
xform: fetch_1._sessionResponse
|
|
20803
20803
|
});
|
|
20804
|
-
const { data, error:
|
|
20805
|
-
if (
|
|
20806
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20804
|
+
const { data, error: error3 } = res;
|
|
20805
|
+
if (error3) {
|
|
20806
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20807
20807
|
} else if (!data || !data.session || !data.user) {
|
|
20808
20808
|
const invalidTokenError = new errors_1.AuthInvalidTokenResponseError;
|
|
20809
20809
|
return this._returnResult({ data: { user: null, session: null }, error: invalidTokenError });
|
|
@@ -20812,12 +20812,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20812
20812
|
await this._saveSession(data.session);
|
|
20813
20813
|
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20814
20814
|
}
|
|
20815
|
-
return this._returnResult({ data, error:
|
|
20816
|
-
} catch (
|
|
20817
|
-
if ((0, errors_1.isAuthError)(
|
|
20818
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20815
|
+
return this._returnResult({ data, error: error3 });
|
|
20816
|
+
} catch (error3) {
|
|
20817
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20818
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20819
20819
|
}
|
|
20820
|
-
throw
|
|
20820
|
+
throw error3;
|
|
20821
20821
|
}
|
|
20822
20822
|
}
|
|
20823
20823
|
async signInWithOtp(credentials) {
|
|
@@ -20830,7 +20830,7 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20830
20830
|
if (this.flowType === "pkce") {
|
|
20831
20831
|
[codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
|
|
20832
20832
|
}
|
|
20833
|
-
const { error:
|
|
20833
|
+
const { error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/otp`, {
|
|
20834
20834
|
headers: this.headers,
|
|
20835
20835
|
body: {
|
|
20836
20836
|
email,
|
|
@@ -20842,11 +20842,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20842
20842
|
},
|
|
20843
20843
|
redirectTo: options2 === null || options2 === undefined ? undefined : options2.emailRedirectTo
|
|
20844
20844
|
});
|
|
20845
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20845
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20846
20846
|
}
|
|
20847
20847
|
if ("phone" in credentials) {
|
|
20848
20848
|
const { phone, options: options2 } = credentials;
|
|
20849
|
-
const { data, error:
|
|
20849
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/otp`, {
|
|
20850
20850
|
headers: this.headers,
|
|
20851
20851
|
body: {
|
|
20852
20852
|
phone,
|
|
@@ -20858,16 +20858,16 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20858
20858
|
});
|
|
20859
20859
|
return this._returnResult({
|
|
20860
20860
|
data: { user: null, session: null, messageId: data === null || data === undefined ? undefined : data.message_id },
|
|
20861
|
-
error:
|
|
20861
|
+
error: error3
|
|
20862
20862
|
});
|
|
20863
20863
|
}
|
|
20864
20864
|
throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number.");
|
|
20865
|
-
} catch (
|
|
20865
|
+
} catch (error3) {
|
|
20866
20866
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20867
|
-
if ((0, errors_1.isAuthError)(
|
|
20868
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20867
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20868
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20869
20869
|
}
|
|
20870
|
-
throw
|
|
20870
|
+
throw error3;
|
|
20871
20871
|
}
|
|
20872
20872
|
}
|
|
20873
20873
|
async verifyOtp(params) {
|
|
@@ -20879,14 +20879,14 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20879
20879
|
redirectTo = (_a = params.options) === null || _a === undefined ? undefined : _a.redirectTo;
|
|
20880
20880
|
captchaToken = (_b = params.options) === null || _b === undefined ? undefined : _b.captchaToken;
|
|
20881
20881
|
}
|
|
20882
|
-
const { data, error:
|
|
20882
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/verify`, {
|
|
20883
20883
|
headers: this.headers,
|
|
20884
20884
|
body: Object.assign(Object.assign({}, params), { gotrue_meta_security: { captcha_token: captchaToken } }),
|
|
20885
20885
|
redirectTo,
|
|
20886
20886
|
xform: fetch_1._sessionResponse
|
|
20887
20887
|
});
|
|
20888
|
-
if (
|
|
20889
|
-
throw
|
|
20888
|
+
if (error3) {
|
|
20889
|
+
throw error3;
|
|
20890
20890
|
}
|
|
20891
20891
|
if (!data) {
|
|
20892
20892
|
const tokenVerificationError = new Error("An error occurred on token verification.");
|
|
@@ -20899,11 +20899,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20899
20899
|
await this._notifyAllSubscribers(params.type == "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", session);
|
|
20900
20900
|
}
|
|
20901
20901
|
return this._returnResult({ data: { user, session }, error: null });
|
|
20902
|
-
} catch (
|
|
20903
|
-
if ((0, errors_1.isAuthError)(
|
|
20904
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20902
|
+
} catch (error3) {
|
|
20903
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20904
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20905
20905
|
}
|
|
20906
|
-
throw
|
|
20906
|
+
throw error3;
|
|
20907
20907
|
}
|
|
20908
20908
|
}
|
|
20909
20909
|
async signInWithSSO(params) {
|
|
@@ -20923,12 +20923,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20923
20923
|
window.location.assign(result.data.url);
|
|
20924
20924
|
}
|
|
20925
20925
|
return this._returnResult(result);
|
|
20926
|
-
} catch (
|
|
20926
|
+
} catch (error3) {
|
|
20927
20927
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
20928
|
-
if ((0, errors_1.isAuthError)(
|
|
20929
|
-
return this._returnResult({ data: null, error:
|
|
20928
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20929
|
+
return this._returnResult({ data: null, error: error3 });
|
|
20930
20930
|
}
|
|
20931
|
-
throw
|
|
20931
|
+
throw error3;
|
|
20932
20932
|
}
|
|
20933
20933
|
}
|
|
20934
20934
|
async reauthenticate() {
|
|
@@ -20945,17 +20945,17 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20945
20945
|
throw sessionError;
|
|
20946
20946
|
if (!session)
|
|
20947
20947
|
throw new errors_1.AuthSessionMissingError;
|
|
20948
|
-
const { error:
|
|
20948
|
+
const { error: error3 } = await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/reauthenticate`, {
|
|
20949
20949
|
headers: this.headers,
|
|
20950
20950
|
jwt: session.access_token
|
|
20951
20951
|
});
|
|
20952
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20952
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20953
20953
|
});
|
|
20954
|
-
} catch (
|
|
20955
|
-
if ((0, errors_1.isAuthError)(
|
|
20956
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20954
|
+
} catch (error3) {
|
|
20955
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20956
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20957
20957
|
}
|
|
20958
|
-
throw
|
|
20958
|
+
throw error3;
|
|
20959
20959
|
}
|
|
20960
20960
|
}
|
|
20961
20961
|
async resend(credentials) {
|
|
@@ -20963,7 +20963,7 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20963
20963
|
const endpoint = `${this.url}/resend`;
|
|
20964
20964
|
if ("email" in credentials) {
|
|
20965
20965
|
const { email, type, options: options2 } = credentials;
|
|
20966
|
-
const { error:
|
|
20966
|
+
const { error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", endpoint, {
|
|
20967
20967
|
headers: this.headers,
|
|
20968
20968
|
body: {
|
|
20969
20969
|
email,
|
|
@@ -20972,10 +20972,10 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20972
20972
|
},
|
|
20973
20973
|
redirectTo: options2 === null || options2 === undefined ? undefined : options2.emailRedirectTo
|
|
20974
20974
|
});
|
|
20975
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20975
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20976
20976
|
} else if ("phone" in credentials) {
|
|
20977
20977
|
const { phone, type, options: options2 } = credentials;
|
|
20978
|
-
const { data, error:
|
|
20978
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", endpoint, {
|
|
20979
20979
|
headers: this.headers,
|
|
20980
20980
|
body: {
|
|
20981
20981
|
phone,
|
|
@@ -20985,15 +20985,15 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
20985
20985
|
});
|
|
20986
20986
|
return this._returnResult({
|
|
20987
20987
|
data: { user: null, session: null, messageId: data === null || data === undefined ? undefined : data.message_id },
|
|
20988
|
-
error:
|
|
20988
|
+
error: error3
|
|
20989
20989
|
});
|
|
20990
20990
|
}
|
|
20991
20991
|
throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number and a type");
|
|
20992
|
-
} catch (
|
|
20993
|
-
if ((0, errors_1.isAuthError)(
|
|
20994
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
20992
|
+
} catch (error3) {
|
|
20993
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
20994
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
20995
20995
|
}
|
|
20996
|
-
throw
|
|
20996
|
+
throw error3;
|
|
20997
20997
|
}
|
|
20998
20998
|
}
|
|
20999
20999
|
async getSession() {
|
|
@@ -21096,9 +21096,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21096
21096
|
}
|
|
21097
21097
|
return { data: { session: currentSession }, error: null };
|
|
21098
21098
|
}
|
|
21099
|
-
const { data: session, error:
|
|
21100
|
-
if (
|
|
21101
|
-
return this._returnResult({ data: { session: null }, error:
|
|
21099
|
+
const { data: session, error: error3 } = await this._callRefreshToken(currentSession.refresh_token);
|
|
21100
|
+
if (error3) {
|
|
21101
|
+
return this._returnResult({ data: { session: null }, error: error3 });
|
|
21102
21102
|
}
|
|
21103
21103
|
return this._returnResult({ data: { session }, error: null });
|
|
21104
21104
|
} finally {
|
|
@@ -21129,9 +21129,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21129
21129
|
}
|
|
21130
21130
|
return await this._useSession(async (result) => {
|
|
21131
21131
|
var _a, _b, _c;
|
|
21132
|
-
const { data, error:
|
|
21133
|
-
if (
|
|
21134
|
-
throw
|
|
21132
|
+
const { data, error: error3 } = result;
|
|
21133
|
+
if (error3) {
|
|
21134
|
+
throw error3;
|
|
21135
21135
|
}
|
|
21136
21136
|
if (!((_a = data.session) === null || _a === undefined ? undefined : _a.access_token) && !this.hasCustomAuthorizationHeader) {
|
|
21137
21137
|
return { data: { user: null }, error: new errors_1.AuthSessionMissingError };
|
|
@@ -21142,15 +21142,15 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21142
21142
|
xform: fetch_1._userResponse
|
|
21143
21143
|
});
|
|
21144
21144
|
});
|
|
21145
|
-
} catch (
|
|
21146
|
-
if ((0, errors_1.isAuthError)(
|
|
21147
|
-
if ((0, errors_1.isAuthSessionMissingError)(
|
|
21145
|
+
} catch (error3) {
|
|
21146
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21147
|
+
if ((0, errors_1.isAuthSessionMissingError)(error3)) {
|
|
21148
21148
|
await this._removeSession();
|
|
21149
21149
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
21150
21150
|
}
|
|
21151
|
-
return this._returnResult({ data: { user: null }, error:
|
|
21151
|
+
return this._returnResult({ data: { user: null }, error: error3 });
|
|
21152
21152
|
}
|
|
21153
|
-
throw
|
|
21153
|
+
throw error3;
|
|
21154
21154
|
}
|
|
21155
21155
|
}
|
|
21156
21156
|
async updateUser(attributes, options2 = {}) {
|
|
@@ -21190,12 +21190,12 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21190
21190
|
await this._notifyAllSubscribers("USER_UPDATED", session);
|
|
21191
21191
|
return this._returnResult({ data: { user: session.user }, error: null });
|
|
21192
21192
|
});
|
|
21193
|
-
} catch (
|
|
21193
|
+
} catch (error3) {
|
|
21194
21194
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
21195
|
-
if ((0, errors_1.isAuthError)(
|
|
21196
|
-
return this._returnResult({ data: { user: null }, error:
|
|
21195
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21196
|
+
return this._returnResult({ data: { user: null }, error: error3 });
|
|
21197
21197
|
}
|
|
21198
|
-
throw
|
|
21198
|
+
throw error3;
|
|
21199
21199
|
}
|
|
21200
21200
|
}
|
|
21201
21201
|
async setSession(currentSession) {
|
|
@@ -21219,18 +21219,18 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21219
21219
|
hasExpired = expiresAt <= timeNow;
|
|
21220
21220
|
}
|
|
21221
21221
|
if (hasExpired) {
|
|
21222
|
-
const { data: refreshedSession, error:
|
|
21223
|
-
if (
|
|
21224
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21222
|
+
const { data: refreshedSession, error: error3 } = await this._callRefreshToken(currentSession.refresh_token);
|
|
21223
|
+
if (error3) {
|
|
21224
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21225
21225
|
}
|
|
21226
21226
|
if (!refreshedSession) {
|
|
21227
21227
|
return { data: { user: null, session: null }, error: null };
|
|
21228
21228
|
}
|
|
21229
21229
|
session = refreshedSession;
|
|
21230
21230
|
} else {
|
|
21231
|
-
const { data, error:
|
|
21232
|
-
if (
|
|
21233
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21231
|
+
const { data, error: error3 } = await this._getUser(currentSession.access_token);
|
|
21232
|
+
if (error3) {
|
|
21233
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21234
21234
|
}
|
|
21235
21235
|
session = {
|
|
21236
21236
|
access_token: currentSession.access_token,
|
|
@@ -21244,11 +21244,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21244
21244
|
await this._notifyAllSubscribers("SIGNED_IN", session);
|
|
21245
21245
|
}
|
|
21246
21246
|
return this._returnResult({ data: { user: session.user, session }, error: null });
|
|
21247
|
-
} catch (
|
|
21248
|
-
if ((0, errors_1.isAuthError)(
|
|
21249
|
-
return this._returnResult({ data: { session: null, user: null }, error:
|
|
21247
|
+
} catch (error3) {
|
|
21248
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21249
|
+
return this._returnResult({ data: { session: null, user: null }, error: error3 });
|
|
21250
21250
|
}
|
|
21251
|
-
throw
|
|
21251
|
+
throw error3;
|
|
21252
21252
|
}
|
|
21253
21253
|
}
|
|
21254
21254
|
async refreshSession(currentSession) {
|
|
@@ -21262,29 +21262,29 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21262
21262
|
return await this._useSession(async (result) => {
|
|
21263
21263
|
var _a;
|
|
21264
21264
|
if (!currentSession) {
|
|
21265
|
-
const { data, error:
|
|
21266
|
-
if (
|
|
21267
|
-
throw
|
|
21265
|
+
const { data, error: error4 } = result;
|
|
21266
|
+
if (error4) {
|
|
21267
|
+
throw error4;
|
|
21268
21268
|
}
|
|
21269
21269
|
currentSession = (_a = data.session) !== null && _a !== undefined ? _a : undefined;
|
|
21270
21270
|
}
|
|
21271
21271
|
if (!(currentSession === null || currentSession === undefined ? undefined : currentSession.refresh_token)) {
|
|
21272
21272
|
throw new errors_1.AuthSessionMissingError;
|
|
21273
21273
|
}
|
|
21274
|
-
const { data: session, error:
|
|
21275
|
-
if (
|
|
21276
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21274
|
+
const { data: session, error: error3 } = await this._callRefreshToken(currentSession.refresh_token);
|
|
21275
|
+
if (error3) {
|
|
21276
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21277
21277
|
}
|
|
21278
21278
|
if (!session) {
|
|
21279
21279
|
return this._returnResult({ data: { user: null, session: null }, error: null });
|
|
21280
21280
|
}
|
|
21281
21281
|
return this._returnResult({ data: { user: session.user, session }, error: null });
|
|
21282
21282
|
});
|
|
21283
|
-
} catch (
|
|
21284
|
-
if ((0, errors_1.isAuthError)(
|
|
21285
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21283
|
+
} catch (error3) {
|
|
21284
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21285
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21286
21286
|
}
|
|
21287
|
-
throw
|
|
21287
|
+
throw error3;
|
|
21288
21288
|
}
|
|
21289
21289
|
}
|
|
21290
21290
|
async _getSessionFromURL(params, callbackUrlType) {
|
|
@@ -21314,9 +21314,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21314
21314
|
this._debug("#_initialize()", "begin", "is PKCE flow", true);
|
|
21315
21315
|
if (!params.code)
|
|
21316
21316
|
throw new errors_1.AuthPKCEGrantCodeExchangeError("No code detected.");
|
|
21317
|
-
const { data: data2, error:
|
|
21318
|
-
if (
|
|
21319
|
-
throw
|
|
21317
|
+
const { data: data2, error: error4 } = await this._exchangeCodeForSession(params.code);
|
|
21318
|
+
if (error4)
|
|
21319
|
+
throw error4;
|
|
21320
21320
|
const url = new URL(window.location.href);
|
|
21321
21321
|
url.searchParams.delete("code");
|
|
21322
21322
|
window.history.replaceState(window.history.state, "", url.toString());
|
|
@@ -21342,9 +21342,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21342
21342
|
} else if (timeNow - issuedAt < 0) {
|
|
21343
21343
|
console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew", issuedAt, expiresAt, timeNow);
|
|
21344
21344
|
}
|
|
21345
|
-
const { data, error:
|
|
21346
|
-
if (
|
|
21347
|
-
throw
|
|
21345
|
+
const { data, error: error3 } = await this._getUser(access_token);
|
|
21346
|
+
if (error3)
|
|
21347
|
+
throw error3;
|
|
21348
21348
|
const session = {
|
|
21349
21349
|
provider_token,
|
|
21350
21350
|
provider_refresh_token,
|
|
@@ -21358,11 +21358,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21358
21358
|
window.location.hash = "";
|
|
21359
21359
|
this._debug("#_getSessionFromURL()", "clearing window.location.hash");
|
|
21360
21360
|
return this._returnResult({ data: { session, redirectType: params.type }, error: null });
|
|
21361
|
-
} catch (
|
|
21362
|
-
if ((0, errors_1.isAuthError)(
|
|
21363
|
-
return this._returnResult({ data: { session: null, redirectType: null }, error:
|
|
21361
|
+
} catch (error3) {
|
|
21362
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21363
|
+
return this._returnResult({ data: { session: null, redirectType: null }, error: error3 });
|
|
21364
21364
|
}
|
|
21365
|
-
throw
|
|
21365
|
+
throw error3;
|
|
21366
21366
|
}
|
|
21367
21367
|
}
|
|
21368
21368
|
_isImplicitGrantCallback(params) {
|
|
@@ -21390,10 +21390,10 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21390
21390
|
}
|
|
21391
21391
|
const accessToken = (_a = data.session) === null || _a === undefined ? undefined : _a.access_token;
|
|
21392
21392
|
if (accessToken) {
|
|
21393
|
-
const { error:
|
|
21394
|
-
if (
|
|
21395
|
-
if (!((0, errors_1.isAuthApiError)(
|
|
21396
|
-
return this._returnResult({ error:
|
|
21393
|
+
const { error: error3 } = await this.admin.signOut(accessToken, scope);
|
|
21394
|
+
if (error3) {
|
|
21395
|
+
if (!((0, errors_1.isAuthApiError)(error3) && (error3.status === 404 || error3.status === 401 || error3.status === 403) || (0, errors_1.isAuthSessionMissingError)(error3))) {
|
|
21396
|
+
return this._returnResult({ error: error3 });
|
|
21397
21397
|
}
|
|
21398
21398
|
}
|
|
21399
21399
|
}
|
|
@@ -21428,9 +21428,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21428
21428
|
return await this._useSession(async (result) => {
|
|
21429
21429
|
var _a, _b;
|
|
21430
21430
|
try {
|
|
21431
|
-
const { data: { session }, error:
|
|
21432
|
-
if (
|
|
21433
|
-
throw
|
|
21431
|
+
const { data: { session }, error: error3 } = result;
|
|
21432
|
+
if (error3)
|
|
21433
|
+
throw error3;
|
|
21434
21434
|
await ((_a = this.stateChangeEmitters.get(id)) === null || _a === undefined ? undefined : _a.callback("INITIAL_SESSION", session));
|
|
21435
21435
|
this._debug("INITIAL_SESSION", "callback id", id, "session", session);
|
|
21436
21436
|
} catch (err) {
|
|
@@ -21457,26 +21457,26 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21457
21457
|
headers: this.headers,
|
|
21458
21458
|
redirectTo: options2.redirectTo
|
|
21459
21459
|
});
|
|
21460
|
-
} catch (
|
|
21460
|
+
} catch (error3) {
|
|
21461
21461
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
21462
|
-
if ((0, errors_1.isAuthError)(
|
|
21463
|
-
return this._returnResult({ data: null, error:
|
|
21462
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21463
|
+
return this._returnResult({ data: null, error: error3 });
|
|
21464
21464
|
}
|
|
21465
|
-
throw
|
|
21465
|
+
throw error3;
|
|
21466
21466
|
}
|
|
21467
21467
|
}
|
|
21468
21468
|
async getUserIdentities() {
|
|
21469
21469
|
var _a;
|
|
21470
21470
|
try {
|
|
21471
|
-
const { data, error:
|
|
21472
|
-
if (
|
|
21473
|
-
throw
|
|
21471
|
+
const { data, error: error3 } = await this.getUser();
|
|
21472
|
+
if (error3)
|
|
21473
|
+
throw error3;
|
|
21474
21474
|
return this._returnResult({ data: { identities: (_a = data.user.identities) !== null && _a !== undefined ? _a : [] }, error: null });
|
|
21475
|
-
} catch (
|
|
21476
|
-
if ((0, errors_1.isAuthError)(
|
|
21477
|
-
return this._returnResult({ data: null, error:
|
|
21475
|
+
} catch (error3) {
|
|
21476
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21477
|
+
return this._returnResult({ data: null, error: error3 });
|
|
21478
21478
|
}
|
|
21479
|
-
throw
|
|
21479
|
+
throw error3;
|
|
21480
21480
|
}
|
|
21481
21481
|
}
|
|
21482
21482
|
async linkIdentity(credentials) {
|
|
@@ -21488,11 +21488,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21488
21488
|
async linkIdentityOAuth(credentials) {
|
|
21489
21489
|
var _a;
|
|
21490
21490
|
try {
|
|
21491
|
-
const { data, error:
|
|
21491
|
+
const { data, error: error3 } = await this._useSession(async (result) => {
|
|
21492
21492
|
var _a2, _b, _c, _d, _e;
|
|
21493
|
-
const { data: data2, error:
|
|
21494
|
-
if (
|
|
21495
|
-
throw
|
|
21493
|
+
const { data: data2, error: error4 } = result;
|
|
21494
|
+
if (error4)
|
|
21495
|
+
throw error4;
|
|
21496
21496
|
const url = await this._getUrlForProvider(`${this.url}/user/identities/authorize`, credentials.provider, {
|
|
21497
21497
|
redirectTo: (_a2 = credentials.options) === null || _a2 === undefined ? undefined : _a2.redirectTo,
|
|
21498
21498
|
scopes: (_b = credentials.options) === null || _b === undefined ? undefined : _b.scopes,
|
|
@@ -21504,8 +21504,8 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21504
21504
|
jwt: (_e = (_d = data2.session) === null || _d === undefined ? undefined : _d.access_token) !== null && _e !== undefined ? _e : undefined
|
|
21505
21505
|
});
|
|
21506
21506
|
});
|
|
21507
|
-
if (
|
|
21508
|
-
throw
|
|
21507
|
+
if (error3)
|
|
21508
|
+
throw error3;
|
|
21509
21509
|
if ((0, helpers_1.isBrowser)() && !((_a = credentials.options) === null || _a === undefined ? undefined : _a.skipBrowserRedirect)) {
|
|
21510
21510
|
window.location.assign(data === null || data === undefined ? undefined : data.url);
|
|
21511
21511
|
}
|
|
@@ -21513,11 +21513,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21513
21513
|
data: { provider: credentials.provider, url: data === null || data === undefined ? undefined : data.url },
|
|
21514
21514
|
error: null
|
|
21515
21515
|
});
|
|
21516
|
-
} catch (
|
|
21517
|
-
if ((0, errors_1.isAuthError)(
|
|
21518
|
-
return this._returnResult({ data: { provider: credentials.provider, url: null }, error:
|
|
21516
|
+
} catch (error3) {
|
|
21517
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21518
|
+
return this._returnResult({ data: { provider: credentials.provider, url: null }, error: error3 });
|
|
21519
21519
|
}
|
|
21520
|
-
throw
|
|
21520
|
+
throw error3;
|
|
21521
21521
|
}
|
|
21522
21522
|
}
|
|
21523
21523
|
async linkIdentityIdToken(credentials) {
|
|
@@ -21541,9 +21541,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21541
21541
|
},
|
|
21542
21542
|
xform: fetch_1._sessionResponse
|
|
21543
21543
|
});
|
|
21544
|
-
const { data, error:
|
|
21545
|
-
if (
|
|
21546
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21544
|
+
const { data, error: error3 } = res;
|
|
21545
|
+
if (error3) {
|
|
21546
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21547
21547
|
} else if (!data || !data.session || !data.user) {
|
|
21548
21548
|
return this._returnResult({
|
|
21549
21549
|
data: { user: null, session: null },
|
|
@@ -21554,13 +21554,13 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21554
21554
|
await this._saveSession(data.session);
|
|
21555
21555
|
await this._notifyAllSubscribers("USER_UPDATED", data.session);
|
|
21556
21556
|
}
|
|
21557
|
-
return this._returnResult({ data, error:
|
|
21558
|
-
} catch (
|
|
21557
|
+
return this._returnResult({ data, error: error3 });
|
|
21558
|
+
} catch (error3) {
|
|
21559
21559
|
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
21560
|
-
if ((0, errors_1.isAuthError)(
|
|
21561
|
-
return this._returnResult({ data: { user: null, session: null }, error:
|
|
21560
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21561
|
+
return this._returnResult({ data: { user: null, session: null }, error: error3 });
|
|
21562
21562
|
}
|
|
21563
|
-
throw
|
|
21563
|
+
throw error3;
|
|
21564
21564
|
}
|
|
21565
21565
|
});
|
|
21566
21566
|
}
|
|
@@ -21568,20 +21568,20 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21568
21568
|
try {
|
|
21569
21569
|
return await this._useSession(async (result) => {
|
|
21570
21570
|
var _a, _b;
|
|
21571
|
-
const { data, error:
|
|
21572
|
-
if (
|
|
21573
|
-
throw
|
|
21571
|
+
const { data, error: error3 } = result;
|
|
21572
|
+
if (error3) {
|
|
21573
|
+
throw error3;
|
|
21574
21574
|
}
|
|
21575
21575
|
return await (0, fetch_1._request)(this.fetch, "DELETE", `${this.url}/user/identities/${identity3.identity_id}`, {
|
|
21576
21576
|
headers: this.headers,
|
|
21577
21577
|
jwt: (_b = (_a = data.session) === null || _a === undefined ? undefined : _a.access_token) !== null && _b !== undefined ? _b : undefined
|
|
21578
21578
|
});
|
|
21579
21579
|
});
|
|
21580
|
-
} catch (
|
|
21581
|
-
if ((0, errors_1.isAuthError)(
|
|
21582
|
-
return this._returnResult({ data: null, error:
|
|
21580
|
+
} catch (error3) {
|
|
21581
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21582
|
+
return this._returnResult({ data: null, error: error3 });
|
|
21583
21583
|
}
|
|
21584
|
-
throw
|
|
21584
|
+
throw error3;
|
|
21585
21585
|
}
|
|
21586
21586
|
}
|
|
21587
21587
|
async _refreshAccessToken(refreshToken) {
|
|
@@ -21599,16 +21599,16 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21599
21599
|
headers: this.headers,
|
|
21600
21600
|
xform: fetch_1._sessionResponse
|
|
21601
21601
|
});
|
|
21602
|
-
}, (attempt,
|
|
21602
|
+
}, (attempt, error3) => {
|
|
21603
21603
|
const nextBackOffInterval = 200 * Math.pow(2, attempt);
|
|
21604
|
-
return
|
|
21604
|
+
return error3 && (0, errors_1.isAuthRetryableFetchError)(error3) && Date.now() + nextBackOffInterval - startedAt < constants_1.AUTO_REFRESH_TICK_DURATION_MS;
|
|
21605
21605
|
});
|
|
21606
|
-
} catch (
|
|
21607
|
-
this._debug(debugName, "error",
|
|
21608
|
-
if ((0, errors_1.isAuthError)(
|
|
21609
|
-
return this._returnResult({ data: { session: null, user: null }, error:
|
|
21606
|
+
} catch (error3) {
|
|
21607
|
+
this._debug(debugName, "error", error3);
|
|
21608
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21609
|
+
return this._returnResult({ data: { session: null, user: null }, error: error3 });
|
|
21610
21610
|
}
|
|
21611
|
-
throw
|
|
21611
|
+
throw error3;
|
|
21612
21612
|
} finally {
|
|
21613
21613
|
this._debug(debugName, "end");
|
|
21614
21614
|
}
|
|
@@ -21666,11 +21666,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21666
21666
|
this._debug(debugName, `session has${expiresWithMargin ? "" : " not"} expired with margin of ${constants_1.EXPIRY_MARGIN_MS}s`);
|
|
21667
21667
|
if (expiresWithMargin) {
|
|
21668
21668
|
if (this.autoRefreshToken && currentSession.refresh_token) {
|
|
21669
|
-
const { error:
|
|
21670
|
-
if (
|
|
21671
|
-
console.error(
|
|
21672
|
-
if (!(0, errors_1.isAuthRetryableFetchError)(
|
|
21673
|
-
this._debug(debugName, "refresh failed with a non-retryable error, removing the session",
|
|
21669
|
+
const { error: error3 } = await this._callRefreshToken(currentSession.refresh_token);
|
|
21670
|
+
if (error3) {
|
|
21671
|
+
console.error(error3);
|
|
21672
|
+
if (!(0, errors_1.isAuthRetryableFetchError)(error3)) {
|
|
21673
|
+
this._debug(debugName, "refresh failed with a non-retryable error, removing the session", error3);
|
|
21674
21674
|
await this._removeSession();
|
|
21675
21675
|
}
|
|
21676
21676
|
}
|
|
@@ -21712,9 +21712,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21712
21712
|
this._debug(debugName, "begin");
|
|
21713
21713
|
try {
|
|
21714
21714
|
this.refreshingDeferred = new helpers_1.Deferred;
|
|
21715
|
-
const { data, error:
|
|
21716
|
-
if (
|
|
21717
|
-
throw
|
|
21715
|
+
const { data, error: error3 } = await this._refreshAccessToken(refreshToken);
|
|
21716
|
+
if (error3)
|
|
21717
|
+
throw error3;
|
|
21718
21718
|
if (!data.session)
|
|
21719
21719
|
throw new errors_1.AuthSessionMissingError;
|
|
21720
21720
|
await this._saveSession(data.session);
|
|
@@ -21722,18 +21722,18 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21722
21722
|
const result = { data: data.session, error: null };
|
|
21723
21723
|
this.refreshingDeferred.resolve(result);
|
|
21724
21724
|
return result;
|
|
21725
|
-
} catch (
|
|
21726
|
-
this._debug(debugName, "error",
|
|
21727
|
-
if ((0, errors_1.isAuthError)(
|
|
21728
|
-
const result = { data: null, error:
|
|
21729
|
-
if (!(0, errors_1.isAuthRetryableFetchError)(
|
|
21725
|
+
} catch (error3) {
|
|
21726
|
+
this._debug(debugName, "error", error3);
|
|
21727
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21728
|
+
const result = { data: null, error: error3 };
|
|
21729
|
+
if (!(0, errors_1.isAuthRetryableFetchError)(error3)) {
|
|
21730
21730
|
await this._removeSession();
|
|
21731
21731
|
}
|
|
21732
21732
|
(_a = this.refreshingDeferred) === null || _a === undefined || _a.resolve(result);
|
|
21733
21733
|
return result;
|
|
21734
21734
|
}
|
|
21735
|
-
(_b = this.refreshingDeferred) === null || _b === undefined || _b.reject(
|
|
21736
|
-
throw
|
|
21735
|
+
(_b = this.refreshingDeferred) === null || _b === undefined || _b.reject(error3);
|
|
21736
|
+
throw error3;
|
|
21737
21737
|
} finally {
|
|
21738
21738
|
this.refreshingDeferred = null;
|
|
21739
21739
|
this._debug(debugName, "end");
|
|
@@ -21897,14 +21897,14 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21897
21897
|
this.visibilityChangedCallback = async () => {
|
|
21898
21898
|
try {
|
|
21899
21899
|
await this._onVisibilityChanged(false);
|
|
21900
|
-
} catch (
|
|
21901
|
-
this._debug("#visibilityChangedCallback", "error",
|
|
21900
|
+
} catch (error3) {
|
|
21901
|
+
this._debug("#visibilityChangedCallback", "error", error3);
|
|
21902
21902
|
}
|
|
21903
21903
|
};
|
|
21904
21904
|
window === null || window === undefined || window.addEventListener("visibilitychange", this.visibilityChangedCallback);
|
|
21905
21905
|
await this._onVisibilityChanged(true);
|
|
21906
|
-
} catch (
|
|
21907
|
-
console.error("_handleVisibilityChange",
|
|
21906
|
+
} catch (error3) {
|
|
21907
|
+
console.error("_handleVisibilityChange", error3);
|
|
21908
21908
|
}
|
|
21909
21909
|
}
|
|
21910
21910
|
async _onVisibilityChanged(calledFromInitialize) {
|
|
@@ -21968,11 +21968,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21968
21968
|
jwt: (_a = sessionData === null || sessionData === undefined ? undefined : sessionData.session) === null || _a === undefined ? undefined : _a.access_token
|
|
21969
21969
|
});
|
|
21970
21970
|
});
|
|
21971
|
-
} catch (
|
|
21972
|
-
if ((0, errors_1.isAuthError)(
|
|
21973
|
-
return this._returnResult({ data: null, error:
|
|
21971
|
+
} catch (error3) {
|
|
21972
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
21973
|
+
return this._returnResult({ data: null, error: error3 });
|
|
21974
21974
|
}
|
|
21975
|
-
throw
|
|
21975
|
+
throw error3;
|
|
21976
21976
|
}
|
|
21977
21977
|
}
|
|
21978
21978
|
async _enroll(params) {
|
|
@@ -21984,24 +21984,24 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
21984
21984
|
return this._returnResult({ data: null, error: sessionError });
|
|
21985
21985
|
}
|
|
21986
21986
|
const body = Object.assign({ friendly_name: params.friendlyName, factor_type: params.factorType }, params.factorType === "phone" ? { phone: params.phone } : params.factorType === "totp" ? { issuer: params.issuer } : {});
|
|
21987
|
-
const { data, error:
|
|
21987
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/factors`, {
|
|
21988
21988
|
body,
|
|
21989
21989
|
headers: this.headers,
|
|
21990
21990
|
jwt: (_a = sessionData === null || sessionData === undefined ? undefined : sessionData.session) === null || _a === undefined ? undefined : _a.access_token
|
|
21991
21991
|
});
|
|
21992
|
-
if (
|
|
21993
|
-
return this._returnResult({ data: null, error:
|
|
21992
|
+
if (error3) {
|
|
21993
|
+
return this._returnResult({ data: null, error: error3 });
|
|
21994
21994
|
}
|
|
21995
21995
|
if (params.factorType === "totp" && data.type === "totp" && ((_b = data === null || data === undefined ? undefined : data.totp) === null || _b === undefined ? undefined : _b.qr_code)) {
|
|
21996
21996
|
data.totp.qr_code = `data:image/svg+xml;utf-8,${data.totp.qr_code}`;
|
|
21997
21997
|
}
|
|
21998
21998
|
return this._returnResult({ data, error: null });
|
|
21999
21999
|
});
|
|
22000
|
-
} catch (
|
|
22001
|
-
if ((0, errors_1.isAuthError)(
|
|
22002
|
-
return this._returnResult({ data: null, error:
|
|
22000
|
+
} catch (error3) {
|
|
22001
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22002
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22003
22003
|
}
|
|
22004
|
-
throw
|
|
22004
|
+
throw error3;
|
|
22005
22005
|
}
|
|
22006
22006
|
}
|
|
22007
22007
|
async _verify(params) {
|
|
@@ -22016,23 +22016,23 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22016
22016
|
const body = Object.assign({ challenge_id: params.challengeId }, "webauthn" in params ? {
|
|
22017
22017
|
webauthn: Object.assign(Object.assign({}, params.webauthn), { credential_response: params.webauthn.type === "create" ? (0, webauthn_1.serializeCredentialCreationResponse)(params.webauthn.credential_response) : (0, webauthn_1.serializeCredentialRequestResponse)(params.webauthn.credential_response) })
|
|
22018
22018
|
} : { code: params.code });
|
|
22019
|
-
const { data, error:
|
|
22019
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "POST", `${this.url}/factors/${params.factorId}/verify`, {
|
|
22020
22020
|
body,
|
|
22021
22021
|
headers: this.headers,
|
|
22022
22022
|
jwt: (_a = sessionData === null || sessionData === undefined ? undefined : sessionData.session) === null || _a === undefined ? undefined : _a.access_token
|
|
22023
22023
|
});
|
|
22024
|
-
if (
|
|
22025
|
-
return this._returnResult({ data: null, error:
|
|
22024
|
+
if (error3) {
|
|
22025
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22026
22026
|
}
|
|
22027
22027
|
await this._saveSession(Object.assign({ expires_at: Math.round(Date.now() / 1000) + data.expires_in }, data));
|
|
22028
22028
|
await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED", data);
|
|
22029
|
-
return this._returnResult({ data, error:
|
|
22029
|
+
return this._returnResult({ data, error: error3 });
|
|
22030
22030
|
});
|
|
22031
|
-
} catch (
|
|
22032
|
-
if ((0, errors_1.isAuthError)(
|
|
22033
|
-
return this._returnResult({ data: null, error:
|
|
22031
|
+
} catch (error3) {
|
|
22032
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22033
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22034
22034
|
}
|
|
22035
|
-
throw
|
|
22035
|
+
throw error3;
|
|
22036
22036
|
}
|
|
22037
22037
|
});
|
|
22038
22038
|
}
|
|
@@ -22070,11 +22070,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22070
22070
|
};
|
|
22071
22071
|
}
|
|
22072
22072
|
});
|
|
22073
|
-
} catch (
|
|
22074
|
-
if ((0, errors_1.isAuthError)(
|
|
22075
|
-
return this._returnResult({ data: null, error:
|
|
22073
|
+
} catch (error3) {
|
|
22074
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22075
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22076
22076
|
}
|
|
22077
|
-
throw
|
|
22077
|
+
throw error3;
|
|
22078
22078
|
}
|
|
22079
22079
|
});
|
|
22080
22080
|
}
|
|
@@ -22134,11 +22134,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22134
22134
|
}
|
|
22135
22135
|
const currentAuthenticationMethods2 = payload2.amr || [];
|
|
22136
22136
|
return { data: { currentLevel: currentLevel2, nextLevel: nextLevel2, currentAuthenticationMethods: currentAuthenticationMethods2 }, error: null };
|
|
22137
|
-
} catch (
|
|
22138
|
-
if ((0, errors_1.isAuthError)(
|
|
22139
|
-
return this._returnResult({ data: null, error:
|
|
22137
|
+
} catch (error3) {
|
|
22138
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22139
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22140
22140
|
}
|
|
22141
|
-
throw
|
|
22141
|
+
throw error3;
|
|
22142
22142
|
}
|
|
22143
22143
|
}
|
|
22144
22144
|
const { data: { session }, error: sessionError } = await this.getSession();
|
|
@@ -22180,11 +22180,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22180
22180
|
xform: (data) => ({ data, error: null })
|
|
22181
22181
|
});
|
|
22182
22182
|
});
|
|
22183
|
-
} catch (
|
|
22184
|
-
if ((0, errors_1.isAuthError)(
|
|
22185
|
-
return this._returnResult({ data: null, error:
|
|
22183
|
+
} catch (error3) {
|
|
22184
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22185
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22186
22186
|
}
|
|
22187
|
-
throw
|
|
22187
|
+
throw error3;
|
|
22188
22188
|
}
|
|
22189
22189
|
}
|
|
22190
22190
|
async _approveAuthorization(authorizationId, options2) {
|
|
@@ -22210,11 +22210,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22210
22210
|
}
|
|
22211
22211
|
return response;
|
|
22212
22212
|
});
|
|
22213
|
-
} catch (
|
|
22214
|
-
if ((0, errors_1.isAuthError)(
|
|
22215
|
-
return this._returnResult({ data: null, error:
|
|
22213
|
+
} catch (error3) {
|
|
22214
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22215
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22216
22216
|
}
|
|
22217
|
-
throw
|
|
22217
|
+
throw error3;
|
|
22218
22218
|
}
|
|
22219
22219
|
}
|
|
22220
22220
|
async _denyAuthorization(authorizationId, options2) {
|
|
@@ -22240,11 +22240,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22240
22240
|
}
|
|
22241
22241
|
return response;
|
|
22242
22242
|
});
|
|
22243
|
-
} catch (
|
|
22244
|
-
if ((0, errors_1.isAuthError)(
|
|
22245
|
-
return this._returnResult({ data: null, error:
|
|
22243
|
+
} catch (error3) {
|
|
22244
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22245
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22246
22246
|
}
|
|
22247
|
-
throw
|
|
22247
|
+
throw error3;
|
|
22248
22248
|
}
|
|
22249
22249
|
}
|
|
22250
22250
|
async _listOAuthGrants() {
|
|
@@ -22263,11 +22263,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22263
22263
|
xform: (data) => ({ data, error: null })
|
|
22264
22264
|
});
|
|
22265
22265
|
});
|
|
22266
|
-
} catch (
|
|
22267
|
-
if ((0, errors_1.isAuthError)(
|
|
22268
|
-
return this._returnResult({ data: null, error:
|
|
22266
|
+
} catch (error3) {
|
|
22267
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22268
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22269
22269
|
}
|
|
22270
|
-
throw
|
|
22270
|
+
throw error3;
|
|
22271
22271
|
}
|
|
22272
22272
|
}
|
|
22273
22273
|
async _revokeOAuthGrant(options2) {
|
|
@@ -22288,11 +22288,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22288
22288
|
});
|
|
22289
22289
|
return { data: {}, error: null };
|
|
22290
22290
|
});
|
|
22291
|
-
} catch (
|
|
22292
|
-
if ((0, errors_1.isAuthError)(
|
|
22293
|
-
return this._returnResult({ data: null, error:
|
|
22291
|
+
} catch (error3) {
|
|
22292
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22293
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22294
22294
|
}
|
|
22295
|
-
throw
|
|
22295
|
+
throw error3;
|
|
22296
22296
|
}
|
|
22297
22297
|
}
|
|
22298
22298
|
async fetchJwk(kid, jwks = { keys: [] }) {
|
|
@@ -22305,11 +22305,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22305
22305
|
if (jwk && this.jwks_cached_at + constants_1.JWKS_TTL > now) {
|
|
22306
22306
|
return jwk;
|
|
22307
22307
|
}
|
|
22308
|
-
const { data, error:
|
|
22308
|
+
const { data, error: error3 } = await (0, fetch_1._request)(this.fetch, "GET", `${this.url}/.well-known/jwks.json`, {
|
|
22309
22309
|
headers: this.headers
|
|
22310
22310
|
});
|
|
22311
|
-
if (
|
|
22312
|
-
throw
|
|
22311
|
+
if (error3) {
|
|
22312
|
+
throw error3;
|
|
22313
22313
|
}
|
|
22314
22314
|
if (!data.keys || data.keys.length === 0) {
|
|
22315
22315
|
return null;
|
|
@@ -22326,9 +22326,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22326
22326
|
try {
|
|
22327
22327
|
let token = jwt;
|
|
22328
22328
|
if (!token) {
|
|
22329
|
-
const { data, error:
|
|
22330
|
-
if (
|
|
22331
|
-
return this._returnResult({ data: null, error:
|
|
22329
|
+
const { data, error: error3 } = await this.getSession();
|
|
22330
|
+
if (error3 || !data.session) {
|
|
22331
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22332
22332
|
}
|
|
22333
22333
|
token = data.session.access_token;
|
|
22334
22334
|
}
|
|
@@ -22338,9 +22338,9 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22338
22338
|
}
|
|
22339
22339
|
const signingKey = !header.alg || header.alg.startsWith("HS") || !header.kid || !(("crypto" in globalThis) && ("subtle" in globalThis.crypto)) ? null : await this.fetchJwk(header.kid, (options2 === null || options2 === undefined ? undefined : options2.keys) ? { keys: options2.keys } : options2 === null || options2 === undefined ? undefined : options2.jwks);
|
|
22340
22340
|
if (!signingKey) {
|
|
22341
|
-
const { error:
|
|
22342
|
-
if (
|
|
22343
|
-
throw
|
|
22341
|
+
const { error: error3 } = await this.getUser(token);
|
|
22342
|
+
if (error3) {
|
|
22343
|
+
throw error3;
|
|
22344
22344
|
}
|
|
22345
22345
|
return {
|
|
22346
22346
|
data: {
|
|
@@ -22367,11 +22367,11 @@ var require_GoTrueClient = __commonJS((exports2) => {
|
|
|
22367
22367
|
},
|
|
22368
22368
|
error: null
|
|
22369
22369
|
};
|
|
22370
|
-
} catch (
|
|
22371
|
-
if ((0, errors_1.isAuthError)(
|
|
22372
|
-
return this._returnResult({ data: null, error:
|
|
22370
|
+
} catch (error3) {
|
|
22371
|
+
if ((0, errors_1.isAuthError)(error3)) {
|
|
22372
|
+
return this._returnResult({ data: null, error: error3 });
|
|
22373
22373
|
}
|
|
22374
|
-
throw
|
|
22374
|
+
throw error3;
|
|
22375
22375
|
}
|
|
22376
22376
|
}
|
|
22377
22377
|
}
|
|
@@ -22737,17 +22737,17 @@ var require_dist_cjs5 = __commonJS((exports2) => {
|
|
|
22737
22737
|
response,
|
|
22738
22738
|
output: parsed
|
|
22739
22739
|
};
|
|
22740
|
-
} catch (
|
|
22741
|
-
Object.defineProperty(
|
|
22740
|
+
} catch (error3) {
|
|
22741
|
+
Object.defineProperty(error3, "$response", {
|
|
22742
22742
|
value: response,
|
|
22743
22743
|
enumerable: false,
|
|
22744
22744
|
writable: false,
|
|
22745
22745
|
configurable: false
|
|
22746
22746
|
});
|
|
22747
|
-
if (!("$metadata" in
|
|
22747
|
+
if (!("$metadata" in error3)) {
|
|
22748
22748
|
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
22749
22749
|
try {
|
|
22750
|
-
|
|
22750
|
+
error3.message += `
|
|
22751
22751
|
` + hint;
|
|
22752
22752
|
} catch (e) {
|
|
22753
22753
|
if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
|
|
@@ -22756,16 +22756,16 @@ var require_dist_cjs5 = __commonJS((exports2) => {
|
|
|
22756
22756
|
context.logger?.warn?.(hint);
|
|
22757
22757
|
}
|
|
22758
22758
|
}
|
|
22759
|
-
if (typeof
|
|
22760
|
-
if (
|
|
22761
|
-
|
|
22759
|
+
if (typeof error3.$responseBodyText !== "undefined") {
|
|
22760
|
+
if (error3.$response) {
|
|
22761
|
+
error3.$response.body = error3.$responseBodyText;
|
|
22762
22762
|
}
|
|
22763
22763
|
}
|
|
22764
22764
|
try {
|
|
22765
22765
|
if (protocolHttp.HttpResponse.isInstance(response)) {
|
|
22766
22766
|
const { headers = {} } = response;
|
|
22767
22767
|
const headerEntries = Object.entries(headers);
|
|
22768
|
-
|
|
22768
|
+
error3.$metadata = {
|
|
22769
22769
|
httpStatusCode: response.statusCode,
|
|
22770
22770
|
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
22771
22771
|
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
@@ -22774,7 +22774,7 @@ var require_dist_cjs5 = __commonJS((exports2) => {
|
|
|
22774
22774
|
}
|
|
22775
22775
|
} catch (e) {}
|
|
22776
22776
|
}
|
|
22777
|
-
throw
|
|
22777
|
+
throw error3;
|
|
22778
22778
|
}
|
|
22779
22779
|
};
|
|
22780
22780
|
var findHeader = (pattern, headers) => {
|
|
@@ -23042,8 +23042,8 @@ var require_createChecksumStream_browser = __commonJS((exports2) => {
|
|
|
23042
23042
|
const digest = await checksum.digest();
|
|
23043
23043
|
const received = encoder(digest);
|
|
23044
23044
|
if (expectedChecksum !== received) {
|
|
23045
|
-
const
|
|
23046
|
-
controller.error(
|
|
23045
|
+
const error3 = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}"` + ` in response header "${checksumSourceLocation}".`);
|
|
23046
|
+
controller.error(error3);
|
|
23047
23047
|
} else {
|
|
23048
23048
|
controller.terminate();
|
|
23049
23049
|
}
|
|
@@ -23532,12 +23532,12 @@ var require_dist_cjs12 = __commonJS((exports2) => {
|
|
|
23532
23532
|
return timing.setTimeout(() => {
|
|
23533
23533
|
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
23534
23534
|
if (throwOnRequestTimeout) {
|
|
23535
|
-
const
|
|
23535
|
+
const error3 = Object.assign(new Error(msg), {
|
|
23536
23536
|
name: "TimeoutError",
|
|
23537
23537
|
code: "ETIMEDOUT"
|
|
23538
23538
|
});
|
|
23539
|
-
req.destroy(
|
|
23540
|
-
reject(
|
|
23539
|
+
req.destroy(error3);
|
|
23540
|
+
reject(error3);
|
|
23541
23541
|
} else {
|
|
23542
23542
|
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
23543
23543
|
logger2?.warn?.(msg);
|
|
@@ -24719,17 +24719,17 @@ var require_schema10 = __commonJS((exports2) => {
|
|
|
24719
24719
|
response,
|
|
24720
24720
|
output: parsed
|
|
24721
24721
|
};
|
|
24722
|
-
} catch (
|
|
24723
|
-
Object.defineProperty(
|
|
24722
|
+
} catch (error4) {
|
|
24723
|
+
Object.defineProperty(error4, "$response", {
|
|
24724
24724
|
value: response,
|
|
24725
24725
|
enumerable: false,
|
|
24726
24726
|
writable: false,
|
|
24727
24727
|
configurable: false
|
|
24728
24728
|
});
|
|
24729
|
-
if (!("$metadata" in
|
|
24729
|
+
if (!("$metadata" in error4)) {
|
|
24730
24730
|
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
24731
24731
|
try {
|
|
24732
|
-
|
|
24732
|
+
error4.message += `
|
|
24733
24733
|
` + hint;
|
|
24734
24734
|
} catch (e) {
|
|
24735
24735
|
if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
|
|
@@ -24738,16 +24738,16 @@ var require_schema10 = __commonJS((exports2) => {
|
|
|
24738
24738
|
context.logger?.warn?.(hint);
|
|
24739
24739
|
}
|
|
24740
24740
|
}
|
|
24741
|
-
if (typeof
|
|
24742
|
-
if (
|
|
24743
|
-
|
|
24741
|
+
if (typeof error4.$responseBodyText !== "undefined") {
|
|
24742
|
+
if (error4.$response) {
|
|
24743
|
+
error4.$response.body = error4.$responseBodyText;
|
|
24744
24744
|
}
|
|
24745
24745
|
}
|
|
24746
24746
|
try {
|
|
24747
24747
|
if (protocolHttp.HttpResponse.isInstance(response)) {
|
|
24748
24748
|
const { headers = {} } = response;
|
|
24749
24749
|
const headerEntries = Object.entries(headers);
|
|
24750
|
-
|
|
24750
|
+
error4.$metadata = {
|
|
24751
24751
|
httpStatusCode: response.statusCode,
|
|
24752
24752
|
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
24753
24753
|
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
@@ -24756,7 +24756,7 @@ var require_schema10 = __commonJS((exports2) => {
|
|
|
24756
24756
|
}
|
|
24757
24757
|
} catch (e) {}
|
|
24758
24758
|
}
|
|
24759
|
-
throw
|
|
24759
|
+
throw error4;
|
|
24760
24760
|
}
|
|
24761
24761
|
};
|
|
24762
24762
|
var findHeader = (pattern, headers) => {
|
|
@@ -24888,7 +24888,7 @@ var require_schema10 = __commonJS((exports2) => {
|
|
|
24888
24888
|
ctor;
|
|
24889
24889
|
symbol = ErrorSchema.symbol;
|
|
24890
24890
|
}
|
|
24891
|
-
var
|
|
24891
|
+
var error3 = (namespace, name, traits, memberNames, memberList, ctor) => Schema3.assign(new ErrorSchema, {
|
|
24892
24892
|
name,
|
|
24893
24893
|
namespace,
|
|
24894
24894
|
traits,
|
|
@@ -25285,7 +25285,7 @@ var require_schema10 = __commonJS((exports2) => {
|
|
|
25285
25285
|
exports2.TypeRegistry = TypeRegistry;
|
|
25286
25286
|
exports2.deref = deref;
|
|
25287
25287
|
exports2.deserializerMiddlewareOption = deserializerMiddlewareOption;
|
|
25288
|
-
exports2.error =
|
|
25288
|
+
exports2.error = error3;
|
|
25289
25289
|
exports2.getSchemaSerdePlugin = getSchemaSerdePlugin;
|
|
25290
25290
|
exports2.isStaticSchema = isStaticSchema;
|
|
25291
25291
|
exports2.list = list;
|
|
@@ -27145,8 +27145,8 @@ var require_dist_cjs17 = __commonJS((exports2) => {
|
|
|
27145
27145
|
}), httpAuthSchemeMiddlewareOptions);
|
|
27146
27146
|
}
|
|
27147
27147
|
});
|
|
27148
|
-
var defaultErrorHandler = (signingProperties) => (
|
|
27149
|
-
throw
|
|
27148
|
+
var defaultErrorHandler = (signingProperties) => (error3) => {
|
|
27149
|
+
throw error3;
|
|
27150
27150
|
};
|
|
27151
27151
|
var defaultSuccessHandler = (httpResponse, signingProperties) => {};
|
|
27152
27152
|
var httpSigningMiddleware = (config) => (next, context) => async (args) => {
|
|
@@ -27396,8 +27396,8 @@ var require_dist_cjs18 = __commonJS((exports2) => {
|
|
|
27396
27396
|
Object.setPrototypeOf(this, ProviderError.prototype);
|
|
27397
27397
|
logger2?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
|
|
27398
27398
|
}
|
|
27399
|
-
static from(
|
|
27400
|
-
return Object.assign(new this(
|
|
27399
|
+
static from(error3, options2 = true) {
|
|
27400
|
+
return Object.assign(new this(error3.message, options2), error3);
|
|
27401
27401
|
}
|
|
27402
27402
|
}
|
|
27403
27403
|
|
|
@@ -31170,18 +31170,18 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
31170
31170
|
return signedRequest;
|
|
31171
31171
|
}
|
|
31172
31172
|
errorHandler(signingProperties) {
|
|
31173
|
-
return (
|
|
31174
|
-
const serverTime =
|
|
31173
|
+
return (error3) => {
|
|
31174
|
+
const serverTime = error3.ServerTime ?? getDateHeader(error3.$response);
|
|
31175
31175
|
if (serverTime) {
|
|
31176
31176
|
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
31177
31177
|
const initialSystemClockOffset = config.systemClockOffset;
|
|
31178
31178
|
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
31179
31179
|
const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
|
|
31180
|
-
if (clockSkewCorrected &&
|
|
31181
|
-
|
|
31180
|
+
if (clockSkewCorrected && error3.$metadata) {
|
|
31181
|
+
error3.$metadata.clockSkewCorrected = true;
|
|
31182
31182
|
}
|
|
31183
31183
|
}
|
|
31184
|
-
throw
|
|
31184
|
+
throw error3;
|
|
31185
31185
|
};
|
|
31186
31186
|
}
|
|
31187
31187
|
successHandler(httpResponse, signingProperties) {
|
|
@@ -31444,21 +31444,21 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
31444
31444
|
decorateServiceException(exception, additions = {}) {
|
|
31445
31445
|
if (this.queryCompat) {
|
|
31446
31446
|
const msg = exception.Message ?? additions.Message;
|
|
31447
|
-
const
|
|
31447
|
+
const error3 = smithyClient.decorateServiceException(exception, additions);
|
|
31448
31448
|
if (msg) {
|
|
31449
|
-
|
|
31449
|
+
error3.message = msg;
|
|
31450
31450
|
}
|
|
31451
|
-
|
|
31452
|
-
...
|
|
31453
|
-
Type:
|
|
31454
|
-
Code:
|
|
31455
|
-
Message:
|
|
31451
|
+
error3.Error = {
|
|
31452
|
+
...error3.Error,
|
|
31453
|
+
Type: error3.Error.Type,
|
|
31454
|
+
Code: error3.Error.Code,
|
|
31455
|
+
Message: error3.Error.message ?? error3.Error.Message ?? msg
|
|
31456
31456
|
};
|
|
31457
|
-
const reqId =
|
|
31457
|
+
const reqId = error3.$metadata.requestId;
|
|
31458
31458
|
if (reqId) {
|
|
31459
|
-
|
|
31459
|
+
error3.RequestId = reqId;
|
|
31460
31460
|
}
|
|
31461
|
-
return
|
|
31461
|
+
return error3;
|
|
31462
31462
|
}
|
|
31463
31463
|
return smithyClient.decorateServiceException(exception, additions);
|
|
31464
31464
|
}
|
|
@@ -34483,12 +34483,12 @@ var require_dist_cjs29 = __commonJS((exports2) => {
|
|
|
34483
34483
|
let checksumAlgorithmFn;
|
|
34484
34484
|
try {
|
|
34485
34485
|
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config);
|
|
34486
|
-
} catch (
|
|
34486
|
+
} catch (error3) {
|
|
34487
34487
|
if (algorithm === exports2.ChecksumAlgorithm.CRC64NVME) {
|
|
34488
|
-
logger2?.warn(`Skipping ${exports2.ChecksumAlgorithm.CRC64NVME} checksum validation: ${
|
|
34488
|
+
logger2?.warn(`Skipping ${exports2.ChecksumAlgorithm.CRC64NVME} checksum validation: ${error3.message}`);
|
|
34489
34489
|
continue;
|
|
34490
34490
|
}
|
|
34491
|
-
throw
|
|
34491
|
+
throw error3;
|
|
34492
34492
|
}
|
|
34493
34493
|
const { base64Encoder } = config;
|
|
34494
34494
|
if (isStreaming(responseBody)) {
|
|
@@ -34632,7 +34632,7 @@ var require_dist_cjs31 = __commonJS((exports2) => {
|
|
|
34632
34632
|
metadata: $metadata
|
|
34633
34633
|
});
|
|
34634
34634
|
return response;
|
|
34635
|
-
} catch (
|
|
34635
|
+
} catch (error3) {
|
|
34636
34636
|
const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context;
|
|
34637
34637
|
const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
|
|
34638
34638
|
const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
|
|
@@ -34640,10 +34640,10 @@ var require_dist_cjs31 = __commonJS((exports2) => {
|
|
|
34640
34640
|
clientName,
|
|
34641
34641
|
commandName,
|
|
34642
34642
|
input: inputFilterSensitiveLog(args.input),
|
|
34643
|
-
error:
|
|
34644
|
-
metadata:
|
|
34643
|
+
error: error3,
|
|
34644
|
+
metadata: error3.$metadata
|
|
34645
34645
|
});
|
|
34646
|
-
throw
|
|
34646
|
+
throw error3;
|
|
34647
34647
|
}
|
|
34648
34648
|
};
|
|
34649
34649
|
var loggerMiddlewareOptions = {
|
|
@@ -35134,9 +35134,9 @@ var require_dist_cjs35 = __commonJS((exports2) => {
|
|
|
35134
35134
|
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
|
35135
35135
|
}
|
|
35136
35136
|
async getIdentity(key) {
|
|
35137
|
-
await this.cache.purgeExpired().catch((
|
|
35137
|
+
await this.cache.purgeExpired().catch((error3) => {
|
|
35138
35138
|
console.warn(`Error while clearing expired entries in S3ExpressIdentityCache:
|
|
35139
|
-
` +
|
|
35139
|
+
` + error3);
|
|
35140
35140
|
});
|
|
35141
35141
|
const session = await this.createSessionFn(key);
|
|
35142
35142
|
if (!session.Credentials?.AccessKeyId || !session.Credentials?.SecretAccessKey) {
|
|
@@ -35247,8 +35247,8 @@ var require_dist_cjs35 = __commonJS((exports2) => {
|
|
|
35247
35247
|
}
|
|
35248
35248
|
return signedRequest;
|
|
35249
35249
|
};
|
|
35250
|
-
var defaultErrorHandler = (signingProperties) => (
|
|
35251
|
-
throw
|
|
35250
|
+
var defaultErrorHandler = (signingProperties) => (error3) => {
|
|
35251
|
+
throw error3;
|
|
35252
35252
|
};
|
|
35253
35253
|
var defaultSuccessHandler = (httpResponse, signingProperties) => {};
|
|
35254
35254
|
var s3ExpressHttpSigningMiddlewareOptions = core$1.httpSigningMiddlewareOptions;
|
|
@@ -35587,7 +35587,7 @@ var require_dist_cjs36 = __commonJS((exports2) => {
|
|
|
35587
35587
|
return url;
|
|
35588
35588
|
}
|
|
35589
35589
|
return new URL(value);
|
|
35590
|
-
} catch (
|
|
35590
|
+
} catch (error3) {
|
|
35591
35591
|
return null;
|
|
35592
35592
|
}
|
|
35593
35593
|
})();
|
|
@@ -35772,9 +35772,9 @@ var require_dist_cjs36 = __commonJS((exports2) => {
|
|
|
35772
35772
|
if (typeof expression === "string") {
|
|
35773
35773
|
try {
|
|
35774
35774
|
return new URL(expression);
|
|
35775
|
-
} catch (
|
|
35776
|
-
console.error(`Failed to construct URL with ${expression}`,
|
|
35777
|
-
throw
|
|
35775
|
+
} catch (error3) {
|
|
35776
|
+
console.error(`Failed to construct URL with ${expression}`, error3);
|
|
35777
|
+
throw error3;
|
|
35778
35778
|
}
|
|
35779
35779
|
}
|
|
35780
35780
|
throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`);
|
|
@@ -35802,12 +35802,12 @@ var require_dist_cjs36 = __commonJS((exports2) => {
|
|
|
35802
35802
|
};
|
|
35803
35803
|
};
|
|
35804
35804
|
var evaluateErrorRule = (errorRule, options2) => {
|
|
35805
|
-
const { conditions, error:
|
|
35805
|
+
const { conditions, error: error3 } = errorRule;
|
|
35806
35806
|
const { result, referenceRecord } = evaluateConditions(conditions, options2);
|
|
35807
35807
|
if (!result) {
|
|
35808
35808
|
return;
|
|
35809
35809
|
}
|
|
35810
|
-
throw new EndpointError(evaluateExpression(
|
|
35810
|
+
throw new EndpointError(evaluateExpression(error3, "Error", {
|
|
35811
35811
|
...options2,
|
|
35812
35812
|
referenceRecord: { ...options2.referenceRecord, ...referenceRecord }
|
|
35813
35813
|
}));
|
|
@@ -36696,7 +36696,7 @@ var require_dist_cjs43 = __commonJS((exports2) => {
|
|
|
36696
36696
|
...request.headers,
|
|
36697
36697
|
[CONTENT_LENGTH_HEADER]: String(length)
|
|
36698
36698
|
};
|
|
36699
|
-
} catch (
|
|
36699
|
+
} catch (error3) {}
|
|
36700
36700
|
}
|
|
36701
36701
|
}
|
|
36702
36702
|
return next({
|
|
@@ -37345,10 +37345,10 @@ var require_dist_cjs47 = __commonJS((exports2) => {
|
|
|
37345
37345
|
var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
|
|
37346
37346
|
var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
|
|
37347
37347
|
var NODEJS_NETWORK_ERROR_CODES = ["EHOSTUNREACH", "ENETUNREACH", "ENOTFOUND"];
|
|
37348
|
-
var isRetryableByTrait = (
|
|
37349
|
-
var isClockSkewError = (
|
|
37350
|
-
var isClockSkewCorrectedError = (
|
|
37351
|
-
var isBrowserNetworkError = (
|
|
37348
|
+
var isRetryableByTrait = (error3) => error3?.$retryable !== undefined;
|
|
37349
|
+
var isClockSkewError = (error3) => CLOCK_SKEW_ERROR_CODES.includes(error3.name);
|
|
37350
|
+
var isClockSkewCorrectedError = (error3) => error3.$metadata?.clockSkewCorrected;
|
|
37351
|
+
var isBrowserNetworkError = (error3) => {
|
|
37352
37352
|
const errorMessages = new Set([
|
|
37353
37353
|
"Failed to fetch",
|
|
37354
37354
|
"NetworkError when attempting to fetch resource",
|
|
@@ -37356,18 +37356,18 @@ var require_dist_cjs47 = __commonJS((exports2) => {
|
|
|
37356
37356
|
"Load failed",
|
|
37357
37357
|
"Network request failed"
|
|
37358
37358
|
]);
|
|
37359
|
-
const isValid2 =
|
|
37359
|
+
const isValid2 = error3 && error3 instanceof TypeError;
|
|
37360
37360
|
if (!isValid2) {
|
|
37361
37361
|
return false;
|
|
37362
37362
|
}
|
|
37363
|
-
return errorMessages.has(
|
|
37363
|
+
return errorMessages.has(error3.message);
|
|
37364
37364
|
};
|
|
37365
|
-
var isThrottlingError = (
|
|
37366
|
-
var isTransientError = (
|
|
37367
|
-
var isServerError = (
|
|
37368
|
-
if (
|
|
37369
|
-
const statusCode =
|
|
37370
|
-
if (500 <= statusCode && statusCode <= 599 && !isTransientError(
|
|
37365
|
+
var isThrottlingError = (error3) => error3.$metadata?.httpStatusCode === 429 || THROTTLING_ERROR_CODES.includes(error3.name) || error3.$retryable?.throttling == true;
|
|
37366
|
+
var isTransientError = (error3, depth = 0) => isRetryableByTrait(error3) || isClockSkewCorrectedError(error3) || TRANSIENT_ERROR_CODES.includes(error3.name) || NODEJS_TIMEOUT_ERROR_CODES.includes(error3?.code || "") || NODEJS_NETWORK_ERROR_CODES.includes(error3?.code || "") || TRANSIENT_ERROR_STATUS_CODES.includes(error3.$metadata?.httpStatusCode || 0) || isBrowserNetworkError(error3) || error3.cause !== undefined && depth <= 10 && isTransientError(error3.cause, depth + 1);
|
|
37367
|
+
var isServerError = (error3) => {
|
|
37368
|
+
if (error3.$metadata?.httpStatusCode !== undefined) {
|
|
37369
|
+
const statusCode = error3.$metadata.httpStatusCode;
|
|
37370
|
+
if (500 <= statusCode && statusCode <= 599 && !isTransientError(error3)) {
|
|
37371
37371
|
return true;
|
|
37372
37372
|
}
|
|
37373
37373
|
return false;
|
|
@@ -37576,7 +37576,7 @@ var require_dist_cjs48 = __commonJS((exports2) => {
|
|
|
37576
37576
|
async getMaxAttempts() {
|
|
37577
37577
|
try {
|
|
37578
37578
|
return await this.maxAttemptsProvider();
|
|
37579
|
-
} catch (
|
|
37579
|
+
} catch (error3) {
|
|
37580
37580
|
console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
|
|
37581
37581
|
return DEFAULT_MAX_ATTEMPTS;
|
|
37582
37582
|
}
|
|
@@ -37675,13 +37675,13 @@ var require_dist_cjs49 = __commonJS((exports2) => {
|
|
|
37675
37675
|
const retryCost = utilRetry.RETRY_COST;
|
|
37676
37676
|
const timeoutRetryCost = utilRetry.TIMEOUT_RETRY_COST;
|
|
37677
37677
|
let availableCapacity = initialRetryTokens;
|
|
37678
|
-
const getCapacityAmount = (
|
|
37679
|
-
const hasRetryTokens = (
|
|
37680
|
-
const retrieveRetryTokens = (
|
|
37681
|
-
if (!hasRetryTokens(
|
|
37678
|
+
const getCapacityAmount = (error3) => error3.name === "TimeoutError" ? timeoutRetryCost : retryCost;
|
|
37679
|
+
const hasRetryTokens = (error3) => getCapacityAmount(error3) <= availableCapacity;
|
|
37680
|
+
const retrieveRetryTokens = (error3) => {
|
|
37681
|
+
if (!hasRetryTokens(error3)) {
|
|
37682
37682
|
throw new Error("No retry token available");
|
|
37683
37683
|
}
|
|
37684
|
-
const capacityAmount = getCapacityAmount(
|
|
37684
|
+
const capacityAmount = getCapacityAmount(error3);
|
|
37685
37685
|
availableCapacity -= capacityAmount;
|
|
37686
37686
|
return capacityAmount;
|
|
37687
37687
|
};
|
|
@@ -37696,20 +37696,20 @@ var require_dist_cjs49 = __commonJS((exports2) => {
|
|
|
37696
37696
|
});
|
|
37697
37697
|
};
|
|
37698
37698
|
var defaultDelayDecider = (delayBase, attempts) => Math.floor(Math.min(utilRetry.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
|
|
37699
|
-
var defaultRetryDecider = (
|
|
37700
|
-
if (!
|
|
37699
|
+
var defaultRetryDecider = (error3) => {
|
|
37700
|
+
if (!error3) {
|
|
37701
37701
|
return false;
|
|
37702
37702
|
}
|
|
37703
|
-
return serviceErrorClassification.isRetryableByTrait(
|
|
37703
|
+
return serviceErrorClassification.isRetryableByTrait(error3) || serviceErrorClassification.isClockSkewError(error3) || serviceErrorClassification.isThrottlingError(error3) || serviceErrorClassification.isTransientError(error3);
|
|
37704
37704
|
};
|
|
37705
|
-
var asSdkError = (
|
|
37706
|
-
if (
|
|
37707
|
-
return
|
|
37708
|
-
if (
|
|
37709
|
-
return Object.assign(new Error,
|
|
37710
|
-
if (typeof
|
|
37711
|
-
return new Error(
|
|
37712
|
-
return new Error(`AWS SDK error wrapper for ${
|
|
37705
|
+
var asSdkError = (error3) => {
|
|
37706
|
+
if (error3 instanceof Error)
|
|
37707
|
+
return error3;
|
|
37708
|
+
if (error3 instanceof Object)
|
|
37709
|
+
return Object.assign(new Error, error3);
|
|
37710
|
+
if (typeof error3 === "string")
|
|
37711
|
+
return new Error(error3);
|
|
37712
|
+
return new Error(`AWS SDK error wrapper for ${error3}`);
|
|
37713
37713
|
};
|
|
37714
37714
|
|
|
37715
37715
|
class StandardRetryStrategy {
|
|
@@ -37724,14 +37724,14 @@ var require_dist_cjs49 = __commonJS((exports2) => {
|
|
|
37724
37724
|
this.delayDecider = options2?.delayDecider ?? defaultDelayDecider;
|
|
37725
37725
|
this.retryQuota = options2?.retryQuota ?? getDefaultRetryQuota(utilRetry.INITIAL_RETRY_TOKENS);
|
|
37726
37726
|
}
|
|
37727
|
-
shouldRetry(
|
|
37728
|
-
return attempts < maxAttempts && this.retryDecider(
|
|
37727
|
+
shouldRetry(error3, attempts, maxAttempts) {
|
|
37728
|
+
return attempts < maxAttempts && this.retryDecider(error3) && this.retryQuota.hasRetryTokens(error3);
|
|
37729
37729
|
}
|
|
37730
37730
|
async getMaxAttempts() {
|
|
37731
37731
|
let maxAttempts;
|
|
37732
37732
|
try {
|
|
37733
37733
|
maxAttempts = await this.maxAttemptsProvider();
|
|
37734
|
-
} catch (
|
|
37734
|
+
} catch (error3) {
|
|
37735
37735
|
maxAttempts = utilRetry.DEFAULT_MAX_ATTEMPTS;
|
|
37736
37736
|
}
|
|
37737
37737
|
return maxAttempts;
|
|
@@ -37940,23 +37940,23 @@ var require_dist_cjs49 = __commonJS((exports2) => {
|
|
|
37940
37940
|
}
|
|
37941
37941
|
};
|
|
37942
37942
|
var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
|
|
37943
|
-
var getRetryErrorInfo = (
|
|
37943
|
+
var getRetryErrorInfo = (error3) => {
|
|
37944
37944
|
const errorInfo = {
|
|
37945
|
-
error:
|
|
37946
|
-
errorType: getRetryErrorType(
|
|
37945
|
+
error: error3,
|
|
37946
|
+
errorType: getRetryErrorType(error3)
|
|
37947
37947
|
};
|
|
37948
|
-
const retryAfterHint = getRetryAfterHint(
|
|
37948
|
+
const retryAfterHint = getRetryAfterHint(error3.$response);
|
|
37949
37949
|
if (retryAfterHint) {
|
|
37950
37950
|
errorInfo.retryAfterHint = retryAfterHint;
|
|
37951
37951
|
}
|
|
37952
37952
|
return errorInfo;
|
|
37953
37953
|
};
|
|
37954
|
-
var getRetryErrorType = (
|
|
37955
|
-
if (serviceErrorClassification.isThrottlingError(
|
|
37954
|
+
var getRetryErrorType = (error3) => {
|
|
37955
|
+
if (serviceErrorClassification.isThrottlingError(error3))
|
|
37956
37956
|
return "THROTTLING";
|
|
37957
|
-
if (serviceErrorClassification.isTransientError(
|
|
37957
|
+
if (serviceErrorClassification.isTransientError(error3))
|
|
37958
37958
|
return "TRANSIENT";
|
|
37959
|
-
if (serviceErrorClassification.isServerError(
|
|
37959
|
+
if (serviceErrorClassification.isServerError(error3))
|
|
37960
37960
|
return "SERVER_ERROR";
|
|
37961
37961
|
return "CLIENT_ERROR";
|
|
37962
37962
|
};
|
|
@@ -38332,18 +38332,18 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
38332
38332
|
return signedRequest;
|
|
38333
38333
|
}
|
|
38334
38334
|
errorHandler(signingProperties) {
|
|
38335
|
-
return (
|
|
38336
|
-
const serverTime =
|
|
38335
|
+
return (error3) => {
|
|
38336
|
+
const serverTime = error3.ServerTime ?? getDateHeader(error3.$response);
|
|
38337
38337
|
if (serverTime) {
|
|
38338
38338
|
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
38339
38339
|
const initialSystemClockOffset = config.systemClockOffset;
|
|
38340
38340
|
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
38341
38341
|
const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
|
|
38342
|
-
if (clockSkewCorrected &&
|
|
38343
|
-
|
|
38342
|
+
if (clockSkewCorrected && error3.$metadata) {
|
|
38343
|
+
error3.$metadata.clockSkewCorrected = true;
|
|
38344
38344
|
}
|
|
38345
38345
|
}
|
|
38346
|
-
throw
|
|
38346
|
+
throw error3;
|
|
38347
38347
|
};
|
|
38348
38348
|
}
|
|
38349
38349
|
successHandler(httpResponse, signingProperties) {
|
|
@@ -38606,21 +38606,21 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
38606
38606
|
decorateServiceException(exception, additions = {}) {
|
|
38607
38607
|
if (this.queryCompat) {
|
|
38608
38608
|
const msg = exception.Message ?? additions.Message;
|
|
38609
|
-
const
|
|
38609
|
+
const error3 = smithyClient.decorateServiceException(exception, additions);
|
|
38610
38610
|
if (msg) {
|
|
38611
|
-
|
|
38611
|
+
error3.message = msg;
|
|
38612
38612
|
}
|
|
38613
|
-
|
|
38614
|
-
...
|
|
38615
|
-
Type:
|
|
38616
|
-
Code:
|
|
38617
|
-
Message:
|
|
38613
|
+
error3.Error = {
|
|
38614
|
+
...error3.Error,
|
|
38615
|
+
Type: error3.Error.Type,
|
|
38616
|
+
Code: error3.Error.Code,
|
|
38617
|
+
Message: error3.Error.message ?? error3.Error.Message ?? msg
|
|
38618
38618
|
};
|
|
38619
|
-
const reqId =
|
|
38619
|
+
const reqId = error3.$metadata.requestId;
|
|
38620
38620
|
if (reqId) {
|
|
38621
|
-
|
|
38621
|
+
error3.RequestId = reqId;
|
|
38622
38622
|
}
|
|
38623
|
-
return
|
|
38623
|
+
return error3;
|
|
38624
38624
|
}
|
|
38625
38625
|
return smithyClient.decorateServiceException(exception, additions);
|
|
38626
38626
|
}
|
|
@@ -40597,9 +40597,9 @@ var require_dist_cjs53 = __commonJS((exports2) => {
|
|
|
40597
40597
|
return cache.set(key, new S3ExpressIdentityCacheEntry(this.getIdentity(key))).identity;
|
|
40598
40598
|
}
|
|
40599
40599
|
async getIdentity(key) {
|
|
40600
|
-
await this.cache.purgeExpired().catch((
|
|
40600
|
+
await this.cache.purgeExpired().catch((error3) => {
|
|
40601
40601
|
console.warn(`Error while clearing expired entries in S3ExpressIdentityCache:
|
|
40602
|
-
` +
|
|
40602
|
+
` + error3);
|
|
40603
40603
|
});
|
|
40604
40604
|
const session = await this.createSessionFn(key);
|
|
40605
40605
|
if (!session.Credentials?.AccessKeyId || !session.Credentials?.SecretAccessKey) {
|
|
@@ -40710,8 +40710,8 @@ var require_dist_cjs53 = __commonJS((exports2) => {
|
|
|
40710
40710
|
}
|
|
40711
40711
|
return signedRequest;
|
|
40712
40712
|
};
|
|
40713
|
-
var defaultErrorHandler = (signingProperties) => (
|
|
40714
|
-
throw
|
|
40713
|
+
var defaultErrorHandler = (signingProperties) => (error3) => {
|
|
40714
|
+
throw error3;
|
|
40715
40715
|
};
|
|
40716
40716
|
var defaultSuccessHandler = (httpResponse, signingProperties) => {};
|
|
40717
40717
|
var s3ExpressHttpSigningMiddlewareOptions = core$1.httpSigningMiddlewareOptions;
|
|
@@ -41826,12 +41826,12 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL);
|
|
|
41826
41826
|
let token;
|
|
41827
41827
|
try {
|
|
41828
41828
|
token = (await getMetadataToken({ ...endpoint, timeout })).toString();
|
|
41829
|
-
} catch (
|
|
41830
|
-
if (
|
|
41831
|
-
throw Object.assign(
|
|
41829
|
+
} catch (error3) {
|
|
41830
|
+
if (error3?.statusCode === 400) {
|
|
41831
|
+
throw Object.assign(error3, {
|
|
41832
41832
|
message: "EC2 Metadata token request returned error"
|
|
41833
41833
|
});
|
|
41834
|
-
} else if (
|
|
41834
|
+
} else if (error3.message === "TimeoutError" || [403, 404, 405].includes(error3.statusCode)) {
|
|
41835
41835
|
disableFetchToken = true;
|
|
41836
41836
|
}
|
|
41837
41837
|
logger2?.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
|
|
@@ -42130,18 +42130,18 @@ var require_httpAuthSchemes = __commonJS((exports2) => {
|
|
|
42130
42130
|
return signedRequest;
|
|
42131
42131
|
}
|
|
42132
42132
|
errorHandler(signingProperties) {
|
|
42133
|
-
return (
|
|
42134
|
-
const serverTime =
|
|
42133
|
+
return (error3) => {
|
|
42134
|
+
const serverTime = error3.ServerTime ?? getDateHeader(error3.$response);
|
|
42135
42135
|
if (serverTime) {
|
|
42136
42136
|
const config = throwSigningPropertyError("config", signingProperties.config);
|
|
42137
42137
|
const initialSystemClockOffset = config.systemClockOffset;
|
|
42138
42138
|
config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
|
|
42139
42139
|
const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
|
|
42140
|
-
if (clockSkewCorrected &&
|
|
42141
|
-
|
|
42140
|
+
if (clockSkewCorrected && error3.$metadata) {
|
|
42141
|
+
error3.$metadata.clockSkewCorrected = true;
|
|
42142
42142
|
}
|
|
42143
42143
|
}
|
|
42144
|
-
throw
|
|
42144
|
+
throw error3;
|
|
42145
42145
|
};
|
|
42146
42146
|
}
|
|
42147
42147
|
successHandler(httpResponse, signingProperties) {
|
|
@@ -42807,21 +42807,21 @@ var require_protocols2 = __commonJS((exports2) => {
|
|
|
42807
42807
|
decorateServiceException(exception, additions = {}) {
|
|
42808
42808
|
if (this.queryCompat) {
|
|
42809
42809
|
const msg = exception.Message ?? additions.Message;
|
|
42810
|
-
const
|
|
42810
|
+
const error3 = smithyClient.decorateServiceException(exception, additions);
|
|
42811
42811
|
if (msg) {
|
|
42812
|
-
|
|
42812
|
+
error3.message = msg;
|
|
42813
42813
|
}
|
|
42814
|
-
|
|
42815
|
-
...
|
|
42816
|
-
Type:
|
|
42817
|
-
Code:
|
|
42818
|
-
Message:
|
|
42814
|
+
error3.Error = {
|
|
42815
|
+
...error3.Error,
|
|
42816
|
+
Type: error3.Error.Type,
|
|
42817
|
+
Code: error3.Error.Code,
|
|
42818
|
+
Message: error3.Error.message ?? error3.Error.Message ?? msg
|
|
42819
42819
|
};
|
|
42820
|
-
const reqId =
|
|
42820
|
+
const reqId = error3.$metadata.requestId;
|
|
42821
42821
|
if (reqId) {
|
|
42822
|
-
|
|
42822
|
+
error3.RequestId = reqId;
|
|
42823
42823
|
}
|
|
42824
|
-
return
|
|
42824
|
+
return error3;
|
|
42825
42825
|
}
|
|
42826
42826
|
return smithyClient.decorateServiceException(exception, additions);
|
|
42827
42827
|
}
|
|
@@ -45368,12 +45368,12 @@ var require_dist_cjs63 = __commonJS((exports2) => {
|
|
|
45368
45368
|
expiresAt: newTokenExpiration.toISOString(),
|
|
45369
45369
|
refreshToken: newSsoOidcToken.refreshToken
|
|
45370
45370
|
});
|
|
45371
|
-
} catch (
|
|
45371
|
+
} catch (error3) {}
|
|
45372
45372
|
return {
|
|
45373
45373
|
token: newSsoOidcToken.accessToken,
|
|
45374
45374
|
expiration: newTokenExpiration
|
|
45375
45375
|
};
|
|
45376
|
-
} catch (
|
|
45376
|
+
} catch (error3) {
|
|
45377
45377
|
validateTokenExpiry(existingToken);
|
|
45378
45378
|
return existingToken;
|
|
45379
45379
|
}
|
|
@@ -47056,9 +47056,9 @@ var require_dist_cjs66 = __commonJS((exports2) => {
|
|
|
47056
47056
|
accountId: newAccessToken.accountId,
|
|
47057
47057
|
expiration
|
|
47058
47058
|
};
|
|
47059
|
-
} catch (
|
|
47060
|
-
if (
|
|
47061
|
-
const errorType =
|
|
47059
|
+
} catch (error3) {
|
|
47060
|
+
if (error3.name === "AccessDeniedException") {
|
|
47061
|
+
const errorType = error3.error;
|
|
47062
47062
|
let message;
|
|
47063
47063
|
switch (errorType) {
|
|
47064
47064
|
case "TOKEN_EXPIRED":
|
|
@@ -47071,11 +47071,11 @@ var require_dist_cjs66 = __commonJS((exports2) => {
|
|
|
47071
47071
|
message = "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
|
|
47072
47072
|
break;
|
|
47073
47073
|
default:
|
|
47074
|
-
message = `Failed to refresh token: ${String(
|
|
47074
|
+
message = `Failed to refresh token: ${String(error3)}. Please re-authenticate using \`aws login\``;
|
|
47075
47075
|
}
|
|
47076
47076
|
throw new propertyProvider.CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });
|
|
47077
47077
|
}
|
|
47078
|
-
throw new propertyProvider.CredentialsProviderError(`Failed to refresh token: ${String(
|
|
47078
|
+
throw new propertyProvider.CredentialsProviderError(`Failed to refresh token: ${String(error3)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
47079
47079
|
}
|
|
47080
47080
|
}
|
|
47081
47081
|
async loadToken() {
|
|
@@ -47099,8 +47099,8 @@ var require_dist_cjs66 = __commonJS((exports2) => {
|
|
|
47099
47099
|
});
|
|
47100
47100
|
}
|
|
47101
47101
|
return token;
|
|
47102
|
-
} catch (
|
|
47103
|
-
throw new propertyProvider.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(
|
|
47102
|
+
} catch (error3) {
|
|
47103
|
+
throw new propertyProvider.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error3)}`, {
|
|
47104
47104
|
logger: this.logger,
|
|
47105
47105
|
tryNextLink: false
|
|
47106
47106
|
});
|
|
@@ -47111,7 +47111,7 @@ var require_dist_cjs66 = __commonJS((exports2) => {
|
|
|
47111
47111
|
const directory = node_path.dirname(tokenFilePath);
|
|
47112
47112
|
try {
|
|
47113
47113
|
await node_fs.promises.mkdir(directory, { recursive: true });
|
|
47114
|
-
} catch (
|
|
47114
|
+
} catch (error3) {}
|
|
47115
47115
|
await node_fs.promises.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
|
|
47116
47116
|
}
|
|
47117
47117
|
getTokenFilePath() {
|
|
@@ -47201,8 +47201,8 @@ var require_dist_cjs66 = __commonJS((exports2) => {
|
|
|
47201
47201
|
const rawSignature = this.derToRawSignature(asn1Signature);
|
|
47202
47202
|
const signatureB64 = rawSignature.toString("base64url");
|
|
47203
47203
|
return `${message}.${signatureB64}`;
|
|
47204
|
-
} catch (
|
|
47205
|
-
throw new propertyProvider.CredentialsProviderError(`Failed to generate Dpop proof: ${
|
|
47204
|
+
} catch (error3) {
|
|
47205
|
+
throw new propertyProvider.CredentialsProviderError(`Failed to generate Dpop proof: ${error3 instanceof Error ? error3.message : String(error3)}`, { logger: this.logger, tryNextLink: false });
|
|
47206
47206
|
}
|
|
47207
47207
|
}
|
|
47208
47208
|
}
|
|
@@ -48144,8 +48144,8 @@ var require_dist_cjs67 = __commonJS((exports2) => {
|
|
|
48144
48144
|
throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
|
|
48145
48145
|
}
|
|
48146
48146
|
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
48147
|
-
} catch (
|
|
48148
|
-
throw new propertyProvider.CredentialsProviderError(
|
|
48147
|
+
} catch (error3) {
|
|
48148
|
+
throw new propertyProvider.CredentialsProviderError(error3.message, { logger: logger2 });
|
|
48149
48149
|
}
|
|
48150
48150
|
} else {
|
|
48151
48151
|
throw new propertyProvider.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger: logger2 });
|
|
@@ -49429,9 +49429,9 @@ var require_dist_cjs73 = __commonJS((exports2) => {
|
|
|
49429
49429
|
const exception = { [code]: message };
|
|
49430
49430
|
const deserializedException = await deserializer(exception);
|
|
49431
49431
|
if (deserializedException.$unknown) {
|
|
49432
|
-
const
|
|
49433
|
-
|
|
49434
|
-
throw
|
|
49432
|
+
const error3 = new Error(toUtf8(message.body));
|
|
49433
|
+
error3.name = code;
|
|
49434
|
+
throw error3;
|
|
49435
49435
|
}
|
|
49436
49436
|
throw deserializedException[code];
|
|
49437
49437
|
} else if (messageType === "event") {
|
|
@@ -58126,8 +58126,8 @@ var require_array = __commonJS((exports2) => {
|
|
|
58126
58126
|
var require_errno = __commonJS((exports2) => {
|
|
58127
58127
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
58128
58128
|
exports2.isEnoentCodeError = undefined;
|
|
58129
|
-
function isEnoentCodeError(
|
|
58130
|
-
return
|
|
58129
|
+
function isEnoentCodeError(error3) {
|
|
58130
|
+
return error3.code === "ENOENT";
|
|
58131
58131
|
}
|
|
58132
58132
|
exports2.isEnoentCodeError = isEnoentCodeError;
|
|
58133
58133
|
});
|
|
@@ -61312,7 +61312,7 @@ var require_stream = __commonJS((exports2) => {
|
|
|
61312
61312
|
function merge(streams) {
|
|
61313
61313
|
const mergedStream = merge2(streams);
|
|
61314
61314
|
streams.forEach((stream) => {
|
|
61315
|
-
stream.once("error", (
|
|
61315
|
+
stream.once("error", (error3) => mergedStream.emit("error", error3));
|
|
61316
61316
|
});
|
|
61317
61317
|
mergedStream.once("close", () => propagateCloseEventToSources(streams));
|
|
61318
61318
|
mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
|
@@ -61472,8 +61472,8 @@ var require_async = __commonJS((exports2) => {
|
|
|
61472
61472
|
});
|
|
61473
61473
|
}
|
|
61474
61474
|
exports2.read = read;
|
|
61475
|
-
function callFailureCallback(callback,
|
|
61476
|
-
callback(
|
|
61475
|
+
function callFailureCallback(callback, error3) {
|
|
61476
|
+
callback(error3);
|
|
61477
61477
|
}
|
|
61478
61478
|
function callSuccessCallback(callback, result) {
|
|
61479
61479
|
callback(null, result);
|
|
@@ -61495,11 +61495,11 @@ var require_sync = __commonJS((exports2) => {
|
|
|
61495
61495
|
stat.isSymbolicLink = () => true;
|
|
61496
61496
|
}
|
|
61497
61497
|
return stat;
|
|
61498
|
-
} catch (
|
|
61498
|
+
} catch (error3) {
|
|
61499
61499
|
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
|
61500
61500
|
return lstat;
|
|
61501
61501
|
}
|
|
61502
|
-
throw
|
|
61502
|
+
throw error3;
|
|
61503
61503
|
}
|
|
61504
61504
|
}
|
|
61505
61505
|
exports2.read = read;
|
|
@@ -61768,9 +61768,9 @@ var require_async2 = __commonJS((exports2) => {
|
|
|
61768
61768
|
const tasks = names.map((name) => {
|
|
61769
61769
|
const path = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
|
61770
61770
|
return (done) => {
|
|
61771
|
-
fsStat.stat(path, settings.fsStatSettings, (
|
|
61772
|
-
if (
|
|
61773
|
-
done(
|
|
61771
|
+
fsStat.stat(path, settings.fsStatSettings, (error3, stats) => {
|
|
61772
|
+
if (error3 !== null) {
|
|
61773
|
+
done(error3);
|
|
61774
61774
|
return;
|
|
61775
61775
|
}
|
|
61776
61776
|
const entry = {
|
|
@@ -61795,8 +61795,8 @@ var require_async2 = __commonJS((exports2) => {
|
|
|
61795
61795
|
});
|
|
61796
61796
|
}
|
|
61797
61797
|
exports2.readdir = readdir;
|
|
61798
|
-
function callFailureCallback(callback,
|
|
61799
|
-
callback(
|
|
61798
|
+
function callFailureCallback(callback, error3) {
|
|
61799
|
+
callback(error3);
|
|
61800
61800
|
}
|
|
61801
61801
|
function callSuccessCallback(callback, result) {
|
|
61802
61802
|
callback(null, result);
|
|
@@ -61830,9 +61830,9 @@ var require_sync2 = __commonJS((exports2) => {
|
|
|
61830
61830
|
try {
|
|
61831
61831
|
const stats = settings.fs.statSync(entry.path);
|
|
61832
61832
|
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
|
61833
|
-
} catch (
|
|
61833
|
+
} catch (error3) {
|
|
61834
61834
|
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
61835
|
-
throw
|
|
61835
|
+
throw error3;
|
|
61836
61836
|
}
|
|
61837
61837
|
}
|
|
61838
61838
|
}
|
|
@@ -62013,7 +62013,7 @@ var require_queue = __commonJS((exports2, module2) => {
|
|
|
62013
62013
|
empty: noop,
|
|
62014
62014
|
kill,
|
|
62015
62015
|
killAndDrain,
|
|
62016
|
-
error:
|
|
62016
|
+
error: error3,
|
|
62017
62017
|
abort
|
|
62018
62018
|
};
|
|
62019
62019
|
return self2;
|
|
@@ -62156,7 +62156,7 @@ var require_queue = __commonJS((exports2, module2) => {
|
|
|
62156
62156
|
}
|
|
62157
62157
|
self2.drain = noop;
|
|
62158
62158
|
}
|
|
62159
|
-
function
|
|
62159
|
+
function error3(handler) {
|
|
62160
62160
|
errorHandler = handler;
|
|
62161
62161
|
}
|
|
62162
62162
|
}
|
|
@@ -62253,11 +62253,11 @@ var require_queue = __commonJS((exports2, module2) => {
|
|
|
62253
62253
|
var require_common4 = __commonJS((exports2) => {
|
|
62254
62254
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
62255
62255
|
exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = undefined;
|
|
62256
|
-
function isFatalError(settings,
|
|
62256
|
+
function isFatalError(settings, error3) {
|
|
62257
62257
|
if (settings.errorFilter === null) {
|
|
62258
62258
|
return true;
|
|
62259
62259
|
}
|
|
62260
|
-
return !settings.errorFilter(
|
|
62260
|
+
return !settings.errorFilter(error3);
|
|
62261
62261
|
}
|
|
62262
62262
|
exports2.isFatalError = isFatalError;
|
|
62263
62263
|
function isAppliedFilter(filter, value) {
|
|
@@ -62348,16 +62348,16 @@ var require_async3 = __commonJS((exports2) => {
|
|
|
62348
62348
|
}
|
|
62349
62349
|
_pushToQueue(directory, base) {
|
|
62350
62350
|
const queueItem = { directory, base };
|
|
62351
|
-
this._queue.push(queueItem, (
|
|
62352
|
-
if (
|
|
62353
|
-
this._handleError(
|
|
62351
|
+
this._queue.push(queueItem, (error3) => {
|
|
62352
|
+
if (error3 !== null) {
|
|
62353
|
+
this._handleError(error3);
|
|
62354
62354
|
}
|
|
62355
62355
|
});
|
|
62356
62356
|
}
|
|
62357
62357
|
_worker(item, done) {
|
|
62358
|
-
this._scandir(item.directory, this._settings.fsScandirSettings, (
|
|
62359
|
-
if (
|
|
62360
|
-
done(
|
|
62358
|
+
this._scandir(item.directory, this._settings.fsScandirSettings, (error3, entries) => {
|
|
62359
|
+
if (error3 !== null) {
|
|
62360
|
+
done(error3, undefined);
|
|
62361
62361
|
return;
|
|
62362
62362
|
}
|
|
62363
62363
|
for (const entry of entries) {
|
|
@@ -62366,13 +62366,13 @@ var require_async3 = __commonJS((exports2) => {
|
|
|
62366
62366
|
done(null, undefined);
|
|
62367
62367
|
});
|
|
62368
62368
|
}
|
|
62369
|
-
_handleError(
|
|
62370
|
-
if (this._isDestroyed || !common2.isFatalError(this._settings,
|
|
62369
|
+
_handleError(error3) {
|
|
62370
|
+
if (this._isDestroyed || !common2.isFatalError(this._settings, error3)) {
|
|
62371
62371
|
return;
|
|
62372
62372
|
}
|
|
62373
62373
|
this._isFatalError = true;
|
|
62374
62374
|
this._isDestroyed = true;
|
|
62375
|
-
this._emitter.emit("error",
|
|
62375
|
+
this._emitter.emit("error", error3);
|
|
62376
62376
|
}
|
|
62377
62377
|
_handleEntry(entry, base) {
|
|
62378
62378
|
if (this._isDestroyed || this._isFatalError) {
|
|
@@ -62409,8 +62409,8 @@ var require_async4 = __commonJS((exports2) => {
|
|
|
62409
62409
|
this._storage = [];
|
|
62410
62410
|
}
|
|
62411
62411
|
read(callback) {
|
|
62412
|
-
this._reader.onError((
|
|
62413
|
-
callFailureCallback(callback,
|
|
62412
|
+
this._reader.onError((error3) => {
|
|
62413
|
+
callFailureCallback(callback, error3);
|
|
62414
62414
|
});
|
|
62415
62415
|
this._reader.onEntry((entry) => {
|
|
62416
62416
|
this._storage.push(entry);
|
|
@@ -62422,8 +62422,8 @@ var require_async4 = __commonJS((exports2) => {
|
|
|
62422
62422
|
}
|
|
62423
62423
|
}
|
|
62424
62424
|
exports2.default = AsyncProvider;
|
|
62425
|
-
function callFailureCallback(callback,
|
|
62426
|
-
callback(
|
|
62425
|
+
function callFailureCallback(callback, error3) {
|
|
62426
|
+
callback(error3);
|
|
62427
62427
|
}
|
|
62428
62428
|
function callSuccessCallback(callback, entries) {
|
|
62429
62429
|
callback(null, entries);
|
|
@@ -62452,8 +62452,8 @@ var require_stream2 = __commonJS((exports2) => {
|
|
|
62452
62452
|
});
|
|
62453
62453
|
}
|
|
62454
62454
|
read() {
|
|
62455
|
-
this._reader.onError((
|
|
62456
|
-
this._stream.emit("error",
|
|
62455
|
+
this._reader.onError((error3) => {
|
|
62456
|
+
this._stream.emit("error", error3);
|
|
62457
62457
|
});
|
|
62458
62458
|
this._reader.onEntry((entry) => {
|
|
62459
62459
|
this._stream.push(entry);
|
|
@@ -62501,15 +62501,15 @@ var require_sync3 = __commonJS((exports2) => {
|
|
|
62501
62501
|
for (const entry of entries) {
|
|
62502
62502
|
this._handleEntry(entry, base);
|
|
62503
62503
|
}
|
|
62504
|
-
} catch (
|
|
62505
|
-
this._handleError(
|
|
62504
|
+
} catch (error3) {
|
|
62505
|
+
this._handleError(error3);
|
|
62506
62506
|
}
|
|
62507
62507
|
}
|
|
62508
|
-
_handleError(
|
|
62509
|
-
if (!common2.isFatalError(this._settings,
|
|
62508
|
+
_handleError(error3) {
|
|
62509
|
+
if (!common2.isFatalError(this._settings, error3)) {
|
|
62510
62510
|
return;
|
|
62511
62511
|
}
|
|
62512
|
-
throw
|
|
62512
|
+
throw error3;
|
|
62513
62513
|
}
|
|
62514
62514
|
_handleEntry(entry, base) {
|
|
62515
62515
|
const fullpath = entry.path;
|
|
@@ -62645,8 +62645,8 @@ var require_reader2 = __commonJS((exports2) => {
|
|
|
62645
62645
|
}
|
|
62646
62646
|
return entry;
|
|
62647
62647
|
}
|
|
62648
|
-
_isFatalError(
|
|
62649
|
-
return !utils.errno.isEnoentCodeError(
|
|
62648
|
+
_isFatalError(error3) {
|
|
62649
|
+
return !utils.errno.isEnoentCodeError(error3) && !this._settings.suppressErrors;
|
|
62650
62650
|
}
|
|
62651
62651
|
}
|
|
62652
62652
|
exports2.default = Reader;
|
|
@@ -62689,17 +62689,17 @@ var require_stream3 = __commonJS((exports2) => {
|
|
|
62689
62689
|
return stream;
|
|
62690
62690
|
}
|
|
62691
62691
|
_getEntry(filepath, pattern, options2) {
|
|
62692
|
-
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((
|
|
62693
|
-
if (options2.errorFilter(
|
|
62692
|
+
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error3) => {
|
|
62693
|
+
if (options2.errorFilter(error3)) {
|
|
62694
62694
|
return null;
|
|
62695
62695
|
}
|
|
62696
|
-
throw
|
|
62696
|
+
throw error3;
|
|
62697
62697
|
});
|
|
62698
62698
|
}
|
|
62699
62699
|
_getStat(filepath) {
|
|
62700
62700
|
return new Promise((resolve6, reject) => {
|
|
62701
|
-
this._stat(filepath, this._fsStatSettings, (
|
|
62702
|
-
return
|
|
62701
|
+
this._stat(filepath, this._fsStatSettings, (error3, stats) => {
|
|
62702
|
+
return error3 === null ? resolve6(stats) : reject(error3);
|
|
62703
62703
|
});
|
|
62704
62704
|
});
|
|
62705
62705
|
}
|
|
@@ -62722,11 +62722,11 @@ var require_async5 = __commonJS((exports2) => {
|
|
|
62722
62722
|
}
|
|
62723
62723
|
dynamic(root, options2) {
|
|
62724
62724
|
return new Promise((resolve6, reject) => {
|
|
62725
|
-
this._walkAsync(root, options2, (
|
|
62726
|
-
if (
|
|
62725
|
+
this._walkAsync(root, options2, (error3, entries) => {
|
|
62726
|
+
if (error3 === null) {
|
|
62727
62727
|
resolve6(entries);
|
|
62728
62728
|
} else {
|
|
62729
|
-
reject(
|
|
62729
|
+
reject(error3);
|
|
62730
62730
|
}
|
|
62731
62731
|
});
|
|
62732
62732
|
});
|
|
@@ -62987,10 +62987,10 @@ var require_error2 = __commonJS((exports2) => {
|
|
|
62987
62987
|
this._settings = _settings;
|
|
62988
62988
|
}
|
|
62989
62989
|
getFilter() {
|
|
62990
|
-
return (
|
|
62990
|
+
return (error3) => this._isNonFatalError(error3);
|
|
62991
62991
|
}
|
|
62992
|
-
_isNonFatalError(
|
|
62993
|
-
return utils.errno.isEnoentCodeError(
|
|
62992
|
+
_isNonFatalError(error3) {
|
|
62993
|
+
return utils.errno.isEnoentCodeError(error3) || this._settings.suppressErrors;
|
|
62994
62994
|
}
|
|
62995
62995
|
}
|
|
62996
62996
|
exports2.default = ErrorFilter;
|
|
@@ -63122,7 +63122,7 @@ var require_stream4 = __commonJS((exports2) => {
|
|
|
63122
63122
|
const options2 = this._getReaderOptions(task);
|
|
63123
63123
|
const source = this.api(root, task, options2);
|
|
63124
63124
|
const destination = new stream_1.Readable({ objectMode: true, read: () => {} });
|
|
63125
|
-
source.once("error", (
|
|
63125
|
+
source.once("error", (error3) => destination.emit("error", error3)).on("data", (entry) => destination.emit("data", options2.transform(entry))).once("end", () => destination.emit("end"));
|
|
63126
63126
|
destination.once("close", () => source.destroy());
|
|
63127
63127
|
return destination;
|
|
63128
63128
|
}
|
|
@@ -63168,11 +63168,11 @@ var require_sync5 = __commonJS((exports2) => {
|
|
|
63168
63168
|
try {
|
|
63169
63169
|
const stats = this._getStat(filepath);
|
|
63170
63170
|
return this._makeEntry(stats, pattern);
|
|
63171
|
-
} catch (
|
|
63172
|
-
if (options2.errorFilter(
|
|
63171
|
+
} catch (error3) {
|
|
63172
|
+
if (options2.errorFilter(error3)) {
|
|
63173
63173
|
return null;
|
|
63174
63174
|
}
|
|
63175
|
-
throw
|
|
63175
|
+
throw error3;
|
|
63176
63176
|
}
|
|
63177
63177
|
}
|
|
63178
63178
|
_getStat(filepath) {
|
|
@@ -81296,6 +81296,293 @@ function createRegistryClient(registry, http2, fs2, shell2) {
|
|
|
81296
81296
|
return new DefaultRegistryClient(registry, http2, fs2, shell2);
|
|
81297
81297
|
}
|
|
81298
81298
|
}
|
|
81299
|
+
var MANIFEST_FILENAME = "grekt.yaml";
|
|
81300
|
+
var DEFAULT_API_HOST = "api.github.com";
|
|
81301
|
+
|
|
81302
|
+
class GitHubRepositoryBrowser {
|
|
81303
|
+
apiHost;
|
|
81304
|
+
owner;
|
|
81305
|
+
repo;
|
|
81306
|
+
token;
|
|
81307
|
+
http;
|
|
81308
|
+
constructor(registry, http2) {
|
|
81309
|
+
if (!registry.project) {
|
|
81310
|
+
throw new Error("GitHub browser requires 'project' field (owner/repo format)");
|
|
81311
|
+
}
|
|
81312
|
+
this.apiHost = resolveApiHost(registry.host);
|
|
81313
|
+
this.token = registry.token;
|
|
81314
|
+
this.http = http2;
|
|
81315
|
+
const parts = registry.project.split("/");
|
|
81316
|
+
if (parts.length !== 2) {
|
|
81317
|
+
throw new Error(`Invalid GitHub project format: "${registry.project}". Expected "owner/repo".`);
|
|
81318
|
+
}
|
|
81319
|
+
this.owner = parts[0];
|
|
81320
|
+
this.repo = parts[1];
|
|
81321
|
+
}
|
|
81322
|
+
async browse() {
|
|
81323
|
+
const treeResult = await this.fetchTree();
|
|
81324
|
+
if (!treeResult.success) {
|
|
81325
|
+
return {
|
|
81326
|
+
success: false,
|
|
81327
|
+
artifacts: [],
|
|
81328
|
+
error: treeResult.error
|
|
81329
|
+
};
|
|
81330
|
+
}
|
|
81331
|
+
const manifestPaths = treeResult.tree.filter((entry) => entry.type === "blob" && entry.path.endsWith(MANIFEST_FILENAME)).map((entry) => entry.path);
|
|
81332
|
+
if (manifestPaths.length === 0) {
|
|
81333
|
+
return { success: true, artifacts: [] };
|
|
81334
|
+
}
|
|
81335
|
+
const artifacts = [];
|
|
81336
|
+
for (const manifestPath of manifestPaths) {
|
|
81337
|
+
const artifact = await this.fetchAndParseManifest(manifestPath);
|
|
81338
|
+
if (artifact) {
|
|
81339
|
+
artifacts.push(artifact);
|
|
81340
|
+
}
|
|
81341
|
+
}
|
|
81342
|
+
return {
|
|
81343
|
+
success: true,
|
|
81344
|
+
artifacts,
|
|
81345
|
+
truncated: treeResult.truncated
|
|
81346
|
+
};
|
|
81347
|
+
}
|
|
81348
|
+
async fetchTree() {
|
|
81349
|
+
const url = `https://${this.apiHost}/repos/${this.owner}/${this.repo}/git/trees/main?recursive=1`;
|
|
81350
|
+
try {
|
|
81351
|
+
const response = await this.http.fetch(url, {
|
|
81352
|
+
headers: this.getHeaders()
|
|
81353
|
+
});
|
|
81354
|
+
if (!response.ok) {
|
|
81355
|
+
if (response.status === 401 || response.status === 403) {
|
|
81356
|
+
return {
|
|
81357
|
+
success: false,
|
|
81358
|
+
tree: [],
|
|
81359
|
+
truncated: false,
|
|
81360
|
+
error: "Authentication failed. Configure a token in .grekt/config.yaml or set GITHUB_TOKEN."
|
|
81361
|
+
};
|
|
81362
|
+
}
|
|
81363
|
+
if (response.status === 404) {
|
|
81364
|
+
return {
|
|
81365
|
+
success: false,
|
|
81366
|
+
tree: [],
|
|
81367
|
+
truncated: false,
|
|
81368
|
+
error: `Repository not found: ${this.owner}/${this.repo}`
|
|
81369
|
+
};
|
|
81370
|
+
}
|
|
81371
|
+
return {
|
|
81372
|
+
success: false,
|
|
81373
|
+
tree: [],
|
|
81374
|
+
truncated: false,
|
|
81375
|
+
error: `GitHub API error: ${response.status} ${response.statusText}`
|
|
81376
|
+
};
|
|
81377
|
+
}
|
|
81378
|
+
const data = await response.json();
|
|
81379
|
+
return {
|
|
81380
|
+
success: true,
|
|
81381
|
+
tree: data.tree,
|
|
81382
|
+
truncated: data.truncated
|
|
81383
|
+
};
|
|
81384
|
+
} catch (err) {
|
|
81385
|
+
return {
|
|
81386
|
+
success: false,
|
|
81387
|
+
tree: [],
|
|
81388
|
+
truncated: false,
|
|
81389
|
+
error: err instanceof Error ? err.message : "Unknown error fetching tree"
|
|
81390
|
+
};
|
|
81391
|
+
}
|
|
81392
|
+
}
|
|
81393
|
+
async fetchAndParseManifest(manifestPath) {
|
|
81394
|
+
const url = `https://${this.apiHost}/repos/${this.owner}/${this.repo}/contents/${manifestPath}`;
|
|
81395
|
+
try {
|
|
81396
|
+
const response = await this.http.fetch(url, {
|
|
81397
|
+
headers: this.getHeaders()
|
|
81398
|
+
});
|
|
81399
|
+
if (!response.ok) {
|
|
81400
|
+
return null;
|
|
81401
|
+
}
|
|
81402
|
+
const data = await response.json();
|
|
81403
|
+
if (data.encoding !== "base64") {
|
|
81404
|
+
return null;
|
|
81405
|
+
}
|
|
81406
|
+
const content = Buffer.from(data.content, "base64").toString("utf-8");
|
|
81407
|
+
const raw = $parse(content);
|
|
81408
|
+
const result = ArtifactManifestSchema.safeParse(raw);
|
|
81409
|
+
if (!result.success) {
|
|
81410
|
+
return null;
|
|
81411
|
+
}
|
|
81412
|
+
const folderPath = manifestPath.replace(`/${MANIFEST_FILENAME}`, "").replace(MANIFEST_FILENAME, "");
|
|
81413
|
+
return {
|
|
81414
|
+
name: result.data.name,
|
|
81415
|
+
version: result.data.version,
|
|
81416
|
+
description: result.data.description ?? "",
|
|
81417
|
+
path: folderPath || "."
|
|
81418
|
+
};
|
|
81419
|
+
} catch {
|
|
81420
|
+
return null;
|
|
81421
|
+
}
|
|
81422
|
+
}
|
|
81423
|
+
getHeaders() {
|
|
81424
|
+
const headers = {
|
|
81425
|
+
Accept: "application/vnd.github+json",
|
|
81426
|
+
"User-Agent": "grekt-cli"
|
|
81427
|
+
};
|
|
81428
|
+
if (this.token) {
|
|
81429
|
+
headers.Authorization = `Bearer ${this.token}`;
|
|
81430
|
+
}
|
|
81431
|
+
return headers;
|
|
81432
|
+
}
|
|
81433
|
+
}
|
|
81434
|
+
function resolveApiHost(host) {
|
|
81435
|
+
if (!host || host === "ghcr.io") {
|
|
81436
|
+
return DEFAULT_API_HOST;
|
|
81437
|
+
}
|
|
81438
|
+
const normalized = host.replace(/^https?:\/\//, "");
|
|
81439
|
+
return normalized;
|
|
81440
|
+
}
|
|
81441
|
+
var MANIFEST_FILENAME2 = "grekt.yaml";
|
|
81442
|
+
var TREE_PAGE_SIZE = 100;
|
|
81443
|
+
|
|
81444
|
+
class GitLabRepositoryBrowser {
|
|
81445
|
+
host;
|
|
81446
|
+
encodedProject;
|
|
81447
|
+
token;
|
|
81448
|
+
http;
|
|
81449
|
+
constructor(registry, http2) {
|
|
81450
|
+
if (!registry.project) {
|
|
81451
|
+
throw new Error("GitLab browser requires 'project' field in config");
|
|
81452
|
+
}
|
|
81453
|
+
this.host = normalizeHost2(registry.host);
|
|
81454
|
+
this.encodedProject = encodeURIComponent(normalizeProject2(registry.project));
|
|
81455
|
+
this.token = registry.token;
|
|
81456
|
+
this.http = http2;
|
|
81457
|
+
}
|
|
81458
|
+
async browse() {
|
|
81459
|
+
const treeResult = await this.fetchTree();
|
|
81460
|
+
if (!treeResult.success) {
|
|
81461
|
+
return {
|
|
81462
|
+
success: false,
|
|
81463
|
+
artifacts: [],
|
|
81464
|
+
error: treeResult.error
|
|
81465
|
+
};
|
|
81466
|
+
}
|
|
81467
|
+
const manifestPaths = treeResult.entries.filter((entry) => entry.type === "blob" && entry.name === MANIFEST_FILENAME2).map((entry) => entry.path);
|
|
81468
|
+
if (manifestPaths.length === 0) {
|
|
81469
|
+
return { success: true, artifacts: [] };
|
|
81470
|
+
}
|
|
81471
|
+
const artifacts = [];
|
|
81472
|
+
for (const manifestPath of manifestPaths) {
|
|
81473
|
+
const artifact = await this.fetchAndParseManifest(manifestPath);
|
|
81474
|
+
if (artifact) {
|
|
81475
|
+
artifacts.push(artifact);
|
|
81476
|
+
}
|
|
81477
|
+
}
|
|
81478
|
+
return {
|
|
81479
|
+
success: true,
|
|
81480
|
+
artifacts
|
|
81481
|
+
};
|
|
81482
|
+
}
|
|
81483
|
+
async fetchTree() {
|
|
81484
|
+
const allEntries = [];
|
|
81485
|
+
let page = 1;
|
|
81486
|
+
try {
|
|
81487
|
+
while (true) {
|
|
81488
|
+
const url = `https://${this.host}/api/v4/projects/${this.encodedProject}/repository/tree` + `?recursive=true&per_page=${TREE_PAGE_SIZE}&page=${page}`;
|
|
81489
|
+
const response = await this.http.fetch(url, {
|
|
81490
|
+
headers: this.getHeaders()
|
|
81491
|
+
});
|
|
81492
|
+
if (!response.ok) {
|
|
81493
|
+
if (response.status === 401 || response.status === 403) {
|
|
81494
|
+
return {
|
|
81495
|
+
success: false,
|
|
81496
|
+
entries: [],
|
|
81497
|
+
error: "Authentication failed. Configure a token in .grekt/config.yaml or set GITLAB_TOKEN."
|
|
81498
|
+
};
|
|
81499
|
+
}
|
|
81500
|
+
if (response.status === 404) {
|
|
81501
|
+
return {
|
|
81502
|
+
success: false,
|
|
81503
|
+
entries: [],
|
|
81504
|
+
error: `Project not found: ${this.encodedProject}`
|
|
81505
|
+
};
|
|
81506
|
+
}
|
|
81507
|
+
return {
|
|
81508
|
+
success: false,
|
|
81509
|
+
entries: [],
|
|
81510
|
+
error: `GitLab API error: ${response.status} ${response.statusText}`
|
|
81511
|
+
};
|
|
81512
|
+
}
|
|
81513
|
+
const entries = await response.json();
|
|
81514
|
+
allEntries.push(...entries);
|
|
81515
|
+
const nextPage = response.headers.get("x-next-page");
|
|
81516
|
+
if (!nextPage || nextPage === "") {
|
|
81517
|
+
break;
|
|
81518
|
+
}
|
|
81519
|
+
page = parseInt(nextPage, 10);
|
|
81520
|
+
}
|
|
81521
|
+
return { success: true, entries: allEntries };
|
|
81522
|
+
} catch (err) {
|
|
81523
|
+
return {
|
|
81524
|
+
success: false,
|
|
81525
|
+
entries: [],
|
|
81526
|
+
error: err instanceof Error ? err.message : "Unknown error fetching tree"
|
|
81527
|
+
};
|
|
81528
|
+
}
|
|
81529
|
+
}
|
|
81530
|
+
async fetchAndParseManifest(manifestPath) {
|
|
81531
|
+
const encodedPath = encodeURIComponent(manifestPath);
|
|
81532
|
+
const url = `https://${this.host}/api/v4/projects/${this.encodedProject}` + `/repository/files/${encodedPath}/raw?ref=main`;
|
|
81533
|
+
try {
|
|
81534
|
+
const response = await this.http.fetch(url, {
|
|
81535
|
+
headers: this.getHeaders()
|
|
81536
|
+
});
|
|
81537
|
+
if (!response.ok) {
|
|
81538
|
+
return null;
|
|
81539
|
+
}
|
|
81540
|
+
const content = await response.text();
|
|
81541
|
+
const raw = $parse(content);
|
|
81542
|
+
const result = ArtifactManifestSchema.safeParse(raw);
|
|
81543
|
+
if (!result.success) {
|
|
81544
|
+
return null;
|
|
81545
|
+
}
|
|
81546
|
+
const folderPath = manifestPath.replace(`/${MANIFEST_FILENAME2}`, "").replace(MANIFEST_FILENAME2, "");
|
|
81547
|
+
return {
|
|
81548
|
+
name: result.data.name,
|
|
81549
|
+
version: result.data.version,
|
|
81550
|
+
description: result.data.description ?? "",
|
|
81551
|
+
path: folderPath || "."
|
|
81552
|
+
};
|
|
81553
|
+
} catch {
|
|
81554
|
+
return null;
|
|
81555
|
+
}
|
|
81556
|
+
}
|
|
81557
|
+
getHeaders() {
|
|
81558
|
+
const headers = {
|
|
81559
|
+
"User-Agent": "grekt-cli"
|
|
81560
|
+
};
|
|
81561
|
+
if (this.token) {
|
|
81562
|
+
const isDeployToken = this.token.startsWith("gldt-");
|
|
81563
|
+
const headerName = isDeployToken ? "Deploy-Token" : "PRIVATE-TOKEN";
|
|
81564
|
+
headers[headerName] = this.token;
|
|
81565
|
+
}
|
|
81566
|
+
return headers;
|
|
81567
|
+
}
|
|
81568
|
+
}
|
|
81569
|
+
function normalizeHost2(host) {
|
|
81570
|
+
return host.replace(/^https?:\/\//, "");
|
|
81571
|
+
}
|
|
81572
|
+
function normalizeProject2(project) {
|
|
81573
|
+
return project.replace(/^\//, "");
|
|
81574
|
+
}
|
|
81575
|
+
function createRegistryBrowser(registry, http2) {
|
|
81576
|
+
switch (registry.type) {
|
|
81577
|
+
case "github":
|
|
81578
|
+
return new GitHubRepositoryBrowser(registry, http2);
|
|
81579
|
+
case "gitlab":
|
|
81580
|
+
return new GitLabRepositoryBrowser(registry, http2);
|
|
81581
|
+
case "default":
|
|
81582
|
+
default:
|
|
81583
|
+
throw new Error("Listing remote artifacts is only supported for self-hosted registries (GitHub/GitLab). " + "Use the web interface to browse the default registry.");
|
|
81584
|
+
}
|
|
81585
|
+
}
|
|
81299
81586
|
var skill_router_default = `# Grekt Skill Loader
|
|
81300
81587
|
|
|
81301
81588
|
**READ THIS CAREFULLY.** Do not improvise or skip steps.
|
|
@@ -89536,8 +89823,30 @@ var removeTargetCommand = new Command("remove-target").description("Remove sync
|
|
|
89536
89823
|
});
|
|
89537
89824
|
});
|
|
89538
89825
|
|
|
89826
|
+
// src/registry/factory/factory.ts
|
|
89827
|
+
function resolveRegistry2(scope, localConfig, projectRoot = process.cwd()) {
|
|
89828
|
+
const tokens = createTokenProvider(projectRoot, getToken);
|
|
89829
|
+
const resolved = resolveRegistry(scope, localConfig, tokens);
|
|
89830
|
+
if (resolved.type === "default" && process.env.GREKT_REGISTRY_URL) {
|
|
89831
|
+
const override = process.env.GREKT_REGISTRY_URL.replace(/\/$/, "");
|
|
89832
|
+
resolved.apiBasePath = override;
|
|
89833
|
+
resolved.host = "";
|
|
89834
|
+
}
|
|
89835
|
+
return resolved;
|
|
89836
|
+
}
|
|
89837
|
+
function createRegistryClient2(registry) {
|
|
89838
|
+
return createRegistryClient(registry, http, fs, shell);
|
|
89839
|
+
}
|
|
89840
|
+
|
|
89539
89841
|
// src/commands/list.ts
|
|
89540
|
-
var listCommand = new Command("list").alias("ls").description("List installed artifacts").option("--json", "Output as JSON").action((options2) => {
|
|
89842
|
+
var listCommand = new Command("list").alias("ls").description("List installed artifacts or browse a remote registry").argument("[scope]", "Registry scope to list remote artifacts (e.g., @myorg)").option("--json", "Output as JSON").action(async (scope, options2) => {
|
|
89843
|
+
if (scope) {
|
|
89844
|
+
await listRemote(scope, options2);
|
|
89845
|
+
} else {
|
|
89846
|
+
listLocal(options2);
|
|
89847
|
+
}
|
|
89848
|
+
});
|
|
89849
|
+
function listLocal(options2) {
|
|
89541
89850
|
const projectRoot = process.cwd();
|
|
89542
89851
|
requireInitialized(projectRoot);
|
|
89543
89852
|
const lockfile = getLockfile2(projectRoot);
|
|
@@ -89582,28 +89891,59 @@ var listCommand = new Command("list").alias("ls").description("List installed ar
|
|
|
89582
89891
|
}
|
|
89583
89892
|
log(colors5.dim("─".repeat(40)));
|
|
89584
89893
|
log(` Total: ${formatBytes(totalSize)} (~${estimateTokens(totalSize).toLocaleString()} tokens)`);
|
|
89585
|
-
}
|
|
89586
|
-
|
|
89587
|
-
|
|
89588
|
-
|
|
89589
|
-
|
|
89590
|
-
|
|
89591
|
-
|
|
89592
|
-
|
|
89593
|
-
|
|
89594
|
-
|
|
89595
|
-
|
|
89596
|
-
|
|
89597
|
-
|
|
89598
|
-
|
|
89894
|
+
}
|
|
89895
|
+
async function listRemote(scope, options2) {
|
|
89896
|
+
const normalizedScope = scope.startsWith("@") ? scope : `@${scope}`;
|
|
89897
|
+
const projectRoot = process.cwd();
|
|
89898
|
+
const localConfig = getLocalConfig(projectRoot);
|
|
89899
|
+
const registry = resolveRegistry2(normalizedScope, localConfig, projectRoot);
|
|
89900
|
+
let browser;
|
|
89901
|
+
try {
|
|
89902
|
+
browser = createRegistryBrowser(registry, http);
|
|
89903
|
+
} catch (err) {
|
|
89904
|
+
error(err instanceof Error ? err.message : "Failed to create registry browser");
|
|
89905
|
+
return;
|
|
89906
|
+
}
|
|
89907
|
+
const spin = spinner(`Browsing artifacts in ${normalizedScope}...`);
|
|
89908
|
+
spin.start();
|
|
89909
|
+
const result = await browser.browse();
|
|
89910
|
+
spin.stop();
|
|
89911
|
+
if (!result.success) {
|
|
89912
|
+
error(result.error ?? "Failed to browse registry");
|
|
89913
|
+
return;
|
|
89914
|
+
}
|
|
89915
|
+
if (options2.json) {
|
|
89916
|
+
console.log(JSON.stringify(result.artifacts, null, 2));
|
|
89917
|
+
return;
|
|
89918
|
+
}
|
|
89919
|
+
if (result.artifacts.length === 0) {
|
|
89920
|
+
info(`No artifacts found in ${normalizedScope}`);
|
|
89921
|
+
return;
|
|
89922
|
+
}
|
|
89923
|
+
log(colors5.bold(`Artifacts in ${normalizedScope}:`));
|
|
89924
|
+
newline();
|
|
89925
|
+
printArtifactTable(result.artifacts);
|
|
89926
|
+
newline();
|
|
89927
|
+
log(colors5.dim(`${result.artifacts.length} artifact${result.artifacts.length === 1 ? "" : "s"} found`));
|
|
89928
|
+
if (result.truncated) {
|
|
89929
|
+
newline();
|
|
89930
|
+
warning("Results may be incomplete — the repository tree was truncated due to size.");
|
|
89599
89931
|
}
|
|
89600
|
-
return resolved;
|
|
89601
89932
|
}
|
|
89602
|
-
function
|
|
89603
|
-
|
|
89933
|
+
function printArtifactTable(artifacts) {
|
|
89934
|
+
const nameWidth = Math.max(...artifacts.map((a) => a.name.length));
|
|
89935
|
+
const versionWidth = Math.max(...artifacts.map((a) => a.version.length));
|
|
89936
|
+
for (const artifact of artifacts) {
|
|
89937
|
+
const name = colors5.highlight(artifact.name.padEnd(nameWidth));
|
|
89938
|
+
const version = colors5.dim(artifact.version.padEnd(versionWidth));
|
|
89939
|
+
const description = artifact.description ? ` ${artifact.description}` : "";
|
|
89940
|
+
log(` ${name} ${version}${description}`);
|
|
89941
|
+
}
|
|
89604
89942
|
}
|
|
89605
89943
|
|
|
89606
89944
|
// src/registry/sources/sources.ts
|
|
89945
|
+
import { resolve as resolve5 } from "path";
|
|
89946
|
+
import { homedir } from "os";
|
|
89607
89947
|
function getSourceToken(source, projectRoot) {
|
|
89608
89948
|
if (source.type === "github") {
|
|
89609
89949
|
const token = getToken("github", projectRoot);
|
|
@@ -89895,6 +90235,7 @@ async function resolveArtifact(sourceStr, options2) {
|
|
|
89895
90235
|
}
|
|
89896
90236
|
const fileHashes = hashDirectory2(tempDir);
|
|
89897
90237
|
const integrity = calculateIntegrity(fileHashes);
|
|
90238
|
+
const resolved = source.type === "local" ? undefined : downloadResult.resolved;
|
|
89898
90239
|
return {
|
|
89899
90240
|
success: true,
|
|
89900
90241
|
artifactId: resolvedArtifactId,
|
|
@@ -89903,7 +90244,7 @@ async function resolveArtifact(sourceStr, options2) {
|
|
|
89903
90244
|
version: artifactInfo.manifest.version,
|
|
89904
90245
|
integrity,
|
|
89905
90246
|
source: source.raw,
|
|
89906
|
-
resolved
|
|
90247
|
+
resolved,
|
|
89907
90248
|
mode: "lazy",
|
|
89908
90249
|
files: fileHashes
|
|
89909
90250
|
},
|
|
@@ -90920,7 +91261,10 @@ async function installFromLockfile(artifactId, entry, targetDir, projectRoot, fo
|
|
|
90920
91261
|
success(`Installed ${artifactId}@${entry.version}`);
|
|
90921
91262
|
return "installed";
|
|
90922
91263
|
}
|
|
90923
|
-
|
|
91264
|
+
function isLocalSource(source) {
|
|
91265
|
+
return parseSource(source).type === "local";
|
|
91266
|
+
}
|
|
91267
|
+
var installCommand = new Command("install").alias("i").description("Install artifacts from config, using lockfile for determinism").option("--force", "Reinstall even if already present").option("--ci", "Fail on local artifacts (also auto-detected via CI env var)").action(async (options2) => {
|
|
90924
91268
|
const projectRoot = process.cwd();
|
|
90925
91269
|
requireInitialized(projectRoot);
|
|
90926
91270
|
const config = getConfig(projectRoot);
|
|
@@ -90944,6 +91288,8 @@ var installCommand = new Command("install").alias("i").description("Install arti
|
|
|
90944
91288
|
log(colors5.dim(` ${plan.toPrune.length} to prune`));
|
|
90945
91289
|
}
|
|
90946
91290
|
newline();
|
|
91291
|
+
const isCI = options2.ci || !!process.env.CI;
|
|
91292
|
+
const localArtifacts = [];
|
|
90947
91293
|
let installed = 0;
|
|
90948
91294
|
let skipped = 0;
|
|
90949
91295
|
let resolved = 0;
|
|
@@ -90964,6 +91310,12 @@ var installCommand = new Command("install").alias("i").description("Install arti
|
|
|
90964
91310
|
failed++;
|
|
90965
91311
|
continue;
|
|
90966
91312
|
}
|
|
91313
|
+
if (isLocalSource(entry.source)) {
|
|
91314
|
+
localArtifacts.push(entry.artifactId);
|
|
91315
|
+
log(`${colors5.dim("skip")} ${entry.artifactId} (local source)`);
|
|
91316
|
+
skipped++;
|
|
91317
|
+
continue;
|
|
91318
|
+
}
|
|
90967
91319
|
const targetDir = `${projectRoot}/${ARTIFACTS_DIR}/${entry.artifactId}`;
|
|
90968
91320
|
const configEntry = configArtifacts[entry.artifactId];
|
|
90969
91321
|
const configMode = extractMode(configEntry);
|
|
@@ -90985,6 +91337,12 @@ var installCommand = new Command("install").alias("i").description("Install arti
|
|
|
90985
91337
|
failed++;
|
|
90986
91338
|
continue;
|
|
90987
91339
|
}
|
|
91340
|
+
if (isLocalSource(entry.source)) {
|
|
91341
|
+
localArtifacts.push(entry.artifactId);
|
|
91342
|
+
log(`${colors5.dim("skip")} ${entry.artifactId} (local source)`);
|
|
91343
|
+
skipped++;
|
|
91344
|
+
continue;
|
|
91345
|
+
}
|
|
90988
91346
|
const spin = spinner(`Resolving ${entry.artifactId}${entry.configVersion ? `@${entry.configVersion}` : ""}...`);
|
|
90989
91347
|
spin.start();
|
|
90990
91348
|
const result = await resolveArtifact(entry.source, {
|
|
@@ -91044,6 +91402,17 @@ var installCommand = new Command("install").alias("i").description("Install arti
|
|
|
91044
91402
|
generateArtifactIndex(projectRoot, config, lockfile);
|
|
91045
91403
|
await syncToTargets(config, lockfile, projectRoot);
|
|
91046
91404
|
}
|
|
91405
|
+
if (isCI && localArtifacts.length > 0) {
|
|
91406
|
+
newline();
|
|
91407
|
+
error("Local artifacts detected in CI environment:");
|
|
91408
|
+
for (const id of localArtifacts) {
|
|
91409
|
+
log(` ${colors5.highlight(id)}`);
|
|
91410
|
+
}
|
|
91411
|
+
newline();
|
|
91412
|
+
error("Local artifacts use filesystem paths that only exist on the author's machine.");
|
|
91413
|
+
info("Replace them with registry, GitHub, or GitLab sources before pushing.");
|
|
91414
|
+
process.exit(1);
|
|
91415
|
+
}
|
|
91047
91416
|
if (failed > 0) {
|
|
91048
91417
|
process.exit(1);
|
|
91049
91418
|
}
|
|
@@ -91578,7 +91947,7 @@ var PostgrestBuilder = class {
|
|
|
91578
91947
|
body: JSON.stringify(this.body),
|
|
91579
91948
|
signal: this.signal
|
|
91580
91949
|
}).then(async (res$1) => {
|
|
91581
|
-
let
|
|
91950
|
+
let error3 = null;
|
|
91582
91951
|
let data = null;
|
|
91583
91952
|
let count = null;
|
|
91584
91953
|
let status = res$1.status;
|
|
@@ -91601,7 +91970,7 @@ var PostgrestBuilder = class {
|
|
|
91601
91970
|
count = parseInt(contentRange[1]);
|
|
91602
91971
|
if (_this.isMaybeSingle && _this.method === "GET" && Array.isArray(data))
|
|
91603
91972
|
if (data.length > 1) {
|
|
91604
|
-
|
|
91973
|
+
error3 = {
|
|
91605
91974
|
code: "PGRST116",
|
|
91606
91975
|
details: `Results contain ${data.length} rows, application/vnd.pgrst.object+json requires 1 row`,
|
|
91607
91976
|
hint: null,
|
|
@@ -91619,10 +91988,10 @@ var PostgrestBuilder = class {
|
|
|
91619
91988
|
var _error$details;
|
|
91620
91989
|
const body = await res$1.text();
|
|
91621
91990
|
try {
|
|
91622
|
-
|
|
91623
|
-
if (Array.isArray(
|
|
91991
|
+
error3 = JSON.parse(body);
|
|
91992
|
+
if (Array.isArray(error3) && res$1.status === 404) {
|
|
91624
91993
|
data = [];
|
|
91625
|
-
|
|
91994
|
+
error3 = null;
|
|
91626
91995
|
status = 200;
|
|
91627
91996
|
statusText = "OK";
|
|
91628
91997
|
}
|
|
@@ -91631,18 +92000,18 @@ var PostgrestBuilder = class {
|
|
|
91631
92000
|
status = 204;
|
|
91632
92001
|
statusText = "No Content";
|
|
91633
92002
|
} else
|
|
91634
|
-
|
|
92003
|
+
error3 = { message: body };
|
|
91635
92004
|
}
|
|
91636
|
-
if (
|
|
91637
|
-
|
|
92005
|
+
if (error3 && _this.isMaybeSingle && (error3 === null || error3 === undefined || (_error$details = error3.details) === null || _error$details === undefined ? undefined : _error$details.includes("0 rows"))) {
|
|
92006
|
+
error3 = null;
|
|
91638
92007
|
status = 200;
|
|
91639
92008
|
statusText = "OK";
|
|
91640
92009
|
}
|
|
91641
|
-
if (
|
|
91642
|
-
throw new PostgrestError(
|
|
92010
|
+
if (error3 && _this.shouldThrowOnError)
|
|
92011
|
+
throw new PostgrestError(error3);
|
|
91643
92012
|
}
|
|
91644
92013
|
return {
|
|
91645
|
-
error:
|
|
92014
|
+
error: error3,
|
|
91646
92015
|
data,
|
|
91647
92016
|
count,
|
|
91648
92017
|
status,
|
|
@@ -92285,21 +92654,21 @@ var NamespaceOperations = class {
|
|
|
92285
92654
|
path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}`
|
|
92286
92655
|
});
|
|
92287
92656
|
return true;
|
|
92288
|
-
} catch (
|
|
92289
|
-
if (
|
|
92657
|
+
} catch (error3) {
|
|
92658
|
+
if (error3 instanceof IcebergError && error3.status === 404) {
|
|
92290
92659
|
return false;
|
|
92291
92660
|
}
|
|
92292
|
-
throw
|
|
92661
|
+
throw error3;
|
|
92293
92662
|
}
|
|
92294
92663
|
}
|
|
92295
92664
|
async createNamespaceIfNotExists(id, metadata) {
|
|
92296
92665
|
try {
|
|
92297
92666
|
return await this.createNamespace(id, metadata);
|
|
92298
|
-
} catch (
|
|
92299
|
-
if (
|
|
92667
|
+
} catch (error3) {
|
|
92668
|
+
if (error3 instanceof IcebergError && error3.status === 409) {
|
|
92300
92669
|
return;
|
|
92301
92670
|
}
|
|
92302
|
-
throw
|
|
92671
|
+
throw error3;
|
|
92303
92672
|
}
|
|
92304
92673
|
}
|
|
92305
92674
|
};
|
|
@@ -92374,21 +92743,21 @@ var TableOperations = class {
|
|
|
92374
92743
|
headers
|
|
92375
92744
|
});
|
|
92376
92745
|
return true;
|
|
92377
|
-
} catch (
|
|
92378
|
-
if (
|
|
92746
|
+
} catch (error3) {
|
|
92747
|
+
if (error3 instanceof IcebergError && error3.status === 404) {
|
|
92379
92748
|
return false;
|
|
92380
92749
|
}
|
|
92381
|
-
throw
|
|
92750
|
+
throw error3;
|
|
92382
92751
|
}
|
|
92383
92752
|
}
|
|
92384
92753
|
async createTableIfNotExists(namespace, request) {
|
|
92385
92754
|
try {
|
|
92386
92755
|
return await this.createTable(namespace, request);
|
|
92387
|
-
} catch (
|
|
92388
|
-
if (
|
|
92756
|
+
} catch (error3) {
|
|
92757
|
+
if (error3 instanceof IcebergError && error3.status === 409) {
|
|
92389
92758
|
return await this.loadTable({ namespace: namespace.namespace, name: request.name });
|
|
92390
92759
|
}
|
|
92391
|
-
throw
|
|
92760
|
+
throw error3;
|
|
92392
92761
|
}
|
|
92393
92762
|
}
|
|
92394
92763
|
};
|
|
@@ -92460,8 +92829,8 @@ var StorageError = class extends Error {
|
|
|
92460
92829
|
this.statusCode = statusCode;
|
|
92461
92830
|
}
|
|
92462
92831
|
};
|
|
92463
|
-
function isStorageError(
|
|
92464
|
-
return typeof
|
|
92832
|
+
function isStorageError(error3) {
|
|
92833
|
+
return typeof error3 === "object" && error3 !== null && "__isStorageError" in error3;
|
|
92465
92834
|
}
|
|
92466
92835
|
var StorageApiError = class extends StorageError {
|
|
92467
92836
|
constructor(message, status, statusCode, namespace = "storage") {
|
|
@@ -92491,8 +92860,8 @@ var StorageVectorsError = class extends StorageError {
|
|
|
92491
92860
|
super(message, "vectors");
|
|
92492
92861
|
}
|
|
92493
92862
|
};
|
|
92494
|
-
function isStorageVectorsError(
|
|
92495
|
-
return isStorageError(
|
|
92863
|
+
function isStorageVectorsError(error3) {
|
|
92864
|
+
return isStorageError(error3) && error3["namespace"] === "vectors";
|
|
92496
92865
|
}
|
|
92497
92866
|
var StorageVectorsApiError = class extends StorageApiError {
|
|
92498
92867
|
constructor(message, status, statusCode) {
|
|
@@ -92604,9 +92973,9 @@ var _getErrorMessage = (err) => {
|
|
|
92604
92973
|
var _err$error;
|
|
92605
92974
|
return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === undefined ? undefined : _err$error.message) || JSON.stringify(err);
|
|
92606
92975
|
};
|
|
92607
|
-
var handleError = async (
|
|
92608
|
-
if (
|
|
92609
|
-
const responseError =
|
|
92976
|
+
var handleError = async (error3, reject, options2, namespace) => {
|
|
92977
|
+
if (error3 && typeof error3 === "object" && "status" in error3 && "ok" in error3 && typeof error3.status === "number" && !(options2 === null || options2 === undefined ? undefined : options2.noResolveJson)) {
|
|
92978
|
+
const responseError = error3;
|
|
92610
92979
|
const status = responseError.status || 500;
|
|
92611
92980
|
if (typeof responseError.json === "function")
|
|
92612
92981
|
responseError.json().then((err) => {
|
|
@@ -92626,7 +92995,7 @@ var handleError = async (error4, reject, options2, namespace) => {
|
|
|
92626
92995
|
reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
|
|
92627
92996
|
}
|
|
92628
92997
|
} else
|
|
92629
|
-
reject(new StorageUnknownError(_getErrorMessage(
|
|
92998
|
+
reject(new StorageUnknownError(_getErrorMessage(error3), error3, namespace));
|
|
92630
92999
|
};
|
|
92631
93000
|
var _getRequestParams = (method, options2, parameters, body) => {
|
|
92632
93001
|
const params = {
|
|
@@ -92659,7 +93028,7 @@ async function _handleRequest(fetcher, method, url, options2, parameters, body,
|
|
|
92659
93028
|
return {};
|
|
92660
93029
|
}
|
|
92661
93030
|
return result.json();
|
|
92662
|
-
}).then((data) => resolve6(data)).catch((
|
|
93031
|
+
}).then((data) => resolve6(data)).catch((error3) => handleError(error3, reject, options2, namespace));
|
|
92663
93032
|
});
|
|
92664
93033
|
}
|
|
92665
93034
|
function createFetchApi(namespace = "storage") {
|
|
@@ -92703,15 +93072,15 @@ var BaseApiClient = class {
|
|
|
92703
93072
|
data: await operation(),
|
|
92704
93073
|
error: null
|
|
92705
93074
|
};
|
|
92706
|
-
} catch (
|
|
93075
|
+
} catch (error3) {
|
|
92707
93076
|
if (_this.shouldThrowOnError)
|
|
92708
|
-
throw
|
|
92709
|
-
if (isStorageError(
|
|
93077
|
+
throw error3;
|
|
93078
|
+
if (isStorageError(error3))
|
|
92710
93079
|
return {
|
|
92711
93080
|
data: null,
|
|
92712
|
-
error:
|
|
93081
|
+
error: error3
|
|
92713
93082
|
};
|
|
92714
|
-
throw
|
|
93083
|
+
throw error3;
|
|
92715
93084
|
}
|
|
92716
93085
|
}
|
|
92717
93086
|
};
|
|
@@ -92730,15 +93099,15 @@ var StreamDownloadBuilder = class {
|
|
|
92730
93099
|
data: (await _this.downloadFn()).body,
|
|
92731
93100
|
error: null
|
|
92732
93101
|
};
|
|
92733
|
-
} catch (
|
|
93102
|
+
} catch (error3) {
|
|
92734
93103
|
if (_this.shouldThrowOnError)
|
|
92735
|
-
throw
|
|
92736
|
-
if (isStorageError(
|
|
93104
|
+
throw error3;
|
|
93105
|
+
if (isStorageError(error3))
|
|
92737
93106
|
return {
|
|
92738
93107
|
data: null,
|
|
92739
|
-
error:
|
|
93108
|
+
error: error3
|
|
92740
93109
|
};
|
|
92741
|
-
throw
|
|
93110
|
+
throw error3;
|
|
92742
93111
|
}
|
|
92743
93112
|
}
|
|
92744
93113
|
};
|
|
@@ -92775,15 +93144,15 @@ var BlobDownloadBuilder = class {
|
|
|
92775
93144
|
data: await (await _this.downloadFn()).blob(),
|
|
92776
93145
|
error: null
|
|
92777
93146
|
};
|
|
92778
|
-
} catch (
|
|
93147
|
+
} catch (error3) {
|
|
92779
93148
|
if (_this.shouldThrowOnError)
|
|
92780
|
-
throw
|
|
92781
|
-
if (isStorageError(
|
|
93149
|
+
throw error3;
|
|
93150
|
+
if (isStorageError(error3))
|
|
92782
93151
|
return {
|
|
92783
93152
|
data: null,
|
|
92784
|
-
error:
|
|
93153
|
+
error: error3
|
|
92785
93154
|
};
|
|
92786
|
-
throw
|
|
93155
|
+
throw error3;
|
|
92787
93156
|
}
|
|
92788
93157
|
}
|
|
92789
93158
|
};
|
|
@@ -92967,18 +93336,18 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
92967
93336
|
data: true,
|
|
92968
93337
|
error: null
|
|
92969
93338
|
};
|
|
92970
|
-
} catch (
|
|
93339
|
+
} catch (error3) {
|
|
92971
93340
|
if (_this11.shouldThrowOnError)
|
|
92972
|
-
throw
|
|
92973
|
-
if (isStorageError(
|
|
92974
|
-
const originalError =
|
|
93341
|
+
throw error3;
|
|
93342
|
+
if (isStorageError(error3) && error3 instanceof StorageUnknownError) {
|
|
93343
|
+
const originalError = error3.originalError;
|
|
92975
93344
|
if ([400, 404].includes(originalError === null || originalError === undefined ? undefined : originalError.status))
|
|
92976
93345
|
return {
|
|
92977
93346
|
data: false,
|
|
92978
|
-
error:
|
|
93347
|
+
error: error3
|
|
92979
93348
|
};
|
|
92980
93349
|
}
|
|
92981
|
-
throw
|
|
93350
|
+
throw error3;
|
|
92982
93351
|
}
|
|
92983
93352
|
}
|
|
92984
93353
|
getPublicUrl(path, options2) {
|
|
@@ -93186,12 +93555,12 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
93186
93555
|
data: await value.apply(target, args),
|
|
93187
93556
|
error: null
|
|
93188
93557
|
};
|
|
93189
|
-
} catch (
|
|
93558
|
+
} catch (error3) {
|
|
93190
93559
|
if (shouldThrowOnError)
|
|
93191
|
-
throw
|
|
93560
|
+
throw error3;
|
|
93192
93561
|
return {
|
|
93193
93562
|
data: null,
|
|
93194
|
-
error:
|
|
93563
|
+
error: error3
|
|
93195
93564
|
};
|
|
93196
93565
|
}
|
|
93197
93566
|
};
|
|
@@ -96001,9 +96370,9 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
|
|
|
96001
96370
|
spin.start();
|
|
96002
96371
|
try {
|
|
96003
96372
|
const supabase = getSupabaseClient();
|
|
96004
|
-
const { data: { user }, error:
|
|
96373
|
+
const { data: { user }, error: error5 } = await supabase.auth.getUser();
|
|
96005
96374
|
spin.stop();
|
|
96006
|
-
if (
|
|
96375
|
+
if (error5 || !user) {
|
|
96007
96376
|
log("Not logged in");
|
|
96008
96377
|
log(colors5.dim(`Registry: ${getSupabaseUrl()}`));
|
|
96009
96378
|
return;
|
|
@@ -96019,7 +96388,7 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
|
|
|
96019
96388
|
// package.json
|
|
96020
96389
|
var package_default = {
|
|
96021
96390
|
name: "@grekt/cli",
|
|
96022
|
-
version: "6.
|
|
96391
|
+
version: "6.33.1",
|
|
96023
96392
|
description: "AI tools versioned, synced, and shared across tools and teams",
|
|
96024
96393
|
type: "module",
|
|
96025
96394
|
bin: {
|
|
@@ -96050,11 +96419,12 @@ var package_default = {
|
|
|
96050
96419
|
"test:watch": "bun test --watch",
|
|
96051
96420
|
"test:coverage": "bun test --coverage",
|
|
96052
96421
|
"test:e2e": "bun test spec/",
|
|
96053
|
-
"test:e2e:watch": "bun test spec/ --watch"
|
|
96422
|
+
"test:e2e:watch": "bun test spec/ --watch",
|
|
96423
|
+
prepare: "husky"
|
|
96054
96424
|
},
|
|
96055
96425
|
dependencies: {
|
|
96056
96426
|
"@aws-sdk/client-s3": "^3.971.0",
|
|
96057
|
-
"@grekt-labs/cli-engine": "5.
|
|
96427
|
+
"@grekt-labs/cli-engine": "5.26.0",
|
|
96058
96428
|
"@inquirer/prompts": "^7.2.0",
|
|
96059
96429
|
"@supabase/supabase-js": "^2.91.0",
|
|
96060
96430
|
chalk: "^5.4.1",
|
|
@@ -96070,6 +96440,7 @@ var package_default = {
|
|
|
96070
96440
|
"@semantic-release/git": "^10.0.1",
|
|
96071
96441
|
"@types/node": "^22.10.5",
|
|
96072
96442
|
"bun-types": "^1.3.6",
|
|
96443
|
+
husky: "^9.1.7",
|
|
96073
96444
|
"semantic-release": "^25.0.2",
|
|
96074
96445
|
typescript: "^5.7.2"
|
|
96075
96446
|
},
|