every-plugin 2.10.1 → 3.0.0-rc.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/bin/every-plugin-serve.mjs +12 -0
- package/bin/every-plugin.mjs +59 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/build/artifact-names.cjs +119 -0
- package/dist/build/artifact-names.cjs.map +1 -0
- package/dist/build/artifact-names.d.cts +68 -0
- package/dist/build/artifact-names.d.cts.map +1 -0
- package/dist/build/artifact-names.d.mts +68 -0
- package/dist/build/artifact-names.d.mts.map +1 -0
- package/dist/build/artifact-names.mjs +102 -0
- package/dist/build/artifact-names.mjs.map +1 -0
- package/dist/build/contract-types.cjs +89 -0
- package/dist/build/contract-types.cjs.map +1 -0
- package/dist/build/contract-types.mjs +81 -0
- package/dist/build/contract-types.mjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.cjs +37 -0
- package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.cts +18 -0
- package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
- package/dist/build/rspack/build-report-plugin.d.mts +18 -0
- package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
- package/dist/build/rspack/build-report-plugin.mjs +37 -0
- package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
- package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
- package/dist/build/rspack/compose.cjs +69 -0
- package/dist/build/rspack/compose.cjs.map +1 -0
- package/dist/build/rspack/compose.d.cts +20 -0
- package/dist/build/rspack/compose.d.cts.map +1 -0
- package/dist/build/rspack/compose.d.mts +20 -0
- package/dist/build/rspack/compose.d.mts.map +1 -0
- package/dist/build/rspack/compose.mjs +65 -0
- package/dist/build/rspack/compose.mjs.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/generated-config.cjs +35 -0
- package/dist/build/rspack/generated-config.cjs.map +1 -0
- package/dist/build/rspack/generated-config.mjs +32 -0
- package/dist/build/rspack/generated-config.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +8 -5
- package/dist/build/rspack/index.d.cts +5 -3
- package/dist/build/rspack/index.d.mts +5 -3
- package/dist/build/rspack/index.mjs +5 -3
- package/dist/build/rspack/module-federation.cjs +2 -2
- package/dist/build/rspack/module-federation.cjs.map +1 -1
- package/dist/build/rspack/module-federation.mjs +1 -1
- package/dist/build/rspack/module-federation.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs +44 -69
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +4 -13
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +4 -13
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +44 -69
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs +7 -5
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs +7 -6
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/ui/factory.cjs +88 -0
- package/dist/build/ui/factory.cjs.map +1 -0
- package/dist/build/ui/factory.d.cts +11 -0
- package/dist/build/ui/factory.d.cts.map +1 -0
- package/dist/build/ui/factory.d.mts +11 -0
- package/dist/build/ui/factory.d.mts.map +1 -0
- package/dist/build/ui/factory.mjs +80 -0
- package/dist/build/ui/factory.mjs.map +1 -0
- package/dist/build/ui/generated-config.cjs +118 -0
- package/dist/build/ui/generated-config.cjs.map +1 -0
- package/dist/build/ui/generated-config.d.cts +33 -0
- package/dist/build/ui/generated-config.d.cts.map +1 -0
- package/dist/build/ui/generated-config.d.mts +33 -0
- package/dist/build/ui/generated-config.d.mts.map +1 -0
- package/dist/build/ui/generated-config.mjs +111 -0
- package/dist/build/ui/generated-config.mjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
- package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
- package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
- package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
- package/dist/build/ui/index.cjs +90 -0
- package/dist/build/ui/index.cjs.map +1 -0
- package/dist/build/ui/index.d.cts +29 -0
- package/dist/build/ui/index.d.cts.map +1 -0
- package/dist/build/ui/index.d.mts +29 -0
- package/dist/build/ui/index.d.mts.map +1 -0
- package/dist/build/ui/index.mjs +68 -0
- package/dist/build/ui/index.mjs.map +1 -0
- package/dist/build/ui/manifest-plugin.cjs +37 -0
- package/dist/build/ui/manifest-plugin.cjs.map +1 -0
- package/dist/build/ui/manifest-plugin.d.cts +19 -0
- package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
- package/dist/build/ui/manifest-plugin.d.mts +19 -0
- package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
- package/dist/build/ui/manifest-plugin.mjs +37 -0
- package/dist/build/ui/manifest-plugin.mjs.map +1 -0
- package/dist/build/ui/rsbuild-config.cjs +203 -0
- package/dist/build/ui/rsbuild-config.cjs.map +1 -0
- package/dist/build/ui/rsbuild-config.d.cts +45 -0
- package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
- package/dist/build/ui/rsbuild-config.d.mts +45 -0
- package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
- package/dist/build/ui/rsbuild-config.mjs +200 -0
- package/dist/build/ui/rsbuild-config.mjs.map +1 -0
- package/dist/build/ui/stubs.cjs +107 -0
- package/dist/build/ui/stubs.cjs.map +1 -0
- package/dist/build/ui/stubs.d.cts +25 -0
- package/dist/build/ui/stubs.d.cts.map +1 -0
- package/dist/build/ui/stubs.d.mts +25 -0
- package/dist/build/ui/stubs.d.mts.map +1 -0
- package/dist/build/ui/stubs.mjs +106 -0
- package/dist/build/ui/stubs.mjs.map +1 -0
- package/dist/cli.cjs +83 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +6 -0
- package/dist/cli.d.cts.map +1 -0
- package/dist/cli.d.mts +6 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +82 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/dev/serve.cjs +390 -0
- package/dist/dev/serve.cjs.map +1 -0
- package/dist/dev/serve.d.cts +23 -0
- package/dist/dev/serve.d.cts.map +1 -0
- package/dist/dev/serve.d.mts +23 -0
- package/dist/dev/serve.d.mts.map +1 -0
- package/dist/dev/serve.mjs +384 -0
- package/dist/dev/serve.mjs.map +1 -0
- package/dist/dev/watch-kill.cjs +39 -0
- package/dist/dev/watch-kill.cjs.map +1 -0
- package/dist/dev/watch-kill.mjs +38 -0
- package/dist/dev/watch-kill.mjs.map +1 -0
- package/dist/effect-helpers.cjs +23 -0
- package/dist/effect-helpers.cjs.map +1 -0
- package/dist/effect-helpers.d.cts +20 -0
- package/dist/effect-helpers.d.cts.map +1 -0
- package/dist/effect-helpers.d.mts +20 -0
- package/dist/effect-helpers.d.mts.map +1 -0
- package/dist/effect-helpers.mjs +22 -0
- package/dist/effect-helpers.mjs.map +1 -0
- package/dist/errors.cjs +49 -69
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +13 -96
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts +13 -96
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +16 -34
- package/dist/errors.mjs.map +1 -1
- package/dist/identity.cjs +19 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +33 -0
- package/dist/identity.d.cts.map +1 -0
- package/dist/identity.d.mts +33 -0
- package/dist/identity.d.mts.map +1 -0
- package/dist/identity.mjs +16 -0
- package/dist/identity.mjs.map +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +6 -4
- package/dist/plugin.cjs +12 -26
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +44 -25
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +45 -26
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +15 -29
- package/dist/plugin.mjs.map +1 -1
- package/dist/remote-entry.cjs +103 -0
- package/dist/remote-entry.cjs.map +1 -0
- package/dist/remote-entry.d.cts +53 -0
- package/dist/remote-entry.d.cts.map +1 -0
- package/dist/remote-entry.d.mts +53 -0
- package/dist/remote-entry.d.mts.map +1 -0
- package/dist/remote-entry.mjs +98 -0
- package/dist/remote-entry.mjs.map +1 -0
- package/dist/runtime/errors.cjs +140 -34
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +42 -7
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +42 -7
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +136 -31
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +95 -23
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +16 -0
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +16 -0
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +98 -26
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +3 -78
- package/dist/runtime/mf-config.cjs.map +1 -1
- package/dist/runtime/mf-config.d.cts +3 -49
- package/dist/runtime/mf-config.d.cts.map +1 -1
- package/dist/runtime/mf-config.d.mts +3 -49
- package/dist/runtime/mf-config.d.mts.map +1 -1
- package/dist/runtime/mf-config.mjs +5 -78
- package/dist/runtime/mf-config.mjs.map +1 -1
- package/dist/runtime/services/module-federation.service.cjs +63 -12
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts +4 -13
- package/dist/runtime/services/module-federation.service.d.mts +4 -13
- package/dist/runtime/services/module-federation.service.mjs +63 -14
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs +2 -22
- package/dist/runtime/services/normalize.d.cts +2 -21
- package/dist/runtime/services/normalize.d.mts +2 -21
- package/dist/runtime/services/normalize.mjs +2 -21
- package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
- package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +30 -29
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
- package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
- package/dist/runtime/services/plugin-loader.service.mjs +29 -30
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +10 -12
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +14 -36
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +14 -36
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs +14 -18
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +12 -12
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts +3 -15
- package/dist/runtime/services/secrets.service.d.mts +3 -15
- package/dist/runtime/services/secrets.service.mjs +12 -13
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/services/shared-identity.cjs +40 -0
- package/dist/runtime/services/shared-identity.cjs.map +1 -0
- package/dist/runtime/services/shared-identity.mjs +38 -0
- package/dist/runtime/services/shared-identity.mjs.map +1 -0
- package/dist/runtime/validation.cjs +2 -2
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs +2 -2
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/shared-deps-spec.cjs +384 -0
- package/dist/shared-deps-spec.cjs.map +1 -0
- package/dist/shared-deps-spec.d.cts +182 -0
- package/dist/shared-deps-spec.d.cts.map +1 -0
- package/dist/shared-deps-spec.d.mts +182 -0
- package/dist/shared-deps-spec.d.mts.map +1 -0
- package/dist/shared-deps-spec.mjs +368 -0
- package/dist/shared-deps-spec.mjs.map +1 -0
- package/dist/types.d.cts +22 -41
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +22 -41
- package/dist/types.d.mts.map +1 -1
- package/dist/ui/manifest/construct.cjs +268 -0
- package/dist/ui/manifest/construct.cjs.map +1 -0
- package/dist/ui/manifest/construct.d.cts +48 -0
- package/dist/ui/manifest/construct.d.cts.map +1 -0
- package/dist/ui/manifest/construct.d.mts +48 -0
- package/dist/ui/manifest/construct.d.mts.map +1 -0
- package/dist/ui/manifest/construct.mjs +268 -0
- package/dist/ui/manifest/construct.mjs.map +1 -0
- package/dist/ui/manifest/contract.cjs +34 -0
- package/dist/ui/manifest/contract.cjs.map +1 -0
- package/dist/ui/manifest/contract.d.cts +26 -0
- package/dist/ui/manifest/contract.d.cts.map +1 -0
- package/dist/ui/manifest/contract.d.mts +26 -0
- package/dist/ui/manifest/contract.d.mts.map +1 -0
- package/dist/ui/manifest/contract.mjs +26 -0
- package/dist/ui/manifest/contract.mjs.map +1 -0
- package/dist/ui/manifest/descriptor.cjs +64 -0
- package/dist/ui/manifest/descriptor.cjs.map +1 -0
- package/dist/ui/manifest/descriptor.d.cts +60 -0
- package/dist/ui/manifest/descriptor.d.cts.map +1 -0
- package/dist/ui/manifest/descriptor.d.mts +60 -0
- package/dist/ui/manifest/descriptor.d.mts.map +1 -0
- package/dist/ui/manifest/descriptor.mjs +61 -0
- package/dist/ui/manifest/descriptor.mjs.map +1 -0
- package/dist/ui/manifest/generator.cjs +128 -0
- package/dist/ui/manifest/generator.cjs.map +1 -0
- package/dist/ui/manifest/generator.d.cts +41 -0
- package/dist/ui/manifest/generator.d.cts.map +1 -0
- package/dist/ui/manifest/generator.d.mts +41 -0
- package/dist/ui/manifest/generator.d.mts.map +1 -0
- package/dist/ui/manifest/generator.mjs +125 -0
- package/dist/ui/manifest/generator.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +35 -0
- package/dist/ui/manifest/index.d.cts +9 -0
- package/dist/ui/manifest/index.d.mts +9 -0
- package/dist/ui/manifest/index.mjs +9 -0
- package/dist/ui/manifest/manifest-schema.cjs +97 -0
- package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.cts +132 -0
- package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
- package/dist/ui/manifest/manifest-schema.d.mts +132 -0
- package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
- package/dist/ui/manifest/manifest-schema.mjs +90 -0
- package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
- package/dist/ui/manifest/mount-registry.cjs +52 -0
- package/dist/ui/manifest/mount-registry.cjs.map +1 -0
- package/dist/ui/manifest/mount-registry.d.cts +61 -0
- package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
- package/dist/ui/manifest/mount-registry.d.mts +61 -0
- package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
- package/dist/ui/manifest/mount-registry.mjs +48 -0
- package/dist/ui/manifest/mount-registry.mjs.map +1 -0
- package/dist/ui/manifest/nav.cjs +13 -0
- package/dist/ui/manifest/nav.cjs.map +1 -0
- package/dist/ui/manifest/nav.d.cts +34 -0
- package/dist/ui/manifest/nav.d.cts.map +1 -0
- package/dist/ui/manifest/nav.d.mts +34 -0
- package/dist/ui/manifest/nav.d.mts.map +1 -0
- package/dist/ui/manifest/nav.mjs +13 -0
- package/dist/ui/manifest/nav.mjs.map +1 -0
- package/dist/ui/manifest/route-config.cjs +33 -0
- package/dist/ui/manifest/route-config.cjs.map +1 -0
- package/dist/ui/manifest/route-config.d.cts +40 -0
- package/dist/ui/manifest/route-config.d.cts.map +1 -0
- package/dist/ui/manifest/route-config.d.mts +40 -0
- package/dist/ui/manifest/route-config.d.mts.map +1 -0
- package/dist/ui/manifest/route-config.mjs +33 -0
- package/dist/ui/manifest/route-config.mjs.map +1 -0
- package/dist/version-manifest.cjs +65 -0
- package/dist/version-manifest.cjs.map +1 -0
- package/dist/version-manifest.d.cts +52 -0
- package/dist/version-manifest.d.cts.map +1 -0
- package/dist/version-manifest.d.mts +52 -0
- package/dist/version-manifest.d.mts.map +1 -0
- package/dist/version-manifest.mjs +63 -0
- package/dist/version-manifest.mjs.map +1 -0
- package/package.json +165 -68
- package/skills/plugin-client/SKILL.md +24 -5
- package/skills/plugin-development/SKILL.md +79 -47
- package/skills/plugin-testing/SKILL.md +41 -12
- package/src/build/artifact-names.ts +117 -0
- package/src/build/contract-types.ts +101 -0
- package/src/build/rspack/build-report-plugin.ts +34 -0
- package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
- package/src/build/rspack/compose.ts +87 -0
- package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
- package/src/build/rspack/generated-config.ts +35 -0
- package/src/build/rspack/index.ts +10 -5
- package/src/build/rspack/module-federation.ts +1 -1
- package/src/build/rspack/plugin.ts +103 -105
- package/src/build/rspack/utils.ts +8 -2
- package/src/build/ui/factory.ts +96 -0
- package/src/build/ui/generated-config.ts +133 -0
- package/src/build/ui/hash-artifacts-plugin.ts +79 -0
- package/src/build/ui/index.ts +98 -0
- package/src/build/ui/manifest-plugin.ts +54 -0
- package/src/build/ui/rsbuild-config.ts +256 -0
- package/src/build/ui/stubs.ts +103 -0
- package/src/cli.ts +100 -0
- package/src/dev/serve.ts +477 -0
- package/src/dev/watch-kill.ts +58 -0
- package/src/effect-helpers.ts +25 -0
- package/src/errors.ts +16 -18
- package/src/identity.ts +36 -0
- package/src/index.ts +4 -0
- package/src/plugin.ts +70 -92
- package/src/remote-entry.ts +171 -0
- package/src/runtime/errors.ts +186 -27
- package/src/runtime/index.ts +132 -43
- package/src/runtime/mf-config.ts +12 -107
- package/src/runtime/services/module-federation.service.ts +221 -117
- package/src/runtime/services/normalize.ts +1 -18
- package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
- package/src/runtime/services/plugin-loader.service.ts +239 -212
- package/src/runtime/services/plugin.service.ts +61 -43
- package/src/runtime/services/secrets.service.ts +20 -15
- package/src/runtime/services/shared-identity.ts +68 -0
- package/src/runtime/validation.ts +5 -7
- package/src/shared-deps-spec.ts +478 -0
- package/src/types.ts +22 -48
- package/src/ui/manifest/construct.ts +403 -0
- package/src/ui/manifest/contract.ts +33 -0
- package/src/ui/manifest/descriptor.ts +96 -0
- package/src/ui/manifest/generator.ts +238 -0
- package/src/ui/manifest/index.ts +55 -0
- package/src/ui/manifest/manifest-schema.ts +107 -0
- package/src/ui/manifest/mount-registry.ts +50 -0
- package/src/ui/manifest/nav.ts +43 -0
- package/src/ui/manifest/route-config.ts +82 -0
- package/src/version-manifest.ts +88 -0
- package/dist/build/rspack/dev-server-middleware.cjs +0 -248
- package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
- package/dist/build/rspack/dev-server-middleware.mjs +0 -247
- package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
- package/dist/build/shared-deps.cjs +0 -83
- package/dist/build/shared-deps.cjs.map +0 -1
- package/dist/build/shared-deps.d.cts +0 -67
- package/dist/build/shared-deps.d.cts.map +0 -1
- package/dist/build/shared-deps.d.mts +0 -67
- package/dist/build/shared-deps.d.mts.map +0 -1
- package/dist/build/shared-deps.mjs +0 -79
- package/dist/build/shared-deps.mjs.map +0 -1
- package/dist/effect.cjs +0 -9
- package/dist/effect.d.cts +0 -1
- package/dist/effect.d.mts +0 -1
- package/dist/effect.mjs +0 -3
- package/dist/orpc-openapi.cjs +0 -17
- package/dist/orpc-openapi.d.cts +0 -2
- package/dist/orpc-openapi.d.mts +0 -2
- package/dist/orpc-openapi.mjs +0 -5
- package/dist/orpc.cjs +0 -46
- package/dist/orpc.d.cts +0 -7
- package/dist/orpc.d.mts +0 -7
- package/dist/orpc.mjs +0 -11
- package/dist/package.cjs +0 -23
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -17
- package/dist/package.mjs.map +0 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
- package/dist/runtime/services/normalize.cjs.map +0 -1
- package/dist/runtime/services/normalize.d.cts.map +0 -1
- package/dist/runtime/services/normalize.d.mts.map +0 -1
- package/dist/runtime/services/normalize.mjs.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
- package/dist/runtime/services/secrets.service.d.cts.map +0 -1
- package/dist/runtime/services/secrets.service.d.mts.map +0 -1
- package/dist/testing/index.cjs +0 -57
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -54
- package/dist/testing/index.d.cts.map +0 -1
- package/dist/testing/index.d.mts +0 -54
- package/dist/testing/index.d.mts.map +0 -1
- package/dist/testing/index.mjs +0 -55
- package/dist/testing/index.mjs.map +0 -1
- package/dist/zod-core.cjs +0 -9
- package/dist/zod-core.d.cts +0 -1
- package/dist/zod-core.d.mts +0 -1
- package/dist/zod-core.mjs +0 -3
- package/dist/zod.cjs +0 -11
- package/dist/zod.d.cts +0 -2
- package/dist/zod.d.mts +0 -2
- package/dist/zod.mjs +0 -3
- package/src/build/rspack/dev-server-middleware.ts +0 -324
- package/src/build/shared-deps.ts +0 -102
- package/src/effect.ts +0 -1
- package/src/orpc-openapi.ts +0 -2
- package/src/orpc.ts +0 -9
- package/src/testing/index.ts +0 -87
- package/src/testing/mocks/module-federation.service.ts +0 -41
- package/src/zod-core.ts +0 -1
- package/src/zod.ts +0 -3
package/dist/errors.mjs
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ModuleFederationError, PluginRuntimeError, ValidationError, classifyPluginFailure, extractFromFiberFailure, formatORPCError, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
2
|
+
import { COMMON_ERROR_STATUS_MAP } from "@orpc/server";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
|
|
4
5
|
//#region src/errors.ts
|
|
5
6
|
/**
|
|
6
|
-
* Error pattern constants for categorizing infrastructure errors
|
|
7
|
-
*/
|
|
8
|
-
const ERROR_PATTERNS = {
|
|
9
|
-
CONNECTION_REFUSED: ["ECONNREFUSED"],
|
|
10
|
-
HOST_NOT_FOUND: ["ENOTFOUND", "EHOSTUNREACH"],
|
|
11
|
-
TIMEOUT: [
|
|
12
|
-
"ETIMEDOUT",
|
|
13
|
-
"ESOCKETTIMEDOUT",
|
|
14
|
-
"timeout"
|
|
15
|
-
],
|
|
16
|
-
CONNECTION_RESET: ["ECONNRESET", "EPIPE"],
|
|
17
|
-
PERMISSION: [
|
|
18
|
-
"EACCES",
|
|
19
|
-
"EPERM",
|
|
20
|
-
"permission denied"
|
|
21
|
-
],
|
|
22
|
-
AUTH: [
|
|
23
|
-
"401",
|
|
24
|
-
"unauthorized",
|
|
25
|
-
"authentication failed"
|
|
26
|
-
],
|
|
27
|
-
RATE_LIMITED: [
|
|
28
|
-
"429",
|
|
29
|
-
"too many requests",
|
|
30
|
-
"rate limit"
|
|
31
|
-
],
|
|
32
|
-
SERVICE_UNAVAILABLE: ["503", "service unavailable"]
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
7
|
* Common error schemas for plugin contracts.
|
|
36
8
|
* Import individually or use the grouped PluginErrors export.
|
|
37
9
|
*
|
|
@@ -135,10 +107,20 @@ const PluginErrors = {
|
|
|
135
107
|
CONNECTION_ERROR
|
|
136
108
|
};
|
|
137
109
|
/**
|
|
138
|
-
*
|
|
110
|
+
* Error-code -> HTTP-status map for handlers.
|
|
111
|
+
*
|
|
112
|
+
* oRPC v2 resolves statuses at the handler boundary via `errorStatusMap`
|
|
113
|
+
* (default `COMMON_ERROR_STATUS_MAP`, where TIMEOUT is 408). Providing a
|
|
114
|
+
* map REPLACES the default entirely, so the standard codes must be spread
|
|
115
|
+
* back in. These custom entries preserve the v1 wire behavior:
|
|
116
|
+
* TIMEOUT -> 504, CONNECTION_ERROR -> 502.
|
|
139
117
|
*/
|
|
140
|
-
const
|
|
118
|
+
const PLUGIN_ERROR_STATUS_MAP = {
|
|
119
|
+
...COMMON_ERROR_STATUS_MAP,
|
|
120
|
+
TIMEOUT: 504,
|
|
121
|
+
CONNECTION_ERROR: 502
|
|
122
|
+
};
|
|
141
123
|
|
|
142
124
|
//#endregion
|
|
143
|
-
export { BAD_REQUEST, CONNECTION_ERROR,
|
|
125
|
+
export { BAD_REQUEST, CONNECTION_ERROR, FORBIDDEN, ModuleFederationError, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, PluginErrors, PluginRuntimeError, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED, ValidationError, classifyPluginFailure, extractFromFiberFailure, formatORPCError, toPluginRuntimeError, wrapORPCError };
|
|
144
126
|
//# sourceMappingURL=errors.mjs.map
|
package/dist/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { COMMON_ERROR_STATUS_MAP } from \"@orpc/server\";\nimport { z } from \"zod\";\n\n/**\n * Common error schemas for plugin contracts.\n * Import individually or use the grouped PluginErrors export.\n *\n * @example\n * ```typescript\n * import { NOT_FOUND, FORBIDDEN, UNAUTHORIZED } from \"every-plugin/errors\";\n *\n * export const contract = oc.router({\n * getData: oc.route(...)\n * .errors({ NOT_FOUND, FORBIDDEN, UNAUTHORIZED })\n * });\n * ```\n */\n\nexport const UNAUTHORIZED = {\n status: 401,\n data: z.object({\n apiKeyProvided: z.boolean(),\n provider: z.string().optional(),\n authType: z.enum([\"apiKey\", \"oauth\", \"token\"]).optional(),\n }),\n} as const;\n\nexport const RATE_LIMITED = {\n status: 429,\n data: z.object({\n retryAfter: z.number().int().min(1),\n remainingRequests: z.number().int().min(0).optional(),\n resetTime: z.string().datetime().optional(),\n limitType: z.enum([\"requests\", \"tokens\", \"bandwidth\"]).optional(),\n }),\n} as const;\n\nexport const SERVICE_UNAVAILABLE = {\n status: 503,\n data: z.object({\n retryAfter: z.number().int().optional(),\n maintenanceWindow: z.boolean().default(false),\n estimatedUptime: z.string().datetime().optional(),\n }),\n} as const;\n\nexport const BAD_REQUEST = {\n status: 400,\n data: z.object({\n invalidFields: z.array(z.string()).optional(),\n validationErrors: z\n .array(\n z.object({\n field: z.string(),\n message: z.string(),\n code: z.string().optional(),\n }),\n )\n .optional(),\n }),\n} as const;\n\nexport const NOT_FOUND = {\n status: 404,\n data: z.object({\n resource: z.string().optional(),\n resourceId: z.string().optional(),\n }),\n} as const;\n\nexport const FORBIDDEN = {\n status: 403,\n data: z.object({\n requiredPermissions: z.array(z.string()).optional(),\n action: z.string().optional(),\n }),\n} as const;\n\nexport const TIMEOUT = {\n status: 504,\n data: z.object({\n timeoutMs: z.number().int().min(0).optional(),\n operation: z.string().optional(),\n retryable: z.boolean().default(true),\n }),\n} as const;\n\nexport const CONNECTION_ERROR = {\n status: 502,\n data: z.object({\n errorCode: z.string().optional(),\n host: z.string().optional(),\n port: z.number().int().optional(),\n suggestion: z.string().optional(),\n }),\n} as const;\n\n/**\n * Grouped export for all plugin errors.\n * Use individual imports for cleaner code.\n */\nexport const PluginErrors = {\n UNAUTHORIZED,\n RATE_LIMITED,\n SERVICE_UNAVAILABLE,\n BAD_REQUEST,\n NOT_FOUND,\n FORBIDDEN,\n TIMEOUT,\n CONNECTION_ERROR,\n} as const;\n\n/**\n * Error-code -> HTTP-status map for handlers.\n *\n * oRPC v2 resolves statuses at the handler boundary via `errorStatusMap`\n * (default `COMMON_ERROR_STATUS_MAP`, where TIMEOUT is 408). Providing a\n * map REPLACES the default entirely, so the standard codes must be spread\n * back in. These custom entries preserve the v1 wire behavior:\n * TIMEOUT -> 504, CONNECTION_ERROR -> 502.\n */\nexport const PLUGIN_ERROR_STATUS_MAP: Record<string, number> = {\n ...COMMON_ERROR_STATUS_MAP,\n TIMEOUT: 504,\n CONNECTION_ERROR: 502,\n} as const;\n\nexport type { PluginLoadFailureInfo } from \"./runtime/errors\";\nexport {\n classifyPluginFailure,\n extractFromFiberFailure,\n formatORPCError,\n ModuleFederationError,\n PluginRuntimeError,\n toPluginRuntimeError,\n ValidationError,\n wrapORPCError,\n} from \"./runtime/errors\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,gBAAgB,EAAE,QAAQ;EAC1B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;EAC9B,UAAU,EAAE,KAAK;GAAC;GAAU;GAAS;EAAO,CAAC,CAAC,CAAC,SAAS;CAC1D,CAAC;AACH;AAEA,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;EAClC,mBAAmB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;EACpD,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EAC1C,WAAW,EAAE,KAAK;GAAC;GAAY;GAAU;EAAW,CAAC,CAAC,CAAC,SAAS;CAClE,CAAC;AACH;AAEA,MAAa,sBAAsB;CACjC,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;EACtC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,QAAQ,KAAK;EAC5C,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAClD,CAAC;AACH;AAEA,MAAa,cAAc;CACzB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;EAC5C,kBAAkB,EACf,MACC,EAAE,OAAO;GACP,OAAO,EAAE,OAAO;GAChB,SAAS,EAAE,OAAO;GAClB,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,CAAC,CACH,CAAC,CACA,SAAS;CACd,CAAC;AACH;AAEA,MAAa,YAAY;CACvB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;EAC9B,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,CAAC;AACH;AAEA,MAAa,YAAY;CACvB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,qBAAqB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;EAClD,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,CAAC;AACH;AAEA,MAAa,UAAU;CACrB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;EAC5C,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;EAC/B,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,IAAI;CACrC,CAAC;AACH;AAEA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;EAC/B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;EAC1B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;EAChC,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,CAAC;AACH;;;;;AAMA,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;AAWA,MAAa,0BAAkD;CAC7D,GAAG;CACH,SAAS;CACT,kBAAkB;AACpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region src/identity.ts
|
|
3
|
+
const remoteName = (name) => name.toLowerCase().replace(/^@/, "").replace(/\//g, "_");
|
|
4
|
+
const containerName = (pkgName) => pkgName.replace(/[^A-Za-z0-9_]/g, "_");
|
|
5
|
+
const identity = (key) => {
|
|
6
|
+
const npm = `@everything-dev/${key}-plugin`;
|
|
7
|
+
return {
|
|
8
|
+
key,
|
|
9
|
+
npm,
|
|
10
|
+
remote: remoteName(npm),
|
|
11
|
+
container: containerName(npm)
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.containerName = containerName;
|
|
17
|
+
exports.identity = identity;
|
|
18
|
+
exports.remoteName = remoteName;
|
|
19
|
+
//# sourceMappingURL=identity.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.cjs","names":[],"sources":["../src/identity.ts"],"sourcesContent":["/**\n * Plugin identity: every name a plugin workspace carries, derived from one\n * input. Two seams live here:\n *\n * - `remoteName`/`containerName` absorb the framework's two normalizers (the\n * Module Federation remote name and the UI container name) — runtime,\n * build, and host consumers delegate to these instead of keeping private\n * copies, so a name can never disagree across contexts.\n * - `identity` derives the full name set from the config layout key (the\n * `plugins/<key>` attachment in `bos.config.json`): the key itself (the\n * composition key), the npm package name under the scaffold convention,\n * and the two normalized build names.\n *\n * Normalization rules:\n * - remote: lowercase, strip a single leading '@', replace '/' with '_',\n * preserve hyphens and other characters\n * (\"@scope/my-plugin\" → \"scope_my-plugin\")\n * - container: replace every character outside [A-Za-z0-9_] with '_'\n * (\"@everything-dev/auth-plugin\" → \"_everything_dev_auth_plugin\")\n */\nexport interface PluginIdentity {\n key: string;\n npm: string;\n remote: string;\n container: string;\n}\n\nexport const remoteName = (name: string): string =>\n name.toLowerCase().replace(/^@/, \"\").replace(/\\//g, \"_\");\n\nexport const containerName = (pkgName: string): string => pkgName.replace(/[^A-Za-z0-9_]/g, \"_\");\n\nexport const identity = (key: string): PluginIdentity => {\n const npm = `@everything-dev/${key}-plugin`;\n return { key, npm, remote: remoteName(npm), container: containerName(npm) };\n};\n"],"mappings":";;AA2BA,MAAa,cAAc,SACzB,KAAK,YAAY,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,QAAQ,OAAO,GAAG;AAEzD,MAAa,iBAAiB,YAA4B,QAAQ,QAAQ,kBAAkB,GAAG;AAE/F,MAAa,YAAY,QAAgC;CACvD,MAAM,MAAM,mBAAmB,IAAI;CACnC,OAAO;EAAE;EAAK;EAAK,QAAQ,WAAW,GAAG;EAAG,WAAW,cAAc,GAAG;CAAE;AAC5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/identity.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Plugin identity: every name a plugin workspace carries, derived from one
|
|
4
|
+
* input. Two seams live here:
|
|
5
|
+
*
|
|
6
|
+
* - `remoteName`/`containerName` absorb the framework's two normalizers (the
|
|
7
|
+
* Module Federation remote name and the UI container name) — runtime,
|
|
8
|
+
* build, and host consumers delegate to these instead of keeping private
|
|
9
|
+
* copies, so a name can never disagree across contexts.
|
|
10
|
+
* - `identity` derives the full name set from the config layout key (the
|
|
11
|
+
* `plugins/<key>` attachment in `bos.config.json`): the key itself (the
|
|
12
|
+
* composition key), the npm package name under the scaffold convention,
|
|
13
|
+
* and the two normalized build names.
|
|
14
|
+
*
|
|
15
|
+
* Normalization rules:
|
|
16
|
+
* - remote: lowercase, strip a single leading '@', replace '/' with '_',
|
|
17
|
+
* preserve hyphens and other characters
|
|
18
|
+
* ("@scope/my-plugin" → "scope_my-plugin")
|
|
19
|
+
* - container: replace every character outside [A-Za-z0-9_] with '_'
|
|
20
|
+
* ("@everything-dev/auth-plugin" → "_everything_dev_auth_plugin")
|
|
21
|
+
*/
|
|
22
|
+
interface PluginIdentity {
|
|
23
|
+
key: string;
|
|
24
|
+
npm: string;
|
|
25
|
+
remote: string;
|
|
26
|
+
container: string;
|
|
27
|
+
}
|
|
28
|
+
declare const remoteName: (name: string) => string;
|
|
29
|
+
declare const containerName: (pkgName: string) => string;
|
|
30
|
+
declare const identity: (key: string) => PluginIdentity;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { PluginIdentity, containerName, identity, remoteName };
|
|
33
|
+
//# sourceMappingURL=identity.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.cts","names":[],"sources":["../src/identity.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBiB;EACf;EACA;EACA;EACA;;cAGW,aAAU;cAGV,gBAAa;cAEb,WAAQ,gBAAkB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/identity.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Plugin identity: every name a plugin workspace carries, derived from one
|
|
4
|
+
* input. Two seams live here:
|
|
5
|
+
*
|
|
6
|
+
* - `remoteName`/`containerName` absorb the framework's two normalizers (the
|
|
7
|
+
* Module Federation remote name and the UI container name) — runtime,
|
|
8
|
+
* build, and host consumers delegate to these instead of keeping private
|
|
9
|
+
* copies, so a name can never disagree across contexts.
|
|
10
|
+
* - `identity` derives the full name set from the config layout key (the
|
|
11
|
+
* `plugins/<key>` attachment in `bos.config.json`): the key itself (the
|
|
12
|
+
* composition key), the npm package name under the scaffold convention,
|
|
13
|
+
* and the two normalized build names.
|
|
14
|
+
*
|
|
15
|
+
* Normalization rules:
|
|
16
|
+
* - remote: lowercase, strip a single leading '@', replace '/' with '_',
|
|
17
|
+
* preserve hyphens and other characters
|
|
18
|
+
* ("@scope/my-plugin" → "scope_my-plugin")
|
|
19
|
+
* - container: replace every character outside [A-Za-z0-9_] with '_'
|
|
20
|
+
* ("@everything-dev/auth-plugin" → "_everything_dev_auth_plugin")
|
|
21
|
+
*/
|
|
22
|
+
interface PluginIdentity {
|
|
23
|
+
key: string;
|
|
24
|
+
npm: string;
|
|
25
|
+
remote: string;
|
|
26
|
+
container: string;
|
|
27
|
+
}
|
|
28
|
+
declare const remoteName: (name: string) => string;
|
|
29
|
+
declare const containerName: (pkgName: string) => string;
|
|
30
|
+
declare const identity: (key: string) => PluginIdentity;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { PluginIdentity, containerName, identity, remoteName };
|
|
33
|
+
//# sourceMappingURL=identity.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.mts","names":[],"sources":["../src/identity.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBiB;EACf;EACA;EACA;EACA;;cAGW,aAAU;cAGV,gBAAa;cAEb,WAAQ,gBAAkB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/identity.ts
|
|
2
|
+
const remoteName = (name) => name.toLowerCase().replace(/^@/, "").replace(/\//g, "_");
|
|
3
|
+
const containerName = (pkgName) => pkgName.replace(/[^A-Za-z0-9_]/g, "_");
|
|
4
|
+
const identity = (key) => {
|
|
5
|
+
const npm = `@everything-dev/${key}-plugin`;
|
|
6
|
+
return {
|
|
7
|
+
key,
|
|
8
|
+
npm,
|
|
9
|
+
remote: remoteName(npm),
|
|
10
|
+
container: containerName(npm)
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { containerName, identity, remoteName };
|
|
16
|
+
//# sourceMappingURL=identity.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.mjs","names":[],"sources":["../src/identity.ts"],"sourcesContent":["/**\n * Plugin identity: every name a plugin workspace carries, derived from one\n * input. Two seams live here:\n *\n * - `remoteName`/`containerName` absorb the framework's two normalizers (the\n * Module Federation remote name and the UI container name) — runtime,\n * build, and host consumers delegate to these instead of keeping private\n * copies, so a name can never disagree across contexts.\n * - `identity` derives the full name set from the config layout key (the\n * `plugins/<key>` attachment in `bos.config.json`): the key itself (the\n * composition key), the npm package name under the scaffold convention,\n * and the two normalized build names.\n *\n * Normalization rules:\n * - remote: lowercase, strip a single leading '@', replace '/' with '_',\n * preserve hyphens and other characters\n * (\"@scope/my-plugin\" → \"scope_my-plugin\")\n * - container: replace every character outside [A-Za-z0-9_] with '_'\n * (\"@everything-dev/auth-plugin\" → \"_everything_dev_auth_plugin\")\n */\nexport interface PluginIdentity {\n key: string;\n npm: string;\n remote: string;\n container: string;\n}\n\nexport const remoteName = (name: string): string =>\n name.toLowerCase().replace(/^@/, \"\").replace(/\\//g, \"_\");\n\nexport const containerName = (pkgName: string): string => pkgName.replace(/[^A-Za-z0-9_]/g, \"_\");\n\nexport const identity = (key: string): PluginIdentity => {\n const npm = `@everything-dev/${key}-plugin`;\n return { key, npm, remote: remoteName(npm), container: containerName(npm) };\n};\n"],"mappings":";AA2BA,MAAa,cAAc,SACzB,KAAK,YAAY,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,QAAQ,OAAO,GAAG;AAEzD,MAAa,iBAAiB,YAA4B,QAAQ,QAAQ,kBAAkB,GAAG;AAE/F,MAAa,YAAY,QAAgC;CACvD,MAAM,MAAM,mBAAmB,IAAI;CACnC,OAAO;EAAE;EAAK;EAAK,QAAQ,WAAW,GAAG;EAAG,WAAW,cAAc,GAAG;CAAE;AAC5E"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_effect_helpers = require('./effect-helpers.cjs');
|
|
2
3
|
const require_errors = require('./runtime/errors.cjs');
|
|
3
4
|
const require_errors$1 = require('./errors.cjs');
|
|
4
5
|
const require_plugin = require('./plugin.cjs');
|
|
5
|
-
const
|
|
6
|
+
const require_identity = require('./identity.cjs');
|
|
6
7
|
const require_runtime_index = require('./runtime/index.cjs');
|
|
8
|
+
require("@orpc/openapi/extensions/route");
|
|
7
9
|
|
|
8
10
|
exports.BAD_REQUEST = require_errors$1.BAD_REQUEST;
|
|
9
11
|
exports.CONNECTION_ERROR = require_errors$1.CONNECTION_ERROR;
|
|
10
|
-
exports.CommonPluginErrors = require_errors$1.CommonPluginErrors;
|
|
11
|
-
exports.ERROR_PATTERNS = require_errors$1.ERROR_PATTERNS;
|
|
12
12
|
exports.FORBIDDEN = require_errors$1.FORBIDDEN;
|
|
13
13
|
exports.ModuleFederationError = require_errors.ModuleFederationError;
|
|
14
14
|
exports.NOT_FOUND = require_errors$1.NOT_FOUND;
|
|
15
|
+
exports.PLUGIN_ERROR_STATUS_MAP = require_errors$1.PLUGIN_ERROR_STATUS_MAP;
|
|
15
16
|
exports.PluginErrors = require_errors$1.PluginErrors;
|
|
16
17
|
exports.PluginIdTag = require_plugin.PluginIdTag;
|
|
17
18
|
exports.PluginRuntime = require_runtime_index.PluginRuntime;
|
|
@@ -21,12 +22,14 @@ exports.SERVICE_UNAVAILABLE = require_errors$1.SERVICE_UNAVAILABLE;
|
|
|
21
22
|
exports.TIMEOUT = require_errors$1.TIMEOUT;
|
|
22
23
|
exports.UNAUTHORIZED = require_errors$1.UNAUTHORIZED;
|
|
23
24
|
exports.ValidationError = require_errors.ValidationError;
|
|
25
|
+
exports.buildScoped = require_effect_helpers.buildScoped;
|
|
26
|
+
exports.buildScopedContext = require_effect_helpers.buildScopedContext;
|
|
27
|
+
exports.classifyPluginFailure = require_errors.classifyPluginFailure;
|
|
24
28
|
exports.createPlugin = require_plugin.createPlugin;
|
|
25
29
|
exports.createPluginRuntime = require_runtime_index.createPluginRuntime;
|
|
26
30
|
exports.extractFromFiberFailure = require_errors.extractFromFiberFailure;
|
|
27
31
|
exports.formatORPCError = require_errors.formatORPCError;
|
|
28
|
-
exports.getNormalizedRemoteName =
|
|
29
|
-
exports.isRetryableORPCCode = require_errors.isRetryableORPCCode;
|
|
32
|
+
exports.getNormalizedRemoteName = require_identity.remoteName;
|
|
30
33
|
exports.toPluginRuntimeError = require_errors.toPluginRuntimeError;
|
|
31
34
|
exports.withPlugins = require_plugin.withPlugins;
|
|
32
35
|
exports.wrapORPCError = require_errors.wrapORPCError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { remoteName } from "./identity.cjs";
|
|
2
|
+
import { ModuleFederationError, PluginLoadFailureInfo, PluginRuntimeError, ValidationError, classifyPluginFailure, extractFromFiberFailure, formatORPCError, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.cjs";
|
|
3
|
+
import { BAD_REQUEST, CONNECTION_ERROR, FORBIDDEN, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.cjs";
|
|
4
|
+
import { buildScoped, buildScopedContext } from "./effect-helpers.cjs";
|
|
5
|
+
import { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor, PluginEnv, PluginIdTag, createPlugin, withPlugins } from "./plugin.cjs";
|
|
6
|
+
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugins, SecretsConfig, UsePluginResult } from "./types.cjs";
|
|
5
7
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.cjs";
|
|
6
|
-
import
|
|
7
|
-
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR,
|
|
8
|
+
import "@orpc/openapi/extensions/route";
|
|
9
|
+
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CreatePluginFn, CreatePluginWithPlugins, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginEnv, PluginErrors, PluginIdTag, type PluginInstance, type PluginLoadFailureInfo, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginServicesEntry, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, type UsePluginResult, ValidationError, buildScoped, buildScopedContext, classifyPluginFailure, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, remoteName as getNormalizedRemoteName, toPluginRuntimeError, withPlugins, wrapORPCError };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { remoteName } from "./identity.mjs";
|
|
2
|
+
import { ModuleFederationError, PluginLoadFailureInfo, PluginRuntimeError, ValidationError, classifyPluginFailure, extractFromFiberFailure, formatORPCError, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
3
|
+
import { BAD_REQUEST, CONNECTION_ERROR, FORBIDDEN, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.mjs";
|
|
4
|
+
import { buildScoped, buildScopedContext } from "./effect-helpers.mjs";
|
|
5
|
+
import { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor, PluginEnv, PluginIdTag, createPlugin, withPlugins } from "./plugin.mjs";
|
|
6
|
+
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugins, SecretsConfig, UsePluginResult } from "./types.mjs";
|
|
5
7
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
6
|
-
import
|
|
7
|
-
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR,
|
|
8
|
+
import "@orpc/openapi/extensions/route";
|
|
9
|
+
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CreatePluginFn, CreatePluginWithPlugins, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginEnv, PluginErrors, PluginIdTag, type PluginInstance, type PluginLoadFailureInfo, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginServicesEntry, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, type UsePluginResult, ValidationError, buildScoped, buildScopedContext, classifyPluginFailure, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, remoteName as getNormalizedRemoteName, toPluginRuntimeError, withPlugins, wrapORPCError };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { buildScoped, buildScopedContext } from "./effect-helpers.mjs";
|
|
2
|
+
import { ModuleFederationError, PluginRuntimeError, ValidationError, classifyPluginFailure, extractFromFiberFailure, formatORPCError, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
3
|
+
import { BAD_REQUEST, CONNECTION_ERROR, FORBIDDEN, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.mjs";
|
|
3
4
|
import { PluginIdTag, createPlugin, withPlugins } from "./plugin.mjs";
|
|
4
|
-
import {
|
|
5
|
+
import { remoteName } from "./identity.mjs";
|
|
5
6
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
7
|
+
import "@orpc/openapi/extensions/route";
|
|
6
8
|
|
|
7
|
-
export { BAD_REQUEST, CONNECTION_ERROR,
|
|
9
|
+
export { BAD_REQUEST, CONNECTION_ERROR, FORBIDDEN, ModuleFederationError, NOT_FOUND, PLUGIN_ERROR_STATUS_MAP, PluginErrors, PluginIdTag, PluginRuntime, PluginRuntimeError, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED, ValidationError, buildScoped, buildScopedContext, classifyPluginFailure, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, remoteName as getNormalizedRemoteName, toPluginRuntimeError, withPlugins, wrapORPCError };
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_errors = require('./runtime/errors.cjs');
|
|
2
|
-
let _orpc_contract = require("@orpc/contract");
|
|
3
2
|
let effect = require("effect");
|
|
4
3
|
let _orpc_server = require("@orpc/server");
|
|
4
|
+
require("@orpc/experimental-effect/extensions/effect");
|
|
5
5
|
|
|
6
6
|
//#region src/plugin.ts
|
|
7
|
-
var PluginIdTag = class extends effect.Context.
|
|
7
|
+
var PluginIdTag = class extends effect.Context.Service()("PluginId") {};
|
|
8
8
|
const createPlugin = function createPlugin(config) {
|
|
9
9
|
const configSchema = {
|
|
10
10
|
variables: config.variables,
|
|
@@ -16,30 +16,15 @@ const createPlugin = function createPlugin(config) {
|
|
|
16
16
|
id;
|
|
17
17
|
contract = config.contract;
|
|
18
18
|
configSchema = configSchema;
|
|
19
|
-
|
|
20
|
-
initialize(pluginConfig, plugins = {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
servicesTag = config.servicesTag;
|
|
20
|
+
initialize(pluginConfig, plugins = {}) {
|
|
21
|
+
const init = config.initialize;
|
|
22
|
+
if (!init) return effect.Effect.succeed(effect.Layer.empty);
|
|
23
|
+
return init(pluginConfig, plugins).pipe(effect.Effect.mapError((error) => require_errors.toPluginRuntimeError(error, this.id, void 0, "initialize-plugin")));
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
if (config.shutdown && self._deps) yield* config.shutdown(self._deps).pipe(effect.Effect.catchAll((error) => effect.Effect.logWarning(`Plugin shutdown hook failed for ${self.id}`, error)));
|
|
29
|
-
self._deps = null;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
createRouter(deps) {
|
|
33
|
-
const base = (0, _orpc_server.implement)(config.contract).$context();
|
|
34
|
-
const errorMiddleware = (0, _orpc_server.onError)((error) => {
|
|
35
|
-
const unwrapped = require_errors.extractFromFiberFailure(error);
|
|
36
|
-
if (unwrapped !== error && unwrapped instanceof _orpc_contract.ORPCError) throw unwrapped;
|
|
37
|
-
const formatted = require_errors.formatORPCError(error);
|
|
38
|
-
if (formatted) console.error(formatted);
|
|
39
|
-
throw error;
|
|
40
|
-
});
|
|
41
|
-
const builder = base.use(errorMiddleware);
|
|
42
|
-
return config.createRouter(deps, builder);
|
|
25
|
+
createRouter(plugins) {
|
|
26
|
+
const builder = (0, _orpc_server.implement)(config.contract).$context();
|
|
27
|
+
return config.createRouter(builder, plugins);
|
|
43
28
|
}
|
|
44
29
|
}
|
|
45
30
|
const PluginConstructor = CreatedPlugin;
|
|
@@ -47,7 +32,8 @@ const createPlugin = function createPlugin(config) {
|
|
|
47
32
|
contract: config.contract,
|
|
48
33
|
variables: config.variables,
|
|
49
34
|
secrets: config.secrets,
|
|
50
|
-
context: config.context
|
|
35
|
+
context: config.context,
|
|
36
|
+
servicesTag: config.servicesTag
|
|
51
37
|
};
|
|
52
38
|
return PluginConstructor;
|
|
53
39
|
};
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["Context","Effect","
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["Context","Effect","Layer","toPluginRuntimeError","implement"],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport type { WithEffectContext } from \"@orpc/experimental-effect\";\nimport \"@orpc/experimental-effect/extensions/effect\";\nimport type { ContractedRouter, Implementer } from \"@orpc/server\";\nimport { implement } from \"@orpc/server\";\nimport type { Scope } from \"effect\";\nimport { Context, Effect, Layer } from \"effect\";\nimport { type PluginRuntimeError, toPluginRuntimeError } from \"./runtime/errors\";\n\ntype ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;\n\nexport type PluginConfigFor<\n V extends AnySchema,\n S extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> = {\n variables: V;\n secrets: S;\n context: TRequestContext;\n};\n\ntype PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {\n variables: InferSchemaOutput<V>;\n secrets: InferSchemaOutput<S>;\n};\n\nexport class PluginIdTag extends Context.Service<PluginIdTag, string>()(\"PluginId\") {}\n\n/**\n * The `initialize` effect's environment: the plugin lifecycle scope plus the\n * framework-assigned plugin id.\n */\nexport type PluginEnv = Scope.Scope | PluginIdTag;\n\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n /**\n * Optional tag under which `initialize` exposes the plugin's services.\n * The host uses it to read services (e.g. the auth plugin's Better Auth\n * handler) from the built Effect context without importing the plugin\n * module statically.\n */\n servicesTag?: Context.Key<any, any>;\n /**\n * Initialize the plugin by returning an Effect `Layer`.\n *\n * The runtime builds the Layer against the plugin's lifecycle scope —\n * scoped resources (db pools, repositories, caches, publishers) release\n * when the plugin shuts down. Services are provided to `.effect()`\n * handlers via the oRPC context (`yield* Tag`).\n */\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<Layer.Layer<any, Error, PluginEnv>, Error, PluginEnv>;\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * Services come from the Effect context — access them with\n * `yield* Tag` in `.effect()` handlers, or\n * `Context.get(context[\"effect/context\"], Tag)` in plain handlers.\n * Sibling plugin entries in `plugins` carry `{ client, router }`.\n */\n createRouter: (\n builder: Implementer<TContract, ContextOutput<TRequestContext> & WithEffectContext<any>>,\n plugins: P,\n ) => ContractedRouter<TContract, any>;\n};\n\n/**\n * Loaded plugin with static binding property\n */\nexport interface LoadedPluginWithBinding<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\n servicesTag?: Context.Key<any, any>;\n };\n}\n\n/**\n * Plugin interface\n */\nexport interface Plugin<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n readonly servicesTag?: Context.Key<any, any>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<Layer.Layer<any, Error, PluginEnv>, PluginRuntimeError, PluginEnv>;\n\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * The router's procedure types are inferred directly from the contract.\n * @param plugins Sibling plugin entries (`{ client, router }`) for\n * cross-plugin composition\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(plugins: Record<string, unknown>): ContractedRouter<TContract, any>;\n}\n\nexport interface CreatePluginFn {\n <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext>;\n\n withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;\n}\n\nexport const createPlugin: CreatePluginFn = function createPlugin<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, P>) {\n const configSchema: PluginConfigFor<V, S, TRequestContext> = {\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n class CreatedPlugin implements Plugin<TContract, V, S, TRequestContext> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n readonly servicesTag = config.servicesTag;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<Layer.Layer<any, Error, PluginEnv>, PluginRuntimeError, PluginEnv> {\n const init = config.initialize;\n if (!init) {\n return Effect.succeed(Layer.empty as unknown as Layer.Layer<any, Error, PluginEnv>);\n }\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.mapError((error) =>\n toPluginRuntimeError(error, this.id, undefined, \"initialize-plugin\"),\n ),\n );\n }\n\n createRouter(plugins: Record<string, unknown>): ContractedRouter<TContract, any> {\n const builder = implement(config.contract).$context<\n ContextOutput<TRequestContext> & WithEffectContext<any>\n >();\n return config.createRouter(builder as any, plugins as P) as ContractedRouter<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\n servicesTag?: Context.Key<any, any>;\n };\n };\n\n PluginConstructor.binding = {\n contract: config.contract,\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n servicesTag: config.servicesTag,\n };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext>;\n};\n\nexport type CreatePluginWithPlugins<P extends Record<string, unknown>> = <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext>;\n\nexport function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P> {\n return <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;AA0BA,IAAa,cAAb,cAAiCA,eAAQ,QAA6B,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AAiHrF,MAAa,eAA+B,SAAS,aAMnD,QAA+D;CAC/D,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;CAClB;CAEA,MAAM,cAAkE;;EAEtE;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EACxB,AAAS,cAAc,OAAO;EAE9B,WACE,cACA,UAAmC,CAAC,GAC8C;GAClF,MAAM,OAAO,OAAO;GACpB,IAAI,CAAC,MACH,OAAOC,cAAO,QAAQC,aAAM,KAAsD;GAGpF,OAAO,KAAK,cAAc,OAAY,CAAC,CAAC,KACtCD,cAAO,UAAU,UACfE,oCAAqB,OAAO,KAAK,IAAI,QAAW,mBAAmB,CACrE,CACF;EACF;EAEA,aAAa,SAAoE;GAC/E,MAAM,cAAUC,wBAAU,OAAO,QAAQ,CAAC,CAAC,SAEzC;GACF,OAAO,OAAO,aAAa,SAAgB,OAAY;EACzD;CACF;CAEA,MAAM,oBAAoB;CAW1B,kBAAkB,UAAU;EAC1B,UAAU,OAAO;EACjB,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,aAAa,OAAO;CACtB;CAEA,OAAO;AACT;AAWA,SAAgB,cAA6E;CAC3F,QAME,WACG,aAAkD,MAAa;AACtE;AAEA,aAAa,cAAc"}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { PluginRuntimeError } from "./runtime/errors.cjs";
|
|
2
|
+
import { ContractedRouter, Implementer } from "@orpc/server";
|
|
1
3
|
import { Context, Effect, Layer, Scope } from "effect";
|
|
2
4
|
import { AnyContractRouter, AnySchema, InferSchemaOutput } from "@orpc/contract";
|
|
3
|
-
import {
|
|
5
|
+
import { WithEffectContext } from "@orpc/experimental-effect";
|
|
6
|
+
import "@orpc/experimental-effect/extensions/effect";
|
|
4
7
|
//#region src/plugin.d.ts
|
|
5
8
|
type ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;
|
|
6
9
|
type PluginConfigFor<V extends AnySchema, S extends AnySchema, TRequestContext extends AnySchema | undefined> = {
|
|
@@ -12,65 +15,81 @@ type PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {
|
|
|
12
15
|
variables: InferSchemaOutput<V>;
|
|
13
16
|
secrets: InferSchemaOutput<S>;
|
|
14
17
|
};
|
|
18
|
+
declare const PluginIdTag_base: Context.ServiceClass<PluginIdTag, "PluginId", string>;
|
|
19
|
+
declare class PluginIdTag extends PluginIdTag_base {}
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
21
|
+
* The `initialize` effect's environment: the plugin lifecycle scope plus the
|
|
22
|
+
* framework-assigned plugin id.
|
|
17
23
|
*/
|
|
18
|
-
type
|
|
19
|
-
type
|
|
20
|
-
buildService: <T>(tag: T, layer: Layer.Layer<any, any, any>) => Effect.Effect<ServiceOf<T>>;
|
|
21
|
-
};
|
|
22
|
-
declare const PluginIdTag_base: Context.TagClass<PluginIdTag, "PluginId", string>;
|
|
23
|
-
declare class PluginIdTag extends PluginIdTag_base {}
|
|
24
|
-
type PluginDefinition<V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined, TDeps extends Record<string, any>, P extends Record<string, unknown>> = {
|
|
24
|
+
type PluginEnv = Scope.Scope | PluginIdTag;
|
|
25
|
+
type PluginDefinition<V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined, P extends Record<string, unknown>> = {
|
|
25
26
|
variables: V;
|
|
26
27
|
secrets: S;
|
|
27
28
|
contract: TContract;
|
|
28
29
|
context?: TRequestContext;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Optional tag under which `initialize` exposes the plugin's services.
|
|
32
|
+
* The host uses it to read services (e.g. the auth plugin's Better Auth
|
|
33
|
+
* handler) from the built Effect context without importing the plugin
|
|
34
|
+
* module statically.
|
|
35
|
+
*/
|
|
36
|
+
servicesTag?: Context.Key<any, any>;
|
|
37
|
+
/**
|
|
38
|
+
* Initialize the plugin by returning an Effect `Layer`.
|
|
39
|
+
*
|
|
40
|
+
* The runtime builds the Layer against the plugin's lifecycle scope —
|
|
41
|
+
* scoped resources (db pools, repositories, caches, publishers) release
|
|
42
|
+
* when the plugin shuts down. Services are provided to `.effect()`
|
|
43
|
+
* handlers via the oRPC context (`yield* Tag`).
|
|
44
|
+
*/
|
|
45
|
+
initialize?: (config: PluginInitializeInput<V, S>, plugins: P) => Effect.Effect<Layer.Layer<any, Error, PluginEnv>, Error, PluginEnv>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates the strongly-typed oRPC router for this plugin.
|
|
48
|
+
* Services come from the Effect context — access them with
|
|
49
|
+
* `yield* Tag` in `.effect()` handlers, or
|
|
50
|
+
* `Context.get(context["effect/context"], Tag)` in plain handlers.
|
|
51
|
+
* Sibling plugin entries in `plugins` carry `{ client, router }`.
|
|
33
52
|
*/
|
|
34
|
-
|
|
35
|
-
createRouter: (deps: TDeps, builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>) => Router<TContract, any>;
|
|
36
|
-
shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;
|
|
53
|
+
createRouter: (builder: Implementer<TContract, ContextOutput<TRequestContext> & WithEffectContext<any>>, plugins: P) => ContractedRouter<TContract, any>;
|
|
37
54
|
};
|
|
38
55
|
/**
|
|
39
56
|
* Loaded plugin with static binding property
|
|
40
57
|
*/
|
|
41
|
-
interface LoadedPluginWithBinding<TContract extends AnyContractRouter, TVariables extends AnySchema, TSecrets extends AnySchema, TRequestContext extends AnySchema | undefined
|
|
42
|
-
new (): Plugin<TContract, TVariables, TSecrets, TRequestContext
|
|
58
|
+
interface LoadedPluginWithBinding<TContract extends AnyContractRouter, TVariables extends AnySchema, TSecrets extends AnySchema, TRequestContext extends AnySchema | undefined> {
|
|
59
|
+
new (): Plugin<TContract, TVariables, TSecrets, TRequestContext>;
|
|
43
60
|
binding: {
|
|
44
61
|
contract: TContract;
|
|
45
62
|
variables: TVariables;
|
|
46
63
|
secrets: TSecrets;
|
|
47
64
|
context: TRequestContext;
|
|
65
|
+
servicesTag?: Context.Key<any, any>;
|
|
48
66
|
};
|
|
49
67
|
}
|
|
50
68
|
/**
|
|
51
69
|
* Plugin interface
|
|
52
70
|
*/
|
|
53
|
-
interface Plugin<TContract extends AnyContractRouter, TVariables extends AnySchema, TSecrets extends AnySchema, TRequestContext extends AnySchema | undefined
|
|
71
|
+
interface Plugin<TContract extends AnyContractRouter, TVariables extends AnySchema, TSecrets extends AnySchema, TRequestContext extends AnySchema | undefined> {
|
|
54
72
|
readonly id: string;
|
|
55
73
|
readonly contract: TContract;
|
|
56
74
|
readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
readonly servicesTag?: Context.Key<any, any>;
|
|
76
|
+
initialize(config: PluginInitializeInput<TVariables, TSecrets>, plugins: Record<string, unknown>): Effect.Effect<Layer.Layer<any, Error, PluginEnv>, PluginRuntimeError, PluginEnv>;
|
|
59
77
|
/**
|
|
60
78
|
* Creates the strongly-typed oRPC router for this plugin.
|
|
61
79
|
* The router's procedure types are inferred directly from the contract.
|
|
62
|
-
* @param
|
|
80
|
+
* @param plugins Sibling plugin entries (`{ client, router }`) for
|
|
81
|
+
* cross-plugin composition
|
|
63
82
|
* @returns A router with procedures matching the plugin's contract
|
|
64
83
|
*/
|
|
65
|
-
createRouter(
|
|
84
|
+
createRouter(plugins: Record<string, unknown>): ContractedRouter<TContract, any>;
|
|
66
85
|
}
|
|
67
86
|
interface CreatePluginFn {
|
|
68
|
-
<V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined = undefined,
|
|
87
|
+
<V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined = undefined, P extends Record<string, unknown> = Record<string, never>>(config: PluginDefinition<V, S, TContract, TRequestContext, P>): LoadedPluginWithBinding<TContract, V, S, TRequestContext>;
|
|
69
88
|
withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;
|
|
70
89
|
}
|
|
71
90
|
declare const createPlugin: CreatePluginFn;
|
|
72
|
-
type CreatePluginWithPlugins<P extends Record<string, unknown>> = <V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined = undefined
|
|
91
|
+
type CreatePluginWithPlugins<P extends Record<string, unknown>> = <V extends AnySchema, S extends AnySchema, TContract extends AnyContractRouter, TRequestContext extends AnySchema | undefined = undefined>(config: PluginDefinition<V, S, TContract, TRequestContext, P>) => LoadedPluginWithBinding<TContract, V, S, TRequestContext>;
|
|
73
92
|
declare function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P>;
|
|
74
93
|
//#endregion
|
|
75
|
-
export { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor,
|
|
94
|
+
export { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor, PluginEnv, PluginIdTag, createPlugin, withPlugins };
|
|
76
95
|
//# sourceMappingURL=plugin.d.cts.map
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;KASK,cAAc,KAAK,UAAU,YAAY,kBAAkB,KAAK;KAEzD,gBACV,UAAU,WACV,UAAU,WACV,wBAAwB;EAExB,WAAW;EACX,SAAS;EACT,SAAS;;KAGN,sBAAsB,UAAU,WAAW,UAAU;EACxD,WAAW,kBAAkB;EAC7B,SAAS,kBAAkB;;;cAGhB,oBAAoB;;;;;KAMrB,YAAY,MAAM,QAAQ;KAEjC,iBACH,UAAU,WACV,UAAU,WACV,kBAAkB,mBAClB,wBAAwB,uBACxB,UAAU;EAEV,WAAW;EACX,SAAS;EACT,UAAU;EACV,UAAU;;;;;;;EAOV,cAAc,QAAQ;;;;;;;;;EAStB,cACE,QAAQ,sBAAsB,GAAG,IACjC,SAAS,MACN,OAAO,OAAO,MAAM,WAAW,OAAO,YAAY,OAAO;;;;;;;;EAQ9D,eACE,SAAS,YAAY,WAAW,cAAc,mBAAmB,yBACjE,SAAS,MACN,iBAAiB;;;;;UAMP,wBACf,kBAAkB,mBAClB,mBAAmB,WACnB,iBAAiB,WACjB,wBAAwB;UAEhB,OAAO,WAAW,YAAY,UAAU;EAChD;IACE,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;IACT,cAAc,QAAQ;;;;;;UAOT,OACf,kBAAkB,mBAClB,mBAAmB,WACnB,iBAAiB,WACjB,wBAAwB;WAEf;WACA,UAAU;WACV,cAAc,gBAAgB,YAAY,UAAU;WACpD,cAAc,QAAQ;EAE/B,WACE,QAAQ,sBAAsB,YAAY,WAC1C,SAAS,0BACR,OAAO,OAAO,MAAM,WAAW,OAAO,YAAY,oBAAoB;;;;;;;;EASzE,aAAa,SAAS,0BAA0B,iBAAiB;;UAGlD;GAEb,UAAU,WACV,UAAU,WACV,kBAAkB,mBAClB,wBAAwB,mCACxB,UAAU,0BAA0B,uBAEpC,QAAQ,iBAAiB,GAAG,GAAG,WAAW,iBAAiB,KAC1D,wBAAwB,WAAW,GAAG,GAAG;EAE5C,cAAc,UAAU,8BAA8B,wBAAwB;;cAGnE,cAAc;KAkEf,wBAAwB,UAAU,4BAC5C,UAAU,WACV,UAAU,WACV,kBAAkB,mBAClB,wBAAwB,mCAExB,QAAQ,iBAAiB,GAAG,GAAG,WAAW,iBAAiB,OACxD,wBAAwB,WAAW,GAAG,GAAG;iBAE9B,YAAY,UAAU,4BAA4B,wBAAwB"}
|