@blossm/fact-get 0.0.35 → 0.0.37

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/deps.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { forbidden } from "@blossm/errors";
2
2
  import { unlinkSync } from "fs";
3
+ import forwardedToken from "@blossm/forwarded-token";
3
4
 
4
5
  export default {
5
6
  forbiddenError: forbidden,
6
7
  unlinkFile: unlinkSync,
8
+ forwardedToken,
7
9
  };
package/index.js CHANGED
@@ -29,22 +29,22 @@ export default ({
29
29
  queryAggregatesFn: queryAggregatesFn({
30
30
  ...(req.query.context && { context: req.query.context }),
31
31
  ...(req.query.claims && { claims: req.query.claims }),
32
- ...(req.query.token && { token: req.query.token }),
32
+ ...(deps.forwardedToken(req) && { token: deps.forwardedToken(req) }),
33
33
  }),
34
34
  aggregateFn: aggregateFn({
35
35
  ...(req.query.context && { context: req.query.context }),
36
36
  ...(req.query.claims && { claims: req.query.claims }),
37
- ...(req.query.token && { token: req.query.token }),
37
+ ...(deps.forwardedToken(req) && { token: deps.forwardedToken(req) }),
38
38
  }),
39
39
  readFactFn: readFactFn({
40
40
  ...(req.query.context && { context: req.query.context }),
41
41
  ...(req.query.claims && { claims: req.query.claims }),
42
- ...(req.query.token && { token: req.query.token }),
42
+ ...(deps.forwardedToken(req) && { token: deps.forwardedToken(req) }),
43
43
  }),
44
44
  streamFactFn: streamFactFn({
45
45
  ...(req.query.context && { context: req.query.context }),
46
46
  ...(req.query.claims && { claims: req.query.claims }),
47
- ...(req.query.token && { token: req.query.token }),
47
+ ...(deps.forwardedToken(req) && { token: deps.forwardedToken(req) }),
48
48
  }),
49
49
  });
50
50
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@blossm/fact-get",
3
3
  "description": "A fact server GET handler.",
4
- "version": "0.0.35",
4
+ "version": "0.0.37",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "author": "blossm.network",
8
8
  "engines": {
9
- "node": ">= 20.19.0"
9
+ "node": ">= 24.22.1"
10
10
  },
11
11
  "scripts": {
12
12
  "test": "mocha --recursive"
@@ -15,13 +15,13 @@
15
15
  "access": "public"
16
16
  },
17
17
  "dependencies": {
18
- "@blossm/errors": "^0.0.40"
18
+ "@blossm/errors": "^0.0.41",
19
+ "@blossm/forwarded-token": "^0.0.2"
19
20
  },
20
21
  "devDependencies": {
21
22
  "chai-datetime": "^1.8.1",
22
- "mocha": "^11.6.0",
23
- "sinon": "^21.0.0",
24
- "sinon-chai": "^4.0.0"
25
- },
26
- "gitHead": "2c039564fe85a778340e95c3133b51472e6ef080"
23
+ "mocha": "^12.0.3",
24
+ "sinon": "^22.1.0",
25
+ "sinon-chai": "^4.0.1"
26
+ }
27
27
  }
package/test/index.js CHANGED
@@ -39,6 +39,7 @@ describe("Fact get", () => {
39
39
  const aggregateFnFake = fake.returns(aggregateFn);
40
40
 
41
41
  const req = {
42
+ headers: {},
42
43
  params,
43
44
  query: {
44
45
  query,
@@ -103,10 +104,10 @@ describe("Fact get", () => {
103
104
  params: {
104
105
  root,
105
106
  },
107
+ headers: { "blossm-token": token },
106
108
  query: {
107
109
  context,
108
110
  claims,
109
- token,
110
111
  },
111
112
  };
112
113
 
@@ -174,6 +175,7 @@ describe("Fact get", () => {
174
175
  const aggregateFnFake = fake.returns(aggregateFn);
175
176
 
176
177
  const req = {
178
+ headers: {},
177
179
  params,
178
180
  query,
179
181
  };
@@ -203,6 +205,7 @@ describe("Fact get", () => {
203
205
  });
204
206
  it("should redirect correctly with no context", async () => {
205
207
  const req = {
208
+ headers: {},
206
209
  query: {},
207
210
  };
208
211
  const sendFake = fake();
@@ -232,13 +235,14 @@ describe("Fact get", () => {
232
235
  contexts: [context],
233
236
  query: undefined,
234
237
  },
235
- }
238
+ },
236
239
  );
237
240
  expect(e).to.equal(error);
238
241
  }
239
242
  });
240
243
  it("should redirect correctly with bad context", async () => {
241
244
  const req = {
245
+ headers: {},
242
246
  query: {
243
247
  context: {},
244
248
  },
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Blossm
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.