Skip to content

Commit 47180e4

Browse files
committed
Removing trailing ".js" in imports or require
1 parent 9933d92 commit 47180e4

11 files changed

Lines changed: 150 additions & 38 deletions

docs/hds-lib.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/hds-lib.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/tests-browser.js

Lines changed: 126 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,9 +1995,9 @@ exports.CollectorInvite = CollectorInvite;
19951995

19961996
Object.defineProperty(exports, "__esModule", ({ value: true }));
19971997
exports.CollectorRequest = void 0;
1998-
const errors_js_1 = __webpack_require__(/*! ../errors.js */ "./lib/errors.js");
1999-
const HDSModelInitAndSingleton_js_1 = __webpack_require__(/*! ../HDSModel/HDSModelInitAndSingleton.js */ "./lib/HDSModel/HDSModelInitAndSingleton.js");
2000-
const localizeText_js_1 = __webpack_require__(/*! ../localizeText.js */ "./lib/localizeText.js");
1998+
const errors_1 = __webpack_require__(/*! ../errors */ "./lib/errors.js");
1999+
const HDSModelInitAndSingleton_1 = __webpack_require__(/*! ../HDSModel/HDSModelInitAndSingleton */ "./lib/HDSModel/HDSModelInitAndSingleton.js");
2000+
const localizeText_1 = __webpack_require__(/*! ../localizeText */ "./lib/localizeText.js");
20012001
const CURRENT_VERSION = 1;
20022002
/**
20032003
* Each Collector has one Request
@@ -2064,7 +2064,7 @@ class CollectorRequest {
20642064
}
20652065
else {
20662066
if (numV !== this.#version)
2067-
throw new errors_js_1.HDSLibError(`Invalid CollectorRequest content version: ${futureContent.version}`);
2067+
throw new errors_1.HDSLibError(`Invalid CollectorRequest content version: ${futureContent.version}`);
20682068
}
20692069
delete futureContent.version;
20702070
}
@@ -2125,11 +2125,11 @@ class CollectorRequest {
21252125
}
21262126
// ------------- getter and setters ------------ //
21272127
get version() { return this.#version; }
2128-
set title(title) { this.#title = (0, localizeText_js_1.validateLocalizableText)('title', title); }
2128+
set title(title) { this.#title = (0, localizeText_1.validateLocalizableText)('title', title); }
21292129
get title() { return this.#title; }
2130-
set consent(consent) { this.#consent = (0, localizeText_js_1.validateLocalizableText)('consent', consent); }
2130+
set consent(consent) { this.#consent = (0, localizeText_1.validateLocalizableText)('consent', consent); }
21312131
get consent() { return this.#consent; }
2132-
set description(description) { this.#description = (0, localizeText_js_1.validateLocalizableText)('description', description); }
2132+
set description(description) { this.#description = (0, localizeText_1.validateLocalizableText)('description', description); }
21332133
get description() { return this.#description; }
21342134
set requesterName(name) { this.#requester.name = validateString('requester:name', name); }
21352135
get requesterName() { return this.#requester.name; }
@@ -2155,7 +2155,7 @@ class CollectorRequest {
21552155
}
21562156
createSection(key, type) {
21572157
if (this.getSectionByKey(key) != null)
2158-
throw new errors_js_1.HDSLibError(`Section with key: ${key} already exists`);
2158+
throw new errors_1.HDSLibError(`Section with key: ${key} already exists`);
21592159
const section = new CollectorRequestSection(key, type);
21602160
this.#sections.push(section);
21612161
return section;
@@ -2197,7 +2197,7 @@ class CollectorRequest {
21972197
}
21982198
// 2 - get the permissions with eventual preRequest
21992199
const preRequest = this.permissionsExtra || [];
2200-
const permissions = (0, HDSModelInitAndSingleton_js_1.getModel)().authorizations.forItemKeys(itemKeys, { preRequest });
2200+
const permissions = (0, HDSModelInitAndSingleton_1.getModel)().authorizations.forItemKeys(itemKeys, { preRequest });
22012201
// 3 - if no error araised - reset permissions
22022202
this.resetPermissions();
22032203
this.addPermissions(permissions);
@@ -2231,7 +2231,7 @@ class CollectorRequest {
22312231
exports.CollectorRequest = CollectorRequest;
22322232
function validateString(key, totest) {
22332233
if (totest == null || typeof totest !== 'string')
2234-
throw new errors_js_1.HDSLibError(`Invalid ${key} value: ${totest}`, { [key]: totest });
2234+
throw new errors_1.HDSLibError(`Invalid ${key} value: ${totest}`, { [key]: totest });
22352235
return totest;
22362236
}
22372237
const RequestSectionType = {
@@ -2255,7 +2255,7 @@ class CollectorRequestSection {
22552255
keys.forEach((k) => this.addItemKey(k));
22562256
}
22572257
addItemKey(key) {
2258-
(0, HDSModelInitAndSingleton_js_1.getModel)().itemsDefs.forKey(key); // will throw error if not found
2258+
(0, HDSModelInitAndSingleton_1.getModel)().itemsDefs.forKey(key); // will throw error if not found
22592259
if (this.#itemKeys.includes(key))
22602260
return; // avoid double entries
22612261
this.#itemKeys.push(key);
@@ -2288,7 +2288,7 @@ class CollectorRequestSection {
22882288
function vo0ToV1(v0Data) {
22892289
if (v0Data.app?.data?.forms) {
22902290
if (v0Data.sections)
2291-
throw new errors_js_1.HDSLibError('Cannot mix data.forms & sections', v0Data);
2291+
throw new errors_1.HDSLibError('Cannot mix data.forms & sections', v0Data);
22922292
v0Data.sections = [];
22932293
for (const [key, value] of Object.entries(v0Data.app.data.forms)) {
22942294
value.key = key;
@@ -23427,8 +23427,8 @@ const { pryv, createUserPermissions } = __webpack_require__(/*! ./test-utils/pry
2342723427
const HDSLib = __webpack_require__(/*! ../lib */ "./lib/index.js");
2342823428
const { AppManagingAccount, AppClientAccount, Collector, CollectorClient } = HDSLib.appTemplates;
2342923429
const { HDSLibError } = __webpack_require__(/*! ../lib/errors */ "./lib/errors.js");
23430-
const { initHDSModel } = __webpack_require__(/*! ../lib/index.js */ "./lib/index.js");
23431-
const { helperNewAppAndUsers, helperNewInvite, helperNewAppManaging } = __webpack_require__(/*! ./test-utils/helpersAppTemplate.js */ "./tests/test-utils/helpersAppTemplate.js");
23430+
const { initHDSModel } = __webpack_require__(/*! ../lib/index */ "./lib/index.js");
23431+
const { helperNewAppAndUsers, helperNewInvite, helperNewAppManaging } = __webpack_require__(/*! ./test-utils/helpersAppTemplate */ "./tests/test-utils/helpersAppTemplate.js");
2343223432

