@striae-org/striae 6.1.8 → 7.0.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.
Files changed (45) hide show
  1. package/.env.example +0 -26
  2. package/app/components/actions/image-manage.ts +17 -67
  3. package/functions/api/audit/[[path]].ts +9 -24
  4. package/functions/api/data/[[path]].ts +9 -24
  5. package/functions/api/image/[[path]].ts +14 -30
  6. package/functions/api/pdf/[[path]].ts +9 -24
  7. package/functions/api/user/[[path]].ts +20 -36
  8. package/package.json +9 -10
  9. package/scripts/deploy-all.sh +29 -10
  10. package/scripts/deploy-config/modules/env-utils.sh +0 -68
  11. package/scripts/deploy-config/modules/prompt.sh +4 -110
  12. package/scripts/deploy-config/modules/scaffolding.sh +5 -0
  13. package/scripts/deploy-config/modules/validation.sh +1 -19
  14. package/scripts/deploy-pages-secrets.sh +0 -9
  15. package/scripts/deploy-worker-secrets.sh +2 -8
  16. package/tsconfig.json +1 -4
  17. package/workers/audit-worker/package.json +2 -2
  18. package/workers/audit-worker/src/audit-worker.ts +0 -5
  19. package/workers/audit-worker/src/config.ts +1 -6
  20. package/workers/audit-worker/src/types.ts +0 -1
  21. package/workers/audit-worker/wrangler.jsonc.example +2 -6
  22. package/workers/data-worker/package.json +3 -3
  23. package/workers/data-worker/src/config.ts +1 -6
  24. package/workers/data-worker/src/data-worker.ts +1 -6
  25. package/workers/data-worker/src/types.ts +0 -1
  26. package/workers/data-worker/wrangler.jsonc.example +2 -4
  27. package/workers/image-worker/package.json +2 -2
  28. package/workers/image-worker/src/handlers/delete-image.ts +0 -5
  29. package/workers/image-worker/src/handlers/mint-signed-url.ts +0 -5
  30. package/workers/image-worker/src/handlers/serve-image.ts +1 -2
  31. package/workers/image-worker/src/handlers/upload-image.ts +0 -5
  32. package/workers/image-worker/src/security/signed-url.ts +2 -2
  33. package/workers/image-worker/src/types.ts +0 -1
  34. package/workers/image-worker/wrangler.jsonc.example +2 -1
  35. package/workers/pdf-worker/package.json +2 -2
  36. package/workers/pdf-worker/src/pdf-worker.ts +0 -8
  37. package/workers/pdf-worker/wrangler.jsonc.example +2 -1
  38. package/workers/user-worker/package.json +2 -2
  39. package/workers/user-worker/src/auth.ts +0 -7
  40. package/workers/user-worker/src/types.ts +0 -2
  41. package/workers/user-worker/src/user-worker.ts +1 -3
  42. package/workers/user-worker/wrangler.jsonc.example +2 -1
  43. package/wrangler.toml.example +22 -2
  44. package/worker-configuration.d.ts +0 -7509
  45. package/workers/image-worker/src/auth.ts +0 -7
