@onehat/data 1.20.8 → 1.21.0
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/cypress/downloads/downloads.html +0 -0
- package/cypress/e2e/Entity.cy.js +2 -2
- package/cypress/e2e/Property/Base64.cy.js +37 -3
- package/cypress/e2e/Property/Boolean.cy.js +30 -0
- package/cypress/e2e/Property/Currency.cy.js +41 -0
- package/cypress/e2e/Property/Date.cy.js +33 -0
- package/cypress/e2e/Property/DateTime.cy.js +33 -0
- package/cypress/e2e/Property/Float.cy.js +31 -0
- package/cypress/e2e/Property/Integer.cy.js +31 -0
- package/cypress/e2e/Property/Json.cy.js +29 -0
- package/cypress/e2e/Property/PercentInt.cy.js +32 -0
- package/cypress/e2e/Property/Property.cy.js +29 -0
- package/cypress/e2e/Property/Time.cy.js +33 -0
- package/cypress/e2e/Repository/Repository.cy.js +25 -18
- package/cypress/e2e/Schema.cy.js +2 -2
- package/package.json +1 -1
- package/src/Integration/Browser/Repository/Cookie.js +4 -4
- package/src/Integration/Browser/Repository/IndexedDB.js +4 -4
- package/src/Integration/Browser/Repository/LocalStorage.js +4 -4
- package/src/Integration/Browser/Repository/SecureLocalStorage.js +2 -2
- package/src/Integration/Browser/Repository/SecureSessionStorage.js +2 -2
- package/src/Integration/Browser/Repository/SessionStorage.js +4 -4
- package/src/Integration/ReactNative/Repository/AsyncStorage.js +8 -8
- package/src/Integration/ReactNative/Repository/SecureStore.js +4 -4
- package/src/Property/Base64.js +21 -11
- package/src/Property/Boolean.js +20 -12
- package/src/Property/Currency.js +30 -21
- package/src/Property/Date.js +23 -14
- package/src/Property/DateTime.js +18 -9
- package/src/Property/File.js +0 -4
- package/src/Property/Float.js +19 -10
- package/src/Property/Integer.js +19 -10
- package/src/Property/Json.js +22 -13
- package/src/Property/Percent.js +2 -2
- package/src/Property/PercentInt.js +16 -7
- package/src/Property/Property.js +150 -140
- package/src/Property/String.js +2 -7
- package/src/Property/Time.js +17 -8
- package/src/Property/Uuid.js +3 -8
- package/src/Property/index.js +2 -0
- package/src/Repository/Ajax.js +35 -30
- package/src/Repository/LocalFromRemote/Command.js +5 -5
- package/src/Repository/LocalFromRemote/CommandRepository.js +1 -1
- package/src/Repository/LocalFromRemote/LocalFromRemote.js +18 -17
- package/src/Repository/Memory.js +22 -21
- package/src/Repository/Null.js +5 -5
- package/src/Repository/Offline.js +17 -16
- package/src/Repository/OneBuild.js +37 -31
- package/src/Repository/OneBuild2.js +19 -13
- package/src/Repository/Repository.js +106 -103
- package/src/Schema/Schema.js +9 -6
|
Binary file
|
package/cypress/e2e/Entity.cy.js
CHANGED
|
@@ -471,11 +471,11 @@ describe('Entity', function() {
|
|
|
471
471
|
});
|
|
472
472
|
|
|
473
473
|
it('hash', function() {
|
|
474
|
-
expect(this.entity.hash).to.be.eq(
|
|
474
|
+
expect(this.entity.hash).to.be.eq('40aa53cc3f0cffef350ce784537eebeacf270b45');
|
|
475
475
|
|
|
476
476
|
// change a property & check again
|
|
477
477
|
this.entity.foo = 3;
|
|
478
|
-
expect(this.entity.hash).to.be.eq(
|
|
478
|
+
expect(this.entity.hash).to.be.eq('6b8d327b573da8133ec2ff39acc9e15efd152afb');
|
|
479
479
|
});
|
|
480
480
|
|
|
481
481
|
});
|
|
@@ -10,11 +10,45 @@ describe('Base64Property', function() {
|
|
|
10
10
|
this.property = new Property(definition);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
describe('class', function() {
|
|
14
|
+
|
|
15
|
+
it('className', function() {
|
|
16
|
+
const className = this.property.getClassName();
|
|
17
|
+
expect(className).to.be.eq('Base64');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('getStaticDefaults', function() {
|
|
21
|
+
const
|
|
22
|
+
PropertyType = PropertyTypes['base64'],
|
|
23
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
24
|
+
expected = {
|
|
25
|
+
allowNull: true,
|
|
26
|
+
defaultValue: null,
|
|
27
|
+
depends: null,
|
|
28
|
+
editorType: null,
|
|
29
|
+
fieldGroup: null,
|
|
30
|
+
filterType: null,
|
|
31
|
+
isEditingDisabled: false,
|
|
32
|
+
isFilteringDisabled: false,
|
|
33
|
+
isForeignModel: false,
|
|
34
|
+
isSortable: false, // mod
|
|
35
|
+
isTempId: false,
|
|
36
|
+
isVirtual: false,
|
|
37
|
+
mapping: null,
|
|
38
|
+
name: null,
|
|
39
|
+
submitAsString: false,
|
|
40
|
+
title: null,
|
|
41
|
+
tooltip: null,
|
|
42
|
+
viewerType: null,
|
|
43
|
+
};
|
|
44
|
+
// console.log(defaults);
|
|
45
|
+
// console.log(expected);
|
|
46
|
+
expect(defaults).to.be.eql(expected);
|
|
47
|
+
});
|
|
48
|
+
|
|
16
49
|
});
|
|
17
50
|
|
|
51
|
+
|
|
18
52
|
describe('custom functions', function() {
|
|
19
53
|
|
|
20
54
|
it('encode', function() {
|
|
@@ -17,6 +17,36 @@ describe('BooleanProperty', function() {
|
|
|
17
17
|
expect(className).to.be.eq('Boolean');
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it('getStaticDefaults', function() {
|
|
21
|
+
const
|
|
22
|
+
PropertyType = PropertyTypes['bool'],
|
|
23
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
24
|
+
expected = {
|
|
25
|
+
allowNull: true,
|
|
26
|
+
defaultValue: false, // mod
|
|
27
|
+
depends: null,
|
|
28
|
+
editorType: null,
|
|
29
|
+
fieldGroup: null,
|
|
30
|
+
filterType: null,
|
|
31
|
+
isEditingDisabled: false,
|
|
32
|
+
isFilteringDisabled: false,
|
|
33
|
+
isForeignModel: false,
|
|
34
|
+
isSortable: true,
|
|
35
|
+
isTempId: false,
|
|
36
|
+
isVirtual: false,
|
|
37
|
+
mapping: null,
|
|
38
|
+
name: null,
|
|
39
|
+
submitAsString: false,
|
|
40
|
+
submitAsInt: false, // new
|
|
41
|
+
title: null,
|
|
42
|
+
tooltip: null,
|
|
43
|
+
viewerType: null,
|
|
44
|
+
};
|
|
45
|
+
// console.log(defaults);
|
|
46
|
+
// console.log(expected);
|
|
47
|
+
expect(defaults).to.be.eql(expected);
|
|
48
|
+
});
|
|
49
|
+
|
|
20
50
|
it('default value', function() {
|
|
21
51
|
const property = this.property,
|
|
22
52
|
rawValue = property.getDefaultValue();
|
|
@@ -17,6 +17,47 @@ describe('CurrencyProperty', function() {
|
|
|
17
17
|
expect(className).to.be.eq('Currency');
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it('getStaticDefaults', function() {
|
|
21
|
+
const
|
|
22
|
+
PropertyType = PropertyTypes['currency'],
|
|
23
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
24
|
+
expected = {
|
|
25
|
+
allowNull: true,
|
|
26
|
+
defaultValue: 0.00, // mod
|
|
27
|
+
depends: null,
|
|
28
|
+
editorType: null,
|
|
29
|
+
fieldGroup: null,
|
|
30
|
+
filterType: null,
|
|
31
|
+
isEditingDisabled: false,
|
|
32
|
+
isFilteringDisabled: false,
|
|
33
|
+
isForeignModel: false,
|
|
34
|
+
isSortable: true,
|
|
35
|
+
isTempId: false,
|
|
36
|
+
isVirtual: false,
|
|
37
|
+
mapping: null,
|
|
38
|
+
name: null,
|
|
39
|
+
submitAsString: true, // mod
|
|
40
|
+
title: null,
|
|
41
|
+
tooltip: null,
|
|
42
|
+
viewerType: null,
|
|
43
|
+
|
|
44
|
+
displayOptions: {
|
|
45
|
+
symbol: "$",
|
|
46
|
+
format: '%s%v',
|
|
47
|
+
decimal: '.' ,
|
|
48
|
+
thousand: ',',
|
|
49
|
+
precision: 2,
|
|
50
|
+
grouping: 3,
|
|
51
|
+
stripZeros: false,
|
|
52
|
+
fallback: 0,
|
|
53
|
+
},
|
|
54
|
+
omitZeros: false, // new
|
|
55
|
+
};
|
|
56
|
+
// console.log(defaults);
|
|
57
|
+
// console.log(expected);
|
|
58
|
+
expect(defaults).to.be.eql(expected);
|
|
59
|
+
});
|
|
60
|
+
|
|
20
61
|
it('default value', function() {
|
|
21
62
|
expect(this.property.submitValue).to.be.eq('0.00');
|
|
22
63
|
|
|
@@ -15,6 +15,39 @@ describe('DateProperty', function() {
|
|
|
15
15
|
expect(className).to.be.eq('Date');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
it('getStaticDefaults', function() {
|
|
19
|
+
const
|
|
20
|
+
PropertyType = PropertyTypes['date'],
|
|
21
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
22
|
+
expected = {
|
|
23
|
+
allowNull: true,
|
|
24
|
+
defaultValue: null,
|
|
25
|
+
depends: null,
|
|
26
|
+
editorType: null,
|
|
27
|
+
fieldGroup: null,
|
|
28
|
+
filterType: null,
|
|
29
|
+
isEditingDisabled: false,
|
|
30
|
+
isFilteringDisabled: false,
|
|
31
|
+
isForeignModel: false,
|
|
32
|
+
isSortable: true,
|
|
33
|
+
isTempId: false,
|
|
34
|
+
isVirtual: false,
|
|
35
|
+
mapping: null,
|
|
36
|
+
name: null,
|
|
37
|
+
submitAsString: false,
|
|
38
|
+
title: null,
|
|
39
|
+
tooltip: null,
|
|
40
|
+
viewerType: null,
|
|
41
|
+
|
|
42
|
+
readFormat: 'YYYY-MM-DD', // new
|
|
43
|
+
displayFormat: 'MMM DD, YYYY', // new
|
|
44
|
+
submitFormat: 'YYYY-MM-DD', // new
|
|
45
|
+
};
|
|
46
|
+
// console.log(defaults);
|
|
47
|
+
// console.log(expected);
|
|
48
|
+
expect(defaults).to.be.eql(expected);
|
|
49
|
+
});
|
|
50
|
+
|
|
18
51
|
it('overrides displayFormat', function() {
|
|
19
52
|
const definition = {
|
|
20
53
|
type: 'date',
|
|
@@ -15,6 +15,39 @@ describe('DateTimeProperty', function() {
|
|
|
15
15
|
expect(className).to.be.eq('DateTime');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
it('getStaticDefaults', function() {
|
|
19
|
+
const
|
|
20
|
+
PropertyType = PropertyTypes['datetime'],
|
|
21
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
22
|
+
expected = {
|
|
23
|
+
allowNull: true,
|
|
24
|
+
defaultValue: null,
|
|
25
|
+
depends: null,
|
|
26
|
+
editorType: null,
|
|
27
|
+
fieldGroup: null,
|
|
28
|
+
filterType: null,
|
|
29
|
+
isEditingDisabled: false,
|
|
30
|
+
isFilteringDisabled: false,
|
|
31
|
+
isForeignModel: false,
|
|
32
|
+
isSortable: true,
|
|
33
|
+
isTempId: false,
|
|
34
|
+
isVirtual: false,
|
|
35
|
+
mapping: null,
|
|
36
|
+
name: null,
|
|
37
|
+
submitAsString: false,
|
|
38
|
+
title: null,
|
|
39
|
+
tooltip: null,
|
|
40
|
+
viewerType: null,
|
|
41
|
+
|
|
42
|
+
readFormat: 'YYYY-MM-DDTHH:mm:ss', // new
|
|
43
|
+
displayFormat: 'MMM DD, YYYY - HH:mm:ss', // new
|
|
44
|
+
submitFormat: 'YYYY-MM-DD HH:mm:ss', // new
|
|
45
|
+
};
|
|
46
|
+
// console.log(defaults);
|
|
47
|
+
// console.log(expected);
|
|
48
|
+
expect(defaults).to.be.eql(expected);
|
|
49
|
+
});
|
|
50
|
+
|
|
18
51
|
describe('parse', function() {
|
|
19
52
|
|
|
20
53
|
it('parse YYYY-MM-DD', function() {
|
|
@@ -18,6 +18,37 @@ describe('FloatProperty', function() {
|
|
|
18
18
|
expect(className).to.be.eq('Float');
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
it('getStaticDefaults', function() {
|
|
22
|
+
const
|
|
23
|
+
PropertyType = PropertyTypes['float'],
|
|
24
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
25
|
+
expected = {
|
|
26
|
+
allowNull: true,
|
|
27
|
+
defaultValue: null,
|
|
28
|
+
depends: null,
|
|
29
|
+
editorType: null,
|
|
30
|
+
fieldGroup: null,
|
|
31
|
+
filterType: null,
|
|
32
|
+
isEditingDisabled: false,
|
|
33
|
+
isFilteringDisabled: false,
|
|
34
|
+
isForeignModel: false,
|
|
35
|
+
isSortable: true,
|
|
36
|
+
isTempId: false,
|
|
37
|
+
isVirtual: false,
|
|
38
|
+
mapping: null,
|
|
39
|
+
name: null,
|
|
40
|
+
submitAsString: false,
|
|
41
|
+
title: null,
|
|
42
|
+
tooltip: null,
|
|
43
|
+
viewerType: null,
|
|
44
|
+
|
|
45
|
+
precision: 2, // new
|
|
46
|
+
};
|
|
47
|
+
// console.log(defaults);
|
|
48
|
+
// console.log(expected);
|
|
49
|
+
expect(defaults).to.be.eql(expected);
|
|
50
|
+
});
|
|
51
|
+
|
|
21
52
|
// it('default value', function() {
|
|
22
53
|
// const property = this.property,
|
|
23
54
|
// rawValue = property.getDefaultValue();
|
|
@@ -19,6 +19,37 @@ describe('IntegerProperty', function() {
|
|
|
19
19
|
expect(className).to.be.eq('Integer');
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
it('getStaticDefaults', function() {
|
|
23
|
+
const
|
|
24
|
+
PropertyType = PropertyTypes['int'],
|
|
25
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
26
|
+
expected = {
|
|
27
|
+
allowNull: true,
|
|
28
|
+
defaultValue: null,
|
|
29
|
+
depends: null,
|
|
30
|
+
editorType: null,
|
|
31
|
+
fieldGroup: null,
|
|
32
|
+
filterType: null,
|
|
33
|
+
isEditingDisabled: false,
|
|
34
|
+
isFilteringDisabled: false,
|
|
35
|
+
isForeignModel: false,
|
|
36
|
+
isSortable: true,
|
|
37
|
+
isTempId: false,
|
|
38
|
+
isVirtual: false,
|
|
39
|
+
mapping: null,
|
|
40
|
+
name: null,
|
|
41
|
+
submitAsString: false,
|
|
42
|
+
title: null,
|
|
43
|
+
tooltip: null,
|
|
44
|
+
viewerType: null,
|
|
45
|
+
|
|
46
|
+
idStartsAt: 100 * 1000 * 1000 * 1000, // new
|
|
47
|
+
};
|
|
48
|
+
// console.log(defaults);
|
|
49
|
+
// console.log(expected);
|
|
50
|
+
expect(defaults).to.be.eql(expected);
|
|
51
|
+
});
|
|
52
|
+
|
|
22
53
|
it('newId', function() {
|
|
23
54
|
const id1 = this.property.newId();
|
|
24
55
|
expect(id1.valueOf()).to.be.eq(this.property.idStartsAt);
|
|
@@ -16,6 +16,35 @@ describe('JsonProperty', function() {
|
|
|
16
16
|
expect(className).to.be.eq('Json');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
it('getStaticDefaults', function() {
|
|
20
|
+
const
|
|
21
|
+
PropertyType = PropertyTypes['json'],
|
|
22
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
23
|
+
expected = {
|
|
24
|
+
allowNull: true,
|
|
25
|
+
defaultValue: null,
|
|
26
|
+
depends: null,
|
|
27
|
+
editorType: null,
|
|
28
|
+
fieldGroup: null,
|
|
29
|
+
filterType: null,
|
|
30
|
+
isEditingDisabled: false,
|
|
31
|
+
isFilteringDisabled: false,
|
|
32
|
+
isForeignModel: false,
|
|
33
|
+
isSortable: false, // mod
|
|
34
|
+
isTempId: false,
|
|
35
|
+
isVirtual: false,
|
|
36
|
+
mapping: null,
|
|
37
|
+
name: null,
|
|
38
|
+
submitAsString: true, // mod
|
|
39
|
+
title: null,
|
|
40
|
+
tooltip: null,
|
|
41
|
+
viewerType: null,
|
|
42
|
+
};
|
|
43
|
+
// console.log(defaults);
|
|
44
|
+
// console.log(expected);
|
|
45
|
+
expect(defaults).to.be.eql(expected);
|
|
46
|
+
});
|
|
47
|
+
|
|
19
48
|
describe('parse', function() {
|
|
20
49
|
|
|
21
50
|
it('good json data', function() {
|
|
@@ -16,6 +16,38 @@ describe('PercentProperty', function() {
|
|
|
16
16
|
expect(className).to.be.eq('PercentInt');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
it('getStaticDefaults', function() {
|
|
20
|
+
const
|
|
21
|
+
PropertyType = PropertyTypes['percentint'],
|
|
22
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
23
|
+
expected = {
|
|
24
|
+
allowNull: true,
|
|
25
|
+
defaultValue: null,
|
|
26
|
+
depends: null,
|
|
27
|
+
editorType: null,
|
|
28
|
+
fieldGroup: null,
|
|
29
|
+
filterType: null,
|
|
30
|
+
isEditingDisabled: false,
|
|
31
|
+
isFilteringDisabled: false,
|
|
32
|
+
isForeignModel: false,
|
|
33
|
+
isSortable: true,
|
|
34
|
+
isTempId: false,
|
|
35
|
+
isVirtual: false,
|
|
36
|
+
mapping: null,
|
|
37
|
+
name: null,
|
|
38
|
+
submitAsString: false,
|
|
39
|
+
title: null,
|
|
40
|
+
tooltip: null,
|
|
41
|
+
viewerType: null,
|
|
42
|
+
|
|
43
|
+
precision: 2, // from Float superclass
|
|
44
|
+
omitZeros: false, // new
|
|
45
|
+
};
|
|
46
|
+
// console.log(defaults);
|
|
47
|
+
// console.log(expected);
|
|
48
|
+
expect(defaults).to.be.eql(expected);
|
|
49
|
+
});
|
|
50
|
+
|
|
19
51
|
it('format', function() {
|
|
20
52
|
this.property.setValue('12.325');
|
|
21
53
|
expect(this.property.displayValue).to.be.eq('12.325%');
|
|
@@ -21,6 +21,35 @@ describe('Property', function() {
|
|
|
21
21
|
expect(this.property.getClassName()).to.be.eq('Integer');
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
it('getStaticDefaults', function() {
|
|
25
|
+
const
|
|
26
|
+
PropertyType = PropertyTypes['auto'],
|
|
27
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
28
|
+
expected = {
|
|
29
|
+
allowNull: true,
|
|
30
|
+
defaultValue: null,
|
|
31
|
+
depends: null,
|
|
32
|
+
editorType: null,
|
|
33
|
+
fieldGroup: null,
|
|
34
|
+
filterType: null,
|
|
35
|
+
isEditingDisabled: false,
|
|
36
|
+
isFilteringDisabled: false,
|
|
37
|
+
isForeignModel: false,
|
|
38
|
+
isSortable: true,
|
|
39
|
+
isTempId: false,
|
|
40
|
+
isVirtual: false,
|
|
41
|
+
mapping: null,
|
|
42
|
+
name: null,
|
|
43
|
+
submitAsString: false,
|
|
44
|
+
title: null,
|
|
45
|
+
tooltip: null,
|
|
46
|
+
viewerType: null,
|
|
47
|
+
};
|
|
48
|
+
// console.log(defaults);
|
|
49
|
+
// console.log(expected);
|
|
50
|
+
expect(defaults).to.be.eql(expected);
|
|
51
|
+
});
|
|
52
|
+
|
|
24
53
|
});
|
|
25
54
|
|
|
26
55
|
describe('getters', function() {
|
|
@@ -15,6 +15,39 @@ describe('TimeProperty', function() {
|
|
|
15
15
|
expect(className).to.be.eq('Time');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
it('getStaticDefaults', function() {
|
|
19
|
+
const
|
|
20
|
+
PropertyType = PropertyTypes['time'],
|
|
21
|
+
defaults = PropertyType.getStaticDefaults(),
|
|
22
|
+
expected = {
|
|
23
|
+
allowNull: true,
|
|
24
|
+
defaultValue: null,
|
|
25
|
+
depends: null,
|
|
26
|
+
editorType: null,
|
|
27
|
+
fieldGroup: null,
|
|
28
|
+
filterType: null,
|
|
29
|
+
isEditingDisabled: false,
|
|
30
|
+
isFilteringDisabled: false,
|
|
31
|
+
isForeignModel: false,
|
|
32
|
+
isSortable: true,
|
|
33
|
+
isTempId: false,
|
|
34
|
+
isVirtual: false,
|
|
35
|
+
mapping: null,
|
|
36
|
+
name: null,
|
|
37
|
+
submitAsString: false,
|
|
38
|
+
title: null,
|
|
39
|
+
tooltip: null,
|
|
40
|
+
viewerType: null,
|
|
41
|
+
|
|
42
|
+
readFormat: 'HH:mm:ss', // new
|
|
43
|
+
displayFormat: 'HH:mm:ss', // new
|
|
44
|
+
submitFormat: 'HH:mm:ss', // new
|
|
45
|
+
};
|
|
46
|
+
// console.log(defaults);
|
|
47
|
+
// console.log(expected);
|
|
48
|
+
expect(defaults).to.be.eql(expected);
|
|
49
|
+
});
|
|
50
|
+
|
|
18
51
|
describe('parse', function() {
|
|
19
52
|
|
|
20
53
|
it('parse HH:mm:ss', function() {
|
|
@@ -232,25 +232,32 @@ describe('Repository Base', function() {
|
|
|
232
232
|
});
|
|
233
233
|
|
|
234
234
|
it('sort by non-existant field', function() {
|
|
235
|
-
let
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
235
|
+
let failed = false,
|
|
236
|
+
message;
|
|
237
|
+
|
|
238
|
+
this.repository.on('error', (msg) => {
|
|
239
|
+
failed = true;
|
|
240
|
+
message = msg;
|
|
241
|
+
});
|
|
242
|
+
this.repository.sort('foo');
|
|
243
|
+
|
|
244
|
+
expect(failed).to.be.true;
|
|
245
|
+
expect(message).to.be.match(/Sorting property does not exist/);
|
|
243
246
|
});
|
|
244
247
|
|
|
245
248
|
it('sort by non-sortable field', function() {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
|
|
250
|
+
let failed = false,
|
|
251
|
+
message;
|
|
252
|
+
|
|
253
|
+
this.repository.on('error', (msg) => {
|
|
254
|
+
failed = true;
|
|
255
|
+
message = msg;
|
|
256
|
+
});
|
|
257
|
+
this.repository.sort('json');
|
|
258
|
+
|
|
259
|
+
expect(failed).to.be.true;
|
|
260
|
+
expect(message).to.be.match(/Sorting property type is not sortable/);
|
|
254
261
|
});
|
|
255
262
|
|
|
256
263
|
it('getSortField', function() {
|
|
@@ -1302,7 +1309,7 @@ describe('Repository Base', function() {
|
|
|
1302
1309
|
})();
|
|
1303
1310
|
});
|
|
1304
1311
|
|
|
1305
|
-
it('
|
|
1312
|
+
it('loadRootNodes', function() {
|
|
1306
1313
|
(async () => {
|
|
1307
1314
|
const repository = await creatRepository();
|
|
1308
1315
|
repository.assembleTreeNodes();
|
|
@@ -1310,7 +1317,7 @@ describe('Repository Base', function() {
|
|
|
1310
1317
|
const
|
|
1311
1318
|
id1 = repository.getById(1);
|
|
1312
1319
|
|
|
1313
|
-
const rootNodes = repository.
|
|
1320
|
+
const rootNodes = repository.loadRootNodes();
|
|
1314
1321
|
expect(rootNodes).to.be.eql([id1]);
|
|
1315
1322
|
|
|
1316
1323
|
destoryRepository(repository);
|
package/cypress/e2e/Schema.cy.js
CHANGED
|
@@ -52,8 +52,8 @@ describe('Schema', function() {
|
|
|
52
52
|
users__last_login: null,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
console.log('defaultValues', defaultValues);
|
|
56
|
-
console.log('expectedDefaultValues', expectedDefaultValues);
|
|
55
|
+
// console.log('defaultValues', defaultValues);
|
|
56
|
+
// console.log('expectedDefaultValues', expectedDefaultValues);
|
|
57
57
|
|
|
58
58
|
expect(defaultValues).to.be.eql(expectedDefaultValues);
|
|
59
59
|
});
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ class CookieRepository extends OfflineRepository {
|
|
|
18
18
|
_.merge(this, config);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
_storageGetValue
|
|
21
|
+
_storageGetValue(name) {
|
|
22
22
|
try {
|
|
23
23
|
|
|
24
24
|
if (this.debugMode) {
|
|
@@ -69,7 +69,7 @@ class CookieRepository extends OfflineRepository {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
_storageSetValue
|
|
72
|
+
_storageSetValue(name, value) {
|
|
73
73
|
try {
|
|
74
74
|
if (!_.isString(value)) {
|
|
75
75
|
value = JSON.stringify(value);
|
|
@@ -121,7 +121,7 @@ class CookieRepository extends OfflineRepository {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
_storageDeleteValue
|
|
124
|
+
_storageDeleteValue(name) {
|
|
125
125
|
try {
|
|
126
126
|
if (this.debugMode) {
|
|
127
127
|
console.log(this.name, 'Cookie.delete', name);
|
|
@@ -157,7 +157,7 @@ class CookieRepository extends OfflineRepository {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
async clearAll() {
|
|
161
161
|
await this.load([]);
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -18,7 +18,7 @@ class IndexedDBRepository extends OfflineRepository {
|
|
|
18
18
|
_.merge(this, config);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
_storageGetValue
|
|
21
|
+
_storageGetValue(name) {
|
|
22
22
|
const result = store.getItem(this._namespace(name));
|
|
23
23
|
let value;
|
|
24
24
|
try {
|
|
@@ -30,18 +30,18 @@ class IndexedDBRepository extends OfflineRepository {
|
|
|
30
30
|
return value;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
_storageSetValue
|
|
33
|
+
_storageSetValue(name, value) {
|
|
34
34
|
if (!_.isString(value)) {
|
|
35
35
|
value = JSON.stringify(value);
|
|
36
36
|
}
|
|
37
37
|
return store.setItem(this._namespace(name), value);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
_storageDeleteValue
|
|
40
|
+
_storageDeleteValue(name) {
|
|
41
41
|
return store.removeItem(this._namespace(name));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
async _clearAll() {
|
|
45
45
|
store.clear();
|
|
46
46
|
this._keyedEntities = {};
|
|
47
47
|
this.reload();
|
|
@@ -22,7 +22,7 @@ class LocalStorageRepository extends OfflineRepository {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
_storageGetValue
|
|
25
|
+
_storageGetValue(name){
|
|
26
26
|
try {
|
|
27
27
|
|
|
28
28
|
if (this.debugMode) {
|
|
@@ -53,7 +53,7 @@ class LocalStorageRepository extends OfflineRepository {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
_storageSetValue
|
|
56
|
+
_storageSetValue(name, value) {
|
|
57
57
|
try {
|
|
58
58
|
if (this.debugMode) {
|
|
59
59
|
console.log(this.name, 'LocalStorage.set', name, value);
|
|
@@ -72,7 +72,7 @@ class LocalStorageRepository extends OfflineRepository {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
_storageDeleteValue
|
|
75
|
+
_storageDeleteValue(name) {
|
|
76
76
|
try {
|
|
77
77
|
if (_.isNil(name) || (_.isString(name) && name === '')) {
|
|
78
78
|
return;
|
|
@@ -92,7 +92,7 @@ class LocalStorageRepository extends OfflineRepository {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
clearAll
|
|
95
|
+
clearAll() {
|
|
96
96
|
return this._store.clearAll();
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -22,7 +22,7 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
|
|
|
22
22
|
this.passphrase = config.passphrase;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
_storageGetValue
|
|
25
|
+
_storageGetValue(name) {
|
|
26
26
|
try {
|
|
27
27
|
|
|
28
28
|
if (this.debugMode) {
|
|
@@ -58,7 +58,7 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
_storageSetValue
|
|
61
|
+
_storageSetValue(name, value) {
|
|
62
62
|
try {
|
|
63
63
|
if (this.debugMode) {
|
|
64
64
|
console.log(this.name, 'LocalStorage.set', name, value);
|
|
@@ -22,7 +22,7 @@ class SecureSessionStorageRepository extends SessionStorageRepository {
|
|
|
22
22
|
this.passphrase = config.passphrase;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
_storageGetValue
|
|
25
|
+
_storageGetValue(name) {
|
|
26
26
|
|
|
27
27
|
// BEGIN MOD
|
|
28
28
|
let result = this._store.session(name);
|
|
@@ -41,7 +41,7 @@ class SecureSessionStorageRepository extends SessionStorageRepository {
|
|
|
41
41
|
return value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
_storageSetValue
|
|
44
|
+
_storageSetValue(name, value) {
|
|
45
45
|
if (!_.isString(value)) {
|
|
46
46
|
value = JSON.stringify(value);
|
|
47
47
|
}
|