@antelopejs/interface-dms-media 0.2.1 → 0.3.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 +68 -35
- package/dist/bindings.d.ts +1 -4
- package/dist/bindings.js +3 -8
- package/dist/bindings.js.map +1 -1
- package/dist/content.d.ts +64 -0
- package/dist/content.js +20 -0
- package/dist/content.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +10 -0
- package/dist/internal.js +13 -0
- package/dist/internal.js.map +1 -0
- package/docs/1.index.md +307 -0
- package/docs/tsconfig.json +10 -0
- package/package.json +15 -9
package/README.md
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# @antelopejs/interface-dms-media
|
|
2
4
|
|
|
3
|
-
<
|
|
4
|
-
<a href="
|
|
5
|
-
<a href="
|
|
6
|
-
<a href="https://
|
|
7
|
-
|
|
5
|
+
<a href="https://www.npmjs.com/package/@antelopejs/interface-dms-media"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-dms-media?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-dms-media?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
7
|
+
<a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
|
|
8
|
+
<a href="https://dms.antelopejs.com/docs/modules/media/extending"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
9
|
+
|
|
10
|
+
The AntelopeJS interface to add media library fields, and the folders bound to them, to DMS pages, and to ship library folders and files as code.
|
|
11
|
+
|
|
8
12
|
</div>
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
- Adds an `AssetType` form field that references library assets by id (one id, or an array with `multiple`) and opens the library as a picker.
|
|
17
|
+
- Binds a field to a folder provisioned under the `Content` root of each tenant: `RegisterAssetBinding` and `UnregisterAssetBinding`, or `new AssetType({ binding })`.
|
|
18
|
+
- Derives the folder's rights from a page (`permissionsFromPage`), a `permissionMapping` or an explicit `acl`.
|
|
19
|
+
- Replays bindings to every new generation of the implementation, so either side can hot reload.
|
|
20
|
+
- Ships folders and files from backend code with `EnsureMediaFolder` and `ImportMediaAsset`: idempotent per key, they never undo what members changed since. `RetireMediaDeclaration` and `PruneMediaDeclarations` take back what the code stopped declaring, unless members changed it.
|
|
21
|
+
- Keeps your module independent of the implementation, [`@antelopejs/dms-media`](https://www.npmjs.com/package/@antelopejs/dms-media).
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
`antelopeJs.implements`).
|
|
15
|
-
- **Consumed by** modules that declare `AssetType` fields on their DMS pages.
|
|
16
|
-
Declare this package in `dependencies`.
|
|
23
|
+
## Install
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
Add the interface to the `dependencies` of the module that declares asset fields:
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `RegisterAssetBinding(config)` / `UnregisterAssetBinding(id)` — declare or
|
|
24
|
-
withdraw a folder binding. `new AssetType({ binding })` registers its binding
|
|
25
|
-
itself. The implementer provisions the bound folder under the `Content` root
|
|
26
|
-
of each tenant, with an ACL derived from `permissionMapping`,
|
|
27
|
-
`permissionsFromPage` or an explicit `acl`.
|
|
28
|
-
- Types: `AssetTypeOptions`, `AssetPickerComponentOptions`,
|
|
29
|
-
`AssetBindingConfig`, `AssetPermissionMapping`, `AclEntry`, `AclSubject`,
|
|
30
|
-
`AclSubjectKind`, `AclRight`.
|
|
27
|
+
```bash
|
|
28
|
+
pnpm add @antelopejs/interface-dms-media
|
|
29
|
+
```
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
when that module is destroyed and replayed to every new generation of the
|
|
34
|
-
implementer, so either side can hot reload without losing it.
|
|
31
|
+
## Quick start
|
|
35
32
|
|
|
36
33
|
```ts
|
|
37
34
|
import { AssetType } from "@antelopejs/interface-dms-media";
|
|
@@ -46,15 +43,51 @@ new AssetType({
|
|
|
46
43
|
});
|
|
47
44
|
```
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
Ship a folder and a file for an explicitly selected tenant. This example intentionally selects the default tenant; for SaaS use the trusted tenant from your application's durable `created` consumer, not a process-global implicit fallback:
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
```ts
|
|
49
|
+
import { EnsureMediaFolder, ImportMediaAsset } from "@antelopejs/interface-dms-media";
|
|
50
|
+
import { DEFAULT_TENANT_ID } from "@antelopejs/interface-dms/constants";
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
const tenantId = DEFAULT_TENANT_ID;
|
|
53
|
+
await EnsureMediaFolder({ tenantId, key: "helio.procedures", name: "Procedures" });
|
|
54
|
+
await ImportMediaAsset({
|
|
55
|
+
tenantId,
|
|
56
|
+
key: "helio.procedures.roof",
|
|
57
|
+
folder: { key: "helio.procedures" },
|
|
58
|
+
name: "Roof safety checklist.pdf",
|
|
59
|
+
mimetype: "application/pdf",
|
|
60
|
+
source: { filePath: "/srv/content/roof-safety-checklist.pdf" },
|
|
61
|
+
});
|
|
60
62
|
```
|
|
63
|
+
|
|
64
|
+
Both declarations require `tenantId` in TypeScript and reject missing, empty or whitespace-only values at runtime before writes. Existing users of these new APIs must pass it explicitly; older media APIs are unchanged. A tenant id does not establish authorization or completed provisioning. See the [application-owned lifecycle and backfill guidance](./docs/1.index.md#new-saas-tenants-application-owned-durable-lifecycle) for at-least-once delivery, durable receipts and deployment refreshes.
|
|
65
|
+
|
|
66
|
+
The interface also exports the option, declaration and ACL types: `AssetTypeOptions`, `AssetPickerComponentOptions`, `AssetBindingConfig`, `AssetPermissionMapping`, `MediaFolderDeclaration`, `MediaAssetDeclaration`, `MediaFolderTarget`, `MediaAssetSource`, `MediaLazySource`, `MediaDeclarationResult`, `MediaDeclarationStatus`, `MediaContentKind`, `MediaDeclarationRetirement`, `MediaDeclarationPrune`, `MediaRetirementResult`, `MediaRetirementStatus`, `AclEntry`, `AclSubject`, `AclSubjectKind` and `AclRight`.
|
|
67
|
+
|
|
68
|
+
## Compatibility
|
|
69
|
+
|
|
70
|
+
The implementation is `@antelopejs/dms-media >=0.4.0`; `EnsureMediaFolder` and `ImportMediaAsset` need the first `@antelopejs/dms-media` release built on this interface's 0.3 line. The interface declares these peer dependencies:
|
|
71
|
+
|
|
72
|
+
<!-- docs-compat: ./package.json#peerDependencies -->
|
|
73
|
+
|
|
74
|
+
| Package | Range |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `@antelopejs/interface-api` | `>=0.0.15 <1.0.0` |
|
|
77
|
+
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
|
|
78
|
+
| `@antelopejs/interface-dms` | `>=0.7.2 <1.0.0` |
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
- [Consumer reference](./docs/1.index.md): field types, bindings, lifecycle, declared content and permission precedence
|
|
83
|
+
- [Extending the media module](https://dms.antelopejs.com/docs/modules/media/extending): asset fields, folder bindings, the HTTP API and delivery URLs
|
|
84
|
+
- [The asset field](https://dms.antelopejs.com/docs/modules/media/usage/asset-field)
|
|
85
|
+
- [Media module guide](https://dms.antelopejs.com/docs/modules/media)
|
|
86
|
+
|
|
87
|
+
## Contributing
|
|
88
|
+
|
|
89
|
+
This package lives in the [`AntelopeJS/dms-media`](https://github.com/AntelopeJS/dms-media) pnpm workspace, next to the module that implements it. Read [CONTRIBUTING.md](https://github.com/AntelopeJS/dms-media/blob/main/CONTRIBUTING.md) and the [repository README](https://github.com/AntelopeJS/dms-media#contributing) for the development commands; `pnpm check:exports` checks, after a build, that the exports map matches `dist`. Release this package before the module that implements it.
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
[Apache-2.0](./LICENSE)
|
package/dist/bindings.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ControllerClass } from "@antelopejs/interface-api";
|
|
2
|
-
import { RegisteringProxy } from "@antelopejs/interface-core";
|
|
3
2
|
import type { AclEntry } from "./acl";
|
|
4
3
|
export interface AssetPermissionMapping {
|
|
5
4
|
read?: string[];
|
|
@@ -16,10 +15,8 @@ export interface AssetBindingConfig {
|
|
|
16
15
|
permissionMapping?: AssetPermissionMapping;
|
|
17
16
|
permissionsFromPage?: ControllerClass;
|
|
18
17
|
acl?: AclEntry[];
|
|
18
|
+
subfolders?: boolean;
|
|
19
19
|
field?: AssetBindingField;
|
|
20
20
|
}
|
|
21
|
-
export declare namespace internal {
|
|
22
|
-
const RegisterAssetBinding: RegisteringProxy<(id: string, config: AssetBindingConfig) => void>;
|
|
23
|
-
}
|
|
24
21
|
export declare function RegisterAssetBinding(config: AssetBindingConfig): void;
|
|
25
22
|
export declare function UnregisterAssetBinding(id: string): void;
|
package/dist/bindings.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.internal = void 0;
|
|
4
3
|
exports.RegisterAssetBinding = RegisterAssetBinding;
|
|
5
4
|
exports.UnregisterAssetBinding = UnregisterAssetBinding;
|
|
6
|
-
const
|
|
7
|
-
var internal;
|
|
8
|
-
(function (internal) {
|
|
9
|
-
internal.RegisterAssetBinding = new interface_core_1.RegisteringProxy();
|
|
10
|
-
})(internal || (exports.internal = internal = {}));
|
|
5
|
+
const internal_1 = require("./internal");
|
|
11
6
|
function RegisterAssetBinding(config) {
|
|
12
|
-
internal.RegisterAssetBinding.register(config.id, config);
|
|
7
|
+
internal_1.internal.RegisterAssetBinding.register(config.id, config);
|
|
13
8
|
}
|
|
14
9
|
function UnregisterAssetBinding(id) {
|
|
15
|
-
internal.RegisterAssetBinding.unregister(id);
|
|
10
|
+
internal_1.internal.RegisterAssetBinding.unregister(id);
|
|
16
11
|
}
|
|
17
12
|
//# sourceMappingURL=bindings.js.map
|
package/dist/bindings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":";;AAoDA,oDAEC;AAGD,wDAEC;AAzDD,yCAAsC;AAkDtC,SAAgB,oBAAoB,CAAC,MAA0B;IAC7D,mBAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC;AAGD,SAAgB,sBAAsB,CAAC,EAAU;IAC/C,mBAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AclEntry } from "./acl";
|
|
2
|
+
export type MediaFolderVisibility = "private" | "public";
|
|
3
|
+
export interface MediaFolderDeclaration {
|
|
4
|
+
key: string;
|
|
5
|
+
name: string;
|
|
6
|
+
parent?: string | MediaFolderTarget;
|
|
7
|
+
visibility?: MediaFolderVisibility;
|
|
8
|
+
acl?: AclEntry[];
|
|
9
|
+
tenantId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DeclaredFolderTarget {
|
|
12
|
+
key: string;
|
|
13
|
+
}
|
|
14
|
+
export interface BoundFolderTarget {
|
|
15
|
+
binding: string;
|
|
16
|
+
}
|
|
17
|
+
export type MediaFolderTarget = DeclaredFolderTarget | BoundFolderTarget;
|
|
18
|
+
export interface MediaBytesSource {
|
|
19
|
+
bytes: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
export interface MediaFileSource {
|
|
22
|
+
filePath: string;
|
|
23
|
+
}
|
|
24
|
+
export interface MediaLazySource {
|
|
25
|
+
load: () => Uint8Array | Promise<Uint8Array>;
|
|
26
|
+
}
|
|
27
|
+
export type MediaAssetSource = MediaBytesSource | MediaFileSource | MediaLazySource;
|
|
28
|
+
export interface MediaAssetDeclaration {
|
|
29
|
+
key: string;
|
|
30
|
+
folder: MediaFolderTarget;
|
|
31
|
+
name: string;
|
|
32
|
+
mimetype: string;
|
|
33
|
+
source: MediaAssetSource;
|
|
34
|
+
version?: string;
|
|
35
|
+
alt?: string;
|
|
36
|
+
tenantId: string;
|
|
37
|
+
}
|
|
38
|
+
export type MediaDeclarationStatus = "created" | "updated" | "unchanged" | "preserved" | "deleted";
|
|
39
|
+
export interface MediaDeclarationResult {
|
|
40
|
+
status: MediaDeclarationStatus;
|
|
41
|
+
id?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function EnsureMediaFolder(declaration: MediaFolderDeclaration): Promise<MediaDeclarationResult>;
|
|
44
|
+
export declare function ImportMediaAsset(declaration: MediaAssetDeclaration): Promise<MediaDeclarationResult>;
|
|
45
|
+
export type MediaContentKind = "folder" | "asset";
|
|
46
|
+
export interface MediaDeclarationRetirement {
|
|
47
|
+
kind: MediaContentKind;
|
|
48
|
+
key: string;
|
|
49
|
+
tenantId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MediaDeclarationPrune {
|
|
52
|
+
prefix: string;
|
|
53
|
+
keep: string[];
|
|
54
|
+
tenantId: string;
|
|
55
|
+
}
|
|
56
|
+
export type MediaRetirementStatus = "removed" | "preserved" | "deleted" | "unknown";
|
|
57
|
+
export interface MediaRetirementResult {
|
|
58
|
+
kind: MediaContentKind;
|
|
59
|
+
key: string;
|
|
60
|
+
status: MediaRetirementStatus;
|
|
61
|
+
id?: string;
|
|
62
|
+
}
|
|
63
|
+
export declare function RetireMediaDeclaration(retirement: MediaDeclarationRetirement): Promise<MediaRetirementResult>;
|
|
64
|
+
export declare function PruneMediaDeclarations(prune: MediaDeclarationPrune): Promise<MediaRetirementResult[]>;
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnsureMediaFolder = EnsureMediaFolder;
|
|
4
|
+
exports.ImportMediaAsset = ImportMediaAsset;
|
|
5
|
+
exports.RetireMediaDeclaration = RetireMediaDeclaration;
|
|
6
|
+
exports.PruneMediaDeclarations = PruneMediaDeclarations;
|
|
7
|
+
const internal_1 = require("./internal");
|
|
8
|
+
function EnsureMediaFolder(declaration) {
|
|
9
|
+
return internal_1.internal.EnsureMediaFolder(declaration);
|
|
10
|
+
}
|
|
11
|
+
function ImportMediaAsset(declaration) {
|
|
12
|
+
return internal_1.internal.ImportMediaAsset(declaration);
|
|
13
|
+
}
|
|
14
|
+
function RetireMediaDeclaration(retirement) {
|
|
15
|
+
return internal_1.internal.RetireMediaDeclaration(retirement);
|
|
16
|
+
}
|
|
17
|
+
function PruneMediaDeclarations(prune) {
|
|
18
|
+
return internal_1.internal.PruneMediaDeclarations(prune);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":";;AA2HA,8CAIC;AAkBD,4CAIC;AA+DD,wDAIC;AASD,wDAIC;AApOD,yCAAsC;AA0HtC,SAAgB,iBAAiB,CAC/B,WAAmC;IAEnC,OAAO,mBAAQ,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;AACjD,CAAC;AAkBD,SAAgB,gBAAgB,CAC9B,WAAkC;IAElC,OAAO,mBAAQ,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAChD,CAAC;AA+DD,SAAgB,sBAAsB,CACpC,UAAsC;IAEtC,OAAO,mBAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;AACrD,CAAC;AASD,SAAgB,sBAAsB,CACpC,KAA4B;IAE5B,OAAO,mBAAQ,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,4 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./acl"), exports);
|
|
18
18
|
__exportStar(require("./asset-type"), exports);
|
|
19
19
|
__exportStar(require("./bindings"), exports);
|
|
20
|
+
__exportStar(require("./content"), exports);
|
|
21
|
+
__exportStar(require("./internal"), exports);
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,+CAA6B;AAC7B,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RegisteringProxy } from "@antelopejs/interface-core";
|
|
2
|
+
import type { AssetBindingConfig } from "./bindings";
|
|
3
|
+
import type { MediaAssetDeclaration, MediaDeclarationPrune, MediaDeclarationResult, MediaDeclarationRetirement, MediaFolderDeclaration, MediaRetirementResult } from "./content";
|
|
4
|
+
export declare namespace internal {
|
|
5
|
+
const RegisterAssetBinding: RegisteringProxy<(id: string, config: AssetBindingConfig) => void>;
|
|
6
|
+
const EnsureMediaFolder: (declaration: MediaFolderDeclaration) => Promise<MediaDeclarationResult>;
|
|
7
|
+
const ImportMediaAsset: (declaration: MediaAssetDeclaration) => Promise<MediaDeclarationResult>;
|
|
8
|
+
const RetireMediaDeclaration: (retirement: MediaDeclarationRetirement) => Promise<MediaRetirementResult>;
|
|
9
|
+
const PruneMediaDeclarations: (prune: MediaDeclarationPrune) => Promise<MediaRetirementResult[]>;
|
|
10
|
+
}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.internal = void 0;
|
|
4
|
+
const interface_core_1 = require("@antelopejs/interface-core");
|
|
5
|
+
var internal;
|
|
6
|
+
(function (internal) {
|
|
7
|
+
internal.RegisterAssetBinding = new interface_core_1.RegisteringProxy();
|
|
8
|
+
internal.EnsureMediaFolder = (0, interface_core_1.InterfaceFunction)();
|
|
9
|
+
internal.ImportMediaAsset = (0, interface_core_1.InterfaceFunction)();
|
|
10
|
+
internal.RetireMediaDeclaration = (0, interface_core_1.InterfaceFunction)();
|
|
11
|
+
internal.PruneMediaDeclarations = (0, interface_core_1.InterfaceFunction)();
|
|
12
|
+
})(internal || (exports.internal = internal = {}));
|
|
13
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;AAAA,+DAGoC;AAcpC,IAAiB,QAAQ,CAoBxB;AApBD,WAAiB,QAAQ;IACV,6BAAoB,GAAG,IAAI,iCAAgB,EAErD,CAAC;IACS,0BAAiB,GAC5B,IAAA,kCAAiB,GAEd,CAAC;IACO,yBAAgB,GAC3B,IAAA,kCAAiB,GAEd,CAAC;IACO,+BAAsB,GACjC,IAAA,kCAAiB,GAEd,CAAC;IACO,+BAAsB,GACjC,IAAA,kCAAiB,GAEd,CAAC;AACR,CAAC,EApBgB,QAAQ,wBAAR,QAAQ,QAoBxB"}
|
package/docs/1.index.md
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Media interface
|
|
3
|
+
description: Asset fields, folder binding lifecycle, declared content and permission contracts for DMS consumers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Media interface
|
|
7
|
+
|
|
8
|
+
`@antelopejs/interface-dms-media` exports the asset field and folder binding declarations, and the functions that ship library folders and files as code. Load the Media runtime for the picker, uploads and provisioning. HTTP routes and delivery URLs remain in the [runtime guide](/docs/modules/media/extending#http-surface).
|
|
9
|
+
|
|
10
|
+
## AssetType
|
|
11
|
+
|
|
12
|
+
```ts [Contract]
|
|
13
|
+
import type { AssetBindingConfig } from "@antelopejs/interface-dms-media";
|
|
14
|
+
|
|
15
|
+
interface AssetTypeOptions extends Record<string, unknown> {
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
max?: number;
|
|
18
|
+
mimetypes?: string[];
|
|
19
|
+
binding?: AssetBindingConfig;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface AssetPickerComponentOptions {
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
max?: number;
|
|
25
|
+
mimetypes?: string[];
|
|
26
|
+
bindingId?: string;
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`new AssetType(options?: AssetTypeOptions)` returns a DMS `DataType`. With default options, validation accepts one nonempty asset-ID string. `multiple: true` accepts an array of nonempty strings, including an empty array; `max` caps its length only in multiple mode. `getValidation()` returns a Zod schema: it validates that shape, not asset existence, ownership or MIME type.
|
|
31
|
+
|
|
32
|
+
`mimetypes` limits the picker to types such as `image/*` or `application/pdf`. Bound-folder uploads also enforce the binding's MIME types server-side, alongside the runtime upload policy. Do not treat the form schema or client-side filtering as an authorization check.
|
|
33
|
+
|
|
34
|
+
Constructing a field with `binding` registers that binding and fills its `field` metadata from `multiple`, `max` and `mimetypes`. The picker receives `AssetPickerComponentOptions` with the binding's ID, not its ACL. The exported constants are `ASSET_DATA_TYPE_ID = "asset"` and `ASSET_PICKER_COMPONENT = "dms-media-asset-picker"`; importing the field module registers the data type.
|
|
35
|
+
|
|
36
|
+
## RegisterAssetBinding and UnregisterAssetBinding
|
|
37
|
+
|
|
38
|
+
```ts [Contract]
|
|
39
|
+
import type { ControllerClass } from "@antelopejs/interface-api";
|
|
40
|
+
|
|
41
|
+
type AclRight = "read" | "write" | "manage";
|
|
42
|
+
type AclSubjectKind = "permission" | "role";
|
|
43
|
+
interface AclSubject { kind: AclSubjectKind; id: string; }
|
|
44
|
+
interface AclEntry { subject: AclSubject; rights: AclRight[]; }
|
|
45
|
+
|
|
46
|
+
interface AssetPermissionMapping {
|
|
47
|
+
read?: string[];
|
|
48
|
+
write?: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AssetBindingField {
|
|
52
|
+
multiple?: boolean;
|
|
53
|
+
max?: number;
|
|
54
|
+
mimetypes?: string[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface AssetBindingConfig {
|
|
58
|
+
id: string;
|
|
59
|
+
folderName?: string;
|
|
60
|
+
permissionMapping?: AssetPermissionMapping;
|
|
61
|
+
permissionsFromPage?: ControllerClass;
|
|
62
|
+
acl?: AclEntry[];
|
|
63
|
+
subfolders?: boolean;
|
|
64
|
+
field?: AssetBindingField;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
declare function RegisterAssetBinding(config: AssetBindingConfig): void;
|
|
68
|
+
declare function UnregisterAssetBinding(id: string): void;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
All these types and functions are available from the package root. The exported `internal` proxy namespace is not a consumer API.
|
|
72
|
+
|
|
73
|
+
Use a stable, namespaced ID such as `articles.cover`. Registrations are keyed by ID, so reusing an ID replaces its declaration rather than creating an independent binding. Registration returns synchronously; it does not await folder creation. The calling module owns the registration: unloading it releases the declaration, and reloading the implementation replays active registrations.
|
|
74
|
+
|
|
75
|
+
The runtime provisions each tenant separately, under a private `Content` root. A new folder uses `folderName ?? id`; an existing bound folder retains its name and gets the current ACL. `UnregisterAssetBinding` removes the declaration but leaves provisioned folders and files in place.
|
|
76
|
+
|
|
77
|
+
A bound folder is locked: it cannot be renamed, moved, deleted or re-permissioned, and by default it holds no subfolders. `subfolders: true` lets it hold them, for a layout per record such as one folder per project under the field's folder. Owners then create subfolders in the library, and backend code declares them with `EnsureMediaFolder({ parent: { binding } })`; the bound folder itself stays locked. A subfolder inherits the bound folder's ACL unless it has its own, and accepts only the types the field accepts, like the bound folder. The field's picker opens on the bound folder and browses its subfolders; its upload button still targets the bound folder. Neither function returns an upload result or a provisioning error; provisioning/storage failures occur when runtime operations ensure the tenant's folders.
|
|
78
|
+
|
|
79
|
+
## Permission precedence and tenant access
|
|
80
|
+
|
|
81
|
+
1. An explicit `acl`, including `[]`, replaces all derived entries.
|
|
82
|
+
2. Otherwise, `permissionMapping.read` and `.write` take precedence independently over the page-derived permission. An explicit empty array disables fallback for that right.
|
|
83
|
+
3. Missing mappings fall back to the effective permission of `permissionsFromPage`, resolved lazily at provisioning time so a field can reference its enclosing page class.
|
|
84
|
+
|
|
85
|
+
ACL rights imply weaker rights: `manage` ⇒ `write` ⇒ `read`. A role must explicitly grant the page permission; `memberAccess` or `publicAccess` alone does not grant a folder right. The runtime's Media administration pages remain owner-only. Members reach accessible files through asset fields on project pages, not by receiving a Media page permission.
|
|
86
|
+
|
|
87
|
+
Owners hold every folder right. Uploading and changing files require folder `write`; folder structure changes require `manage`. File and folder visibility changes stay owner-only. A writable linked folder lets a member modify its files regardless of who uploaded them. The default root ACL grants no member access; configure `rootAcl` deliberately because its grants can open the rest of the library.
|
|
88
|
+
|
|
89
|
+
## Declare a field
|
|
90
|
+
|
|
91
|
+
This field stores up to four asset IDs and registers a tenant-local upload folder. The permission IDs are application-defined and must be granted by the project's role configuration.
|
|
92
|
+
|
|
93
|
+
```ts docs-check
|
|
94
|
+
import { AssetType } from "@antelopejs/interface-dms-media";
|
|
95
|
+
|
|
96
|
+
export const articleImages = new AssetType({
|
|
97
|
+
multiple: true,
|
|
98
|
+
max: 4,
|
|
99
|
+
mimetypes: ["image/*"],
|
|
100
|
+
binding: {
|
|
101
|
+
id: "articles.images",
|
|
102
|
+
folderName: "Article images",
|
|
103
|
+
permissionMapping: {
|
|
104
|
+
read: ["articles.page"],
|
|
105
|
+
write: ["articles.page.table.edit"],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## EnsureMediaFolder and ImportMediaAsset
|
|
112
|
+
|
|
113
|
+
A project ships media content (templates, procedures, demo pictures) from its backend code with these two functions. The Media runtime creates the content itself: it validates it with the dashboard's rules, writes the bytes to its configured file storage, computes image dimensions and records the creation in the library activity. Never write the runtime's tables yourself.
|
|
114
|
+
|
|
115
|
+
```ts [Contract]
|
|
116
|
+
import type { AclEntry } from "@antelopejs/interface-dms-media";
|
|
117
|
+
|
|
118
|
+
type MediaFolderVisibility = "private" | "public";
|
|
119
|
+
|
|
120
|
+
interface MediaFolderDeclaration {
|
|
121
|
+
key: string;
|
|
122
|
+
name: string;
|
|
123
|
+
parent?: string | MediaFolderTarget;
|
|
124
|
+
visibility?: MediaFolderVisibility;
|
|
125
|
+
acl?: AclEntry[];
|
|
126
|
+
tenantId: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface DeclaredFolderTarget { key: string; }
|
|
130
|
+
interface BoundFolderTarget { binding: string; }
|
|
131
|
+
type MediaFolderTarget = DeclaredFolderTarget | BoundFolderTarget;
|
|
132
|
+
|
|
133
|
+
interface MediaBytesSource { bytes: Uint8Array; }
|
|
134
|
+
interface MediaFileSource { filePath: string; }
|
|
135
|
+
interface MediaLazySource { load: () => Uint8Array | Promise<Uint8Array>; }
|
|
136
|
+
type MediaAssetSource = MediaBytesSource | MediaFileSource | MediaLazySource;
|
|
137
|
+
|
|
138
|
+
interface MediaAssetDeclaration {
|
|
139
|
+
key: string;
|
|
140
|
+
folder: MediaFolderTarget;
|
|
141
|
+
name: string;
|
|
142
|
+
mimetype: string;
|
|
143
|
+
source: MediaAssetSource;
|
|
144
|
+
version?: string;
|
|
145
|
+
alt?: string;
|
|
146
|
+
tenantId: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type MediaDeclarationStatus = "created" | "updated" | "unchanged" | "preserved" | "deleted";
|
|
150
|
+
|
|
151
|
+
interface MediaDeclarationResult {
|
|
152
|
+
status: MediaDeclarationStatus;
|
|
153
|
+
id?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare function EnsureMediaFolder(declaration: MediaFolderDeclaration): Promise<MediaDeclarationResult>;
|
|
157
|
+
declare function ImportMediaAsset(declaration: MediaAssetDeclaration): Promise<MediaDeclarationResult>;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- `key` is a stable, namespaced id you choose, such as `helio.procedures`. Declarations are keyed by tenant, kind and key: calling them on every boot or hot reload creates each folder and file once.
|
|
161
|
+
- A folder goes at the library root, under the declared folder named by `parent` (its key, or `{ key }`), or under the folder bound to an asset field (`{ binding }`) when that binding sets `subfolders: true`. `visibility` defaults to `private`; without `acl` the folder inherits its parent's ACL (the `rootAcl` at the root).
|
|
162
|
+
- A file goes into a declared folder (`{ key }`) or into the folder bound to an asset field (`{ binding }`, the `id` given to `AssetType` or `RegisterAssetBinding`, which the runtime provisions first). `source` is the content in memory (`bytes`), a path on the backend's file system (`filePath`) or a function producing it (`load`). `name` is the file name shown in the library, extension included.
|
|
163
|
+
- The source is read only when a decision needs the bytes: never for a file a member changed or deleted, and not for an unchanged file whose `version` matches. `version` is an opaque string you change whenever the bytes change, such as a hash of what they are generated from: while it equals the version of the key's last declaration, the runtime reuses the content hash it recorded then instead of reading `source`. Pair it with `load` to skip generating content on every boot or hot reload. A new version whose bytes turn out identical is `unchanged` and remembered, so the next call does not read them again. Without `version`, every call reads the source to compare it.
|
|
164
|
+
- `tenantId` is required in TypeScript and at runtime. Omission, an empty string or whitespace-only input rejects before database writes or source reads. There is no default fallback; passing `DEFAULT_TENANT_ID` explicitly remains valid. Existing callers of these new APIs must add their trusted tenant id; older media APIs are unchanged.
|
|
165
|
+
- `id` in the result is the library id of the folder or file, to store in an `AssetType` value for example.
|
|
166
|
+
|
|
167
|
+
### The refresh rule
|
|
168
|
+
|
|
169
|
+
For each key, the runtime remembers the last declaration it applied and a hash of the row's editable state right after applying it: a folder's name, parent, visibility and ACL; a file's name, folder, alt text, visibility and stored content. On each call:
|
|
170
|
+
|
|
171
|
+
1. No row was ever declared for the key: the folder or file is created (`created`).
|
|
172
|
+
2. The row was deleted since, by a member or with its folder: it is not created again (`deleted`). A file whose declared folder was deleted before it was ever imported is `deleted` too.
|
|
173
|
+
3. The row's current state no longer hashes to what the last declaration left: someone changed it, so it is left as is, whatever the new declaration says (`preserved`).
|
|
174
|
+
4. The declaration equals the last one applied: nothing is written (`unchanged`). A file's content counts as equal when its bytes hash the same, or when its `version` equals the last one without the bytes being read.
|
|
175
|
+
5. Otherwise the row still holds exactly what was declared, and is refreshed to the new declaration (`updated`): a new name, place, visibility, ACL or alt text, or new bytes, which replace the stored file and its generated sizes the way an image edit does.
|
|
176
|
+
|
|
177
|
+
Refreshes compare the observed editable state in the database write itself. A member edit that wins that race is `preserved`, or `deleted` if the row was removed. File metadata and replacement bytes are published together; a rejected replacement does not become the live file. An edit made after a successful refresh remains a member edit on the next declaration, rather than becoming the declaration's baseline.
|
|
178
|
+
|
|
179
|
+
Only creations are recorded in the activity, attributed to `System`, as `folder.create` and `asset.upload`; refreshes are not.
|
|
180
|
+
|
|
181
|
+
The comparison is of state, not edit history: restoring exactly the last applied state makes the row eligible for refresh again. Removing a declaration from code does not delete its row: retire it (below). Use one declaration writer per tenant and key: the queue is process-local, and creation, storage, activity and declaration bookkeeping are not a single transaction. Folder moves and descendant path rewrites are also separate writes; this API is not a transaction across a whole folder tree.
|
|
182
|
+
|
|
183
|
+
### Retiring content the code no longer declares
|
|
184
|
+
|
|
185
|
+
```ts [Contract]
|
|
186
|
+
type MediaContentKind = "folder" | "asset";
|
|
187
|
+
|
|
188
|
+
interface MediaDeclarationRetirement {
|
|
189
|
+
kind: MediaContentKind;
|
|
190
|
+
key: string;
|
|
191
|
+
tenantId: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface MediaDeclarationPrune {
|
|
195
|
+
prefix: string;
|
|
196
|
+
keep: string[];
|
|
197
|
+
tenantId: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
type MediaRetirementStatus = "removed" | "preserved" | "deleted" | "unknown";
|
|
201
|
+
|
|
202
|
+
interface MediaRetirementResult {
|
|
203
|
+
kind: MediaContentKind;
|
|
204
|
+
key: string;
|
|
205
|
+
status: MediaRetirementStatus;
|
|
206
|
+
id?: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare function RetireMediaDeclaration(retirement: MediaDeclarationRetirement): Promise<MediaRetirementResult>;
|
|
210
|
+
declare function PruneMediaDeclarations(prune: MediaDeclarationPrune): Promise<MediaRetirementResult[]>;
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`RetireMediaDeclaration` takes back one declaration, by the kind and key it was made with. `PruneMediaDeclarations` retires every declaration whose key starts with `prefix` and is not listed in `keep` (keys of folders and files alike): call it after the declarations of the current code, with the keys they used, and whatever an earlier version shipped and this one dropped is taken back. It retires files first, then folders from the deepest, and returns one result per retired declaration. The rule follows the refresh rule:
|
|
214
|
+
|
|
215
|
+
1. Nothing is declared under the kind and key, never or no longer: nothing happens (`unknown`).
|
|
216
|
+
2. The row was deleted since: `deleted`.
|
|
217
|
+
3. The row's state no longer hashes to what the last declaration left, or the folder holds anything (members' files and folders, or declared content not retired yet): it stays as it is (`preserved`).
|
|
218
|
+
4. Otherwise the row still holds exactly what was declared: it is deleted like a member's delete, its stored files with it, and recorded as `asset.delete` or `folder.delete` by `System` (`removed`).
|
|
219
|
+
|
|
220
|
+
In every case but `unknown` the declaration is forgotten: a preserved folder or file now belongs to the members, and declaring the key again creates new content. Retiring is never a cascade: a folder is removed only once empty, so keep in `keep` the folders the code still imports into. The delete is conditional on the observed state in the database write, so a member edit racing it wins. Only one module should own a prefix; `prefix` is required and nonblank.
|
|
221
|
+
|
|
222
|
+
### Validation and errors
|
|
223
|
+
|
|
224
|
+
Declarations follow the dashboard's rules and reject with an error naming the kind, the key and the reason, such as `Media folder 'helio.procedures': a folder named 'Procedures' already exists there`:
|
|
225
|
+
|
|
226
|
+
- folder names refuse `/ \ < > : " | ? *` and control characters, stay within 255 characters and must be unique among their siblings, case and Unicode form aside;
|
|
227
|
+
- a `parent` or `{ key }` folder must have been declared first;
|
|
228
|
+
- a folder cannot name itself as its parent or move under one of its descendants; these declarations reject without changing the hierarchy;
|
|
229
|
+
- a `{ binding }` folder must have been registered, and a `{ binding }` parent must allow `subfolders`;
|
|
230
|
+
- a file must be of an allowed type (`allowedMimetypes`, never HTML, XHTML or PHP), of a type the bound field accepts, within the storage quota and the 500 MB upload limit, and a decodable image when its mimetype says so; the stored mimetype is the decoded format's, as for an upload;
|
|
231
|
+
- alt text stays within 255 characters.
|
|
232
|
+
|
|
233
|
+
### Calling them at startup
|
|
234
|
+
|
|
235
|
+
A call made before the runtime is loaded is queued by the interface, and the runtime waits for the explicitly selected tenant's tables (up to 5 minutes) and for the file storage to answer (up to 2 minutes; `@antelopejs/file-storage-local` receives files on the API server, which may not listen yet). This is technical readiness, not proof that SaaS provisioning is committed. Do not await them in `construct()`: the database only becomes ready once every module is constructed. Declare a parent before its children and a folder before its files, awaiting each call. Reserve `start()` for registration or explicitly scoped global work; use the application lifecycle below for new SaaS tenants.
|
|
236
|
+
|
|
237
|
+
### Tenant scope and trusted backend context
|
|
238
|
+
|
|
239
|
+
`tenantId` selects the existing DMS tenant schema instance for the folders, files and declaration registry. Parent keys and bindings resolve within that tenant, and the same declaration key can be used independently in different tenants. Both functions require a nonblank explicit tenant; neither infers it from an HTTP session or a SaaS workspace context. Surrounding whitespace is trimmed.
|
|
240
|
+
|
|
241
|
+
These are trusted backend APIs, not authorization endpoints. They need the media implementation, the selected tenant's database instance and reachable file storage; they do not require a signed-in user, create a workspace, check payment status or decide when workspace provisioning is committed. Storage paths include the tenant id, but the storage backend and upload policy remain module configuration. Events are attributed to `System`.
|
|
242
|
+
|
|
243
|
+
`start()` runs for the process, not once per tenant. The routine below receives its trusted tenant from the application; it does not initialize every existing or future workspace. A required tenant id proves neither authorization nor completed provisioning.
|
|
244
|
+
|
|
245
|
+
```ts docs-check
|
|
246
|
+
import {
|
|
247
|
+
EnsureMediaFolder,
|
|
248
|
+
ImportMediaAsset,
|
|
249
|
+
type MediaDeclarationResult,
|
|
250
|
+
} from "@antelopejs/interface-dms-media";
|
|
251
|
+
|
|
252
|
+
export async function declareProcedures(tenantId: string, pdf: Uint8Array): Promise<MediaDeclarationResult[]> {
|
|
253
|
+
const root = await EnsureMediaFolder({ tenantId, key: "helio.procedures", name: "Procedures" });
|
|
254
|
+
const safety = await EnsureMediaFolder({
|
|
255
|
+
tenantId,
|
|
256
|
+
key: "helio.procedures.safety",
|
|
257
|
+
name: "Safety",
|
|
258
|
+
parent: "helio.procedures",
|
|
259
|
+
acl: [
|
|
260
|
+
{ subject: { kind: "permission", id: "projects.page" }, rights: ["read"] },
|
|
261
|
+
],
|
|
262
|
+
});
|
|
263
|
+
const file = await ImportMediaAsset({
|
|
264
|
+
tenantId,
|
|
265
|
+
key: "helio.procedures.safety.roof",
|
|
266
|
+
folder: { key: "helio.procedures.safety" },
|
|
267
|
+
name: "Roof safety checklist.pdf",
|
|
268
|
+
mimetype: "application/pdf",
|
|
269
|
+
source: { bytes: pdf },
|
|
270
|
+
});
|
|
271
|
+
return [root, safety, file];
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### New SaaS tenants: application-owned durable lifecycle
|
|
276
|
+
|
|
277
|
+
For resources needed after payment, register an application consumer through `RegisterWorkspaceLifecycleConsumer` from `@antelopejs/interface-dms-saas/workspace-lifecycle`, with `transitions: ["created"]`. Register it synchronously in `construct()` before startup reconciliation begins: module `start()` functions may run concurrently. Do not await media declarations in `construct()`; they run later inside `consume`. The existing SaaS `created` transition follows preparation and payment and is delivered at least once. Media neither depends on SaaS at runtime nor registers this consumer itself.
|
|
278
|
+
|
|
279
|
+
The following is an **integration skeleton**, not a runnable persistence implementation. Replace the fail-closed body with the application's durable operation handling before enabling it:
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
import { RegisterWorkspaceLifecycleConsumer } from "@antelopejs/interface-dms-saas/workspace-lifecycle";
|
|
283
|
+
|
|
284
|
+
export function construct(): void {
|
|
285
|
+
RegisterWorkspaceLifecycleConsumer({
|
|
286
|
+
name: "app.media-content",
|
|
287
|
+
transitions: ["created"],
|
|
288
|
+
async consume({ tenantId, operationId }) {
|
|
289
|
+
// Deduplicate operationId in durable application storage, scoped to this
|
|
290
|
+
// consumer and tenantId; replay the stored receipt for a completed operation.
|
|
291
|
+
// Otherwise call declareProcedures(tenantId, pdf), inspecting its results.
|
|
292
|
+
// Durably link the resulting resources to the operation before returning
|
|
293
|
+
// { receiptId: persistedReceiptId }. Recover incomplete attempts on retry.
|
|
294
|
+
// Concurrent deliveries need application-level serialization/uniqueness.
|
|
295
|
+
throw new Error(`Implement durable receipt handling for ${tenantId}/${operationId}`);
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
The application supplies the content and durable storage, handles `preserved` and `deleted` according to its business contract, and returns `{ receiptId, ... }` only after resource links and completion are durable. Retain the declaration results needed to link resources; `deleted` has no resource id. Do not acknowledge errors, or mint a receipt before linking resources. Idempotent declarations do not make every effect exactly-once: database, storage, activity and declaration records are separate writes, and media's key queue is process-local. Recovery and coordination across workers remain application responsibilities.
|
|
302
|
+
|
|
303
|
+
`TENANT_BEING_PROVISIONED` is different: it runs before payment, is awaited in series, can reject tenant creation, and has neither automatic hook replay nor automatic compensation for consumer effects. It is not a substitute for durable `created`. These recommendations do not change the application's provisioning policy or move existing hooks.
|
|
304
|
+
|
|
305
|
+
### Existing tenants: deployment refresh and backfill
|
|
306
|
+
|
|
307
|
+
A new-tenant `created` consumer does not update all existing tenants when content changes at deployment. Run a separately controlled refresh/backfill over the application's trusted tenant inventory. For each tenant, check `IsWorkspaceProvisioningCommitted(tenantId)` through the SaaS interface before declaring content. If the result is false, skip it; if inventory or commitment lookup fails, stop or retry without writing (fail closed). Never replace a missing tenant with `DEFAULT_TENANT_ID`. Coordinate this writer with lifecycle deliveries, use stable keys, and retain progress/errors for retries. An explicitly selected default tenant remains suitable for intentional single-tenant/global content, not as an implicit SaaS fallback.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-dms-media",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "AntelopeJS interface for the DMS media module: declare asset fields and the media folders bound to them from any module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -9,13 +9,19 @@
|
|
|
9
9
|
"interface",
|
|
10
10
|
"media"
|
|
11
11
|
],
|
|
12
|
+
"homepage": "https://dms.antelopejs.com/docs/modules/media/extending",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/AntelopeJS/dms-media/issues"
|
|
15
|
+
},
|
|
12
16
|
"license": "Apache-2.0",
|
|
13
17
|
"repository": {
|
|
14
18
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/AntelopeJS/dms-media.git"
|
|
19
|
+
"url": "git+https://github.com/AntelopeJS/dms-media.git",
|
|
20
|
+
"directory": "packages/interface-dms-media"
|
|
16
21
|
},
|
|
17
22
|
"files": [
|
|
18
23
|
"LICENSE",
|
|
24
|
+
"docs",
|
|
19
25
|
"dist",
|
|
20
26
|
"!dist/.tsbuildinfo"
|
|
21
27
|
],
|
|
@@ -53,10 +59,10 @@
|
|
|
53
59
|
"zod": "~3.24.2"
|
|
54
60
|
},
|
|
55
61
|
"devDependencies": {
|
|
56
|
-
"@antelopejs/interface-api": ">=0.0.
|
|
57
|
-
"@antelopejs/interface-core": ">=0.
|
|
58
|
-
"@antelopejs/interface-dms": ">=0.
|
|
59
|
-
"@antelopejs/tooling-configs": ">=0.0.
|
|
62
|
+
"@antelopejs/interface-api": ">=0.0.15 <1.0.0",
|
|
63
|
+
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
64
|
+
"@antelopejs/interface-dms": ">=0.7.2 <1.0.0",
|
|
65
|
+
"@antelopejs/tooling-configs": ">=0.0.9 <1.0.0",
|
|
60
66
|
"@types/node": "^24.0.0",
|
|
61
67
|
"knip": "^6.34.0",
|
|
62
68
|
"oxfmt": "^0.66.0",
|
|
@@ -68,9 +74,9 @@
|
|
|
68
74
|
"typescript": "^6.0.3"
|
|
69
75
|
},
|
|
70
76
|
"peerDependencies": {
|
|
71
|
-
"@antelopejs/interface-api": ">=0.0.
|
|
72
|
-
"@antelopejs/interface-core": ">=0.
|
|
73
|
-
"@antelopejs/interface-dms": ">=0.
|
|
77
|
+
"@antelopejs/interface-api": ">=0.0.15 <1.0.0",
|
|
78
|
+
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
79
|
+
"@antelopejs/interface-dms": ">=0.7.2 <1.0.0"
|
|
74
80
|
},
|
|
75
81
|
"packageManager": "pnpm@10.2.0",
|
|
76
82
|
"antelopeJs": {}
|