@patch-adams/core 1.5.13 → 1.5.14

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
@@ -399,7 +399,9 @@ var LrsBridgeConfigSchema = zod.z.object({
399
399
  /** Document GUID for xAPI statement aggregation - baked into package at wrap time */
400
400
  documentGuid: zod.z.string().optional(),
401
401
  /** Version GUID for xAPI statement aggregation - unique per export */
402
- versionGuid: zod.z.string().optional()
402
+ versionGuid: zod.z.string().optional(),
403
+ /** Original SCORM package filename - baked in at wrap time for LRS searchability */
404
+ packageName: zod.z.string().optional()
403
405
  });
404
406
  var BlockingAssetConfigSchema = zod.z.object({
405
407
  /** Filename for the asset */
@@ -748,6 +750,7 @@ function generateLrsBridgeCode(options) {
748
750
  const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
749
751
  const documentGuid = options.documentGuid || "";
750
752
  const versionGuid = options.versionGuid || "";
753
+ const packageName = options.packageName || "";
751
754
  return `
752
755
  // ==========================================================================
753
756
  // PATCH-ADAMS LRS BRIDGE v2.2.0
@@ -780,6 +783,7 @@ function generateLrsBridgeCode(options) {
780
783
  var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
781
784
  var DOCUMENT_GUID = '${documentGuid}';
782
785
  var VERSION_GUID = '${versionGuid}';
786
+ var PACKAGE_NAME = '${packageName}';
783
787
 
784
788
  // Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
785
789
  // Example: core-acme.bravais.com -> lrs-acme.bravais.com
@@ -2463,7 +2467,9 @@ function generateLrsBridgeCode(options) {
2463
2467
  sharedLinkName: null,
2464
2468
  // Tenant info
2465
2469
  homepage: COURSE_HOMEPAGE || window.location.origin,
2466
- tenantHomepage: null // https://{tenant}.bravais.com format
2470
+ tenantHomepage: null, // https://{tenant}.bravais.com format
2471
+ // Package info
2472
+ packageName: null // Original SCORM zip filename
2467
2473
  };
2468
2474
 
2469
2475
  // 0. Use baked-in GUIDs from PA-Patcher config (highest priority - set at wrap time)
@@ -2476,6 +2482,10 @@ function generateLrsBridgeCode(options) {
2476
2482
  info.versionGuid = VERSION_GUID;
2477
2483
  log('Version GUID from baked-in config:', VERSION_GUID);
2478
2484
  }
2485
+ if (PACKAGE_NAME) {
2486
+ info.packageName = PACKAGE_NAME;
2487
+ log('Package name from baked-in config:', PACKAGE_NAME);
2488
+ }
2479
2489
 
2480
2490
  // 1. Extract shared link token and document ID from URL
2481
2491
  info.sharedLinkToken = extractSharedLinkToken();
@@ -2906,6 +2916,11 @@ function generateLrsBridgeCode(options) {
2906
2916
  // Resource type
2907
2917
  obj.definition.extensions['resourceType'] = LRS.courseInfo.resourceType || 'Course';
2908
2918
 
2919
+ // Package name (original SCORM zip filename)
2920
+ if (LRS.courseInfo.packageName) {
2921
+ obj.definition.extensions['packageName'] = LRS.courseInfo.packageName;
2922
+ }
2923
+
2909
2924
  return obj;
2910
2925
  }
2911
2926
 
@@ -5371,7 +5386,8 @@ function buildJsBeforeOptions(config, metadata) {
5371
5386
  lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
5372
5387
  employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
5373
5388
  documentGuid: lrsBridgeConfig.documentGuid,
5374
- versionGuid: lrsBridgeConfig.versionGuid
5389
+ versionGuid: lrsBridgeConfig.versionGuid,
5390
+ packageName: lrsBridgeConfig.packageName
5375
5391
  };
5376
5392
  return {
5377
5393
  remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
@@ -6751,6 +6767,11 @@ var Patcher = class {
6751
6767
  if (effectiveSkin) {
6752
6768
  console.log(`[Patcher] Skin: ${effectiveSkin}`);
6753
6769
  }
6770
+ if (options.packageName) {
6771
+ this.config.lrsBridge = this.config.lrsBridge ?? {};
6772
+ this.config.lrsBridge.packageName = options.packageName;
6773
+ console.log(`[Patcher] Package name: ${options.packageName}`);
6774
+ }
6754
6775
  const htmlInjector = this.getHtmlInjector(toolInfo.tool);
6755
6776
  htmlInjector.setMetadata(metadata);
6756
6777
  let fetchedFallbacks = {};
@@ -7044,6 +7065,7 @@ program.command("patch <input>").description("Patch a Rise course ZIP file").opt
7044
7065
  if (options.jsAfter) {
7045
7066
  patchOptions.jsAfterContent = fs.readFileSync(path.resolve(options.jsAfter), "utf-8");
7046
7067
  }
7068
+ patchOptions.packageName = path.basename(inputPath);
7047
7069
  spinner.text = "Patching package...";
7048
7070
  const patcher = new Patcher(validatedConfig);
7049
7071
  const { buffer, result } = await patcher.patch(inputBuffer, patchOptions);