@patch-adams/core 1.5.7 → 1.5.8
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/cli.cjs +30 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +30 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -3026,15 +3026,37 @@ function generateLrsBridgeCode(options) {
|
|
|
3026
3026
|
* Build activity object for questions in Xyleme format
|
|
3027
3027
|
* Name format: "Assessment Name - Q#: Question text..."
|
|
3028
3028
|
*/
|
|
3029
|
+
/**
|
|
3030
|
+
* Simple string hash for generating short, stable IDs from long strings.
|
|
3031
|
+
* Returns a hex string (8 chars). Not cryptographic \u2014 just for uniqueness.
|
|
3032
|
+
*/
|
|
3033
|
+
function hashString(str) {
|
|
3034
|
+
var hash = 0;
|
|
3035
|
+
for (var i = 0; i < str.length; i++) {
|
|
3036
|
+
var ch = str.charCodeAt(i);
|
|
3037
|
+
hash = ((hash << 5) - hash) + ch;
|
|
3038
|
+
hash = hash & hash; // Convert to 32-bit integer
|
|
3039
|
+
}
|
|
3040
|
+
return Math.abs(hash).toString(16).padStart(8, '0');
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3029
3043
|
function buildQuestionActivityObject(questionInfo) {
|
|
3030
|
-
var
|
|
3044
|
+
var rawGuid = questionInfo.questionGuid || questionInfo.id || generateUUID();
|
|
3045
|
+
|
|
3046
|
+
// Ensure the object ID stays under 255 chars total to avoid Bravais aggregation failures.
|
|
3047
|
+
// Rise SCORM interaction IDs can be very long (full slugified question text).
|
|
3048
|
+
// Use a truncated prefix + hash to keep it short but unique and stable.
|
|
3049
|
+
var questionGuid = rawGuid;
|
|
3050
|
+
if (rawGuid.length > 80) {
|
|
3051
|
+
questionGuid = rawGuid.substring(0, 60) + '_' + hashString(rawGuid);
|
|
3052
|
+
}
|
|
3031
3053
|
|
|
3032
3054
|
// Build human-readable display name
|
|
3033
3055
|
var displayName = (questionInfo.assessmentName || 'Knowledge Check');
|
|
3034
3056
|
if (questionInfo.questionNumber) {
|
|
3035
3057
|
displayName += ' - Q' + questionInfo.questionNumber;
|
|
3036
3058
|
}
|
|
3037
|
-
var questionText = questionInfo.text || questionInfo.questionText || '';
|
|
3059
|
+
var questionText = decodeEntities(questionInfo.text || questionInfo.questionText || '');
|
|
3038
3060
|
if (questionText.length > 50) {
|
|
3039
3061
|
displayName += ': ' + questionText.substring(0, 47) + '...';
|
|
3040
3062
|
} else if (questionText.length > 0) {
|
|
@@ -4411,10 +4433,12 @@ function generateLrsBridgeCode(options) {
|
|
|
4411
4433
|
var interactionId = interaction.id || ('interaction-' + idx);
|
|
4412
4434
|
|
|
4413
4435
|
// Try to make a readable question text from the interaction ID
|
|
4414
|
-
var questionText =
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4436
|
+
var questionText = decodeEntities(
|
|
4437
|
+
interactionId
|
|
4438
|
+
.replace(/_\\d+$/, '') // remove trailing _0
|
|
4439
|
+
.replace(/_/g, ' ') // underscores to spaces
|
|
4440
|
+
.substring(0, 200)
|
|
4441
|
+
);
|
|
4418
4442
|
|
|
4419
4443
|
// Get lesson context
|
|
4420
4444
|
var lessonInfo = getCachedLessonInfo();
|