@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.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
|
|
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();
|
|
@@ -2867,12 +2877,19 @@ function generateLrsBridgeCode(options) {
|
|
|
2867
2877
|
warn('Missing version GUID - statement may fail Bravais aggregation (document_version_id will be null)');
|
|
2868
2878
|
}
|
|
2869
2879
|
|
|
2880
|
+
// Use packageName (Bravais document name) as the object name when available,
|
|
2881
|
+
// so statements match the searchable document name in Bravais Analytics.
|
|
2882
|
+
// Strip .zip extension to match Bravais convention. Fall back to Rise course title.
|
|
2883
|
+
var objectName = LRS.courseInfo.packageName
|
|
2884
|
+
? LRS.courseInfo.packageName.replace(/.zip$/i, '')
|
|
2885
|
+
: decodeEntities(LRS.courseInfo.title);
|
|
2886
|
+
|
|
2870
2887
|
var obj = {
|
|
2871
2888
|
objectType: 'Activity',
|
|
2872
2889
|
id: LRS.courseInfo.id,
|
|
2873
2890
|
definition: {
|
|
2874
2891
|
type: 'http://xyleme.com/bravais/activities/document',
|
|
2875
|
-
name: { 'en-US':
|
|
2892
|
+
name: { 'en-US': objectName }
|
|
2876
2893
|
}
|
|
2877
2894
|
};
|
|
2878
2895
|
|
|
@@ -2906,6 +2923,11 @@ function generateLrsBridgeCode(options) {
|
|
|
2906
2923
|
// Resource type
|
|
2907
2924
|
obj.definition.extensions['resourceType'] = LRS.courseInfo.resourceType || 'Course';
|
|
2908
2925
|
|
|
2926
|
+
// Package name (original SCORM zip filename)
|
|
2927
|
+
if (LRS.courseInfo.packageName) {
|
|
2928
|
+
obj.definition.extensions['packageName'] = LRS.courseInfo.packageName;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2909
2931
|
return obj;
|
|
2910
2932
|
}
|
|
2911
2933
|
|
|
@@ -5371,7 +5393,8 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
5371
5393
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
5372
5394
|
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
5373
5395
|
documentGuid: lrsBridgeConfig.documentGuid,
|
|
5374
|
-
versionGuid: lrsBridgeConfig.versionGuid
|
|
5396
|
+
versionGuid: lrsBridgeConfig.versionGuid,
|
|
5397
|
+
packageName: lrsBridgeConfig.packageName
|
|
5375
5398
|
};
|
|
5376
5399
|
return {
|
|
5377
5400
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|
|
@@ -6751,6 +6774,11 @@ var Patcher = class {
|
|
|
6751
6774
|
if (effectiveSkin) {
|
|
6752
6775
|
console.log(`[Patcher] Skin: ${effectiveSkin}`);
|
|
6753
6776
|
}
|
|
6777
|
+
if (options.packageName) {
|
|
6778
|
+
this.config.lrsBridge = this.config.lrsBridge ?? {};
|
|
6779
|
+
this.config.lrsBridge.packageName = options.packageName;
|
|
6780
|
+
console.log(`[Patcher] Package name: ${options.packageName}`);
|
|
6781
|
+
}
|
|
6754
6782
|
const htmlInjector = this.getHtmlInjector(toolInfo.tool);
|
|
6755
6783
|
htmlInjector.setMetadata(metadata);
|
|
6756
6784
|
let fetchedFallbacks = {};
|
|
@@ -7044,6 +7072,7 @@ program.command("patch <input>").description("Patch a Rise course ZIP file").opt
|
|
|
7044
7072
|
if (options.jsAfter) {
|
|
7045
7073
|
patchOptions.jsAfterContent = fs.readFileSync(path.resolve(options.jsAfter), "utf-8");
|
|
7046
7074
|
}
|
|
7075
|
+
patchOptions.packageName = path.basename(inputPath);
|
|
7047
7076
|
spinner.text = "Patching package...";
|
|
7048
7077
|
const patcher = new Patcher(validatedConfig);
|
|
7049
7078
|
const { buffer, result } = await patcher.patch(inputBuffer, patchOptions);
|