@bringg/dashboard-sdk 9.91.0-pre.0 → 9.91.0-pre.2
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/TaskManagedAttributes/task-managed-attributes-api.d.ts +5 -1
- package/dist/TaskManagedAttributes/task-managed-attributes-api.js +31 -12
- package/dist/TaskManagedAttributes/task-managed-attributes-api.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +32 -13
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +2 -2
- package/dist/bringg-dashboard-sdk.min.js +1 -1
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GetAvailableManagedAttributeHTTPResponse, GetFamilyHTTPResponse } from '@bringg/common-utils';
|
|
2
|
+
import { CommonOptions } from '../Core/RouteGenerator';
|
|
2
3
|
import { DataOptions } from '../data-entity';
|
|
3
4
|
import Session from '../Services/Identity/Session';
|
|
4
5
|
import { TaskManagedAttributeUpdateRealTimeEvent } from './internal-types';
|
|
@@ -10,6 +11,7 @@ export default class TaskManagedAttributesApi {
|
|
|
10
11
|
private readonly storableDataService;
|
|
11
12
|
private readonly realtimeSubscriptions;
|
|
12
13
|
private readonly cachedAvailableAttributes;
|
|
14
|
+
private pendingAvailableAttributes;
|
|
13
15
|
constructor(session: Session);
|
|
14
16
|
get(id: number): ManagedAttribute;
|
|
15
17
|
getByIds(ids: number[]): ManagedAttribute[];
|
|
@@ -21,14 +23,16 @@ export default class TaskManagedAttributesApi {
|
|
|
21
23
|
* the order page renders for each of them. Not cached: statuses and time windows change.
|
|
22
24
|
*
|
|
23
25
|
* @param taskId - the order whose family is requested
|
|
26
|
+
* @param commonOptions - request options, such as an abort `signal`
|
|
24
27
|
* @returns `family: null` when the order belongs to no family
|
|
25
28
|
* @throws BringgException with `statusCode` 409 when the service cannot resolve the family
|
|
26
29
|
* @example
|
|
27
30
|
* const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
|
|
28
31
|
* const siblingIds = family?.members.map(member => member.task_id) ?? [];
|
|
29
32
|
*/
|
|
30
|
-
getFamily(taskId: number): Promise<GetFamilyHTTPResponse>;
|
|
33
|
+
getFamily(taskId: number, commonOptions?: CommonOptions): Promise<GetFamilyHTTPResponse>;
|
|
31
34
|
onUpdate(callback: (event: TaskManagedAttributeUpdateRealTimeEvent) => unknown | Promise<unknown>): () => void;
|
|
32
35
|
fetchAvailableAttributes(ids: number[], commonOptions?: DataOptions): Promise<GetAvailableManagedAttributeHTTPResponse>;
|
|
33
36
|
resetAllListeners(): void;
|
|
37
|
+
private requestAvailableAttributes;
|
|
34
38
|
}
|
|
@@ -113,17 +113,14 @@ 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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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];
|
|
126
119
|
}
|
|
120
|
+
if (!this.pendingAvailableAttributes) {
|
|
121
|
+
this.pendingAvailableAttributes = this.requestAvailableAttributes();
|
|
122
|
+
}
|
|
123
|
+
return [2 /*return*/, this.pendingAvailableAttributes];
|
|
127
124
|
});
|
|
128
125
|
});
|
|
129
126
|
};
|
|
@@ -132,16 +129,18 @@ var TaskManagedAttributesApi = /** @class */ (function () {
|
|
|
132
129
|
* the order page renders for each of them. Not cached: statuses and time windows change.
|
|
133
130
|
*
|
|
134
131
|
* @param taskId - the order whose family is requested
|
|
132
|
+
* @param commonOptions - request options, such as an abort `signal`
|
|
135
133
|
* @returns `family: null` when the order belongs to no family
|
|
136
134
|
* @throws BringgException with `statusCode` 409 when the service cannot resolve the family
|
|
137
135
|
* @example
|
|
138
136
|
* const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
|
|
139
137
|
* const siblingIds = family?.members.map(member => member.task_id) ?? [];
|
|
140
138
|
*/
|
|
141
|
-
TaskManagedAttributesApi.prototype.getFamily = function (taskId) {
|
|
139
|
+
TaskManagedAttributesApi.prototype.getFamily = function (taskId, commonOptions) {
|
|
140
|
+
if (commonOptions === void 0) { commonOptions = {}; }
|
|
142
141
|
return __awaiter(this, void 0, void 0, function () {
|
|
143
142
|
return __generator(this, function (_a) {
|
|
144
|
-
return [2 /*return*/, this.service.getFamily(taskId)];
|
|
143
|
+
return [2 /*return*/, this.service.getFamily(taskId, commonOptions)];
|
|
145
144
|
});
|
|
146
145
|
});
|
|
147
146
|
};
|
|
@@ -168,6 +167,26 @@ var TaskManagedAttributesApi = /** @class */ (function () {
|
|
|
168
167
|
TaskManagedAttributesApi.prototype.resetAllListeners = function () {
|
|
169
168
|
this.realtimeSubscriptions.resetAllListeners();
|
|
170
169
|
};
|
|
170
|
+
TaskManagedAttributesApi.prototype.requestAvailableAttributes = function () {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
+
var attributes;
|
|
173
|
+
return __generator(this, function (_a) {
|
|
174
|
+
switch (_a.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_a.trys.push([0, , 2, 3]);
|
|
177
|
+
return [4 /*yield*/, this.service.getAvailableAttributes()];
|
|
178
|
+
case 1:
|
|
179
|
+
attributes = _a.sent();
|
|
180
|
+
this.cachedAvailableAttributes.set(attributes);
|
|
181
|
+
return [2 /*return*/, attributes];
|
|
182
|
+
case 2:
|
|
183
|
+
this.pendingAvailableAttributes = undefined;
|
|
184
|
+
return [7 /*endfinally*/];
|
|
185
|
+
case 3: return [2 /*return*/];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
171
190
|
return TaskManagedAttributesApi;
|
|
172
191
|
}());
|
|
173
192
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"task-managed-attributes-api.js","sourceRoot":"","sources":["../../src/TaskManagedAttributes/task-managed-attributes-api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,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,OAAgB;QAA5B,iBAkBC;QA1BgB,8BAAyB,GAAG,IAAI,wBAAU,CAA2C;YACrG,GAAG,EAAE;gBACJ,OAAO,EAAE,sCAA8B;aACvC;SACD,CAAC,CAAC;QAKF,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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CAAC;wBAE/C,sBAAO,UAAU,EAAC;;wBAElB,IAAI,CAAC,0BAA0B,GAAG,SAAS,CAAC;;;;;;KAE7C;IACF,+BAAC;AAAD,CAAC,AA9HD,IA8HC"}
|
|
@@ -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.91.0-pre.
|
|
24787
|
+
var version = '9.91.0-pre.2';
|
|
24788
24788
|
function logErrorResponse(response) {
|
|
24789
24789
|
var data = response.data, status = response.status;
|
|
24790
24790
|
try {
|
|
@@ -29064,17 +29064,14 @@ 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
|
-
|
|
29068
|
-
|
|
29069
|
-
|
|
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];
|
|
29077
29070
|
}
|
|
29071
|
+
if (!this.pendingAvailableAttributes) {
|
|
29072
|
+
this.pendingAvailableAttributes = this.requestAvailableAttributes();
|
|
29073
|
+
}
|
|
29074
|
+
return [2 /*return*/, this.pendingAvailableAttributes];
|
|
29078
29075
|
});
|
|
29079
29076
|
});
|
|
29080
29077
|
};
|
|
@@ -29083,16 +29080,18 @@ var TaskManagedAttributesApi = /** @class */ (function () {
|
|
|
29083
29080
|
* the order page renders for each of them. Not cached: statuses and time windows change.
|
|
29084
29081
|
*
|
|
29085
29082
|
* @param taskId - the order whose family is requested
|
|
29083
|
+
* @param commonOptions - request options, such as an abort `signal`
|
|
29086
29084
|
* @returns `family: null` when the order belongs to no family
|
|
29087
29085
|
* @throws BringgException with `statusCode` 409 when the service cannot resolve the family
|
|
29088
29086
|
* @example
|
|
29089
29087
|
* const { family } = await sdk.v2.taskManagedAttributes.getFamily(9750945);
|
|
29090
29088
|
* const siblingIds = family?.members.map(member => member.task_id) ?? [];
|
|
29091
29089
|
*/
|
|
29092
|
-
TaskManagedAttributesApi.prototype.getFamily = function (taskId) {
|
|
29090
|
+
TaskManagedAttributesApi.prototype.getFamily = function (taskId, commonOptions) {
|
|
29091
|
+
if (commonOptions === void 0) { commonOptions = {}; }
|
|
29093
29092
|
return __awaiter(this, void 0, void 0, function () {
|
|
29094
29093
|
return __generator(this, function (_a) {
|
|
29095
|
-
return [2 /*return*/, this.service.getFamily(taskId)];
|
|
29094
|
+
return [2 /*return*/, this.service.getFamily(taskId, commonOptions)];
|
|
29096
29095
|
});
|
|
29097
29096
|
});
|
|
29098
29097
|
};
|
|
@@ -29119,6 +29118,26 @@ var TaskManagedAttributesApi = /** @class */ (function () {
|
|
|
29119
29118
|
TaskManagedAttributesApi.prototype.resetAllListeners = function () {
|
|
29120
29119
|
this.realtimeSubscriptions.resetAllListeners();
|
|
29121
29120
|
};
|
|
29121
|
+
TaskManagedAttributesApi.prototype.requestAvailableAttributes = function () {
|
|
29122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
29123
|
+
var attributes;
|
|
29124
|
+
return __generator(this, function (_a) {
|
|
29125
|
+
switch (_a.label) {
|
|
29126
|
+
case 0:
|
|
29127
|
+
_a.trys.push([0, , 2, 3]);
|
|
29128
|
+
return [4 /*yield*/, this.service.getAvailableAttributes()];
|
|
29129
|
+
case 1:
|
|
29130
|
+
attributes = _a.sent();
|
|
29131
|
+
this.cachedAvailableAttributes.set(attributes);
|
|
29132
|
+
return [2 /*return*/, attributes];
|
|
29133
|
+
case 2:
|
|
29134
|
+
this.pendingAvailableAttributes = undefined;
|
|
29135
|
+
return [7 /*endfinally*/];
|
|
29136
|
+
case 3: return [2 /*return*/];
|
|
29137
|
+
}
|
|
29138
|
+
});
|
|
29139
|
+
});
|
|
29140
|
+
};
|
|
29122
29141
|
return TaskManagedAttributesApi;
|
|
29123
29142
|
}());
|
|
29124
29143
|
exports["default"] = TaskManagedAttributesApi;
|