@patch-adams/core 1.4.21 → 1.4.23
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 +55 -12
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +55 -12
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +58 -13
- 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 +58 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -34,6 +34,10 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
34
34
|
lrsProxyEndpoint: z.ZodOptional<z.ZodString>;
|
|
35
35
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
36
36
|
employeeApiEndpoint: z.ZodOptional<z.ZodString>;
|
|
37
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
38
|
+
documentGuid: z.ZodOptional<z.ZodString>;
|
|
39
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
40
|
+
versionGuid: z.ZodOptional<z.ZodString>;
|
|
37
41
|
}, "strip", z.ZodTypeAny, {
|
|
38
42
|
enabled: boolean;
|
|
39
43
|
trackMedia: boolean;
|
|
@@ -49,6 +53,8 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
49
53
|
lrsAuth?: string | undefined;
|
|
50
54
|
lrsProxyEndpoint?: string | undefined;
|
|
51
55
|
employeeApiEndpoint?: string | undefined;
|
|
56
|
+
documentGuid?: string | undefined;
|
|
57
|
+
versionGuid?: string | undefined;
|
|
52
58
|
}, {
|
|
53
59
|
enabled?: boolean | undefined;
|
|
54
60
|
trackMedia?: boolean | undefined;
|
|
@@ -64,6 +70,8 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
64
70
|
lrsAuth?: string | undefined;
|
|
65
71
|
lrsProxyEndpoint?: string | undefined;
|
|
66
72
|
employeeApiEndpoint?: string | undefined;
|
|
73
|
+
documentGuid?: string | undefined;
|
|
74
|
+
versionGuid?: string | undefined;
|
|
67
75
|
}>;
|
|
68
76
|
/**
|
|
69
77
|
* Configuration for a blocking asset (CSS before, JS before)
|
|
@@ -233,6 +241,10 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
233
241
|
lrsProxyEndpoint: z.ZodOptional<z.ZodString>;
|
|
234
242
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
235
243
|
employeeApiEndpoint: z.ZodOptional<z.ZodString>;
|
|
244
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
245
|
+
documentGuid: z.ZodOptional<z.ZodString>;
|
|
246
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
247
|
+
versionGuid: z.ZodOptional<z.ZodString>;
|
|
236
248
|
}, "strip", z.ZodTypeAny, {
|
|
237
249
|
enabled: boolean;
|
|
238
250
|
trackMedia: boolean;
|
|
@@ -248,6 +260,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
248
260
|
lrsAuth?: string | undefined;
|
|
249
261
|
lrsProxyEndpoint?: string | undefined;
|
|
250
262
|
employeeApiEndpoint?: string | undefined;
|
|
263
|
+
documentGuid?: string | undefined;
|
|
264
|
+
versionGuid?: string | undefined;
|
|
251
265
|
}, {
|
|
252
266
|
enabled?: boolean | undefined;
|
|
253
267
|
trackMedia?: boolean | undefined;
|
|
@@ -263,6 +277,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
263
277
|
lrsAuth?: string | undefined;
|
|
264
278
|
lrsProxyEndpoint?: string | undefined;
|
|
265
279
|
employeeApiEndpoint?: string | undefined;
|
|
280
|
+
documentGuid?: string | undefined;
|
|
281
|
+
versionGuid?: string | undefined;
|
|
266
282
|
}>>;
|
|
267
283
|
/** Plugin configurations - each plugin is keyed by its name */
|
|
268
284
|
plugins: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -318,6 +334,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
318
334
|
lrsAuth?: string | undefined;
|
|
319
335
|
lrsProxyEndpoint?: string | undefined;
|
|
320
336
|
employeeApiEndpoint?: string | undefined;
|
|
337
|
+
documentGuid?: string | undefined;
|
|
338
|
+
versionGuid?: string | undefined;
|
|
321
339
|
};
|
|
322
340
|
plugins: Record<string, z.objectOutputType<{
|
|
323
341
|
/** Whether this plugin is enabled */
|
|
@@ -366,6 +384,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
366
384
|
lrsAuth?: string | undefined;
|
|
367
385
|
lrsProxyEndpoint?: string | undefined;
|
|
368
386
|
employeeApiEndpoint?: string | undefined;
|
|
387
|
+
documentGuid?: string | undefined;
|
|
388
|
+
versionGuid?: string | undefined;
|
|
369
389
|
} | undefined;
|
|
370
390
|
plugins?: Record<string, z.objectInputType<{
|
|
371
391
|
/** Whether this plugin is enabled */
|
|
@@ -984,6 +1004,10 @@ interface LrsBridgeOptions {
|
|
|
984
1004
|
lrsAuth?: string;
|
|
985
1005
|
/** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
|
|
986
1006
|
lrsProxyEndpoint?: string;
|
|
1007
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
1008
|
+
documentGuid?: string;
|
|
1009
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
1010
|
+
versionGuid?: string;
|
|
987
1011
|
}
|
|
988
1012
|
declare const DEFAULT_LRS_OPTIONS: LrsBridgeOptions;
|
|
989
1013
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
34
34
|
lrsProxyEndpoint: z.ZodOptional<z.ZodString>;
|
|
35
35
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
36
36
|
employeeApiEndpoint: z.ZodOptional<z.ZodString>;
|
|
37
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
38
|
+
documentGuid: z.ZodOptional<z.ZodString>;
|
|
39
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
40
|
+
versionGuid: z.ZodOptional<z.ZodString>;
|
|
37
41
|
}, "strip", z.ZodTypeAny, {
|
|
38
42
|
enabled: boolean;
|
|
39
43
|
trackMedia: boolean;
|
|
@@ -49,6 +53,8 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
49
53
|
lrsAuth?: string | undefined;
|
|
50
54
|
lrsProxyEndpoint?: string | undefined;
|
|
51
55
|
employeeApiEndpoint?: string | undefined;
|
|
56
|
+
documentGuid?: string | undefined;
|
|
57
|
+
versionGuid?: string | undefined;
|
|
52
58
|
}, {
|
|
53
59
|
enabled?: boolean | undefined;
|
|
54
60
|
trackMedia?: boolean | undefined;
|
|
@@ -64,6 +70,8 @@ declare const LrsBridgeConfigSchema: z.ZodObject<{
|
|
|
64
70
|
lrsAuth?: string | undefined;
|
|
65
71
|
lrsProxyEndpoint?: string | undefined;
|
|
66
72
|
employeeApiEndpoint?: string | undefined;
|
|
73
|
+
documentGuid?: string | undefined;
|
|
74
|
+
versionGuid?: string | undefined;
|
|
67
75
|
}>;
|
|
68
76
|
/**
|
|
69
77
|
* Configuration for a blocking asset (CSS before, JS before)
|
|
@@ -233,6 +241,10 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
233
241
|
lrsProxyEndpoint: z.ZodOptional<z.ZodString>;
|
|
234
242
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
235
243
|
employeeApiEndpoint: z.ZodOptional<z.ZodString>;
|
|
244
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
245
|
+
documentGuid: z.ZodOptional<z.ZodString>;
|
|
246
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
247
|
+
versionGuid: z.ZodOptional<z.ZodString>;
|
|
236
248
|
}, "strip", z.ZodTypeAny, {
|
|
237
249
|
enabled: boolean;
|
|
238
250
|
trackMedia: boolean;
|
|
@@ -248,6 +260,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
248
260
|
lrsAuth?: string | undefined;
|
|
249
261
|
lrsProxyEndpoint?: string | undefined;
|
|
250
262
|
employeeApiEndpoint?: string | undefined;
|
|
263
|
+
documentGuid?: string | undefined;
|
|
264
|
+
versionGuid?: string | undefined;
|
|
251
265
|
}, {
|
|
252
266
|
enabled?: boolean | undefined;
|
|
253
267
|
trackMedia?: boolean | undefined;
|
|
@@ -263,6 +277,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
263
277
|
lrsAuth?: string | undefined;
|
|
264
278
|
lrsProxyEndpoint?: string | undefined;
|
|
265
279
|
employeeApiEndpoint?: string | undefined;
|
|
280
|
+
documentGuid?: string | undefined;
|
|
281
|
+
versionGuid?: string | undefined;
|
|
266
282
|
}>>;
|
|
267
283
|
/** Plugin configurations - each plugin is keyed by its name */
|
|
268
284
|
plugins: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -318,6 +334,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
318
334
|
lrsAuth?: string | undefined;
|
|
319
335
|
lrsProxyEndpoint?: string | undefined;
|
|
320
336
|
employeeApiEndpoint?: string | undefined;
|
|
337
|
+
documentGuid?: string | undefined;
|
|
338
|
+
versionGuid?: string | undefined;
|
|
321
339
|
};
|
|
322
340
|
plugins: Record<string, z.objectOutputType<{
|
|
323
341
|
/** Whether this plugin is enabled */
|
|
@@ -366,6 +384,8 @@ declare const PatchAdamsConfigSchema: z.ZodObject<{
|
|
|
366
384
|
lrsAuth?: string | undefined;
|
|
367
385
|
lrsProxyEndpoint?: string | undefined;
|
|
368
386
|
employeeApiEndpoint?: string | undefined;
|
|
387
|
+
documentGuid?: string | undefined;
|
|
388
|
+
versionGuid?: string | undefined;
|
|
369
389
|
} | undefined;
|
|
370
390
|
plugins?: Record<string, z.objectInputType<{
|
|
371
391
|
/** Whether this plugin is enabled */
|
|
@@ -984,6 +1004,10 @@ interface LrsBridgeOptions {
|
|
|
984
1004
|
lrsAuth?: string;
|
|
985
1005
|
/** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
|
|
986
1006
|
lrsProxyEndpoint?: string;
|
|
1007
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
1008
|
+
documentGuid?: string;
|
|
1009
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
1010
|
+
versionGuid?: string;
|
|
987
1011
|
}
|
|
988
1012
|
declare const DEFAULT_LRS_OPTIONS: LrsBridgeOptions;
|
|
989
1013
|
/**
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,11 @@ var LrsBridgeConfigSchema = z.object({
|
|
|
37
37
|
/** LRS proxy endpoint URL - statements are sent here instead of direct LRS, proxy handles auth server-side */
|
|
38
38
|
lrsProxyEndpoint: z.string().optional(),
|
|
39
39
|
/** Employee API endpoint URL for user identity lookup (e.g., https://node.example.com/admin_api/users/employees/) */
|
|
40
|
-
employeeApiEndpoint: z.string().optional()
|
|
40
|
+
employeeApiEndpoint: z.string().optional(),
|
|
41
|
+
/** Document GUID for xAPI statement aggregation - baked into package at wrap time */
|
|
42
|
+
documentGuid: z.string().optional(),
|
|
43
|
+
/** Version GUID for xAPI statement aggregation - unique per export */
|
|
44
|
+
versionGuid: z.string().optional()
|
|
41
45
|
});
|
|
42
46
|
var BlockingAssetConfigSchema = z.object({
|
|
43
47
|
/** Filename for the asset */
|
|
@@ -382,7 +386,9 @@ var DEFAULT_LRS_OPTIONS = {
|
|
|
382
386
|
autoDetectLrs: true,
|
|
383
387
|
employeeApiEndpoint: "",
|
|
384
388
|
lrsAuth: "",
|
|
385
|
-
lrsProxyEndpoint: ""
|
|
389
|
+
lrsProxyEndpoint: "",
|
|
390
|
+
documentGuid: "",
|
|
391
|
+
versionGuid: ""
|
|
386
392
|
};
|
|
387
393
|
function generateLrsBridgeCode(options) {
|
|
388
394
|
if (!options.enabled) {
|
|
@@ -396,6 +402,8 @@ function generateLrsBridgeCode(options) {
|
|
|
396
402
|
const employeeApiEndpoint = options.employeeApiEndpoint || "";
|
|
397
403
|
const lrsAuth = options.lrsAuth || "";
|
|
398
404
|
const lrsProxyEndpoint = options.lrsProxyEndpoint || "";
|
|
405
|
+
const documentGuid = options.documentGuid || "";
|
|
406
|
+
const versionGuid = options.versionGuid || "";
|
|
399
407
|
return `
|
|
400
408
|
// ==========================================================================
|
|
401
409
|
// PATCH-ADAMS LRS BRIDGE v2.2.0
|
|
@@ -426,6 +434,8 @@ function generateLrsBridgeCode(options) {
|
|
|
426
434
|
var EMPLOYEE_API_ENDPOINT = '${employeeApiEndpoint}';
|
|
427
435
|
var LRS_AUTH = '${lrsAuth}';
|
|
428
436
|
var LRS_PROXY_ENDPOINT = '${lrsProxyEndpoint}';
|
|
437
|
+
var DOCUMENT_GUID = '${documentGuid}';
|
|
438
|
+
var VERSION_GUID = '${versionGuid}';
|
|
429
439
|
|
|
430
440
|
// Bravais LRS endpoint pattern: https://lrs-{tenant}.bravais.com/XAPI/statements
|
|
431
441
|
// Example: core-acme.bravais.com -> lrs-acme.bravais.com
|
|
@@ -2071,6 +2081,17 @@ function generateLrsBridgeCode(options) {
|
|
|
2071
2081
|
tenantHomepage: null // https://{tenant}.bravais.com format
|
|
2072
2082
|
};
|
|
2073
2083
|
|
|
2084
|
+
// 0. Use baked-in GUIDs from Patch-Adams config (highest priority - set at wrap time)
|
|
2085
|
+
if (DOCUMENT_GUID) {
|
|
2086
|
+
info.guid = DOCUMENT_GUID;
|
|
2087
|
+
info.id = 'http://xyleme.com/bravais/document/' + DOCUMENT_GUID;
|
|
2088
|
+
log('Document GUID from baked-in config:', DOCUMENT_GUID);
|
|
2089
|
+
}
|
|
2090
|
+
if (VERSION_GUID) {
|
|
2091
|
+
info.versionGuid = VERSION_GUID;
|
|
2092
|
+
log('Version GUID from baked-in config:', VERSION_GUID);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2074
2095
|
// 1. Extract shared link token and document ID from URL
|
|
2075
2096
|
info.sharedLinkToken = extractSharedLinkToken();
|
|
2076
2097
|
info.documentId = extractBravaisDocumentId();
|
|
@@ -2147,14 +2168,15 @@ function generateLrsBridgeCode(options) {
|
|
|
2147
2168
|
info.title = document.title;
|
|
2148
2169
|
}
|
|
2149
2170
|
|
|
2150
|
-
// 7. Get from PA metadata if available
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
info.
|
|
2155
|
-
info.
|
|
2156
|
-
info.
|
|
2157
|
-
info.
|
|
2171
|
+
// 7. Get from PA metadata if available (check both .courseMetadata and .course)
|
|
2172
|
+
var paMeta = (window.pa_patcher && window.pa_patcher.courseMetadata) ||
|
|
2173
|
+
(window.pa_patcher && window.pa_patcher.course) || null;
|
|
2174
|
+
if (paMeta) {
|
|
2175
|
+
info.documentId = paMeta.documentId || paMeta.courseId || info.documentId;
|
|
2176
|
+
if (!info.guid) info.guid = paMeta.guid || paMeta.courseGuid || null;
|
|
2177
|
+
if (!info.versionGuid) info.versionGuid = paMeta.versionGuid || null;
|
|
2178
|
+
info.title = (info.title === 'Rise Course') ? (paMeta.title || paMeta.courseTitle || info.title) : info.title;
|
|
2179
|
+
info.versionId = paMeta.versionId || info.versionId;
|
|
2158
2180
|
}
|
|
2159
2181
|
|
|
2160
2182
|
// 8. Build the course ID in Xyleme IRI format
|
|
@@ -3287,6 +3309,24 @@ function generateLrsBridgeCode(options) {
|
|
|
3287
3309
|
* because the bridge initializes in <head> before LMSInitialize runs.
|
|
3288
3310
|
*/
|
|
3289
3311
|
LRS.refreshActor = function(callback) {
|
|
3312
|
+
// Always-visible diagnostic: confirm refreshActor is being called and show SCORM data (TEMPORARY)
|
|
3313
|
+
if (window.console && window.console.info) {
|
|
3314
|
+
var scormId = 'n/a', scormName = 'n/a';
|
|
3315
|
+
if (LRS.scormApi) {
|
|
3316
|
+
try {
|
|
3317
|
+
scormId = LRS.scormApiType === '2004'
|
|
3318
|
+
? LRS.scormApi.GetValue('cmi.learner_id')
|
|
3319
|
+
: LRS.scormApi.LMSGetValue('cmi.core.student_id');
|
|
3320
|
+
scormName = LRS.scormApiType === '2004'
|
|
3321
|
+
? LRS.scormApi.GetValue('cmi.learner_name')
|
|
3322
|
+
: LRS.scormApi.LMSGetValue('cmi.core.student_name');
|
|
3323
|
+
} catch(e) { scormId = 'error'; scormName = 'error'; }
|
|
3324
|
+
}
|
|
3325
|
+
console.info('[PA-LRS] refreshActor called. SCORM API=' + (LRS.scormApi ? 'found' : 'MISSING') +
|
|
3326
|
+
', student_id=' + scormId +
|
|
3327
|
+
', student_name=' + scormName +
|
|
3328
|
+
', previous actor=' + (LRS.actor ? LRS.actor.name : 'none'));
|
|
3329
|
+
}
|
|
3290
3330
|
log('refreshActor called - re-extracting from SCORM...');
|
|
3291
3331
|
var previousName = LRS.actor ? LRS.actor.name : 'none';
|
|
3292
3332
|
|
|
@@ -4034,10 +4074,13 @@ function generateLrsBridgeCode(options) {
|
|
|
4034
4074
|
// Always-visible bridge summary (not gated by DEBUG)
|
|
4035
4075
|
// This ensures diagnostics are available even in production builds
|
|
4036
4076
|
if (window.console && window.console.info) {
|
|
4037
|
-
console.info('[PA-LRS] Bridge: mode=' + LRS.mode +
|
|
4077
|
+
console.info('[PA-LRS] Bridge v' + LRS.version + ': mode=' + LRS.mode +
|
|
4038
4078
|
', endpoint=' + (LRS_ENDPOINT ? LRS_ENDPOINT.substring(0, 30) + '...' : 'NONE') +
|
|
4039
4079
|
', proxy=' + (LRS_PROXY_ENDPOINT ? 'yes' : 'no') +
|
|
4040
|
-
',
|
|
4080
|
+
', docGuid=' + (DOCUMENT_GUID || 'NONE') +
|
|
4081
|
+
', verGuid=' + (VERSION_GUID || 'NONE') +
|
|
4082
|
+
', actor=' + (LRS.actor ? (LRS.actor.name || 'anonymous') : 'none') +
|
|
4083
|
+
', hasRefreshActor=' + (typeof LRS.refreshActor === 'function'));
|
|
4041
4084
|
}
|
|
4042
4085
|
|
|
4043
4086
|
// Set up event interceptors
|
|
@@ -4314,7 +4357,9 @@ function buildJsBeforeOptions(config, metadata) {
|
|
|
4314
4357
|
autoDetectLrs: lrsBridgeConfig.autoDetectLrs,
|
|
4315
4358
|
lrsAuth: lrsBridgeConfig.lrsAuth,
|
|
4316
4359
|
lrsProxyEndpoint: lrsBridgeConfig.lrsProxyEndpoint,
|
|
4317
|
-
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint
|
|
4360
|
+
employeeApiEndpoint: lrsBridgeConfig.employeeApiEndpoint,
|
|
4361
|
+
documentGuid: lrsBridgeConfig.documentGuid,
|
|
4362
|
+
versionGuid: lrsBridgeConfig.versionGuid
|
|
4318
4363
|
};
|
|
4319
4364
|
return {
|
|
4320
4365
|
remoteUrl: `${config.remoteDomain}/${config.localFolders.js}/${config.jsBefore.filename}`,
|