@bringg/dashboard-sdk 9.90.0 → 9.91.0-pre.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.
@@ -1,4 +1,4 @@
1
- import { GetAvailableManagedAttributeHTTPResponse } from '@bringg/common-utils';
1
+ import { GetAvailableManagedAttributeHTTPResponse, GetFamilyHTTPResponse } from '@bringg/common-utils';
2
2
  import { DataOptions } from '../data-entity';
3
3
  import Session from '../Services/Identity/Session';
4
4
  import { TaskManagedAttributeUpdateRealTimeEvent } from './internal-types';
@@ -10,13 +10,27 @@ export default class TaskManagedAttributesApi {
10
10
  private readonly storableDataService;
11
11
  private readonly realtimeSubscriptions;
12
12
  private readonly cachedAvailableAttributes;
13
+ private pendingAvailableAttributes;
13
14
  constructor(session: Session);
14
15
  get(id: number): ManagedAttribute;
15
16
  getByIds(ids: number[]): ManagedAttribute[];
16
17
  getAll(): GetAvailableManagedAttributeHTTPResponse;
17
18
  loadByIds(ids: number[], commonOptions?: DataOptions): Promise<ManagedAttribute[]>;
18
19
  getAvailableAttributes(): Promise<GetAvailableManagedAttributeHTTPResponse>;
20
+ /**
21
+ * The orders sharing this order's value for the merchant's family-key attribute, with the fields
22
+ * the order page renders for each of them. Not cached: statuses and time windows change.
23
+ *
24
+ * @param taskId - the order whose family is requested
25
+ * @returns `family: null` when the order belongs to no family
26
+ * @throws BringgException with `statusCode` 409 when the service cannot resolve the family
27
+ * @example
28
+ * const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
29
+ * const siblingIds = family?.members.map(member => member.task_id) ?? [];
30
+ */
31
+ getFamily(taskId: number): Promise<GetFamilyHTTPResponse>;
19
32
  onUpdate(callback: (event: TaskManagedAttributeUpdateRealTimeEvent) => unknown | Promise<unknown>): () => void;
20
33
  fetchAvailableAttributes(ids: number[], commonOptions?: DataOptions): Promise<GetAvailableManagedAttributeHTTPResponse>;
21
34
  resetAllListeners(): void;
35
+ private requestAvailableAttributes;
22
36
  }
@@ -113,17 +113,32 @@ var TaskManagedAttributesApi = /** @class */ (function () {
113
113
  return __awaiter(this, void 0, void 0, function () {
114
114
  var attributes;
115
115
  return __generator(this, function (_a) {
116
- switch (_a.label) {
117
- case 0:
118
- attributes = this.cachedAvailableAttributes.get();
119
- if (!!attributes) return [3 /*break*/, 2];
120
- return [4 /*yield*/, this.service.getAvailableAttributes()];
121
- case 1:
122
- attributes = _a.sent();
123
- this.cachedAvailableAttributes.set(attributes);
124
- _a.label = 2;
125
- case 2: return [2 /*return*/, attributes];
116
+ attributes = this.cachedAvailableAttributes.get();
117
+ if (attributes) {
118
+ return [2 /*return*/, attributes];
119
+ }
120
+ if (!this.pendingAvailableAttributes) {
121
+ this.pendingAvailableAttributes = this.requestAvailableAttributes();
126
122
  }
123
+ return [2 /*return*/, this.pendingAvailableAttributes];
124
+ });
125
+ });
126
+ };
127
+ /**
128
+ * The orders sharing this order's value for the merchant's family-key attribute, with the fields
129
+ * the order page renders for each of them. Not cached: statuses and time windows change.
130
+ *
131
+ * @param taskId - the order whose family is requested
132
+ * @returns `family: null` when the order belongs to no family
133
+ * @throws BringgException with `statusCode` 409 when the service cannot resolve the family
134
+ * @example
135
+ * const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
136
+ * const siblingIds = family?.members.map(member => member.task_id) ?? [];
137
+ */
138
+ TaskManagedAttributesApi.prototype.getFamily = function (taskId) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ return __generator(this, function (_a) {
141
+ return [2 /*return*/, this.service.getFamily(taskId)];
127
142
  });
128
143
  });
129
144
  };
