@alliance-droid/status-feedback-system 4.2.0 → 4.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.2
4
+
5
+ ### Fixed
6
+
7
+ - SvelteKit feedback proxy: read-only board status transition probes now return `200` with `canManage: false` when the browser has no usable management bearer token, avoiding noisy console `401` / `403` errors. Status mutations still require and forward a valid bearer token.
8
+
9
+ ## 4.2.1
10
+
11
+ ### Fixed
12
+
13
+ - SvelteKit feedback proxy: private-app authentication/authorization now runs before missing proxy configuration is reported, so unauthenticated callers receive `401` instead of learning whether `SF_API_URL` / `SF_API_KEY` are configured.
14
+
3
15
  ## 4.2.0
4
16
 
5
17
  ### Added
@@ -31,9 +31,6 @@ async function handleProxyRequest(event, options) {
31
31
  const route = getRouteSpec(event.request.method, resolvedPath.path);
32
32
  if (!route)
33
33
  return feedbackError(404, 'Feedback endpoint not found');
34
- const config = await getResolvedConfig(options);
35
- if (!config)
36
- return feedbackError(503, 'Feedback service is not configured');
37
34
  const user = options.resolveUser ? await options.resolveUser(event) : null;
38
35
  const requireUser = await shouldRequireUser(event, options, route.operation, resolvedPath.source);
39
36
  if (requireUser && !user)
@@ -56,6 +53,9 @@ async function handleProxyRequest(event, options) {
56
53
  }
57
54
  }
58
55
  }
56
+ const config = await getResolvedConfig(options);
57
+ if (!config)
58
+ return feedbackError(503, 'Feedback service is not configured');
59
59
  const upstreamUrl = buildUpstreamUrl(config.apiUrl, route.upstreamPath, copyAllowedSearchParams(event.url.searchParams, route.allowedSearchParams ?? []));
60
60
  const headers = new Headers({
61
61
  Accept: 'application/json',
@@ -64,6 +64,8 @@ async function handleProxyRequest(event, options) {
64
64
  if (route.forwardBearerToken) {
65
65
  const authorization = event.request.headers.get('authorization');
66
66
  if (!authorization?.toLowerCase().startsWith('bearer ')) {
67
+ if (route.operation === 'transitions')
68
+ return statusManagementUnavailable();
67
69
  return feedbackError(401, 'Status feedback access token required');
68
70
  }
69
71
  headers.set('Authorization', authorization);
@@ -84,6 +86,10 @@ async function handleProxyRequest(event, options) {
84
86
  headers,
85
87
  body,
86
88
  });
89
+ if (route.operation === 'transitions' &&
90
+ (upstreamResponse.status === 401 || upstreamResponse.status === 403)) {
91
+ return statusManagementUnavailable();
92
+ }
87
93
  return await toProxyResponse(upstreamResponse);
88
94
  }
89
95
  catch {
@@ -378,6 +384,25 @@ function feedbackError(status, message) {
378
384
  },
379
385
  });
380
386
  }
387
+ function feedbackData(data) {
388
+ return new Response(JSON.stringify({
389
+ success: true,
390
+ data,
391
+ }), {
392
+ status: 200,
393
+ headers: {
394
+ 'Content-Type': 'application/json',
395
+ 'Cache-Control': 'no-store',
396
+ },
397
+ });
398
+ }
399
+ function statusManagementUnavailable() {
400
+ return feedbackData({
401
+ current: { status: 'unknown', display: 'Unknown', publicStatus: 'open' },
402
+ targets: [],
403
+ canManage: false,
404
+ });
405
+ }
381
406
  function trimSlashes(value) {
382
407
  return value.replace(/^\/+|\/+$/g, '');
383
408
  }
