@genesislcap/pbc-reporting-ui 14.472.1 → 14.473.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.
@@ -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.472.1",
4
+ "version": "14.473.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/dts/index.d.ts",
@@ -86,21 +86,21 @@
86
86
  "@ag-grid-community/core": "29.2.0"
87
87
  },
88
88
  "dependencies": {
89
- "@genesislcap/foundation-comms": "14.472.1",
90
- "@genesislcap/foundation-entity-management": "14.472.1",
91
- "@genesislcap/foundation-events": "14.472.1",
92
- "@genesislcap/foundation-forms": "14.472.1",
93
- "@genesislcap/foundation-logger": "14.472.1",
94
- "@genesislcap/foundation-notifications": "14.472.1",
95
- "@genesislcap/foundation-ui": "14.472.1",
96
- "@genesislcap/foundation-user": "14.472.1",
97
- "@genesislcap/foundation-utils": "14.472.1",
98
- "@genesislcap/foundation-zero": "14.472.1",
99
- "@genesislcap/foundation-zero-grid-pro": "14.472.1",
100
- "@genesislcap/grid-pro": "14.472.1",
101
- "@genesislcap/rapid-design-system": "14.472.1",
102
- "@genesislcap/rapid-grid-pro": "14.472.1",
103
- "@genesislcap/web-core": "14.472.1",
89
+ "@genesislcap/foundation-comms": "14.473.0",
90
+ "@genesislcap/foundation-entity-management": "14.473.0",
91
+ "@genesislcap/foundation-events": "14.473.0",
92
+ "@genesislcap/foundation-forms": "14.473.0",
93
+ "@genesislcap/foundation-logger": "14.473.0",
94
+ "@genesislcap/foundation-notifications": "14.473.0",
95
+ "@genesislcap/foundation-ui": "14.473.0",
96
+ "@genesislcap/foundation-user": "14.473.0",
97
+ "@genesislcap/foundation-utils": "14.473.0",
98
+ "@genesislcap/foundation-zero": "14.473.0",
99
+ "@genesislcap/foundation-zero-grid-pro": "14.473.0",
100
+ "@genesislcap/grid-pro": "14.473.0",
101
+ "@genesislcap/rapid-design-system": "14.473.0",
102
+ "@genesislcap/rapid-grid-pro": "14.473.0",
103
+ "@genesislcap/web-core": "14.473.0",
104
104
  "@reduxjs/toolkit": "^2.2.5",
105
105
  "@types/node": "^22.10.2",
106
106
  "change-case": "^5.4.3",
@@ -109,11 +109,11 @@
109
109
  "devDependencies": {
110
110
  "@genesiscommunitysuccess/cep-fast-plugin": "^5.0.3",
111
111
  "@genesiscommunitysuccess/custom-elements-lsp": "^5.0.3",
112
- "@genesislcap/eslint-config": "14.472.1",
113
- "@genesislcap/foundation-testing": "14.472.1",
114
- "@genesislcap/genx": "14.472.1",
115
- "@genesislcap/prettier-config": "14.472.1",
116
- "@genesislcap/stylelint-config": "14.472.1",
112
+ "@genesislcap/eslint-config": "14.473.0",
113
+ "@genesislcap/foundation-testing": "14.473.0",
114
+ "@genesislcap/genx": "14.473.0",
115
+ "@genesislcap/prettier-config": "14.473.0",
116
+ "@genesislcap/stylelint-config": "14.473.0",
117
117
  "@types/json-schema": "^7.0.11",
118
118
  "playwright-lighthouse": "^4.0.0",
119
119
  "rimraf": "^5.0.0"
@@ -122,5 +122,5 @@
122
122
  "access": "public"
123
123
  },
124
124
  "customElements": "dist/custom-elements.json",
125
- "gitHead": "552eb1292e66bba5b3f27f2b0fbd6cbe62c20772"
125
+ "gitHead": "2408f54cd71e4fe715ab6cbb43b6fd16ec2b733e"
126
126
  }
@@ -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 ||