@@ -150,6 +165,26 @@ var TaskManagedAttributesApi = /** @class */ (function () {
150
165
  TaskManagedAttributesApi.prototype.resetAllListeners = function () {
151
166
  this.realtimeSubscriptions.resetAllListeners();
152
167
  };
168
+ TaskManagedAttributesApi.prototype.requestAvailableAttributes = function () {
169
+ return __awaiter(this, void 0, void 0, function () {
170
+ var attributes;
171
+ return __generator(this, function (_a) {
172
+ switch (_a.label) {
173
+ case 0:
174
+ _a.trys.push([0, , 2, 3]);
175
+ return [4 /*yield*/, this.service.getAvailableAttributes()];
176
+ case 1:
177
+ attributes = _a.sent();
178
+ this.cachedAvailableAttributes.set(attributes);
179
+ return [2 /*return*/, attributes];
180
+ case 2:
181
+ this.pendingAvailableAttributes = undefined;
182
+ return [7 /*endfinally*/];
183
+ case 3: return [2 /*return*/];
184
+ }
185
+ });
186
+ });
187
+ };
153
188
  return TaskManagedAttributesApi;
154
189
  }());
155
190
  exports.default = TaskManagedAttributesApi;
@@ -1 +1 @@
1
- {"version":3,"file":"task-managed-attributes-api.js","sourceRoot":"","sources":["../../src/TaskManagedAttributes/task-managed-attributes-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,8EAAsD;AACtD,qDAAmD;AAEnD,6DAAsC;AAEtC,mFAA2D;AAC3D,oDAAkD;AAElD,oIAA0G;AAC1G,sGAA6E;AAG7E,4BAA4B;AACf,QAAA,8BAA8B,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS;AAEvE;IAYC,kCAAY,OAAgB;QAA5B,iBAkBC;QAxBgB,8BAAyB,GAAG,IAAI,wBAAU,CAA2C;YACrG,GAAG,EAAE;gBACJ,OAAO,EAAE,sCAA8B;aACvC;SACD,CAAC,CAAC;QAGF,IAAI,CAAC,SAAS,GAAG,IAAI,oBAAS,EAAoB,CAAC;QACnD,IAAM,cAAc,GAAG,IAAI,0BAAc,EAAoB,CAAC;QAE9D,IAAI,CAAC,OAAO,GAAG,IAAI,yCAA4B,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,mBAAmB,GAAG,IAAI,+BAAmB,CACjD,IAAI,CAAC,SAAS,EACd,UAAA,gBAAgB,IAAI,OAAA,0BAAW,CAAC,iBAAiB,CAAC,KAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,EAA/D,CAA+D,EACnF,CA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AnC;;;;;;wBACK,UAAU,GAAG,IAAI,CAAC,yBAAyB,CAAC,GAAG,EAAE,CAAC;6BAElD,CAAC,UAAU,EAAX,wBAAW;wBACD,qBAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAA;;wBAAxD,UAAU,GAAG,SAA2C,CAAC;wBACzD,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;;4BAGhD,sBAAO,UAAU,EAAC;;;;KAClB;IAEM,2CAAQ,GAAf,UACC,QAAwF;QAExF,OAAO,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAEY,2DAAwB,GAArC,UACC,GAAa,EACb,aAA+C;QAA/C,8BAAA,EAAA,kBAA+B,QAAQ,EAAE,IAAI,EAAE;;;;;4BAE/C,qBAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,EAAA;;wBAAxC,SAAwC,CAAC;wBACtB,qBAAM,IAAI,CAAC,sBAAsB,EAAE,EAAA;;wBAAhD,UAAU,GAAG,SAAmC;wBAEtD,sBAAO,UAAU,EAAC;;;;KAClB;IAEM,oDAAiB,GAAxB;QACC,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,CAAC;IAChD,CAAC;IACF,+BAAC;AAAD,CAAC,AA7FD,IA6FC"}
1
+ {"version":3,"file":"task-managed-attributes-api.js","sourceRoot":"","sources":["../../src/TaskManagedAttributes/task-managed-attributes-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,8EAAsD;AACtD,qDAAmD;AAEnD,6DAAsC;AAEtC,mFAA2D;AAC3D,oDAAkD;AAElD,oIAA0G;AAC1G,sGAA6E;AAG7E,4BAA4B;AACf,QAAA,8BAA8B,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,SAAS;AAEvE;IAcC,kCAAY,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wC,CAAC;wBACtB,qBAAM,IAAI,CAAC,sBAAsB,EAAE,EAAA;;wBAAhD,UAAU,GAAG,SAAmC;wBAEtD,sBAAO,UAAU,EAAC;;;;KAClB;IAEM,oDAAiB,GAAxB;QACC,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,CAAC;IAChD,CAAC;IAEa,6DAA0B,GAAxC;;;;;;;wBAEqB,qBAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAA;;wBAAxD,UAAU,GAAG,SAA2C;wBAE9D,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;wBAE/C,sBAAO,UAAU,EAAC;;wBAElB,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;;;;;;KAE7C;IACF,+BAAC;AAAD,CAAC,AA7HD,IA6HC"}
@@ -1,4 +1,4 @@
1
- import { GetAvailableManagedAttributeHTTPResponse, TaskManagedAttributesHTTPGetTasksByIdsResponse } from '@bringg/common-utils';
1
+ import { GetAvailableManagedAttributeHTTPResponse, GetFamilyHTTPResponse, TaskManagedAttributesHTTPGetTasksByIdsResponse } from '@bringg/common-utils';
2
2
  import { CommonOptions } from '../Core/RouteGenerator';
3
3
  import Session from '../Services/Identity/Session';
4
4
  export default class TaskManagedAttributesService {
@@ -6,4 +6,5 @@ export default class TaskManagedAttributesService {
6
6
  constructor(session: Session);
7
7
  loadByIds(ids: number[], commonOptions?: CommonOptions): Promise<TaskManagedAttributesHTTPGetTasksByIdsResponse>;
8
8
  getAvailableAttributes(commonOptions?: CommonOptions): Promise<GetAvailableManagedAttributeHTTPResponse>;
9
+ getFamily(taskId: number, commonOptions?: CommonOptions): Promise<GetFamilyHTTPResponse>;
9
10
  }
@@ -72,6 +72,19 @@ var TaskManagedAttributesService = /** @class */ (function () {
72
72
  });
73
73
  });
74
74
  };
