@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/index.js
CHANGED
|
@@ -1941,17 +1941,27 @@ function generateLrsBridgeCode(options) {
|
|
|
1941
1941
|
function updateCourseInfoFromApi(docData) {
|
|
1942
1942
|
if (!docData || !LRS.courseInfo) return;
|
|
1943
1943
|
|
|
1944
|
-
// Document GUID
|
|
1945
|
-
|
|
1944
|
+
// Document GUID \u2014 Bravais API GUID ALWAYS overrides baked-in GUID.
|
|
1945
|
+
// The baked-in GUID is a random UUID from wrap time. The Bravais GUID is the
|
|
1946
|
+
// canonical document identifier that Analytics uses to link statements to documents.
|
|
1947
|
+
// Without this override, our statements have a different object.id than cloudplayer
|
|
1948
|
+
// statements, so Analytics treats them as unrelated to the document.
|
|
1949
|
+
if (docData.guid) {
|
|
1950
|
+
var oldGuid = LRS.courseInfo.guid;
|
|
1946
1951
|
LRS.courseInfo.guid = docData.guid;
|
|
1947
1952
|
LRS.courseInfo.id = 'http://xyleme.com/bravais/document/' + docData.guid;
|
|
1948
|
-
log(
|
|
1953
|
+
// Always-visible log (not behind DEBUG) so we can confirm override in production
|
|
1954
|
+
console.info('[PA-LRS] Document GUID set from API:', docData.guid,
|
|
1955
|
+
oldGuid && oldGuid !== docData.guid ? '(was: ' + oldGuid + ')' : '');
|
|
1949
1956
|
}
|
|
1950
1957
|
|
|
1951
|
-
// Version GUID
|
|
1952
|
-
if (docData.latestVersion && docData.latestVersion.guid
|
|
1958
|
+
// Version GUID \u2014 same principle: Bravais version GUID must override baked-in
|
|
1959
|
+
if (docData.latestVersion && docData.latestVersion.guid) {
|
|
1960
|
+
if (LRS.courseInfo.versionGuid && LRS.courseInfo.versionGuid !== docData.latestVersion.guid) {
|
|
1961
|
+
log('Overriding baked-in version GUID:', LRS.courseInfo.versionGuid, '->', docData.latestVersion.guid);
|
|
1962
|
+
}
|
|
1953
1963
|
LRS.courseInfo.versionGuid = docData.latestVersion.guid;
|
|
1954
|
-
log('
|
|
1964
|
+
log('Version GUID from API:', docData.latestVersion.guid);
|
|
1955
1965
|
}
|
|
1956
1966
|
|
|
1957
1967
|
// Other metadata
|
|
@@ -2251,21 +2261,20 @@ function generateLrsBridgeCode(options) {
|
|
|
2251
2261
|
info.sharedLinkName = launchInfo.sharedLinkName || info.sharedLinkName;
|
|
2252
2262
|
}
|
|
2253
2263
|
|
|
2254
|
-
// 3b.
|
|
2255
|
-
//
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
}
|
|
2264
|
+
// 3b. Always try to extract GUIDs from Xyleme Cloud Player's internal data.
|
|
2265
|
+
// Cloud Player data is authoritative \u2014 it has the canonical Bravais GUID.
|
|
2266
|
+
// This overrides any baked-in GUID which is just a random UUID from wrap time.
|
|
2267
|
+
var cloudPlayerData = extractFromXylemeCloudPlayer();
|
|
2268
|
+
if (cloudPlayerData) {
|
|
2269
|
+
if (cloudPlayerData.guid) info.guid = cloudPlayerData.guid;
|
|
2270
|
+
if (cloudPlayerData.versionGuid) info.versionGuid = cloudPlayerData.versionGuid;
|
|
2271
|
+
info.documentId = cloudPlayerData.documentId || info.documentId;
|
|
2272
|
+
info.title = cloudPlayerData.title || info.title;
|
|
2273
|
+
log('Updated course info from Cloud Player:', {
|
|
2274
|
+
guid: info.guid,
|
|
2275
|
+
versionGuid: info.versionGuid,
|
|
2276
|
+
documentId: info.documentId
|
|
2277
|
+
});
|
|
2269
2278
|
}
|
|
2270
2279
|
|
|
2271
2280
|
// 4. Try getCourseTitle() from preloadIntegrity.js
|
|
@@ -4887,12 +4896,18 @@ function generateLrsBridgeCode(options) {
|
|
|
4887
4896
|
|
|
4888
4897
|
// Always-visible bridge summary (not gated by DEBUG)
|
|
4889
4898
|
// This ensures diagnostics are available even in production builds
|
|
4899
|
+
// Shows current GUID (may be from Cloud Player, baked-in, or pending API override)
|
|
4900
|
+
var currentGuid = LRS.courseInfo ? LRS.courseInfo.guid : DOCUMENT_GUID;
|
|
4901
|
+
var currentVerGuid = LRS.courseInfo ? LRS.courseInfo.versionGuid : VERSION_GUID;
|
|
4902
|
+
var sharedToken = LRS.courseInfo ? LRS.courseInfo.sharedLinkToken : null;
|
|
4890
4903
|
if (window.console && window.console.info) {
|
|
4891
4904
|
console.info('[PA-LRS] Bridge v' + LRS.version + ': mode=' + LRS.mode +
|
|
4892
4905
|
', endpoint=' + (LRS_ENDPOINT ? LRS_ENDPOINT.substring(0, 30) + '...' : 'NONE') +
|
|
4893
4906
|
', proxy=' + (LRS_PROXY_ENDPOINT ? 'yes' : 'no') +
|
|
4894
|
-
', docGuid=' + (
|
|
4895
|
-
'
|
|
4907
|
+
', docGuid=' + (currentGuid || 'NONE') +
|
|
4908
|
+
(currentGuid !== DOCUMENT_GUID ? ' (overridden from baked: ' + DOCUMENT_GUID + ')' : '') +
|
|
4909
|
+
', verGuid=' + (currentVerGuid || 'NONE') +
|
|
4910
|
+
', sharedToken=' + (sharedToken || 'NONE') +
|
|
4896
4911
|
', actor=' + (LRS.actor ? (LRS.actor.name || 'anonymous') : 'none') +
|
|
4897
4912
|
', hasRefreshActor=' + (typeof LRS.refreshActor === 'function'));
|
|
4898
4913
|
}
|
|
@@ -4963,35 +4978,30 @@ function generateLrsBridgeCode(options) {
|
|
|
4963
4978
|
});
|
|
4964
4979
|
}
|
|
4965
4980
|
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
}
|
|
4979
|
-
} else {
|
|
4980
|
-
warn('Could not fetch document data from shared API - statements may fail aggregation');
|
|
4981
|
+
// ALWAYS fetch document metadata from the Bravais API.
|
|
4982
|
+
// Even if we have a baked-in GUID, we must override it with the canonical
|
|
4983
|
+
// Bravais GUID so our statements link to the same document as cloudplayer.
|
|
4984
|
+
// The baked-in GUID is a random UUID from wrap time; the Bravais GUID is
|
|
4985
|
+
// assigned at upload and is what Analytics uses for aggregation.
|
|
4986
|
+
if (sharedLinkToken) {
|
|
4987
|
+
log('Have shared link token, fetching document data via shared API...');
|
|
4988
|
+
fetchDocumentMetadata(null, function(docData) {
|
|
4989
|
+
if (docData) {
|
|
4990
|
+
updateCourseInfoFromApi(docData);
|
|
4991
|
+
if (docData.name) {
|
|
4992
|
+
LRS.courseInfo.sharedLinkName = docData.name;
|
|
4981
4993
|
}
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
// No shared link token, try with extracted document ID (requires auth)
|
|
4986
|
-
log('No shared link token, fetching document data with ID:', documentId);
|
|
4987
|
-
fetchDocDataAndReady(documentId);
|
|
4988
|
-
} else {
|
|
4989
|
-
// No identifiers available
|
|
4990
|
-
warn('No shared link token or document ID - statements may fail aggregation');
|
|
4994
|
+
} else {
|
|
4995
|
+
warn('Could not fetch document data from shared API - statements may use baked-in GUID');
|
|
4996
|
+
}
|
|
4991
4997
|
maybeEnrichAndReady();
|
|
4992
|
-
}
|
|
4998
|
+
});
|
|
4999
|
+
} else if (documentId) {
|
|
5000
|
+
log('Fetching document data with ID:', documentId);
|
|
5001
|
+
fetchDocDataAndReady(documentId);
|
|
4993
5002
|
} else {
|
|
4994
|
-
//
|
|
5003
|
+
// No identifiers available
|
|
5004
|
+
warn('No shared link token or document ID - statements will use baked-in GUID');
|
|
4995
5005
|
maybeEnrichAndReady();
|
|
4996
5006
|
}
|
|
4997
5007
|
|