@toa.io/boot 1.0.0-alpha.274 → 1.0.0-alpha.278
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 +17 -0
- package/package.json +10 -10
- package/src/atom.js +3 -7
- package/src/atomicity.js +2 -6
- package/src/bindings/broadcast.js +3 -6
- package/src/bindings/constants.js +1 -3
- package/src/bindings/consume.js +5 -8
- package/src/bindings/emit.js +3 -6
- package/src/bindings/factory.js +5 -9
- package/src/bindings/index.js +5 -13
- package/src/bindings/produce.js +12 -14
- package/src/bindings/receive.js +3 -6
- package/src/bridge.js +16 -22
- package/src/call.js +4 -8
- package/src/cascade.js +3 -7
- package/src/component.js +8 -12
- package/src/composition.js +8 -12
- package/src/context.js +3 -7
- package/src/contract.js +5 -8
- package/src/discovery.js +6 -11
- package/src/emission.js +8 -12
- package/src/env.js +4 -5
- package/src/events.js +1 -5
- package/src/exposition.js +3 -7
- package/src/extensions/aspects.js +3 -7
- package/src/extensions/component.js +2 -6
- package/src/extensions/context.js +2 -6
- package/src/extensions/emitter.js +2 -6
- package/src/extensions/index.js +9 -21
- package/src/extensions/instances.js +1 -3
- package/src/extensions/load.js +4 -8
- package/src/extensions/manage.js +2 -6
- package/src/extensions/receiver.js +2 -6
- package/src/extensions/resolve.js +36 -11
- package/src/extensions/storage.js +2 -6
- package/src/extensions/tenants.js +4 -8
- package/src/guards.js +3 -7
- package/src/index.js +27 -44
- package/src/manifest.js +17 -13
- package/src/manifest.test.js +7 -7
- package/src/operation.js +3 -15
- package/src/outbox.js +3 -7
- package/src/rc.js +2 -6
- package/src/receivers.js +10 -13
- package/src/remote.js +15 -10
- package/src/span.js +2 -6
- package/src/storage.js +11 -10
- package/types/index.d.ts +2 -2
- package/types/manifest.d.ts +1 -1
package/src/storage.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { createRequire } from 'node:module'
|
|
2
|
+
import { pathToFileURL } from 'node:url'
|
|
3
|
+
import * as extensions from './extensions/index.js'
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
// import.meta.resolve takes no paths, and the connector is resolved against the
|
|
6
|
+
// component that names it
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* @param {toa.norm.Component} manifest
|
|
8
11
|
* @param {boolean} outbox whether this component publishes anything, and so needs a place to
|
|
9
12
|
* commit it with the entity
|
|
10
13
|
*/
|
|
11
|
-
const storage = (manifest, outbox) => {
|
|
14
|
+
export const storage = async (manifest, outbox) => {
|
|
12
15
|
if (manifest.entity === undefined) return
|
|
13
16
|
|
|
14
|
-
const Factory = load(manifest)
|
|
17
|
+
const Factory = await load(manifest)
|
|
15
18
|
|
|
16
19
|
/** @type {toa.core.storages.Factory} */
|
|
17
20
|
const factory = new Factory()
|
|
@@ -20,12 +23,10 @@ const storage = (manifest, outbox) => {
|
|
|
20
23
|
return extensions.storage(storage)
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
function load (component) {
|
|
26
|
+
async function load (component) {
|
|
24
27
|
const reference = component.entity.storage
|
|
25
|
-
const path = require.resolve(reference, { paths: [component.path,
|
|
26
|
-
const { Factory } =
|
|
28
|
+
const path = require.resolve(reference, { paths: [component.path, import.meta.dirname] })
|
|
29
|
+
const { Factory } = await import(pathToFileURL(path).href)
|
|
27
30
|
|
|
28
31
|
return Factory
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
exports.storage = storage
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as core from '@toa.io/core'
|
|
2
|
-
import * as composition from './composition'
|
|
2
|
+
import * as composition from './composition.js'
|
|
3
3
|
|
|
4
|
-
export * as bindings from './bindings'
|
|
4
|
+
export * as bindings from './bindings.js'
|
|
5
5
|
|
|
6
6
|
export async function composition (paths: string[], options?: composition.Options): Promise<core.Connector>
|
|
7
7
|
|
package/types/manifest.d.ts
CHANGED