75
+ TaskManagedAttributesService.prototype.getFamily = function (taskId, commonOptions) {
76
+ if (commonOptions === void 0) { commonOptions = {}; }
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ return __generator(this, function (_a) {
79
+ return [2 /*return*/, this.service.routeGenerator
80
+ .get("".concat(basePath, "/family"))
81
+ .withQueryString({ task_id: taskId })
82
+ .setException('failed to fetch the family of the task')
83
+ .withCommonOptions(commonOptions)
84
+ .invoke()];
85
+ });
86
+ });
87
+ };
75
88
  return TaskManagedAttributesService;
76
89
  }());
77
90
  exports.default = TaskManagedAttributesService;
@@ -1 +1 @@
1
- {"version":3,"file":"task-managed-attributes-service.js","sourceRoot":"","sources":["../../src/TaskManagedAttributes/task-managed-attributes-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,oEAA8C;AAK9C,IAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD;IAGC,sCAAY,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,qBAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC;IAC/E,CAAC;IAEY,gDAAS,GAAtB,UACC,GAAa,EACb,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;gBAEjC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,IAAI,CAAC,QAAQ,CAAC;yBACd,WAAW,CAAC;wBACZ,QAAQ,EAAE,GAAG;qBACwC,CAAC;yBACtD,YAAY,CAAC,wDAAwD,CAAC;yBACtE,iBAAiB,CAAC,aAAa,CAAC;yBAChC,MAAM,EAAkG,EAAC;;;KAC3G;IAEY,6DAAsB,GAAnC,UACC,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;gBAEjC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,UAAG,QAAQ,eAAY,CAAC;yBAC5B,YAAY,CAAC,8CAA8C,CAAC;yBAC5D,iBAAiB,CAAC,aAAa,CAAC;yBAChC,MAAM,EAAsF,EAAC;;;KAC/F;IACF,mCAAC;AAAD,CAAC,AA9BD,IA8BC"}
1
+ {"version":3,"file":"task-managed-attributes-service.js","sourceRoot":"","sources":["../../src/TaskManagedAttributes/task-managed-attributes-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,oEAA8C;AAK9C,IAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD;IAGC,sCAAY,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,qBAAW,CAAC,OAAO,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC;IAC/E,CAAC;IAEY,gDAAS,GAAtB,UACC,GAAa,EACb,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;gBAEjC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,IAAI,CAAC,QAAQ,CAAC;yBACd,WAAW,CAAC;wBACZ,QAAQ,EAAE,GAAG;qBACwC,CAAC;yBACtD,YAAY,CAAC,wDAAwD,CAAC;yBACtE,iBAAiB,CAAC,aAAa,CAAC;yBAChC,MAAM,EAAkG,EAAC;;;KAC3G;IAEY,6DAAsB,GAAnC,UACC,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;gBAEjC,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,UAAG,QAAQ,eAAY,CAAC;yBAC5B,YAAY,CAAC,8CAA8C,CAAC;yBAC5D,iBAAiB,CAAC,aAAa,CAAC;yBAChC,MAAM,EAAsF,EAAC;;;KAC/F;IAEY,gDAAS,GAAtB,UAAuB,MAAc,EAAE,aAAiC;QAAjC,8BAAA,EAAA,kBAAiC;;;gBACvE,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,UAAG,QAAQ,YAAS,CAAC;yBACzB,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;yBACpC,YAAY,CAAC,wCAAwC,CAAC;yBACtD,iBAAiB,CAAC,aAAa,CAAC;yBAChC,MAAM,EAAgD,EAAC;;;KACzD;IACF,mCAAC;AAAD,CAAC,AAvCD,IAuCC"}
@@ -24784,7 +24784,7 @@ var BringgException_1 = __webpack_require__(43605);
24784
24784
  var client_page_1 = __webpack_require__(16573);
24785
24785
  var Logger_1 = __importDefault(__webpack_require__(55860));
24786
24786
  var abort_1 = __webpack_require__(34179);
24787
- var version = '9.90.0';
24787
+ var version = '9.91.0-pre.1';
24788
24788
  function logErrorResponse(response) {
24789
24789
  var data = response.data, status = response.status;
24790
24790
  try {
@@ -29064,17 +29064,32 @@ var TaskManagedAttributesApi = /** @class */ (function () {
29064
29064
  return __awaiter(this, void 0, void 0, function () {
29065
29065
  var attributes;
29066
29066
  return __generator(this, function (_a) {
29067
- switch (_a.label) {
29068
- case 0:
29069
- attributes = this.cachedAvailableAttributes.get();
29070
- if (!!attributes) return [3 /*break*/, 2];
29071
- return [4 /*yield*/, this.service.getAvailableAttributes()];
29072
- case 1:
29073
- attributes = _a.sent();
29074
- this.cachedAvailableAttributes.set(attributes);
29075
- _a.label = 2;
29076
- case 2: return [2 /*return*/, attributes];
29067
+ attributes = this.cachedAvailableAttributes.get();
29068
+ if (attributes) {
29069
+ return [2 /*return*/, attributes];
29070
+ }
29071
+ if (!this.pendingAvailableAttributes) {
29072
+ this.pendingAvailableAttributes = this.requestAvailableAttributes();
29077
29073
  }
29074
+ return [2 /*return*/, this.pendingAvailableAttributes];
29075
+ });
29076
+ });
29077
+ };
29078
+ /**
29079
+ * The orders sharing this order's value for the merchant's family-key attribute, with the fields
29080
+ * the order page renders for each of them. Not cached: statuses and time windows change.
29081
+ *
29082
+ * @param taskId - the order whose family is requested
29083
+ * @returns `family: null` when the order belongs to no family
29084
+ * @throws BringgException with `statusCode` 409 when the service cannot resolve the family
29085
+ * @example
29086
+ * const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
29087
+ * const siblingIds = family?.members.map(member => member.task_id) ?? [];
29088
+ */
29089
+ TaskManagedAttributesApi.prototype.getFamily = function (taskId) {
29090
+ return __awaiter(this, void 0, void 0, function () {
29091
+ return __generator(this, function (_a) {
29092
+ return [2 /*return*/, this.service.getFamily(taskId)];
29078
29093
  });
29079
29094
  });
29080
29095
  };
@@ -29101,6 +29116,26 @@ var TaskManagedAttributesApi = /** @class */ (function () {
29101
29116
  TaskManagedAttributesApi.prototype.resetAllListeners = function () {
29102
29117
  this.realtimeSubscriptions.resetAllListeners();
29103
29118
  };
29119
+ TaskManagedAttributesApi.prototype.requestAvailableAttributes = function () {
29120
+ return __awaiter(this, void 0, void 0, function () {
29121
+ var attributes;
29122
+ return __generator(this, function (_a) {
29123
+ switch (_a.label) {
29124
+ case 0:
29125
+ _a.trys.push([0, , 2, 3]);
29126
+ return [4 /*yield*/, this.service.getAvailableAttributes()];
29127
+ case 1:
29128
+ attributes = _a.sent();
29129
+ this.cachedAvailableAttributes.set(attributes);
29130
+ return [2 /*return*/, attributes];
29131
+ case 2:
29132
+ this.pendingAvailableAttributes = undefined;
29133
+ return [7 /*endfinally*/];
29134
+ case 3: return [2 /*return*/];
29135
+ }
29136
+ });
29137
+ });
29138
+ };
29104
29139
  return TaskManagedAttributesApi;
29105
29140
  }());
29106
29141
  exports["default"] = TaskManagedAttributesApi;
@@ -29306,6 +29341,19 @@ var TaskManagedAttributesService = /** @class */ (function () {
29306
29341
  });
29307
29342
  });
29308
29343
  };
29344
+ TaskManagedAttributesService.prototype.getFamily = function (taskId, commonOptions) {
29345
+ if (commonOptions === void 0) { commonOptions = {}; }
29346
+ return __awaiter(this, void 0, void 0, function () {
29347
+ return __generator(this, function (_a) {
29348
+ return [2 /*return*/, this.service.routeGenerator
29349
+ .get("".concat(basePath, "/family"))
29350
+ .withQueryString({ task_id: taskId })
29351
+ .setException('failed to fetch the family of the task')
29352
+ .withCommonOptions(commonOptions)
29353
+ .invoke()];
29354
+ });
29355
+ });
29356
+ };
29309
29357
  return TaskManagedAttributesService;
29310
29358
  }());
29311
29359
  exports["default"] = TaskManagedAttributesService;
@@ -37469,15 +37517,24 @@ var ToolName;
37469
37517
  (function (ToolName) {
37470
37518
  ToolName["CreateVisualization"] = "create_visualization";
37471
37519
  ToolName["SuggestFollowupQuestions"] = "suggest_followup_questions";
37520
+ ToolName["ExplainCalculation"] = "explain_calculation";
37472
37521
  })(ToolName || (exports.ToolName = ToolName = {}));
37473
37522
  var ChartKind;
37474
37523
  (function (ChartKind) {
37475
37524
  ChartKind["Bar"] = "bar";
37525
+ /** `bar` turned on its side, for long category names or more categories than fit across the width. */
37526
+ ChartKind["HorizontalBar"] = "horizontal_bar";
37527
+ /** One bar per category split into its series, for parts of a whole — `bar` puts them side by side instead. */
37528
+ ChartKind["StackedBar"] = "stacked_bar";
37476
37529
  ChartKind["Line"] = "line";
37477
- ChartKind["Pie"] = "pie";
37530
+ /** A line with the space under it filled, for when the size of the total matters and not only its direction. */
37478
37531
  ChartKind["Area"] = "area";
37532
+ ChartKind["Pie"] = "pie";
37533
+ /** A pie with its center cut out, for when that center should carry the total. */
37534
+ ChartKind["Doughnut"] = "doughnut";
37479
37535
  ChartKind["Scatter"] = "scatter";
37480
- ChartKind["StackedBar"] = "stacked_bar";
37536
+ /** A closed loop per series over the same measures, for comparing a few series across many measures at once. */
37537
+ ChartKind["Radar"] = "radar";
37481
37538
  })(ChartKind || (exports.ChartKind = ChartKind = {}));
37482
37539
  //# sourceMappingURL=tool_calls.js.map
37483
37540
 
@@ -38075,8 +38132,39 @@ var aggregation_types_1 = __webpack_require__(53551);
38075
38132
  var task_inventories_load_aggregator_1 = __webpack_require__(69508);
38076
38133
  function sortTasks(tasks, tieBreakById) {
38077
38134
  // Tie-break on id only where cluster identity depends on task adjacency: callers fetch tasks
38078
- // unordered, and every other path has to keep the caller's order for tied priorities
38079
- return __spreadArray([], tasks, true).sort(function (a, b) { return a.priority - b.priority || (tieBreakById ? a.id - b.id : 0); });
38135
+ // unordered, and every other path has to keep the caller's order for tied priorities. A missing
38136
+ // priority defaults to 0 because subtracting undefined yields NaN and costs the total order
38137
+ return __spreadArray([], tasks, true).sort(function (a, b) { var _a, _b; return ((_a = a.priority) !== null && _a !== void 0 ? _a : 0) - ((_b = b.priority) !== null && _b !== void 0 ? _b : 0) || (tieBreakById ? a.id - b.id : 0); });
38138
+ }
38139
+ // An order added to a sequenced route arrives as a pickup task and a drop-off task, so two stops
38140
+ // is the most that can sit unsequenced at the tail before their own order starts deciding the walk
38141
+ var MAX_UNSEQUENCED_TAIL = 2;
38142
+ function hasAssignedSequence(task) {
38143
+ return !(0, isNil_1.default)(task.priority) && task.priority !== task.id;
38144
+ }
38145
+ // Hagmonia defaults a missing priority to the task id, so a non-null priority is not evidence of a
38146
+ // route order. Ids dwarf sequence ordinals, so a couple of defaults sort past every assigned one
38147
+ // and stay a known tail; anything else puts the walk back on creation order, which reports less
38148
+ // than the vehicle carries
38149
+ function hasRouteSequence(tasks) {
38150
+ var lastAssigned = -Infinity;
38151
+ var firstDefaulted = Infinity;
38152
+ var unsequenced = 0;
38153
+ for (var _i = 0, tasks_1 = tasks; _i < tasks_1.length; _i++) {
38154
+ var task = tasks_1[_i];
38155
+ if (hasAssignedSequence(task)) {
38156
+ lastAssigned = Math.max(lastAssigned, task.priority);
38157
+ }
38158
+ else if ((0, isNil_1.default)(task.priority)) {
38159
+ // A null priority has no place in the sort at all, so it cannot be trusted to sort last
38160
+ return false;
38161
+ }
38162
+ else {
38163
+ unsequenced += 1;
38164
+ firstDefaulted = Math.min(firstDefaulted, task.priority);
38165
+ }
38166
+ }
38167
+ return lastAssigned > -Infinity && unsequenced <= MAX_UNSEQUENCED_TAIL && firstDefaulted > lastAssigned;
38080
38168
  }
38081
38169
  function getTaskInventoriesFromTasks(tasks) {
38082
38170
  return tasks.flatMap(function (task, taskIndex) {
@@ -38145,13 +38233,8 @@ function getTaskInventoriesOrderedByCustomers(taskInventories, splitClusters, un
38145
38233
  }
38146
38234
  return visitKey;
38147
38235
  }
38148
- // Only a pickup opens a new visit. Deliveries to the same customer twice stay one cluster,
38149
- // otherwise splitting them apart would raise the peak above what the vehicle ever carries
38150
- if (!pending) {
38151
- return visitKey;
38152
- }
38153
- // A stop elsewhere between two loads ends the cluster: the vehicle unloads in between,
38154
- // so the second load must not stack onto the first one's
38236
+ // A row past the visit's last load opens a new visit: the vehicle may have left in between,
38237
+ // and walking the row with the earlier visit would load or unload it somewhere else
38155
38238
  var nextVisitKey = "".concat(customerId, ":").concat(visit + 1);
38156
38239
  customerVisit[customerId] = visit + 1;
38157
38240
  clusterLastTaskIndex[nextVisitKey] = taskIndex;
@@ -38190,8 +38273,19 @@ function getTaskInventoriesOrderedByCustomers(taskInventories, splitClusters, un
38190
38273
  }
38191
38274
  function calculateLoadAggregations(aggregationTypes, _a) {
38192
38275
  var items = _a.items, field = _a.field, ignoreQuantity = _a.ignoreQuantity, isClusterMode = _a.isClusterMode, splitClustersBySequence = _a.splitClustersBySequence, uniqueInventoryFields = _a.uniqueInventoryFields, logger = _a.logger;
38193
- var splitClusters = Boolean(isClusterMode && splitClustersBySequence);
38194
- var sortedTasks = sortTasks(items, splitClusters);
38276
+ var splitRequested = Boolean(isClusterMode && splitClustersBySequence);
38277
+ var splitClusters = splitRequested && hasRouteSequence(items);
38278
+ if (logger && splitRequested && !splitClusters) {
38279
+ var taskIds = items.filter(function (task) { return !hasAssignedSequence(task); }).map(function (task) { return task.id; });
38280
+ if (taskIds.length) {
38281
+ logger('Split by sequence declined because these tasks have no assigned sequence', {
38282
+ task_ids: taskIds
38283
+ });
38284
+ }
38285
+ }
38286
+ // The tie-break follows the request, not the guard: dropping it on the fallback would leave the
38287
+ // order to the caller's fetch and make the reported load differ between two identical requests
38288
+ var sortedTasks = sortTasks(items, splitRequested);
38195
38289
  var plannedOrder = getTaskInventoriesFromTasks(sortedTasks);
38196
38290
  var taskInventories = isClusterMode
38197
38291
  ? getTaskInventoriesOrderedByCustomers(plannedOrder, splitClusters, uniqueInventoryFields, logger)
@@ -38216,7 +38310,7 @@ function calculateLoadAggregations(aggregationTypes, _a) {
38216
38310
  });
38217
38311
  }
38218
38312
  function calculateTasksMaxLoad(_a) {
38219
- var items = _a.items, field = _a.field, ignoreQuantity = _a.ignoreQuantity, isClusterMode = _a.isClusterMode, splitClustersBySequence = _a.splitClustersBySequence, uniqueInventoryFields = _a.uniqueInventoryFields;
38313
+ var items = _a.items, field = _a.field, ignoreQuantity = _a.ignoreQuantity, isClusterMode = _a.isClusterMode, splitClustersBySequence = _a.splitClustersBySequence, uniqueInventoryFields = _a.uniqueInventoryFields, logger = _a.logger;
38220
38314
  var aggregationType = aggregation_types_1.AggregationTypes.MAX_LOAD;
38221
38315
  return calculateLoadAggregations([aggregationType], {
38222
38316
  items: items,
@@ -38224,7 +38318,8 @@ function calculateTasksMaxLoad(_a) {
38224
38318
  ignoreQuantity: ignoreQuantity,
38225
38319
  isClusterMode: isClusterMode,
38226
38320
  splitClustersBySequence: splitClustersBySequence,
38227
- uniqueInventoryFields: uniqueInventoryFields
38321
+ uniqueInventoryFields: uniqueInventoryFields,
38322
+ logger: logger
38228
38323
  })[aggregationType];
38229
38324
  }
38230
38325
  //# sourceMappingURL=tasks_load_aggregators.js.map
@@ -39280,6 +39375,7 @@ __exportStar(__webpack_require__(82642), exports);
39280
39375
  __exportStar(__webpack_require__(44394), exports);
39281
39376
  __exportStar(__webpack_require__(37787), exports);
39282
39377
  __exportStar(__webpack_require__(31306), exports);
39378
+ __exportStar(__webpack_require__(92244), exports);
39283
39379
  //# sourceMappingURL=index.js.map
39284
39380
 
39285
39381
  /***/ }),
@@ -39362,6 +39458,112 @@ function getActionableWaypoint(wayPoints, taskTypeId) {
39362
39458
 
39363
39459
  /***/ }),
