@genesislcap/foundation-utils 14.260.3-alpha-c132865.0 → 14.261.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.
@@ -369,23 +369,50 @@
369
369
  },
370
370
  {
371
371
  "kind": "javascript-module",
372
- "path": "src/directives/index.ts",
373
- "declarations": [],
372
+ "path": "src/design-system/design-system.ts",
373
+ "declarations": [
374
+ {
375
+ "kind": "function",
376
+ "name": "assureDesignSystem",
377
+ "return": {
378
+ "type": {
379
+ "text": "DesignSystemModule"
380
+ }
381
+ },
382
+ "parameters": [
383
+ {
384
+ "name": "module",
385
+ "type": {
386
+ "text": "DesignSystemModule"
387
+ }
388
+ }
389
+ ],
390
+ "description": "assureDesignSystem.",
391
+ "privacy": "public"
392
+ }
393
+ ],
374
394
  "exports": [
375
395
  {
376
396
  "kind": "js",
377
- "name": "*",
397
+ "name": "assureDesignSystem",
378
398
  "declaration": {
379
- "name": "*",
380
- "package": "./sync"
399
+ "name": "assureDesignSystem",
400
+ "module": "src/design-system/design-system.ts"
381
401
  }
382
- },
402
+ }
403
+ ]
404
+ },
405
+ {
406
+ "kind": "javascript-module",
407
+ "path": "src/design-system/index.ts",
408
+ "declarations": [],
409
+ "exports": [
383
410
  {
384
411
  "kind": "js",
385
412
  "name": "*",
386
413
  "declaration": {
387
414
  "name": "*",
388
- "package": "./when-else"
415
+ "package": "./design-system"
389
416
  }
390
417
  }
391
418
  ]
@@ -445,7 +472,7 @@
445
472
  },
446
473
  {
447
474
  "kind": "javascript-module",
448
- "path": "src/encoding/index.ts",
475
+ "path": "src/directives/index.ts",
449
476
  "declarations": [],
450
477
  "exports": [
451
478
  {
@@ -453,49 +480,22 @@
453
480
  "name": "*",
454
481
  "declaration": {
455
482
  "name": "*",
456
- "package": "./base64"
483
+ "package": "./sync"
457
484
  }
458
- }
459
- ]
460
- },
461
- {
462
- "kind": "javascript-module",
463
- "path": "src/design-system/design-system.ts",
464
- "declarations": [
465
- {
466
- "kind": "function",
467
- "name": "assureDesignSystem",
468
- "return": {
469
- "type": {
470
- "text": "DesignSystemModule"
471
- }
472
- },
473
- "parameters": [
474
- {
475
- "name": "module",
476
- "type": {
477
- "text": "DesignSystemModule"
478
- }
479
- }
480
- ],
481
- "description": "assureDesignSystem.",
482
- "privacy": "public"
483
- }
484
- ],
485
- "exports": [
485
+ },
486
486
  {
487
487
  "kind": "js",
488
- "name": "assureDesignSystem",
488
+ "name": "*",
489
489
  "declaration": {
490
- "name": "assureDesignSystem",
491
- "module": "src/design-system/design-system.ts"
490
+ "name": "*",
491
+ "package": "./when-else"
492
492
  }
493
493
  }
494
494
  ]
495
495
  },
496
496
  {
497
497
  "kind": "javascript-module",
498
- "path": "src/design-system/index.ts",
498
+ "path": "src/encoding/index.ts",
499
499
  "declarations": [],
500
500
  "exports": [
501
501
  {
@@ -503,7 +503,7 @@
503
503
  "name": "*",
504
504
  "declaration": {
505
505
  "name": "*",
506
- "package": "./design-system"
506
+ "package": "./base64"
507
507
  }
508
508
  }
509
509
  ]
@@ -2922,6 +2922,12 @@
2922
2922
  }
2923
2923
  ]
2924
2924
  },
