sgerp-frontend-lib 0.2.3 → 0.2.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../sgerplib/sgerp/routing/index.ts"],"names":[],"mappings":"AA6EA,UAAU,WAAW;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB;AAED,qBAAa,IAAI;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAEL,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CASrF;AAED,qBAAa,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;gBAGnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,EACf,GAAG,EAAE,MAAM,EAAE,EACb,KAAK,EAAE,IAAI,EAAE,EACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM;CAoBnB;AAED,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAG,CAUpE;AAED,qBAAa,KAAK;IAChB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;gBAET,IAAI,EAAE,GAAG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ACZ,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGpC,mBAAmB,EAAE,MAAM,EAC3B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,eAAe,GAAE,MAAsC,EACvD,QAAQ,GAAE,eAAe,GAAG,IAAW;IA8DzC,MAAM,IAAI,MAAM;IAwCV,KAAK,CACT,MAAM,EAAE,MAAM,EAAE,EAAE,EAClB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,aAAa,EACvB,eAAe,GAAE,OAAe,GAC/B,OAAO,CAAC,IAAI,CAAC;IAqHhB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM;CAgBhE"}
|
|
@@ -276,14 +276,19 @@ const fetchData = async (url) => {
|
|
|
276
276
|
};
|
|
277
277
|
class RoutingEngine {
|
|
278
278
|
constructor(routing_engine_name, url, road_network, key, default_backend = detectBackendFromDeployment(), settings = null) {
|
|
279
|
+
var _a;
|
|
279
280
|
this.routing_engine_name = routing_engine_name;
|
|
280
281
|
this.default_backend = default_backend;
|
|
281
282
|
console.log(`default backend in routing engine ${default_backend}`);
|
|
282
283
|
this.settings = settings;
|
|
283
284
|
this.useAirDistance = !url || url === 'null' || url === '' || url === undefined;
|
|
284
285
|
if (!this.useAirDistance) {
|
|
285
|
-
// Only normalize URLs that aren't already full URLs
|
|
286
|
-
|
|
286
|
+
// Only normalize URLs that aren't already full URLs with proper domains
|
|
287
|
+
// A full URL should have http(s):// and contain a dot (indicating a domain)
|
|
288
|
+
// This excludes k8s internal placeholders like "http://mapbox-osrm-proxy"
|
|
289
|
+
const hasProtocol = url.startsWith('http://') || url.startsWith('https://');
|
|
290
|
+
const hasDomainDot = url.includes('://') && ((_a = url.split('://')[1]) === null || _a === void 0 ? void 0 : _a.includes('.'));
|
|
291
|
+
const isFullUrl = hasProtocol && hasDomainDot;
|
|
287
292
|
if (!isFullUrl) {
|
|
288
293
|
if (url.includes('gcstage')) {
|
|
289
294
|
url = url.replace('gcstage', 'gcdev');
|
|
@@ -291,7 +296,8 @@ class RoutingEngine {
|
|
|
291
296
|
if (url === '' ||
|
|
292
297
|
url === 'null' ||
|
|
293
298
|
url === undefined ||
|
|
294
|
-
url.includes('localhost')
|
|
299
|
+
url.includes('localhost') ||
|
|
300
|
+
url === 'http://mapbox-osrm-proxy') {
|
|
295
301
|
url = 'http://mapbox-osrm-proxy';
|
|
296
302
|
}
|
|
297
303
|
}
|
|
@@ -320,15 +326,23 @@ class RoutingEngine {
|
|
|
320
326
|
this.requestCache = {};
|
|
321
327
|
}
|
|
322
328
|
getUrl() {
|
|
323
|
-
|
|
329
|
+
var _a;
|
|
330
|
+
// If URL is a full URL with a proper domain (contains a dot), use it as-is
|
|
324
331
|
// This respects URLs from payloads that specify their own routing endpoint
|
|
325
|
-
|
|
332
|
+
// But excludes k8s internal placeholders like "http://mapbox-osrm-proxy"
|
|
333
|
+
const hasProtocol = this.url.startsWith('http://') || this.url.startsWith('https://');
|
|
334
|
+
const hasDomainDot = this.url.includes('://') && ((_a = this.url.split('://')[1]) === null || _a === void 0 ? void 0 : _a.includes('.'));
|
|
335
|
+
const isFullUrl = hasProtocol && hasDomainDot;
|
|
336
|
+
console.log('[RoutingEngine.getUrl] this.url:', this.url, 'isFullUrl:', isFullUrl, 'hasProtocol:', hasProtocol, 'hasDomainDot:', hasDomainDot);
|
|
337
|
+
if (isFullUrl) {
|
|
338
|
+
console.log('[RoutingEngine.getUrl] Using as-is (full URL):', this.url);
|
|
326
339
|
return this.url;
|
|
327
340
|
}
|
|
328
341
|
// Only apply env mapping or SGERP_DOMAINS for placeholder/relative URLs
|
|
329
342
|
if (this.url === 'http://mapbox-osrm-proxy') {
|
|
330
343
|
// First, check if there's an env-based mapping
|
|
331
344
|
const envMappedUrl = getOSRMProxyFromEnvMapping();
|
|
345
|
+
console.log('[RoutingEngine.getUrl] envMappedUrl:', envMappedUrl, 'default_backend:', this.default_backend);
|
|
332
346
|
if (envMappedUrl) {
|
|
333
347
|
return envMappedUrl;
|
|
334
348
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../sgerplib/vrptoolbox/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAA0B,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAqBjD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,UAAU,CAAC,eAAe,CAAC;IACxE,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,CAAS;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../sgerplib/vrptoolbox/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAA0B,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAqBjD;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,UAAU,CAAC,eAAe,CAAC;IACxE,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,CAAS;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAwCjE;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAIzD"}
|
|
@@ -26,6 +26,8 @@ class OptimizationJobCollection extends collection_1.Collection {
|
|
|
26
26
|
// Create fetch function that adapts VRP Toolbox API to SGERP format
|
|
27
27
|
const fetchFn = async (params) => {
|
|
28
28
|
const searchParams = new URLSearchParams();
|
|
29
|
+
// Exclude error field from list API to improve performance (error can be large)
|
|
30
|
+
searchParams.append('only_fields', 'id,status,label,created_at,creator_username,auth_backend,nodes_count,vehicles_count,project_id,solver_parameters_time_limit_ms,modified_at');
|
|
29
31
|
if (params && typeof params === 'object') {
|
|
30
32
|
Object.entries(params).forEach(([key, value]) => {
|
|
31
33
|
if (value !== undefined && value !== null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sgerp-frontend-lib",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "TypeScript/React library for interacting with the SGERP API, providing client SDK, Backbone.js-style Collections, and pre-built React components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|