@genesislcap/mock-server 15.74.0 → 15.76.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.
Files changed (100) hide show
  1. package/README.md +296 -58
  2. package/dist/db/schema.d.ts +9 -1
  3. package/dist/db/schema.js +40 -11
  4. package/dist/db/store.d.ts +1 -0
  5. package/dist/db/store.js +4 -0
  6. package/dist/handlers/auth.d.ts +15 -6
  7. package/dist/handlers/auth.js +152 -33
  8. package/dist/handlers/commitEvent.js +43 -20
  9. package/dist/handlers/crudEvents.d.ts +3 -1
  10. package/dist/handlers/crudEvents.js +3 -2
  11. package/dist/handlers/eventValidation.js +6 -3
  12. package/dist/handlers/http.d.ts +2 -2
  13. package/dist/handlers/http.js +66 -43
  14. package/dist/handlers/jsonSchema.d.ts +1 -0
  15. package/dist/handlers/jsonSchema.js +72 -21
  16. package/dist/handlers/meta.d.ts +1 -1
  17. package/dist/handlers/meta.js +59 -10
  18. package/dist/handlers/requestReply.js +36 -9
  19. package/dist/index.d.ts +1 -1
  20. package/dist/presets/auth.d.ts +25 -0
  21. package/dist/presets/auth.js +855 -0
  22. package/dist/presets/cronExpression.d.ts +1 -0
  23. package/dist/presets/cronExpression.js +429 -0
  24. package/dist/presets/fileServer.d.ts +13 -0
  25. package/dist/presets/fileServer.js +399 -0
  26. package/dist/presets/gsf.d.ts +24 -0
  27. package/dist/presets/gsf.js +450 -0
  28. package/dist/presets/index.d.ts +1 -0
  29. package/dist/presets/index.js +1 -0
  30. package/dist/presets/javaTime.d.ts +7 -0
  31. package/dist/presets/javaTime.js +322 -0
  32. package/dist/presets/multipart.d.ts +14 -0
  33. package/dist/presets/multipart.js +91 -0
  34. package/dist/presets/notify.d.ts +27 -0
  35. package/dist/presets/notify.js +250 -0
  36. package/dist/presets/notifyDispatch.d.ts +28 -0
  37. package/dist/presets/notifyDispatch.js +570 -0
  38. package/dist/presets/notifyRules.d.ts +9 -0
  39. package/dist/presets/notifyRules.js +754 -0
  40. package/dist/presets/platform/backing.json +8058 -217
  41. package/dist/presets/platform/criteria-model.json +362 -0
  42. package/dist/presets/platform/time-zones.json +608 -0
  43. package/dist/presets/platform.d.ts +7 -0
  44. package/dist/presets/platform.js +145 -103
  45. package/dist/presets/products.d.ts +9 -7
  46. package/dist/presets/products.js +89 -21
  47. package/dist/presets/reconciliation.d.ts +18 -0
  48. package/dist/presets/reconciliation.js +721 -0
  49. package/dist/presets/reporting.d.ts +14 -0
  50. package/dist/presets/reporting.js +862 -0
  51. package/dist/protocol/connection.d.ts +2 -0
  52. package/dist/protocol/connection.js +4 -0
  53. package/dist/protocol/dtoTypes.d.ts +30 -0
  54. package/dist/protocol/dtoTypes.js +250 -0
  55. package/dist/protocol/errors.d.ts +3 -1
  56. package/dist/protocol/errors.js +2 -0
  57. package/dist/protocol/fieldTypes.js +5 -0
  58. package/dist/protocol/router.d.ts +1 -0
  59. package/dist/protocol/router.js +3 -3
  60. package/dist/protocol/schemaValidation.d.ts +1 -1
  61. package/dist/protocol/schemaValidation.js +53 -8
  62. package/dist/server.js +34 -2
  63. package/dist/types.d.ts +50 -2
  64. package/package.json +1 -1
  65. package/src/db/schema.ts +56 -13
  66. package/src/db/store.ts +5 -0
  67. package/src/handlers/auth.ts +211 -37
  68. package/src/handlers/commitEvent.ts +44 -19
  69. package/src/handlers/crudEvents.ts +9 -2
  70. package/src/handlers/eventValidation.ts +6 -3
  71. package/src/handlers/http.ts +83 -42
  72. package/src/handlers/jsonSchema.ts +86 -23
  73. package/src/handlers/meta.ts +77 -9
  74. package/src/handlers/requestReply.ts +42 -6
  75. package/src/index.ts +7 -0
  76. package/src/presets/auth.ts +961 -0
  77. package/src/presets/cronExpression.ts +445 -0
  78. package/src/presets/fileServer.ts +475 -0
  79. package/src/presets/gsf.ts +475 -0
  80. package/src/presets/index.ts +5 -0
  81. package/src/presets/javaTime.ts +354 -0
  82. package/src/presets/multipart.ts +110 -0
  83. package/src/presets/notify.ts +312 -0
  84. package/src/presets/notifyDispatch.ts +685 -0
  85. package/src/presets/notifyRules.ts +866 -0
  86. package/src/presets/platform/backing.json +8058 -217
  87. package/src/presets/platform/criteria-model.json +362 -0
  88. package/src/presets/platform/time-zones.json +608 -0
  89. package/src/presets/platform.ts +204 -115
  90. package/src/presets/products.ts +125 -19
  91. package/src/presets/reconciliation.ts +824 -0
  92. package/src/presets/reporting.ts +953 -0
  93. package/src/protocol/connection.ts +4 -0
  94. package/src/protocol/dtoTypes.ts +310 -0
  95. package/src/protocol/errors.ts +13 -1
  96. package/src/protocol/fieldTypes.ts +5 -0
  97. package/src/protocol/router.ts +3 -3
  98. package/src/protocol/schemaValidation.ts +61 -8
  99. package/src/server.ts +38 -2
  100. package/src/types.ts +147 -3
