@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 +32 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +32 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +35 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +35 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,11 @@ var LrsBridgeConfigSchema = zod.z.object({
|
|
|
45
45
|
/** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
|
|
46
46
|
lrsProxyEndpoint: zod.z.string().optional(),
|
|
47
47
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
48
|
-
employeeApiEndpoint: zod.z.string().optional()
|
|
48
|
+
employeeApiEndpoint: zod.z.string().optional(),
|
|
49
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
50
|
+
documentGuid: zod.z.string().optional(),
|
|
51
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
52
|
+
versionGuid: zod.z.string().optional()
|
|
49
53
|
});
|
|
50
54
|
var BlockingAssetConfigSchema = zod.z.object({
|
|
51
55
|
/** Filename for the asset */
|
|
@@ -390,7 +394,9 @@ var DEFAULT_LRS_OPTIONS = {
|
|
|
390
394
|
autoDetectLrs: true,
|
|
391
395
|
employeeApiEndpoint: "",
|
|
392
396
|
lrsAuth: "",
|
|
393
|
-
lrsProxyEndpoint: ""
|
|
397
|
+
lrsProxyEndpoint: "",
|
|
398
|
+
documentGuid: "",
|
|
399
|
+
versionGuid: ""
|
|
394
400
|
};
|
|
395
401
|
function generateLrsBridgeCode(options) {
|
|
396
402
|
if (!options.enabled) {
|
|
@@ -404,6 +410,8 @@ function generateLrsBridgeCode(options) {
|
|
|
404
410
|
const employeeApiEndpoint = options.employeeApiEndpoint || "";
|
|
405
411
|
const lrsAuth = options.lrsAuth || "";
|
|
406
412
|
const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
|
|
413
|
+
const documentGuid = options.documentGuid || "";
|
|
414
|
+
const versionGuid = options.versionGuid || "";
|
|
407
415
|
return `
|
|
408
416
|
// ==========================================================================
|
|
409
417
|
// PATCH-ADAMS LRS BRIDGE v2.2.0
|
|
@@ -434,6 +442,8 @@ function generateLrsBridgeCode(options) {
|
|
|
434
442
|
var EMPLOYEE_API_ENDPOINT = '${employeeApiEndpoint}';
|
|
435
443
|
var LRS_AUTH = '${lrsAuth}';
|
|
436
444
|
var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
|
|
445
|
+
var DOCUMENT_GUID = '${documentGuid}';
|
|
446
|
+
var VERSION_GUID = '${versionGuid}';
|
|
437
447
|
|
|
438
448
|
// Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
|
|
439
449
|
// Example: core-acme.bravais.com -> lrs-acme.bravais.com
|
|
@@ -2079,6 +2089,17 @@ function generateLrsBridgeCode(options) {
|
|
|
2079
2089
|
tenantHomepage: null // https://{tenant}.bravais.com format
|
|
2080
2090
|
};
|
|
2081
2091
|
|
|
2092
|
+
// 0. Use baked-in GUIDs from Patch-Adams config (highest priority - set at wrap time)
|
|
2093
|
+
if (DOCUMENT_GUID) {
|
|
2094
|
+
info.guid = DOCUMENT_GUID;
|
|
2095
|
+
info.id = 'http://xyleme.com/bravais/document/' + DOCUMENT_GUID;
|
|
2096
|
+
log('Document GUID from baked-in config:', DOCUMENT_GUID);
|
|
2097
|
+
}
|
|
2098
|
+
if (VERSION_GUID) {
|
|
2099
|
+
info.versionGuid = VERSION_GUID;
|
|
2100
|
+
log('Version GUID from baked-in config:', VERSION_GUID);
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2082
2103
|
// 1. Extract shared link token and document ID from URL
|
|
2083
2104
|
info.sharedLinkToken = extractSharedLinkToken();
|
|
2084
2105
|
info.documentId = extractBravaisDocumentId();
|
|
@@ -2155,14 +2176,15 @@ function generateLrsBridgeCode(options) {
|
|
|
2155
2176
|
info.title = document.title;
|
|
2156
2177
|
}
|
|
2157
2178
|
|
|
2158
|
-
// 7. Get from PA metadata if available
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
info.
|
|
2163
|
-
info.
|
|
2164
|
-
info.
|
|
2165
|
-
info.
|
|
2179
|
+
// 7. Get from PA metadata if available (check both .courseMetadata and .course)
|
|
2180
|
+
var paMeta = (window.pa_patcher && window.pa_patcher.courseMetadata) ||
|
|
2181
|
+
(window.pa_patcher && window.pa_patcher.course) || null;
|
|
2182
|
+
if (paMeta) {
|
|
2183
|
+
info.documentId = paMeta.documentId || paMeta.courseId || info.documentId;
|
|
2184
|
+
if (!info.guid) info.guid = paMeta.guid || paMeta.courseGuid || null;
|
|
2185
|
+
if (!info.versionGuid) info.versionGuid = paMeta.versionGuid || null;
|
|
2186
|
+
info.title = (info.title === 'Rise Course') ? (paMeta.title || paMeta.courseTitle || info.title) : info.title;
|
|
2187
|
+
info.versionId = paMeta.versionId || info.versionId;
|
|
2166
2188
|
}
|
|
2167
2189
|
|
|
2168
2190
|
// 8. Build the course ID in Xyleme IRI format
|
|
@@ -4322,7 +4344,9 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
4322
4344
|
autoDetectLrs: lrsBridgeConfig.autoDetectLrs,
|
|
4323
4345
|
lrsAuth: lrsBridgeConfig.lrsAuth,
|
|
4324
4346
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
4325
|
-
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint
|
|
4347
|
+
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
4348
|
+
documentGuid: lrsBridgeConfig.documentGuid,
|
|
4349
|
+
versionGuid: lrsBridgeConfig.versionGuid
|
|
4326
4350
|
};
|
|
4327
4351
|
return {
|
|
4328
4352
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|