@org-quicko/silo-client 1.0.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 +313 -0
- package/dist/collections/collection-definition.d.cts +10 -0
- package/dist/collections/collection-definition.d.ts +10 -0
- package/dist/collections/collection-handle.d.cts +54 -0
- package/dist/collections/collection-handle.d.ts +54 -0
- package/dist/collections/collection-schema.d.cts +16 -0
- package/dist/collections/collection-schema.d.ts +16 -0
- package/dist/collections/collection-summary.d.cts +10 -0
- package/dist/collections/collection-summary.d.ts +10 -0
- package/dist/collections/collections.d.cts +19 -0
- package/dist/collections/collections.d.ts +19 -0
- package/dist/collections/json-schema.d.cts +9 -0
- package/dist/collections/json-schema.d.ts +9 -0
- package/dist/collections/reserved-field-names.d.cts +9 -0
- package/dist/collections/reserved-field-names.d.ts +9 -0
- package/dist/entries/entry-base.d.cts +31 -0
- package/dist/entries/entry-base.d.ts +31 -0
- package/dist/entries/entry-list-query.d.cts +11 -0
- package/dist/entries/entry-list-query.d.ts +11 -0
- package/dist/entries/entry-mapper.d.cts +13 -0
- package/dist/entries/entry-mapper.d.ts +13 -0
- package/dist/entries/entry-page-stream.d.cts +14 -0
- package/dist/entries/entry-page-stream.d.ts +14 -0
- package/dist/entries/entry-page.d.cts +16 -0
- package/dist/entries/entry-page.d.ts +16 -0
- package/dist/entries/entry-payload.d.cts +12 -0
- package/dist/entries/entry-payload.d.ts +12 -0
- package/dist/entries/entry-reader.d.cts +26 -0
- package/dist/entries/entry-reader.d.ts +26 -0
- package/dist/entries/entry-stream.d.cts +5 -0
- package/dist/entries/entry-stream.d.ts +5 -0
- package/dist/entries/entry.d.cts +25 -0
- package/dist/entries/entry.d.ts +25 -0
- package/dist/entries/resolved-entry.d.cts +11 -0
- package/dist/entries/resolved-entry.d.ts +11 -0
- package/dist/errors/conflict-error.d.cts +6 -0
- package/dist/errors/conflict-error.d.ts +6 -0
- package/dist/errors/error-code.d.cts +4 -0
- package/dist/errors/error-code.d.ts +4 -0
- package/dist/errors/error-factory.d.cts +15 -0
- package/dist/errors/error-factory.d.ts +15 -0
- package/dist/errors/error-payload.d.cts +13 -0
- package/dist/errors/error-payload.d.ts +13 -0
- package/dist/errors/forbidden-error.d.cts +5 -0
- package/dist/errors/forbidden-error.d.ts +5 -0
- package/dist/errors/internal-error.d.cts +6 -0
- package/dist/errors/internal-error.d.ts +6 -0
- package/dist/errors/invalid-response-error.d.cts +11 -0
- package/dist/errors/invalid-response-error.d.ts +11 -0
- package/dist/errors/media-delete-stalled-error.d.cts +14 -0
- package/dist/errors/media-delete-stalled-error.d.ts +14 -0
- package/dist/errors/media-in-use-error.d.cts +21 -0
- package/dist/errors/media-in-use-error.d.ts +21 -0
- package/dist/errors/network-error.d.cts +11 -0
- package/dist/errors/network-error.d.ts +11 -0
- package/dist/errors/not-found-error.d.cts +6 -0
- package/dist/errors/not-found-error.d.ts +6 -0
- package/dist/errors/request-aborted-error.d.cts +10 -0
- package/dist/errors/request-aborted-error.d.ts +10 -0
- package/dist/errors/silo-error.d.cts +12 -0
- package/dist/errors/silo-error.d.ts +12 -0
- package/dist/errors/timeout-error.d.cts +11 -0
- package/dist/errors/timeout-error.d.ts +11 -0
- package/dist/errors/unauthorized-error.d.cts +5 -0
- package/dist/errors/unauthorized-error.d.ts +5 -0
- package/dist/errors/validation-detail.d.cts +8 -0
- package/dist/errors/validation-detail.d.ts +8 -0
- package/dist/errors/validation-failed-error.d.cts +11 -0
- package/dist/errors/validation-failed-error.d.ts +11 -0
- package/dist/index.cjs +2095 -0
- package/dist/index.d.cts +96 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +2053 -0
- package/dist/instance/health-report.d.cts +5 -0
- package/dist/instance/health-report.d.ts +5 -0
- package/dist/media/media-asset-mapper.d.cts +31 -0
- package/dist/media/media-asset-mapper.d.ts +31 -0
- package/dist/media/media-asset-payload.d.cts +20 -0
- package/dist/media/media-asset-payload.d.ts +20 -0
- package/dist/media/media-asset.d.cts +63 -0
- package/dist/media/media-asset.d.ts +63 -0
- package/dist/media/media-delete-failure.d.cts +16 -0
- package/dist/media/media-delete-failure.d.ts +16 -0
- package/dist/media/media-delete-options.d.cts +9 -0
- package/dist/media/media-delete-options.d.ts +9 -0
- package/dist/media/media-delete-report.d.cts +13 -0
- package/dist/media/media-delete-report.d.ts +13 -0
- package/dist/media/media-folder-delete.d.cts +10 -0
- package/dist/media/media-folder-delete.d.ts +10 -0
- package/dist/media/media-folder-move.d.cts +9 -0
- package/dist/media/media-folder-move.d.ts +9 -0
- package/dist/media/media-folders.d.cts +22 -0
- package/dist/media/media-folders.d.ts +22 -0
- package/dist/media/media-page-stream.d.cts +10 -0
- package/dist/media/media-page-stream.d.ts +10 -0
- package/dist/media/media-page.d.cts +19 -0
- package/dist/media/media-page.d.ts +19 -0
- package/dist/media/media-query.d.cts +24 -0
- package/dist/media/media-query.d.ts +24 -0
- package/dist/media/media-reference.d.cts +18 -0
- package/dist/media/media-reference.d.ts +18 -0
- package/dist/media/media-stream.d.cts +7 -0
- package/dist/media/media-stream.d.ts +7 -0
- package/dist/media/media-upload.d.cts +18 -0
- package/dist/media/media-upload.d.ts +18 -0
- package/dist/media/media-usage-page.d.cts +35 -0
- package/dist/media/media-usage-page.d.ts +35 -0
- package/dist/media/media-usage.d.cts +13 -0
- package/dist/media/media-usage.d.ts +13 -0
- package/dist/media/media.d.cts +37 -0
- package/dist/media/media.d.ts +37 -0
- package/dist/pagination/page-window.d.cts +14 -0
- package/dist/pagination/page-window.d.ts +14 -0
- package/dist/pagination/page.d.cts +27 -0
- package/dist/pagination/page.d.ts +27 -0
- package/dist/pagination/row-stream.d.cts +28 -0
- package/dist/pagination/row-stream.d.ts +28 -0
- package/dist/query/field-path.d.cts +14 -0
- package/dist/query/field-path.d.ts +14 -0
- package/dist/query/filter-expression.d.cts +15 -0
- package/dist/query/filter-expression.d.ts +15 -0
- package/dist/query/filter-field.d.cts +19 -0
- package/dist/query/filter-field.d.ts +19 -0
- package/dist/query/filter-node.d.cts +9 -0
- package/dist/query/filter-node.d.ts +9 -0
- package/dist/query/filter-operator.d.cts +7 -0
- package/dist/query/filter-operator.d.ts +7 -0
- package/dist/query/filter.d.cts +18 -0
- package/dist/query/filter.d.ts +18 -0
- package/dist/query/sort-term.d.cts +13 -0
- package/dist/query/sort-term.d.ts +13 -0
- package/dist/query/sort.d.cts +15 -0
- package/dist/query/sort.d.ts +15 -0
- package/dist/query/typed-filter.d.cts +32 -0
- package/dist/query/typed-filter.d.ts +32 -0
- package/dist/request-options.d.cts +9 -0
- package/dist/request-options.d.ts +9 -0
- package/dist/scope/delete-options.d.cts +9 -0
- package/dist/scope/delete-options.d.ts +9 -0
- package/dist/scope/environment-handle.d.cts +29 -0
- package/dist/scope/environment-handle.d.ts +29 -0
- package/dist/scope/environment.d.cts +8 -0
- package/dist/scope/environment.d.ts +8 -0
- package/dist/scope/environments.d.cts +11 -0
- package/dist/scope/environments.d.ts +11 -0
- package/dist/scope/project-handle.d.cts +22 -0
- package/dist/scope/project-handle.d.ts +22 -0
- package/dist/scope/project.d.cts +8 -0
- package/dist/scope/project.d.ts +8 -0
- package/dist/scope/projects.d.cts +10 -0
- package/dist/scope/projects.d.ts +10 -0
- package/dist/scope/rename-options.d.cts +10 -0
- package/dist/scope/rename-options.d.ts +10 -0
- package/dist/scope/rename-report.d.cts +21 -0
- package/dist/scope/rename-report.d.ts +21 -0
- package/dist/scope/scope-reference.d.cts +12 -0
- package/dist/scope/scope-reference.d.ts +12 -0
- package/dist/search/search-engine.d.cts +3 -0
- package/dist/search/search-engine.d.ts +3 -0
- package/dist/search/search-hit.d.cts +18 -0
- package/dist/search/search-hit.d.ts +18 -0
- package/dist/search/search-page.d.cts +19 -0
- package/dist/search/search-page.d.ts +19 -0
- package/dist/search/search-query.d.cts +11 -0
- package/dist/search/search-query.d.ts +11 -0
- package/dist/search/search-reach.d.cts +12 -0
- package/dist/search/search-reach.d.ts +12 -0
- package/dist/search/search-snippet.d.cts +8 -0
- package/dist/search/search-snippet.d.ts +8 -0
- package/dist/search/search.d.cts +18 -0
- package/dist/search/search.d.ts +18 -0
- package/dist/silo-options.d.cts +12 -0
- package/dist/silo-options.d.ts +12 -0
- package/dist/silo.d.cts +42 -0
- package/dist/silo.d.ts +42 -0
- package/dist/transport/abort-signals.d.cts +23 -0
- package/dist/transport/abort-signals.d.ts +23 -0
- package/dist/transport/api-path.d.cts +36 -0
- package/dist/transport/api-path.d.ts +36 -0
- package/dist/transport/fetch-function.d.cts +11 -0
- package/dist/transport/fetch-function.d.ts +11 -0
- package/dist/transport/page-payload.d.cts +15 -0
- package/dist/transport/page-payload.d.ts +15 -0
- package/dist/transport/query-string.d.cts +10 -0
- package/dist/transport/query-string.d.ts +10 -0
- package/dist/transport/response-decoder.d.cts +14 -0
- package/dist/transport/response-decoder.d.ts +14 -0
- package/dist/transport/route-inventory.d.cts +22 -0
- package/dist/transport/route-inventory.d.ts +22 -0
- package/dist/transport/transport-request.d.cts +18 -0
- package/dist/transport/transport-request.d.ts +18 -0
- package/dist/transport/transport.d.cts +45 -0
- package/dist/transport/transport.d.ts +45 -0
- package/dist/variables/environment-variables.d.cts +14 -0
- package/dist/variables/environment-variables.d.ts +14 -0
- package/dist/variables/project-variables.d.cts +38 -0
- package/dist/variables/project-variables.d.ts +38 -0
- package/dist/variables/variable-declaration.d.cts +10 -0
- package/dist/variables/variable-declaration.d.ts +10 -0
- package/dist/variables/variable.d.cts +17 -0
- package/dist/variables/variable.d.ts +17 -0
- package/package.json +58 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MediaAssetRecord } from "./media-asset.cjs";
|
|
2
|
+
import type { MediaAssetPayload } from "./media-asset-payload.cjs";
|
|
3
|
+
import type { MediaUsage } from "./media-usage.cjs";
|
|
4
|
+
/** `MediaAssetMapper.toUsagePage`'s output — one page of an asset's
|
|
5
|
+
* referrers, mapped. */
|
|
6
|
+
export interface MediaUsagePageFields {
|
|
7
|
+
items: MediaUsage[];
|
|
8
|
+
total: number;
|
|
9
|
+
visible: number;
|
|
10
|
+
visibleCapped: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The explicit per-type mapper for media: renames only the known wire
|
|
14
|
+
* fields — `size`, `content_type`, `blob_key`, `usage_count`, `env`,
|
|
15
|
+
* `visible_capped` and the two timestamps — and leaves `filename` and `tags`
|
|
16
|
+
* untouched. The one place that maps the wire, reused by every media class
|
|
17
|
+
* and by `MediaInUseError` for its `referrers`.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MediaAssetMapper {
|
|
20
|
+
static toRecord(payload: MediaAssetPayload): MediaAssetRecord;
|
|
21
|
+
/** Reads defensively: this also backs `MediaInUseError`'s referrers, which
|
|
22
|
+
* arrive inside an error body rather than a route this client trusts to
|
|
23
|
+
* shape exactly right. */
|
|
24
|
+
static toUsage(payload: Record<string, unknown>): MediaUsage;
|
|
25
|
+
static toUsagePage(body: {
|
|
26
|
+
items: unknown[];
|
|
27
|
+
total: number;
|
|
28
|
+
visible: number;
|
|
29
|
+
visible_capped: boolean;
|
|
30
|
+
}): MediaUsagePageFields;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { MediaAssetRecord } from "./media-asset.js";
|
|
2
|
+
import type { MediaAssetPayload } from "./media-asset-payload.js";
|
|
3
|
+
import type { MediaUsage } from "./media-usage.js";
|
|
4
|
+
/** `MediaAssetMapper.toUsagePage`'s output — one page of an asset's
|
|
5
|
+
* referrers, mapped. */
|
|
6
|
+
export interface MediaUsagePageFields {
|
|
7
|
+
items: MediaUsage[];
|
|
8
|
+
total: number;
|
|
9
|
+
visible: number;
|
|
10
|
+
visibleCapped: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The explicit per-type mapper for media: renames only the known wire
|
|
14
|
+
* fields — `size`, `content_type`, `blob_key`, `usage_count`, `env`,
|
|
15
|
+
* `visible_capped` and the two timestamps — and leaves `filename` and `tags`
|
|
16
|
+
* untouched. The one place that maps the wire, reused by every media class
|
|
17
|
+
* and by `MediaInUseError` for its `referrers`.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MediaAssetMapper {
|
|
20
|
+
static toRecord(payload: MediaAssetPayload): MediaAssetRecord;
|
|
21
|
+
/** Reads defensively: this also backs `MediaInUseError`'s referrers, which
|
|
22
|
+
* arrive inside an error body rather than a route this client trusts to
|
|
23
|
+
* shape exactly right. */
|
|
24
|
+
static toUsage(payload: Record<string, unknown>): MediaUsage;
|
|
25
|
+
static toUsagePage(body: {
|
|
26
|
+
items: unknown[];
|
|
27
|
+
total: number;
|
|
28
|
+
visible: number;
|
|
29
|
+
visible_capped: boolean;
|
|
30
|
+
}): MediaUsagePageFields;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A catalogued media asset exactly as the wire answers it — the body
|
|
3
|
+
* `GET/POST/PATCH /api/media[/…]` sends for one asset, and `MediaAssetMapper`
|
|
4
|
+
*'s input.
|
|
5
|
+
*/
|
|
6
|
+
export interface MediaAssetPayload {
|
|
7
|
+
id: string;
|
|
8
|
+
filename: string;
|
|
9
|
+
folder: string;
|
|
10
|
+
blob_key: string;
|
|
11
|
+
size: number;
|
|
12
|
+
content_type: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
state: "active" | "deleting";
|
|
15
|
+
tags: string[];
|
|
16
|
+
url: string;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
usage_count?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A catalogued media asset exactly as the wire answers it — the body
|
|
3
|
+
* `GET/POST/PATCH /api/media[/…]` sends for one asset, and `MediaAssetMapper`
|
|
4
|
+
*'s input.
|
|
5
|
+
*/
|
|
6
|
+
export interface MediaAssetPayload {
|
|
7
|
+
id: string;
|
|
8
|
+
filename: string;
|
|
9
|
+
folder: string;
|
|
10
|
+
blob_key: string;
|
|
11
|
+
size: number;
|
|
12
|
+
content_type: string;
|
|
13
|
+
hash: string;
|
|
14
|
+
state: "active" | "deleting";
|
|
15
|
+
tags: string[];
|
|
16
|
+
url: string;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
usage_count?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
import type { Transport } from "../transport/transport.cjs";
|
|
3
|
+
import type { MediaDeleteOptions } from "./media-delete-options.cjs";
|
|
4
|
+
import type { MediaUsageQuery } from "./media-usage-page.cjs";
|
|
5
|
+
import { MediaUsagePage } from "./media-usage-page.cjs";
|
|
6
|
+
/** `MediaAsset`'s mapped state — `MediaAssetMapper.toRecord`'s output. */
|
|
7
|
+
export interface MediaAssetRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
filename: string;
|
|
10
|
+
folder: string;
|
|
11
|
+
blobKey: string;
|
|
12
|
+
sizeInBytes: number;
|
|
13
|
+
contentType: string;
|
|
14
|
+
hash: string;
|
|
15
|
+
state: "active" | "deleting";
|
|
16
|
+
tags: string[];
|
|
17
|
+
url: string;
|
|
18
|
+
usageCount: number;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A catalogued media asset, live: the mapped record plus the operations on
|
|
24
|
+
* it (symmetrical with `Entry`). A mutating call adopts the server's answer
|
|
25
|
+
* in place and returns `this`.
|
|
26
|
+
*
|
|
27
|
+
* `reference` (`silo://media/<id>`) is what an entry field should hold;
|
|
28
|
+
* `url` is only where to fetch today's bytes. A rename or move keeps the
|
|
29
|
+
* same `reference` but can change `url` — storing `url` in an entry is the
|
|
30
|
+
* mistake a later rename silently breaks.
|
|
31
|
+
*/
|
|
32
|
+
export declare class MediaAsset {
|
|
33
|
+
private readonly transport;
|
|
34
|
+
private record;
|
|
35
|
+
constructor(transport: Transport, record: MediaAssetRecord);
|
|
36
|
+
get id(): string;
|
|
37
|
+
get filename(): string;
|
|
38
|
+
get folder(): string;
|
|
39
|
+
get sizeInBytes(): number;
|
|
40
|
+
get contentType(): string;
|
|
41
|
+
get hash(): string;
|
|
42
|
+
get state(): "active" | "deleting";
|
|
43
|
+
get tags(): readonly string[];
|
|
44
|
+
get url(): string;
|
|
45
|
+
get usageCount(): number;
|
|
46
|
+
get createdAt(): Date;
|
|
47
|
+
get updatedAt(): Date;
|
|
48
|
+
get blobKey(): string;
|
|
49
|
+
/** `silo://media/<id>` — store THIS in an entry field, never `url` (see
|
|
50
|
+
* the class doc). */
|
|
51
|
+
get reference(): string;
|
|
52
|
+
rename(filename: string, options?: RequestOptions): Promise<this>;
|
|
53
|
+
moveTo(folder: string, options?: RequestOptions): Promise<this>;
|
|
54
|
+
/** REPLACES the tag list — `PATCH` replaces, it does not append. */
|
|
55
|
+
setTags(tags: readonly string[], options?: RequestOptions): Promise<this>;
|
|
56
|
+
/** Refused while an entry references it; `{ force: true }` also needs
|
|
57
|
+
* `entries:update` on every scope this asset reaches. */
|
|
58
|
+
delete(options?: MediaDeleteOptions): Promise<void>;
|
|
59
|
+
usages(query?: MediaUsageQuery, options?: RequestOptions): Promise<MediaUsagePage>;
|
|
60
|
+
refresh(options?: RequestOptions): Promise<this>;
|
|
61
|
+
toJSON(): MediaAssetRecord;
|
|
62
|
+
private patch;
|
|
63
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
import type { Transport } from "../transport/transport.js";
|
|
3
|
+
import type { MediaDeleteOptions } from "./media-delete-options.js";
|
|
4
|
+
import type { MediaUsageQuery } from "./media-usage-page.js";
|
|
5
|
+
import { MediaUsagePage } from "./media-usage-page.js";
|
|
6
|
+
/** `MediaAsset`'s mapped state — `MediaAssetMapper.toRecord`'s output. */
|
|
7
|
+
export interface MediaAssetRecord {
|
|
8
|
+
id: string;
|
|
9
|
+
filename: string;
|
|
10
|
+
folder: string;
|
|
11
|
+
blobKey: string;
|
|
12
|
+
sizeInBytes: number;
|
|
13
|
+
contentType: string;
|
|
14
|
+
hash: string;
|
|
15
|
+
state: "active" | "deleting";
|
|
16
|
+
tags: string[];
|
|
17
|
+
url: string;
|
|
18
|
+
usageCount: number;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A catalogued media asset, live: the mapped record plus the operations on
|
|
24
|
+
* it (symmetrical with `Entry`). A mutating call adopts the server's answer
|
|
25
|
+
* in place and returns `this`.
|
|
26
|
+
*
|
|
27
|
+
* `reference` (`silo://media/<id>`) is what an entry field should hold;
|
|
28
|
+
* `url` is only where to fetch today's bytes. A rename or move keeps the
|
|
29
|
+
* same `reference` but can change `url` — storing `url` in an entry is the
|
|
30
|
+
* mistake a later rename silently breaks.
|
|
31
|
+
*/
|
|
32
|
+
export declare class MediaAsset {
|
|
33
|
+
private readonly transport;
|
|
34
|
+
private record;
|
|
35
|
+
constructor(transport: Transport, record: MediaAssetRecord);
|
|
36
|
+
get id(): string;
|
|
37
|
+
get filename(): string;
|
|
38
|
+
get folder(): string;
|
|
39
|
+
get sizeInBytes(): number;
|
|
40
|
+
get contentType(): string;
|
|
41
|
+
get hash(): string;
|
|
42
|
+
get state(): "active" | "deleting";
|
|
43
|
+
get tags(): readonly string[];
|
|
44
|
+
get url(): string;
|
|
45
|
+
get usageCount(): number;
|
|
46
|
+
get createdAt(): Date;
|
|
47
|
+
get updatedAt(): Date;
|
|
48
|
+
get blobKey(): string;
|
|
49
|
+
/** `silo://media/<id>` — store THIS in an entry field, never `url` (see
|
|
50
|
+
* the class doc). */
|
|
51
|
+
get reference(): string;
|
|
52
|
+
rename(filename: string, options?: RequestOptions): Promise<this>;
|
|
53
|
+
moveTo(folder: string, options?: RequestOptions): Promise<this>;
|
|
54
|
+
/** REPLACES the tag list — `PATCH` replaces, it does not append. */
|
|
55
|
+
setTags(tags: readonly string[], options?: RequestOptions): Promise<this>;
|
|
56
|
+
/** Refused while an entry references it; `{ force: true }` also needs
|
|
57
|
+
* `entries:update` on every scope this asset reaches. */
|
|
58
|
+
delete(options?: MediaDeleteOptions): Promise<void>;
|
|
59
|
+
usages(query?: MediaUsageQuery, options?: RequestOptions): Promise<MediaUsagePage>;
|
|
60
|
+
refresh(options?: RequestOptions): Promise<this>;
|
|
61
|
+
toJSON(): MediaAssetRecord;
|
|
62
|
+
private patch;
|
|
63
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MediaUsage } from "./media-usage.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* One id's outcome in a bulk delete that could not remove it. `usageCount`,
|
|
4
|
+
* `visibleCount`, `visibleCapped` and `referrers` are present only for the
|
|
5
|
+
* `"media_in_use"` code — `"not_found"`, `"media_delete_stalled"` and
|
|
6
|
+
* `"invalid_id"` carry just `id`, `code` and `message`.
|
|
7
|
+
*/
|
|
8
|
+
export interface MediaDeleteFailure {
|
|
9
|
+
id: string;
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
usageCount?: number;
|
|
13
|
+
visibleCount?: number;
|
|
14
|
+
visibleCapped?: boolean;
|
|
15
|
+
referrers?: MediaUsage[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MediaUsage } from "./media-usage.js";
|
|
2
|
+
/**
|
|
3
|
+
* One id's outcome in a bulk delete that could not remove it. `usageCount`,
|
|
4
|
+
* `visibleCount`, `visibleCapped` and `referrers` are present only for the
|
|
5
|
+
* `"media_in_use"` code — `"not_found"`, `"media_delete_stalled"` and
|
|
6
|
+
* `"invalid_id"` carry just `id`, `code` and `message`.
|
|
7
|
+
*/
|
|
8
|
+
export interface MediaDeleteFailure {
|
|
9
|
+
id: string;
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
usageCount?: number;
|
|
13
|
+
visibleCount?: number;
|
|
14
|
+
visibleCapped?: boolean;
|
|
15
|
+
referrers?: MediaUsage[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaAsset.delete()` and `Media.deleteMany()`'s options. `force` skips the
|
|
4
|
+
* usage check and deletes over a live reference — it also needs
|
|
5
|
+
* `entries:update` on every scope the asset actually reaches.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaDeleteOptions extends RequestOptions {
|
|
8
|
+
force?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaAsset.delete()` and `Media.deleteMany()`'s options. `force` skips the
|
|
4
|
+
* usage check and deletes over a live reference — it also needs
|
|
5
|
+
* `entries:update` on every scope the asset actually reaches.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaDeleteOptions extends RequestOptions {
|
|
8
|
+
force?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MediaDeleteFailure } from "./media-delete-failure.cjs";
|
|
2
|
+
/** `POST /api/media/delete`'s always-`200` body: every id's outcome,
|
|
3
|
+
* never a partial result the caller has to infer from a thrown error. */
|
|
4
|
+
export declare class MediaDeleteReport {
|
|
5
|
+
readonly deleted: readonly string[];
|
|
6
|
+
readonly failed: readonly MediaDeleteFailure[];
|
|
7
|
+
private constructor();
|
|
8
|
+
static fromWireBody(body: {
|
|
9
|
+
deleted: string[];
|
|
10
|
+
failed: Record<string, unknown>[];
|
|
11
|
+
}): MediaDeleteReport;
|
|
12
|
+
private static toFailure;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MediaDeleteFailure } from "./media-delete-failure.js";
|
|
2
|
+
/** `POST /api/media/delete`'s always-`200` body: every id's outcome,
|
|
3
|
+
* never a partial result the caller has to infer from a thrown error. */
|
|
4
|
+
export declare class MediaDeleteReport {
|
|
5
|
+
readonly deleted: readonly string[];
|
|
6
|
+
readonly failed: readonly MediaDeleteFailure[];
|
|
7
|
+
private constructor();
|
|
8
|
+
static fromWireBody(body: {
|
|
9
|
+
deleted: string[];
|
|
10
|
+
failed: Record<string, unknown>[];
|
|
11
|
+
}): MediaDeleteReport;
|
|
12
|
+
private static toFailure;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaFolders.delete()`'s options. `recursive` takes everything inside the
|
|
4
|
+
* folder with it; `force` (only meaningful with `recursive`) opts past a live
|
|
5
|
+
* reference among those assets.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaFolderDeleteOptions extends RequestOptions {
|
|
8
|
+
recursive?: boolean;
|
|
9
|
+
force?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaFolders.delete()`'s options. `recursive` takes everything inside the
|
|
4
|
+
* folder with it; `force` (only meaningful with `recursive`) opts past a live
|
|
5
|
+
* reference among those assets.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaFolderDeleteOptions extends RequestOptions {
|
|
8
|
+
recursive?: boolean;
|
|
9
|
+
force?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaFolders.rename()`'s options. `merge` opts into joining an existing
|
|
4
|
+
* destination instead of refusing on collision — the same authority that
|
|
5
|
+
* already governs where a folder sits.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaFolderMoveOptions extends RequestOptions {
|
|
8
|
+
merge?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
/**
|
|
3
|
+
* `MediaFolders.rename()`'s options. `merge` opts into joining an existing
|
|
4
|
+
* destination instead of refusing on collision — the same authority that
|
|
5
|
+
* already governs where a folder sits.
|
|
6
|
+
*/
|
|
7
|
+
export interface MediaFolderMoveOptions extends RequestOptions {
|
|
8
|
+
merge?: boolean;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
import type { Transport } from "../transport/transport.cjs";
|
|
3
|
+
import type { MediaFolderDeleteOptions } from "./media-folder-delete.cjs";
|
|
4
|
+
import type { MediaFolderMoveOptions } from "./media-folder-move.cjs";
|
|
5
|
+
/** The media library's folder tree: `list`, `create`, `rename`/move,
|
|
6
|
+
* `delete`. A folder is an explicit record, so one can exist before
|
|
7
|
+
* anything is filed into it. */
|
|
8
|
+
export declare class MediaFolders {
|
|
9
|
+
private readonly transport;
|
|
10
|
+
constructor(transport: Transport);
|
|
11
|
+
list(options?: RequestOptions): Promise<string[]>;
|
|
12
|
+
/** Answers the path the server settled on. */
|
|
13
|
+
create(path: string, options?: RequestOptions): Promise<string>;
|
|
14
|
+
rename(from: string, to: string, options?: MediaFolderMoveOptions): Promise<{
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
}>;
|
|
18
|
+
/** The folder path is carried as `?path=`, not a path segment — it
|
|
19
|
+
* contains "/". `force` needs `recursive`: without it nothing here
|
|
20
|
+
* deletes anything, so there is nothing to force. */
|
|
21
|
+
delete(path: string, options?: MediaFolderDeleteOptions): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
import type { Transport } from "../transport/transport.js";
|
|
3
|
+
import type { MediaFolderDeleteOptions } from "./media-folder-delete.js";
|
|
4
|
+
import type { MediaFolderMoveOptions } from "./media-folder-move.js";
|
|
5
|
+
/** The media library's folder tree: `list`, `create`, `rename`/move,
|
|
6
|
+
* `delete`. A folder is an explicit record, so one can exist before
|
|
7
|
+
* anything is filed into it. */
|
|
8
|
+
export declare class MediaFolders {
|
|
9
|
+
private readonly transport;
|
|
10
|
+
constructor(transport: Transport);
|
|
11
|
+
list(options?: RequestOptions): Promise<string[]>;
|
|
12
|
+
/** Answers the path the server settled on. */
|
|
13
|
+
create(path: string, options?: RequestOptions): Promise<string>;
|
|
14
|
+
rename(from: string, to: string, options?: MediaFolderMoveOptions): Promise<{
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
}>;
|
|
18
|
+
/** The folder path is carried as `?path=`, not a path segment — it
|
|
19
|
+
* contains "/". `force` needs `recursive`: without it nothing here
|
|
20
|
+
* deletes anything, so there is nothing to force. */
|
|
21
|
+
delete(path: string, options?: MediaFolderDeleteOptions): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
import type { MediaPage } from "./media-page.cjs";
|
|
3
|
+
/** `Media.pages()`'s async-iterable: one whole `MediaPage` at a time,
|
|
4
|
+
* stopping once a page reports no more. */
|
|
5
|
+
export declare class MediaPageStream implements AsyncIterable<MediaPage> {
|
|
6
|
+
private readonly first;
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(first: () => Promise<MediaPage>, options?: RequestOptions);
|
|
9
|
+
[Symbol.asyncIterator](): AsyncIterator<MediaPage>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
import type { MediaPage } from "./media-page.js";
|
|
3
|
+
/** `Media.pages()`'s async-iterable: one whole `MediaPage` at a time,
|
|
4
|
+
* stopping once a page reports no more. */
|
|
5
|
+
export declare class MediaPageStream implements AsyncIterable<MediaPage> {
|
|
6
|
+
private readonly first;
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(first: () => Promise<MediaPage>, options?: RequestOptions);
|
|
9
|
+
[Symbol.asyncIterator](): AsyncIterator<MediaPage>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Page } from "../pagination/page.cjs";
|
|
2
|
+
import { PageWindow } from "../pagination/page-window.cjs";
|
|
3
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
4
|
+
import type { Transport } from "../transport/transport.cjs";
|
|
5
|
+
import type { TransportQueryValue } from "../transport/transport-request.cjs";
|
|
6
|
+
import { MediaAsset } from "./media-asset.cjs";
|
|
7
|
+
/** One page of `Media.list()`: rows named `files`. Navigates by the
|
|
8
|
+
* window the server ECHOED, never the one requested. */
|
|
9
|
+
export declare class MediaPage extends Page<MediaAsset> {
|
|
10
|
+
private readonly transport;
|
|
11
|
+
private readonly wireQuery;
|
|
12
|
+
private constructor();
|
|
13
|
+
get files(): readonly MediaAsset[];
|
|
14
|
+
next(options?: RequestOptions): Promise<MediaPage | null>;
|
|
15
|
+
previous(options?: RequestOptions): Promise<MediaPage | null>;
|
|
16
|
+
/** `Media` builds `wireQuery` (already translated onto `q`/`ext`/etc.,
|
|
17
|
+
* without `limit`/`offset`) once; `next`/`previous` reuse it unchanged. */
|
|
18
|
+
static loadWindow(transport: Transport, wireQuery: Record<string, TransportQueryValue>, window: PageWindow, options?: RequestOptions): Promise<MediaPage>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Page } from "../pagination/page.js";
|
|
2
|
+
import { PageWindow } from "../pagination/page-window.js";
|
|
3
|
+
import type { RequestOptions } from "../request-options.js";
|
|
4
|
+
import type { Transport } from "../transport/transport.js";
|
|
5
|
+
import type { TransportQueryValue } from "../transport/transport-request.js";
|
|
6
|
+
import { MediaAsset } from "./media-asset.js";
|
|
7
|
+
/** One page of `Media.list()`: rows named `files`. Navigates by the
|
|
8
|
+
* window the server ECHOED, never the one requested. */
|
|
9
|
+
export declare class MediaPage extends Page<MediaAsset> {
|
|
10
|
+
private readonly transport;
|
|
11
|
+
private readonly wireQuery;
|
|
12
|
+
private constructor();
|
|
13
|
+
get files(): readonly MediaAsset[];
|
|
14
|
+
next(options?: RequestOptions): Promise<MediaPage | null>;
|
|
15
|
+
previous(options?: RequestOptions): Promise<MediaPage | null>;
|
|
16
|
+
/** `Media` builds `wireQuery` (already translated onto `q`/`ext`/etc.,
|
|
17
|
+
* without `limit`/`offset`) once; `next`/`previous` reuse it unchanged. */
|
|
18
|
+
static loadWindow(transport: Transport, wireQuery: Record<string, TransportQueryValue>, window: PageWindow, options?: RequestOptions): Promise<MediaPage>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Media.list()`'s search, in client-facing names. `Media` translates these
|
|
3
|
+
* onto the wire's `q`, `ext`, `modified_after` and `modified_before` — the
|
|
4
|
+
* same rule the response mapper follows, applied to a request instead.
|
|
5
|
+
*/
|
|
6
|
+
export interface MediaQuery {
|
|
7
|
+
/** Substring match on the filename; the wire's `q`. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Exact folder, or every folder beneath it when `recursive` is set. */
|
|
10
|
+
folder?: string;
|
|
11
|
+
recursive?: boolean;
|
|
12
|
+
/** Substring match on the content type, e.g. "image/" or "pdf". */
|
|
13
|
+
type?: string;
|
|
14
|
+
/** Exact file extension, no dot; the wire's `ext`. */
|
|
15
|
+
extension?: string;
|
|
16
|
+
tag?: string;
|
|
17
|
+
/** Inclusive ISO-8601 bounds on `updated_at`. */
|
|
18
|
+
modifiedAfter?: string;
|
|
19
|
+
modifiedBefore?: string;
|
|
20
|
+
limit?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
/** "-created_at" (default), "created_at", "filename", "-filename", "size", "-size". */
|
|
23
|
+
sort?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Media.list()`'s search, in client-facing names. `Media` translates these
|
|
3
|
+
* onto the wire's `q`, `ext`, `modified_after` and `modified_before` — the
|
|
4
|
+
* same rule the response mapper follows, applied to a request instead.
|
|
5
|
+
*/
|
|
6
|
+
export interface MediaQuery {
|
|
7
|
+
/** Substring match on the filename; the wire's `q`. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Exact folder, or every folder beneath it when `recursive` is set. */
|
|
10
|
+
folder?: string;
|
|
11
|
+
recursive?: boolean;
|
|
12
|
+
/** Substring match on the content type, e.g. "image/" or "pdf". */
|
|
13
|
+
type?: string;
|
|
14
|
+
/** Exact file extension, no dot; the wire's `ext`. */
|
|
15
|
+
extension?: string;
|
|
16
|
+
tag?: string;
|
|
17
|
+
/** Inclusive ISO-8601 bounds on `updated_at`. */
|
|
18
|
+
modifiedAfter?: string;
|
|
19
|
+
modifiedBefore?: string;
|
|
20
|
+
limit?: number;
|
|
21
|
+
offset?: number;
|
|
22
|
+
/** "-created_at" (default), "created_at", "filename", "-filename", "size", "-size". */
|
|
23
|
+
sort?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `silo://media/<id>` scheme an entry field holds to name a catalogued
|
|
3
|
+
* asset — the client-side counterpart to `@silo/shared`'s `MediaRef`, not
|
|
4
|
+
* imported here since this package ships zero runtime dependencies.
|
|
5
|
+
*
|
|
6
|
+
* Recognises only the canonical scheme form, deliberately narrower than the
|
|
7
|
+
* server's `MediaRef`: a client either builds a reference itself or reads one
|
|
8
|
+
* back verbatim, so accepting `asset.url` would let "I stored the wrong
|
|
9
|
+
* property" keep working until the first rename.
|
|
10
|
+
*/
|
|
11
|
+
export declare class MediaReference {
|
|
12
|
+
private static readonly Scheme;
|
|
13
|
+
/** Builds the reference to store in an entry field: `silo://media/<id>`. */
|
|
14
|
+
static of(id: string): string;
|
|
15
|
+
/** The asset id a `silo://media/` reference names, or `null` if `value`
|
|
16
|
+
* is not one. A trailing fragment, query or path segment is ignored. */
|
|
17
|
+
static idOf(value: unknown): string | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `silo://media/<id>` scheme an entry field holds to name a catalogued
|
|
3
|
+
* asset — the client-side counterpart to `@silo/shared`'s `MediaRef`, not
|
|
4
|
+
* imported here since this package ships zero runtime dependencies.
|
|
5
|
+
*
|
|
6
|
+
* Recognises only the canonical scheme form, deliberately narrower than the
|
|
7
|
+
* server's `MediaRef`: a client either builds a reference itself or reads one
|
|
8
|
+
* back verbatim, so accepting `asset.url` would let "I stored the wrong
|
|
9
|
+
* property" keep working until the first rename.
|
|
10
|
+
*/
|
|
11
|
+
export declare class MediaReference {
|
|
12
|
+
private static readonly Scheme;
|
|
13
|
+
/** Builds the reference to store in an entry field: `silo://media/<id>`. */
|
|
14
|
+
static of(id: string): string;
|
|
15
|
+
/** The asset id a `silo://media/` reference names, or `null` if `value`
|
|
16
|
+
* is not one. A trailing fragment, query or path segment is ignored. */
|
|
17
|
+
static idOf(value: unknown): string | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowStream } from "../pagination/row-stream.cjs";
|
|
2
|
+
import type { MediaAsset } from "./media-asset.cjs";
|
|
3
|
+
/** `Media.all()`'s async-iterable: one `MediaAsset` at a time, paging by the
|
|
4
|
+
* window the server echoes. No behaviour of its own — the named type
|
|
5
|
+
* is what `Media.all()` answers. */
|
|
6
|
+
export declare class MediaStream extends RowStream<MediaAsset> {
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowStream } from "../pagination/row-stream.js";
|
|
2
|
+
import type { MediaAsset } from "./media-asset.js";
|
|
3
|
+
/** `Media.all()`'s async-iterable: one `MediaAsset` at a time, paging by the
|
|
4
|
+
* window the server echoes. No behaviour of its own — the named type
|
|
5
|
+
* is what `Media.all()` answers. */
|
|
6
|
+
export declare class MediaStream extends RowStream<MediaAsset> {
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.cjs";
|
|
2
|
+
/** The fully-described upload: everything about the file given explicitly,
|
|
3
|
+
* including its name — the only form usable with raw bytes. */
|
|
4
|
+
export interface MediaUploadBytes {
|
|
5
|
+
bytes: Uint8Array | ArrayBuffer | Blob;
|
|
6
|
+
filename: string;
|
|
7
|
+
contentType?: string;
|
|
8
|
+
folder?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Where a `File`/`Blob` upload lands, and the filename to record when the
|
|
11
|
+
* input carries none — a `File` already has `.name`; a bare `Blob` does not. */
|
|
12
|
+
export interface MediaUploadFileOptions extends RequestOptions {
|
|
13
|
+
folder?: string;
|
|
14
|
+
filename?: string;
|
|
15
|
+
}
|
|
16
|
+
/** `Media.upload()`'s input: a fully-described upload, or a runtime
|
|
17
|
+
* `File`/`Blob`, sent with the runtime's own `FormData` and `Blob`. */
|
|
18
|
+
export type MediaUpload = MediaUploadBytes | File | Blob;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RequestOptions } from "../request-options.js";
|
|
2
|
+
/** The fully-described upload: everything about the file given explicitly,
|
|
3
|
+
* including its name — the only form usable with raw bytes. */
|
|
4
|
+
export interface MediaUploadBytes {
|
|
5
|
+
bytes: Uint8Array | ArrayBuffer | Blob;
|
|
6
|
+
filename: string;
|
|
7
|
+
contentType?: string;
|
|
8
|
+
folder?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Where a `File`/`Blob` upload lands, and the filename to record when the
|
|
11
|
+
* input carries none — a `File` already has `.name`; a bare `Blob` does not. */
|
|
12
|
+
export interface MediaUploadFileOptions extends RequestOptions {
|
|
13
|
+
folder?: string;
|
|
14
|
+
filename?: string;
|
|
15
|
+
}
|
|
16
|
+
/** `Media.upload()`'s input: a fully-described upload, or a runtime
|
|
17
|
+
* `File`/`Blob`, sent with the runtime's own `FormData` and `Blob`. */
|
|
18
|
+
export type MediaUpload = MediaUploadBytes | File | Blob;
|