@patch-adams/core 1.5.17 → 1.5.19
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 +59 -49
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +59 -49
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +59 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2272,17 +2272,27 @@ function generateLrsBridgeCode(options) {
|
|
|
2272
2272
|
function updateCourseInfoFromApi(docData) {
|
|
2273
2273
|
if (!docData || !LRS.courseInfo) return;
|
|
2274
2274
|
|
|
2275
|
-
// Document GUID
|
|
2276
|
-
|
|
2275
|
+
// Document GUID \u2014 Bravais API GUID ALWAYS overrides baked-in GUID.
|
|
2276
|
+
// The baked-in GUID is a random UUID from wrap time. The Bravais GUID is the
|
|
2277
|
+
// canonical document identifier that Analytics uses to link statements to documents.
|
|
2278
|
+
// Without this override, our statements have a different object.id than cloudplayer
|
|
2279
|
+
// statements, so Analytics treats them as unrelated to the document.
|
|
2280
|
+
if (docData.guid) {
|
|
2281
|
+
var oldGuid = LRS.courseInfo.guid;
|
|
2277
2282
|
LRS.courseInfo.guid = docData.guid;
|
|
2278
2283
|
LRS.courseInfo.id = 'http://xyleme.com/bravais/document/' + docData.guid;
|
|
2279
|
-
log(
|
|
2284
|
+
// Always-visible log (not behind DEBUG) so we can confirm override in production
|
|
2285
|
+
console.info('[PA-LRS] Document GUID set from API:', docData.guid,
|
|
2286
|
+
oldGuid && oldGuid !== docData.guid ? '(was: ' + oldGuid + ')' : '');
|
|
2280
2287
|
}
|
|
2281
2288
|
|
|
2282
|
-
// Version GUID
|
|
2283
|
-
if (docData.latestVersion && docData.latestVersion.guid
|
|
2289
|
+
// Version GUID \u2014 same principle: Bravais version GUID must override baked-in
|
|
2290
|
+
if (docData.latestVersion && docData.latestVersion.guid) {
|
|
2291
|
+
if (LRS.courseInfo.versionGuid && LRS.courseInfo.versionGuid !== docData.latestVersion.guid) {
|
|
2292
|
+
log('Overriding baked-in version GUID:', LRS.courseInfo.versionGuid, '->', docData.latestVersion.guid);
|
|
2293
|
+
}
|
|
2284
2294
|
LRS.courseInfo.versionGuid = docData.latestVersion.guid;
|
|
2285
|
-
log('
|
|
2295
|
+
log('Version GUID from API:', docData.latestVersion.guid);
|
|
2286
2296
|
}
|
|
2287
2297
|
|
|
2288
2298
|
// Other metadata
|
|
@@ -2582,21 +2592,20 @@ function generateLrsBridgeCode(options) {
|
|
|
2582
2592
|
info.sharedLinkName = launchInfo.sharedLinkName || info.sharedLinkName;
|
|
2583
2593
|
}
|
|
2584
2594
|
|
|
2585
|
-
// 3b.
|
|
2586
|
-
//
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
}
|
|
2595
|
+
// 3b. Always try to extract GUIDs from Xyleme Cloud Player's internal data.
|
|
2596
|
+
// Cloud Player data is authoritative \u2014 it has the canonical Bravais GUID.
|
|
2597
|
+
// This overrides any baked-in GUID which is just a random UUID from wrap time.
|
|
2598
|
+
var cloudPlayerData = extractFromXylemeCloudPlayer();
|
|
2599
|
+
if (cloudPlayerData) {
|
|
2600
|
+
if (cloudPlayerData.guid) info.guid = cloudPlayerData.guid;
|
|
2601
|
+
if (cloudPlayerData.versionGuid) info.versionGuid = cloudPlayerData.versionGuid;
|
|
2602
|
+
info.documentId = cloudPlayerData.documentId || info.documentId;
|
|
2603
|
+
info.title = cloudPlayerData.title || info.title;
|
|
2604
|
+
log('Updated course info from Cloud Player:', {
|
|
2605
|
+
guid: info.guid,
|
|
2606
|
+
versionGuid: info.versionGuid,
|
|
2607
|
+
documentId: info.documentId
|
|
2608
|
+
});
|
|
2600
2609
|
}
|
|
2601
2610
|
|
|
2602
2611
|
// 4. Try getCourseTitle() from preloadIntegrity.js
|
|
@@ -5218,12 +5227,18 @@ function generateLrsBridgeCode(options) {
|
|
|
5218
5227
|
|
|
5219
5228
|
// Always-visible bridge summary (not gated by DEBUG)
|
|
5220
5229
|
// This ensures diagnostics are available even in production builds
|
|
5230
|
+
// Shows current GUID (may be from Cloud Player, baked-in, or pending API override)
|
|
5231
|
+
var currentGuid = LRS.courseInfo ? LRS.courseInfo.guid : DOCUMENT_GUID;
|
|
5232
|
+
var currentVerGuid = LRS.courseInfo ? LRS.courseInfo.versionGuid : VERSION_GUID;
|
|
5233
|
+
var sharedToken = LRS.courseInfo ? LRS.courseInfo.sharedLinkToken : null;
|
|
5221
5234
|
if (window.console && window.console.info) {
|
|
5222
5235
|
console.info('[PA-LRS] Bridge v' + LRS.version + ': mode=' + LRS.mode +
|
|
5223
5236
|
', endpoint=' + (LRS_ENDPOINT ? LRS_ENDPOINT.substring(0, 30) + '...' : 'NONE') +
|
|
5224
5237
|
', proxy=' + (LRS_PROXY_ENDPOINT ? 'yes' : 'no') +
|
|
5225
|
-
', docGuid=' + (
|
|
5226
|
-
'
|
|
5238
|
+
', docGuid=' + (currentGuid || 'NONE') +
|
|
5239
|
+
(currentGuid !== DOCUMENT_GUID ? ' (overridden from baked: ' + DOCUMENT_GUID + ')' : '') +
|
|
5240
|
+
', verGuid=' + (currentVerGuid || 'NONE') +
|
|
5241
|
+
', sharedToken=' + (sharedToken || 'NONE') +
|
|
5227
5242
|
', actor=' + (LRS.actor ? (LRS.actor.name || 'anonymous') : 'none') +
|
|
5228
5243
|
', hasRefreshActor=' + (typeof LRS.refreshActor === 'function'));
|
|
5229
5244
|
}
|
|
@@ -5294,35 +5309,30 @@ function generateLrsBridgeCode(options) {
|
|
|
5294
5309
|
});
|
|
5295
5310
|
}
|
|
5296
5311
|
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
}
|
|
5310
|
-
} else {
|
|
5311
|
-
warn('Could not fetch document data from shared API - statements may fail aggregation');
|
|
5312
|
+
// ALWAYS fetch document metadata from the Bravais API.
|
|
5313
|
+
// Even if we have a baked-in GUID, we must override it with the canonical
|
|
5314
|
+
// Bravais GUID so our statements link to the same document as cloudplayer.
|
|
5315
|
+
// The baked-in GUID is a random UUID from wrap time; the Bravais GUID is
|
|
5316
|
+
// assigned at upload and is what Analytics uses for aggregation.
|
|
5317
|
+
if (sharedLinkToken) {
|
|
5318
|
+
log('Have shared link token, fetching document data via shared API...');
|
|
5319
|
+
fetchDocumentMetadata(null, function(docData) {
|
|
5320
|
+
if (docData) {
|
|
5321
|
+
updateCourseInfoFromApi(docData);
|
|
5322
|
+
if (docData.name) {
|
|
5323
|
+
LRS.courseInfo.sharedLinkName = docData.name;
|
|
5312
5324
|
}
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
// No shared link token, try with extracted document ID (requires auth)
|
|
5317
|
-
log('No shared link token, fetching document data with ID:', documentId);
|
|
5318
|
-
fetchDocDataAndReady(documentId);
|
|
5319
|
-
} else {
|
|
5320
|
-
// No identifiers available
|
|
5321
|
-
warn('No shared link token or document ID - statements may fail aggregation');
|
|
5325
|
+
} else {
|
|
5326
|
+
warn('Could not fetch document data from shared API - statements may use baked-in GUID');
|
|
5327
|
+
}
|
|
5322
5328
|
maybeEnrichAndReady();
|
|
5323
|
-
}
|
|
5329
|
+
});
|
|
5330
|
+
} else if (documentId) {
|
|
5331
|
+
log('Fetching document data with ID:', documentId);
|
|
5332
|
+
fetchDocDataAndReady(documentId);
|
|
5324
5333
|
} else {
|
|
5325
|
-
//
|
|
5334
|
+
// No identifiers available
|
|
5335
|
+
warn('No shared link token or document ID - statements will use baked-in GUID');
|
|
5326
5336
|
maybeEnrichAndReady();
|
|
5327
5337
|
}
|
|
5328
5338
|
|