@sprucelabs/spruce-test-fixtures 66.0.67 → 66.1.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.
|
@@ -531,13 +531,33 @@ function fakeUpdateOrganization() {
|
|
|
531
531
|
function fakeListOrganization() {
|
|
532
532
|
return __awaiter(this, void 0, void 0, function* () {
|
|
533
533
|
yield eventFaker.on('list-organizations::v2020_12_25', (targetAndPayload) => {
|
|
534
|
-
const { payload } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
534
|
+
const { payload, target } = targetAndPayload !== null && targetAndPayload !== void 0 ? targetAndPayload : {};
|
|
535
|
+
let { organizationIds } = target !== null && target !== void 0 ? target : {};
|
|
536
|
+
let fakedOrgs = FakerTracker.fakedOrganizations;
|
|
537
|
+
if (organizationIds) {
|
|
538
|
+
fakedOrgs = filterOrgsByIds(organizationIds);
|
|
539
|
+
}
|
|
535
540
|
return {
|
|
536
|
-
organizations: applyPaging(
|
|
541
|
+
organizations: applyPaging(fakedOrgs, payload),
|
|
537
542
|
};
|
|
538
543
|
});
|
|
539
544
|
});
|
|
540
545
|
}
|
|
546
|
+
function filterOrgsByIds(organizationIds) {
|
|
547
|
+
const uniqueIds = [...new Set(organizationIds)];
|
|
548
|
+
const filteredOrgs = [];
|
|
549
|
+
for (const orgId of uniqueIds) {
|
|
550
|
+
const org = FakerTracker.fakedOrganizations.find((o) => o.id === orgId);
|
|
551
|
+
if (!org) {
|
|
552
|
+
throw new SpruceError({
|
|
553
|
+
code: 'NOT_FOUND',
|
|
554
|
+
friendlyMessage: `I could not find an organization with the id of '${orgId}'`,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
filteredOrgs.push(org);
|
|
558
|
+
}
|
|
559
|
+
return filteredOrgs;
|
|
560
|
+
}
|
|
541
561
|
function applyPaging(records, payload) {
|
|
542
562
|
var _a;
|
|
543
563
|
let copy = [...records];
|
|
@@ -494,12 +494,32 @@ async function fakeUpdateOrganization() {
|
|
|
494
494
|
}
|
|
495
495
|
async function fakeListOrganization() {
|
|
496
496
|
await eventFaker_1.default.on('list-organizations::v2020_12_25', (targetAndPayload) => {
|
|
497
|
-
const { payload } = targetAndPayload ?? {};
|
|
497
|
+
const { payload, target } = targetAndPayload ?? {};
|
|
498
|
+
let { organizationIds } = target ?? {};
|
|
499
|
+
let fakedOrgs = FakerTracker_1.default.fakedOrganizations;
|
|
500
|
+
if (organizationIds) {
|
|
501
|
+
fakedOrgs = filterOrgsByIds(organizationIds);
|
|
502
|
+
}
|
|
498
503
|
return {
|
|
499
|
-
organizations: applyPaging(
|
|
504
|
+
organizations: applyPaging(fakedOrgs, payload),
|
|
500
505
|
};
|
|
501
506
|
});
|
|
502
507
|
}
|
|
508
|
+
function filterOrgsByIds(organizationIds) {
|
|
509
|
+
const uniqueIds = [...new Set(organizationIds)];
|
|
510
|
+
const filteredOrgs = [];
|
|
511
|
+
for (const orgId of uniqueIds) {
|
|
512
|
+
const org = FakerTracker_1.default.fakedOrganizations.find((o) => o.id === orgId);
|
|
513
|
+
if (!org) {
|
|
514
|
+
throw new SpruceError_1.default({
|
|
515
|
+
code: 'NOT_FOUND',
|
|
516
|
+
friendlyMessage: `I could not find an organization with the id of '${orgId}'`,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
filteredOrgs.push(org);
|
|
520
|
+
}
|
|
521
|
+
return filteredOrgs;
|
|
522
|
+
}
|
|
503
523
|
function applyPaging(records, payload) {
|
|
504
524
|
let copy = [...records];
|
|
505
525
|
if (payload?.paging?.pageSize) {
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "66.0
|
|
16
|
+
"version": "66.1.0",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@sprucelabs/spruce-core-schemas": "^40.1.676",
|
|
72
72
|
"@sprucelabs/spruce-event-utils": "^40.2.82",
|
|
73
73
|
"@sprucelabs/spruce-permission-utils": "^12.0.90",
|
|
74
|
-
"@sprucelabs/spruce-skill-booter": "^66.0
|
|
74
|
+
"@sprucelabs/spruce-skill-booter": "^66.1.0",
|
|
75
75
|
"@sprucelabs/spruce-skill-utils": "^31.2.91",
|
|
76
76
|
"@sprucelabs/test-utils": "^5.5.42",
|
|
77
77
|
"dotenv": "^16.5.0",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7fa497cf53382245557a5c73bc92b26051fffb42"
|
|
118
118
|
}
|