@scaleflex/dam-core 0.1.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 +34 -0
- package/dist/api/archive.service.d.ts +44 -0
- package/dist/api/archive.service.d.ts.map +1 -0
- package/dist/api/archive.test.d.ts +2 -0
- package/dist/api/archive.test.d.ts.map +1 -0
- package/dist/api/dam-client.d.ts +27 -0
- package/dist/api/dam-client.d.ts.map +1 -0
- package/dist/api/filerobot-browse.service.d.ts +84 -0
- package/dist/api/filerobot-browse.service.d.ts.map +1 -0
- package/dist/api/files.service.d.ts +63 -0
- package/dist/api/files.service.d.ts.map +1 -0
- package/dist/api/files.service.test.d.ts +2 -0
- package/dist/api/files.service.test.d.ts.map +1 -0
- package/dist/api/folders.service.d.ts +21 -0
- package/dist/api/folders.service.d.ts.map +1 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/labels.service.d.ts +10 -0
- package/dist/api/labels.service.d.ts.map +1 -0
- package/dist/api/variations.service.d.ts +23 -0
- package/dist/api/variations.service.d.ts.map +1 -0
- package/dist/api/variations.service.test.d.ts +2 -0
- package/dist/api/variations.service.test.d.ts.map +1 -0
- package/dist/auth/auth.service.d.ts +34 -0
- package/dist/auth/auth.service.d.ts.map +1 -0
- package/dist/auth/auth.service.test.d.ts +2 -0
- package/dist/auth/auth.service.test.d.ts.map +1 -0
- package/dist/auth/auth.types.d.ts +44 -0
- package/dist/auth/auth.types.d.ts.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/helpers/cdn.d.ts +50 -0
- package/dist/helpers/cdn.d.ts.map +1 -0
- package/dist/helpers/cdn.test.d.ts +2 -0
- package/dist/helpers/cdn.test.d.ts.map +1 -0
- package/dist/helpers/debounce.d.ts +4 -0
- package/dist/helpers/debounce.d.ts.map +1 -0
- package/dist/helpers/format.d.ts +7 -0
- package/dist/helpers/format.d.ts.map +1 -0
- package/dist/helpers/format.test.d.ts +2 -0
- package/dist/helpers/format.test.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +6 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/thumbnail.d.ts +19 -0
- package/dist/helpers/thumbnail.d.ts.map +1 -0
- package/dist/helpers/thumbnail.test.d.ts +2 -0
- package/dist/helpers/thumbnail.test.d.ts.map +1 -0
- package/dist/helpers/variations.d.ts +24 -0
- package/dist/helpers/variations.d.ts.map +1 -0
- package/dist/helpers/variations.test.d.ts +2 -0
- package/dist/helpers/variations.test.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1189 -0
- package/dist/index.js.map +1 -0
- package/dist/store/browse-store.d.ts +199 -0
- package/dist/store/browse-store.d.ts.map +1 -0
- package/dist/store/browse-store.test.d.ts +2 -0
- package/dist/store/browse-store.test.d.ts.map +1 -0
- package/dist/store/index.d.ts +4 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/local-favourites.d.ts +12 -0
- package/dist/store/local-favourites.d.ts.map +1 -0
- package/dist/types/api.types.d.ts +99 -0
- package/dist/types/api.types.d.ts.map +1 -0
- package/dist/types/asset.types.d.ts +20 -0
- package/dist/types/asset.types.d.ts.map +1 -0
- package/dist/types/filerobot.types.d.ts +133 -0
- package/dist/types/filerobot.types.d.ts.map +1 -0
- package/dist/types/folder.types.d.ts +10 -0
- package/dist/types/folder.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/label.types.d.ts +13 -0
- package/dist/types/label.types.d.ts.map +1 -0
- package/dist/types/variation.types.d.ts +28 -0
- package/dist/types/variation.types.d.ts.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @scaleflex/dam-core
|
|
2
|
+
|
|
3
|
+
Headless, framework-agnostic foundation for the Scaleflex DAM widgets. **No UI, no Lit, no
|
|
4
|
+
React — Fetch API only.** Everything every widget needs to talk to the Filerobot DAM
|
|
5
|
+
backend, in one place, so it isn't reimplemented (and allowed to drift) per widget.
|
|
6
|
+
|
|
7
|
+
## What's inside
|
|
8
|
+
|
|
9
|
+
- **`auth/`** — `resolveAuth`, `normalizeAuth`, `exchangeSassKey`, `buildAuthHeaders`,
|
|
10
|
+
`getApiBase`, and the `AuthConfig` union. Accepts the canonical (`container`) shape **and**
|
|
11
|
+
asset-picker's historical (`projectToken`) shape, normalizing the latter. See
|
|
12
|
+
[`plan/05`](../../plan/05-shared-core-design.md) + [`plan/11`](../../plan/11-deepdive-findings.md).
|
|
13
|
+
- **`api/`** — `DamClient` + `folders` / `files` / `labels` services.
|
|
14
|
+
- **`types/`** — `Asset`, `Folder`, `Label`, and API response envelopes.
|
|
15
|
+
- **`store/`** — headless observable `BrowseStore` + `FavouritesAdapter` /
|
|
16
|
+
`LocalFavouritesAdapter`.
|
|
17
|
+
- **`helpers/`** — CDN / thumbnail URL builders.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { resolveAuth, DamClient } from '@scaleflex/dam-core';
|
|
23
|
+
|
|
24
|
+
// Canonical shape (light-dam / uploader):
|
|
25
|
+
const resolved = await resolveAuth({ mode: 'sass-key', container: 'akli', sassKey: 'K' });
|
|
26
|
+
|
|
27
|
+
// asset-picker shape is accepted too and normalized automatically:
|
|
28
|
+
await resolveAuth({ mode: 'sassKey', projectToken: 'akli', sassKey: 'K' });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Conventions
|
|
32
|
+
|
|
33
|
+
This is the bottom of the dependency graph: it imports **nothing** internal. Keep it that
|
|
34
|
+
way. Domain types here are the contract every widget shares — change them deliberately.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { ArchiveStatusResponse } from '../types/api.types';
|
|
3
|
+
/** What to bundle. Any combination of file uuids, folder uuids, and raw CDN URLs. */
|
|
4
|
+
export interface ArchiveTarget {
|
|
5
|
+
filesUuids?: string[];
|
|
6
|
+
foldersUuids?: string[];
|
|
7
|
+
urls?: string[];
|
|
8
|
+
}
|
|
9
|
+
/** Kick off an archive job; resolves with its task id. */
|
|
10
|
+
export declare function createArchive(client: DamClient, target: ArchiveTarget): Promise<string>;
|
|
11
|
+
/** One status read of an archive job. */
|
|
12
|
+
export declare function getArchiveStatus(client: DamClient, taskId: string): Promise<ArchiveStatusResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Interpret an archive status payload. Pure — the heart of the poll loop, tested
|
|
15
|
+
* in isolation. Throws on a terminal failure status; returns `{done,progress}`
|
|
16
|
+
* otherwise (`done` only for DONE).
|
|
17
|
+
*/
|
|
18
|
+
export declare function archiveStatusOutcome(res: ArchiveStatusResponse): {
|
|
19
|
+
done: boolean;
|
|
20
|
+
progress: number;
|
|
21
|
+
};
|
|
22
|
+
export interface PollArchiveOptions {
|
|
23
|
+
/** Delay between status reads (default 1500ms). */
|
|
24
|
+
intervalMs?: number;
|
|
25
|
+
/** Give up after this long (default 120000ms). */
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
/** Tolerate this many transient status-read errors (the job may not be registered yet). */
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
/** Abort the poll early. */
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
/** Progress callback (0–100). */
|
|
32
|
+
onProgress?: (percent: number) => void;
|
|
33
|
+
/** Injectable sleep (tests pass an immediate resolver). */
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
/** Injectable clock (tests pass a controllable one). */
|
|
36
|
+
now?: () => number;
|
|
37
|
+
}
|
|
38
|
+
/** Poll an archive job until it reports DONE (or throws on failure/timeout/abort). */
|
|
39
|
+
export declare function pollArchive(client: DamClient, taskId: string, opts?: PollArchiveOptions): Promise<void>;
|
|
40
|
+
/** Build the authenticated direct-download URL for a finished archive. */
|
|
41
|
+
export declare function archiveDownloadUrl(client: DamClient, taskId: string): string;
|
|
42
|
+
/** Create → poll → resolve the authenticated download URL. */
|
|
43
|
+
export declare function createAndPollArchive(client: DamClient, target: ArchiveTarget, opts?: PollArchiveOptions): Promise<string>;
|
|
44
|
+
//# sourceMappingURL=archive.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.service.d.ts","sourceRoot":"","sources":["../../src/api/archive.service.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAyB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEvF,qFAAqF;AACrF,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,0DAA0D;AAC1D,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ7F;AAED,yCAAyC;AACzC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC,CAIhC;AAID;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG;IAChE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAMA;AAED,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iCAAiC;IACjC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,sFAAsF;AACtF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,8DAA8D;AAC9D,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.test.d.ts","sourceRoot":"","sources":["../../src/api/archive.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AuthConfig, ResolvedAuth } from '../auth';
|
|
2
|
+
type Params = Record<string, unknown>;
|
|
3
|
+
export declare class DamClient {
|
|
4
|
+
/** REST base, e.g. "https://api.filerobot.com/akli/v5". */
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
private headers;
|
|
7
|
+
private readonly auth?;
|
|
8
|
+
private readonly apiDomain?;
|
|
9
|
+
constructor(resolved: ResolvedAuth, auth?: AuthConfig, apiDomain?: string);
|
|
10
|
+
/** Resolve an AuthConfig (performing key exchange if needed) and build a client. */
|
|
11
|
+
static create(auth: AuthConfig, apiDomain?: string): Promise<DamClient>;
|
|
12
|
+
get<T>(path: string, params?: Params): Promise<T>;
|
|
13
|
+
post<T>(path: string, body: unknown): Promise<T>;
|
|
14
|
+
put<T>(path: string, body: unknown): Promise<T>;
|
|
15
|
+
delete<T>(path: string, body?: unknown): Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Absolute REST URL (incl. the `/v5` base) for a path — for building direct
|
|
18
|
+
* browser-download links (e.g. the archive ZIP) that bypass `fetch`.
|
|
19
|
+
*/
|
|
20
|
+
absoluteUrl(path: string): string;
|
|
21
|
+
/** The Filerobot key (`X-Filerobot-Key`), for query-param auth on direct downloads. */
|
|
22
|
+
get authKey(): string | undefined;
|
|
23
|
+
private sendJson;
|
|
24
|
+
private send;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=dam-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dam-client.d.ts","sourceRoot":"","sources":["../../src/api/dam-client.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AAIrE,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtC,qBAAa,SAAS;IACpB,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,OAAO,CAAc;IAE7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAS;gBAExB,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM;IAOzE,oFAAoF;WACvE,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAK7E,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAWjD,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/C,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAInD;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIjC,uFAAuF;IACvF,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,OAAO,CAAC,QAAQ;YAQF,IAAI;CAkDnB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { FilerobotAsset, FilerobotFolder } from '../types/filerobot.types';
|
|
3
|
+
export interface FilerobotFilesParams {
|
|
4
|
+
folder?: string;
|
|
5
|
+
offset?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
sort_by?: string;
|
|
8
|
+
sort_direction?: string;
|
|
9
|
+
/** Free-text search. */
|
|
10
|
+
search?: string;
|
|
11
|
+
/** Pre-serialized search/filter notation. */
|
|
12
|
+
q?: string;
|
|
13
|
+
recursive?: number;
|
|
14
|
+
/** Enable AI-powered semantic search. */
|
|
15
|
+
with_ai?: boolean;
|
|
16
|
+
ai_query?: string;
|
|
17
|
+
ai_lang?: string;
|
|
18
|
+
/** Filter by collection. */
|
|
19
|
+
collection_uuid?: string;
|
|
20
|
+
/** Base64-encoded collection-folder filter. */
|
|
21
|
+
f64?: string;
|
|
22
|
+
/** Extra computed fields (e.g. `cdn_permalink`); undefined → the default set. */
|
|
23
|
+
fields?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface FilerobotFilesResponse {
|
|
26
|
+
status: string;
|
|
27
|
+
msg?: string;
|
|
28
|
+
files: FilerobotAsset[];
|
|
29
|
+
folders: FilerobotFolder[];
|
|
30
|
+
base?: {
|
|
31
|
+
count?: {
|
|
32
|
+
files_direct?: number;
|
|
33
|
+
files_recursive?: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
info?: {
|
|
37
|
+
total_files_count?: number;
|
|
38
|
+
total_files_size?: number;
|
|
39
|
+
};
|
|
40
|
+
limit: number;
|
|
41
|
+
offset: number;
|
|
42
|
+
}
|
|
43
|
+
/** Fetch a page of files as the raw Filerobot wire response (no normalization). */
|
|
44
|
+
export declare function getFilesRaw(client: DamClient, params: FilerobotFilesParams): Promise<FilerobotFilesResponse>;
|
|
45
|
+
export interface FilerobotFilesStatsResponse {
|
|
46
|
+
status: string;
|
|
47
|
+
stats?: {
|
|
48
|
+
approx_files_count?: number;
|
|
49
|
+
approx_files_size?: number;
|
|
50
|
+
};
|
|
51
|
+
info?: {
|
|
52
|
+
total_files_count?: number;
|
|
53
|
+
total_files_size?: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export type FilerobotFilesStatsParams = Pick<FilerobotFilesParams, 'folder' | 'q' | 'search' | 'recursive' | 'with_ai' | 'ai_query' | 'ai_lang' | 'collection_uuid' | 'f64'>;
|
|
57
|
+
/** Approximate file count/size for a scope (the `/files/stats` endpoint). */
|
|
58
|
+
export declare function getFilesStats(client: DamClient, params: FilerobotFilesStatsParams): Promise<FilerobotFilesStatsResponse>;
|
|
59
|
+
export interface FilerobotFoldersParams {
|
|
60
|
+
folderPath?: string;
|
|
61
|
+
recursive?: number;
|
|
62
|
+
limit?: number;
|
|
63
|
+
offset?: number;
|
|
64
|
+
q?: string;
|
|
65
|
+
sort_by?: string;
|
|
66
|
+
sort_direction?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface FilerobotFoldersResponse {
|
|
69
|
+
status: string;
|
|
70
|
+
msg?: string;
|
|
71
|
+
folders: FilerobotFolder[];
|
|
72
|
+
total?: number;
|
|
73
|
+
}
|
|
74
|
+
/** Fetch folders as the raw Filerobot wire response (no normalization). */
|
|
75
|
+
export declare function getFoldersRaw(client: DamClient, params?: FilerobotFoldersParams): Promise<FilerobotFoldersResponse>;
|
|
76
|
+
export interface FolderPreview {
|
|
77
|
+
file_uuid: string;
|
|
78
|
+
file_uri_cdn: string;
|
|
79
|
+
file_type: string;
|
|
80
|
+
preview_origin: string;
|
|
81
|
+
}
|
|
82
|
+
/** Preview thumbnails for a set of folders (`POST /folders/previews`). */
|
|
83
|
+
export declare function getFolderPreviews(client: DamClient, folderUuids: string[]): Promise<Record<string, FolderPreview[]>>;
|
|
84
|
+
//# sourceMappingURL=filerobot-browse.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filerobot-browse.service.d.ts","sourceRoot":"","sources":["../../src/api/filerobot-browse.service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAKhF,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+CAA+C;IAC/C,GAAG,CA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AAE,yBAAyB,GAChC,OAAO,CAAC,2BAA2B,CAAC,CAetC;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,sBAA2B,GAClC,OAAO,CAAC,wBAAwB,CAAC,CAYnC;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAOD,0EAA0E;AAC1E,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,CAM1C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { Asset } from '../types/asset.types';
|
|
3
|
+
/** File-type categories the backend can filter on (`type:"image"` …). */
|
|
4
|
+
export type FileTypeFilter = 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
5
|
+
/** Coarse file-size buckets (in bytes), mapped to a `size:"min..max"` clause. */
|
|
6
|
+
export type SizeBucket = 'small' | 'medium' | 'large' | 'huge';
|
|
7
|
+
/** "Within the last …" presets for the created/modified date facets. */
|
|
8
|
+
export type DatePreset = 'today' | 'week' | 'month' | 'year';
|
|
9
|
+
export interface GetFilesParams {
|
|
10
|
+
folder?: string;
|
|
11
|
+
recursive?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
search?: string;
|
|
15
|
+
q?: string;
|
|
16
|
+
/** Restrict to these file-type categories (Filerobot `type:"…"` clause). */
|
|
17
|
+
types?: FileTypeFilter[];
|
|
18
|
+
/** Restrict to a file-size bucket (`size:"min..max"` clause). */
|
|
19
|
+
sizeBucket?: SizeBucket;
|
|
20
|
+
/** Only assets created within this window (`created>"…"` clause). */
|
|
21
|
+
createdWithin?: DatePreset;
|
|
22
|
+
/** Only assets modified within this window (`updated>"…"` clause). */
|
|
23
|
+
updatedWithin?: DatePreset;
|
|
24
|
+
sortBy?: 'created_at' | 'modified_at' | 'name' | 'size' | 'type';
|
|
25
|
+
sortDirection?: 'asc' | 'desc';
|
|
26
|
+
/** Additive computed fields; `cdn_permalink` must be requested explicitly. */
|
|
27
|
+
fields?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface FilesPage {
|
|
30
|
+
assets: Asset[];
|
|
31
|
+
/** Total matching the query (from the API when available, else this page's size). */
|
|
32
|
+
total: number;
|
|
33
|
+
}
|
|
34
|
+
/** One page of files. `total` is the API's grand total when provided, else this page's size. */
|
|
35
|
+
export declare function getFilesPage(client: DamClient, params?: GetFilesParams): Promise<FilesPage>;
|
|
36
|
+
export declare function getFiles(client: DamClient, params?: GetFilesParams): Promise<Asset[]>;
|
|
37
|
+
/** Subset of the facets that can also be evaluated client-side (favourites). */
|
|
38
|
+
export type FacetFilters = Pick<GetFilesParams, 'types' | 'sizeBucket' | 'createdWithin' | 'updatedWithin'>;
|
|
39
|
+
/**
|
|
40
|
+
* Does an already-loaded asset satisfy the facet filters? Used for the
|
|
41
|
+
* Favourites axis, which fetches a known uuid set directly and filters in
|
|
42
|
+
* memory rather than re-querying the server. Mirrors buildFilesQuery's clauses
|
|
43
|
+
* (shares SIZE_BUCKETS / sinceMidnight) so server- and client-side agree.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assetMatchesFacets(asset: Asset, f: FacetFilters, nowMs: number): boolean;
|
|
46
|
+
type SortField = NonNullable<GetFilesParams['sortBy']>;
|
|
47
|
+
/** Client-side sort matching the server's `sort=field:dir`, for the favourites set. */
|
|
48
|
+
export declare function sortAssets(assets: Asset[], sortBy: SortField, dir: 'asc' | 'desc'): Asset[];
|
|
49
|
+
/**
|
|
50
|
+
* Fetch specific files by uuid (one `GET /file/{uuid}` each, bounded concurrency).
|
|
51
|
+
* The Favourites axis is a known, usually-small uuid set, so this is far cheaper
|
|
52
|
+
* than scanning the whole library. Missing/forbidden uuids are skipped; results
|
|
53
|
+
* keep the input order (caller re-sorts as needed).
|
|
54
|
+
*/
|
|
55
|
+
export declare function getFilesByUuids(client: DamClient, uuids: string[], opts?: {
|
|
56
|
+
concurrency?: number;
|
|
57
|
+
fields?: string[];
|
|
58
|
+
}): Promise<Asset[]>;
|
|
59
|
+
export declare function renameFile(client: DamClient, uuid: string, newName: string): Promise<void>;
|
|
60
|
+
export declare function deleteFiles(client: DamClient, uuids: string[]): Promise<void>;
|
|
61
|
+
export declare function moveFiles(client: DamClient, uuids: string[], destinationFolder: string): Promise<void>;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=files.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.service.d.ts","sourceRoot":"","sources":["../../src/api/files.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAa,MAAM,sBAAsB,CAAC;AAG7D,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;AA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CAC7B,cAAc,EACd,OAAO,GAAG,YAAY,GAAG,eAAe,GAAG,eAAe,CAC3D,CAAC;AAcF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAiBxF;AAED,KAAK,SAAS,GAAG,WAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEvD,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,EAAE,CAqB3F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GACrD,OAAO,CAAC,KAAK,EAAE,CAAC,CAsBlB;AAQD,wBAAsB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhG;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnF;AAED,wBAAsB,SAAS,CAC7B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EAAE,EACf,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.service.test.d.ts","sourceRoot":"","sources":["../../src/api/files.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { Folder } from '../types/folder.types';
|
|
3
|
+
export interface GetFoldersParams {
|
|
4
|
+
folderPath?: string;
|
|
5
|
+
recursive?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
offset?: number;
|
|
8
|
+
q?: string;
|
|
9
|
+
sortBy?: 'created_at' | 'modified_at' | 'name';
|
|
10
|
+
sortDirection?: 'asc' | 'desc';
|
|
11
|
+
}
|
|
12
|
+
export declare function getFolders(client: DamClient, params?: GetFoldersParams): Promise<Folder[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Create a folder. The backend's `name` is a full path; we build it from
|
|
15
|
+
* parent + leaf. `parentFolderPath` is expected to start with `/`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createFolder(client: DamClient, leafName: string, parentFolderPath: string): Promise<void>;
|
|
18
|
+
export declare function renameFolder(client: DamClient, uuid: string, newName: string): Promise<void>;
|
|
19
|
+
export declare function deleteFolders(client: DamClient, uuids: string[]): Promise<void>;
|
|
20
|
+
export declare function moveFolders(client: DamClient, uuids: string[], destinationPath: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=folders.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folders.service.d.ts","sourceRoot":"","sources":["../../src/api/folders.service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,CAAC;IAC/C,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAChC;AAeD,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,gBAAqB,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC,CAYnB;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAKf;AAID,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrF;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EAAE,EACf,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { DamClient } from './dam-client';
|
|
2
|
+
export { getFolders, createFolder, renameFolder, deleteFolders, moveFolders, type GetFoldersParams, } from './folders.service';
|
|
3
|
+
export { getFiles, getFilesPage, getFilesByUuids, assetMatchesFacets, sortAssets, renameFile, deleteFiles, moveFiles, type GetFilesParams, type FilesPage, type FacetFilters, type FileTypeFilter, type SizeBucket, type DatePreset, } from './files.service';
|
|
4
|
+
export { getLabels, labelFilterQuery } from './labels.service';
|
|
5
|
+
export { getFileVariations, getPresets, normalizePresets, loadVariations, } from './variations.service';
|
|
6
|
+
export { createArchive, getArchiveStatus, archiveStatusOutcome, pollArchive, archiveDownloadUrl, createAndPollArchive, type ArchiveTarget, type PollArchiveOptions, } from './archive.service';
|
|
7
|
+
export { getFilesRaw, getFilesStats, getFoldersRaw, getFolderPreviews, type FilerobotFilesParams, type FilerobotFilesResponse, type FilerobotFilesStatsParams, type FilerobotFilesStatsResponse, type FilerobotFoldersParams, type FilerobotFoldersResponse, type FolderPreview, } from './filerobot-browse.service';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { Label } from '../types/label.types';
|
|
3
|
+
export declare function getLabels(client: DamClient): Promise<Label[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Build the Files API query that filters by a label, mirroring asset-picker:
|
|
6
|
+
* `q=labels:{sid}` with the leading "#" stripped from the label's sid.
|
|
7
|
+
* Returns undefined for a label with no usable sid (caller skips the filter).
|
|
8
|
+
*/
|
|
9
|
+
export declare function labelFilterQuery(label: Label): string | undefined;
|
|
10
|
+
//# sourceMappingURL=labels.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.service.d.ts","sourceRoot":"","sources":["../../src/api/labels.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAOlD,wBAAsB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAGnE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAGjE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DamClient } from './dam-client';
|
|
2
|
+
import { Asset } from '../types/asset.types';
|
|
3
|
+
import { Variation, Preset } from '../types/variation.types';
|
|
4
|
+
import { RawVariation, RawPreset } from '../types/api.types';
|
|
5
|
+
/** List a file's raw variations (custom + background-removed renditions). */
|
|
6
|
+
export declare function getFileVariations(client: DamClient, uuid: string): Promise<RawVariation[]>;
|
|
7
|
+
/** Normalize the various preset shapes (`string` | `{ name, desc }`) into `Preset[]`. */
|
|
8
|
+
export declare function normalizePresets(raw: RawPreset[] | undefined): Preset[];
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the container's resolution presets from `/settings`. The presets array
|
|
11
|
+
* lives under the container's cloudimg config; its exact nesting varies by
|
|
12
|
+
* deployment, so we probe the known locations defensively (verify against a live
|
|
13
|
+
* container — Q-AP presets).
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPresets(client: DamClient): Promise<Preset[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Convenience: fetch a file's variants + the container presets and assemble the
|
|
18
|
+
* full ordered `Variation[]` (Original + custom + background-removed + presets).
|
|
19
|
+
* Hosts that already hold variants/presets can call `assembleVariations` directly
|
|
20
|
+
* instead (the fetch-or-inject contract).
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadVariations(client: DamClient, asset: Asset): Promise<Variation[]>;
|
|
23
|
+
//# sourceMappingURL=variations.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variations.service.d.ts","sourceRoot":"","sources":["../../src/api/variations.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAGV,YAAY,EACZ,SAAS,EACV,MAAM,oBAAoB,CAAC;AAG5B,6EAA6E;AAC7E,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAKhG;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAWvE;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKrE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAM1F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variations.service.test.d.ts","sourceRoot":"","sources":["../../src/api/variations.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AnyAuthConfig, AuthConfig, AuthHeaders, ResolvedAuth } from './auth.types';
|
|
2
|
+
/**
|
|
3
|
+
* Container base URL, e.g. "https://api.filerobot.com/akli".
|
|
4
|
+
* `apiDomain` overrides the default host. The REST client appends `/v5` to this
|
|
5
|
+
* for the Files/Folders API.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getApiBase(container: string, apiDomain?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Exchange a security template id for a short-lived SASS key.
|
|
10
|
+
*
|
|
11
|
+
* Resilience: the response is fetched with `cache: 'no-store'` (the key is
|
|
12
|
+
* short-lived and security-sensitive — never serve a cached key or a cached
|
|
13
|
+
* transient 404), and transient failures (404/408/429/5xx, network errors) are
|
|
14
|
+
* retried a few times with linear backoff. This fixes the intermittent
|
|
15
|
+
* "SASS key exchange failed (HTTP 404)" seen with a valid container + template.
|
|
16
|
+
*/
|
|
17
|
+
export declare function exchangeSassKey(container: string, securityTemplateId: string, apiDomain?: string, opts?: {
|
|
18
|
+
retries?: number;
|
|
19
|
+
retryDelayMs?: number;
|
|
20
|
+
}): Promise<string>;
|
|
21
|
+
/** Build auth headers from a (possibly resolved) SASS key. */
|
|
22
|
+
export declare function buildAuthHeaders(auth: AuthConfig, resolvedSassKey?: string): AuthHeaders;
|
|
23
|
+
/**
|
|
24
|
+
* Normalize any accepted auth shape onto the canonical {@link AuthConfig}. The canonical
|
|
25
|
+
* shape passes through untouched; asset-picker's `projectToken`/camelCase shape is mapped.
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeAuth(auth: AnyAuthConfig): AuthConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve any accepted auth shape into a ready-to-use base URL + headers.
|
|
30
|
+
* Accepts the canonical {@link AuthConfig} or asset-picker's {@link AssetPickerAuth}.
|
|
31
|
+
* For security-template mode this performs the SASS key exchange.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveAuth(auth: AnyAuthConfig, apiDomain?: string): Promise<ResolvedAuth>;
|
|
34
|
+
//# sourceMappingURL=auth.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EAEb,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,cAAc,CAAC;AA0BtB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAsBxF;AAOD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,CAiB7D;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAShG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.test.d.ts","sourceRoot":"","sources":["../../src/auth/auth.service.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface SecurityTemplateAuth {
|
|
2
|
+
mode: 'security-template';
|
|
3
|
+
/** Filerobot container / project token, e.g. "akli". */
|
|
4
|
+
container: string;
|
|
5
|
+
/** Security template id, exchanged for a short-lived SASS key at runtime. */
|
|
6
|
+
securityTemplateId: string;
|
|
7
|
+
airboxPuid?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SassKeyAuth {
|
|
10
|
+
mode: 'sass-key';
|
|
11
|
+
container: string;
|
|
12
|
+
/** Pre-resolved SASS key — used directly, no exchange. */
|
|
13
|
+
sassKey: string;
|
|
14
|
+
airboxPuid?: string;
|
|
15
|
+
}
|
|
16
|
+
export type AuthConfig = SecurityTemplateAuth | SassKeyAuth;
|
|
17
|
+
/**
|
|
18
|
+
* @scaleflex/asset-picker's historical auth shape. Accepted by {@link resolveAuth} for
|
|
19
|
+
* back-compat and normalized onto {@link AuthConfig}. Field/mode mapping:
|
|
20
|
+
* `projectToken→container`, `securityTemplateKey→securityTemplateId`,
|
|
21
|
+
* `'securityTemplate'→'security-template'`, `'sassKey'→'sass-key'`.
|
|
22
|
+
*/
|
|
23
|
+
export type AssetPickerAuth = {
|
|
24
|
+
mode: 'securityTemplate';
|
|
25
|
+
projectToken: string;
|
|
26
|
+
securityTemplateKey: string;
|
|
27
|
+
airboxPuid?: string;
|
|
28
|
+
} | {
|
|
29
|
+
mode: 'sassKey';
|
|
30
|
+
projectToken: string;
|
|
31
|
+
sassKey: string;
|
|
32
|
+
airboxPuid?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Any auth shape {@link resolveAuth} accepts: canonical or the asset-picker variant. */
|
|
35
|
+
export type AnyAuthConfig = AuthConfig | AssetPickerAuth;
|
|
36
|
+
/** Headers attached to every Scaleflex/Filerobot API request. */
|
|
37
|
+
export type AuthHeaders = Record<string, string>;
|
|
38
|
+
/** Output of {@link resolveAuth}: a ready-to-use base URL + headers. */
|
|
39
|
+
export interface ResolvedAuth {
|
|
40
|
+
apiBase: string;
|
|
41
|
+
headers: AuthHeaders;
|
|
42
|
+
sassKey?: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=auth.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/auth/auth.types.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,oBAAoB,GAAG,WAAW,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,kBAAkB,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpF,yFAAyF;AACzF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,eAAe,CAAC;AAEzD,iEAAiE;AACjE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { AuthConfig, SecurityTemplateAuth, SassKeyAuth, AssetPickerAuth, AnyAuthConfig, AuthHeaders, ResolvedAuth, } from './auth.types';
|
|
2
|
+
export { resolveAuth, normalizeAuth, exchangeSassKey, getApiBase, buildAuthHeaders, } from './auth.service';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface TransformParams {
|
|
2
|
+
width?: number;
|
|
3
|
+
height?: number;
|
|
4
|
+
/** 1–100, or "auto". */
|
|
5
|
+
quality?: number | 'auto';
|
|
6
|
+
}
|
|
7
|
+
/** Append Filerobot CDN sizing params (w/h/q) to a permalink, preserving existing params. */
|
|
8
|
+
export declare function addCdnParams(cdnUrl: string, params: TransformParams): string;
|
|
9
|
+
/** Output formats the transform pipeline supports. */
|
|
10
|
+
export type DownloadFormat = 'webp' | 'jpeg' | 'png' | 'gif';
|
|
11
|
+
/** Quality presets → numeric `q` (JPEG/WEBP), matching the reference admin. */
|
|
12
|
+
export declare const QUALITY_LEVELS: {
|
|
13
|
+
readonly excellent: 90;
|
|
14
|
+
readonly good: 75;
|
|
15
|
+
readonly fair: 60;
|
|
16
|
+
};
|
|
17
|
+
export type QualityLevel = keyof typeof QUALITY_LEVELS;
|
|
18
|
+
/** Standardized resize presets (max box, in px); "Full HD" + the reference's large/medium/small. */
|
|
19
|
+
export declare const RESIZE_PRESETS: {
|
|
20
|
+
readonly fullhd: 1920;
|
|
21
|
+
readonly large: 1200;
|
|
22
|
+
readonly medium: 600;
|
|
23
|
+
readonly small: 300;
|
|
24
|
+
};
|
|
25
|
+
export type ResizePreset = keyof typeof RESIZE_PRESETS;
|
|
26
|
+
export interface TransformOptions {
|
|
27
|
+
format?: DownloadFormat;
|
|
28
|
+
/** Numeric q (1–100). Use QUALITY_LEVELS for the named presets. Omit for "Original" quality. */
|
|
29
|
+
quality?: number;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Aspect-ratio handling when width/height are set (the embed/options "lock" toggle).
|
|
34
|
+
* `true` → `func=bound` (fit inside the box, keep ratio); `false` → `func=cover`
|
|
35
|
+
* (fill the box, may crop). Omit to leave `func` off (the reference admin's default
|
|
36
|
+
* resize). Mirrors Portals' strict-size switch.
|
|
37
|
+
*/
|
|
38
|
+
strictSizes?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The downloaded file's name with the new extension (jpeg → jpg) when reformatting. */
|
|
41
|
+
export declare function transformedFileName(originalName: string, format?: DownloadFormat): string;
|
|
42
|
+
/**
|
|
43
|
+
* Build a CDN URL that serves the *transformed* asset as a download attachment.
|
|
44
|
+
* Uses `force_download=<name>` (not `download=1`, which bypasses transforms and
|
|
45
|
+
* returns the original) — same contract as the reference admin's getFileWithNewParams.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildTransformedDownloadUrl(cdnUrl: string, originalName: string, t?: TransformOptions): string;
|
|
48
|
+
/** Build a CDN URL for the transformed asset for embedding/linking (no download flag). */
|
|
49
|
+
export declare function buildEmbedUrl(cdnUrl: string, t?: TransformOptions): string;
|
|
50
|
+
//# sourceMappingURL=cdn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../../src/helpers/cdn.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB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ts","sourceRoot":"","sources":["../../src/helpers/debounce.ts"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EACzD,EAAE,EAAE,CAAC,EACL,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG;IAAE,MAAM,IAAI,IAAI,CAAA;CAAE,CASxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Human-readable byte size ("—" when unknown, e.g. "1.4 MB", "512 B"). */
|
|
2
|
+
export declare function formatFileSize(bytes?: number | null): string;
|
|
3
|
+
/** Short, locale-aware date ("—" when missing; echoes the raw value if unparseable). */
|
|
4
|
+
export declare function formatDate(iso?: string | null): string;
|
|
5
|
+
/** "W × H" pixel dimensions, or "—" when either side is missing. */
|
|
6
|
+
export declare function formatDimensions(width?: number | null, height?: number | null): string;
|
|
7
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/helpers/format.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CA0B5D;AAED,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKtD;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.test.d.ts","sourceRoot":"","sources":["../../src/helpers/format.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { addCdnParams, buildTransformedDownloadUrl, buildEmbedUrl, transformedFileName, QUALITY_LEVELS, RESIZE_PRESETS, type TransformParams, type TransformOptions, type DownloadFormat, type QualityLevel, type ResizePreset, } from './cdn';
|
|
2
|
+
export { getThumbnailUrl, getFormattedPreviewUrl, getFileTypeIconUrl, getDefaultFileTypeIconUrl, } from './thumbnail';
|
|
3
|
+
export { formatFileSize, formatDate, formatDimensions } from './format';
|
|
4
|
+
export { debounce } from './debounce';
|
|
5
|
+
export { presetUrl, normalizeVariation, assembleVariations, type AssembleVariationsInput, } from './variations';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,OAAO,CAAC;AACf,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,cAAc,CAAC"}
|