@antelopejs/dms-media 0.7.3 → 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/README.md +10 -10
- package/dist/acl/entries.js +20 -2
- package/dist/acl/entries.js.map +1 -1
- package/dist/asset-lifecycle.js +5 -1
- package/dist/asset-lifecycle.js.map +1 -1
- package/dist/bindings.d.ts +1 -0
- package/dist/bindings.js +36 -25
- package/dist/bindings.js.map +1 -1
- package/dist/db/models/mediaAssets.model.d.ts +3 -3
- package/dist/db/models/mediaDeclarations.model.d.ts +3 -3
- package/dist/db/models/mediaEvents.model.d.ts +3 -3
- package/dist/db/models/mediaFavorites.model.d.ts +3 -3
- package/dist/db/models/mediaFolders.model.d.ts +3 -3
- package/dist/db/models/mediaUploads.model.d.ts +3 -3
- package/dist/declared/assets.js +39 -25
- package/dist/declared/assets.js.map +1 -1
- package/dist/declared/folders.js +27 -14
- package/dist/declared/folders.js.map +1 -1
- package/dist/declared/records.d.ts +1 -0
- package/dist/declared/records.js +18 -1
- package/dist/declared/records.js.map +1 -1
- package/dist/fixed-id.d.ts +1 -0
- package/dist/fixed-id.js +16 -0
- package/dist/fixed-id.js.map +1 -0
- package/dist/routes/media/assets.d.ts +3 -2
- package/dist/routes/media/assets.js +11 -6
- package/dist/routes/media/assets.js.map +1 -1
- package/dist/routes/media/storage-keys.js +10 -1
- package/dist/routes/media/storage-keys.js.map +1 -1
- package/dist/test/helpers/assets.d.ts +2 -2
- package/dist/test/helpers/folders.d.ts +6 -6
- package/dist/test/helpers/permissions-world.d.ts +6 -6
- package/dist/test/integration/binding-folder-race.test.d.ts +1 -0
- package/dist/test/integration/binding-folder-race.test.js +66 -0
- package/dist/test/integration/binding-folder-race.test.js.map +1 -0
- package/dist/test/integration/declared-asset-race.test.d.ts +1 -0
- package/dist/test/integration/declared-asset-race.test.js +78 -0
- package/dist/test/integration/declared-asset-race.test.js.map +1 -0
- package/dist/test/integration/declared-folder-race.test.d.ts +1 -0
- package/dist/test/integration/declared-folder-race.test.js +43 -0
- package/dist/test/integration/declared-folder-race.test.js.map +1 -0
- package/dist/test/integration/media-activity-overview.test.js +27 -22
- package/dist/test/integration/media-activity-overview.test.js.map +1 -1
- package/dist/test/integration/media-api.test.js +9 -5
- package/dist/test/integration/media-api.test.js.map +1 -1
- package/dist/test/integration/media-bindings.test.js +16 -13
- package/dist/test/integration/media-bindings.test.js.map +1 -1
- package/dist/test/integration/media-cleanup.test.js +14 -5
- package/dist/test/integration/media-cleanup.test.js.map +1 -1
- package/dist/test/integration/media-declared-content.test.js +107 -91
- package/dist/test/integration/media-declared-content.test.js.map +1 -1
- package/dist/test/integration/media-delivery-editing.test.js +238 -215
- package/dist/test/integration/media-delivery-editing.test.js.map +1 -1
- package/dist/test/integration/media-explorer-writes.test.js +131 -112
- package/dist/test/integration/media-explorer-writes.test.js.map +1 -1
- package/dist/test/integration/media-guards.test.js +38 -37
- package/dist/test/integration/media-guards.test.js.map +1 -1
- package/dist/test/integration/media-library.test.js +244 -224
- package/dist/test/integration/media-library.test.js.map +1 -1
- package/dist/test/integration/media-linked-subfolders.test.js +173 -158
- package/dist/test/integration/media-linked-subfolders.test.js.map +1 -1
- package/dist/test/integration/media-permissions.test.js +31 -11
- package/dist/test/integration/media-permissions.test.js.map +1 -1
- package/dist/test/integration/media-search-query.test.js +8 -6
- package/dist/test/integration/media-search-query.test.js.map +1 -1
- package/dist/test/integration/media-search-views.test.js +12 -8
- package/dist/test/integration/media-search-views.test.js.map +1 -1
- package/dist/test/integration/media-upload-policy.test.js +228 -200
- package/dist/test/integration/media-upload-policy.test.js.map +1 -1
- package/dist/test/stack-modules.json +5 -5
- package/dist/test/unit/acl/entries.test.js +19 -0
- package/dist/test/unit/acl/entries.test.js.map +1 -1
- package/dist/test/unit/acl/resolver.test.js +9 -1
- package/dist/test/unit/acl/resolver.test.js.map +1 -1
- package/dist/test/unit/asset-lifecycle.test.d.ts +1 -0
- package/dist/test/unit/asset-lifecycle.test.js +18 -0
- package/dist/test/unit/asset-lifecycle.test.js.map +1 -0
- package/dist/test/unit/routes/storage-keys.test.d.ts +1 -0
- package/dist/test/unit/routes/storage-keys.test.js +18 -0
- package/dist/test/unit/routes/storage-keys.test.js.map +1 -0
- package/dist/test/unit/transform-ops.test.js +19 -0
- package/dist/test/unit/transform-ops.test.js.map +1 -1
- package/dist/transform-ops.js +25 -1
- package/dist/transform-ops.js.map +1 -1
- package/dist/validation/declared.schema.d.ts +6 -6
- package/dist/validation/library.schema.d.ts +4 -4
- package/dist/validation/media.schema.d.ts +4 -4
- package/frontend-vue/app/components/Explorer.vue +2 -0
- package/frontend-vue/app/components/FileProperties.vue +1 -1
- package/frontend-vue/app/components/ImageEditor.vue +5 -5
- package/frontend-vue/app/components/RecentFiles.vue +2 -2
- package/frontend-vue/app/components/UploadQueue.vue +4 -4
- package/frontend-vue/app/components/dialogs/DeleteFilesDialog.vue +1 -1
- package/frontend-vue/app/components/dialogs/ShortcutsDialog.vue +1 -1
- package/frontend-vue/app/components/dialogs/VisibilityDialog.vue +1 -1
- package/frontend-vue/app/components/explorer/ExplorerInspector.vue +1 -1
- package/frontend-vue/app/components/explorer/ExplorerSidebar.vue +2 -2
- package/frontend-vue/app/components/explorer/FolderStrip.vue +1 -1
- package/frontend-vue/app/components/explorer/GridView.vue +1 -1
- package/frontend-vue/app/components/shared/AltTextField.vue +2 -2
- package/frontend-vue/build/backend-boundary.ts +8 -3
- package/frontend-vue/eslint.config.mjs +0 -1
- package/frontend-vue/package.json +2 -2
- package/frontend-vue/pnpm-lock.yaml +45 -14
- package/frontend-vue/tests/backend-boundary.test.ts +6 -4
- package/frontend-vue/tests/fixtures/serverRender.ts +3 -3
- package/frontend-vue/tests/registration.test.ts +5 -0
- package/package.json +15 -15
- package/src/acl/entries.ts +30 -7
- package/src/asset-lifecycle.ts +6 -2
- package/src/bindings.ts +41 -38
- package/src/declared/assets.ts +45 -28
- package/src/declared/folders.ts +30 -21
- package/src/declared/records.ts +31 -2
- package/src/fixed-id.ts +18 -0
- package/src/routes/media/assets.ts +14 -6
- package/src/routes/media/storage-keys.ts +14 -2
- package/src/test/integration/binding-folder-race.test.ts +82 -0
- package/src/test/integration/declared-asset-race.test.ts +115 -0
- package/src/test/integration/declared-folder-race.test.ts +50 -0
- package/src/test/integration/media-activity-overview.test.ts +40 -27
- package/src/test/integration/media-api.test.ts +9 -5
- package/src/test/integration/media-bindings.test.ts +17 -13
- package/src/test/integration/media-cleanup.test.ts +17 -5
- package/src/test/integration/media-declared-content.test.ts +129 -112
- package/src/test/integration/media-delivery-editing.test.ts +323 -299
- package/src/test/integration/media-explorer-writes.test.ts +161 -135
- package/src/test/integration/media-guards.test.ts +40 -38
- package/src/test/integration/media-library.test.ts +325 -296
- package/src/test/integration/media-linked-subfolders.test.ts +207 -186
- package/src/test/integration/media-permissions.test.ts +33 -14
- package/src/test/integration/media-search-query.test.ts +24 -8
- package/src/test/integration/media-search-views.test.ts +39 -32
- package/src/test/integration/media-upload-policy.test.ts +283 -254
- package/src/test/stack-modules.json +5 -5
- package/src/test/unit/acl/entries.test.ts +23 -0
- package/src/test/unit/acl/resolver.test.ts +9 -1
- package/src/test/unit/asset-lifecycle.test.ts +21 -0
- package/src/test/unit/routes/storage-keys.test.ts +23 -0
- package/src/test/unit/transform-ops.test.ts +29 -1
- package/src/transform-ops.ts +32 -2
|
@@ -42,7 +42,7 @@ function onKeydown(event: KeyboardEvent): void {
|
|
|
42
42
|
|
|
43
43
|
<template>
|
|
44
44
|
<section v-if="folders.length" class="flex flex-col gap-2">
|
|
45
|
-
<
|
|
45
|
+
<DmsEyebrowLabel :label="`${t('dms_media.explorer.folders')} · ${folders.length}`" tone="muted" />
|
|
46
46
|
<div class="grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2" role="list" :aria-label="t('dms_media.explorer.folders')" @keydown="onKeydown">
|
|
47
47
|
<UContextMenu v-for="(folder, index) in folders" :key="folder.id" :items="commands.folderMenu(folder)">
|
|
48
48
|
<div
|
|
@@ -16,7 +16,7 @@ const columns = computed(() => {
|
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
18
|
<section v-if="assets.length" class="flex flex-col gap-2">
|
|
19
|
-
<
|
|
19
|
+
<DmsEyebrowLabel :label="t('dms_media.explorer.files')" tone="muted" />
|
|
20
20
|
<div
|
|
21
21
|
class="grid gap-2"
|
|
22
22
|
role="listbox"
|
|
@@ -45,7 +45,7 @@ async function commit(): Promise<void> {
|
|
|
45
45
|
<template>
|
|
46
46
|
<DmsFieldRow :label="t('dms_media.alt.label')" :label-for="inputId" layout="stack" :inset="false" spacing="list">
|
|
47
47
|
<template v-if="compact" #label>
|
|
48
|
-
<
|
|
48
|
+
<DmsEyebrowLabel :label="t('dms_media.alt.label')" tone="muted" />
|
|
49
49
|
</template>
|
|
50
50
|
<template #label-extra>
|
|
51
51
|
<UBadge v-if="asset.alt" :label="t('dms_media.alt.set')" color="success" variant="subtle" size="sm" />
|
|
@@ -55,7 +55,7 @@ async function commit(): Promise<void> {
|
|
|
55
55
|
<DmsSaveStatus :state="saveState" @retry="commit" />
|
|
56
56
|
</template>
|
|
57
57
|
<UFormField>
|
|
58
|
-
<
|
|
58
|
+
<DmsInputTextarea
|
|
59
59
|
:id="inputId"
|
|
60
60
|
v-model="draft"
|
|
61
61
|
:rows="compact ? 3 : 2"
|
|
@@ -4,7 +4,7 @@ import type { DmsVitePluginEntry } from '#dms/frontend-build'
|
|
|
4
4
|
|
|
5
5
|
type VitePlugin = Extract<DmsVitePluginEntry, { name: string }>
|
|
6
6
|
|
|
7
|
-
const BACKEND_PACKAGE =
|
|
7
|
+
const BACKEND_PACKAGE = "@antelopejs/dms-media"
|
|
8
8
|
const BACKEND_SOURCE = 'src'
|
|
9
9
|
const QUERY_OR_HASH = /[?#].*$/
|
|
10
10
|
|
|
@@ -74,6 +74,11 @@ function backendSourceFile(id: string): string | undefined {
|
|
|
74
74
|
: undefined
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/** `path` with `/` separators, the form Vite gives an importer, so a boundary error names both paths alike on every OS. */
|
|
78
|
+
function forwardSlashes(path: string): string {
|
|
79
|
+
return path.split(sep).join('/')
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
/**
|
|
78
83
|
* Fails the build and the dev server when a module of the frontend resolves to
|
|
79
84
|
* a file under the `src` of the backend package: the browser reaches the
|
|
@@ -113,9 +118,9 @@ function boundaryCheck(): VitePlugin {
|
|
|
113
118
|
const from =
|
|
114
119
|
importer === undefined
|
|
115
120
|
? 'an entry point'
|
|
116
|
-
: importer.replace(QUERY_OR_HASH, '')
|
|
121
|
+
: forwardSlashes(importer.replace(QUERY_OR_HASH, ''))
|
|
117
122
|
return this.error(
|
|
118
|
-
`Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
123
|
+
`Backend boundary: ${from} imports ${forwardSlashes(file)}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
119
124
|
)
|
|
120
125
|
},
|
|
121
126
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"main": "./dms.frontend.ts",
|
|
7
7
|
"packageManager": "pnpm@10.6.5",
|
|
8
8
|
"engines": {
|
|
9
|
-
"@antelopejs/dms-frontend": ">=0.
|
|
9
|
+
"@antelopejs/dms-frontend": ">=0.11.1 <0.12.0"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "pnpm --dir ../playground frontend:dev",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"zod": "^3.24.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@antelopejs/tooling-configs": "^0.
|
|
29
|
+
"@antelopejs/tooling-configs": "^0.7.1",
|
|
30
30
|
"@nuxt/ui": "4.10.0",
|
|
31
31
|
"@typescript-eslint/parser": "^8.0.0",
|
|
32
32
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
@@ -28,8 +28,8 @@ importers:
|
|
|
28
28
|
version: 3.25.76
|
|
29
29
|
devDependencies:
|
|
30
30
|
'@antelopejs/tooling-configs':
|
|
31
|
-
specifier: ^0.
|
|
32
|
-
version: 0.
|
|
31
|
+
specifier: ^0.7.1
|
|
32
|
+
version: 0.7.1
|
|
33
33
|
'@nuxt/ui':
|
|
34
34
|
specifier: 4.10.0
|
|
35
35
|
version: 4.10.0(bde0b3f9741301faabd50d1085263063)
|
|
@@ -67,16 +67,20 @@ packages:
|
|
|
67
67
|
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
|
|
68
68
|
engines: {node: '>=10'}
|
|
69
69
|
|
|
70
|
-
'@antelopejs/tooling-configs@0.
|
|
71
|
-
resolution: {integrity: sha512-
|
|
70
|
+
'@antelopejs/tooling-configs@0.7.1':
|
|
71
|
+
resolution: {integrity: sha512-X/mr/nQEgmFI2dMr3ThMS7HcPaU1amsTU/RNfEnQv46+l7au8cv7unpypCZ0BggnfJHjpk2QG2CTOOllpwj3cw==}
|
|
72
72
|
engines: {node: '>=22.18.0'}
|
|
73
73
|
hasBin: true
|
|
74
74
|
peerDependencies:
|
|
75
75
|
'@nuxt/eslint-config': '>=1.2.0'
|
|
76
76
|
eslint-plugin-perfectionist: '>=5.0.0'
|
|
77
77
|
knip: '>=6.0.0'
|
|
78
|
-
|
|
78
|
+
mongodb-memory-server: '>=10.0.0'
|
|
79
|
+
oxfmt: ^0.66.0 || ^0.77.0
|
|
79
80
|
oxlint: 1.81.0
|
|
81
|
+
pixelmatch: '>=7.0.0'
|
|
82
|
+
playwright-core: '>=1.56.0'
|
|
83
|
+
sharp: '>=0.34.0'
|
|
80
84
|
peerDependenciesMeta:
|
|
81
85
|
'@nuxt/eslint-config':
|
|
82
86
|
optional: true
|
|
@@ -84,10 +88,18 @@ packages:
|
|
|
84
88
|
optional: true
|
|
85
89
|
knip:
|
|
86
90
|
optional: true
|
|
91
|
+
mongodb-memory-server:
|
|
92
|
+
optional: true
|
|
87
93
|
oxfmt:
|
|
88
94
|
optional: true
|
|
89
95
|
oxlint:
|
|
90
96
|
optional: true
|
|
97
|
+
pixelmatch:
|
|
98
|
+
optional: true
|
|
99
|
+
playwright-core:
|
|
100
|
+
optional: true
|
|
101
|
+
sharp:
|
|
102
|
+
optional: true
|
|
91
103
|
|
|
92
104
|
'@antfu/install-pkg@1.1.0':
|
|
93
105
|
resolution: {integrity: sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==}
|
|
@@ -1413,6 +1425,10 @@ packages:
|
|
|
1413
1425
|
resolution: {integrity: sha512-8C71BQkGjiMmXtop7pHVJu1l2NNShFdkCyD6a2ezzs5vU/L3LRtb69EtcteFwz0mYMPzIgOw0n6OV4VBUWZd7A==}
|
|
1414
1426
|
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
|
1415
1427
|
|
|
1428
|
+
'@typescript/typescript6@6.0.2':
|
|
1429
|
+
resolution: {integrity: sha512-mbCddXd+jm7hfx7w2YU64/Av4/NqqeG3GoRZgxPcgoTxYjhrcfJRw9ULch71SS4G+Q3bOXFhRvPqjguN0Hyp5w==}
|
|
1430
|
+
hasBin: true
|
|
1431
|
+
|
|
1416
1432
|
'@unhead/vue@2.1.16':
|
|
1417
1433
|
resolution: {integrity: sha512-t6QykImeMJcrUTbFB0Coy0cB/OZItHdQFRFLoH8GAVXKWmQORGPrwvueP9me7adOCuMH2uVvrv0nCkbi6zksaA==}
|
|
1418
1434
|
peerDependencies:
|
|
@@ -1623,6 +1639,10 @@ packages:
|
|
|
1623
1639
|
brace-expansion@1.1.16:
|
|
1624
1640
|
resolution: {integrity: sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==}
|
|
1625
1641
|
|
|
1642
|
+
brace-expansion@5.0.13:
|
|
1643
|
+
resolution: {integrity: sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==}
|
|
1644
|
+
engines: {node: 20 || >=22}
|
|
1645
|
+
|
|
1626
1646
|
brace-expansion@5.0.7:
|
|
1627
1647
|
resolution: {integrity: sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==}
|
|
1628
1648
|
engines: {node: 18 || 20 || >=22}
|
|
@@ -2367,6 +2387,10 @@ packages:
|
|
|
2367
2387
|
resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==}
|
|
2368
2388
|
engines: {node: 18 || 20 || >=22}
|
|
2369
2389
|
|
|
2390
|
+
minimatch@10.2.6:
|
|
2391
|
+
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
|
|
2392
|
+
engines: {node: 18 || 20 || >=22}
|
|
2393
|
+
|
|
2370
2394
|
minimatch@3.1.5:
|
|
2371
2395
|
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
|
|
2372
2396
|
|
|
@@ -2821,11 +2845,6 @@ packages:
|
|
|
2821
2845
|
type-level-regexp@0.1.17:
|
|
2822
2846
|
resolution: {integrity: sha512-wTk4DH3cxwk196uGLK/E9pE45aLfeKJacKmcEgEOA/q5dnPGNxXt0cfYdFxb57L+sEpf1oJH4Dnx/pnRcku9jg==}
|
|
2823
2847
|
|
|
2824
|
-
typescript@5.9.3:
|
|
2825
|
-
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
|
2826
|
-
engines: {node: '>=14.17'}
|
|
2827
|
-
hasBin: true
|
|
2828
|
-
|
|
2829
2848
|
typescript@6.0.3:
|
|
2830
2849
|
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
|
|
2831
2850
|
engines: {node: '>=14.17'}
|
|
@@ -3208,11 +3227,13 @@ snapshots:
|
|
|
3208
3227
|
|
|
3209
3228
|
'@alloc/quick-lru@5.2.0': {}
|
|
3210
3229
|
|
|
3211
|
-
'@antelopejs/tooling-configs@0.
|
|
3230
|
+
'@antelopejs/tooling-configs@0.7.1':
|
|
3212
3231
|
dependencies:
|
|
3213
3232
|
'@oxlint/plugins': 1.81.0
|
|
3233
|
+
'@typescript/typescript6': 6.0.2
|
|
3214
3234
|
dts-bundle-generator: 9.5.1
|
|
3215
|
-
|
|
3235
|
+
minimatch: 10.2.6
|
|
3236
|
+
semver: 7.8.5
|
|
3216
3237
|
yaml: 2.9.1
|
|
3217
3238
|
|
|
3218
3239
|
'@antfu/install-pkg@1.1.0':
|
|
@@ -4460,6 +4481,10 @@ snapshots:
|
|
|
4460
4481
|
'@typescript-eslint/types': 8.65.0
|
|
4461
4482
|
eslint-visitor-keys: 5.0.1
|
|
4462
4483
|
|
|
4484
|
+
'@typescript/typescript6@6.0.2':
|
|
4485
|
+
dependencies:
|
|
4486
|
+
'@typescript/old': typescript@6.0.3
|
|
4487
|
+
|
|
4463
4488
|
'@unhead/vue@2.1.16(vue@3.5.40(typescript@6.0.3))':
|
|
4464
4489
|
dependencies:
|
|
4465
4490
|
hookable: 6.1.1
|
|
@@ -4694,6 +4719,10 @@ snapshots:
|
|
|
4694
4719
|
balanced-match: 1.0.2
|
|
4695
4720
|
concat-map: 0.0.1
|
|
4696
4721
|
|
|
4722
|
+
brace-expansion@5.0.13:
|
|
4723
|
+
dependencies:
|
|
4724
|
+
balanced-match: 4.0.4
|
|
4725
|
+
|
|
4697
4726
|
brace-expansion@5.0.7:
|
|
4698
4727
|
dependencies:
|
|
4699
4728
|
balanced-match: 4.0.4
|
|
@@ -5418,6 +5447,10 @@ snapshots:
|
|
|
5418
5447
|
dependencies:
|
|
5419
5448
|
brace-expansion: 5.0.7
|
|
5420
5449
|
|
|
5450
|
+
minimatch@10.2.6:
|
|
5451
|
+
dependencies:
|
|
5452
|
+
brace-expansion: 5.0.13
|
|
5453
|
+
|
|
5421
5454
|
minimatch@3.1.5:
|
|
5422
5455
|
dependencies:
|
|
5423
5456
|
brace-expansion: 1.1.16
|
|
@@ -5876,8 +5909,6 @@ snapshots:
|
|
|
5876
5909
|
|
|
5877
5910
|
type-level-regexp@0.1.17: {}
|
|
5878
5911
|
|
|
5879
|
-
typescript@5.9.3: {}
|
|
5880
|
-
|
|
5881
5912
|
typescript@6.0.3: {}
|
|
5882
5913
|
|
|
5883
5914
|
ufo@1.6.4: {}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from 'node:fs'
|
|
9
9
|
import { tmpdir } from 'node:os'
|
|
10
10
|
import { dirname, join } from 'node:path'
|
|
11
|
-
import { build as viteBuild, type Plugin } from 'vite'
|
|
11
|
+
import { build as viteBuild, normalizePath, type Plugin } from 'vite'
|
|
12
12
|
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
13
13
|
import { backendBoundary } from '../build/backend-boundary'
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ function write(file: string, text: string): void {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
beforeAll(() => {
|
|
25
|
-
repository = realpathSync(
|
|
25
|
+
repository = realpathSync.native(
|
|
26
26
|
mkdtempSync(join(tmpdir(), 'dms-media-boundary-')),
|
|
27
27
|
)
|
|
28
28
|
const backend = join(repository, 'packages/dms-media')
|
|
@@ -102,8 +102,10 @@ describe('the backend boundary of the frontend build', () => {
|
|
|
102
102
|
'import { secret } from "../src/backend.ts"\nexport { secret }\n',
|
|
103
103
|
)
|
|
104
104
|
await expect(failure).rejects.toThrow(/Backend boundary/)
|
|
105
|
-
await expect(failure).rejects.toThrow(
|
|
106
|
-
|
|
105
|
+
await expect(failure).rejects.toThrow(
|
|
106
|
+
normalizePath(join(frontend, 'entry.ts')),
|
|
107
|
+
)
|
|
108
|
+
await expect(failure).rejects.toThrow(normalizePath(backendFile()))
|
|
107
109
|
})
|
|
108
110
|
|
|
109
111
|
it('fails on a file deeper under the backend source', async () => {
|
|
@@ -82,14 +82,14 @@ for (const load of Object.values(own))
|
|
|
82
82
|
// The DMS's and Nuxt UI's components the module's templates use: each renders
|
|
83
83
|
// its default slot, its props as attributes.
|
|
84
84
|
const UI_COMPONENTS = [
|
|
85
|
-
'
|
|
85
|
+
'DmsCardPanel',
|
|
86
86
|
'DmsCopyButton',
|
|
87
87
|
'DmsEmptyState',
|
|
88
|
-
'
|
|
88
|
+
'DmsEyebrowLabel',
|
|
89
89
|
'DmsFieldRow',
|
|
90
90
|
'DmsIconWell',
|
|
91
|
+
'DmsInputTextarea',
|
|
91
92
|
'DmsSaveStatus',
|
|
92
|
-
'DmsTextarea',
|
|
93
93
|
'UBadge',
|
|
94
94
|
'UButton',
|
|
95
95
|
'UFormField',
|
|
@@ -25,3 +25,8 @@ it('registers every block under the DmsMedia prefix by its file name', async ()
|
|
|
25
25
|
}
|
|
26
26
|
expect(new Set(names).size).toBe(names.length)
|
|
27
27
|
})
|
|
28
|
+
|
|
29
|
+
it('names the explorer block by the name the DMS serves it under', async () => {
|
|
30
|
+
const { default: Explorer } = await import('../app/components/Explorer.vue')
|
|
31
|
+
expect(Explorer.name).toBe(`${frontendModule.componentPrefix}Explorer`)
|
|
32
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-media",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Media library for the AntelopeJS DMS: uploads, folders with per-folder permissions, image sizes and light editing, with a Finder-style explorer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -61,24 +61,24 @@
|
|
|
61
61
|
"test:playground": "[ -n \"$DMS_PREBUILT\" ] || pnpm run build && pnpm --dir playground install --frozen-lockfile --ignore-workspace && pnpm --dir playground build"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@antelopejs/interface-api": ">=0.3.
|
|
65
|
-
"@antelopejs/interface-api-util": ">=0.3.
|
|
66
|
-
"@antelopejs/interface-core": ">=0.
|
|
67
|
-
"@antelopejs/interface-database": ">=0.
|
|
68
|
-
"@antelopejs/interface-database-decorators": ">=0.2
|
|
69
|
-
"@antelopejs/interface-dms": ">=0.
|
|
70
|
-
"@antelopejs/interface-dms-media": ">=0.
|
|
71
|
-
"@antelopejs/interface-file-storage": ">=0.1.
|
|
64
|
+
"@antelopejs/interface-api": ">=0.3.3 <0.4.0",
|
|
65
|
+
"@antelopejs/interface-api-util": ">=0.3.2 <0.4.0",
|
|
66
|
+
"@antelopejs/interface-core": ">=0.5.1 <0.6.0",
|
|
67
|
+
"@antelopejs/interface-database": ">=0.4.0 <0.5.0",
|
|
68
|
+
"@antelopejs/interface-database-decorators": ">=0.5.2 <0.6.0",
|
|
69
|
+
"@antelopejs/interface-dms": ">=0.14.0 <0.15.0",
|
|
70
|
+
"@antelopejs/interface-dms-media": ">=0.4.0 <0.5.0",
|
|
71
|
+
"@antelopejs/interface-file-storage": ">=0.1.8 <0.2.0",
|
|
72
72
|
"node-cron": "^4.2.1",
|
|
73
73
|
"sharp": "^0.34.4",
|
|
74
|
-
"zod": "
|
|
74
|
+
"zod": "^3.24.2"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@antelopejs/core": "
|
|
78
|
-
"@antelopejs/dms": ">=0.
|
|
79
|
-
"@antelopejs/dms-frontend": "0.
|
|
80
|
-
"@antelopejs/interface-data-api": ">=0.
|
|
81
|
-
"@antelopejs/tooling-configs": "^0.
|
|
77
|
+
"@antelopejs/core": "~1.23.2",
|
|
78
|
+
"@antelopejs/dms": ">=0.20.0 <0.21.0",
|
|
79
|
+
"@antelopejs/dms-frontend": ">=0.11.1 <0.12.0",
|
|
80
|
+
"@antelopejs/interface-data-api": ">=0.8.0 <0.9.0",
|
|
81
|
+
"@antelopejs/tooling-configs": "^0.7.1",
|
|
82
82
|
"@types/chai": "^4.3.20",
|
|
83
83
|
"@types/mocha": "^10",
|
|
84
84
|
"@types/node": "^24.0.0",
|
package/src/acl/entries.ts
CHANGED
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import { Logging } from "@antelopejs/interface-core/logging";
|
|
2
2
|
import type { MediaFolder } from "../db/tables";
|
|
3
|
-
import
|
|
3
|
+
import { isObject, isString } from "../guards";
|
|
4
|
+
import type { AclEntry, AclRight, AclSubject } from "../types";
|
|
5
|
+
|
|
6
|
+
function isAclRight(value: unknown): value is AclRight {
|
|
7
|
+
return value === "read" || value === "write" || value === "manage";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function isAclSubject(value: unknown): value is AclSubject {
|
|
11
|
+
return (
|
|
12
|
+
isObject(value) &&
|
|
13
|
+
"kind" in value &&
|
|
14
|
+
(value.kind === "permission" || value.kind === "role") &&
|
|
15
|
+
"id" in value &&
|
|
16
|
+
isString(value.id)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isAclEntry(value: unknown): value is AclEntry {
|
|
21
|
+
return (
|
|
22
|
+
isObject(value) &&
|
|
23
|
+
"subject" in value &&
|
|
24
|
+
isAclSubject(value.subject) &&
|
|
25
|
+
"rights" in value &&
|
|
26
|
+
Array.isArray(value.rights) &&
|
|
27
|
+
value.rights.every(isAclRight)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
4
30
|
|
|
5
31
|
/**
|
|
6
32
|
* Fails closed: an unreadable stored ACL grants nothing instead of inheriting.
|
|
7
|
-
* A stored ACL that is not JSON
|
|
8
|
-
* logged, then read as empty.
|
|
33
|
+
* A stored ACL that is not JSON, not an array, or holds an entry that is not
|
|
34
|
+
* an ACL entry is logged, then read as empty.
|
|
9
35
|
*/
|
|
10
36
|
export function parseFolderAcl(folder: MediaFolder): AclEntry[] | undefined {
|
|
11
37
|
if (!folder.json_acl) return undefined;
|
|
12
38
|
try {
|
|
13
39
|
const parsed: unknown = JSON.parse(folder.json_acl);
|
|
14
|
-
if (Array.isArray(parsed))
|
|
15
|
-
// SAFETY: json_acl is written only as serializeAcl of an AclEntry[] (bindings.ts, declared/folders.ts) or as the literal "[]" (bindings.ts EMPTY_ACL), so an array read back holds AclEntry values; a schema parse of a stored row on read is excluded by ruling.
|
|
16
|
-
return parsed as AclEntry[];
|
|
17
|
-
}
|
|
40
|
+
if (Array.isArray(parsed) && parsed.every(isAclEntry)) return parsed;
|
|
18
41
|
} catch {}
|
|
19
42
|
Logging.Warn(
|
|
20
43
|
`Media folder '${folder._id}' has an unreadable ACL; treating it as empty.`,
|
package/src/asset-lifecycle.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
MediaAssetModel,
|
|
5
5
|
type MediaMutationOptions,
|
|
6
6
|
} from "./db";
|
|
7
|
+
import { isString } from "./guards";
|
|
7
8
|
import { collectAssetStorageKeys } from "./routes/media/storage-keys";
|
|
8
9
|
|
|
9
10
|
/** Bookkeeping write (derivatives, file queue) that leaves `updatedAt` alone. */
|
|
@@ -11,8 +12,11 @@ export const TECHNICAL_MUTATION: MediaMutationOptions = { touchesAsset: false };
|
|
|
11
12
|
|
|
12
13
|
/** Reads the durable, retryable file deletion queue for an asset. */
|
|
13
14
|
export function retiredFiles(asset: MediaAsset): string[] {
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const parsed: unknown = JSON.parse(asset.json_retiredFiles);
|
|
16
|
+
if (Array.isArray(parsed) && parsed.every(isString)) return parsed;
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Media asset '${asset._id}' has a file deletion queue that is not a list of storage keys`,
|
|
19
|
+
);
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
/** Detaches references and records their cleanup in the same media transition. */
|
package/src/bindings.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { IsDuplicateKeyError } from "@antelopejs/interface-database";
|
|
2
3
|
import { GetPermissionId } from "@antelopejs/interface-dms/page";
|
|
3
4
|
import type { AssetBindingConfig } from "@antelopejs/interface-dms-media";
|
|
4
5
|
import { serializeAcl } from "./acl";
|
|
5
6
|
import type { MediaFolder, MediaFolderModel } from "./db";
|
|
7
|
+
import { fixedId } from "./fixed-id";
|
|
6
8
|
import type { AclEntry } from "./types";
|
|
7
9
|
|
|
8
10
|
export const CONTENT_ROOT_BINDING = "dms-media.content-root";
|
|
@@ -101,37 +103,39 @@ export function buildBindingAcl(config: AssetBindingConfig): AclEntry[] {
|
|
|
101
103
|
];
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
/**
|
|
107
|
+
* The id of the folder linked to `binding` in a tenant, the content root
|
|
108
|
+
* included, the same in every process: two processes provisioning one tenant
|
|
109
|
+
* at once write one folder instead of two.
|
|
110
|
+
*/
|
|
111
|
+
export function bindingFolderId(tenantId: string, binding: string): string {
|
|
112
|
+
return fixedId("dms-media:binding-folder", tenantId, binding);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Inserts `folder` under its fixed id. False when another process inserted it first. */
|
|
116
|
+
async function insertOnce(
|
|
105
117
|
folderModel: MediaFolderModel,
|
|
106
|
-
|
|
107
|
-
): Promise<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
visibility: "private",
|
|
116
|
-
});
|
|
117
|
-
return id;
|
|
118
|
+
folder: Parameters<MediaFolderModel["insert"]>[0],
|
|
119
|
+
): Promise<boolean> {
|
|
120
|
+
try {
|
|
121
|
+
await folderModel.insert(folder);
|
|
122
|
+
return true;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (!IsDuplicateKeyError(error)) throw error;
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
async function ensureBindingFolder(
|
|
130
|
+
tenantId: string,
|
|
121
131
|
folderModel: MediaFolderModel,
|
|
122
|
-
foldersByBinding: Map<string, MediaFolder>,
|
|
123
132
|
contentRootId: string,
|
|
124
133
|
config: AssetBindingConfig,
|
|
125
134
|
): Promise<void> {
|
|
135
|
+
const id = bindingFolderId(tenantId, config.id);
|
|
126
136
|
const acl = serializeAcl(buildBindingAcl(config)) ?? EMPTY_ACL;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
if (existing.json_acl !== acl) {
|
|
130
|
-
await folderModel.update(existing._id, { json_acl: acl });
|
|
131
|
-
}
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
await folderModel.insert({
|
|
137
|
+
const inserted = await insertOnce(folderModel, {
|
|
138
|
+
_id: id,
|
|
135
139
|
name: config.folderName ?? config.id,
|
|
136
140
|
parentId: contentRootId,
|
|
137
141
|
path: [contentRootId],
|
|
@@ -139,6 +143,11 @@ async function ensureBindingFolder(
|
|
|
139
143
|
json_acl: acl,
|
|
140
144
|
visibility: "private",
|
|
141
145
|
});
|
|
146
|
+
if (inserted) return;
|
|
147
|
+
const existing = await folderModel.get(id);
|
|
148
|
+
if (existing && existing.json_acl !== acl) {
|
|
149
|
+
await folderModel.update(id, { json_acl: acl });
|
|
150
|
+
}
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
async function provisionTenant(
|
|
@@ -147,23 +156,17 @@ async function provisionTenant(
|
|
|
147
156
|
fingerprint: string,
|
|
148
157
|
): Promise<void> {
|
|
149
158
|
if (registeredBindings.size > 0) {
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
);
|
|
159
|
+
const contentRootId = bindingFolderId(tenantId, CONTENT_ROOT_BINDING);
|
|
160
|
+
await insertOnce(folderModel, {
|
|
161
|
+
_id: contentRootId,
|
|
162
|
+
name: CONTENT_ROOT_NAME,
|
|
163
|
+
path: [],
|
|
164
|
+
binding: CONTENT_ROOT_BINDING,
|
|
165
|
+
json_acl: EMPTY_ACL,
|
|
166
|
+
visibility: "private",
|
|
167
|
+
});
|
|
160
168
|
for (const config of registeredBindings.values()) {
|
|
161
|
-
await ensureBindingFolder(
|
|
162
|
-
folderModel,
|
|
163
|
-
foldersByBinding,
|
|
164
|
-
contentRootId,
|
|
165
|
-
config,
|
|
166
|
-
);
|
|
169
|
+
await ensureBindingFolder(tenantId, folderModel, contentRootId, config);
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
provisionedTenants.set(tenantId, fingerprint);
|