@extn/segi-js 0.2.8 → 0.2.9
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/cdn.global.js +25 -25
- package/dist/index.js +12 -1
- package/dist/index.mjs +13 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55,7 +55,18 @@ function buildEvent(state2, base) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/transport.ts
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
58
61
|
var _segishared = require('@extn/segi-shared');
|
|
62
|
+
function resolveIngestUrl(endpoint) {
|
|
63
|
+
const raw = endpoint && endpoint.trim() || _segishared.SEGI_DEFAULT_INGEST_ENDPOINT;
|
|
64
|
+
if (/\/api\/ingest\/events\/?$/.test(raw)) {
|
|
65
|
+
return raw.replace(/\/+$/, "");
|
|
66
|
+
}
|
|
67
|
+
const base = raw.replace(/\/+$/, "").replace(/\/api\/ingest$/, "").replace(/\/api$/, "");
|
|
68
|
+
return `${base || _segishared.SEGI_DEFAULT_API_BASE}/api/ingest/events`;
|
|
69
|
+
}
|
|
59
70
|
var warnedKeys = /* @__PURE__ */ new Set();
|
|
60
71
|
function warnOnce(key, message) {
|
|
61
72
|
if (warnedKeys.has(key)) return;
|
|
@@ -74,7 +85,7 @@ function describeStatus(status) {
|
|
|
74
85
|
return "ingest returned a non-2xx response";
|
|
75
86
|
}
|
|
76
87
|
function send(endpoint, projectKey, event) {
|
|
77
|
-
const url = endpoint
|
|
88
|
+
const url = resolveIngestUrl(endpoint);
|
|
78
89
|
if (!url || !projectKey) {
|
|
79
90
|
warnOnce(
|
|
80
91
|
"missing-config",
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,18 @@ function buildEvent(state2, base) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/transport.ts
|
|
58
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
SEGI_DEFAULT_API_BASE,
|
|
60
|
+
SEGI_DEFAULT_INGEST_ENDPOINT
|
|
61
|
+
} from "@extn/segi-shared";
|
|
62
|
+
function resolveIngestUrl(endpoint) {
|
|
63
|
+
const raw = endpoint && endpoint.trim() || SEGI_DEFAULT_INGEST_ENDPOINT;
|
|
64
|
+
if (/\/api\/ingest\/events\/?$/.test(raw)) {
|
|
65
|
+
return raw.replace(/\/+$/, "");
|
|
66
|
+
}
|
|
67
|
+
const base = raw.replace(/\/+$/, "").replace(/\/api\/ingest$/, "").replace(/\/api$/, "");
|
|
68
|
+
return `${base || SEGI_DEFAULT_API_BASE}/api/ingest/events`;
|
|
69
|
+
}
|
|
59
70
|
var warnedKeys = /* @__PURE__ */ new Set();
|
|
60
71
|
function warnOnce(key, message) {
|
|
61
72
|
if (warnedKeys.has(key)) return;
|
|
@@ -74,7 +85,7 @@ function describeStatus(status) {
|
|
|
74
85
|
return "ingest returned a non-2xx response";
|
|
75
86
|
}
|
|
76
87
|
function send(endpoint, projectKey, event) {
|
|
77
|
-
const url = endpoint
|
|
88
|
+
const url = resolveIngestUrl(endpoint);
|
|
78
89
|
if (!url || !projectKey) {
|
|
79
90
|
warnOnce(
|
|
80
91
|
"missing-config",
|