@anvilkit/plugin-asset-manager 0.1.7 → 0.1.8
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 +3 -3
- package/dist/adapters/data-url.d.cts +13 -0
- package/dist/adapters/data-url.d.cts.map +1 -1
- package/dist/adapters/data-url.d.ts +13 -0
- package/dist/adapters/data-url.d.ts.map +1 -1
- package/dist/adapters/in-memory.d.cts +8 -1
- package/dist/adapters/in-memory.d.cts.map +1 -1
- package/dist/adapters/in-memory.d.ts +8 -1
- package/dist/adapters/in-memory.d.ts.map +1 -1
- package/dist/i18n/entry.cjs +75 -0
- package/dist/i18n/entry.d.cts +15 -0
- package/dist/i18n/entry.d.cts.map +1 -0
- package/dist/i18n/entry.d.ts +15 -0
- package/dist/i18n/entry.d.ts.map +1 -0
- package/dist/i18n/entry.js +29 -0
- package/dist/i18n/provider.cjs +49 -0
- package/dist/i18n/provider.d.cts +20 -0
- package/dist/i18n/provider.d.cts.map +1 -0
- package/dist/i18n/provider.d.ts +20 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +11 -0
- package/dist/plugin.cjs +3 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +3 -1
- package/dist/sources/composite-source.cjs +4 -3
- package/dist/sources/composite-source.d.cts.map +1 -1
- package/dist/sources/composite-source.d.ts.map +1 -1
- package/dist/sources/composite-source.js +4 -3
- package/dist/sources/federated-search.cjs +16 -6
- package/dist/sources/federated-search.d.cts.map +1 -1
- package/dist/sources/federated-search.d.ts.map +1 -1
- package/dist/sources/federated-search.js +16 -6
- package/dist/sources/unsplash/index.cjs +6 -4
- package/dist/sources/unsplash/index.d.cts.map +1 -1
- package/dist/sources/unsplash/index.d.ts.map +1 -1
- package/dist/sources/unsplash/index.js +6 -4
- package/dist/types/types.d.cts +7 -1
- package/dist/types/types.d.cts.map +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/ui/AssetBrowser.cjs +175 -134
- package/dist/ui/AssetBrowser.d.cts.map +1 -1
- package/dist/ui/AssetBrowser.d.ts.map +1 -1
- package/dist/ui/AssetBrowser.js +175 -134
- package/dist/ui/AssetCommandPalette.cjs +20 -18
- package/dist/ui/AssetCommandPalette.d.cts.map +1 -1
- package/dist/ui/AssetCommandPalette.d.ts.map +1 -1
- package/dist/ui/AssetCommandPalette.js +20 -18
- package/dist/ui/AssetManagerUI.cjs +23 -15
- package/dist/ui/AssetManagerUI.d.cts.map +1 -1
- package/dist/ui/AssetManagerUI.d.ts.map +1 -1
- package/dist/ui/AssetManagerUI.js +23 -15
- package/dist/ui/DeleteAssetDialog.cjs +5 -3
- package/dist/ui/DeleteAssetDialog.d.cts.map +1 -1
- package/dist/ui/DeleteAssetDialog.d.ts.map +1 -1
- package/dist/ui/DeleteAssetDialog.js +5 -3
- package/dist/ui/DeleteFolderDialog.cjs +6 -4
- package/dist/ui/DeleteFolderDialog.d.cts.map +1 -1
- package/dist/ui/DeleteFolderDialog.d.ts.map +1 -1
- package/dist/ui/DeleteFolderDialog.js +6 -4
- package/dist/ui/EmptyFolderState.cjs +6 -3
- package/dist/ui/EmptyFolderState.d.cts +1 -1
- package/dist/ui/EmptyFolderState.d.cts.map +1 -1
- package/dist/ui/EmptyFolderState.d.ts +1 -1
- package/dist/ui/EmptyFolderState.d.ts.map +1 -1
- package/dist/ui/EmptyFolderState.js +6 -3
- package/dist/ui/FolderBreadcrumb.cjs +7 -4
- package/dist/ui/FolderBreadcrumb.d.cts.map +1 -1
- package/dist/ui/FolderBreadcrumb.d.ts.map +1 -1
- package/dist/ui/FolderBreadcrumb.js +7 -4
- package/dist/ui/FolderNameDialog.cjs +19 -12
- package/dist/ui/FolderNameDialog.d.cts.map +1 -1
- package/dist/ui/FolderNameDialog.d.ts.map +1 -1
- package/dist/ui/FolderNameDialog.js +19 -12
- package/dist/ui/FolderTree.cjs +4 -2
- package/dist/ui/FolderTree.d.cts.map +1 -1
- package/dist/ui/FolderTree.d.ts.map +1 -1
- package/dist/ui/FolderTree.js +4 -2
- package/dist/ui/MetadataPanel.cjs +16 -13
- package/dist/ui/MetadataPanel.d.cts.map +1 -1
- package/dist/ui/MetadataPanel.d.ts.map +1 -1
- package/dist/ui/MetadataPanel.js +16 -13
- package/dist/ui/MoveTargetPicker.cjs +7 -4
- package/dist/ui/MoveTargetPicker.d.cts.map +1 -1
- package/dist/ui/MoveTargetPicker.d.ts.map +1 -1
- package/dist/ui/MoveTargetPicker.js +7 -4
- package/dist/ui/ReplaceAssetDialog.cjs +19 -17
- package/dist/ui/ReplaceAssetDialog.d.cts.map +1 -1
- package/dist/ui/ReplaceAssetDialog.d.ts.map +1 -1
- package/dist/ui/ReplaceAssetDialog.js +19 -17
- package/dist/ui/UnsplashPanel.cjs +15 -12
- package/dist/ui/UnsplashPanel.d.cts.map +1 -1
- package/dist/ui/UnsplashPanel.d.ts.map +1 -1
- package/dist/ui/UnsplashPanel.js +15 -12
- package/dist/ui/UploadButton.cjs +11 -8
- package/dist/ui/UploadButton.d.cts.map +1 -1
- package/dist/ui/UploadButton.d.ts.map +1 -1
- package/dist/ui/UploadButton.js +11 -8
- package/dist/ui/index.cjs +4 -0
- package/dist/ui/index.d.cts +1 -0
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/dist/utils/data-source.cjs +18 -5
- package/dist/utils/data-source.d.cts.map +1 -1
- package/dist/utils/data-source.d.ts.map +1 -1
- package/dist/utils/data-source.js +19 -6
- package/dist/utils/folders.cjs +107 -33
- package/dist/utils/folders.d.cts +7 -2
- package/dist/utils/folders.d.cts.map +1 -1
- package/dist/utils/folders.d.ts +7 -2
- package/dist/utils/folders.d.ts.map +1 -1
- package/dist/utils/folders.js +107 -33
- package/dist/utils/header-action.cjs +1 -1
- package/dist/utils/header-action.d.cts.map +1 -1
- package/dist/utils/header-action.d.ts.map +1 -1
- package/dist/utils/header-action.js +1 -1
- package/dist/utils/registry.cjs +23 -12
- package/dist/utils/registry.d.cts +16 -8
- package/dist/utils/registry.d.cts.map +1 -1
- package/dist/utils/registry.d.ts +16 -8
- package/dist/utils/registry.d.ts.map +1 -1
- package/dist/utils/registry.js +19 -8
- package/dist/utils/resolver.cjs +5 -4
- package/dist/utils/resolver.d.cts.map +1 -1
- package/dist/utils/resolver.d.ts.map +1 -1
- package/dist/utils/resolver.js +5 -4
- package/dist/utils/studio-asset-source.cjs +8 -2
- package/dist/utils/studio-asset-source.js +8 -2
- package/dist/version.cjs +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/i18n/messages/en.json +99 -0
- package/i18n/messages/ja.json +99 -0
- package/i18n/messages/ko.json +99 -0
- package/i18n/messages/zh.json +99 -0
- package/meta/config.json +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @anvilkit/plugin-asset-manager
|
|
2
2
|
|
|
3
|
-
> **Alpha (`0.1.
|
|
3
|
+
> **Alpha (`0.1.8`).** Public surface may still shift before `v1.0`. Bundle budgets enforced in CI: headless entry ≤ 8 KB gzip, UI subpath ≤ 12 KB gzip, Unsplash subpath ≤ 4 KB gzip.
|
|
4
4
|
|
|
5
5
|
Headless asset manager plugin for Anvilkit Studio. The host provides the upload backend; the plugin handles validation, registration, search, IR-time resolution, CSP guidance, and (optionally) a React UI for the upload + browse experience. Designed for pluggable production backends (S3, GCS, custom HTTP) with strict trust-boundary enforcement on every adapter response.
|
|
6
6
|
|
|
@@ -103,8 +103,8 @@ interface UploadResult {
|
|
|
103
103
|
|
|
104
104
|
| Adapter | Use case | Notes |
|
|
105
105
|
| -------------------------- | ---------- | ---------------------------------------------------------------------------------------------------- |
|
|
106
|
-
| `dataUrlUploader(opts?)` | Dev, demos | `maxBytes` default 1 MB. Extracts image dimensions.
|
|
107
|
-
| `inMemoryUploader()` | Tests | Stores files in memory with `blob:` URLs.
|
|
106
|
+
| `dataUrlUploader(opts?)` | Dev, demos | `maxBytes` default 1 MB — bounds the **raw** file; the emitted base64 `data:` URL is ~33% larger and is held in memory + embedded inline in the IR/export. Extracts image dimensions. |
|
|
107
|
+
| `inMemoryUploader()` | Tests | Stores files in memory with `blob:` URLs. The object URLs are **never revoked** (no delete hook), so long upload/delete churn leaks — dev/test only. |
|
|
108
108
|
| `s3PresignedAdapter(opts)` | Production | POST `{ name, type, size }` to `presignEndpoint`; PUT file to returned `url`. Retries 5xx + network. |
|
|
109
109
|
|
|
110
110
|
`s3PresignedAdapter` options:
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { UploadAdapter } from "../types/types.js";
|
|
2
2
|
export interface DataUrlUploaderOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Maximum **raw file size** in bytes (default 1 MB). This bounds the input
|
|
5
|
+
* file, NOT the emitted `data:` URL: base64 encoding inflates the payload
|
|
6
|
+
* ~4/3, so a file at the cap becomes a ~1.33× larger string that is held in
|
|
7
|
+
* memory and embedded inline in the registry / IR / exported page (C3). Size
|
|
8
|
+
* the cap for the *encoded* footprint your target can carry.
|
|
9
|
+
*/
|
|
3
10
|
readonly maxBytes?: number;
|
|
4
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Dev/demo upload adapter that inlines the file as a `data:` URL. The result is
|
|
14
|
+
* self-contained (no host backend) but ~33% larger than the raw bytes once
|
|
15
|
+
* base64-encoded — see {@link DataUrlUploaderOptions.maxBytes}. Not for
|
|
16
|
+
* production; use `s3PresignedAdapter` or a custom `UploadAdapter` there.
|
|
17
|
+
*/
|
|
5
18
|
export declare function dataUrlUploader(options?: DataUrlUploaderOptions): UploadAdapter;
|
|
6
19
|
//# sourceMappingURL=data-url.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-url.d.cts","sourceRoot":"","sources":["../../src/adapters/data-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAIrE,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,wBAAgB,eAAe,CAC9B,OAAO,GAAE,sBAA2B,GAClC,aAAa,CA+Bf"}
|
|
1
|
+
{"version":3,"file":"data-url.d.cts","sourceRoot":"","sources":["../../src/adapters/data-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAIrE,MAAM,WAAW,sBAAsB;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,OAAO,GAAE,sBAA2B,GAClC,aAAa,CA+Bf"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { UploadAdapter } from "../types/types.js";
|
|
2
2
|
export interface DataUrlUploaderOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Maximum **raw file size** in bytes (default 1 MB). This bounds the input
|
|
5
|
+
* file, NOT the emitted `data:` URL: base64 encoding inflates the payload
|
|
6
|
+
* ~4/3, so a file at the cap becomes a ~1.33× larger string that is held in
|
|
7
|
+
* memory and embedded inline in the registry / IR / exported page (C3). Size
|
|
8
|
+
* the cap for the *encoded* footprint your target can carry.
|
|
9
|
+
*/
|
|
3
10
|
readonly maxBytes?: number;
|
|
4
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Dev/demo upload adapter that inlines the file as a `data:` URL. The result is
|
|
14
|
+
* self-contained (no host backend) but ~33% larger than the raw bytes once
|
|
15
|
+
* base64-encoded — see {@link DataUrlUploaderOptions.maxBytes}. Not for
|
|
16
|
+
* production; use `s3PresignedAdapter` or a custom `UploadAdapter` there.
|
|
17
|
+
*/
|
|
5
18
|
export declare function dataUrlUploader(options?: DataUrlUploaderOptions): UploadAdapter;
|
|
6
19
|
//# sourceMappingURL=data-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-url.d.ts","sourceRoot":"","sources":["../../src/adapters/data-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAIrE,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,wBAAgB,eAAe,CAC9B,OAAO,GAAE,sBAA2B,GAClC,aAAa,CA+Bf"}
|
|
1
|
+
{"version":3,"file":"data-url.d.ts","sourceRoot":"","sources":["../../src/adapters/data-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAIrE,MAAM,WAAW,sBAAsB;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,OAAO,GAAE,sBAA2B,GAClC,aAAa,CA+Bf"}
|
|
@@ -3,7 +3,14 @@ import type { UploadAdapter } from "../types/types.js";
|
|
|
3
3
|
* In-memory upload adapter for demos and tests. Returns a `blob:` URL
|
|
4
4
|
* that the consumer renders directly, so the object URL intentionally
|
|
5
5
|
* lives for the page lifetime — it cannot be revoked while the asset is
|
|
6
|
-
* still referenced.
|
|
6
|
+
* still referenced.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle caveat (C4): this is a stateless factory with no delete hook, so a
|
|
9
|
+
* `blob:` URL is never `URL.revokeObjectURL`-d — including when its asset is
|
|
10
|
+
* removed from the registry. Each upload pins its `File` in memory until the
|
|
11
|
+
* page unloads, so a long session that churns through many upload/delete cycles
|
|
12
|
+
* leaks. Acceptable for its dev/test purpose; use a real backend (e.g.
|
|
13
|
+
* `s3PresignedAdapter`) in production.
|
|
7
14
|
*/
|
|
8
15
|
export declare function inMemoryUploader(): UploadAdapter;
|
|
9
16
|
//# sourceMappingURL=in-memory.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.d.cts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE
|
|
1
|
+
{"version":3,"file":"in-memory.d.cts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CA8BhD"}
|
|
@@ -3,7 +3,14 @@ import type { UploadAdapter } from "../types/types.js";
|
|
|
3
3
|
* In-memory upload adapter for demos and tests. Returns a `blob:` URL
|
|
4
4
|
* that the consumer renders directly, so the object URL intentionally
|
|
5
5
|
* lives for the page lifetime — it cannot be revoked while the asset is
|
|
6
|
-
* still referenced.
|
|
6
|
+
* still referenced.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle caveat (C4): this is a stateless factory with no delete hook, so a
|
|
9
|
+
* `blob:` URL is never `URL.revokeObjectURL`-d — including when its asset is
|
|
10
|
+
* removed from the registry. Each upload pins its `File` in memory until the
|
|
11
|
+
* page unloads, so a long session that churns through many upload/delete cycles
|
|
12
|
+
* leaks. Acceptable for its dev/test purpose; use a real backend (e.g.
|
|
13
|
+
* `s3PresignedAdapter`) in production.
|
|
7
14
|
*/
|
|
8
15
|
export declare function inMemoryUploader(): UploadAdapter;
|
|
9
16
|
//# sourceMappingURL=in-memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE
|
|
1
|
+
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/adapters/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AAGrE;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CA8BhD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
ASSET_MANAGER_ENTRY: ()=>ASSET_MANAGER_ENTRY
|
|
41
|
+
});
|
|
42
|
+
const en_json_namespaceObject = require("../../i18n/messages/en.json");
|
|
43
|
+
var en_json_default = /*#__PURE__*/ __webpack_require__.n(en_json_namespaceObject);
|
|
44
|
+
const LOCALE_PACKS = {
|
|
45
|
+
zh: ()=>import("../../i18n/messages/zh.json", {
|
|
46
|
+
with: {
|
|
47
|
+
type: "json"
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
ja: ()=>import("../../i18n/messages/ja.json", {
|
|
51
|
+
with: {
|
|
52
|
+
type: "json"
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
ko: ()=>import("../../i18n/messages/ko.json", {
|
|
56
|
+
with: {
|
|
57
|
+
type: "json"
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
const ASSET_MANAGER_ENTRY = {
|
|
62
|
+
namespace: "assetManager",
|
|
63
|
+
en: en_json_default(),
|
|
64
|
+
loadMessages: async (locale)=>{
|
|
65
|
+
const pack = LOCALE_PACKS[locale];
|
|
66
|
+
return void 0 === pack ? {} : (await pack()).default;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.ASSET_MANAGER_ENTRY = __webpack_exports__.ASSET_MANAGER_ENTRY;
|
|
70
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
71
|
+
"ASSET_MANAGER_ENTRY"
|
|
72
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
73
|
+
Object.defineProperty(exports, '__esModule', {
|
|
74
|
+
value: true
|
|
75
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The `assetManager` registry entry (pure data — no React).
|
|
3
|
+
*
|
|
4
|
+
* Message content lives in `messages/<locale>.json`; English ships inline
|
|
5
|
+
* and other locales lazy-load. Kept separate from `provider.tsx` so the
|
|
6
|
+
* headless `register()` can import {@link ASSET_MANAGER_ENTRY} without
|
|
7
|
+
* pulling the React `EditorI18nProvider` into the headless entry chunk.
|
|
8
|
+
*/
|
|
9
|
+
import type { RegistryEntry } from "@anvilkit/core/i18n";
|
|
10
|
+
import enMessages from "../../i18n/messages/en.json";
|
|
11
|
+
/** The registry entry contributed to the catalog (core prepends `studio.*`). */
|
|
12
|
+
export declare const ASSET_MANAGER_ENTRY: RegistryEntry;
|
|
13
|
+
/** Exact key union for the `AnvilkitMessages` augmentation. */
|
|
14
|
+
export type AssetManagerMessageKey = keyof typeof enMessages;
|
|
15
|
+
//# sourceMappingURL=entry.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.cts","sourceRoot":"","sources":["../../src/i18n/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD,OAAO,UAAU,MAAM,6BAA6B,CAAuB;AAW3E,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,EAAE,aAOjC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The `assetManager` registry entry (pure data — no React).
|
|
3
|
+
*
|
|
4
|
+
* Message content lives in `messages/<locale>.json`; English ships inline
|
|
5
|
+
* and other locales lazy-load. Kept separate from `provider.tsx` so the
|
|
6
|
+
* headless `register()` can import {@link ASSET_MANAGER_ENTRY} without
|
|
7
|
+
* pulling the React `EditorI18nProvider` into the headless entry chunk.
|
|
8
|
+
*/
|
|
9
|
+
import type { RegistryEntry } from "@anvilkit/core/i18n";
|
|
10
|
+
import enMessages from "../../i18n/messages/en.json";
|
|
11
|
+
/** The registry entry contributed to the catalog (core prepends `studio.*`). */
|
|
12
|
+
export declare const ASSET_MANAGER_ENTRY: RegistryEntry;
|
|
13
|
+
/** Exact key union for the `AnvilkitMessages` augmentation. */
|
|
14
|
+
export type AssetManagerMessageKey = keyof typeof enMessages;
|
|
15
|
+
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/i18n/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD,OAAO,UAAU,MAAM,6BAA6B,CAAuB;AAW3E,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,EAAE,aAOjC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import en from "../../i18n/messages/en.json" with {
|
|
2
|
+
type: "json"
|
|
3
|
+
};
|
|
4
|
+
const LOCALE_PACKS = {
|
|
5
|
+
zh: ()=>import("../../i18n/messages/zh.json", {
|
|
6
|
+
with: {
|
|
7
|
+
type: "json"
|
|
8
|
+
}
|
|
9
|
+
}),
|
|
10
|
+
ja: ()=>import("../../i18n/messages/ja.json", {
|
|
11
|
+
with: {
|
|
12
|
+
type: "json"
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
ko: ()=>import("../../i18n/messages/ko.json", {
|
|
16
|
+
with: {
|
|
17
|
+
type: "json"
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
const ASSET_MANAGER_ENTRY = {
|
|
22
|
+
namespace: "assetManager",
|
|
23
|
+
en: en,
|
|
24
|
+
loadMessages: async (locale)=>{
|
|
25
|
+
const pack = LOCALE_PACKS[locale];
|
|
26
|
+
return void 0 === pack ? {} : (await pack()).default;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export { ASSET_MANAGER_ENTRY };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
AssetManagerI18nProvider: ()=>AssetManagerI18nProvider
|
|
32
|
+
});
|
|
33
|
+
const i18n_namespaceObject = require("@anvilkit/core/i18n");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const external_entry_cjs_namespaceObject = require("./entry.cjs");
|
|
36
|
+
function AssetManagerI18nProvider({ children }) {
|
|
37
|
+
return /*#__PURE__*/ external_react_namespaceObject.createElement(i18n_namespaceObject.EditorI18nProvider, {
|
|
38
|
+
entries: [
|
|
39
|
+
external_entry_cjs_namespaceObject.ASSET_MANAGER_ENTRY
|
|
40
|
+
]
|
|
41
|
+
}, children);
|
|
42
|
+
}
|
|
43
|
+
exports.AssetManagerI18nProvider = __webpack_exports__.AssetManagerI18nProvider;
|
|
44
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
+
"AssetManagerI18nProvider"
|
|
46
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
47
|
+
Object.defineProperty(exports, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Standalone `assetManager` i18n provider + the `AnvilkitMessages`
|
|
3
|
+
* type augmentation.
|
|
4
|
+
*
|
|
5
|
+
* {@link AssetManagerI18nProvider} wraps the standalone `./ui` subpath
|
|
6
|
+
* (mounted outside `<Studio>`) so its `useMsg("assetManager.*")` calls
|
|
7
|
+
* resolve. Standalone mounts default to English; locale switching is a
|
|
8
|
+
* Studio (in-chrome) feature. In-chrome usage needs no wrapper —
|
|
9
|
+
* `register()` already contributes {@link ASSET_MANAGER_ENTRY}.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReactNode } from "react";
|
|
12
|
+
import { type AssetManagerMessageKey } from "./entry.js";
|
|
13
|
+
export declare function AssetManagerI18nProvider({ children, }: {
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
}): ReactNode;
|
|
16
|
+
declare module "@anvilkit/core/i18n" {
|
|
17
|
+
interface AnvilkitMessages extends Record<AssetManagerMessageKey, string> {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=provider.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.cts","sourceRoot":"","sources":["../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE9E,wBAAgB,wBAAwB,CAAC,EACxC,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,GAAG,SAAS,CAMZ;AAGD,OAAO,QAAQ,qBAAqB,CAAC;IACpC,UAAU,gBAAiB,SAAQ,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC;KAAG;CAC5E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Standalone `assetManager` i18n provider + the `AnvilkitMessages`
|
|
3
|
+
* type augmentation.
|
|
4
|
+
*
|
|
5
|
+
* {@link AssetManagerI18nProvider} wraps the standalone `./ui` subpath
|
|
6
|
+
* (mounted outside `<Studio>`) so its `useMsg("assetManager.*")` calls
|
|
7
|
+
* resolve. Standalone mounts default to English; locale switching is a
|
|
8
|
+
* Studio (in-chrome) feature. In-chrome usage needs no wrapper —
|
|
9
|
+
* `register()` already contributes {@link ASSET_MANAGER_ENTRY}.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReactNode } from "react";
|
|
12
|
+
import { type AssetManagerMessageKey } from "./entry.js";
|
|
13
|
+
export declare function AssetManagerI18nProvider({ children, }: {
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
}): ReactNode;
|
|
16
|
+
declare module "@anvilkit/core/i18n" {
|
|
17
|
+
interface AnvilkitMessages extends Record<AssetManagerMessageKey, string> {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/i18n/provider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE9E,wBAAgB,wBAAwB,CAAC,EACxC,QAAQ,GACR,EAAE;IACF,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC7B,GAAG,SAAS,CAMZ;AAGD,OAAO,QAAQ,qBAAqB,CAAC;IACpC,UAAU,gBAAiB,SAAQ,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC;KAAG;CAC5E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EditorI18nProvider } from "@anvilkit/core/i18n";
|
|
2
|
+
import { ASSET_MANAGER_ENTRY } from "./entry.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
function AssetManagerI18nProvider({ children }) {
|
|
5
|
+
return /*#__PURE__*/ __rspack_external_react.createElement(EditorI18nProvider, {
|
|
6
|
+
entries: [
|
|
7
|
+
ASSET_MANAGER_ENTRY
|
|
8
|
+
]
|
|
9
|
+
}, children);
|
|
10
|
+
}
|
|
11
|
+
export { AssetManagerI18nProvider };
|
package/dist/plugin.cjs
CHANGED
|
@@ -48,6 +48,7 @@ const external_react_namespaceObject = require("react");
|
|
|
48
48
|
const config_json_namespaceObject = require("../meta/config.json");
|
|
49
49
|
var config_json_default = /*#__PURE__*/ __webpack_require__.n(config_json_namespaceObject);
|
|
50
50
|
const in_memory_cjs_namespaceObject = require("./adapters/in-memory.cjs");
|
|
51
|
+
const entry_cjs_namespaceObject = require("./i18n/entry.cjs");
|
|
51
52
|
const asset_reference_cjs_namespaceObject = require("./utils/asset-reference.cjs");
|
|
52
53
|
const errors_cjs_namespaceObject = require("./utils/errors.cjs");
|
|
53
54
|
const header_action_cjs_namespaceObject = require("./utils/header-action.cjs");
|
|
@@ -75,7 +76,8 @@ function createAssetManagerPlugin(options = {}) {
|
|
|
75
76
|
});
|
|
76
77
|
return {
|
|
77
78
|
meta: META,
|
|
78
|
-
register (
|
|
79
|
+
register (ctx) {
|
|
80
|
+
ctx.registerMessages(entry_cjs_namespaceObject.ASSET_MANAGER_ENTRY);
|
|
79
81
|
const registration = {
|
|
80
82
|
meta: META,
|
|
81
83
|
headerActions: [
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,mBAAmB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,mBAAmB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAEX,aAAa,EAEb,YAAY,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAWlE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AA6BhC,wBAAgB,wBAAwB,CACvC,UAAU,SAAS,UAAU,GAAG,UAAU,EACzC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAAC,UAAU,CAAC,CA4F7D;AAED,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,UAAU,GAAG,UAAU,EAC1E,GAAG,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAClC,aAAa,GAAG,SAAS,CAG3B;AAED,wBAAsB,WAAW,CAAC,UAAU,SAAS,UAAU,GAAG,UAAU,EAC3E,GAAG,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACpC,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,YAAY,CAAC,CAwDvB;AAED,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC,GACrE,IAAI,CAmBN"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,mBAAmB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,mBAAmB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAEX,aAAa,EAEb,YAAY,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAWlE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AA6BhC,wBAAgB,wBAAwB,CACvC,UAAU,SAAS,UAAU,GAAG,UAAU,EACzC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAAC,UAAU,CAAC,CA4F7D;AAED,wBAAgB,gBAAgB,CAAC,UAAU,SAAS,UAAU,GAAG,UAAU,EAC1E,GAAG,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAClC,aAAa,GAAG,SAAS,CAG3B;AAED,wBAAsB,WAAW,CAAC,UAAU,SAAS,UAAU,GAAG,UAAU,EAC3E,GAAG,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACpC,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,YAAY,CAAC,CAwDvB;AAED,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,aAAa,CAAC,GACrE,IAAI,CAmBN"}
|
package/dist/plugin.js
CHANGED
|
@@ -4,6 +4,7 @@ import config from "../meta/config.json" with {
|
|
|
4
4
|
type: "json"
|
|
5
5
|
};
|
|
6
6
|
import { inMemoryUploader } from "./adapters/in-memory.js";
|
|
7
|
+
import { ASSET_MANAGER_ENTRY } from "./i18n/entry.js";
|
|
7
8
|
import { createAssetReference } from "./utils/asset-reference.js";
|
|
8
9
|
import { AssetValidationError } from "./utils/errors.js";
|
|
9
10
|
import { uploadAssetAction } from "./utils/header-action.js";
|
|
@@ -31,7 +32,8 @@ function createAssetManagerPlugin(options = {}) {
|
|
|
31
32
|
});
|
|
32
33
|
return {
|
|
33
34
|
meta: META,
|
|
34
|
-
register (
|
|
35
|
+
register (ctx) {
|
|
36
|
+
ctx.registerMessages(ASSET_MANAGER_ENTRY);
|
|
35
37
|
const registration = {
|
|
36
38
|
meta: META,
|
|
37
39
|
headerActions: [
|
|
@@ -122,9 +122,10 @@ function createCompositeAssetSource(options) {
|
|
|
122
122
|
},
|
|
123
123
|
subscribeStatus: (listener)=>source.subscribeStatus(listener),
|
|
124
124
|
async listThemes () {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const themeLists = await Promise.all(providers.flatMap((provider)=>"local" === provider.id ? [] : [
|
|
126
|
+
provider.listThemes()
|
|
127
|
+
]));
|
|
128
|
+
return themeLists.flat();
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composite-source.d.cts","sourceRoot":"","sources":["../../src/sources/composite-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAIX,iBAAiB,EAEjB,MA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IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,CAAC;IACpE,wFAAwF;IACxF,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACpD;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC9D,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5E,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC/D,YAAY,CACX,EAAE,EAAE,QAAQ,EACZ,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GACnC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1E,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,iCAAiC,GACxC,oBAAoB,CAiItB"}
|
|
@@ -90,9 +90,10 @@ function createCompositeAssetSource(options) {
|
|
|
90
90
|
},
|
|
91
91
|
subscribeStatus: (listener)=>source.subscribeStatus(listener),
|
|
92
92
|
async listThemes () {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const themeLists = await Promise.all(providers.flatMap((provider)=>"local" === provider.id ? [] : [
|
|
94
|
+
provider.listThemes()
|
|
95
|
+
]));
|
|
96
|
+
return themeLists.flat();
|
|
96
97
|
}
|
|
97
98
|
};
|
|
98
99
|
}
|
|
@@ -96,7 +96,7 @@ function compareEntries(a, b, field) {
|
|
|
96
96
|
if ("number" == typeof ka && "number" == typeof kb) return ka - kb;
|
|
97
97
|
return String(ka).localeCompare(String(kb));
|
|
98
98
|
}
|
|
99
|
-
function mergePages(pages, filter) {
|
|
99
|
+
function mergePages(pages, filter, carryForward = {}) {
|
|
100
100
|
const field = filter.sort?.field ?? "recent";
|
|
101
101
|
const comparable = "name" === field || "size" === field || "kind" === field;
|
|
102
102
|
const items = pages.flatMap((p)=>[
|
|
@@ -108,9 +108,13 @@ function mergePages(pages, filter) {
|
|
|
108
108
|
items.sort((a, b)=>compareEntries(a, b, field) * sign);
|
|
109
109
|
}
|
|
110
110
|
const total = pages.reduce((n, p)=>n + p.page.total, 0);
|
|
111
|
-
const sourceCursors = {
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const sourceCursors = {
|
|
112
|
+
...carryForward
|
|
113
|
+
};
|
|
114
|
+
const next = {
|
|
115
|
+
...carryForward
|
|
116
|
+
};
|
|
117
|
+
let hasNext = Object.keys(carryForward).length > 0;
|
|
114
118
|
for (const { provider, page } of pages){
|
|
115
119
|
sourceCursors[provider.id] = page.nextCursor;
|
|
116
120
|
if (void 0 !== page.nextCursor) {
|
|
@@ -137,14 +141,20 @@ async function federatedSearch(input) {
|
|
|
137
141
|
const cursors = decodeCompositeCursor(filter.cursor);
|
|
138
142
|
const settled = await Promise.allSettled(targets.map((p)=>p.search(filter, cursors[p.id], signal)));
|
|
139
143
|
const ok = [];
|
|
144
|
+
const carryForward = {};
|
|
140
145
|
settled.forEach((result, index)=>{
|
|
141
146
|
const provider = targets[index];
|
|
142
|
-
if (void 0
|
|
147
|
+
if (void 0 === provider) return;
|
|
148
|
+
if ("fulfilled" === result.status) ok.push({
|
|
143
149
|
provider,
|
|
144
150
|
page: result.value
|
|
145
151
|
});
|
|
152
|
+
else {
|
|
153
|
+
const incoming = cursors[provider.id];
|
|
154
|
+
if (void 0 !== incoming) carryForward[provider.id] = incoming;
|
|
155
|
+
}
|
|
146
156
|
});
|
|
147
|
-
return mergePages(ok, filter);
|
|
157
|
+
return mergePages(ok, filter, carryForward);
|
|
148
158
|
}
|
|
149
159
|
exports.createLocalProvider = __webpack_exports__.createLocalProvider;
|
|
150
160
|
exports.decodeCompositeCursor = __webpack_exports__.decodeCompositeCursor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"federated-search.d.cts","sourceRoot":"","sources":["../../src/sources/federated-search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAY1D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAErE;AAED,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,GAAG,SAAS,GACvB,eAAe,CAUjB;AAED,uFAAuF;AACvF,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,WAAW,GACjB,OAAO,CAKT;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,uBAAuB,EAC/B,QAAQ,EAAE,aAAa,EACvB,KAAK,SAAgC,GACnC,mBAAmB,CAqBrB;
|
|
1
|
+
{"version":3,"file":"federated-search.d.cts","sourceRoot":"","sources":["../../src/sources/federated-search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,E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AE,uBAAuB,EAC/B,QAAQ,EAAE,aAAa,EACvB,KAAK,SAAgC,GACnC,mBAAmB,CAqBrB;AAmED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACpC,KAAK,EAAE,oBAAoB,GACzB,OAAO,CAAC,aAAa,CAAC,CAqCxB"}
|
|
@@ -60,7 +60,7 @@ function compareEntries(a, b, field) {
|
|
|
60
60
|
if ("number" == typeof ka && "number" == typeof kb) return ka - kb;
|
|
61
61
|
return String(ka).localeCompare(String(kb));
|
|
62
62
|
}
|
|
63
|
-
function mergePages(pages, filter) {
|
|
63
|
+
function mergePages(pages, filter, carryForward = {}) {
|
|
64
64
|
const field = filter.sort?.field ?? "recent";
|
|
65
65
|
const comparable = "name" === field || "size" === field || "kind" === field;
|
|
66
66
|
const items = pages.flatMap((p)=>[
|
|
@@ -72,9 +72,13 @@ function mergePages(pages, filter) {
|
|
|
72
72
|
items.sort((a, b)=>compareEntries(a, b, field) * sign);
|
|
73
73
|
}
|
|
74
74
|
const total = pages.reduce((n, p)=>n + p.page.total, 0);
|
|
75
|
-
const sourceCursors = {
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const sourceCursors = {
|
|
76
|
+
...carryForward
|
|
77
|
+
};
|
|
78
|
+
const next = {
|
|
79
|
+
...carryForward
|
|
80
|
+
};
|
|
81
|
+
let hasNext = Object.keys(carryForward).length > 0;
|
|
78
82
|
for (const { provider, page } of pages){
|
|
79
83
|
sourceCursors[provider.id] = page.nextCursor;
|
|
80
84
|
if (void 0 !== page.nextCursor) {
|
|
@@ -101,13 +105,19 @@ async function federatedSearch(input) {
|
|
|
101
105
|
const cursors = decodeCompositeCursor(filter.cursor);
|
|
102
106
|
const settled = await Promise.allSettled(targets.map((p)=>p.search(filter, cursors[p.id], signal)));
|
|
103
107
|
const ok = [];
|
|
108
|
+
const carryForward = {};
|
|
104
109
|
settled.forEach((result, index)=>{
|
|
105
110
|
const provider = targets[index];
|
|
106
|
-
if (void 0
|
|
111
|
+
if (void 0 === provider) return;
|
|
112
|
+
if ("fulfilled" === result.status) ok.push({
|
|
107
113
|
provider,
|
|
108
114
|
page: result.value
|
|
109
115
|
});
|
|
116
|
+
else {
|
|
117
|
+
const incoming = cursors[provider.id];
|
|
118
|
+
if (void 0 !== incoming) carryForward[provider.id] = incoming;
|
|
119
|
+
}
|
|
110
120
|
});
|
|
111
|
-
return mergePages(ok, filter);
|
|
121
|
+
return mergePages(ok, filter, carryForward);
|
|
112
122
|
}
|
|
113
123
|
export { createLocalProvider, decodeCompositeCursor, encodeCompositeCursor, federatedSearch, providerCanSatisfy };
|