@attraccess/plugins-backend-sdk 1.10.0 → 1.11.0-beta.0
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/package.json +8 -3
- package/src/index.d.ts +5 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -1
- package/src/lib/plugin-audit.d.ts +33 -33
- package/src/lib/plugin-audit.js +11 -11
- package/src/lib/plugin-audit.js.map +1 -1
- package/src/lib/plugin-backend-module.d.ts +66 -0
- package/src/lib/plugin-backend-module.js +3 -0
- package/src/lib/plugin-backend-module.js.map +1 -0
- package/src/lib/plugin-context.d.ts +52 -54
- package/src/lib/plugin-context.js +6 -6
- package/src/lib/plugin-context.js.map +1 -1
- package/src/lib/plugin-flow-node.d.ts +52 -3
- package/src/lib/plugin-live-updates.d.ts +21 -0
- package/src/lib/plugin-live-updates.js +3 -0
- package/src/lib/plugin-live-updates.js.map +1 -0
- package/src/lib/plugin-notifications.d.ts +83 -0
- package/src/lib/plugin-notifications.js +3 -0
- package/src/lib/plugin-notifications.js.map +1 -0
- package/src/lib/plugin-resource-access.d.ts +89 -0
- package/src/lib/plugin-resource-access.js +3 -0
- package/src/lib/plugin-resource-access.js.map +1 -0
- package/src/lib/plugin.interface.d.ts +74 -5
- package/src/lib/plugin.interface.js +20 -1
- package/src/lib/plugin.interface.js.map +1 -1
- package/src/lib/reader-ui.d.ts +317 -0
- package/src/lib/reader-ui.js +115 -0
- package/src/lib/reader-ui.js.map +1 -0
- package/src/lib/shared-live-sampler.d.ts +11 -0
- package/src/lib/shared-live-sampler.js +33 -0
- package/src/lib/shared-live-sampler.js.map +1 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Reader UI schema v1 and the pre-start / session-end hook contract.
|
|
4
|
+
*
|
|
5
|
+
* Plugins describe UI as plain data. Nothing here runs on the reader. The host
|
|
6
|
+
* validates, sanitizes (Latin-1) and size-checks everything before it is sent.
|
|
7
|
+
* The firmware mirrors the constants in `display/ui/ui_schema.hpp`; a Jest
|
|
8
|
+
* parity test keeps both in sync.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.READER_UI_CAPABILITIES_NONE = exports.PANIC_CLASS_RESET_REASONS = exports.DEFAULT_NO_SCREEN_POLICY = exports.NO_SCREEN_POLICIES = exports.READER_UI_RESERVED_STATUS_STRINGS = exports.READER_UI_TIMING = exports.READER_UI_LIMITS = exports.READER_UI_STEP_KINDS = exports.READER_UI_SLOT_NODE_BUDGET = exports.READER_UI_SLOT_IDS = exports.READER_UI_SLOTS = exports.READER_UI_TEXT_STYLES = exports.READER_UI_ICONS = exports.READER_UI_TONES = exports.READER_UI_COMPONENTS = exports.READER_UI_SCHEMA_VERSION = void 0;
|
|
12
|
+
exports.READER_UI_SCHEMA_VERSION = 1;
|
|
13
|
+
exports.READER_UI_COMPONENTS = [
|
|
14
|
+
'col',
|
|
15
|
+
'row',
|
|
16
|
+
'text',
|
|
17
|
+
'badge',
|
|
18
|
+
'icon',
|
|
19
|
+
'button',
|
|
20
|
+
'progress',
|
|
21
|
+
'countdown',
|
|
22
|
+
'spacer',
|
|
23
|
+
];
|
|
24
|
+
exports.READER_UI_TONES = ['primary', 'success', 'warning', 'danger'];
|
|
25
|
+
exports.READER_UI_ICONS = ['ok', 'warning', 'bell', 'lock', 'clock'];
|
|
26
|
+
exports.READER_UI_TEXT_STYLES = ['title', 'body', 'small'];
|
|
27
|
+
exports.READER_UI_SLOTS = {
|
|
28
|
+
RESOURCE_LIST_ROW_STATUS: 'resourceList.row.status',
|
|
29
|
+
RESOURCE_DETAILS_HEADER: 'resource.details.header',
|
|
30
|
+
RESOURCE_DETAILS_BODY: 'resource.details.body',
|
|
31
|
+
RESOURCE_DETAILS_SESSION: 'resource.details.session',
|
|
32
|
+
};
|
|
33
|
+
exports.READER_UI_SLOT_IDS = Object.values(exports.READER_UI_SLOTS);
|
|
34
|
+
/** Node budget per slot. The list row slot takes a single text or badge. */
|
|
35
|
+
exports.READER_UI_SLOT_NODE_BUDGET = {
|
|
36
|
+
'resourceList.row.status': 1,
|
|
37
|
+
'resource.details.header': 6,
|
|
38
|
+
'resource.details.body': 8,
|
|
39
|
+
'resource.details.session': 6,
|
|
40
|
+
};
|
|
41
|
+
exports.READER_UI_STEP_KINDS = ['confirm', 'choose', 'info'];
|
|
42
|
+
exports.READER_UI_LIMITS = {
|
|
43
|
+
/** UTF-8 bytes of the sanitized UI payload. */
|
|
44
|
+
maxPayloadBytes: 3072,
|
|
45
|
+
/** Whole websocket frame; legacy token readers cannot reassemble. */
|
|
46
|
+
maxFrameBytes: 4096,
|
|
47
|
+
maxNodes: 32,
|
|
48
|
+
maxDepth: 5,
|
|
49
|
+
maxLiveNodes: 64,
|
|
50
|
+
maxTextChars: 80,
|
|
51
|
+
maxLabelBytes: 31,
|
|
52
|
+
maxListRowChars: 24,
|
|
53
|
+
maxChoices: 4,
|
|
54
|
+
maxSlotContributionsPerResource: 8,
|
|
55
|
+
idPattern: /^[a-z0-9_-]{1,24}$/,
|
|
56
|
+
};
|
|
57
|
+
exports.READER_UI_TIMING = {
|
|
58
|
+
stepDefaultTtlSec: 60,
|
|
59
|
+
stepMaxTtlSec: 120,
|
|
60
|
+
stepGraceSec: 5,
|
|
61
|
+
postStopDefaultTtlSec: 15,
|
|
62
|
+
postStopMaxTtlSec: 30,
|
|
63
|
+
hookDefaultTimeoutMs: 1500,
|
|
64
|
+
hookMaxTimeoutMs: 3000,
|
|
65
|
+
breakerThreshold: 5,
|
|
66
|
+
breakerProbeAfterMs: 60000,
|
|
67
|
+
crashLoopSuspendMs: 30 * 60000,
|
|
68
|
+
slotUpdateMinIntervalMs: 2000,
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Strings that only the host may show (core status). Plugin text is rejected when it equals one after lower-casing,
|
|
72
|
+
* collapsing whitespace and stripping non-letters at both ends.
|
|
73
|
+
*/
|
|
74
|
+
exports.READER_UI_RESERVED_STATUS_STRINGS = [
|
|
75
|
+
'maintenance',
|
|
76
|
+
'under maintenance',
|
|
77
|
+
'in use',
|
|
78
|
+
'available',
|
|
79
|
+
'access granted',
|
|
80
|
+
'access denied',
|
|
81
|
+
'unavailable',
|
|
82
|
+
'introduction required',
|
|
83
|
+
'emergency stop',
|
|
84
|
+
'firmware update',
|
|
85
|
+
'wartung',
|
|
86
|
+
'in wartung',
|
|
87
|
+
'in benutzung',
|
|
88
|
+
'verfuegbar',
|
|
89
|
+
'verfügbar',
|
|
90
|
+
'zugriff gewaehrt',
|
|
91
|
+
'zugriff gewährt',
|
|
92
|
+
'zugriff verweigert',
|
|
93
|
+
'einweisung erforderlich',
|
|
94
|
+
'notaus',
|
|
95
|
+
];
|
|
96
|
+
exports.NO_SCREEN_POLICIES = ['block', 'card-confirm', 'allow-with-warning'];
|
|
97
|
+
exports.DEFAULT_NO_SCREEN_POLICY = 'block';
|
|
98
|
+
/** Reset reasons shared with READER_CRASH_REPORT. */
|
|
99
|
+
exports.PANIC_CLASS_RESET_REASONS = ['PANIC', 'INT_WDT', 'TASK_WDT', 'WDT', 'CPU_LOCKUP'];
|
|
100
|
+
exports.READER_UI_CAPABILITIES_NONE = {
|
|
101
|
+
schemaVersion: 0,
|
|
102
|
+
components: [],
|
|
103
|
+
slots: [],
|
|
104
|
+
steps: [],
|
|
105
|
+
maxPayloadBytes: 0,
|
|
106
|
+
maxNodes: 0,
|
|
107
|
+
maxDepth: 0,
|
|
108
|
+
maxLiveNodes: 0,
|
|
109
|
+
display: null,
|
|
110
|
+
input: { touch: false, buttons: 0, cardHold: false },
|
|
111
|
+
feedback: { leds: false, beeper: false },
|
|
112
|
+
charset: 'latin1',
|
|
113
|
+
images: false,
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=reader-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader-ui.js","sourceRoot":"","sources":["../../../../../lib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,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;IACpD,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACxC,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,KAAK;CACd,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export type LiveSample<Value> = {
|
|
3
|
+
data: {
|
|
4
|
+
eventType: 'snapshot';
|
|
5
|
+
value: Value;
|
|
6
|
+
} | {
|
|
7
|
+
eventType: 'unavailable';
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/** Share status reads per key until the final subscriber leaves. */
|
|
11
|
+
export declare function createSharedLiveSampler<Key, Value = unknown>(): (key: Key, intervalMs: number, read: () => Promise<Value>) => Observable<LiveSample<Value>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSharedLiveSampler = createSharedLiveSampler;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
/** Share status reads per key until the final subscriber leaves. */
|
|
6
|
+
function createSharedLiveSampler() {
|
|
7
|
+
const sources = new Map();
|
|
8
|
+
// Unsubscribing cannot cancel a device Promise. Keep only its guard until it settles.
|
|
9
|
+
const inFlight = new Set();
|
|
10
|
+
return (key, intervalMs, read) => (0, rxjs_1.defer)(() => {
|
|
11
|
+
let source = sources.get(key);
|
|
12
|
+
if (!source) {
|
|
13
|
+
source = (0, rxjs_1.timer)(0, intervalMs).pipe(
|
|
14
|
+
// Skip ticks while a read is pending; failures allow the next tick to recover.
|
|
15
|
+
(0, rxjs_1.exhaustMap)(() => (0, rxjs_1.defer)(() => {
|
|
16
|
+
if (inFlight.has(key))
|
|
17
|
+
return rxjs_1.EMPTY;
|
|
18
|
+
inFlight.add(key);
|
|
19
|
+
return Promise.resolve()
|
|
20
|
+
.then(read)
|
|
21
|
+
.finally(() => inFlight.delete(key));
|
|
22
|
+
}).pipe((0, rxjs_1.map)((value) => ({ data: { eventType: 'snapshot', value } })),
|
|
23
|
+
// Device errors may contain credentials, so only expose availability.
|
|
24
|
+
(0, rxjs_1.catchError)(() => (0, rxjs_1.of)({ data: { eventType: 'unavailable' } })))), (0, rxjs_1.finalize)(() => {
|
|
25
|
+
if (sources.get(key) === source)
|
|
26
|
+
sources.delete(key);
|
|
27
|
+
}), (0, rxjs_1.shareReplay)({ bufferSize: 1, refCount: true }));
|
|
28
|
+
sources.set(key, source);
|
|
29
|
+
}
|
|
30
|
+
return source;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=shared-live-sampler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-live-sampler.js","sourceRoot":"","sources":["../../../../../libs/plugins-backend-sdk/src/lib/shared-live-sampler.ts"],"names":[],"mappings":";;AAOA,0DAiCC;AAxCD,+BAA+G;AAM/G,oEAAoE;AACpE,SAAgB,uBAAuB;IACrC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAsC,CAAC;IAC9D,sFAAsF;IACtF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAO,CAAC;IAEhC,OAAO,CAAC,GAAQ,EAAE,UAAkB,EAAE,IAA0B,EAAiC,EAAE,CACjG,IAAA,YAAK,EAAC,GAAG,EAAE;QACT,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAA,YAAK,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI;YAChC,+EAA+E;YAC/E,IAAA,iBAAU,EAAC,GAAG,EAAE,CACd,IAAA,YAAK,EAAC,GAAG,EAAE;gBACT,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;oBAAE,OAA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