@ossy/platform 3.0.4 → 3.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/platform",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Ossy application server runtime",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,17 +44,17 @@
44
44
  "@aws-sdk/util-create-request": "^3.972.26",
45
45
  "@aws-sdk/util-format-url": "^3.972.17",
46
46
  "@modelcontextprotocol/sdk": "^1.12.1",
47
- "@ossy/config": "^3.0.4",
48
- "@ossy/event-store": "^3.0.4",
49
- "@ossy/locale": "^3.0.4",
50
- "@ossy/manifest": "^3.0.4",
51
- "@ossy/observability": "^3.0.4",
52
- "@ossy/policies": "^3.0.4",
53
- "@ossy/schema": "^3.0.4",
54
- "@ossy/sdk": "^3.0.4",
55
- "@ossy/tokens": "^3.0.4",
56
- "@ossy/users": "^3.0.4",
57
- "@ossy/workspaces": "^3.0.4",
47
+ "@ossy/config": "^3.0.6",
48
+ "@ossy/event-store": "^3.0.6",
49
+ "@ossy/locale": "^3.0.6",
50
+ "@ossy/manifest": "^3.0.6",
51
+ "@ossy/observability": "^3.0.6",
52
+ "@ossy/policies": "^3.0.6",
53
+ "@ossy/schema": "^3.0.6",
54
+ "@ossy/sdk": "^3.0.6",
55
+ "@ossy/tokens": "^3.0.6",
56
+ "@ossy/users": "^3.0.6",
57
+ "@ossy/workspaces": "^3.0.6",
58
58
  "cookie-parser": "^1.4.7",
59
59
  "dotenv": ">=16.0.0 <18.0.0",
60
60
  "express": ">=5.0.0 <6.0.0",
@@ -74,5 +74,5 @@
74
74
  "src",
75
75
  "Dockerfile"
76
76
  ],
77
- "gitHead": "831c9816bee67c5e53d0a4be4f6401975f23d72a"
77
+ "gitHead": "3e1c558069c7738dd751e429c69b10e52d247d8c"
78
78
  }
@@ -35,6 +35,20 @@ function buildUrl (key, env = process.env) {
35
35
  return createResourceReadUrl(key, env)
36
36
  }
37
37
 
38
+ /**
39
+ * Local PUT endpoint — `/r/{id}` is read-only; uploads go through `@ossy/storage` local-storage API.
40
+ *
41
+ * @param {string} key
42
+ * @param {NodeJS.ProcessEnv} [env]
43
+ * @returns {string}
44
+ */
45
+ export function createFilesystemUploadUrl (key, env = process.env) {
46
+ const Key = normalizeKey(key)
47
+ const path = `/local-storage?key=${encodeURIComponent(Key)}`
48
+ const base = (env.WEB_CLIENT_DOMAIN || env.LOCAL_API_URL || '').replace(/\/$/, '')
49
+ return base ? `${base}${path}` : path
50
+ }
51
+
38
52
  export function createFilesystemStorageClient ({ root, env = process.env } = {}) {
39
53
  const storageRoot = root ?? resolveFilesystemStorageRoot(env)
40
54
 
@@ -43,7 +57,7 @@ export function createFilesystemStorageClient ({ root, env = process.env } = {})
43
57
  root: storageRoot,
44
58
 
45
59
  createUploadUrl ({ Key }) {
46
- return Promise.resolve(buildUrl(normalizeKey({ Key }), env))
60
+ return Promise.resolve(createFilesystemUploadUrl(Key, env))
47
61
  },
48
62
 
49
63
  createPresignedDownloadUrl (keyOrShape) {
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from '@jest/globals'
2
+ import { createFilesystemUploadUrl } from './filesystem-storage.client.js'
3
+
4
+ describe('createFilesystemUploadUrl', () => {
5
+ it('builds local-storage PUT URL from WEB_CLIENT_DOMAIN', () => {
6
+ expect(createFilesystemUploadUrl('abc123', { WEB_CLIENT_DOMAIN: 'https://app.example.com' }))
7
+ .toBe('https://app.example.com/local-storage?key=abc123')
8
+ })
9
+
10
+ it('falls back to LOCAL_API_URL', () => {
11
+ expect(createFilesystemUploadUrl('abc123', { LOCAL_API_URL: 'http://localhost:3006' }))
12
+ .toBe('http://localhost:3006/local-storage?key=abc123')
13
+ })
14
+
15
+ it('encodes keys with reserved characters', () => {
16
+ expect(createFilesystemUploadUrl('id:variant', { LOCAL_API_URL: 'http://localhost:3006' }))
17
+ .toBe('http://localhost:3006/local-storage?key=id%3Avariant')
18
+ })
19
+ })