@patch-adams/core 1.4.21 → 1.4.23
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 +55 -12
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +55 -12
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +58 -13
- 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 +58 -13
- 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
|
|
@@ -3620,6 +3640,24 @@ function generateLrsBridgeCode(options) {
|
|
|
3620
3640
|
* because the bridge initializes in <head> before LMSInitialize runs.
|
|
3621
3641
|
*/
|
|
3622
3642
|
LRS.refreshActor = function(callback) {
|
|
3643
|
+
// Always-visible diagnostic: confirm refreshActor is being called and show SCORM data (TEMPORARY)
|
|
3644
|
+
if (window.console && window.console.info) {
|
|
3645
|
+
var scormId = 'n/a', scormName = 'n/a';
|
|
3646
|
+
if (LRS.scormApi) {
|
|
3647
|
+
try {
|
|
3648
|
+
scormId = LRS.scormApiType === '2004'
|
|
3649
|
+
? LRS.scormApi.GetValue('cmi.learner_id')
|
|
3650
|
+
: LRS.scormApi.LMSGetValue('cmi.core.student_id');
|
|
3651
|
+
scormName = LRS.scormApiType === '2004'
|
|
3652
|
+
? LRS.scormApi.GetValue('cmi.learner_name')
|
|
3653
|
+
: LRS.scormApi.LMSGetValue('cmi.core.student_name');
|
|
3654
|
+
} catch(e) { scormId = 'error'; scormName = 'error'; }
|
|
3655
|
+
}
|
|
3656
|
+
console.info('[PA-LRS] refreshActor called. SCORM API=' + (LRS.scormApi ? 'found' : 'MISSING') +
|
|
3657
|
+
', student_id=' + scormId +
|
|
3658
|
+
', student_name=' + scormName +
|
|
3659
|
+
', previous actor=' + (LRS.actor ? LRS.actor.name : 'none'));
|
|
3660
|
+
}
|
|
3623
3661
|
log('refreshActor called - re-extracting from SCORM...');
|
|
3624
3662
|
var previousName = LRS.actor ? LRS.actor.name : 'none';
|
|
3625
3663
|
|
|
@@ -4367,10 +4405,13 @@ function generateLrsBridgeCode(options) {
|
|
|
4367
4405
|
// Always-visible bridge summary (not gated by DEBUG)
|
|
4368
4406
|
// This ensures diagnostics are available even in production builds
|
|
4369
4407
|
if (window.console && window.console.info) {
|
|
4370
|
-
console.info('[PA-LRS] Bridge: mode=' + LRS.mode +
|
|
4408
|
+
console.info('[PA-LRS] Bridge v' + LRS.version + ': mode=' + LRS.mode +
|
|
4371
4409
|
', endpoint=' + (LRS_ENDPOINT ? LRS_ENDPOINT.substring(0, 30) + '...' : 'NONE') +
|
|
4372
4410
|
', proxy=' + (LRS_PROXY_ENDPOINT ? 'yes' : 'no') +
|
|
4373
|
-
',
|
|
4411
|
+
', docGuid=' + (DOCUMENT_GUID || 'NONE') +
|
|
4412
|
+
', verGuid=' + (VERSION_GUID || 'NONE') +
|
|
4413
|
+
', actor=' + (LRS.actor ? (LRS.actor.name || 'anonymous') : 'none') +
|
|
4414
|
+
', hasRefreshActor=' + (typeof LRS.refreshActor === 'function'));
|
|
4374
4415
|
}
|
|
4375
4416
|
|
|
4376
4417
|
// Set up event interceptors
|
|
@@ -4647,7 +4688,9 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
4647
4688
|
autoDetectLrs: lrsBridgeConfig.autoDetectLrs,
|
|
4648
4689
|
lrsAuth: lrsBridgeConfig.lrsAuth,
|
|
4649
4690
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
4650
|
-
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint
|
|
4691
|
+
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
4692
|
+
documentGuid: lrsBridgeConfig.documentGuid,
|
|
4693
|
+
versionGuid: lrsBridgeConfig.versionGuid
|
|
4651
4694
|
};
|
|
4652
4695
|
return {
|
|
4653
4696
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|