@amplifyup/sdk 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/dist/AmplifyRenderer.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +14 -6
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +14 -6
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +14 -6
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +14 -6
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +0 -6
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +0 -6
- package/dist/server.mjs.map +1 -1
- package/dist/{types-Xv9P55Dj.d.mts → types-B2Swk8BW.d.mts} +10 -7
- package/dist/{types-Xv9P55Dj.d.ts → types-B2Swk8BW.d.ts} +10 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -230,14 +230,16 @@ function resolveAmplifyUpTarget(options) {
|
|
|
230
230
|
if (isAmplifyUpTarget(envTarget)) {
|
|
231
231
|
return normalizeAmplifyUpTarget(envTarget);
|
|
232
232
|
}
|
|
233
|
-
if (typeof window !== "undefined") {
|
|
234
|
-
const host = window.location.hostname;
|
|
235
|
-
if (host === "localhost" || host === "127.0.0.1") {
|
|
236
|
-
return "local";
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
233
|
return "production";
|
|
240
234
|
}
|
|
235
|
+
function isRemoteOrchestratorUrl(orchestratorUrl) {
|
|
236
|
+
try {
|
|
237
|
+
const host = new URL(orchestratorUrl).hostname.toLowerCase();
|
|
238
|
+
return host !== "localhost" && host !== "127.0.0.1" && host !== "::1";
|
|
239
|
+
} catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
241
243
|
function localOrchestratorUrl() {
|
|
242
244
|
const fromEnv = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_ORCHESTRATOR_URL : void 0;
|
|
243
245
|
return (fromEnv || "http://localhost:5001").replace(/\/$/, "");
|
|
@@ -420,6 +422,12 @@ var AmplifyUpSDK = class {
|
|
|
420
422
|
const previewOverrides = readPreviewQueryOverrides();
|
|
421
423
|
if (previewOverrides.orchestratorUrl) {
|
|
422
424
|
this.orchestratorUrl = previewOverrides.orchestratorUrl;
|
|
425
|
+
if (isRemoteOrchestratorUrl(previewOverrides.orchestratorUrl)) {
|
|
426
|
+
const prodUrls = resolveAmplifyUpUrls("production");
|
|
427
|
+
this.target = "production";
|
|
428
|
+
this.apiGatewayUrl = prodUrls.apiGatewayUrl;
|
|
429
|
+
this.decisionApiUrl = prodUrls.decisionApiUrl;
|
|
430
|
+
}
|
|
423
431
|
}
|
|
424
432
|
this.config = {
|
|
425
433
|
trackingId: previewOverrides.trackingId || config.trackingId,
|