@devframes/plugin-assets 0.7.15 → 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.
@@ -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-lfFykVQ_.mjs";
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 * as v from "valibot";
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: [v.object({ path: v.string() })],
114
- returns: v.object({ uploadId: v.string() }),
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: v.object({
162
- write: v.boolean(),
163
- uploadExtensions: v.union([v.array(v.string()), v.literal("*")])
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: [v.object({ paths: v.array(v.string()) })],
185
- returns: v.object({ deleted: v.array(v.string()) }),
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 = v.object({
258
- path: v.string(),
259
- type: v.picklist([
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: v.string(),
268
- size: v.number(),
269
- mtime: v.number()
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: v.array(assetInfoSchema),
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: [v.object({ path: v.string() })],
294
- returns: v.void(),
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: [v.string()],
322
- returns: v.void(),
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: [v.string()],
341
- returns: v.nullable(v.object({
342
- width: v.optional(v.number()),
343
- height: v.optional(v.number()),
344
- orientation: v.optional(v.number())
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: [v.string(), v.optional(v.number())],
377
- returns: v.nullable(v.string()),
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: [v.object({
400
- path: v.string(),
401
- newName: v.string()
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: [v.string()],
448
- returns: v.void(),
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.",