2925
+ {
2926
+ "kind": "javascript-module",
2927
+ "path": "src/mappers/genesis-json-schema/test.ts",
2928
+ "declarations": [],
2929
+ "exports": []
2930
+ },
2925
2931
  {
2926
2932
  "kind": "javascript-module",
2927
2933
  "path": "src/mappers/genesis-json-schema/types.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mappers/genesis-json-schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,cAAc,SAAS,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE;IACtD,QAAQ,EAAE,WAAW,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAwBtB;AAsCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;IACnE,MAAM;IACN,OAAO,CAAC,eAAe;CACxB,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CASrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mappers/genesis-json-schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,cAAc,SAAS,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,iBAAiB,EAAE;IACtD,QAAQ,EAAE,WAAW,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAwBtB;AA0DD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;IACnE,MAAM;IACN,OAAO,CAAC,eAAe;CACxB,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,CASrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../src/mappers/genesis-json-schema/test.ts"],"names":[],"mappings":""}
@@ -21,14 +21,27 @@ export function mapGenesisJsonSchema(jsonSchemResponse) {
21
21
  throw new Error(`Schema properties don't contain 'genesisType' field`);
22
22
  return (_x = (_w = (_v = result.OUTBOUND) === null || _v === void 0 ? void 0 : _v.properties) === null || _w === void 0 ? void 0 : _w['REPLY']) === null || _x === void 0 ? void 0 : _x.items;
23
23
  }
