@devframes/plugin-assets 0.7.16 → 0.8.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.
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/{node-Bpl891iK.mjs → node-BYWWO6JH.mjs} +1 -1
- package/dist/rpc/index.d.mts +499 -398
- package/dist/rpc/index.mjs +1 -1
- package/dist/{rpc-lfFykVQ_.mjs → rpc-BHri4K4-.mjs} +31 -31
- package/dist/spa/assets/index-Ca5QWBML.js +6 -0
- package/dist/spa/index.html +1 -1
- package/dist/{src-DABuDvK7.mjs → src-BOFCks3-.mjs} +2 -2
- package/dist/vite.mjs +1 -1
- package/package.json +4 -6
- package/dist/spa/assets/index-D9rGP3AJ.js +0 -6
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as UPLOAD_CHANNEL, a as revealInFolder, c as readImageMeta, d as assetInfoSchema, f as list, g as capabilities, h as deleteAssets, i as writeFunctions, l as openInEditor, n as readFunctions, o as rename, r as serverFunctions, s as readText, t as alwaysFunctions, u as mkdir, v as upload } from "../rpc-
|
|
1
|
+
import { _ as UPLOAD_CHANNEL, a as revealInFolder, c as readImageMeta, d as assetInfoSchema, f as list, g as capabilities, h as deleteAssets, i as writeFunctions, l as openInEditor, n as readFunctions, o as rename, r as serverFunctions, s as readText, t as alwaysFunctions, u as mkdir, v as upload } from "../rpc-BHri4K4-.mjs";
|
|
2
2
|
export { UPLOAD_CHANNEL, alwaysFunctions, assetInfoSchema, capabilities, deleteAssets, list, mkdir, openInEditor, readFunctions, readImageMeta, readText, rename, revealInFolder, serverFunctions, upload, writeFunctions };
|
|
@@ -2,7 +2,7 @@ import { dirname, extname, join, resolve } from "pathe";
|
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
3
|
import fsp from "node:fs/promises";
|
|
4
4
|
import { createDefineWrapperWithContext } from "devframe/rpc";
|
|
5
|
-
import
|
|
5
|
+
import { s } from "devframe/utils/simple-schema";
|
|
6
6
|
import { defineDiagnostics } from "nostics";
|
|
7
7
|
import { glob } from "tinyglobby";
|
|
8
8
|
import { joinURL } from "ufo";
|
|
@@ -110,8 +110,8 @@ const upload = defineAssetsRpc$9({
|
|
|
110
110
|
name: "devframes:plugin:assets:upload",
|
|
111
111
|
type: "action",
|
|
112
112
|
jsonSerializable: true,
|
|
113
|
-
args: [
|
|
114
|
-
returns:
|
|
113
|
+
args: [s.object({ path: s.string() })],
|
|
114
|
+
returns: s.object({ uploadId: s.string() }),
|
|
115
115
|
agent: {
|
|
116
116
|
title: "Upload an asset",
|
|
117
117
|
description: "Allocate an upload slot for a new file at the given path. The caller streams the bytes over the paired upload channel.",
|
|
@@ -158,9 +158,9 @@ const capabilities = createDefineWrapperWithContext()({
|
|
|
158
158
|
snapshot: true,
|
|
159
159
|
jsonSerializable: true,
|
|
160
160
|
args: [],
|
|
161
|
-
returns:
|
|
162
|
-
write:
|
|
163
|
-
uploadExtensions:
|
|
161
|
+
returns: s.object({
|
|
162
|
+
write: s.boolean(),
|
|
163
|
+
uploadExtensions: s.union([s.array(s.string()), s.literal("*")])
|
|
164
164
|
}),
|
|
165
165
|
agent: {
|
|
166
166
|
title: "Read assets capabilities",
|
|
@@ -181,8 +181,8 @@ const deleteAssets = createDefineWrapperWithContext()({
|
|
|
181
181
|
name: "devframes:plugin:assets:delete",
|
|
182
182
|
type: "action",
|
|
183
183
|
jsonSerializable: true,
|
|
184
|
-
args: [
|
|
185
|
-
returns:
|
|
184
|
+
args: [s.object({ paths: s.array(s.string()) })],
|
|
185
|
+
returns: s.object({ deleted: s.array(s.string()) }),
|
|
186
186
|
agent: {
|
|
187
187
|
title: "Delete assets",
|
|
188
188
|
description: "Delete one or more assets from the managed directory.",
|
|
@@ -254,9 +254,9 @@ async function scanAssets(dir, baseURL) {
|
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region src/rpc/functions/list.ts
|
|
256
256
|
const defineAssetsRpc$6 = createDefineWrapperWithContext();
|
|
257
|
-
const assetInfoSchema =
|
|
258
|
-
path:
|
|
259
|
-
type:
|
|
257
|
+
const assetInfoSchema = s.object({
|
|
258
|
+
path: s.string(),
|
|
259
|
+
type: s.picklist([
|
|
260
260
|
"image",
|
|
261
261
|
"font",
|
|
262
262
|
"video",
|
|
@@ -264,9 +264,9 @@ const assetInfoSchema = v.object({
|
|
|
264
264
|
"text",
|
|
265
265
|
"other"
|
|
266
266
|
]),
|
|
267
|
-
publicPath:
|
|
268
|
-
size:
|
|
269
|
-
mtime:
|
|
267
|
+
publicPath: s.string(),
|
|
268
|
+
size: s.number(),
|
|
269
|
+
mtime: s.number()
|
|
270
270
|
});
|
|
271
271
|
const list = defineAssetsRpc$6({
|
|
272
272
|
name: "devframes:plugin:assets:list",
|
|
@@ -274,7 +274,7 @@ const list = defineAssetsRpc$6({
|
|
|
274
274
|
snapshot: true,
|
|
275
275
|
jsonSerializable: true,
|
|
276
276
|
args: [],
|
|
277
|
-
returns:
|
|
277
|
+
returns: s.array(assetInfoSchema),
|
|
278
278
|
agent: {
|
|
279
279
|
title: "List managed assets",
|
|
280
280
|
description: "List every file under the managed directory with its type, size, and last-modified time.",
|
|
@@ -290,8 +290,8 @@ const mkdir = createDefineWrapperWithContext()({
|
|
|
290
290
|
name: "devframes:plugin:assets:mkdir",
|
|
291
291
|
type: "action",
|
|
292
292
|
jsonSerializable: true,
|
|
293
|
-
args: [
|
|
294
|
-
returns:
|
|
293
|
+
args: [s.object({ path: s.string() })],
|
|
294
|
+
returns: s.void(),
|
|
295
295
|
agent: {
|
|
296
296
|
title: "Create a folder",
|
|
297
297
|
description: "Create a folder under the managed directory, including any missing parent folders.",
|
|
@@ -318,8 +318,8 @@ const openInEditor = createDefineWrapperWithContext()({
|
|
|
318
318
|
name: "devframes:plugin:assets:open-in-editor",
|
|
319
319
|
type: "action",
|
|
320
320
|
jsonSerializable: true,
|
|
321
|
-
args: [
|
|
322
|
-
returns:
|
|
321
|
+
args: [s.string()],
|
|
322
|
+
returns: s.void(),
|
|
323
323
|
agent: {
|
|
324
324
|
title: "Open an asset in the editor",
|
|
325
325
|
description: "Open an asset in the user's configured editor.",
|
|
@@ -337,11 +337,11 @@ const readImageMeta = createDefineWrapperWithContext()({
|
|
|
337
337
|
name: "devframes:plugin:assets:read-image-meta",
|
|
338
338
|
type: "query",
|
|
339
339
|
jsonSerializable: true,
|
|
340
|
-
args: [
|
|
341
|
-
returns:
|
|
342
|
-
width:
|
|
343
|
-
height:
|
|
344
|
-
orientation:
|
|
340
|
+
args: [s.string()],
|
|
341
|
+
returns: s.nullable(s.object({
|
|
342
|
+
width: s.optional(s.number()),
|
|
343
|
+
height: s.optional(s.number()),
|
|
344
|
+
orientation: s.optional(s.number())
|
|
345
345
|
})),
|
|
346
346
|
agent: {
|
|
347
347
|
title: "Read image dimensions",
|
|
@@ -373,8 +373,8 @@ const readText = defineAssetsRpc$2({
|
|
|
373
373
|
name: "devframes:plugin:assets:read-text",
|
|
374
374
|
type: "query",
|
|
375
375
|
jsonSerializable: true,
|
|
376
|
-
args: [
|
|
377
|
-
returns:
|
|
376
|
+
args: [s.string(), s.optional(s.number())],
|
|
377
|
+
returns: s.nullable(s.string()),
|
|
378
378
|
agent: {
|
|
379
379
|
title: "Read a text asset",
|
|
380
380
|
description: "Read the (possibly truncated) text content of a text-type asset, for preview or editing.",
|
|
@@ -396,9 +396,9 @@ const rename = createDefineWrapperWithContext()({
|
|
|
396
396
|
name: "devframes:plugin:assets:rename",
|
|
397
397
|
type: "action",
|
|
398
398
|
jsonSerializable: true,
|
|
399
|
-
args: [
|
|
400
|
-
path:
|
|
401
|
-
newName:
|
|
399
|
+
args: [s.object({
|
|
400
|
+
path: s.string(),
|
|
401
|
+
newName: s.string()
|
|
402
402
|
})],
|
|
403
403
|
returns: assetInfoSchema,
|
|
404
404
|
agent: {
|
|
@@ -444,8 +444,8 @@ const revealInFolder = createDefineWrapperWithContext()({
|
|
|
444
444
|
name: "devframes:plugin:assets:reveal-in-folder",
|
|
445
445
|
type: "action",
|
|
446
446
|
jsonSerializable: true,
|
|
447
|
-
args: [
|
|
448
|
-
returns:
|
|
447
|
+
args: [s.string()],
|
|
448
|
+
returns: s.void(),
|
|
449
449
|
agent: {
|
|
450
450
|
title: "Reveal an asset in the file manager",
|
|
451
451
|
description: "Open the OS file manager at the asset's containing folder.",
|