@genesislcap/pbc-reporting-ui 14.427.0 → 14.427.1-TAM-8.26-patch.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,WAK7C,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,UAAS,MAAsC,KAC9C,MAWF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,MAAY,cAAc,MAAM,iCAwBnF,CAAC"}
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,+BAA+B,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,WAK7C,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,UAAS,MAAsC,KAC9C,MAWF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,OAAO,MAAY,cAAc,MAAM,iCAkCnF,CAAC"}
@@ -22,6 +22,14 @@ export const getEndpointUrl = (endpoint, urlRoot = tryReadFromSession('hostUrl')
22
22
  export const getDatasourceSchema = (connect) => (resourceName) => __awaiter(void 0, void 0, void 0, function* () {
23
23
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
24
24
  const result = yield connect.getJSONSchema(resourceName);
25
+ // A server-side failure (e.g. JSON_SCHEMA_NACK) comes back as an error message rather
26
+ // than a schema. Surface that error directly instead of masking it as a shape problem.
27
+ const errors = result === null || result === void 0 ? void 0 : result.ERROR;
28
+ if (Array.isArray(errors) && errors.length) {
29
+ throw new Error(`Failed to fetch JSON schema for ${resourceName}: ${errors
30
+ .map((error) => [error === null || error === void 0 ? void 0 : error.STATUS_CODE, error === null || error === void 0 ? void 0 : error.CODE, error === null || error === void 0 ? void 0 : error.TEXT].filter(Boolean).join(' - '))
31
+ .join('; ')}`);
32
+ }
25
33
  if (typeof ((_b = (_a = result.OUTBOUND) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b['REPLY']) !== 'object' ||
26
34
  !((_d = (_c = result.OUTBOUND) === null || _c === void 0 ? void 0 : _c.properties) === null || _d === void 0 ? void 0 : _d['REPLY'].items) ||
27
35
  typeof ((_f = (_e = result.OUTBOUND) === null || _e === void 0 ? void 0 : _e.properties) === null || _f === void 0 ? void 0 : _f['REPLY'].items) === 'boolean')
@@ -26,6 +26,31 @@ GetDatasourceSchema('returns schema items when response is valid', () => __await
26
26
  const result = yield getSchema('TEST_RESOURCE');
27
27
  assert.equal(result, mockResponse.OUTBOUND.properties.REPLY.items);
28
28
  }));
29
+ GetDatasourceSchema('surfaces server error response instead of a shape error', () => __awaiter(void 0, void 0, void 0, function* () {
30
+ const mockConnect = {
31
+ getJSONSchema: sinon.stub(),
32
+ };
33
+ const mockResponse = {
34
+ MESSAGE_TYPE: 'JSON_SCHEMA_NACK',
35
+ ERROR: [
36
+ {
37
+ '@type': 'StandardError',
38
+ CODE: 'FEATURE_NOT_FOUND',
39
+ STATUS_CODE: '404 Not Found',
40
+ TEXT: 'Feature not found',
41
+ },
42
+ ],
43
+ };
44
+ mockConnect.getJSONSchema.resolves(mockResponse);
45
+ const getSchema = getDatasourceSchema(mockConnect);
46
+ try {
47
+ yield getSchema('Allocations');
48
+ assert.unreachable('Expected function to throw');
49
+ }
50
+ catch (error) {
51
+ assert.equal(error.message, 'Failed to fetch JSON schema for Allocations: 404 Not Found - FEATURE_NOT_FOUND - Feature not found');
52
+ }
53
+ }));
29
54
  GetDatasourceSchema('throws error when items is missing', () => __awaiter(void 0, void 0, void 0, function* () {
30
55
  const mockConnect = {
31
56
  getJSONSchema: sinon.stub(),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/pbc-reporting-ui",
3
3
  "description": "Genesis PBC Reporting UI",
4
- "version": "14.427.0",
4
+ "version": "14.427.1-TAM-8.26-patch.2",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/dts/index.d.ts",
@@ -109,21 +109,21 @@
109
109
  "@ag-grid-community/core": "29.2.0"
110
110
  },
111
111
  "dependencies": {
112
- "@genesislcap/foundation-comms": "14.427.0",
113
- "@genesislcap/foundation-entity-management": "14.427.0",
114
- "@genesislcap/foundation-events": "14.427.0",
115
- "@genesislcap/foundation-forms": "14.427.0",
116
- "@genesislcap/foundation-logger": "14.427.0",
117
- "@genesislcap/foundation-notifications": "14.427.0",
118
- "@genesislcap/foundation-ui": "14.427.0",
119
- "@genesislcap/foundation-user": "14.427.0",
120
- "@genesislcap/foundation-utils": "14.427.0",
121
- "@genesislcap/foundation-zero": "14.427.0",
122
- "@genesislcap/foundation-zero-grid-pro": "14.427.0",
123
- "@genesislcap/grid-pro": "14.427.0",
124
- "@genesislcap/rapid-design-system": "14.427.0",
125
- "@genesislcap/rapid-grid-pro": "14.427.0",
126
- "@genesislcap/web-core": "14.427.0",
112
+ "@genesislcap/foundation-comms": "14.427.1-TAM-8.26-patch.2",
113
+ "@genesislcap/foundation-entity-management": "14.427.1-TAM-8.26-patch.2",
114
+ "@genesislcap/foundation-events": "14.427.1-TAM-8.26-patch.2",
115
+ "@genesislcap/foundation-forms": "14.427.1-TAM-8.26-patch.2",
116
+ "@genesislcap/foundation-logger": "14.427.1-TAM-8.26-patch.2",
117
+ "@genesislcap/foundation-notifications": "14.427.1-TAM-8.26-patch.2",
118
+ "@genesislcap/foundation-ui": "14.427.1-TAM-8.26-patch.2",
119
+ "@genesislcap/foundation-user": "14.427.1-TAM-8.26-patch.2",
120
+ "@genesislcap/foundation-utils": "14.427.1-TAM-8.26-patch.2",
121
+ "@genesislcap/foundation-zero": "14.427.1-TAM-8.26-patch.2",
122
+ "@genesislcap/foundation-zero-grid-pro": "14.427.1-TAM-8.26-patch.2",
123
+ "@genesislcap/grid-pro": "14.427.1-TAM-8.26-patch.2",
124
+ "@genesislcap/rapid-design-system": "14.427.1-TAM-8.26-patch.2",
125
+ "@genesislcap/rapid-grid-pro": "14.427.1-TAM-8.26-patch.2",
126
+ "@genesislcap/web-core": "14.427.1-TAM-8.26-patch.2",
127
127
  "@reduxjs/toolkit": "^2.2.5",
128
128
  "@types/node": "^22.10.2",
129
129
  "change-case": "^5.4.3",
@@ -132,11 +132,11 @@
132
132
  "devDependencies": {
133
133
  "@genesiscommunitysuccess/cep-fast-plugin": "^5.0.3",
134
134
  "@genesiscommunitysuccess/custom-elements-lsp": "^5.0.3",
135
- "@genesislcap/eslint-config": "14.427.0",
136
- "@genesislcap/foundation-testing": "14.427.0",
137
- "@genesislcap/genx": "14.427.0",
138
- "@genesislcap/prettier-config": "14.427.0",
139
- "@genesislcap/stylelint-config": "14.427.0",
135
+ "@genesislcap/eslint-config": "14.427.1-TAM-8.26-patch.2",
136
+ "@genesislcap/foundation-testing": "14.427.1-TAM-8.26-patch.2",
137
+ "@genesislcap/genx": "14.427.1-TAM-8.26-patch.2",
138
+ "@genesislcap/prettier-config": "14.427.1-TAM-8.26-patch.2",
139
+ "@genesislcap/stylelint-config": "14.427.1-TAM-8.26-patch.2",
140
140
  "@types/json-schema": "^7.0.11",
141
141
  "playwright-lighthouse": "^4.0.0",
142
142
  "rimraf": "^5.0.0"
@@ -145,5 +145,5 @@
145
145
  "access": "public"
146
146
  },
147
147
  "customElements": "dist/custom-elements.json",
148
- "gitHead": "8906c7c7a03330a19b81a9aa77b6c45f66b3ef6d"
148
+ "gitHead": "58e50904c9846ce49d3e4ee9d803b075e078ca4b"
149
149
  }
@@ -33,6 +33,37 @@ GetDatasourceSchema('returns schema items when response is valid', async () => {
33
33
  assert.equal(result, mockResponse.OUTBOUND.properties.REPLY.items);
34
34
  });
35
35
 
36
+ GetDatasourceSchema('surfaces server error response instead of a shape error', async () => {
37
+ const mockConnect = {
38
+ getJSONSchema: sinon.stub(),
39
+ };
40
+
41
+ const mockResponse = {
42
+ MESSAGE_TYPE: 'JSON_SCHEMA_NACK',
43
+ ERROR: [
44
+ {
45
+ '@type': 'StandardError',
46
+ CODE: 'FEATURE_NOT_FOUND',
47
+ STATUS_CODE: '404 Not Found',
48
+ TEXT: 'Feature not found',
49
+ },
50
+ ],
51
+ };
52
+
53
+ mockConnect.getJSONSchema.resolves(mockResponse);
54
+ const getSchema = getDatasourceSchema(mockConnect as unknown as Connect);
55
+
56
+ try {
57
+ await getSchema('Allocations');
58
+ assert.unreachable('Expected function to throw');
59
+ } catch (error) {
60
+ assert.equal(
61
+ error.message,
62
+ 'Failed to fetch JSON schema for Allocations: 404 Not Found - FEATURE_NOT_FOUND - Feature not found',
63
+ );
64
+ }
65
+ });
66
+
36
67
  GetDatasourceSchema('throws error when items is missing', async () => {
37
68
  const mockConnect = {
38
69
  getJSONSchema: sinon.stub(),
@@ -1,4 +1,4 @@
1
- import { Connect, Session } from '@genesislcap/foundation-comms';
1
+ import { Connect, Message, Session } from '@genesislcap/foundation-comms';
2
2
  import { DI } from '@genesislcap/web-core';
3
3
  import { Genesis } from '../types';
4
4
 
@@ -27,6 +27,16 @@ export const getEndpointUrl = (
27
27
 
28
28
  export const getDatasourceSchema = (connect: Connect) => async (resourceName: string) => {
29
29
  const result = await connect.getJSONSchema(resourceName);
30
+ // A server-side failure (e.g. JSON_SCHEMA_NACK) comes back as an error message rather
31
+ // than a schema. Surface that error directly instead of masking it as a shape problem.
32
+ const errors = (result as unknown as Message)?.ERROR;
33
+ if (Array.isArray(errors) && errors.length) {
34
+ throw new Error(
35
+ `Failed to fetch JSON schema for ${resourceName}: ${errors
36
+ .map((error) => [error?.STATUS_CODE, error?.CODE, error?.TEXT].filter(Boolean).join(' - '))
37
+ .join('; ')}`,
38
+ );
39
+ }
30
40
  if (
31
41
  typeof result.OUTBOUND?.properties?.['REPLY'] !== 'object' ||
32
42
  !result.OUTBOUND?.properties?.['REPLY'].items ||