24
+ function extractEnumValues(schema, fieldName) {
25
+ if (schema.enum) {
26
+ // If there's a top-level enum property, use it
27
+ return schema.enum;
28
+ }
29
+ if (schema.oneOf) {
30
+ // Look for enum values within the oneOf structure
31
+ const stringTypeSchema = schema.oneOf.find((s) => s.type === 'string' && Array.isArray(s.enum));
32
+ if (stringTypeSchema && stringTypeSchema.enum) {
33
+ return stringTypeSchema.enum;
34
+ }
35
+ }
36
+ throw new Error(`Could not extract enum values for field '${fieldName}'`);
37
+ }
24
38
  function mapGenesisFieldTypeToFieldInputAndType(partialData, schema) {
25
39
  switch (schema.genesisType) {
26
40
  case 'STRING':
27
41
  return Object.assign(Object.assign({}, partialData), { type: 'string', input: 'text' });
28
42
  case 'ENUM':
29
- if (!schema.enum)
30
- throw new Error('Enum type but without enum values');
31
- return Object.assign(Object.assign({}, partialData), { type: 'enum', input: 'select', values: schema.enum.reduce((acum, v) => (Object.assign(Object.assign({}, acum), { [v]: v })), {}) });
43
+ const enumVals = extractEnumValues(schema, partialData.fieldId);
44
+ return Object.assign(Object.assign({}, partialData), { type: 'enum', input: 'select', values: enumVals.reduce((acum, v) => (Object.assign(Object.assign({}, acum), { [v]: v })), {}) });
32
45
  case 'INT':
33
46
  return Object.assign(Object.assign({}, partialData), { type: 'int', input: 'number' });
34
47
  case 'SHORT':
@@ -0,0 +1,261 @@
1
+ import { assert, createLogicSuite } from '@genesislcap/foundation-testing';
2
+ import { mapJsonSchemaFieldToExprBuilderField } from '.';
3
+ const LogicSuite = createLogicSuite('mapJsonSchemaFieldToExprBuilderField');
4
+ LogicSuite('makes all root properties on the object observable', () => {
5
+ const exampleTradeSchema = {
6
+ properties: {
7
+ TRADE_ID: {
8
+ type: 'integer',
9
+ description: '',
10
+ genesisType: 'LONG',
11
+ },
12
+ TRADED_PRICE: {
13
+ type: 'number',
14
+ description: '',
15
+ genesisType: 'DOUBLE',
16
+ },
17
+ TRADED_QUANTITY: {
18
+ type: 'integer',
19
+ description: '',
20
+ genesisType: 'INT',
21
+ },
22
+ ORDER_ID: {
23
+ type: 'integer',
24
+ description: '',
25
+ genesisType: 'LONG',
26
+ },
27
+ ORDER_DATETIME: {
28
+ oneOf: [
29
+ {
30
+ type: 'null',
31
+ },
32
+ {
33
+ type: 'integer',
34
+ },
35
+ ],
36
+ description: '',
37
+ genesisType: 'DATETIME',
38
+ },
39
+ DIRECTION: {
40
+ oneOf: [
41
+ {
42
+ type: 'null',
43
+ },
44
+ {
45
+ type: 'string',
46
+ enum: ['SELL', 'SHORT_SELL', 'BUY'],
47
+ },
48
+ ],
49
+ description: '',
50
+ genesisType: 'ENUM',
51
+ },
52
+ IS_AGENCY: {
53
+ oneOf: [
54
+ {
55
+ type: 'null',
56
+ },
57
+ {
58
+ type: 'boolean',
59
+ },
60
+ ],
61
+ description: '',
62
+ genesisType: 'BOOLEAN',
63
+ },
64
+ QUANTITY: {
65
+ oneOf: [
66
+ {
67
+ type: 'null',
68
+ },
69
+ {
70
+ type: 'integer',
71
+ },
72
+ ],
73
+ description: '',
74
+ genesisType: 'INT',
75
+ },
76
+ PRICE: {
77
+ oneOf: [
78
+ {
79
+ type: 'null',
80
+ },
81
+ {
82
+ type: 'number',
83
+ },
84
+ ],
85
+ description: '',
86
+ genesisType: 'DOUBLE',
87
+ },
88
+ ORDER_DATE: {
89
+ oneOf: [
90
+ {
91
+ type: 'null',
92
+ },
93
+ {
94
+ type: 'integer',
95
+ },
96
+ ],
97
+ description: '',
98
+ genesisType: 'DATE',
99
+ },
100
+ COUNTERPARTY_ID: {
101
+ oneOf: [
102
+ {
103
+ type: 'null',
104
+ },
105
+ {
106
+ type: 'integer',
107
+ },
108
+ ],
109
+ description: '',
110
+ genesisType: 'LONG',
111
+ },
112
+ INSTRUMENT_ID: {
113
+ oneOf: [
114
+ {
115
+ type: 'null',
116
+ },
117
+ {
118
+ type: 'integer',
119
+ },
120
+ ],
121
+ description: '',
122
+ genesisType: 'LONG',
123
+ },
124
+ COUNTERPARTY_NAME: {
125
+ oneOf: [
126
+ {
127
+ type: 'null',
128
+ },
129
+ {
130
+ type: 'string',
131
+ },
132
+ ],
133
+ description: '',
134
+ genesisType: 'STRING',
135
+ },
136
+ SYMBOL: {
137
+ oneOf: [
138
+ {
139
+ type: 'null',
140
+ },
141
+ {
142
+ type: 'string',
143
+ },
144
+ ],
145
+ description: '',
146
+ genesisType: 'STRING',
147
+ },
148
+ RECORD_ID: {
149
+ type: 'integer',
150
+ description: '',
151
+ genesisType: 'LONG',
152
+ },
153
+ TIMESTAMP: {
154
+ type: 'integer',
155
+ description: '',
156
+ genesisType: 'NANO_TIMESTAMP',
157
+ },
158
+ },
159
+ };
160
+ const expected = [
161
+ {
162
+ fieldId: 'TRADE_ID',
163
+ label: 'TRADE_ID',
164
+ type: 'long',
165
+ input: 'number',
166
+ },
167
+ {
168
+ fieldId: 'TRADED_PRICE',
169
+ label: 'TRADED_PRICE',
170
+ type: 'double',
171
+ input: 'number',
172
+ },
173
+ {
174
+ fieldId: 'TRADED_QUANTITY',
175
+ label: 'TRADED_QUANTITY',
176
+ type: 'int',
177
+ input: 'number',
178
+ },
179
+ {
180
+ fieldId: 'ORDER_ID',
181
+ label: 'ORDER_ID',
182
+ type: 'long',
183
+ input: 'number',
184
+ },
185
+ {
186
+ fieldId: 'ORDER_DATETIME',
187
+ label: 'ORDER_DATETIME',
188
+ type: 'date-time',
189
+ input: 'datetime-local',
190
+ },
191
+ {
192
+ fieldId: 'DIRECTION',
193
+ label: 'DIRECTION',
194
+ type: 'enum',
195
+ input: 'select',
196
+ values: {
197
+ SELL: 'SELL',
198
+ SHORT_SELL: 'SHORT_SELL',
199
+ BUY: 'BUY',
200
+ },
201
+ },
202
+ {
203
+ fieldId: 'IS_AGENCY',
204
+ label: 'IS_AGENCY',
205
+ type: 'boolean',
206
+ input: 'checkbox',
207
+ },
208
+ {
209
+ fieldId: 'QUANTITY',
210
+ label: 'QUANTITY',
211
+ type: 'int',
212
+ input: 'number',
213
+ },
214
+ {
215
+ fieldId: 'PRICE',
216
+ label: 'PRICE',
217
+ type: 'double',
218
+ input: 'number',
219
+ },
220
+ {
221
+ fieldId: 'ORDER_DATE',
222
+ label: 'ORDER_DATE',
223
+ type: 'date',
224
+ input: 'date',
225
+ },
226
+ {
227
+ fieldId: 'COUNTERPARTY_ID',
228
+ label: 'COUNTERPARTY_ID',
229
+ type: 'long',
230
+ input: 'number',
231
+ },
232
+ {
233
+ fieldId: 'INSTRUMENT_ID',
234
+ label: 'INSTRUMENT_ID',
235
+ type: 'long',
236
+ input: 'number',
237
+ },
238
+ {
239
+ fieldId: 'COUNTERPARTY_NAME',
240
+ label: 'COUNTERPARTY_NAME',
241
+ type: 'string',
242
+ input: 'text',
243
+ },
244
+ {
245
+ fieldId: 'SYMBOL',
246
+ label: 'SYMBOL',
247
+ type: 'string',
248
+ input: 'text',
249
+ },
250
+ {
251
+ fieldId: 'RECORD_ID',
252
+ label: 'RECORD_ID',
253
+ type: 'long',
254
+ input: 'number',
255
+ },
256
+ null,
257
+ ];
258
+ const fields = Object.entries(exampleTradeSchema.properties).map(mapJsonSchemaFieldToExprBuilderField);
259
+ assert.equal(fields, expected);
260
+ });
261
+ LogicSuite.run();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "14.260.3-alpha-c132865.0",
4
+ "version": "14.261.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -27,19 +27,19 @@
27
27
  }
28
28
  },
