merchi_sdk_ts 1.0.63 → 1.0.65
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/entities/draft.js
CHANGED
|
@@ -22,17 +22,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
22
22
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
23
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
24
|
};
|
|
25
|
-
var __values = (this && this.__values) || function(o) {
|
|
26
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
27
|
-
if (m) return m.call(o);
|
|
28
|
-
if (o && typeof o.length === "number") return {
|
|
29
|
-
next: function () {
|
|
30
|
-
if (o && i >= o.length) o = void 0;
|
|
31
|
-
return { value: o && o[i++], done: !o };
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
35
|
-
};
|
|
36
25
|
import { Entity } from '../entity.js';
|
|
37
26
|
import { Job } from './job.js';
|
|
38
27
|
import { User } from './user.js';
|
|
@@ -40,32 +29,6 @@ var Draft = /** @class */ (function (_super) {
|
|
|
40
29
|
__extends(Draft, _super);
|
|
41
30
|
function Draft() {
|
|
42
31
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
43
|
-
_this.wereChangesRequested = function () {
|
|
44
|
-
var e_1, _a;
|
|
45
|
-
/* true if any comment is/was a change request comment. */
|
|
46
|
-
if (_this.comments === undefined) {
|
|
47
|
-
throw 'comments is undefined. did you forget to embed it?';
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
for (var _b = __values(_this.comments), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
51
|
-
var comment = _c.value;
|
|
52
|
-
if (comment.changeRequest === undefined) {
|
|
53
|
-
throw 'changeRequest is undefined.';
|
|
54
|
-
}
|
|
55
|
-
if (comment.changeRequest) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e_1) throw e_1.error; }
|
|
66
|
-
}
|
|
67
|
-
return false;
|
|
68
|
-
};
|
|
69
32
|
_this.commentsYoungestToEldest = function () {
|
|
70
33
|
if (_this.comments === undefined) {
|
|
71
34
|
throw 'comments is undefined. did you forget to embed it?';
|
|
@@ -118,6 +81,10 @@ var Draft = /** @class */ (function (_super) {
|
|
|
118
81
|
Draft.property({ arrayType: 'DraftComment' }),
|
|
119
82
|
__metadata("design:type", Array)
|
|
120
83
|
], Draft.prototype, "comments", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
Draft.property({ arrayType: 'DraftTemplate' }),
|
|
86
|
+
__metadata("design:type", Array)
|
|
87
|
+
], Draft.prototype, "draftTemplates", void 0);
|
|
121
88
|
__decorate([
|
|
122
89
|
Draft.property(),
|
|
123
90
|
__metadata("design:type", Number)
|
|
@@ -4,19 +4,6 @@ test('can make Draft', function () {
|
|
|
4
4
|
var draft = new merchi.Draft();
|
|
5
5
|
expect(draft).toBeTruthy();
|
|
6
6
|
});
|
|
7
|
-
test('wereChangesRequested', function () {
|
|
8
|
-
var merchi = new Merchi();
|
|
9
|
-
var draft = new merchi.Draft();
|
|
10
|
-
expect(draft.wereChangesRequested).toThrow();
|
|
11
|
-
draft.comments = [];
|
|
12
|
-
expect(draft.wereChangesRequested()).toBe(false);
|
|
13
|
-
draft.comments = [new merchi.DraftComment()];
|
|
14
|
-
expect(draft.wereChangesRequested).toThrow();
|
|
15
|
-
draft.comments[0].changeRequest = false;
|
|
16
|
-
expect(draft.wereChangesRequested()).toBe(false);
|
|
17
|
-
draft.comments[0].changeRequest = true;
|
|
18
|
-
expect(draft.wereChangesRequested()).toBe(true);
|
|
19
|
-
});
|
|
20
7
|
test('commentsYoungestToEldest', function () {
|
|
21
8
|
var merchi = new Merchi();
|
|
22
9
|
var draft = new merchi.Draft();
|
|
@@ -66,6 +66,10 @@ var DraftTemplate = /** @class */ (function (_super) {
|
|
|
66
66
|
DraftTemplate.property({ type: MerchiFile }),
|
|
67
67
|
__metadata("design:type", MerchiFile)
|
|
68
68
|
], DraftTemplate.prototype, "file", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
DraftTemplate.property({ type: 'MerchiFile' }),
|
|
71
|
+
__metadata("design:type", MerchiFile)
|
|
72
|
+
], DraftTemplate.prototype, "design", void 0);
|
|
69
73
|
__decorate([
|
|
70
74
|
DraftTemplate.property({ type: Product }),
|
|
71
75
|
__metadata("design:type", Object)
|
|
@@ -82,10 +86,6 @@ var DraftTemplate = /** @class */ (function (_super) {
|
|
|
82
86
|
DraftTemplate.property({ arrayType: 'VariationField' }),
|
|
83
87
|
__metadata("design:type", Array)
|
|
84
88
|
], DraftTemplate.prototype, "editedByVariationFields", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
DraftTemplate.property({ arrayType: 'MerchiFile' }),
|
|
87
|
-
__metadata("design:type", Array)
|
|
88
|
-
], DraftTemplate.prototype, "draftPreviews", void 0);
|
|
89
89
|
return DraftTemplate;
|
|
90
90
|
}(Entity));
|
|
91
91
|
export { DraftTemplate };
|
package/package.json
CHANGED
|
@@ -6,20 +6,6 @@ test('can make Draft', () => {
|
|
|
6
6
|
expect(draft).toBeTruthy();
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
test('wereChangesRequested', () => {
|
|
10
|
-
const merchi = new Merchi();
|
|
11
|
-
const draft = new merchi.Draft();
|
|
12
|
-
expect(draft.wereChangesRequested).toThrow();
|
|
13
|
-
draft.comments = [];
|
|
14
|
-
expect(draft.wereChangesRequested()).toBe(false);
|
|
15
|
-
draft.comments = [new merchi.DraftComment()];
|
|
16
|
-
expect(draft.wereChangesRequested).toThrow();
|
|
17
|
-
draft.comments[0].changeRequest = false;
|
|
18
|
-
expect(draft.wereChangesRequested()).toBe(false);
|
|
19
|
-
draft.comments[0].changeRequest = true;
|
|
20
|
-
expect(draft.wereChangesRequested()).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
9
|
test('commentsYoungestToEldest', () => {
|
|
24
10
|
const merchi = new Merchi();
|
|
25
11
|
const draft = new merchi.Draft();
|
package/src/entities/draft.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { MerchiFile } from './file.js';
|
|
|
4
4
|
import { Job } from './job.js';
|
|
5
5
|
import { Notification } from './notification.js';
|
|
6
6
|
import { User } from './user.js';
|
|
7
|
+
import { DraftTemplate } from './draft_template.js';
|
|
7
8
|
|
|
8
9
|
export class Draft extends Entity {
|
|
9
10
|
protected static resourceName = 'drafts';
|
|
@@ -37,6 +38,9 @@ export class Draft extends Entity {
|
|
|
37
38
|
@Draft.property({arrayType: 'DraftComment'})
|
|
38
39
|
public comments?: DraftComment[];
|
|
39
40
|
|
|
41
|
+
@Draft.property({arrayType: 'DraftTemplate'})
|
|
42
|
+
public draftTemplates?: DraftTemplate[];
|
|
43
|
+
|
|
40
44
|
@Draft.property()
|
|
41
45
|
public commentsCount?: number;
|
|
42
46
|
|
|
@@ -58,22 +62,6 @@ export class Draft extends Entity {
|
|
|
58
62
|
@Draft.property()
|
|
59
63
|
public sharedWithJob?: Job;
|
|
60
64
|
|
|
61
|
-
public wereChangesRequested = () => {
|
|
62
|
-
/* true if any comment is/was a change request comment. */
|
|
63
|
-
if (this.comments === undefined) {
|
|
64
|
-
throw 'comments is undefined. did you forget to embed it?';
|
|
65
|
-
}
|
|
66
|
-
for (const comment of this.comments) {
|
|
67
|
-
if (comment.changeRequest === undefined) {
|
|
68
|
-
throw 'changeRequest is undefined.';
|
|
69
|
-
}
|
|
70
|
-
if (comment.changeRequest) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return false;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
65
|
public commentsYoungestToEldest = () => {
|
|
78
66
|
if (this.comments === undefined) {
|
|
79
67
|
throw 'comments is undefined. did you forget to embed it?';
|
|
@@ -34,6 +34,9 @@ export class DraftTemplate extends Entity {
|
|
|
34
34
|
@DraftTemplate.property({type: MerchiFile})
|
|
35
35
|
public file?: MerchiFile;
|
|
36
36
|
|
|
37
|
+
@DraftTemplate.property({type: 'MerchiFile'})
|
|
38
|
+
public design?: MerchiFile;
|
|
39
|
+
|
|
37
40
|
@DraftTemplate.property({type: Product})
|
|
38
41
|
public product?: Product | null;
|
|
39
42
|
|
|
@@ -46,6 +49,4 @@ export class DraftTemplate extends Entity {
|
|
|
46
49
|
@DraftTemplate.property({arrayType: 'VariationField'})
|
|
47
50
|
public editedByVariationFields?: VariationField[];
|
|
48
51
|
|
|
49
|
-
@DraftTemplate.property({arrayType: 'MerchiFile'})
|
|
50
|
-
public draftPreviews?: MerchiFile[];
|
|
51
52
|
}
|