@patch-adams/core 1.4.20 → 1.4.22
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 +60 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +60 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +63 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +63 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -384,7 +384,11 @@ var LrsBridgeConfigSchema = z.object({
|
|
|
384
384
|
/** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
|
|
385
385
|
lrsProxyEndpoint: z.string().optional(),
|
|
386
386
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
387
|
-
employeeApiEndpoint: z.string().optional()
|
|
387
|
+
employeeApiEndpoint: z.string().optional(),
|
|
388
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
389
|
+
documentGuid: z.string().optional(),
|
|
390
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
391
|
+
versionGuid: z.string().optional()
|
|
388
392
|
});
|
|
389
393
|
var BlockingAssetConfigSchema = z.object({
|
|
390
394
|
/** Filename for the asset */
|
|
@@ -729,6 +733,8 @@ function generateLrsBridgeCode(options) {
|
|
|
729
733
|
const employeeApiEndpoint = options.employeeApiEndpoint || "";
|
|
730
734
|
const lrsAuth = options.lrsAuth || "";
|
|
731
735
|
const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
|
|
736
|
+
const documentGuid = options.documentGuid || "";
|
|
737
|
+
const versionGuid = options.versionGuid || "";
|
|
732
738
|
return `
|
|
733
739
|
// ==========================================================================
|
|
734
740
|
// PATCH-ADAMS LRS BRIDGE v2.2.0
|
|
@@ -759,6 +765,8 @@ function generateLrsBridgeCode(options) {
|
|
|
759
765
|
var EMPLOYEE_API_ENDPOINT = '${employeeApiEndpoint}';
|
|
760
766
|
var LRS_AUTH = '${lrsAuth}';
|
|
761
767
|
var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
|
|
768
|
+
var DOCUMENT_GUID = '${documentGuid}';
|
|
769
|
+
var VERSION_GUID = '${versionGuid}';
|
|
762
770
|
|
|
763
771
|
// Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
|
|
764
772
|
// Example: core-acme.bravais.com -> lrs-acme.bravais.com
|
|
@@ -2404,6 +2412,17 @@ function generateLrsBridgeCode(options) {
|
|
|
2404
2412
|
tenantHomepage: null // https://{tenant}.bravais.com format
|
|
2405
2413
|
};
|
|
2406
2414
|
|
|
2415
|
+
// 0. Use baked-in GUIDs from Patch-Adams config (highest priority - set at wrap time)
|
|
2416
|
+
if (DOCUMENT_GUID) {
|
|
2417
|
+
info.guid = DOCUMENT_GUID;
|
|
2418
|
+
info.id = 'http://xyleme.com/bravais/document/' + DOCUMENT_GUID;
|
|
2419
|
+
log('Document GUID from baked-in config:', DOCUMENT_GUID);
|
|
2420
|
+
}
|
|
2421
|
+
if (VERSION_GUID) {
|
|
2422
|
+
info.versionGuid = VERSION_GUID;
|
|
2423
|
+
log('Version GUID from baked-in config:', VERSION_GUID);
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2407
2426
|
// 1. Extract shared link token and document ID from URL
|
|
2408
2427
|
info.sharedLinkToken = extractSharedLinkToken();
|
|
2409
2428
|
info.documentId = extractBravaisDocumentId();
|
|
@@ -2480,14 +2499,15 @@ function generateLrsBridgeCode(options) {
|
|
|
2480
2499
|
info.title = document.title;
|
|
2481
2500
|
}
|
|
2482
2501
|
|
|
2483
|
-
// 7. Get from PA metadata if available
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
info.
|
|
2488
|
-
info.
|
|
2489
|
-
info.
|
|
2490
|
-
info.
|
|
2502
|
+
// 7. Get from PA metadata if available (check both .courseMetadata and .course)
|
|
2503
|
+
var paMeta = (window.pa_patcher && window.pa_patcher.courseMetadata) ||
|
|
2504
|
+
(window.pa_patcher && window.pa_patcher.course) || null;
|
|
2505
|
+
if (paMeta) {
|
|
2506
|
+
info.documentId = paMeta.documentId || paMeta.courseId || info.documentId;
|
|
2507
|
+
if (!info.guid) info.guid = paMeta.guid || paMeta.courseGuid || null;
|
|
2508
|
+
if (!info.versionGuid) info.versionGuid = paMeta.versionGuid || null;
|
|
2509
|
+
info.title = (info.title === 'Rise Course') ? (paMeta.title || paMeta.courseTitle || info.title) : info.title;
|
|
2510
|
+
info.versionId = paMeta.versionId || info.versionId;
|
|
2491
2511
|
}
|
|
2492
2512
|
|
|
2493
2513
|
// 8. Build the course ID in Xyleme IRI format
|
|
@@ -3614,6 +3634,34 @@ function generateLrsBridgeCode(options) {
|
|
|
3614
3634
|
sendStatement(statement);
|
|
3615
3635
|
};
|
|
3616
3636
|
|
|
3637
|
+
/**
|
|
3638
|
+
* Re-extract actor from SCORM after LMSInitialize has been called.
|
|
3639
|
+
* Call this from the SCORM wrapper after scormInit() succeeds,
|
|
3640
|
+
* because the bridge initializes in <head> before LMSInitialize runs.
|
|
3641
|
+
*/
|
|
3642
|
+
LRS.refreshActor = function(callback) {
|
|
3643
|
+
log('refreshActor called - re-extracting from SCORM...');
|
|
3644
|
+
var previousName = LRS.actor ? LRS.actor.name : 'none';
|
|
3645
|
+
|
|
3646
|
+
// Re-run sync extraction (SCORM data should now be available)
|
|
3647
|
+
var newActor = extractActor();
|
|
3648
|
+
|
|
3649
|
+
if (isValidActor(newActor) && newActor.account && newActor.account.name !== 'unknown') {
|
|
3650
|
+
log('refreshActor: got valid actor:', newActor.name, newActor.account ? newActor.account.name : '');
|
|
3651
|
+
// Enhance with email lookup (async)
|
|
3652
|
+
extractActorAsync(function(enhancedActor) {
|
|
3653
|
+
if (window.console && window.console.info) {
|
|
3654
|
+
console.info('[PA-LRS] Actor refreshed: ' + previousName + ' -> ' + enhancedActor.name +
|
|
3655
|
+
(enhancedActor.mbox ? ' (' + enhancedActor.mbox + ')' : ''));
|
|
3656
|
+
}
|
|
3657
|
+
if (callback) callback(enhancedActor);
|
|
3658
|
+
});
|
|
3659
|
+
} else {
|
|
3660
|
+
log('refreshActor: no valid actor found after re-extraction');
|
|
3661
|
+
if (callback) callback(LRS.actor);
|
|
3662
|
+
}
|
|
3663
|
+
};
|
|
3664
|
+
|
|
3617
3665
|
// Course terminated/exited
|
|
3618
3666
|
LRS.courseTerminated = function() {
|
|
3619
3667
|
// Calculate duration
|
|
@@ -4619,7 +4667,9 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
4619
4667
|
autoDetectLrs: lrsBridgeConfig.autoDetectLrs,
|
|
4620
4668
|
lrsAuth: lrsBridgeConfig.lrsAuth,
|
|
4621
4669
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
4622
|
-
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint
|
|
4670
|
+
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
4671
|
+
documentGuid: lrsBridgeConfig.documentGuid,
|
|
4672
|
+
versionGuid: lrsBridgeConfig.versionGuid
|
|
4623
4673
|
};
|
|
4624
4674
|
return {
|
|
4625
4675
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|