@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.js CHANGED
@@ -389,7 +389,9 @@ var LrsBridgeConfigSchema = z.object({
389
389
  /** Document GUID for xAPI statement aggregation - baked into package at wrap time */
390
390
  documentGuid: z.string().optional(),
391
391
  /** Version GUID for xAPI statement aggregation - unique per export */
392
- versionGuid: z.string().optional()
392
+ versionGuid: z.string().optional(),
393
+ /** Original SCORM package filename - baked in at wrap time for LRS searchability */
394
+ packageName: z.string().optional()
393
395
  });
394
396
  var BlockingAssetConfigSchema = z.object({
395
397
  /** Filename for the asset */
@@ -738,6 +740,7 @@ function generateLrsBridgeCode(options) {
738
740
  const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
739
741
  const documentGuid = options.documentGuid || "";
740
742
  const versionGuid = options.versionGuid || "";
743
+ const packageName = options.packageName || "";
741
744
  return `
742
745
  // ==========================================================================
743
746
  // PATCH-ADAMS LRS BRIDGE v2.2.0
@@ -770,6 +773,7 @@ function generateLrsBridgeCode(options) {
770
773
  var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
771
774
  var DOCUMENT_GUID = '${documentGuid}';
772
775
  var VERSION_GUID = '${versionGuid}';
776
+ var PACKAGE_NAME = '${packageName}';
773
777
 
774
778
  // Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
775
779
  // Example: core-acme.bravais.com -> lrs-acme.bravais.com
@@ -2453,7 +2457,9 @@ function generateLrsBridgeCode(options) {
2453
2457
  sharedLinkName: null,
2454
2458
  // Tenant info
2455
2459
  homepage: COURSE_HOMEPAGE || window.location.origin,
2456
- tenantHomepage: null // https://{tenant}.bravais.com format
2460
+ tenantHomepage: null, // https://{tenant}.bravais.com format
2461
+ // Package info
2462
+ packageName: null // Original SCORM zip filename
2457
2463
  };
2458
2464
 
2459
2465
  // 0. Use baked-in GUIDs from PA-Patcher config (highest priority - set at wrap time)
@@ -2466,6 +2472,10 @@ function generateLrsBridgeCode(options) {
2466
2472
  info.versionGuid = VERSION_GUID;
2467
2473
  log('Version GUID from baked-in config:', VERSION_GUID);
2468
2474
  }
2475
+ if (PACKAGE_NAME) {
2476
+ info.packageName = PACKAGE_NAME;
2477
+ log('Package name from baked-in config:', PACKAGE_NAME);
2478
+ }
2469
2479
 
2470
2480
  // 1. Extract shared link token and document ID from URL
2471
2481
  info.sharedLinkToken = extractSharedLinkToken();
@@ -2896,6 +2906,11 @@ function generateLrsBridgeCode(options) {
2896
2906
  // Resource type
2897
2907
  obj.definition.extensions['resourceType'] = LRS.courseInfo.resourceType || 'Course';
2898
2908
 
2909
+ // Package name (original SCORM zip filename)
2910
+ if (LRS.courseInfo.packageName) {
2911
+ obj.definition.extensions['packageName'] = LRS.courseInfo.packageName;
2912
+ }
2913
+
2899
2914
  return obj;
2900
2915
  }
2901
2916
 
@@ -5361,7 +5376,8 @@ function buildJsBeforeOptions(config, metadata) {
5361
5376
  lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
5362
5377
  employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
5363
5378
  documentGuid: lrsBridgeConfig.documentGuid,
5364
- versionGuid: lrsBridgeConfig.versionGuid
5379
+ versionGuid: lrsBridgeConfig.versionGuid,
5380
+ packageName: lrsBridgeConfig.packageName
5365
5381
  };
5366
5382
  return {
5367
5383
  remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
@@ -6741,6 +6757,11 @@ var Patcher = class {
6741
6757
  if (effectiveSkin) {
6742
6758
  console.log(`[Patcher] Skin: ${effectiveSkin}`);
6743
6759
  }
6760
+ if (options.packageName) {
6761
+ this.config.lrsBridge = this.config.lrsBridge ?? {};
6762
+ this.config.lrsBridge.packageName = options.packageName;
6763
+ console.log(`[Patcher] Package name: ${options.packageName}`);
6764
+ }
6744
6765
  const htmlInjector = this.getHtmlInjector(toolInfo.tool);
6745
6766
  htmlInjector.setMetadata(metadata);
6746
6767
  let fetchedFallbacks = {};
@@ -7034,6 +7055,7 @@ program.command("patch <input>").description("Patch a Rise course ZIP file").opt
7034
7055
  if (options.jsAfter) {
7035
7056
  patchOptions.jsAfterContent = readFileSync(resolve(options.jsAfter), "utf-8");
7036
7057
  }
7058
+ patchOptions.packageName = basename(inputPath);
7037
7059
  spinner.text = "Patching package...";
7038
7060
  const patcher = new Patcher(validatedConfig);
7039
7061
  const { buffer, result } = await patcher.patch(inputBuffer, patchOptions);