@patch-adams/core 1.5.13 → 1.5.15
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 +33 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +33 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +34 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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();
|
|
@@ -2857,12 +2867,19 @@ function generateLrsBridgeCode(options) {
|
|
|
2857
2867
|
warn('Missing version GUID - statement may fail Bravais aggregation (document_version_id will be null)');
|
|
2858
2868
|
}
|
|
2859
2869
|
|
|
2870
|
+
// Use packageName (Bravais document name) as the object name when available,
|
|
2871
|
+
// so statements match the searchable document name in Bravais Analytics.
|
|
2872
|
+
// Strip .zip extension to match Bravais convention. Fall back to Rise course title.
|
|
2873
|
+
var objectName = LRS.courseInfo.packageName
|
|
2874
|
+
? LRS.courseInfo.packageName.replace(/.zip$/i, '')
|
|
2875
|
+
: decodeEntities(LRS.courseInfo.title);
|
|
2876
|
+
|
|
2860
2877
|
var obj = {
|
|
2861
2878
|
objectType: 'Activity',
|
|
2862
2879
|
id: LRS.courseInfo.id,
|
|
2863
2880
|
definition: {
|
|
2864
2881
|
type: 'http://xyleme.com/bravais/activities/document',
|
|
2865
|
-
name: { 'en-US':
|
|
2882
|
+
name: { 'en-US': objectName }
|
|
2866
2883
|
}
|
|
2867
2884
|
};
|
|
2868
2885
|
|
|
@@ -2896,6 +2913,11 @@ function generateLrsBridgeCode(options) {
|
|
|
2896
2913
|
// Resource type
|
|
2897
2914
|
obj.definition.extensions['resourceType'] = LRS.courseInfo.resourceType || 'Course';
|
|
2898
2915
|
|
|
2916
|
+
// Package name (original SCORM zip filename)
|
|
2917
|
+
if (LRS.courseInfo.packageName) {
|
|
2918
|
+
obj.definition.extensions['packageName'] = LRS.courseInfo.packageName;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2899
2921
|
return obj;
|
|
2900
2922
|
}
|
|
2901
2923
|
|
|
@@ -5361,7 +5383,8 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
5361
5383
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
5362
5384
|
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
5363
5385
|
documentGuid: lrsBridgeConfig.documentGuid,
|
|
5364
|
-
versionGuid: lrsBridgeConfig.versionGuid
|
|
5386
|
+
versionGuid: lrsBridgeConfig.versionGuid,
|
|
5387
|
+
packageName: lrsBridgeConfig.packageName
|
|
5365
5388
|
};
|
|
5366
5389
|
return {
|
|
5367
5390
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|
|
@@ -6741,6 +6764,11 @@ var Patcher = class {
|
|
|
6741
6764
|
if (effectiveSkin) {
|
|
6742
6765
|
console.log(`[Patcher] Skin: ${effectiveSkin}`);
|
|
6743
6766
|
}
|
|
6767
|
+
if (options.packageName) {
|
|
6768
|
+
this.config.lrsBridge = this.config.lrsBridge ?? {};
|
|
6769
|
+
this.config.lrsBridge.packageName = options.packageName;
|
|
6770
|
+
console.log(`[Patcher] Package name: ${options.packageName}`);
|
|
6771
|
+
}
|
|
6744
6772
|
const htmlInjector = this.getHtmlInjector(toolInfo.tool);
|
|
6745
6773
|
htmlInjector.setMetadata(metadata);
|
|
6746
6774
|
let fetchedFallbacks = {};
|
|
@@ -7034,6 +7062,7 @@ program.command("patch <input>").description("Patch a Rise course ZIP file").opt
|
|
|
7034
7062
|
if (options.jsAfter) {
|
|
7035
7063
|
patchOptions.jsAfterContent = readFileSync(resolve(options.jsAfter), "utf-8");
|
|
7036
7064
|
}
|
|
7065
|
+
patchOptions.packageName = basename(inputPath);
|
|
7037
7066
|
spinner.text = "Patching package...";
|
|
7038
7067
|
const patcher = new Patcher(validatedConfig);
|
|
7039
7068
|
const { buffer, result } = await patcher.patch(inputBuffer, patchOptions);
|