2343323433
describe('[APTX] appTemplates', function () {
2343423434
this.timeout(10000);
@@ -23940,6 +23940,116 @@ describe('[APTX] appTemplates', function () {
2394023940
});
2394123941

2394223942

23943+
/***/ }),
23944+
23945+
/***/ "./tests/apptemplatesRequest.test.js":
23946+
/*!*******************************************!*\
23947+
!*** ./tests/apptemplatesRequest.test.js ***!
23948+
\*******************************************/
23949+
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
23950+
23951+
/* eslint-env mocha */
23952+
23953+
const { initHDSModel } = __webpack_require__(/*! ../lib */ "./lib/index.js");
23954+
const { helperNewAppManaging } = __webpack_require__(/*! ./test-utils/helpersAppTemplate */ "./tests/test-utils/helpersAppTemplate.js");
23955+
const { assert } = __webpack_require__(/*! ./test-utils/deps-node */ "./tests/test-utils/deps-browser.js");
23956+
23957+
describe('[APRX] appTemplates Requests', function () {
23958+
before(async () => {
23959+
await initHDSModel();
23960+
});
23961+
it('[APRC] Compute a simple request', async () => {
23962+
const baseStreamId = 'aprc';
23963+
const { appManaging } = await helperNewAppManaging(baseStreamId, 'test-APRC');
23964+
const newCollector = await appManaging.createCollector('Invite test APCV');
23965+
23966+
const request = newCollector.request;
23967+
request.appId = 'dr-form';
23968+
request.appUrl = 'https://xxx.yyy';
23969+
request.title = { en: 'My title' };
23970+
request.requesterName = 'Username APRC';
23971+
request.description = { en: 'Short Description' };
23972+
request.consent = { en: 'Short Consent' };
23973+
request.addPermissionExtra({ streamId: 'profile' });
23974+
request.addPermissionExtra({ streamId: 'fertility' });
23975+
23976+
const sectionA = request.createSection('profile', 'permanent');
23977+
sectionA.setNameLocal('en', 'A');
23978+
sectionA.addItemKeys([
23979+
'profile-name',
23980+
'profile-surname',
23981+
'profile-sex',
23982+
'family-children-count',
23983+
'fertility-miscarriages-count'
23984+
]);
23985+
23986+
const sectionB = request.createSection('history', 'recurring');
23987+
sectionB.setNameLocal('en', 'B');
23988+
sectionB.addItemKeys([
23989+
'fertility-ttc-tta',
23990+
'body-weight'
23991+
]);
23992+
// build permissions needed
23993+
request.buildPermissions();
23994+
const requestContent = request.content;
23995+
assert.ok(requestContent.id.startsWith(baseStreamId), 'id should start with the basetreamid of the manager');
23996+
23997+
const expectedContent = {
23998+
version: 1,
23999+
title: { en: 'My title' },
24000+
consent: { en: 'Short Consent' },
24001+
description: { en: 'Short Description' },
24002+
requester: { name: 'Username APRC' },
24003+
permissionsExtra: [
24004+
{ streamId: 'profile', defaultName: 'Profile', level: 'read' },
24005+
{
24006+
streamId: 'fertility',
24007+
defaultName: 'Fertility',
24008+
level: 'read'
24009+
}
24010+
],
24011+
permissions: [
24012+
{ streamId: 'profile', defaultName: 'Profile', level: 'read' },
24013+
{ streamId: 'fertility', defaultName: 'Fertility', level: 'read' },
24014+
{
24015+
streamId: 'family-children',
24016+
defaultName: 'Children',
24017+
level: 'read'
24018+
},
24019+
{
24020+
streamId: 'body-weight',
24021+
defaultName: 'Body Weight',
24022+
level: 'read'
24023+
}
24024+
],
24025+
app: { id: 'dr-form', url: 'https://xxx.yyy', data: {} },
24026+
sections: [
24027+
{
24028+
key: 'profile',
24029+
type: 'permanent',
24030+
name: { en: 'A' },
24031+
itemKeys: [
24032+
'profile-name',
24033+
'profile-surname',
24034+
'profile-sex',
24035+
'family-children-count',
24036+
'fertility-miscarriages-count'
24037+
]
24038+
},
24039+
{
24040+
key: 'history',
24041+
type: 'recurring',
24042+
name: { en: 'B' },
24043+
itemKeys: ['fertility-ttc-tta', 'body-weight']
24044+
}
24045+
],
24046+
id: requestContent.id
24047+
};
24048+
assert.deepEqual(requestContent, expectedContent);
24049+
});
24050+
});
24051+
24052+
2394324053
/***/ }),
2394424054

