@adonis-agora/media 0.10.2 → 0.10.3
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/CHANGELOG.md +16 -0
- package/dist/src/services/main.d.ts +10 -10
- package/dist/src/services/main.d.ts.map +1 -1
- package/dist/src/services/main.js +13 -13
- package/dist/src/services/main.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @adonis-agora/media
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fdfafea`](https://github.com/DavideCarvalho/adonis-media/commit/fdfafeabf618b2787a970c4b104af822dcec03fe) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `services/main` no longer throws when imported before `MediaProvider.register()`
|
|
8
|
+
|
|
9
|
+
The `@adonis-agora/media/services/main` singleton used a provider-captured `getBootedApp()` with a
|
|
10
|
+
top-level `await` — importing it before `MediaProvider.register()` ran (e.g. the ace command loader
|
|
11
|
+
reading command metadata during `node ace list`) threw `app accessed before MediaProvider registered`.
|
|
12
|
+
|
|
13
|
+
It now follows the ecosystem-standard pattern used by `@adonisjs/lucid`, `@adonisjs/drive` and
|
|
14
|
+
`@adonisjs/queue`: read the app from `@adonisjs/core/services/app` (whose binding is set by
|
|
15
|
+
`bin/server`/`bin/console` before any command module is imported) and capture the `MediaManager`
|
|
16
|
+
inside `app.booted(...)`. Importing the singleton is now safe at any time; the manager resolves once
|
|
17
|
+
the app boots.
|
|
18
|
+
|
|
3
19
|
## 0.10.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -9,17 +9,17 @@ import { MediaManager } from '../media_manager.js';
|
|
|
9
9
|
* await media.library.attach({ ownerType: 'Post', ownerId: '1', collection: 'gallery', ... })
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* `@adonisjs/
|
|
14
|
-
*
|
|
12
|
+
* Same pattern as `@adonisjs/lucid/services/db`, `@adonisjs/drive/services/main` and
|
|
13
|
+
* `@adonisjs/queue/services/main`: read the app from `@adonisjs/core/services/app` (whose binding is
|
|
14
|
+
* set by `bin/server`/`bin/console` before any command/route module is imported) and capture the
|
|
15
|
+
* manager inside `app.booted(...)`. This makes importing this module safe at ANY time — including
|
|
16
|
+
* the ace command loader reading command metadata before the app boots.
|
|
15
17
|
*
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* exists to fix. Importing this module before `MediaProvider.register()` has run now throws the same
|
|
22
|
-
* clear, actionable error {@link getBootedApp} gives everywhere else in this package.
|
|
18
|
+
* (Historical note: this module used a provider-captured `getBootedApp()` instead, because under a
|
|
19
|
+
* duplicated `@adonisjs/core` tree (pnpm dual-package hazard) `services/app`'s binding could resolve
|
|
20
|
+
* to a non-booted copy and stay `undefined`. That hazard is solved at the app level — the Lumen
|
|
21
|
+
* workspace pins `@adonisjs/core` to a single copy via `pnpm.overrides` — and the ecosystem-standard
|
|
22
|
+
* `services/app` pattern is what `lucid`/`drive`/`queue` use, so we align with it.)
|
|
23
23
|
*/
|
|
24
24
|
declare let media: MediaManager;
|
|
25
25
|
export { media as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/services/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/services/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,IAAI,KAAK,EAAE,YAAY,CAAC;AAMxB,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import app from '@adonisjs/core/services/app';
|
|
1
2
|
import { MediaManager } from '../media_manager.js';
|
|
2
|
-
import { getBootedApp } from './booted_app.js';
|
|
3
3
|
/**
|
|
4
4
|
* Service-singleton for the {@link MediaManager}, resolved from the container once the app has
|
|
5
5
|
* booted. Import it for a ready-to-use manager instead of resolving the binding by hand:
|
|
@@ -10,21 +10,21 @@ import { getBootedApp } from './booted_app.js';
|
|
|
10
10
|
* await media.library.attach({ ownerType: 'Post', ownerId: '1', collection: 'gallery', ... })
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* `@adonisjs/
|
|
15
|
-
*
|
|
13
|
+
* Same pattern as `@adonisjs/lucid/services/db`, `@adonisjs/drive/services/main` and
|
|
14
|
+
* `@adonisjs/queue/services/main`: read the app from `@adonisjs/core/services/app` (whose binding is
|
|
15
|
+
* set by `bin/server`/`bin/console` before any command/route module is imported) and capture the
|
|
16
|
+
* manager inside `app.booted(...)`. This makes importing this module safe at ANY time — including
|
|
17
|
+
* the ace command loader reading command metadata before the app boots.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* exists to fix. Importing this module before `MediaProvider.register()` has run now throws the same
|
|
23
|
-
* clear, actionable error {@link getBootedApp} gives everywhere else in this package.
|
|
19
|
+
* (Historical note: this module used a provider-captured `getBootedApp()` instead, because under a
|
|
20
|
+
* duplicated `@adonisjs/core` tree (pnpm dual-package hazard) `services/app`'s binding could resolve
|
|
21
|
+
* to a non-booted copy and stay `undefined`. That hazard is solved at the app level — the Lumen
|
|
22
|
+
* workspace pins `@adonisjs/core` to a single copy via `pnpm.overrides` — and the ecosystem-standard
|
|
23
|
+
* `services/app` pattern is what `lucid`/`drive`/`queue` use, so we align with it.)
|
|
24
24
|
*/
|
|
25
25
|
let media;
|
|
26
|
-
await
|
|
27
|
-
media = await
|
|
26
|
+
await app.booted(async () => {
|
|
27
|
+
media = await app.container.make(MediaManager);
|
|
28
28
|
});
|
|
29
29
|
export { media as default };
|
|
30
30
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/services/main.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/services/main.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,6BAA6B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAI,KAAmB,CAAC;AAExB,MAAM,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;IAC1B,KAAK,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/media",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe), and column attachments, all on top of @adonisjs/drive. Pluggable MediaStore (in-memory + Lucid) and ImageProcessor (sharp). Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|