@@ -0,0 +1,450 @@
1
+ // GSF's own resources in the platform preset (genesis 8.15.29): the system
2
+ // information request servers system-info-reqrep.kts declares, over the
3
+ // server's dictionary, and the status dataservers GSF registers in code
4
+ // (StatusDataserver.java), over the tables its Resource Daemon fills.
5
+ // Behaviour read from GSF's source and checked against its jars (the
6
+ // handoff's research-gsf-system.md).
7
+ import { createContext, Script } from 'node:vm';
8
+ import { auditTableName } from "../db/audit.js";
9
+ import { pkFieldsOf } from "../db/schema.js";
10
+ import { NackError } from "../protocol/errors.js";
11
+ import { dto } from "./notify.js";
12
+ import { aliasedEnumKeys, fieldFormat, isPlatformTable, platformTable } from "./products.js";
13
+ const SYSINFO = 'global.genesis.console.sysinfo';
14
+ // The views the preset declares only to serve a resource GSF serves with a
15
+ // renamed column (platform.ts, auth.ts); GSF's dictionary has none of them.
16
+ export const SERVING_VIEWS = new Set([
17
+ 'PROFILE_PREFIXED',
18
+ 'RIGHT_PREFIXED',
19
+ 'USER_PROFILE_NAMES',
20
+ 'SYSTEM_STATUS_BYTES',
21
+ ]);
22
+ // The table an audit table is, when `name` is one (<TABLE>_AUDIT of an
23
+ // audited table).
24
+ function auditedTableOf(config, name) {
25
+ const tables = config.tables ?? {};
26
+ const base = Object.keys(tables).find((table) => auditTableName(table) === name && Boolean(tables[table].audit));
27
+ return base;
28
+ }
29
+ /**
30
+ * GSF's getAllEntityNames (DbReflectionUtils.kt:116-123): the dictionary's
31
+ * tables, each audit table right after its table, then the views. GSF lists
32
+ * the tables by product, in its dictionary files' HashMap order (which the
33
+ * app's own file names decide), then declaration order: here, in the
34
+ * config's order.
35
+ */
36
+ export function entityNames(config) {
37
+ const tables = Object.keys(config.tables ?? {});
38
+ const audits = new Set(tables.filter((name) => auditedTableOf(config, name)));
39
+ const ordered = tables
40
+ .filter((name) => !audits.has(name))
41
+ .flatMap((name) => (audits.has(auditTableName(name)) ? [name, auditTableName(name)] : [name]));
42
+ const views = Object.keys(config.views ?? {}).filter((name) => !SERVING_VIEWS.has(name));
43
+ return [...ordered, ...views];
44
+ }
45
+ // --- Java patterns -------------------------------------------------------------------
46
+ // PatternSyntaxException.getMessage (Java 17): the description, the index
47
+ // when there is one, the pattern, and a caret under the index when it's
48
+ // inside the pattern.
49
+ function patternError(description, index, pattern) {
50
+ const near = index >= 0 ? ` near index ${index}` : '';
51
+ const caret = index >= 0 && index < pattern.length ? `\n${' '.repeat(index)}^` : '';
52
+ return new Error(`${description}${near}\n${pattern}${caret}`);
53
+ }
54
+ // The characters a JavaScript (u-mode) pattern needs escaped to mean
55
+ // themselves.
56
+ const JS_SYNTAX = new Set('^$\\.*+?()[]{}|/');
57
+ const ALNUM = /[0-9A-Za-z]/;
58
+ const literal = (char) => (JS_SYNTAX.has(char) ? `\\${char}` : char);
59
+ // Java's anchors, as a whole-string match reads them.
60
+ const ANCHORS = { A: '^', z: '$', Z: '(?=\\n?$)' };
61
+ const CASE_INSENSITIVE = '(?i)';
62
+ // The escape at `index` (a backslash), as JavaScript spells it, and the
63
+ // index of its last character.
64
+ function escaped(pattern, index, inClass) {
65
+ const next = pattern[index + 1] ?? '';
66
+ const end = index + 1;
67
+ if (inClass)
68
+ return { text: ALNUM.test(next) || next === '-' ? `\\${next}` : literal(next), end };
69
+ if (next === 'Q') {
70
+ const close = pattern.indexOf('\\E', end + 1);
71
+ const quoted = pattern.slice(end + 1, close === -1 ? pattern.length : close);
72
+ return {
73
+ text: [...quoted].map(literal).join(''),
74
+ end: close === -1 ? pattern.length : close + 1,
75
+ };
76
+ }
77
+ if (next in ANCHORS)
78
+ return { text: ANCHORS[next], end };
79
+ // Any other letter or digit as JavaScript reads it (\d, \p{Lu}, ...).
80
+ return { text: ALNUM.test(next) ? `\\${next}` : literal(next), end };
81
+ }
82
+ // Kotlin's toRegex() and String.matches: a whole-string java.util.regex
83
+ // match. A pattern Java refuses fails with its PatternSyntaxException
84
+ // message for the mistakes a name pattern makes (a quantifier with nothing
85
+ // to repeat, an unmatched or unclosed group, an unclosed class); the Java
86
+ // spellings JavaScript lacks are translated (\Q...\E, \A, \z, \Z, a leading
87
+ // (?i), a backslash before a character that needs none), and what
88
+ // JavaScript can't express at all (an inline flag after the start, Java's
89
+ // own escapes) fails with JavaScript's message.
90
+ export function javaPattern(pattern) {
91
+ let source = '';
92
+ let flags = 'u';
93
+ let depth = 0;
94
+ let inClass = false;
95
+ // What came last: nothing to repeat, something that can be, a quantifier,
96
+ // or a lazy/possessive mark on one.
97
+ let last = 'none';
98
+ let index = 0;
99
+ if (pattern.startsWith(CASE_INSENSITIVE)) {
100
+ flags += 'i';
101
+ index = CASE_INSENSITIVE.length;
102
+ }
103
+ for (; index < pattern.length; index += 1) {
104
+ const char = pattern[index];
105
+ if (char === '\\') {
106
+ const escape = escaped(pattern, index, inClass);
107
+ source += escape.text;
108
+ index = escape.end;
109
+ if (!inClass)
110
+ last = 'atom';
111
+ }
112
+ else if (inClass) {
113
+ source += char;
114
+ if (char === ']') {
115
+ inClass = false;
116
+ last = 'atom';
117
+ }
118
+ }
119
+ else if (char === '[') {
120
+ source += char;
121
+ inClass = true;
122
+ }
123
+ else if (char === '(') {
124
+ source += char;
125
+ depth += 1;
126
+ // (?:, (?=, (?<name>, ...: a group construct, not a quantifier.
127
+ if (pattern[index + 1] === '?') {
128
+ source += '?';
129
+ index += 1;
130
+ }
131
+ last = 'none';
132
+ }
133
+ else if (char === ')') {
134
+ depth -= 1;
135
+ if (depth < 0)
136
+ throw patternError("Unmatched closing ')'", index - 1, pattern);
137
+ source += char;
138
+ last = 'atom';
139
+ }
140
+ else if (char === '|') {
141
+ source += char;
142
+ last = 'none';
143
+ }
144
+ else if (char === '*' || char === '+' || char === '?') {
145
+ // After a quantifier, `?` makes it lazy and `+` possessive; anything
146
+ // else has nothing to repeat.
147
+ const marks = last === 'quantifier' && char !== '*';
148
+ if (last === 'none' || last === 'marked' || (last === 'quantifier' && !marks)) {
149
+ throw patternError(`Dangling meta character '${char}'`, index, pattern);
150
+ }
151
+ // JavaScript has no possessive quantifier; on a whole-string match of
152
+ // a name, a greedy one finds the same names.
153
+ if (!(marks && char === '+'))
154
+ source += char;
155
+ last = marks ? 'marked' : 'quantifier';
156
+ }
157
+ else {
158
+ source += char === ']' || char === '}' ? `\\${char}` : char;
159
+ last = char === '{' ? 'quantifier' : 'atom';
160
+ if (char === '{') {
161
+ // A counted closure, copied whole.
162
+ const close = pattern.indexOf('}', index + 1);
163
+ if (close !== -1) {
164
+ source += pattern.slice(index + 1, close + 1);
165
+ index = close;
166
+ last = 'atom';
167
+ }
168
+ }
169
+ }
170
+ }
171
+ if (inClass)
172
+ throw patternError('Unclosed character class', pattern.length - 1, pattern);
173
+ if (depth > 0)
174
+ throw patternError('Unclosed group', pattern.length, pattern);
175
+ return new RegExp(`^(?:${source})$`, flags);
176
+ }
177
+ // How long matching names may take. A pattern that backtracks badly ties
178
+ // up one of the real server's request threads; here it would stall every
179
+ // socket, so it fails instead (GENERIC_ERROR, with this text).
180
+ const MATCH_BUDGET_MS = 1000;
181
+ const matchScript = new Script('names.filter((name) => pattern.test(name))');
182
+ // The names `pattern` matches whole, in their order.
183
+ export function matchingNames(pattern, names) {
184
+ try {
185
+ return matchScript.runInContext(createContext({ pattern, names }), {
186
+ timeout: MATCH_BUDGET_MS,
187
+ });
188
+ }
189
+ catch (error) {
190
+ if (error.code !== 'ERR_SCRIPT_EXECUTION_TIMEOUT')
191
+ throw error;
192
+ throw new Error(`The mock stopped matching ${pattern.source} after ${MATCH_BUDGET_MS} ms: it backtracks too much`);
193
+ }
194
+ }
195
+ // --- SYSTEM_ENTITY and SYSTEM_ENTITY_FIELDS ----------------------------------------------
196
+ // system-info-reqrep.kts: SystemEntityRequest(entityName: String), and the
197
+ // two reply classes (console API.kt). SystemFieldResponse's TYPE is the
198
+ // dictionary's Field.Type.
199
+ const FIELD_TYPES = [
200
+ 'STRING',
201
+ 'ENUM',
202
+ 'INT',
203
+ 'SHORT',
204
+ 'DOUBLE',
205
+ 'LONG',
206
+ 'BOOLEAN',
207
+ 'RAW',
208
+ 'BIGDECIMAL',
209
+ 'NANO_TIMESTAMP',
210
+ 'DATETIME',
211
+ 'DATE',
212
+ ];
213
+ const entityRequest = {
214
+ className: `${SYSINFO}.SystemEntityRequest`,
215
+ fields: [dto('ENTITY_NAME', 'STRING')],
216
+ };
217
+ const optionalString = (name) => dto(name, 'STRING', { nullable: true, optional: true });
218
+ export const SYSTEM_ENTITY_TYPES = {
219
+ request: entityRequest,
220
+ reply: { className: `${SYSINFO}.SystemEntityResponse`, fields: [dto('ENTITY_NAME', 'STRING')] },
221
+ };
222
+ const SYSTEM_FIELD_TYPES = {
223
+ request: entityRequest,
224
+ reply: {
225
+ className: `${SYSINFO}.SystemFieldResponse`,
226
+ fields: [
227
+ dto('DEFAULT_VALUE', 'ANY', { nullable: true, optional: true }),
228
+ optionalString('FILE_NAME'),
229
+ optionalString('FORMAT'),
230
+ dto('MAX_SIZE', 'INT', { nullable: true, optional: true }),
231
+ dto('NAME', 'STRING'),
232
+ dto('NULLABLE', 'BOOLEAN', { optional: true }),
233
+ optionalString('SENSITIVE_MASK'),
234
+ dto('TYPE', 'ENUM', {
235
+ values: FIELD_TYPES,
236
+ enumClass: 'global.genesis.dictionary.Field.Type',
237
+ }),
238
+ optionalString('VALUES'),
239
+ ],
240
+ },
241
+ };
242
+ // A request without ENTITY_NAME fails to decode into SystemEntityRequest
243
+ // (GenesisJacksonExceptionTranslator); not recorded end to end.
244
+ function entityNameOf(request) {
245
+ const name = request.ENTITY_NAME;
246
+ if (name === undefined || name === null) {
247
+ throw NackError.field('ENTITY_NAME', 'Missing mandatory field ENTITY_NAME', '$.REQUEST.ENTITY_NAME', 'MISSING_FIELD');
248
+ }
249
+ return String(name);
250
+ }
251
+ // One SystemFieldResponse, as GSF's generated config classes give a field:
252
+ // never a MAX_SIZE or a FILE_NAME (the generator drops both), nulls sent.
253
+ const fieldReply = (field) => ({
254
+ NAME: field.NAME,
255
+ TYPE: field.TYPE,
256
+ VALUES: field.VALUES ?? null,
257
+ DEFAULT_VALUE: field.DEFAULT_VALUE ?? null,
258
+ MAX_SIZE: null,
259
+ FILE_NAME: null,
260
+ FORMAT: field.FORMAT ?? null,
261
+ SENSITIVE_MASK: null,
262
+ NULLABLE: field.NULLABLE ?? true,
263
+ });
264
+ // GSF adds every table's RECORD_ID and TIMESTAMP after its own fields.
265
+ const IDENTITY = [
266
+ fieldReply({ NAME: 'RECORD_ID', TYPE: 'LONG', NULLABLE: false }),
267
+ fieldReply({ NAME: 'TIMESTAMP', TYPE: 'NANO_TIMESTAMP', NULLABLE: false }),
268
+ ];
269
+ // A table as GSF's dictionary has it: a platform one as its product declares
270
+ // it (the preset leaves USER's PASSWORD and KEY_VALUE's columns out of its
271
+ // own), else the config's.
272
+ const tableDefOf = (config, name) => isPlatformTable(name) ? platformTable(name) : config.tables?.[name];
273
+ // A table field's TYPE, VALUES and DEFAULT_VALUE: an ALIASED_ENUM by its keys,
274
+ // an ENUM with no default defaulting to its first value (ParsedTable.kt:113).
275
+ function enumOf(table, field) {
276
+ if (field.type !== 'ENUM')
277
+ return { VALUES: null, DEFAULT_VALUE: field.default ?? null };
278
+ const values = field.values ?? [];
279
+ const keys = aliasedEnumKeys(table, field.name);
280
+ const keyOf = (value) => (keys ? keys[values.indexOf(String(value))] : value);
281
+ const fallback = field.default ?? values[0];
282
+ return {
283
+ VALUES: (keys ?? values).join(' ') || null,
284
+ DEFAULT_VALUE: fallback === undefined ? null : keyOf(fallback),
285
+ };
286
+ }
287
+ // A table's own fields (Helper.kt:73-88): not nullable when the dictionary
288
+ // says so, when the field is in any index (the key's included), generated,
289
+ // or has a default.
290
+ function tableFieldReplies(table, def) {
291
+ const required = new Set([
292
+ ...pkFieldsOf(def),
293
+ ...(def.indexes ?? []).flatMap((index) => index.fields),
294
+ ...(def.generated ?? []).map(({ field }) => field),
295
+ ]);
296
+ return (def.fields ?? []).map((field) => {
297
+ const typed = enumOf(table, field);
298
+ return fieldReply({
299
+ NAME: field.name,
300
+ TYPE: field.type,
301
+ ...typed,
302
+ FORMAT: field.type === 'RAW' ? (fieldFormat(field.name) ?? null) : null,
303
+ NULLABLE: field.nullable !== false && !required.has(field.name) && typed.DEFAULT_VALUE === null,
304
+ });
305
+ });
306
+ }
307
+ // An audit table's: its table's, then its own id and the four audit fields
308
+ // (Audit.kt:76-80).
309
+ function auditFieldReplies(table, def) {
310
+ const audit = auditTableName(table);
311
+ return [
312
+ ...tableFieldReplies(table, def),
313
+ ...IDENTITY,
314
+ fieldReply({ NAME: `${audit}_ID`, TYPE: 'STRING', NULLABLE: false }),
315
+ fieldReply({ NAME: 'AUDIT_EVENT_TYPE', TYPE: 'STRING' }),
316
+ fieldReply({ NAME: 'AUDIT_EVENT_DATETIME', TYPE: 'DATETIME' }),
317
+ fieldReply({ NAME: 'AUDIT_EVENT_TEXT', TYPE: 'STRING' }),
318
+ fieldReply({ NAME: 'AUDIT_EVENT_USER', TYPE: 'STRING' }),
319
+ ];
320
+ }
321
+ // A view's fields (ViewConfigClassGenerator.kt:176-251), by their names in
322
+ // the view: a base table column as nullable as in its table, a joined one
323
+ // always nullable, a derived one too and with only its type; none with a
324
+ // default or format. Then RECORD_ID and TIMESTAMP.
325
+ function viewFieldReplies(config, view) {
326
+ const columnOf = (table, column) => {
327
+ const def = tableDefOf(config, table);
328
+ const field = def?.fields?.find(({ name }) => name === column);
329
+ if (!def || !field)
330
+ return undefined;
331
+ return tableFieldReplies(table, { ...def, fields: [field] })[0];
332
+ };
333
+ const baseDef = tableDefOf(config, view.base);
334
+ const names = view.fields ?? [
335
+ ...(baseDef?.fields ?? []).map(({ name }) => name),
336
+ ...Object.keys(view.select ?? {}),
337
+ ...(view.joins ?? []).flatMap((join) => Object.keys(join.select ?? {})),
338
+ ...Object.keys(view.derivedTypes ?? {}),
339
+ ];
340
+ const replies = names
341
+ .filter((name) => name !== 'RECORD_ID' && name !== 'TIMESTAMP')
342
+ .map((name) => {
343
+ const derived = view.derivedTypes?.[name];
344
+ if (derived) {
345
+ const type = typeof derived === 'string' ? derived : derived.type;
346
+ const values = typeof derived === 'string' ? undefined : derived.values;
347
+ return fieldReply({ NAME: name, TYPE: type, VALUES: values?.join(' ') ?? null });
348
+ }
349
+ const join = (view.joins ?? []).find((candidate) => candidate.select?.[name]);
350
+ const source = join
351
+ ? columnOf(join.table, join.select[name])
352
+ : columnOf(view.base, view.select?.[name] ?? name);
353
+ return fieldReply({
354
+ NAME: name,
355
+ TYPE: source?.TYPE ?? 'STRING',
356
+ VALUES: source?.VALUES ?? null,
357
+ NULLABLE: join ? true : (source?.NULLABLE ?? true),
358
+ });
359
+ });
360
+ return [...replies, ...IDENTITY];
361
+ }
362
+ function entityFieldReplies(config, entity) {
363
+ const view = config.views?.[entity];
364
+ if (view)
365
+ return viewFieldReplies(config, view);
366
+ const audited = auditedTableOf(config, entity);
367
+ if (audited)
368
+ return auditFieldReplies(audited, tableDefOf(config, audited));
369
+ return [...tableFieldReplies(entity, tableDefOf(config, entity) ?? { pkField: [] }), ...IDENTITY];
370
+ }
371
+ /** system-info-reqrep.kts's two request servers. */
372
+ export function systemInfoRequestReplies() {
373
+ return {
374
+ // :11 the entities whose name the pattern matches whole, `*` any run.
375
+ SYSTEM_ENTITY: {
376
+ typed: SYSTEM_ENTITY_TYPES,
377
+ requestFields: ['ENTITY_NAME'],
378
+ resolver: ({ request, config }) => {
379
+ const pattern = javaPattern(entityNameOf(request).replaceAll('*', '.*'));
380
+ return matchingNames(pattern, entityNames(config)).map((ENTITY_NAME) => ({
381
+ ENTITY_NAME,
382
+ }));
383
+ },
384
+ },
385
+ // :25 the first entity the pattern (as given: `*` alone is no pattern)
386
+ // matches, and its fields.
387
+ SYSTEM_ENTITY_FIELDS: {
388
+ typed: SYSTEM_FIELD_TYPES,
389
+ requestFields: ['ENTITY_NAME'],
390
+ resolver: ({ request, config }) => {
391
+ const pattern = javaPattern(entityNameOf(request));
392
+ const [entity] = matchingNames(pattern, entityNames(config));
393
+ if (!entity)
394
+ throw new Error('Collection contains no element matching the predicate.');
395
+ return entityFieldReplies(config, entity);
396
+ },
397
+ },
398
+ };
399
+ }
400
+ // --- the status dataservers ----------------------------------------------------------
401
+ // StatusDataserver.java:113-145: SYSTEM_STATUS with its memory columns
402
+ // renamed.
403
+ export const SYSTEM_STATUS_BYTES = {
404
+ base: 'SYSTEM_STATUS',
405
+ select: {
406
+ TOTAL_PHYSICAL_MEMORY_SIZE_BYTES: 'TOTAL_PHYSICAL_MEMORY_SIZE',
407
+ FREE_PHYSICAL_MEMORY_SIZE_BYTES: 'FREE_PHYSICAL_MEMORY_SIZE',
408
+ },
409
+ fields: [
410
+ 'SYSTEM_CPU_LOAD',
411
+ 'TOTAL_PHYSICAL_MEMORY_SIZE_BYTES',
412
+ 'HOST_NAME',
413
+ 'FREE_PHYSICAL_MEMORY_SIZE_BYTES',
414
+ ],
415
+ };
416
+ /**
417
+ * StatusDataserver.java's two dataservers, on GSF's older engine (no INDEXES
418
+ * in their META), their fields in the order its HashSet of fields gives
419
+ * them. Only GSF's Resource Daemon fills GENESIS_PROCESS and SYSTEM_STATUS,
420
+ * and Genesis Start and Create's preview don't run it, so both stream no
421
+ * rows, as there.
422
+ */
423
+ export function statusQueries() {
424
+ return {
425
+ ALL_PROCESSES_STATUS: {
426
+ source: 'GENESIS_PROCESS',
427
+ legacyEngine: true,
428
+ fields: [
429
+ 'PROCESS_PORT',
430
+ 'START_TIME',
431
+ 'PROCESS_STATUS',
432
+ 'PROCESS_ENABLED',
433
+ 'PROCESS_SECURE',
434
+ 'PROCESS_STATE_TEXT',
435
+ 'DATADUMP',
436
+ 'PROCESS_RESOURCES',
437
+ 'PROCESS_MEM_USAGE',
438
+ 'PROCESS_CPU_USAGE',
439
+ 'PROCESS_NAME',
440
+ 'PROCESS_STATUS_MESSAGE',
441
+ 'LOG_LEVEL',
442
+ 'PROCESS_HOSTNAME',
443
+ 'RESOURCE_TYPES',
444
+ ],
445
+ // A STRING in its metadata, an ENUM in its table.
446
+ fieldTypes: { PROCESS_STATE_TEXT: 'STRING' },
447
+ },
448
+ ALL_SYSTEM_STATUS: { source: 'SYSTEM_STATUS_BYTES', legacyEngine: true },
449
+ };
450
+ }
@@ -1,4 +1,5 @@
1
1
  export { parseSeedCsv } from './csv.ts';
