@graview/ship 0.1.34 → 0.1.36
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/dist/files-at.d.ts +7 -0
- package/dist/files-at.d.ts.map +1 -1
- package/dist/files-at.js +11 -0
- package/dist/files-at.js.map +1 -1
- package/package.json +2 -2
package/dist/files-at.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ import type { HostFiles } from "@graview/core";
|
|
|
9
9
|
*
|
|
10
10
|
* It is what the dev door (`devFiles` in `@graview/ship/dev`) answers, and
|
|
11
11
|
* a host whose route answers the same may use it as it is.
|
|
12
|
+
*
|
|
13
|
+
* WHERE A RECORD'S FILE IS SERVED (`src`, 0.1.36): a record keeps the path
|
|
14
|
+
* the host answered, `/graview/files/<sha>.<ext>`, without the base the app
|
|
15
|
+
* is served under; such a path is drawn under `url` — `filesAt("/a/jobs/
|
|
16
|
+
* graview/files")` draws `/graview/files/x.webp` at `/a/jobs/graview/files/
|
|
17
|
+
* x.webp`. Any other href (the dev door's `/__graview/files/…`, already
|
|
18
|
+
* where it is served) is drawn as the record keeps it.
|
|
12
19
|
*/
|
|
13
20
|
export declare function filesAt(url: string, options: {
|
|
14
21
|
readonly maxBytes: number;
|
package/dist/files-at.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files-at.d.ts","sourceRoot":"","sources":["../src/files-at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"files-at.d.ts","sourceRoot":"","sources":["../src/files-at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAE,GAAG,SAAS,CAmBxJ"}
|
package/dist/files-at.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Where a record keeps a host's file: the path every host's upload answers, without its base. */
|
|
2
|
+
const HOST_FILES = "/graview/files/";
|
|
1
3
|
/**
|
|
2
4
|
* A HOST'S FILES AT AN ADDRESS (FR-163): the `files` a page hands `mount`,
|
|
3
5
|
* `<Embed>` or the Shell, sending each file to `url` with POST — the bytes
|
|
@@ -8,12 +10,21 @@
|
|
|
8
10
|
*
|
|
9
11
|
* It is what the dev door (`devFiles` in `@graview/ship/dev`) answers, and
|
|
10
12
|
* a host whose route answers the same may use it as it is.
|
|
13
|
+
*
|
|
14
|
+
* WHERE A RECORD'S FILE IS SERVED (`src`, 0.1.36): a record keeps the path
|
|
15
|
+
* the host answered, `/graview/files/<sha>.<ext>`, without the base the app
|
|
16
|
+
* is served under; such a path is drawn under `url` — `filesAt("/a/jobs/
|
|
17
|
+
* graview/files")` draws `/graview/files/x.webp` at `/a/jobs/graview/files/
|
|
18
|
+
* x.webp`. Any other href (the dev door's `/__graview/files/…`, already
|
|
19
|
+
* where it is served) is drawn as the record keeps it.
|
|
11
20
|
*/
|
|
12
21
|
export function filesAt(url, options) {
|
|
13
22
|
const send = options.fetch ?? ((...args) => fetch(...args));
|
|
23
|
+
const served = url.replace(/\/+$/, "");
|
|
14
24
|
return {
|
|
15
25
|
maxBytes: options.maxBytes,
|
|
16
26
|
kinds: options.kinds,
|
|
27
|
+
src: (href) => (href.startsWith(HOST_FILES) ? served + href.slice(HOST_FILES.length - 1) : href),
|
|
17
28
|
async upload(file, name) {
|
|
18
29
|
const response = await send(url, {
|
|
19
30
|
method: "POST",
|
package/dist/files-at.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files-at.js","source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C,QAAQ,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACxI,OAAO,IAAiB,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graview/ship",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@graview/core": "0.1.
|
|
30
|
+
"@graview/core": "0.1.36"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"zod": "^4.6.5"
|