2394524055
/***/ "./tests/errors.test.js":
@@ -23993,7 +24103,7 @@ const HDSLib = __webpack_require__(/*! ../lib */ "./lib/index.js");
2399324103
const { waitUntilFalse } = __webpack_require__(/*! ../lib/utils */ "./lib/utils.js");
2399424104
const { resetModel } = __webpack_require__(/*! ../lib/HDSModel/HDSModelInitAndSingleton */ "./lib/HDSModel/HDSModelInitAndSingleton.js");
2399524105

23996-
describe('[HDLX] HDSLib.index.js', () => {
24106+
describe('[HDLX] HDSLib.index', () => {
2399724107
before(async () => {
2399824108
await HDSLib.initHDSModel();
2399924109
resetModel();
@@ -25103,6 +25213,7 @@ var __webpack_exports__ = {};
2510325213
*/
2510425214
__webpack_require__(/*! ./applicationClass.test */ "./tests/applicationClass.test.js");
2510525215
__webpack_require__(/*! ./apptemplates.test */ "./tests/apptemplates.test.js");
25216+
__webpack_require__(/*! ./apptemplatesRequest.test */ "./tests/apptemplatesRequest.test.js");
2510625217
__webpack_require__(/*! ./errors.test */ "./tests/errors.test.js");
2510725218
__webpack_require__(/*! ./hdsLib.test */ "./tests/hdsLib.test.js");
2510825219
__webpack_require__(/*! ./hdsModel.test */ "./tests/hdsModel.test.js");

docs/tests-browser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/appTemplates/CollectorRequest.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)