@anvilkit/plugin-asset-manager 0.1.6 → 0.1.7
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/README.md +26 -18
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +11 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/plugin.cjs +67 -4
- package/dist/plugin.d.cts +3 -2
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +67 -4
- package/dist/sources/composite-source.cjs +137 -0
- package/dist/sources/composite-source.d.cts +39 -0
- package/dist/sources/composite-source.d.cts.map +1 -0
- package/dist/sources/composite-source.d.ts +39 -0
- package/dist/sources/composite-source.d.ts.map +1 -0
- package/dist/sources/composite-source.js +99 -0
- package/dist/sources/federated-search.cjs +163 -0
- package/dist/sources/federated-search.d.cts +33 -0
- package/dist/sources/federated-search.d.cts.map +1 -0
- package/dist/sources/federated-search.d.ts +33 -0
- package/dist/sources/federated-search.d.ts.map +1 -0
- package/dist/sources/federated-search.js +113 -0
- package/dist/sources/provider.cjs +18 -0
- package/dist/sources/provider.d.cts +51 -0
- package/dist/sources/provider.d.cts.map +1 -0
- package/dist/sources/provider.d.ts +51 -0
- package/dist/sources/provider.d.ts.map +1 -0
- package/dist/sources/provider.js +1 -0
- package/dist/sources/unsplash/client.cjs +189 -0
- package/dist/sources/unsplash/client.d.cts +87 -0
- package/dist/sources/unsplash/client.d.cts.map +1 -0
- package/dist/sources/unsplash/client.d.ts +87 -0
- package/dist/sources/unsplash/client.d.ts.map +1 -0
- package/dist/sources/unsplash/client.js +151 -0
- package/dist/sources/unsplash/index.cjs +192 -0
- package/dist/sources/unsplash/index.d.cts +16 -0
- package/dist/sources/unsplash/index.d.cts.map +1 -0
- package/dist/sources/unsplash/index.d.ts +16 -0
- package/dist/sources/unsplash/index.d.ts.map +1 -0
- package/dist/sources/unsplash/index.js +148 -0
- package/dist/sources/unsplash/themes.cjs +141 -0
- package/dist/sources/unsplash/themes.d.cts +18 -0
- package/dist/sources/unsplash/themes.d.cts.map +1 -0
- package/dist/sources/unsplash/themes.d.ts +18 -0
- package/dist/sources/unsplash/themes.d.ts.map +1 -0
- package/dist/sources/unsplash/themes.js +93 -0
- package/dist/sources/unsplash/throttle-cache.cjs +86 -0
- package/dist/sources/unsplash/throttle-cache.d.cts +25 -0
- package/dist/sources/unsplash/throttle-cache.d.cts.map +1 -0
- package/dist/sources/unsplash/throttle-cache.d.ts +25 -0
- package/dist/sources/unsplash/throttle-cache.d.ts.map +1 -0
- package/dist/sources/unsplash/throttle-cache.js +45 -0
- package/dist/types/categories.cjs +18 -0
- package/dist/types/categories.d.cts +48 -0
- package/dist/types/categories.d.cts.map +1 -0
- package/dist/types/categories.d.ts +48 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +1 -0
- package/dist/types/data-source.cjs +18 -0
- package/dist/types/data-source.d.cts +59 -0
- package/dist/types/data-source.d.cts.map +1 -0
- package/dist/types/data-source.d.ts +59 -0
- package/dist/types/data-source.d.ts.map +1 -0
- package/dist/types/data-source.js +1 -0
- package/dist/types/filter.cjs +18 -0
- package/dist/types/filter.d.cts +55 -0
- package/dist/types/filter.d.cts.map +1 -0
- package/dist/types/filter.d.ts +55 -0
- package/dist/types/filter.d.ts.map +1 -0
- package/dist/types/filter.js +1 -0
- package/dist/types/folders.cjs +42 -0
- package/dist/types/folders.d.cts +46 -0
- package/dist/types/folders.d.cts.map +1 -0
- package/dist/types/folders.d.ts +46 -0
- package/dist/types/folders.d.ts.map +1 -0
- package/dist/types/folders.js +4 -0
- package/dist/types/options.cjs +18 -0
- package/dist/types/options.d.cts +68 -0
- package/dist/types/options.d.cts.map +1 -0
- package/dist/types/options.d.ts +68 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +1 -0
- package/dist/types/types.d.cts +15 -27
- package/dist/types/types.d.cts.map +1 -1
- package/dist/types/types.d.ts +15 -27
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/unsplash.cjs +18 -0
- package/dist/types/unsplash.d.cts +60 -0
- package/dist/types/unsplash.d.cts.map +1 -0
- package/dist/types/unsplash.d.ts +60 -0
- package/dist/types/unsplash.d.ts.map +1 -0
- package/dist/types/unsplash.js +1 -0
- package/dist/ui/AssetBrowser.cjs +33 -12
- package/dist/ui/AssetBrowser.d.cts +12 -1
- package/dist/ui/AssetBrowser.d.cts.map +1 -1
- package/dist/ui/AssetBrowser.d.ts +12 -1
- package/dist/ui/AssetBrowser.d.ts.map +1 -1
- package/dist/ui/AssetBrowser.js +33 -12
- package/dist/ui/AssetManagerUI.cjs +8 -2
- package/dist/ui/AssetManagerUI.d.cts +19 -3
- package/dist/ui/AssetManagerUI.d.cts.map +1 -1
- package/dist/ui/AssetManagerUI.d.ts +19 -3
- package/dist/ui/AssetManagerUI.d.ts.map +1 -1
- package/dist/ui/AssetManagerUI.js +8 -2
- package/dist/ui/DeleteFolderDialog.cjs +78 -0
- package/dist/ui/DeleteFolderDialog.d.cts +11 -0
- package/dist/ui/DeleteFolderDialog.d.cts.map +1 -0
- package/dist/ui/DeleteFolderDialog.d.ts +11 -0
- package/dist/ui/DeleteFolderDialog.d.ts.map +1 -0
- package/dist/ui/DeleteFolderDialog.js +40 -0
- package/dist/ui/EmptyFolderState.cjs +53 -0
- package/dist/ui/EmptyFolderState.d.cts +6 -0
- package/dist/ui/EmptyFolderState.d.cts.map +1 -0
- package/dist/ui/EmptyFolderState.d.ts +6 -0
- package/dist/ui/EmptyFolderState.d.ts.map +1 -0
- package/dist/ui/EmptyFolderState.js +15 -0
- package/dist/ui/FolderBreadcrumb.cjs +73 -0
- package/dist/ui/FolderBreadcrumb.d.cts +9 -0
- package/dist/ui/FolderBreadcrumb.d.cts.map +1 -0
- package/dist/ui/FolderBreadcrumb.d.ts +9 -0
- package/dist/ui/FolderBreadcrumb.d.ts.map +1 -0
- package/dist/ui/FolderBreadcrumb.js +35 -0
- package/dist/ui/FolderNameDialog.cjs +98 -0
- package/dist/ui/FolderNameDialog.d.cts +14 -0
- package/dist/ui/FolderNameDialog.d.cts.map +1 -0
- package/dist/ui/FolderNameDialog.d.ts +14 -0
- package/dist/ui/FolderNameDialog.d.ts.map +1 -0
- package/dist/ui/FolderNameDialog.js +60 -0
- package/dist/ui/FolderTree.cjs +83 -0
- package/dist/ui/FolderTree.d.cts +13 -0
- package/dist/ui/FolderTree.d.cts.map +1 -0
- package/dist/ui/FolderTree.d.ts +13 -0
- package/dist/ui/FolderTree.d.ts.map +1 -0
- package/dist/ui/FolderTree.js +42 -0
- package/dist/ui/MetadataPanel.cjs +7 -4
- package/dist/ui/MetadataPanel.d.cts.map +1 -1
- package/dist/ui/MetadataPanel.d.ts.map +1 -1
- package/dist/ui/MetadataPanel.js +7 -4
- package/dist/ui/MoveTargetPicker.cjs +84 -0
- package/dist/ui/MoveTargetPicker.d.cts +16 -0
- package/dist/ui/MoveTargetPicker.d.cts.map +1 -0
- package/dist/ui/MoveTargetPicker.d.ts +16 -0
- package/dist/ui/MoveTargetPicker.d.ts.map +1 -0
- package/dist/ui/MoveTargetPicker.js +46 -0
- package/dist/ui/ReplaceAssetDialog.d.cts +2 -1
- package/dist/ui/ReplaceAssetDialog.d.cts.map +1 -1
- package/dist/ui/ReplaceAssetDialog.d.ts +2 -1
- package/dist/ui/ReplaceAssetDialog.d.ts.map +1 -1
- package/dist/ui/UnsplashPanel.cjs +134 -0
- package/dist/ui/UnsplashPanel.d.cts +28 -0
- package/dist/ui/UnsplashPanel.d.cts.map +1 -0
- package/dist/ui/UnsplashPanel.d.ts +28 -0
- package/dist/ui/UnsplashPanel.d.ts.map +1 -0
- package/dist/ui/UnsplashPanel.js +96 -0
- package/dist/ui/UploadButton.cjs +1 -5
- package/dist/ui/UploadButton.d.cts +9 -2
- package/dist/ui/UploadButton.d.cts.map +1 -1
- package/dist/ui/UploadButton.d.ts +9 -2
- package/dist/ui/UploadButton.d.ts.map +1 -1
- package/dist/ui/UploadButton.js +1 -5
- package/dist/ui/index.cjs +37 -0
- package/dist/ui/index.d.cts +14 -0
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.ts +14 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +7 -0
- package/dist/utils/data-source.cjs +177 -0
- package/dist/utils/data-source.d.cts +63 -0
- package/dist/utils/data-source.d.cts.map +1 -0
- package/dist/utils/data-source.d.ts +63 -0
- package/dist/utils/data-source.d.ts.map +1 -0
- package/dist/utils/data-source.js +136 -0
- package/dist/utils/errors.cjs +18 -0
- package/dist/utils/errors.d.cts +27 -0
- package/dist/utils/errors.d.cts.map +1 -1
- package/dist/utils/errors.d.ts +27 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +16 -1
- package/dist/utils/folders.cjs +261 -0
- package/dist/utils/folders.d.cts +49 -0
- package/dist/utils/folders.d.cts.map +1 -0
- package/dist/utils/folders.d.ts +49 -0
- package/dist/utils/folders.d.ts.map +1 -0
- package/dist/utils/folders.js +223 -0
- package/dist/utils/registry.cjs +27 -12
- package/dist/utils/registry.d.cts +21 -1
- package/dist/utils/registry.d.cts.map +1 -1
- package/dist/utils/registry.d.ts +21 -1
- package/dist/utils/registry.d.ts.map +1 -1
- package/dist/utils/registry.js +20 -11
- package/dist/utils/studio-asset-source.cjs +5 -2
- package/dist/utils/studio-asset-source.d.cts +6 -1
- package/dist/utils/studio-asset-source.d.cts.map +1 -1
- package/dist/utils/studio-asset-source.d.ts +6 -1
- package/dist/utils/studio-asset-source.d.ts.map +1 -1
- package/dist/utils/studio-asset-source.js +1 -1
- package/dist/utils/validate-upload-result.d.cts +2 -1
- package/dist/utils/validate-upload-result.d.cts.map +1 -1
- package/dist/utils/validate-upload-result.d.ts +2 -1
- package/dist/utils/validate-upload-result.d.ts.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/meta/config.json +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { resolveFolderId } from "../types/folders.js";
|
|
2
|
+
import { AssetSourceError } from "./errors.js";
|
|
3
|
+
function createFolderStore(options = {}) {
|
|
4
|
+
const now = options.now ?? (()=>Date.now());
|
|
5
|
+
const records = new Map();
|
|
6
|
+
const assetFolder = new Map();
|
|
7
|
+
const listeners = new Set();
|
|
8
|
+
let seq = 0;
|
|
9
|
+
const notify = ()=>{
|
|
10
|
+
for (const listener of listeners)listener();
|
|
11
|
+
};
|
|
12
|
+
const requireRecord = (id)=>{
|
|
13
|
+
const rec = records.get(id);
|
|
14
|
+
if (void 0 === rec) throw new AssetSourceError("FOLDER_NOT_FOUND", `Unknown folder "${id}".`);
|
|
15
|
+
return rec;
|
|
16
|
+
};
|
|
17
|
+
const childFolderCount = (id)=>{
|
|
18
|
+
let n = 0;
|
|
19
|
+
for (const rec of records.values())if (rec.parentId === id) n += 1;
|
|
20
|
+
return n;
|
|
21
|
+
};
|
|
22
|
+
const directAssetCount = (id)=>{
|
|
23
|
+
let n = 0;
|
|
24
|
+
for (const folderId of assetFolder.values())if (folderId === id) n += 1;
|
|
25
|
+
return n;
|
|
26
|
+
};
|
|
27
|
+
const project = (rec)=>Object.freeze({
|
|
28
|
+
id: rec.id,
|
|
29
|
+
name: rec.name,
|
|
30
|
+
parentId: rec.parentId,
|
|
31
|
+
createdAt: rec.createdAt,
|
|
32
|
+
updatedAt: rec.updatedAt,
|
|
33
|
+
counts: Object.freeze({
|
|
34
|
+
assets: directAssetCount(rec.id),
|
|
35
|
+
folders: childFolderCount(rec.id)
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
const depthOf = (id)=>{
|
|
39
|
+
let depth = 0;
|
|
40
|
+
let cursor = id;
|
|
41
|
+
while(null !== cursor){
|
|
42
|
+
const rec = records.get(cursor);
|
|
43
|
+
if (void 0 === rec) break;
|
|
44
|
+
depth += 1;
|
|
45
|
+
cursor = rec.parentId;
|
|
46
|
+
}
|
|
47
|
+
return depth;
|
|
48
|
+
};
|
|
49
|
+
const subtree = (id)=>{
|
|
50
|
+
const out = new Set([
|
|
51
|
+
id
|
|
52
|
+
]);
|
|
53
|
+
let added = true;
|
|
54
|
+
while(added){
|
|
55
|
+
added = false;
|
|
56
|
+
for (const rec of records.values())if (null !== rec.parentId && out.has(rec.parentId) && !out.has(rec.id)) {
|
|
57
|
+
out.add(rec.id);
|
|
58
|
+
added = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
};
|
|
63
|
+
const heightOf = (id)=>{
|
|
64
|
+
let height = 0;
|
|
65
|
+
const ids = subtree(id);
|
|
66
|
+
for (const fid of ids){
|
|
67
|
+
const d = depthOf(fid) - depthOf(id);
|
|
68
|
+
if (d > height) height = d;
|
|
69
|
+
}
|
|
70
|
+
return height;
|
|
71
|
+
};
|
|
72
|
+
const assertNameFree = (parentId, name, exceptId)=>{
|
|
73
|
+
const lowered = name.toLowerCase();
|
|
74
|
+
for (const rec of records.values())if (rec.parentId === parentId) {
|
|
75
|
+
if (rec.id !== exceptId) {
|
|
76
|
+
if (rec.name.toLowerCase() === lowered) throw new AssetSourceError("FOLDER_NAME_CONFLICT", `A folder named "${name}" already exists here.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const normalizeName = (name)=>{
|
|
81
|
+
const trimmed = name.trim();
|
|
82
|
+
if ("" === trimmed) throw new AssetSourceError("FOLDER_NAME_CONFLICT", "Folder name must not be empty.");
|
|
83
|
+
return trimmed;
|
|
84
|
+
};
|
|
85
|
+
const assertDepthOk = (parentDepth, extraHeight, maxDepth)=>{
|
|
86
|
+
if (void 0 === maxDepth) return;
|
|
87
|
+
if (parentDepth + 1 + extraHeight > maxDepth) throw new AssetSourceError("MOVE_REJECTED", `Operation would exceed the maximum folder depth of ${maxDepth}.`);
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
listChildren (parentId) {
|
|
91
|
+
const target = resolveFolderId(parentId);
|
|
92
|
+
const out = [];
|
|
93
|
+
for (const rec of records.values())if (rec.parentId === target) out.push(project(rec));
|
|
94
|
+
return Object.freeze(out);
|
|
95
|
+
},
|
|
96
|
+
listAll () {
|
|
97
|
+
return Object.freeze([
|
|
98
|
+
...records.values()
|
|
99
|
+
].map(project));
|
|
100
|
+
},
|
|
101
|
+
get (id) {
|
|
102
|
+
const rec = records.get(id);
|
|
103
|
+
return void 0 === rec ? void 0 : project(rec);
|
|
104
|
+
},
|
|
105
|
+
path (id) {
|
|
106
|
+
const target = resolveFolderId(id);
|
|
107
|
+
if (null === target) return Object.freeze([]);
|
|
108
|
+
const chain = [];
|
|
109
|
+
let cursor = target;
|
|
110
|
+
const seen = new Set();
|
|
111
|
+
while(null !== cursor){
|
|
112
|
+
if (seen.has(cursor)) break;
|
|
113
|
+
seen.add(cursor);
|
|
114
|
+
const rec = records.get(cursor);
|
|
115
|
+
if (void 0 === rec) break;
|
|
116
|
+
chain.unshift(project(rec));
|
|
117
|
+
cursor = rec.parentId;
|
|
118
|
+
}
|
|
119
|
+
return Object.freeze(chain);
|
|
120
|
+
},
|
|
121
|
+
createFolder (parentId, name, maxDepth) {
|
|
122
|
+
const target = resolveFolderId(parentId);
|
|
123
|
+
if (null !== target) requireRecord(target);
|
|
124
|
+
const clean = normalizeName(name);
|
|
125
|
+
assertNameFree(target, clean);
|
|
126
|
+
assertDepthOk(depthOf(target), 0, maxDepth);
|
|
127
|
+
const ts = now();
|
|
128
|
+
const rec = {
|
|
129
|
+
id: `folder-${seq += 1}`,
|
|
130
|
+
name: clean,
|
|
131
|
+
parentId: target,
|
|
132
|
+
createdAt: ts,
|
|
133
|
+
updatedAt: ts
|
|
134
|
+
};
|
|
135
|
+
records.set(rec.id, rec);
|
|
136
|
+
notify();
|
|
137
|
+
return project(rec);
|
|
138
|
+
},
|
|
139
|
+
renameFolder (id, name) {
|
|
140
|
+
const rec = requireRecord(id);
|
|
141
|
+
const clean = normalizeName(name);
|
|
142
|
+
assertNameFree(rec.parentId, clean, id);
|
|
143
|
+
rec.name = clean;
|
|
144
|
+
rec.updatedAt = now();
|
|
145
|
+
notify();
|
|
146
|
+
return project(rec);
|
|
147
|
+
},
|
|
148
|
+
moveFolder (id, parentId, maxDepth) {
|
|
149
|
+
const rec = requireRecord(id);
|
|
150
|
+
const target = resolveFolderId(parentId);
|
|
151
|
+
if (target === id) throw new AssetSourceError("FOLDER_CYCLE", "A folder cannot be moved into itself.");
|
|
152
|
+
if (null !== target) {
|
|
153
|
+
requireRecord(target);
|
|
154
|
+
if (subtree(id).has(target)) throw new AssetSourceError("FOLDER_CYCLE", "A folder cannot be moved into one of its own descendants.");
|
|
155
|
+
}
|
|
156
|
+
if (rec.parentId === target) return project(rec);
|
|
157
|
+
assertNameFree(target, rec.name, id);
|
|
158
|
+
assertDepthOk(depthOf(target), heightOf(id), maxDepth);
|
|
159
|
+
rec.parentId = target;
|
|
160
|
+
rec.updatedAt = now();
|
|
161
|
+
notify();
|
|
162
|
+
return project(rec);
|
|
163
|
+
},
|
|
164
|
+
removeFolder (id, opts) {
|
|
165
|
+
const rec = requireRecord(id);
|
|
166
|
+
if (opts?.cascade) {
|
|
167
|
+
const ids = subtree(id);
|
|
168
|
+
const removedAssetIds = [];
|
|
169
|
+
for (const [assetId, folderId] of assetFolder)if (ids.has(folderId)) {
|
|
170
|
+
removedAssetIds.push(assetId);
|
|
171
|
+
assetFolder.delete(assetId);
|
|
172
|
+
}
|
|
173
|
+
for (const fid of ids)records.delete(fid);
|
|
174
|
+
notify();
|
|
175
|
+
return {
|
|
176
|
+
removedAssetIds: Object.freeze(removedAssetIds)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const newParent = rec.parentId;
|
|
180
|
+
for (const child of records.values())if (child.parentId === id) {
|
|
181
|
+
child.parentId = newParent;
|
|
182
|
+
child.updatedAt = now();
|
|
183
|
+
}
|
|
184
|
+
for (const [assetId, folderId] of assetFolder)if (folderId === id) if (null === newParent) assetFolder.delete(assetId);
|
|
185
|
+
else assetFolder.set(assetId, newParent);
|
|
186
|
+
records.delete(id);
|
|
187
|
+
notify();
|
|
188
|
+
return {
|
|
189
|
+
removedAssetIds: Object.freeze([])
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
folderOf (assetId) {
|
|
193
|
+
return assetFolder.get(assetId) ?? null;
|
|
194
|
+
},
|
|
195
|
+
moveAsset (assetId, folderId) {
|
|
196
|
+
const target = resolveFolderId(folderId);
|
|
197
|
+
if (null !== target) requireRecord(target);
|
|
198
|
+
if (null === target) assetFolder.delete(assetId);
|
|
199
|
+
else assetFolder.set(assetId, target);
|
|
200
|
+
notify();
|
|
201
|
+
},
|
|
202
|
+
moveAssets (assetIds, folderId) {
|
|
203
|
+
const target = resolveFolderId(folderId);
|
|
204
|
+
if (null !== target) requireRecord(target);
|
|
205
|
+
for (const assetId of assetIds)if (null === target) assetFolder.delete(assetId);
|
|
206
|
+
else assetFolder.set(assetId, target);
|
|
207
|
+
notify();
|
|
208
|
+
},
|
|
209
|
+
removeAsset (assetId) {
|
|
210
|
+
if (assetFolder.delete(assetId)) notify();
|
|
211
|
+
},
|
|
212
|
+
subtreeIds (id) {
|
|
213
|
+
return subtree(id);
|
|
214
|
+
},
|
|
215
|
+
subscribe (listener) {
|
|
216
|
+
listeners.add(listener);
|
|
217
|
+
return ()=>{
|
|
218
|
+
listeners.delete(listener);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
export { createFolderStore };
|
package/dist/utils/registry.cjs
CHANGED
|
@@ -28,7 +28,9 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
|
|
31
|
+
assetMatchesSearch: ()=>assetMatchesSearch,
|
|
32
|
+
createAssetRegistry: ()=>createAssetRegistry,
|
|
33
|
+
paginateMatches: ()=>paginateMatches
|
|
32
34
|
});
|
|
33
35
|
const external_infer_kind_cjs_namespaceObject = require("./infer-kind.cjs");
|
|
34
36
|
const DEFAULT_SEARCH_LIMIT = 50;
|
|
@@ -126,6 +128,11 @@ function freezeUploadResult(asset) {
|
|
|
126
128
|
} : {},
|
|
127
129
|
...void 0 !== asset.meta.height ? {
|
|
128
130
|
height: asset.meta.height
|
|
131
|
+
} : {},
|
|
132
|
+
...void 0 !== asset.meta.attribution ? {
|
|
133
|
+
attribution: Object.freeze({
|
|
134
|
+
...asset.meta.attribution
|
|
135
|
+
})
|
|
129
136
|
} : {}
|
|
130
137
|
})
|
|
131
138
|
} : {},
|
|
@@ -149,18 +156,17 @@ function normalizeTags(tags) {
|
|
|
149
156
|
}
|
|
150
157
|
return out;
|
|
151
158
|
}
|
|
152
|
-
function
|
|
159
|
+
function assetMatchesSearch(entry, options) {
|
|
153
160
|
const query = options.query?.trim().toLowerCase() ?? "";
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
if (void 0 === kindFilter || kindFilter.includes((0, external_infer_kind_cjs_namespaceObject.inferAssetKind)(entry))) {
|
|
160
|
-
if (void 0 === tagFilter || matchesAllTags(entry, tagFilter)) matches.push(entry);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
161
|
+
if (!matchesQuery(entry, query)) return false;
|
|
162
|
+
if (options.kinds && options.kinds.length > 0 && !options.kinds.includes((0, external_infer_kind_cjs_namespaceObject.inferAssetKind)(entry))) return false;
|
|
163
|
+
if (options.tags && options.tags.length > 0) {
|
|
164
|
+
const tagFilter = options.tags.map((t)=>t.trim().toLowerCase()).filter((t)=>"" !== t);
|
|
165
|
+
if (tagFilter.length > 0 && !matchesAllTags(entry, tagFilter)) return false;
|
|
163
166
|
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
function paginateMatches(matches, options) {
|
|
164
170
|
const total = matches.length;
|
|
165
171
|
const limit = void 0 !== options.limit && options.limit > 0 ? options.limit : DEFAULT_SEARCH_LIMIT;
|
|
166
172
|
const offset = parseCursor(options.cursor);
|
|
@@ -173,6 +179,11 @@ function runSearch(assetsById, options) {
|
|
|
173
179
|
nextCursor
|
|
174
180
|
});
|
|
175
181
|
}
|
|
182
|
+
function runSearch(assetsById, options) {
|
|
183
|
+
const matches = [];
|
|
184
|
+
for (const entry of assetsById.values())if (assetMatchesSearch(entry, options)) matches.push(entry);
|
|
185
|
+
return paginateMatches(matches, options);
|
|
186
|
+
}
|
|
176
187
|
function matchesQuery(entry, query) {
|
|
177
188
|
if ("" === query) return true;
|
|
178
189
|
if (entry.id.toLowerCase().includes(query)) return true;
|
|
@@ -193,9 +204,13 @@ function parseCursor(cursor) {
|
|
|
193
204
|
if (!Number.isFinite(value) || value < 0) return 0;
|
|
194
205
|
return value;
|
|
195
206
|
}
|
|
207
|
+
exports.assetMatchesSearch = __webpack_exports__.assetMatchesSearch;
|
|
196
208
|
exports.createAssetRegistry = __webpack_exports__.createAssetRegistry;
|
|
209
|
+
exports.paginateMatches = __webpack_exports__.paginateMatches;
|
|
197
210
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
198
|
-
"
|
|
211
|
+
"assetMatchesSearch",
|
|
212
|
+
"createAssetRegistry",
|
|
213
|
+
"paginateMatches"
|
|
199
214
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
200
215
|
Object.defineProperty(exports, '__esModule', {
|
|
201
216
|
value: true
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import type { AssetRegistry } from "../types/types.js";
|
|
1
|
+
import type { AssetKind, AssetRegistry, AssetSearchPage, UploadResult } from "../types/types.js";
|
|
2
2
|
export declare function createAssetRegistry(): AssetRegistry;
|
|
3
|
+
/**
|
|
4
|
+
* Pure predicate: does `entry` satisfy the query / kind / tag filters? Exported
|
|
5
|
+
* so the in-memory data-source compose layer applies the EXACT same matching
|
|
6
|
+
* before adding its folder clause (PRD 0002 §9.2 — single source of truth for
|
|
7
|
+
* search semantics).
|
|
8
|
+
*/
|
|
9
|
+
export declare function assetMatchesSearch(entry: UploadResult, options: {
|
|
10
|
+
readonly query?: string;
|
|
11
|
+
readonly kinds?: readonly AssetKind[];
|
|
12
|
+
readonly tags?: readonly string[];
|
|
13
|
+
}): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pure offset-cursor pagination over a pre-filtered match list. Shared by
|
|
16
|
+
* `runSearch` and the folder-scoped data-source path so the cursor contract is
|
|
17
|
+
* identical regardless of which clause did the filtering.
|
|
18
|
+
*/
|
|
19
|
+
export declare function paginateMatches(matches: readonly UploadResult[], options: {
|
|
20
|
+
readonly cursor?: string;
|
|
21
|
+
readonly limit?: number;
|
|
22
|
+
}): AssetSearchPage;
|
|
3
23
|
//# sourceMappingURL=registry.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.cts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,
|
|
1
|
+
{"version":3,"file":"registry.d.cts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,aAAa,EAGb,eAAe,EACf,YAAY,EACZ,MAAM,mBAAmB,CAAC;AAK3B,wBAAgB,mBAAmB,IAAI,aAAa,CA6EnD;AAmDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE;IACR,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,GACC,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D,eAAe,CAejB"}
|
package/dist/utils/registry.d.ts
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import type { AssetRegistry } from "../types/types.js";
|
|
1
|
+
import type { AssetKind, AssetRegistry, AssetSearchPage, UploadResult } from "../types/types.js";
|
|
2
2
|
export declare function createAssetRegistry(): AssetRegistry;
|
|
3
|
+
/**
|
|
4
|
+
* Pure predicate: does `entry` satisfy the query / kind / tag filters? Exported
|
|
5
|
+
* so the in-memory data-source compose layer applies the EXACT same matching
|
|
6
|
+
* before adding its folder clause (PRD 0002 §9.2 — single source of truth for
|
|
7
|
+
* search semantics).
|
|
8
|
+
*/
|
|
9
|
+
export declare function assetMatchesSearch(entry: UploadResult, options: {
|
|
10
|
+
readonly query?: string;
|
|
11
|
+
readonly kinds?: readonly AssetKind[];
|
|
12
|
+
readonly tags?: readonly string[];
|
|
13
|
+
}): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pure offset-cursor pagination over a pre-filtered match list. Shared by
|
|
16
|
+
* `runSearch` and the folder-scoped data-source path so the cursor contract is
|
|
17
|
+
* identical regardless of which clause did the filtering.
|
|
18
|
+
*/
|
|
19
|
+
export declare function paginateMatches(matches: readonly UploadResult[], options: {
|
|
20
|
+
readonly cursor?: string;
|
|
21
|
+
readonly limit?: number;
|
|
22
|
+
}): AssetSearchPage;
|
|
3
23
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,aAAa,EAGb,eAAe,EACf,YAAY,EACZ,MAAM,mBAAmB,CAAC;AAK3B,wBAAgB,mBAAmB,IAAI,aAAa,CA6EnD;AAmDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE;IACR,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,GACC,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D,eAAe,CAejB"}
|
package/dist/utils/registry.js
CHANGED
|
@@ -94,6 +94,11 @@ function freezeUploadResult(asset) {
|
|
|
94
94
|
} : {},
|
|
95
95
|
...void 0 !== asset.meta.height ? {
|
|
96
96
|
height: asset.meta.height
|
|
97
|
+
} : {},
|
|
98
|
+
...void 0 !== asset.meta.attribution ? {
|
|
99
|
+
attribution: Object.freeze({
|
|
100
|
+
...asset.meta.attribution
|
|
101
|
+
})
|
|
97
102
|
} : {}
|
|
98
103
|
})
|
|
99
104
|
} : {},
|
|
@@ -117,18 +122,17 @@ function normalizeTags(tags) {
|
|
|
117
122
|
}
|
|
118
123
|
return out;
|
|
119
124
|
}
|
|
120
|
-
function
|
|
125
|
+
function assetMatchesSearch(entry, options) {
|
|
121
126
|
const query = options.query?.trim().toLowerCase() ?? "";
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (
|
|
127
|
-
if (void 0 === kindFilter || kindFilter.includes(inferAssetKind(entry))) {
|
|
128
|
-
if (void 0 === tagFilter || matchesAllTags(entry, tagFilter)) matches.push(entry);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
127
|
+
if (!matchesQuery(entry, query)) return false;
|
|
128
|
+
if (options.kinds && options.kinds.length > 0 && !options.kinds.includes(inferAssetKind(entry))) return false;
|
|
129
|
+
if (options.tags && options.tags.length > 0) {
|
|
130
|
+
const tagFilter = options.tags.map((t)=>t.trim().toLowerCase()).filter((t)=>"" !== t);
|
|
131
|
+
if (tagFilter.length > 0 && !matchesAllTags(entry, tagFilter)) return false;
|
|
131
132
|
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
function paginateMatches(matches, options) {
|
|
132
136
|
const total = matches.length;
|
|
133
137
|
const limit = void 0 !== options.limit && options.limit > 0 ? options.limit : DEFAULT_SEARCH_LIMIT;
|
|
134
138
|
const offset = parseCursor(options.cursor);
|
|
@@ -141,6 +145,11 @@ function runSearch(assetsById, options) {
|
|
|
141
145
|
nextCursor
|
|
142
146
|
});
|
|
143
147
|
}
|
|
148
|
+
function runSearch(assetsById, options) {
|
|
149
|
+
const matches = [];
|
|
150
|
+
for (const entry of assetsById.values())if (assetMatchesSearch(entry, options)) matches.push(entry);
|
|
151
|
+
return paginateMatches(matches, options);
|
|
152
|
+
}
|
|
144
153
|
function matchesQuery(entry, query) {
|
|
145
154
|
if ("" === query) return true;
|
|
146
155
|
if (entry.id.toLowerCase().includes(query)) return true;
|
|
@@ -161,4 +170,4 @@ function parseCursor(cursor) {
|
|
|
161
170
|
if (!Number.isFinite(value) || value < 0) return 0;
|
|
162
171
|
return value;
|
|
163
172
|
}
|
|
164
|
-
export { createAssetRegistry };
|
|
173
|
+
export { assetMatchesSearch, createAssetRegistry, paginateMatches };
|
|
@@ -30,7 +30,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
MAX_CONCURRENT_UPLOADS: ()=>MAX_CONCURRENT_UPLOADS,
|
|
32
32
|
createStudioAssetSource: ()=>createStudioAssetSource,
|
|
33
|
-
inferStudioAssetKind: ()=>inferStudioAssetKind
|
|
33
|
+
inferStudioAssetKind: ()=>inferStudioAssetKind,
|
|
34
|
+
toStudioAsset: ()=>toStudioAsset
|
|
34
35
|
});
|
|
35
36
|
const external_asset_reference_cjs_namespaceObject = require("./asset-reference.cjs");
|
|
36
37
|
const external_infer_kind_cjs_namespaceObject = require("./infer-kind.cjs");
|
|
@@ -226,10 +227,12 @@ function makeAbortError() {
|
|
|
226
227
|
exports.MAX_CONCURRENT_UPLOADS = __webpack_exports__.MAX_CONCURRENT_UPLOADS;
|
|
227
228
|
exports.createStudioAssetSource = __webpack_exports__.createStudioAssetSource;
|
|
228
229
|
exports.inferStudioAssetKind = __webpack_exports__.inferStudioAssetKind;
|
|
230
|
+
exports.toStudioAsset = __webpack_exports__.toStudioAsset;
|
|
229
231
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
230
232
|
"MAX_CONCURRENT_UPLOADS",
|
|
231
233
|
"createStudioAssetSource",
|
|
232
|
-
"inferStudioAssetKind"
|
|
234
|
+
"inferStudioAssetKind",
|
|
235
|
+
"toStudioAsset"
|
|
233
236
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
234
237
|
Object.defineProperty(exports, '__esModule', {
|
|
235
238
|
value: true
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* shared `AssetRegistry`. Mutation methods route back through the
|
|
12
12
|
* registry so the IR resolver and the sidebar see the same data.
|
|
13
13
|
*/
|
|
14
|
-
import type { StudioAssetKind, StudioAssetSource } from "@anvilkit/core/types";
|
|
14
|
+
import type { StudioAsset, StudioAssetKind, StudioAssetSource } from "@anvilkit/core/types";
|
|
15
15
|
import type { AssetRegistry, UploadAdapterOptions, UploadResult } from "../types/types.js";
|
|
16
16
|
/**
|
|
17
17
|
* Default concurrency cap for batched uploads. Editors typically drag
|
|
@@ -43,6 +43,11 @@ export interface CreateStudioAssetSourceOptions {
|
|
|
43
43
|
readonly maxConcurrentUploads?: number;
|
|
44
44
|
}
|
|
45
45
|
export declare function createStudioAssetSource(options: CreateStudioAssetSourceOptions): StudioAssetSource;
|
|
46
|
+
/**
|
|
47
|
+
* Project a registry `UploadResult` into the sidebar's `StudioAsset` shape.
|
|
48
|
+
* Exported so the composite source reuses the exact same projection.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toStudioAsset(entry: UploadResult, getThumbnail?: (entry: UploadResult) => string | undefined): StudioAsset;
|
|
46
51
|
/**
|
|
47
52
|
* Public alias for {@link inferAssetKind}. Preserved as the documented
|
|
48
53
|
* Studio-side projection so existing imports keep working; library
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio-asset-source.d.cts","sourceRoot":"","sources":["../../src/utils/studio-asset-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"studio-asset-source.d.cts","sourceRoot":"","sources":["../../src/utils/studio-asset-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EAGf,iBAAiB,EAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,MAAM,mBAAmB,CAAC;AAI3B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,CAChB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,oBAAoB,KAC1B,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,CAAC;IACpE;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,8BAA8B,GACrC,iBAAiB,CAqLnB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,GACxD,WAAW,CAqBb;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAEzE"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* shared `AssetRegistry`. Mutation methods route back through the
|
|
12
12
|
* registry so the IR resolver and the sidebar see the same data.
|
|
13
13
|
*/
|
|
14
|
-
import type { StudioAssetKind, StudioAssetSource } from "@anvilkit/core/types";
|
|
14
|
+
import type { StudioAsset, StudioAssetKind, StudioAssetSource } from "@anvilkit/core/types";
|
|
15
15
|
import type { AssetRegistry, UploadAdapterOptions, UploadResult } from "../types/types.js";
|
|
16
16
|
/**
|
|
17
17
|
* Default concurrency cap for batched uploads. Editors typically drag
|
|
@@ -43,6 +43,11 @@ export interface CreateStudioAssetSourceOptions {
|
|
|
43
43
|
readonly maxConcurrentUploads?: number;
|
|
44
44
|
}
|
|
45
45
|
export declare function createStudioAssetSource(options: CreateStudioAssetSourceOptions): StudioAssetSource;
|
|
46
|
+
/**
|
|
47
|
+
* Project a registry `UploadResult` into the sidebar's `StudioAsset` shape.
|
|
48
|
+
* Exported so the composite source reuses the exact same projection.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toStudioAsset(entry: UploadResult, getThumbnail?: (entry: UploadResult) => string | undefined): StudioAsset;
|
|
46
51
|
/**
|
|
47
52
|
* Public alias for {@link inferAssetKind}. Preserved as the documented
|
|
48
53
|
* Studio-side projection so existing imports keep working; library
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio-asset-source.d.ts","sourceRoot":"","sources":["../../src/utils/studio-asset-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"studio-asset-source.d.ts","sourceRoot":"","sources":["../../src/utils/studio-asset-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EAGf,iBAAiB,EAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACX,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,MAAM,mBAAmB,CAAC;AAI3B;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,CAChB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,oBAAoB,KAC1B,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,CAAC;IACpE;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,8BAA8B,GACrC,iBAAiB,CAqLnB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,GACxD,WAAW,CAqBb;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAEzE"}
|
|
@@ -189,4 +189,4 @@ function makeAbortError() {
|
|
|
189
189
|
error.name = "AbortError";
|
|
190
190
|
return error;
|
|
191
191
|
}
|
|
192
|
-
export { MAX_CONCURRENT_UPLOADS, createStudioAssetSource, inferStudioAssetKind };
|
|
192
|
+
export { MAX_CONCURRENT_UPLOADS, createStudioAssetSource, inferStudioAssetKind, toStudioAsset };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AssetManagerOptions
|
|
1
|
+
import type { AssetManagerOptions } from "../types/options.js";
|
|
2
|
+
import type { UploadResult } from "../types/types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Subset of {@link AssetManagerOptions} consulted by the trust boundary.
|
|
4
5
|
* `urlAllowlist` is intentionally absent — Phase 4 replaced the raw
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-upload-result.d.cts","sourceRoot":"","sources":["../../src/utils/validate-upload-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-upload-result.d.cts","sourceRoot":"","sources":["../../src/utils/validate-upload-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC7C,mBAAmB,EACnB,uBAAuB,GAAG,2BAA2B,CACrD,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,2BAAgC,GACvC,YAAY,CAqBd"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AssetManagerOptions
|
|
1
|
+
import type { AssetManagerOptions } from "../types/options.js";
|
|
2
|
+
import type { UploadResult } from "../types/types.js";
|
|
2
3
|
/**
|
|
3
4
|
* Subset of {@link AssetManagerOptions} consulted by the trust boundary.
|
|
4
5
|
* `urlAllowlist` is intentionally absent — Phase 4 replaced the raw
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-upload-result.d.ts","sourceRoot":"","sources":["../../src/utils/validate-upload-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-upload-result.d.ts","sourceRoot":"","sources":["../../src/utils/validate-upload-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMtD;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC7C,mBAAmB,EACnB,uBAAuB,GAAG,2BAA2B,CACrD,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,2BAAgC,GACvC,YAAY,CAqBd"}
|
package/dist/version.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var __webpack_require__ = {};
|
|
|
27
27
|
})();
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const ASSET_MANAGER_VERSION = "0.1.
|
|
30
|
+
const ASSET_MANAGER_VERSION = "0.1.7";
|
|
31
31
|
__webpack_require__.d(__webpack_exports__, {}, {
|
|
32
32
|
ASSET_MANAGER_VERSION: ASSET_MANAGER_VERSION
|
|
33
33
|
});
|
package/dist/version.d.cts
CHANGED
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
* constant ships only the version. Mirrors `@anvilkit/core`'s
|
|
17
17
|
* `runtime/version.ts`, which makes the same call.
|
|
18
18
|
*/
|
|
19
|
-
export declare const ASSET_MANAGER_VERSION = "0.1.
|
|
19
|
+
export declare const ASSET_MANAGER_VERSION = "0.1.7";
|
|
20
20
|
//# sourceMappingURL=version.d.cts.map
|
package/dist/version.d.ts
CHANGED
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
* constant ships only the version. Mirrors `@anvilkit/core`'s
|
|
17
17
|
* `runtime/version.ts`, which makes the same call.
|
|
18
18
|
*/
|
|
19
|
-
export declare const ASSET_MANAGER_VERSION = "0.1.
|
|
19
|
+
export declare const ASSET_MANAGER_VERSION = "0.1.7";
|
|
20
20
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const ASSET_MANAGER_VERSION = "0.1.
|
|
1
|
+
const ASSET_MANAGER_VERSION = "0.1.7";
|
|
2
2
|
export { ASSET_MANAGER_VERSION };
|
package/meta/config.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "anvilkit-plugin-asset-manager",
|
|
3
3
|
"name": "Asset Manager",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"coreVersion": "^0.1.0-alpha",
|
|
6
6
|
"description": "Headless asset upload plugin with host-provided persistence and a separate React UI subpath.",
|
|
7
7
|
"capabilities": { "header": true }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvilkit/plugin-asset-manager",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Headless asset manager plugin for Anvilkit Studio with host-provided uploads and optional React UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -56,6 +56,16 @@
|
|
|
56
56
|
"types": "./dist/adapters/s3-presigned.d.cts",
|
|
57
57
|
"default": "./dist/adapters/s3-presigned.cjs"
|
|
58
58
|
}
|
|
59
|
+
},
|
|
60
|
+
"./providers/unsplash": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/sources/unsplash/index.d.ts",
|
|
63
|
+
"default": "./dist/sources/unsplash/index.js"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/sources/unsplash/index.d.cts",
|
|
67
|
+
"default": "./dist/sources/unsplash/index.cjs"
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
},
|
|
61
71
|
"files": [
|
|
@@ -86,7 +96,7 @@
|
|
|
86
96
|
},
|
|
87
97
|
"dependencies": {
|
|
88
98
|
"lucide-react": "^1.16.0",
|
|
89
|
-
"@anvilkit/core": "0.1.
|
|
99
|
+
"@anvilkit/core": "0.1.13",
|
|
90
100
|
"@anvilkit/ir": "0.1.11",
|
|
91
101
|
"@anvilkit/ui": "0.1.11",
|
|
92
102
|
"@anvilkit/utils": "0.1.11"
|