@ossy/platform 3.0.4 → 3.0.5
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.
|
|
3
|
+
"version": "3.0.5",
|
|
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.
|
|
48
|
-
"@ossy/event-store": "^3.0.
|
|
49
|
-
"@ossy/locale": "^3.0.
|
|
50
|
-
"@ossy/manifest": "^3.0.
|
|
51
|
-
"@ossy/observability": "^3.0.
|
|
52
|
-
"@ossy/policies": "^3.0.
|
|
53
|
-
"@ossy/schema": "^3.0.
|
|
54
|
-
"@ossy/sdk": "^3.0.
|
|
55
|
-
"@ossy/tokens": "^3.0.
|
|
56
|
-
"@ossy/users": "^3.0.
|
|
57
|
-
"@ossy/workspaces": "^3.0.
|
|
47
|
+
"@ossy/config": "^3.0.5",
|
|
48
|
+
"@ossy/event-store": "^3.0.5",
|
|
49
|
+
"@ossy/locale": "^3.0.5",
|
|
50
|
+
"@ossy/manifest": "^3.0.5",
|
|
51
|
+
"@ossy/observability": "^3.0.5",
|
|
52
|
+
"@ossy/policies": "^3.0.5",
|
|
53
|
+
"@ossy/schema": "^3.0.5",
|
|
54
|
+
"@ossy/sdk": "^3.0.5",
|
|
55
|
+
"@ossy/tokens": "^3.0.5",
|
|
56
|
+
"@ossy/users": "^3.0.5",
|
|
57
|
+
"@ossy/workspaces": "^3.0.5",
|
|
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": "
|
|
77
|
+
"gitHead": "e12eb33b42db8ba8a7e1a34f6b0fe30b6879f91b"
|
|
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(
|
|
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
|
+
})
|