39364
39460
 
39461
+ /***/ 92244:
39462
+ /***/ ((__unused_webpack_module, exports) => {
39463
+
39464
+ "use strict";
39465
+
39466
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
39467
+ exports.normalizeUrl = normalizeUrl;
39468
+ exports.isValidPublicUrl = isValidPublicUrl;
39469
+ // A DNS label: 1-63 chars, alphanumeric at both ends, hyphens only in between.
39470
+ // The optional group is what allows a 1-char label while still forbidding a
39471
+ // trailing hyphen, and {0,61} caps the label at 63 (1 + 61 + 1).
39472
+ var LABEL_REGEX = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?';
39473
+ // Same shape, but the TLD must begin with a letter. That also rejects every
39474
+ // IPv4 literal, since a dotted quad's final label is numeric.
39475
+ var TLD_REGEX = '[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?';
39476
+ // Two or more labels, 253 chars max overall. Safe against a lowercased,
39477
+ // punycoded hostname only -- run URL.parse first, never raw input.
39478
+ var HOSTNAME_REGEX = new RegExp("^(?=.{1,253}$)(?:".concat(LABEL_REGEX, "\\.)+").concat(TLD_REGEX, "$"));
39479
+ var IPV4 = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
39480
+ // IANA special-purpose IPv4 ranges: never valid as a public destination.
39481
+ // Ordered as in the registry; the CIDR sizes are the whole point, so the
39482
+ // /10, /12 and /15 entries are the ones worth having tests around.
39483
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
39484
+ var RESERVED_V4 = [
39485
+ ['0.0.0.0', 8], // "this network"
39486
+ ['10.0.0.0', 8], // private
39487
+ ['100.64.0.0', 10], // carrier-grade NAT
39488
+ ['127.0.0.0', 8], // loopback
39489
+ ['169.254.0.0', 16], // link-local, incl. cloud metadata
39490
+ ['172.16.0.0', 12], // private
39491
+ ['192.0.0.0', 24], // IETF protocol assignments
39492
+ ['192.0.2.0', 24], // TEST-NET-1
39493
+ ['192.88.99.0', 24], // 6to4 relay anycast (deprecated)
39494
+ ['192.168.0.0', 16], // private
39495
+ ['198.18.0.0', 15], // benchmarking
39496
+ ['198.51.100.0', 24], // TEST-NET-2
39497
+ ['203.0.113.0', 24], // TEST-NET-3
39498
+ ['224.0.0.0', 4], // multicast
39499
+ ['240.0.0.0', 4] // reserved, incl. 255.255.255.255 broadcast
39500
+ ];
39501
+ /* eslint-enable @typescript-eslint/no-magic-numbers */
39502
+ function normalizeUrl(value) {
39503
+ var _a, _b;
39504
+ return (_b = (_a = parseUrl(value)) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : value;
39505
+ }
39506
+ /**
39507
+ * NOTE: there is another `isUrl` validation missaligned with this one in bringg-frontend/libs/features/sendbird-chat/src/components/channel-conversation/components/message-content/utils.ts
39508
+ * Considering it's very different and will produce a lot of false-positves, I didn't align it here; still worth being recorded
39509
+ * Known gaps:
39510
+ * nonexistent TLD: 'http://example.invalid'
39511
+ * reserved TLD: 'http://foo.test'
39512
+ */
39513
+ function isValidPublicUrl(value) {
39514
+ var url = parseUrl(value);
39515
+ if (!url) {
39516
+ return false;
39517
+ }
39518
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') {
39519
+ return false;
39520
+ }
39521
+ // credential-stuffing vector
39522
+ if (url.username || url.password) {
39523
+ return false;
39524
+ }
39525
+ if (IPV4.test(url.hostname)) {
39526
+ return isPublicIPv4(url.hostname);
39527
+ }
39528
+ return HOSTNAME_REGEX.test(url.hostname);
39529
+ }
39530
+ var IPV4_OCTET_MAX = 255;
39531
+ var IPV4_OCTET_RADIX = 256;
39532
+ var IPV4_BIT_WIDTH = 32;
39533
+ var IPV4_ALL_ONES = 0xffffffff;
39534
+ var RESERVED_V4_MASKED = RESERVED_V4.map(function (_a) {
39535
+ var base = _a[0], bits = _a[1];
39536
+ var mask = (IPV4_ALL_ONES << (IPV4_BIT_WIDTH - bits)) >>> 0;
39537
+ return [(toUint32(base) & mask) >>> 0, mask];
39538
+ });
39539
+ function parseUrl(value) {
39540
+ try {
39541
+ return new URL(value);
39542
+ }
39543
+ catch (_a) {
39544
+ return null;
39545
+ }
39546
+ }
39547
+ // Only ever called with a hostname URL.parse produced, so the dotted quad is
39548
+ // already canonical -- 0x7f.1, 2130706433 and 0177.0.0.1 all arrive as 127.0.0.1
39549
+ function isPublicIPv4(hostname) {
39550
+ var octets = hostname.split('.');
39551
+ if (octets.some(function (o) { return Number(o) > IPV4_OCTET_MAX; })) {
39552
+ return false;
39553
+ }
39554
+ var n = toUint32(hostname);
39555
+ return !RESERVED_V4_MASKED.some(function (_a) {
39556
+ var base = _a[0], mask = _a[1];
39557
+ return (n & mask) >>> 0 === base;
39558
+ });
39559
+ }
39560
+ function toUint32(quad) {
39561
+ return quad.split('.').reduce(function (acc, oct) { return acc * IPV4_OCTET_RADIX + Number(oct); }, 0);
39562
+ }
39563
+ //# sourceMappingURL=url_utils.js.map
39564
+
39565
+ /***/ }),
39566
+
39365
39567
  /***/ 63127:
39366
39568
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
39367
39569