@@ -1,4 +1,3 @@
1
- import { hasValidToken } from '../auth';
2
1
  import {
3
2
  normalizeSignedUrlTtlSeconds,
4
3
  parseSignedUrlBaseUrl,
@@ -21,10 +20,6 @@ export async function handleSignedUrlMinting(
21
20
  fileId: string,
22
21
  createJsonResponse: CreateImageWorkerResponse
23
22
  ): Promise<Response> {
24
- if (!hasValidToken(request, env)) {
25
- return createJsonResponse({ error: 'Unauthorized' }, 403);
26
- }
27
-
28
23
  requireSignedUrlConfig(env);
29
24
 
30
25
  const existing = await env.STRIAE_FILES.head(fileId);
@@ -1,4 +1,3 @@
1
- import { hasValidToken } from '../auth';
2
1
  import {
3
2
  decryptBinaryWithRegistry,
4
3
  requireEncryptionRetrievalConfig
@@ -29,7 +28,7 @@ export async function handleImageServing(
29
28
  if (!tokenValid) {
30
29
  return createJsonResponse({ error: 'Invalid or expired signed URL token' }, 403);
31
30
  }
32
- } else if (!hasValidToken(request, env)) {
31
+ } else {
33
32
  return createJsonResponse({ error: 'Unauthorized' }, 403);
34
33
  }
35
34
 
@@ -1,4 +1,3 @@
1
- import { hasValidToken } from '../auth';
2
1
  import { encryptBinaryForStorage } from '../encryption-utils';
3
2
  import { requireEncryptionUploadConfig } from '../security/key-registry';
4
3
  import type { CreateImageWorkerResponse, Env } from '../types';
@@ -9,10 +8,6 @@ export async function handleImageUpload(
9
8
  env: Env,
10
9
  createJsonResponse: CreateImageWorkerResponse
11
10
  ): Promise<Response> {
12
- if (!hasValidToken(request, env)) {
13
- return createJsonResponse({ error: 'Unauthorized' }, 403);
14
- }
15
-
16
11
  requireEncryptionUploadConfig(env);
17
12
 
18
13
  const formData = await request.formData();
@@ -51,7 +51,7 @@ export function normalizeSignedUrlTtlSeconds(requestedTtlSeconds: unknown, env:
51
51
  }
52
52
 
53
53
  export function requireSignedUrlConfig(env: Env): void {
54
- const resolvedSecret = (env.IMAGE_SIGNED_URL_SECRET || env.IMAGES_API_TOKEN || '').trim();
54
+ const resolvedSecret = (env.IMAGE_SIGNED_URL_SECRET || '').trim();
55
55
  if (resolvedSecret.length === 0) {
56
56
  throw new Error('Signed URL configuration is missing');
57
57
  }
@@ -77,7 +77,7 @@ export function parseSignedUrlBaseUrl(raw: string): string {
77
77
  }
78
78
 
79
79
  async function getSignedUrlHmacKey(env: Env): Promise<CryptoKey> {
80
- const resolvedSecret = (env.IMAGE_SIGNED_URL_SECRET || env.IMAGES_API_TOKEN || '').trim();
80
+ const resolvedSecret = (env.IMAGE_SIGNED_URL_SECRET || '').trim();
81
81
  const keyBytes = new TextEncoder().encode(resolvedSecret);
82
82
 
83
83
  return crypto.subtle.importKey(
@@ -1,5 +1,4 @@
1
1
  export interface Env {
2
- IMAGES_API_TOKEN: string;
3
2
  STRIAE_FILES: R2Bucket;
4
3
  DATA_AT_REST_ENCRYPTION_PRIVATE_KEY?: string;
5
4
  DATA_AT_REST_ENCRYPTION_PUBLIC_KEY: string;
@@ -2,7 +2,8 @@
2
2
  "name": "IMAGES_WORKER_NAME",
3
3
  "account_id": "ACCOUNT_ID",
4
4
  "main": "src/image-worker.ts",
5
- "compatibility_date": "2026-04-20",
5
+ "workers_dev": false,
6
+ "compatibility_date": "2026-04-21",
6
7
  "compatibility_flags": [
7
8
  "nodejs_compat"
8
9
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdf-worker",
3
- "version": "6.1.8",
3
+ "version": "7.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "generate:assets": "node scripts/generate-assets.js",
@@ -9,6 +9,6 @@
9
9
  "start": "wrangler dev"
10
10
  },
11
11
  "devDependencies": {
12
- "wrangler": "^4.84.0"
12
+ "wrangler": "^4.84.1"
13
13
  }
14
14
  }
@@ -2,7 +2,6 @@ import type { PDFGenerationData, PDFGenerationRequest, ReportModule, ReportPdfOp
2
2
  import { getAuditTrailPdfOptions, isAuditTrailReportMode, renderAuditTrailReport } from './audit-trail-report';
3
3
 
4
4
  interface Env {
5
- PDF_WORKER_AUTH: string;
6
5
  ACCOUNT_ID?: string;
7
6
  BROWSER_API_TOKEN?: string;
8
7
  }
@@ -40,9 +39,6 @@ const reportModuleLoaders: Record<string, () => Promise<ReportModule>> = {
40
39
 
41
40
  };
42
41
 
43
- const hasValidHeader = (request: Request, env: Env): boolean =>
44
- request.headers.get('X-Custom-Auth-Key') === env.PDF_WORKER_AUTH;
45
-
46
42
  function isTimeoutError(error: unknown): boolean {
47
43
  return error instanceof Error && (
48
44
  error.name === 'AbortError' ||
@@ -193,10 +189,6 @@ async function renderPdfViaRestEndpoint(env: Env, html: string, pdfOptions: Repo
193
189
 
194
190
  export default {
195
191
  async fetch(request: Request, env: Env): Promise<Response> {
196
- if (!hasValidHeader(request, env)) {
197
- return jsonResponse({ error: 'Forbidden' }, 403);
198
- }
199
-
200
192
  if (request.method === 'POST') {
201
193
  try {
202
194
  const payload = await request.json() as unknown;
@@ -2,7 +2,8 @@
2
2
  "name": "PDF_WORKER_NAME",
3
3
  "account_id": "ACCOUNT_ID",
4
4
  "main": "src/pdf-worker.ts",
5
- "compatibility_date": "2026-04-20",
5
+ "workers_dev": false,
6
+ "compatibility_date": "2026-04-21",
6
7
  "compatibility_flags": [
7
8
  "nodejs_compat"
8
9
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "user-worker",
3
- "version": "6.1.8",
3
+ "version": "7.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "deploy": "wrangler deploy",
@@ -8,6 +8,6 @@
8
8
  "start": "wrangler dev"
9
9
  },
10
10
  "devDependencies": {
11
- "wrangler": "^4.84.0"
11
+ "wrangler": "^4.84.1"
12
12
  }
13
13
  }
@@ -1,12 +1,5 @@
1
1
  import type { Env } from './types';
2
2
 
3
- export async function authenticate(request: Request, env: Env): Promise<void> {
4
- const authKey = request.headers.get('X-Custom-Auth-Key');
5
- if (authKey !== env.USER_DB_AUTH) {
6
- throw new Error('Unauthorized');
7
- }
8
- }
9
-
10
3
  export function requireUserKvReadConfig(env: Env): void {
11
4
  const hasLegacyPrivateKey = typeof env.USER_KV_ENCRYPTION_PRIVATE_KEY === 'string' && env.USER_KV_ENCRYPTION_PRIVATE_KEY.trim().length > 0;
12
5
  const hasRegistryPrivateKeys = typeof env.USER_KV_ENCRYPTION_KEYS_JSON === 'string' && env.USER_KV_ENCRYPTION_KEYS_JSON.trim().length > 0;
@@ -1,9 +1,7 @@
1
1
  export interface Env {
2
- USER_DB_AUTH: string;
3
2
  USER_DB: KVNamespace;
4
3
  STRIAE_DATA: R2Bucket;
5
4
  STRIAE_FILES: R2Bucket;
6
- R2_KEY_SECRET: string;
7
5
  DATA_AT_REST_ENCRYPTION_PRIVATE_KEY?: string;
8
6
  DATA_AT_REST_ENCRYPTION_KEY_ID?: string;
9
7
  DATA_AT_REST_ENCRYPTION_KEYS_JSON?: string;
@@ -1,4 +1,4 @@
1
- import { authenticate, requireUserKvReadConfig, requireUserKvWriteConfig } from './auth';
1
+ import { requireUserKvReadConfig, requireUserKvWriteConfig } from './auth';
2
2
  import { USER_CASES_SEGMENT } from './config';
3
3
  import {
4
4
  handleAddCases,
@@ -20,8 +20,6 @@ function createTextResponse(message: string, status: number): Response {
20
20
  export default {
21
21
  async fetch(request: Request, env: Env): Promise<Response> {
22
22
  try {
23
- await authenticate(request, env);
24
-
25
23
  // DELETE can mutate user KV data (for example /:uid/cases), so non-GET methods require write config.
26
24
  if (request.method === 'GET') {
27
25
  requireUserKvReadConfig(env);
@@ -2,7 +2,8 @@
2
2
  "name": "USER_WORKER_NAME",
3
3
  "account_id": "ACCOUNT_ID",
4
4
  "main": "src/user-worker.ts",
5
- "compatibility_date": "2026-04-20",
5
+ "workers_dev": false,
6
+ "compatibility_date": "2026-04-21",
6
7
  "compatibility_flags": [
7
8
  "nodejs_compat"
8
9
  ],
@@ -1,8 +1,28 @@
1
1
  #:schema node_modules/wrangler/config-schema.json
2
2
  name = "PAGES_PROJECT_NAME"
3
- compatibility_date = "2026-04-20"
3
+ compatibility_date = "2026-04-21"
4
4
  compatibility_flags = ["nodejs_compat"]
5
5
  pages_build_output_dir = "./build/client"
6
6
 
7
7
  [placement]
8
- mode = "smart"
8
+ mode = "smart"
9
+
10
+ [[services]]
11
+ binding = "USER_WORKER"
12
+ service = "USER_WORKER_NAME"
13
+
14
+ [[services]]
15
+ binding = "DATA_WORKER"
16
+ service = "DATA_WORKER_NAME"
17
+
18
+ [[services]]
19
+ binding = "AUDIT_WORKER"
20
+ service = "AUDIT_WORKER_NAME"
21
+
22
+ [[services]]
23
+ binding = "IMAGE_WORKER"
24
+ service = "IMAGES_WORKER_NAME"
25
+
26
+ [[services]]
27
+ binding = "PDF_WORKER"
28
+ service = "PDF_WORKER_NAME"