xoonya 2.13.0 → 2.15.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/server.js CHANGED
@@ -85,6 +85,21 @@ const {
85
85
  getTrustPortabilityProfile,
86
86
  summarizeTrustPortabilityPack
87
87
  } = require('./lib/trust_portability_pack');
88
+ const {
89
+ buildProofTruthModelPack,
90
+ summarizeProofTruthModelPack,
91
+ getProofTruthObjectDetail
92
+ } = require('./lib/proof_truth_contract');
93
+ const {
94
+ buildDefaultPathPack,
95
+ summarizeDefaultPathPack,
96
+ getDefaultPathSurfaceDetail
97
+ } = require('./lib/default_path_contract');
98
+ const {
99
+ buildFollowthroughTruthPack,
100
+ summarizeFollowthroughTruthPack,
101
+ getFollowthroughTruthProfileDetail
102
+ } = require('./lib/followthrough_truth_contract');
88
103
  const {
89
104
  buildOpenApiDocument,
90
105
  summarizeOpenApiDocument,
@@ -796,6 +811,90 @@ async function routeRequest(req, res) {
796
811
  return;
797
812
  }
798
813
 
814
+ if (req.method === 'GET' && url.pathname === '/v1/proof-truth') {
815
+ sendJson(res, 200, buildProofTruthModelPack());
816
+ return;
817
+ }
818
+
819
+ if (req.method === 'GET' && url.pathname === '/v1/proof-truth/summary') {
820
+ sendJson(res, 200, summarizeProofTruthModelPack());
821
+ return;
822
+ }
823
+
824
+ if (req.method === 'GET' && url.pathname.startsWith('/v1/proof-truth/')) {
825
+ const suffix = decodeURIComponent(url.pathname.slice('/v1/proof-truth/'.length));
826
+ if (suffix && suffix !== 'summary') {
827
+ const objectDetail = getProofTruthObjectDetail(suffix);
828
+ if (!objectDetail) {
829
+ sendJson(res, 404, { ok: false, error: 'proof_truth_object_not_found' });
830
+ return;
831
+ }
832
+ sendJson(res, 200, {
833
+ ok: true,
834
+ product: 'xoonya',
835
+ category: 'xoonya-proof-truth-detail',
836
+ object: objectDetail
837
+ });
838
+ return;
839
+ }
840
+ }
841
+
842
+ if (req.method === 'GET' && url.pathname === '/v1/default-path') {
843
+ sendJson(res, 200, buildDefaultPathPack());
844
+ return;
845
+ }
846
+
847
+ if (req.method === 'GET' && url.pathname === '/v1/default-path/summary') {
848
+ sendJson(res, 200, summarizeDefaultPathPack());
849
+ return;
850
+ }
851
+
852
+ if (req.method === 'GET' && url.pathname.startsWith('/v1/default-path/')) {
853
+ const suffix = decodeURIComponent(url.pathname.slice('/v1/default-path/'.length));
854
+ if (suffix && suffix !== 'summary') {
855
+ const surface = getDefaultPathSurfaceDetail(suffix);
856
+ if (!surface) {
857
+ sendJson(res, 404, { ok: false, error: 'default_path_surface_not_found' });
858
+ return;
859
+ }
860
+ sendJson(res, 200, {
861
+ ok: true,
862
+ product: 'xoonya',
863
+ category: 'xoonya-default-path-surface-detail',
864
+ surface
865
+ });
866
+ return;
867
+ }
868
+ }
869
+
870
+ if (req.method === 'GET' && url.pathname === '/v1/followthrough-truth') {
871
+ sendJson(res, 200, buildFollowthroughTruthPack());
872
+ return;
873
+ }
874
+
875
+ if (req.method === 'GET' && url.pathname === '/v1/followthrough-truth/summary') {
876
+ sendJson(res, 200, summarizeFollowthroughTruthPack());
877
+ return;
878
+ }
879
+
880
+ if (req.method === 'GET' && url.pathname.startsWith('/v1/followthrough-truth/')) {
881
+ const suffix = decodeURIComponent(url.pathname.slice('/v1/followthrough-truth/'.length));
882
+ if (suffix && suffix !== 'summary') {
883
+ const profile = getFollowthroughTruthProfileDetail(suffix);
884
+ if (!profile) {
885
+ sendJson(res, 404, { ok: false, error: 'followthrough_truth_profile_not_found' });
886
+ return;
887
+ }
888
+ sendJson(res, 200, {
889
+ ok: true,
890
+ product: 'xoonya',
891
+ category: 'xoonya-followthrough-truth-profile-detail',
892
+ profile
893
+ });
894
+ return;
895
+ }
896
+ }
897
+
799
898
  if (req.method === 'GET' && url.pathname === '/v1/providers') {
800
899
  sendJson(res, 200, buildProviderLanePack());
801
900
  return;
@@ -3450,6 +3549,16 @@ async function routeRequest(req, res) {
3450
3549
  return;
3451
3550
  }
3452
3551
 
3552
+ if (req.method === 'GET' && url.pathname === '/v1/proof-center/governance/disputes/summary') {
3553
+ try {
3554
+ const result = proofSdk.summarizeGovernanceDisputes({});
3555
+ sendJson(res, 200, result);
3556
+ } catch (error) {
3557
+ sendJson(res, 400, { ok: false, reason: error.message });
3558
+ }
3559
+ return;
3560
+ }
3561
+
3453
3562
  if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/case-review') {
3454
3563
  try {
3455
3564
  const body = await readJsonBody(req);