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