@merchi/sdk 1.42.19 → 1.42.20
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/category.d.ts +3 -0
- package/dist/entities/category.js +8 -0
- package/dist/entities/category.test.js +13 -0
- package/dist/entities/domain_tag.d.ts +2 -0
- package/dist/entities/domain_tag.js +4 -0
- package/dist/entities/domain_tag.test.js +9 -0
- package/dist/entities/user.d.ts +1 -0
- package/dist/entities/user.js +4 -0
- package/dist/entities/user.test.js +9 -0
- package/package.json +1 -1
- package/src/entities/category.test.ts +13 -0
- package/src/entities/category.ts +7 -0
- package/src/entities/domain_tag.test.ts +9 -0
- package/src/entities/domain_tag.ts +4 -0
- package/src/entities/user.test.ts +9 -0
- package/src/entities/user.ts +3 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Domain } from './domain.js';
|
|
2
|
+
import { DomainTag } from './domain_tag.js';
|
|
2
3
|
import { Entity } from '../entity.js';
|
|
3
4
|
import { MerchiFile } from './file.js';
|
|
4
5
|
import { Product } from './product.js';
|
|
@@ -20,6 +21,8 @@ export declare class Category extends Entity {
|
|
|
20
21
|
domain?: Domain;
|
|
21
22
|
products?: Product[];
|
|
22
23
|
users?: User[];
|
|
24
|
+
tags?: DomainTag[];
|
|
25
|
+
assigned?: User[];
|
|
23
26
|
subcategories?: Category[];
|
|
24
27
|
parent?: Category;
|
|
25
28
|
image?: MerchiFile | null;
|
|
@@ -84,6 +84,14 @@ var Category = /** @class */ (function (_super) {
|
|
|
84
84
|
Category.property({ arrayType: 'User' }),
|
|
85
85
|
__metadata("design:type", Array)
|
|
86
86
|
], Category.prototype, "users", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
Category.property({ arrayType: 'DomainTag' }),
|
|
89
|
+
__metadata("design:type", Array)
|
|
90
|
+
], Category.prototype, "tags", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
Category.property({ arrayType: 'User' }),
|
|
93
|
+
__metadata("design:type", Array)
|
|
94
|
+
], Category.prototype, "assigned", void 0);
|
|
87
95
|
__decorate([
|
|
88
96
|
Category.property({ arrayType: 'Category' }),
|
|
89
97
|
__metadata("design:type", Array)
|
|
@@ -33,6 +33,19 @@ test('can get and set product', function () {
|
|
|
33
33
|
p1.categories = undefined;
|
|
34
34
|
expect(p1.categories).toBe(undefined);
|
|
35
35
|
});
|
|
36
|
+
test('can set tags and assigned team members', function () {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
var merchi = new Merchi();
|
|
39
|
+
var category = new merchi.Category();
|
|
40
|
+
var tag = new merchi.DomainTag();
|
|
41
|
+
var user = new merchi.User();
|
|
42
|
+
tag.id = 4;
|
|
43
|
+
user.id = 9;
|
|
44
|
+
category.tags = [tag];
|
|
45
|
+
category.assigned = [user];
|
|
46
|
+
expect((_a = category.tags) === null || _a === void 0 ? void 0 : _a.map(function (item) { return item.id; })).toEqual([4]);
|
|
47
|
+
expect((_b = category.assigned) === null || _b === void 0 ? void 0 : _b.map(function (item) { return item.id; })).toEqual([9]);
|
|
48
|
+
});
|
|
36
49
|
test('independence of entities', function () {
|
|
37
50
|
var merchi = new Merchi();
|
|
38
51
|
var c1 = new merchi.Category();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Category } from './category.js';
|
|
1
2
|
import { Domain } from './domain.js';
|
|
2
3
|
import { Entity } from '../entity.js';
|
|
3
4
|
import { Invoice } from './invoice.js';
|
|
@@ -18,4 +19,5 @@ export declare class DomainTag extends Entity {
|
|
|
18
19
|
products?: Product[];
|
|
19
20
|
invoices?: Invoice[];
|
|
20
21
|
shipments?: Shipment[];
|
|
22
|
+
categories?: Category[];
|
|
21
23
|
}
|
|
@@ -72,6 +72,10 @@ var DomainTag = /** @class */ (function (_super) {
|
|
|
72
72
|
DomainTag.property({ arrayType: 'Shipment' }),
|
|
73
73
|
__metadata("design:type", Array)
|
|
74
74
|
], DomainTag.prototype, "shipments", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
DomainTag.property({ arrayType: 'Category' }),
|
|
77
|
+
__metadata("design:type", Array)
|
|
78
|
+
], DomainTag.prototype, "categories", void 0);
|
|
75
79
|
return DomainTag;
|
|
76
80
|
}(Entity));
|
|
77
81
|
export { DomainTag };
|
|
@@ -4,3 +4,12 @@ test('can make DomainTag', function () {
|
|
|
4
4
|
var domainTag = new merchi.DomainTag();
|
|
5
5
|
expect(domainTag).toBeTruthy();
|
|
6
6
|
});
|
|
7
|
+
test('can set categories', function () {
|
|
8
|
+
var _a;
|
|
9
|
+
var merchi = new Merchi();
|
|
10
|
+
var domainTag = new merchi.DomainTag();
|
|
11
|
+
var category = new merchi.Category();
|
|
12
|
+
category.id = 3;
|
|
13
|
+
domainTag.categories = [category];
|
|
14
|
+
expect((_a = domainTag.categories) === null || _a === void 0 ? void 0 : _a.map(function (item) { return item.id; })).toEqual([3]);
|
|
15
|
+
});
|
package/dist/entities/user.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare class User extends Entity {
|
|
|
90
90
|
_companies?: UserCompany[];
|
|
91
91
|
companiesNeedStripe?: Company[];
|
|
92
92
|
categories?: Category[];
|
|
93
|
+
assignedCategories?: Category[];
|
|
93
94
|
products?: Product[];
|
|
94
95
|
profilePicture?: MerchiFile | null;
|
|
95
96
|
phoneNumbers?: PhoneNumber[];
|
package/dist/entities/user.js
CHANGED
|
@@ -372,6 +372,10 @@ var User = /** @class */ (function (_super) {
|
|
|
372
372
|
User.property({ arrayType: 'Category' }),
|
|
373
373
|
__metadata("design:type", Array)
|
|
374
374
|
], User.prototype, "categories", void 0);
|
|
375
|
+
__decorate([
|
|
376
|
+
User.property({ arrayType: 'Category' }),
|
|
377
|
+
__metadata("design:type", Array)
|
|
378
|
+
], User.prototype, "assignedCategories", void 0);
|
|
375
379
|
__decorate([
|
|
376
380
|
User.property({ arrayType: 'Product' }),
|
|
377
381
|
__metadata("design:type", Array)
|
|
@@ -11,6 +11,15 @@ test('can make User', function () {
|
|
|
11
11
|
var user = new merchi.User();
|
|
12
12
|
expect(user).toBeTruthy();
|
|
13
13
|
});
|
|
14
|
+
test('can set assignedCategories', function () {
|
|
15
|
+
var _a;
|
|
16
|
+
var merchi = new Merchi();
|
|
17
|
+
var user = new merchi.User();
|
|
18
|
+
var category = new merchi.Category();
|
|
19
|
+
category.id = 3;
|
|
20
|
+
user.assignedCategories = [category];
|
|
21
|
+
expect((_a = user.assignedCategories) === null || _a === void 0 ? void 0 : _a.map(function (item) { return item.id; })).toEqual([3]);
|
|
22
|
+
});
|
|
14
23
|
test('can issue public create request to server', function () {
|
|
15
24
|
var merchi = new Merchi();
|
|
16
25
|
var user = new merchi.User();
|
package/package.json
CHANGED
|
@@ -38,6 +38,19 @@ test('can get and set product', () => {
|
|
|
38
38
|
expect(p1.categories).toBe(undefined);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
test('can set tags and assigned team members', () => {
|
|
42
|
+
const merchi = new Merchi();
|
|
43
|
+
const category = new merchi.Category();
|
|
44
|
+
const tag = new merchi.DomainTag();
|
|
45
|
+
const user = new merchi.User();
|
|
46
|
+
tag.id = 4;
|
|
47
|
+
user.id = 9;
|
|
48
|
+
category.tags = [tag];
|
|
49
|
+
category.assigned = [user];
|
|
50
|
+
expect(category.tags?.map((item) => item.id)).toEqual([4]);
|
|
51
|
+
expect(category.assigned?.map((item) => item.id)).toEqual([9]);
|
|
52
|
+
});
|
|
53
|
+
|
|
41
54
|
test('independence of entities', () => {
|
|
42
55
|
const merchi = new Merchi();
|
|
43
56
|
const c1 = new merchi.Category();
|
package/src/entities/category.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Domain } from './domain.js';
|
|
2
|
+
import { DomainTag } from './domain_tag.js';
|
|
2
3
|
import { Entity } from '../entity.js';
|
|
3
4
|
import { MerchiFile } from './file.js';
|
|
4
5
|
import { Product } from './product.js';
|
|
@@ -48,6 +49,12 @@ export class Category extends Entity {
|
|
|
48
49
|
@Category.property({arrayType: 'User'})
|
|
49
50
|
public users?: User[];
|
|
50
51
|
|
|
52
|
+
@Category.property({arrayType: 'DomainTag'})
|
|
53
|
+
public tags?: DomainTag[];
|
|
54
|
+
|
|
55
|
+
@Category.property({arrayType: 'User'})
|
|
56
|
+
public assigned?: User[];
|
|
57
|
+
|
|
51
58
|
@Category.property({arrayType: 'Category'})
|
|
52
59
|
public subcategories?: Category[];
|
|
53
60
|
|
|
@@ -5,3 +5,12 @@ test('can make DomainTag', () => {
|
|
|
5
5
|
const domainTag = new merchi.DomainTag();
|
|
6
6
|
expect(domainTag).toBeTruthy();
|
|
7
7
|
});
|
|
8
|
+
|
|
9
|
+
test('can set categories', () => {
|
|
10
|
+
const merchi = new Merchi();
|
|
11
|
+
const domainTag = new merchi.DomainTag();
|
|
12
|
+
const category = new merchi.Category();
|
|
13
|
+
category.id = 3;
|
|
14
|
+
domainTag.categories = [category];
|
|
15
|
+
expect(domainTag.categories?.map((item) => item.id)).toEqual([3]);
|
|
16
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Category } from './category.js';
|
|
1
2
|
import { Domain } from './domain.js';
|
|
2
3
|
import { Entity } from '../entity.js';
|
|
3
4
|
import { Invoice } from './invoice.js';
|
|
@@ -39,4 +40,7 @@ export class DomainTag extends Entity {
|
|
|
39
40
|
|
|
40
41
|
@DomainTag.property({arrayType: 'Shipment'})
|
|
41
42
|
public shipments?: Shipment[];
|
|
43
|
+
|
|
44
|
+
@DomainTag.property({arrayType: 'Category'})
|
|
45
|
+
public categories?: Category[];
|
|
42
46
|
}
|
|
@@ -15,6 +15,15 @@ test('can make User', () => {
|
|
|
15
15
|
expect(user).toBeTruthy();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
test('can set assignedCategories', () => {
|
|
19
|
+
const merchi = new Merchi();
|
|
20
|
+
const user = new merchi.User();
|
|
21
|
+
const category = new merchi.Category();
|
|
22
|
+
category.id = 3;
|
|
23
|
+
user.assignedCategories = [category];
|
|
24
|
+
expect(user.assignedCategories?.map((item) => item.id)).toEqual([3]);
|
|
25
|
+
});
|
|
26
|
+
|
|
18
27
|
test('can issue public create request to server', () => {
|
|
19
28
|
const merchi = new Merchi();
|
|
20
29
|
const user = new merchi.User();
|
package/src/entities/user.ts
CHANGED
|
@@ -204,6 +204,9 @@ export class User extends Entity {
|
|
|
204
204
|
@User.property({ arrayType: 'Category' })
|
|
205
205
|
public categories?: Category[];
|
|
206
206
|
|
|
207
|
+
@User.property({ arrayType: 'Category' })
|
|
208
|
+
public assignedCategories?: Category[];
|
|
209
|
+
|
|
207
210
|
@User.property({ arrayType: 'Product' })
|
|
208
211
|
public products?: Product[];
|
|
209
212
|
|