package/package.json CHANGED
@@ -1,69 +1,70 @@
1
- {
2
- "name": "@alliance-droid/status-feedback-system",
3
- "version": "4.2.0",
4
- "type": "module",
5
- "description": "Drop-in system status pages and user feedback forms for SvelteKit apps",
6
- "svelte": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "svelte": "./dist/index.js"
12
- },
13
- "./sveltekit/server": {
14
- "types": "./dist/sveltekit/server.d.ts",
15
- "default": "./dist/sveltekit/server.js"
16
- }
17
- },
18
- "files": [
19
- "dist",
20
- "!dist/**/*.test.*",
21
- "CHANGELOG.md"
22
- ],
23
- "peerDependencies": {
24
- "@alliance-droid/svelte-component-library": ">=1.3.2",
25
- "svelte": "^5.48.0"
26
- },
27
- "devDependencies": {
28
- "@alliance-droid/svelte-component-library": "^1.3.2",
29
- "@eslint/js": "^10.0.1",
30
- "@sveltejs/package": "^2.3.0",
31
- "@sveltejs/vite-plugin-svelte": "^6.0.0",
32
- "@testing-library/jest-dom": "^6.9.1",
33
- "@testing-library/svelte": "^5.3.1",
34
- "eslint": "^10.4.0",
35
- "eslint-plugin-svelte": "^3.17.1",
36
- "globals": "^17.6.0",
37
- "jsdom": "^29.0.0",
38
- "publint": "^0.3.0",
39
- "svelte": "^5.48.0",
40
- "svelte-check": "^4.3.0",
41
- "typescript": "^5.9.0",
42
- "typescript-eslint": "^8.59.4",
43
- "vite": "^7.3.0",
44
- "vitest": "^4.0.0"
45
- },
46
- "keywords": [
47
- "svelte",
48
- "sveltekit",
49
- "status-page",
50
- "feedback",
51
- "uptime"
52
- ],
53
- "author": "Alliance Technical Group",
54
- "license": "UNLICENSED",
55
- "publishConfig": {
56
- "access": "restricted"
57
- },
58
- "repository": {
59
- "type": "git",
60
- "url": "git+https://alliance.ghe.com/alliance/status-feedback-system.git"
61
- },
62
- "scripts": {
63
- "build": "svelte-package -o dist && publint",
64
- "lint": "eslint src",
65
- "check": "svelte-check --tsconfig ./tsconfig.json",
66
- "test": "vitest run",
67
- "test:watch": "vitest"
68
- }
69
- }
1
+ {
2
+ "name": "@alliance-droid/status-feedback-system",
3
+ "version": "4.2.2",
4
+ "type": "module",
5
+ "description": "Drop-in system status pages and user feedback forms for SvelteKit apps",
6
+ "svelte": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "svelte": "./dist/index.js"
12
+ },
13
+ "./sveltekit/server": {
14
+ "types": "./dist/sveltekit/server.d.ts",
15
+ "default": "./dist/sveltekit/server.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "!dist/**/*.test.*",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "svelte-package -o dist && publint",
25
+ "lint": "eslint src",
26
+ "check": "svelte-check --tsconfig ./tsconfig.json",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "peerDependencies": {
32
+ "@alliance-droid/svelte-component-library": ">=1.3.2",
33
+ "svelte": "^5.48.0"
34
+ },
35
+ "devDependencies": {
36
+ "@alliance-droid/svelte-component-library": "^1.3.2",
37
+ "@eslint/js": "^10.0.1",
38
+ "@sveltejs/package": "^2.3.0",
39
+ "@sveltejs/vite-plugin-svelte": "^6.0.0",
40
+ "@testing-library/jest-dom": "^6.9.1",
41
+ "@testing-library/svelte": "^5.3.1",
42
+ "eslint": "^10.4.0",
43
+ "eslint-plugin-svelte": "^3.17.1",
44
+ "globals": "^17.6.0",
45
+ "jsdom": "^29.0.0",
46
+ "publint": "^0.3.0",
47
+ "svelte": "^5.48.0",
48
+ "svelte-check": "^4.3.0",
49
+ "typescript": "^5.9.0",
50
+ "typescript-eslint": "^8.59.4",
51
+ "vite": "^7.3.0",
52
+ "vitest": "^4.0.0"
53
+ },
54
+ "keywords": [
55
+ "svelte",
56
+ "sveltekit",
57
+ "status-page",
58
+ "feedback",
59
+ "uptime"
60
+ ],
61
+ "author": "Alliance Technical Group",
62
+ "license": "UNLICENSED",
63
+ "publishConfig": {
64
+ "access": "restricted"
65
+ },
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://alliance.ghe.com/alliance/status-feedback-system.git"
69
+ }
70
+ }