29
29
  "devDependencies": {
30
- "@genesislcap/foundation-testing": "14.260.3-alpha-c132865.0",
31
- "@genesislcap/genx": "14.260.3-alpha-c132865.0",
32
- "@genesislcap/rollup-builder": "14.260.3-alpha-c132865.0",
33
- "@genesislcap/ts-builder": "14.260.3-alpha-c132865.0",
34
- "@genesislcap/uvu-playwright-builder": "14.260.3-alpha-c132865.0",
35
- "@genesislcap/vite-builder": "14.260.3-alpha-c132865.0",
36
- "@genesislcap/webpack-builder": "14.260.3-alpha-c132865.0",
30
+ "@genesislcap/foundation-testing": "14.261.0",
31
+ "@genesislcap/genx": "14.261.0",
32
+ "@genesislcap/rollup-builder": "14.261.0",
33
+ "@genesislcap/ts-builder": "14.261.0",
34
+ "@genesislcap/uvu-playwright-builder": "14.261.0",
35
+ "@genesislcap/vite-builder": "14.261.0",
36
+ "@genesislcap/webpack-builder": "14.261.0",
37
37
  "@types/json-schema": "^7.0.11",
38
38
  "rimraf": "^5.0.0"
39
39
  },
40
40
  "dependencies": {
41
41
  "@genesislcap/expression-builder": "14.258.1",
42
- "@genesislcap/foundation-logger": "14.260.3-alpha-c132865.0",
42
+ "@genesislcap/foundation-logger": "14.261.0",
43
43
  "@microsoft/fast-components": "2.30.6",
44
44
  "@microsoft/fast-element": "1.14.0",
45
45
  "@microsoft/fast-foundation": "2.49.6",
@@ -57,5 +57,5 @@
57
57
  "access": "public"
58
58
  },
59
59
  "customElements": "dist/custom-elements.json",
60
- "gitHead": "99bcd5e37e68140e9558a5e54dd90c2821b28dfa"
60
+ "gitHead": "0f53a72fa79fcfc3ffb9a4b741815aaaad1a8980"
61
61
  }