2
2
  export { mergeConfigs } from './merge.ts';
3
+ export { DEFAULT_NOTIFY_GATEWAYS, type NotifyGateway, type NotifyGatewayKind, } from './notifyDispatch.ts';
3
4
  export { platformPreset, type PlatformPresetOptions, type PlatformSeed, type PlatformUser, } from './platform.ts';
4
5
  export { PLATFORM_PRODUCTS, type PlatformProduct } from './products.ts';
@@ -1,4 +1,5 @@
1
1
  export { parseSeedCsv } from "./csv.js";
2
2
  export { mergeConfigs } from "./merge.js";
3
+ export { DEFAULT_NOTIFY_GATEWAYS, } from "./notifyDispatch.js";
3
4
  export { platformPreset, } from "./platform.js";
4
5
  export { PLATFORM_PRODUCTS } from "./products.js";
@@ -0,0 +1,7 @@
1
+ export declare const JVM_ZONE_IDS: readonly string[];
2
+ export declare function kotlinString(value: unknown): string;
3
+ export declare function zoneIdError(id: string): string | undefined;
4
+ export declare function jodaFormat(pattern: string, epochMillis: number, zone: string): string | undefined;
5
+ export declare function jodaIso(epochMillis: number, zone: string): string;
6
+ export declare function knownZone(zone: string): boolean;
7
+ export declare function hostZone(): string;