Comparing version 0.6.0-alpha to 0.6.1-alpha
@@ -93,3 +93,3 @@ export declare enum APIValidationState { | ||
id: string; | ||
state: APIValidationState; | ||
state: APIStateData; | ||
updatedAt: string; | ||
@@ -101,8 +101,9 @@ resource: Partial<APIResourceData>; | ||
id: string; | ||
state: { | ||
id: number; | ||
label: string; | ||
}; | ||
state: APIStateData; | ||
updatedAt: string; | ||
} | ||
export interface APIStateData { | ||
id: number; | ||
label: APIValidationState; | ||
} | ||
export interface APIErrorData { | ||
@@ -109,0 +110,0 @@ } |
@@ -72,3 +72,2 @@ import { __extends } from "tslib"; | ||
this.validations = new ResourceValidationStateManager(this); | ||
this.client.refresh(); | ||
}; | ||
@@ -75,0 +74,0 @@ /** Return data for api request */ |
@@ -11,3 +11,3 @@ import { __extends } from "tslib"; | ||
_this.data = data; | ||
_this.state = data.state; | ||
_this.state = data.state.label; | ||
_this.updatedAt = new Date(data.updatedAt); | ||
@@ -25,3 +25,3 @@ _this.moderator = _this.getModerator((_a = data.moderator) === null || _a === void 0 ? void 0 : _a.id); | ||
this.data = data; | ||
this.state = data.state; | ||
this.state = data.state.label; | ||
this.updatedAt = new Date(data.updatedAt); | ||
@@ -28,0 +28,0 @@ this.moderator = this.getModerator((_a = data.moderator) === null || _a === void 0 ? void 0 : _a.id); |
@@ -18,6 +18,13 @@ import { __awaiter, __extends, __generator } from "tslib"; | ||
if (existing) { | ||
var oldCategories = existing.categories.cache; | ||
existing._patch(data); | ||
existing.categories.cache.forEach(function (c) { | ||
var newCategories = existing.categories.cache; | ||
// Remove resource from old categories | ||
oldCategories.difference(newCategories).forEach(function (c) { | ||
c.resources.cache.delete(existing.id); | ||
}); | ||
// add resource to new categories | ||
newCategories.difference(oldCategories).forEach(function (c) { | ||
c.resources.cache.set(existing.id, existing); | ||
}); | ||
return existing; | ||
@@ -80,3 +87,3 @@ } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var data, resourceData, resource, _i, _a, a, data_2; | ||
var data, resourceData, finalResourceData, _i, _a, a; | ||
return __generator(this, function (_b) { | ||
@@ -89,2 +96,3 @@ switch (_b.label) { | ||
resourceData = _b.sent(); | ||
finalResourceData = resourceData; | ||
if (!(builder.attachments.length > 0)) return [3 /*break*/, 7]; | ||
@@ -106,9 +114,6 @@ _i = 0, _a = builder.attachments; | ||
case 6: | ||
data_2 = _b.sent(); | ||
resource = new Resource(this.client, data_2); | ||
return [3 /*break*/, 8]; | ||
case 7: | ||
resource = new Resource(this.client, resourceData); | ||
_b.label = 8; | ||
case 8: return [2 /*return*/, this._add(resourceData)]; | ||
finalResourceData = | ||
_b.sent(); | ||
_b.label = 7; | ||
case 7: return [2 /*return*/, this._add(finalResourceData)]; | ||
} | ||
@@ -115,0 +120,0 @@ }); |
{ | ||
"name": "rr-apilib", | ||
"version": "0.6.0-alpha", | ||
"version": "0.6.1-alpha", | ||
"description": "Library for interact with RR-API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
188333
2727