@patch-adams/core 1.4.21 → 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 CHANGED
@@ -393,7 +393,11 @@ var LrsBridgeConfigSchema = zod.z.object({
393
393
  /** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
394
394
  lrsProxyEndpoint: zod.z.string().optional(),
395
395
  /** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
396
- employeeApiEndpoint: zod.z.string().optional()
396
+ employeeApiEndpoint: zod.z.string().optional(),
397
+ /** Document GUID for xAPI statement aggregation - baked into package at wrap time */
398
+ documentGuid: zod.z.string().optional(),
399
+ /** Version GUID for xAPI statement aggregation - unique per export */
400
+ versionGuid: zod.z.string().optional()
397
401
  });
398
402
  var BlockingAssetConfigSchema = zod.z.object({
399
403
  /** Filename for the asset */
@@ -738,6 +742,8 @@ function generateLrsBridgeCode(options) {
738
742
  const employeeApiEndpoint = options.employeeApiEndpoint || "";
739
743
  const lrsAuth = options.lrsAuth || "";
740
744
  const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
745
+ const documentGuid = options.documentGuid || "";
746
+ const versionGuid = options.versionGuid || "";
741
747
  return `
742
748
  // ==========================================================================
743
749
  // PATCH-ADAMS LRS BRIDGE v2.2.0
@@ -768,6 +774,8 @@ function generateLrsBridgeCode(options) {
768
774
  var EMPLOYEE_API_ENDPOINT = '${employeeApiEndpoint}';
769
775
  var LRS_AUTH = '${lrsAuth}';
770
776
  var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
777
+ var DOCUMENT_GUID = '${documentGuid}';
778
+ var VERSION_GUID = '${versionGuid}';
771
779
 
772
780
  // Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
773
781
  // Example: core-acme.bravais.com -> lrs-acme.bravais.com
@@ -2413,6 +2421,17 @@ function generateLrsBridgeCode(options) {
2413
2421
  tenantHomepage: null // https://{tenant}.bravais.com format
2414
2422
  };
2415
2423
 
2424
+ // 0. Use baked-in GUIDs from Patch-Adams config (highest priority - set at wrap time)
2425
+ if (DOCUMENT_GUID) {
2426
+ info.guid = DOCUMENT_GUID;
2427
+ info.id = 'http://xyleme.com/bravais/document/' + DOCUMENT_GUID;
2428
+ log('Document GUID from baked-in config:', DOCUMENT_GUID);
2429
+ }
2430
+ if (VERSION_GUID) {
2431
+ info.versionGuid = VERSION_GUID;
2432
+ log('Version GUID from baked-in config:', VERSION_GUID);
2433
+ }
2434
+
2416
2435
  // 1. Extract shared link token and document ID from URL
2417
2436
  info.sharedLinkToken = extractSharedLinkToken();
2418
2437
  info.documentId = extractBravaisDocumentId();
@@ -2489,14 +2508,15 @@ function generateLrsBridgeCode(options) {
2489
2508
  info.title = document.title;
2490
2509
  }
2491
2510
 
2492
- // 7. Get from PA metadata if available
2493
- if (window.pa_patcher && window.pa_patcher.courseMetadata) {
2494
- var meta = window.pa_patcher.courseMetadata;
2495
- info.documentId = meta.documentId || meta.courseId || info.documentId;
2496
- info.guid = meta.guid || meta.courseGuid || info.guid;
2497
- info.versionGuid = meta.versionGuid || info.versionGuid;
2498
- info.title = meta.title || meta.courseTitle || info.title;
2499
- info.versionId = meta.versionId || info.versionId;
2511
+ // 7. Get from PA metadata if available (check both .courseMetadata and .course)
2512
+ var paMeta = (window.pa_patcher && window.pa_patcher.courseMetadata) ||
2513
+ (window.pa_patcher && window.pa_patcher.course) || null;
2514
+ if (paMeta) {
2515
+ info.documentId = paMeta.documentId || paMeta.courseId || info.documentId;
2516
+ if (!info.guid) info.guid = paMeta.guid || paMeta.courseGuid || null;
2517
+ if (!info.versionGuid) info.versionGuid = paMeta.versionGuid || null;
2518
+ info.title = (info.title === 'Rise Course') ? (paMeta.title || paMeta.courseTitle || info.title) : info.title;
2519
+ info.versionId = paMeta.versionId || info.versionId;
2500
2520
  }
2501
2521
 
2502
2522
  // 8. Build the course ID in Xyleme IRI format
@@ -4656,7 +4676,9 @@ function buildJsBeforeOptions(config, metadata) {
4656
4676
  autoDetectLrs: lrsBridgeConfig.autoDetectLrs,
4657
4677
  lrsAuth: lrsBridgeConfig.lrsAuth,
4658
4678
  lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
4659
- employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint
4679
+ employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
4680
+ documentGuid: lrsBridgeConfig.documentGuid,
4681
+ versionGuid: lrsBridgeConfig.versionGuid
4660
4682
  };
4661
4683
  return {
4662
4684
  remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,