@ndustrial/contxt-sdk 5.7.4 → 5.8.1
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/.nvmrc +1 -1
- package/esm/bus/channels.js +0 -1
- package/esm/bus/channels.js.map +1 -1
- package/esm/bus/index.js +0 -1
- package/esm/bus/index.js.map +1 -1
- package/esm/bus/webSocketConnection.js +403 -405
- package/esm/bus/webSocketConnection.js.map +1 -1
- package/esm/config/index.js +27 -27
- package/esm/config/index.js.map +1 -1
- package/esm/coordinator/applications.js +0 -2
- package/esm/coordinator/applications.js.map +1 -1
- package/esm/coordinator/consent.js +0 -1
- package/esm/coordinator/consent.js.map +1 -1
- package/esm/coordinator/edgeNodes.js +0 -1
- package/esm/coordinator/edgeNodes.js.map +1 -1
- package/esm/coordinator/organizations.js +0 -2
- package/esm/coordinator/organizations.js.map +1 -1
- package/esm/coordinator/permissions.js +0 -1
- package/esm/coordinator/permissions.js.map +1 -1
- package/esm/coordinator/roles.js +0 -3
- package/esm/coordinator/roles.js.map +1 -1
- package/esm/coordinator/users.js +0 -2
- package/esm/coordinator/users.js.map +1 -1
- package/esm/events/index.js +0 -1
- package/esm/events/index.js.map +1 -1
- package/esm/files/index.js +20 -31
- package/esm/files/index.js.map +1 -1
- package/esm/index.js +7 -8
- package/esm/index.js.map +1 -1
- package/esm/iot/feeds.js +0 -1
- package/esm/iot/feeds.js.map +1 -1
- package/esm/iot/fieldCategories.js +0 -1
- package/esm/iot/fieldCategories.js.map +1 -1
- package/esm/iot/fieldGroupings.js +0 -1
- package/esm/iot/fieldGroupings.js.map +1 -1
- package/esm/iot/fields.js +0 -1
- package/esm/iot/fields.js.map +1 -1
- package/esm/iot/outputs.js +0 -1
- package/esm/iot/outputs.js.map +1 -1
- package/esm/nionic/index.js +12 -15
- package/esm/nionic/index.js.map +1 -1
- package/esm/request.js +8 -9
- package/esm/request.js.map +1 -1
- package/esm/sessionTypes/auth0WebAuth.js +10 -19
- package/esm/sessionTypes/auth0WebAuth.js.map +1 -1
- package/esm/sessionTypes/index.js +0 -1
- package/esm/sessionTypes/index.js.map +1 -1
- package/esm/sessionTypes/machineAuth.js +7 -16
- package/esm/sessionTypes/machineAuth.js.map +1 -1
- package/esm/sessionTypes/passwordGrantAuth.js +3 -6
- package/esm/sessionTypes/passwordGrantAuth.js.map +1 -1
- package/esm/utils/iot/formatOutputFieldDataFromServer.js +6 -13
- package/esm/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
- package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js +0 -2
- package/esm/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
- package/esm/utils/objects/createCaseChangeFn.js +4 -14
- package/esm/utils/objects/createCaseChangeFn.js.map +1 -1
- package/esm/utils/objects/map.js +5 -29
- package/esm/utils/objects/map.js.map +1 -1
- package/esm/utils/pagination/formatPaginatedDataFromServer.js +0 -1
- package/esm/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
- package/esm/utils/url/index.js +2 -2
- package/lib/bus/channels.js +0 -1
- package/lib/bus/channels.js.map +1 -1
- package/lib/bus/index.js +0 -1
- package/lib/bus/index.js.map +1 -1
- package/lib/bus/webSocketConnection.js +403 -405
- package/lib/bus/webSocketConnection.js.map +1 -1
- package/lib/config/index.js +27 -27
- package/lib/config/index.js.map +1 -1
- package/lib/coordinator/applications.js +0 -2
- package/lib/coordinator/applications.js.map +1 -1
- package/lib/coordinator/consent.js +0 -1
- package/lib/coordinator/consent.js.map +1 -1
- package/lib/coordinator/edgeNodes.js +0 -1
- package/lib/coordinator/edgeNodes.js.map +1 -1
- package/lib/coordinator/organizations.js +0 -2
- package/lib/coordinator/organizations.js.map +1 -1
- package/lib/coordinator/permissions.js +0 -1
- package/lib/coordinator/permissions.js.map +1 -1
- package/lib/coordinator/roles.js +0 -3
- package/lib/coordinator/roles.js.map +1 -1
- package/lib/coordinator/users.js +0 -2
- package/lib/coordinator/users.js.map +1 -1
- package/lib/events/index.js +0 -1
- package/lib/events/index.js.map +1 -1
- package/lib/files/index.js +20 -31
- package/lib/files/index.js.map +1 -1
- package/lib/index.js +7 -8
- package/lib/index.js.map +1 -1
- package/lib/iot/feeds.js +0 -1
- package/lib/iot/feeds.js.map +1 -1
- package/lib/iot/fieldCategories.js +0 -1
- package/lib/iot/fieldCategories.js.map +1 -1
- package/lib/iot/fieldGroupings.js +0 -1
- package/lib/iot/fieldGroupings.js.map +1 -1
- package/lib/iot/fields.js +0 -1
- package/lib/iot/fields.js.map +1 -1
- package/lib/iot/outputs.js +0 -1
- package/lib/iot/outputs.js.map +1 -1
- package/lib/nionic/index.js +12 -15
- package/lib/nionic/index.js.map +1 -1
- package/lib/request.js +8 -9
- package/lib/request.js.map +1 -1
- package/lib/sessionTypes/auth0WebAuth.js +10 -19
- package/lib/sessionTypes/auth0WebAuth.js.map +1 -1
- package/lib/sessionTypes/index.js +0 -1
- package/lib/sessionTypes/index.js.map +1 -1
- package/lib/sessionTypes/machineAuth.js +7 -16
- package/lib/sessionTypes/machineAuth.js.map +1 -1
- package/lib/sessionTypes/passwordGrantAuth.js +3 -6
- package/lib/sessionTypes/passwordGrantAuth.js.map +1 -1
- package/lib/utils/iot/formatOutputFieldDataFromServer.js +6 -13
- package/lib/utils/iot/formatOutputFieldDataFromServer.js.map +1 -1
- package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js +0 -2
- package/lib/utils/iot/parseOutputFieldNextPageUrlMetadata.js.map +1 -1
- package/lib/utils/objects/createCaseChangeFn.js +4 -14
- package/lib/utils/objects/createCaseChangeFn.js.map +1 -1
- package/lib/utils/objects/map.js +5 -29
- package/lib/utils/objects/map.js.map +1 -1
- package/lib/utils/pagination/formatPaginatedDataFromServer.js +0 -1
- package/lib/utils/pagination/formatPaginatedDataFromServer.js.map +1 -1
- package/lib/utils/url/index.js +2 -2
- package/package.json +14 -7
- package/src/bus/index.spec.js +1 -1
- package/src/bus/webSocketConnection.js +1 -2
- package/src/bus/webSocketConnection.spec.js +53 -53
- package/src/config/index.spec.js +5 -5
- package/src/coordinator/applications.spec.js +7 -7
- package/src/coordinator/consent.spec.js +1 -1
- package/src/coordinator/edgeNodes.spec.js +2 -2
- package/src/coordinator/organizations.spec.js +3 -3
- package/src/coordinator/permissions.spec.js +3 -3
- package/src/coordinator/roles.spec.js +3 -3
- package/src/coordinator/users.spec.js +17 -17
- package/src/events/index.spec.js +15 -15
- package/src/files/index.spec.js +8 -8
- package/src/index.spec.js +8 -8
- package/src/iot/feeds.spec.js +3 -3
- package/src/iot/fieldCategories.spec.js +3 -3
- package/src/iot/fieldGroupings.spec.js +4 -4
- package/src/iot/outputs.spec.js +6 -6
- package/src/request.spec.js +3 -3
- package/src/sessionTypes/auth0WebAuth.spec.js +16 -14
- package/src/sessionTypes/index.spec.js +1 -1
- package/src/sessionTypes/machineAuth.spec.js +5 -5
- package/src/sessionTypes/passwordGrantAuth.spec.js +1 -1
- package/src/utils/iot/formatOutputFieldDataFromServer.spec.js +6 -6
- package/src/utils/iot/parseOutputFieldNextPageUrlMetadata.spec.js +3 -3
- package/src/utils/pagination/formatPaginatedDataFromServer.spec.js +2 -2
- package/src/utils/url/stringifyParams.spec.js +3 -3
- package/support/fixtures/factories/IOSDevice.js +4 -4
- package/support/fixtures/factories/applicationGrouping.js +6 -6
- package/support/fixtures/factories/applicationModule.js +3 -3
- package/support/fixtures/factories/asset.js +2 -2
- package/support/fixtures/factories/assetAttribute.js +4 -4
- package/support/fixtures/factories/assetAttributeValue.js +3 -3
- package/support/fixtures/factories/assetMetric.js +3 -3
- package/support/fixtures/factories/assetMetricValue.js +4 -4
- package/support/fixtures/factories/assetMetricValueCompact.js +3 -3
- package/support/fixtures/factories/assetType.js +2 -2
- package/support/fixtures/factories/audience.js +1 -1
- package/support/fixtures/factories/authResults.js +4 -4
- package/support/fixtures/factories/channel.js +2 -2
- package/support/fixtures/factories/contxtApplication.js +10 -10
- package/support/fixtures/factories/contxtOrganization.js +3 -3
- package/support/fixtures/factories/contxtOrganizationFeaturedApplication.js +4 -4
- package/support/fixtures/factories/contxtProject.js +7 -7
- package/support/fixtures/factories/contxtProjectEnvironment.js +7 -7
- package/support/fixtures/factories/contxtRole.js +5 -5
- package/support/fixtures/factories/contxtRoleApplication.js +2 -2
- package/support/fixtures/factories/contxtRoleProjectEnvironment.js +3 -3
- package/support/fixtures/factories/contxtUser.js +6 -6
- package/support/fixtures/factories/contxtUserApplication.js +2 -2
- package/support/fixtures/factories/contxtUserFavoriteApplication.js +3 -3
- package/support/fixtures/factories/contxtUserPermissions.js +6 -6
- package/support/fixtures/factories/contxtUserProjectEnvironment.js +3 -3
- package/support/fixtures/factories/contxtUserRole.js +3 -3
- package/support/fixtures/factories/costCenter.js +3 -3
- package/support/fixtures/factories/costCenterFacility.js +4 -4
- package/support/fixtures/factories/edgeNode.js +2 -2
- package/support/fixtures/factories/event.js +7 -7
- package/support/fixtures/factories/eventType.js +6 -6
- package/support/fixtures/factories/eventUser.js +8 -8
- package/support/fixtures/factories/facility.js +12 -12
- package/support/fixtures/factories/facilityGrouping.js +5 -5
- package/support/fixtures/factories/facilityGroupingFacility.js +4 -4
- package/support/fixtures/factories/facilityInfo.js +6 -6
- package/support/fixtures/factories/facilityTag.js +2 -2
- package/support/fixtures/factories/feedStatus.js +3 -3
- package/support/fixtures/factories/feedType.js +2 -2
- package/support/fixtures/factories/feeds.js +8 -8
- package/support/fixtures/factories/fieldCategory.js +4 -4
- package/support/fixtures/factories/fieldGrouping.js +6 -6
- package/support/fixtures/factories/fieldGroupingField.js +4 -4
- package/support/fixtures/factories/fieldGroupingStatus.js +3 -3
- package/support/fixtures/factories/file.js +3 -3
- package/support/fixtures/factories/fileToDownload.js +1 -1
- package/support/fixtures/factories/fileUploadInfo.js +3 -3
- package/support/fixtures/factories/organization.js +3 -3
- package/support/fixtures/factories/outputField.js +18 -18
- package/support/fixtures/factories/outputFieldData.js +2 -2
- package/support/fixtures/factories/owner.js +5 -5
- package/support/fixtures/factories/paginationMetadata.js +3 -3
- package/support/fixtures/factories/triggeredEvent.js +5 -5
- package/support/fixtures/factories/userEventSubscription.js +3 -3
- package/support/fixtures/factories/userMobileNumber.js +4 -4
- package/support/fixtures/factories/userPermissionsMap.js +3 -3
- package/support/fixtures/factories/userProfile.js +3 -3
- package/support/globals.js +11 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('outputField')
|
|
8
8
|
.option('fromServer', false)
|
|
9
9
|
.sequence('id')
|
|
10
10
|
.attrs({
|
|
11
|
-
_sourceDescriptor: () => faker.
|
|
11
|
+
_sourceDescriptor: () => faker.number.int(),
|
|
12
12
|
_sourceType: () =>
|
|
13
|
-
faker.
|
|
13
|
+
faker.helpers.arrayElement([
|
|
14
14
|
'compressor',
|
|
15
15
|
'condenser_fan',
|
|
16
16
|
'condenser_pump',
|
|
@@ -24,17 +24,17 @@ factory
|
|
|
24
24
|
'outdoor_sump_pump',
|
|
25
25
|
'transfer_pump'
|
|
26
26
|
]),
|
|
27
|
-
canAggregate: () =>
|
|
28
|
-
divisor: () => faker.
|
|
29
|
-
fieldName: () => faker.
|
|
30
|
-
isDefault: () =>
|
|
31
|
-
isHidden: () =>
|
|
32
|
-
isTotalizer: () =>
|
|
33
|
-
isWindowed: () =>
|
|
34
|
-
outputId: () => faker.
|
|
35
|
-
scalar: () => faker.
|
|
36
|
-
status: () => faker.
|
|
37
|
-
valueType: () => faker.
|
|
27
|
+
canAggregate: () => fakerBoolean(),
|
|
28
|
+
divisor: () => faker.number.int(),
|
|
29
|
+
fieldName: () => faker.helpers.arrayElement(['power', 'temperature']),
|
|
30
|
+
isDefault: () => fakerBoolean(),
|
|
31
|
+
isHidden: () => fakerBoolean(),
|
|
32
|
+
isTotalizer: () => fakerBoolean(),
|
|
33
|
+
isWindowed: () => fakerBoolean(),
|
|
34
|
+
outputId: () => faker.number.int(),
|
|
35
|
+
scalar: () => faker.number.int(),
|
|
36
|
+
status: () => faker.helpers.arrayElement(['Active', 'Out-of-Date']),
|
|
37
|
+
valueType: () => faker.helpers.arrayElement(['boolean', 'numeric', 'string'])
|
|
38
38
|
})
|
|
39
39
|
.attr('_sourceMeasurement', ['fieldName'], (fieldName) => {
|
|
40
40
|
const fieldNames = {
|
|
@@ -42,7 +42,7 @@ factory
|
|
|
42
42
|
temperature: ['temperature']
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
return faker.
|
|
45
|
+
return faker.helpers.arrayElement(fieldNames[fieldName]);
|
|
46
46
|
})
|
|
47
47
|
.attr('feedKey', ['_sourceDescriptor'], (descriptor) => `egauge${descriptor}`)
|
|
48
48
|
.attr(
|
|
@@ -51,7 +51,7 @@ factory
|
|
|
51
51
|
(descriptor, measurement, type) => {
|
|
52
52
|
const baseFieldDescriptor = `${type}_${descriptor}`;
|
|
53
53
|
|
|
54
|
-
return
|
|
54
|
+
return fakerBoolean()
|
|
55
55
|
? baseFieldDescriptor
|
|
56
56
|
: `${baseFieldDescriptor}.${measurement}`;
|
|
57
57
|
}
|
|
@@ -64,7 +64,7 @@ factory
|
|
|
64
64
|
usage: ['Average Usage', 'Cumulative Usage']
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
return faker.
|
|
67
|
+
return faker.helpers.arrayElement(labels[measurement]);
|
|
68
68
|
})
|
|
69
69
|
.attr('units', ['_sourceMeasurement'], (measurement) => {
|
|
70
70
|
const units = {
|
|
@@ -73,7 +73,7 @@ factory
|
|
|
73
73
|
usage: ['kW', 'kWh']
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
return faker.
|
|
76
|
+
return faker.helpers.arrayElement(units[measurement]);
|
|
77
77
|
})
|
|
78
78
|
.after((outputField, options) => {
|
|
79
79
|
delete outputField._sourceDescriptor;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('outputFieldData')
|
|
8
8
|
.option('fromServer', false)
|
|
9
9
|
.attrs({
|
|
10
10
|
eventTime: () => faker.date.past(),
|
|
11
|
-
value: () => `${faker.
|
|
11
|
+
value: () => `${faker.number.int()}`
|
|
12
12
|
})
|
|
13
13
|
.after((outputFieldData, options) => {
|
|
14
14
|
// If building an output field data object that comes from the server,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('owner')
|
|
@@ -9,10 +9,10 @@ factory
|
|
|
9
9
|
.attrs({
|
|
10
10
|
createdAt: () => faker.date.past().toISOString(),
|
|
11
11
|
email: () => faker.internet.email(),
|
|
12
|
-
firstName: () => faker.
|
|
13
|
-
id: () => `auth0|${faker.
|
|
14
|
-
isMachineUser: () =>
|
|
15
|
-
lastName: () => faker.
|
|
12
|
+
firstName: () => faker.person.firstName(),
|
|
13
|
+
id: () => `auth0|${faker.number.int()}`,
|
|
14
|
+
isMachineUser: () => fakerBoolean(),
|
|
15
|
+
lastName: () => faker.person.lastName(),
|
|
16
16
|
updatedAt: () => faker.date.recent().toISOString()
|
|
17
17
|
})
|
|
18
18
|
.after((owner, options) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory.define('paginationMetadata').attrs({
|
|
7
|
-
offset: () => faker.
|
|
8
|
-
totalRecords: () => faker.
|
|
7
|
+
offset: () => faker.number.int({ max: 100 }),
|
|
8
|
+
totalRecords: () => faker.number.int({ min: 1, max: 1000 })
|
|
9
9
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('triggeredEvent')
|
|
@@ -10,10 +10,10 @@ factory
|
|
|
10
10
|
createdAt: () => faker.date.past().toISOString(),
|
|
11
11
|
data: () => faker.hacker.phrase(),
|
|
12
12
|
deletedAt: () => faker.date.recent().toISOString(),
|
|
13
|
-
eventId: () => faker.
|
|
14
|
-
id: () => faker.
|
|
15
|
-
isPublic: () =>
|
|
16
|
-
ownerId: () => faker.
|
|
13
|
+
eventId: () => faker.string.uuid(),
|
|
14
|
+
id: () => faker.string.uuid(),
|
|
15
|
+
isPublic: () => fakerBoolean(),
|
|
16
|
+
ownerId: () => faker.string.uuid(),
|
|
17
17
|
triggerEndAt: () => faker.date.recent().toISOString(),
|
|
18
18
|
triggerStartAt: () => faker.date.recent().toISOString(),
|
|
19
19
|
updatedAt: () => faker.date.recent().toISOString()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('userEventSubscription')
|
|
@@ -10,8 +10,8 @@ factory
|
|
|
10
10
|
createdAt: () => faker.date.past().toISOString(),
|
|
11
11
|
endpointArn: () => null,
|
|
12
12
|
eventId: () => factory.build('event').id,
|
|
13
|
-
id: () => faker.
|
|
14
|
-
mediumType: () => faker.
|
|
13
|
+
id: () => faker.string.uuid(),
|
|
14
|
+
mediumType: () => faker.helpers.arrayElement(['email', 'sms']),
|
|
15
15
|
updatedAt: () => faker.date.recent().toISOString(),
|
|
16
16
|
userId: () => factory.build('contxtUser').id
|
|
17
17
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('userMobileNumber')
|
|
@@ -9,9 +9,9 @@ factory
|
|
|
9
9
|
.sequence('id')
|
|
10
10
|
.attrs({
|
|
11
11
|
createdAt: () => faker.date.past().toISOString(),
|
|
12
|
-
name: () => faker.
|
|
13
|
-
isActive: () =>
|
|
14
|
-
phoneNumber: () => faker.phone.
|
|
12
|
+
name: () => faker.person.firstName(),
|
|
13
|
+
isActive: () => fakerBoolean(),
|
|
14
|
+
phoneNumber: () => faker.phone.number(),
|
|
15
15
|
updatedAt: () => faker.date.recent().toISOString(),
|
|
16
16
|
userId: () => factory.build('eventUser').id
|
|
17
17
|
})
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
const times = require('lodash.times');
|
|
6
6
|
|
|
7
7
|
factory.define('userPermissionsMap').after((userPermissionsMap) => {
|
|
8
8
|
const newPermissionsMap = times(
|
|
9
|
-
faker.
|
|
9
|
+
faker.number.int({ min: 1, max: 5 })
|
|
10
10
|
).reduce((memo) => {
|
|
11
11
|
memo[faker.internet.password()] = times(
|
|
12
|
-
faker.
|
|
12
|
+
faker.number.int({ min: 1, max: 5 })
|
|
13
13
|
).reduce((existingScopes) => {
|
|
14
14
|
const scopeLabel = `${faker.lorem.word()}_${faker.lorem.word()}`;
|
|
15
15
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const factory = require('rosie').Factory;
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
5
|
|
|
6
6
|
factory
|
|
7
7
|
.define('userProfile')
|
|
8
8
|
.attrs({
|
|
9
|
-
name: () => faker.
|
|
10
|
-
nickname: () => faker.
|
|
9
|
+
name: () => faker.person.fullName(),
|
|
10
|
+
nickname: () => faker.person.firstName(),
|
|
11
11
|
picture: () => faker.image.avatar(),
|
|
12
12
|
sub: () => faker.hacker.adjective(),
|
|
13
13
|
updatedAt: () => faker.date.recent().toISOString()
|
package/support/globals.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const chai = require('chai');
|
|
4
|
-
const faker = require('faker');
|
|
4
|
+
const { faker } = require('@faker-js/faker');
|
|
5
|
+
|
|
6
|
+
// createTransaction was removed from faker; this polyfill restores it for tests
|
|
7
|
+
faker.helpers.createTransaction = () => ({});
|
|
8
|
+
|
|
9
|
+
// faker.datatype.boolean() was removed in @faker-js/faker v10;
|
|
10
|
+
// this is a drop-in replacement using faker.number.int()
|
|
11
|
+
function fakerBoolean() {
|
|
12
|
+
return faker.number.int({ max: 1 }) === 1;
|
|
13
|
+
}
|
|
5
14
|
const sinon = require('sinon');
|
|
6
15
|
const fixtureFactories = require('./fixtures/factories');
|
|
7
16
|
|
|
17
|
+
global.fakerBoolean = fakerBoolean;
|
|
8
18
|
global.expect = chai.expect;
|
|
9
19
|
global.fixture = fixtureFactories;
|
|
10
20
|
global.faker = faker;
|