every-plugin 0.9.0 → 2.2.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/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +15 -1
- package/dist/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +15 -2
- package/dist/build/rspack/dev-server-middleware.cjs +15 -4
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs +15 -4
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +44 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +11 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +11 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +43 -0
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -0
- package/dist/build/rspack/index.cjs +8 -4
- package/dist/build/rspack/index.d.cts +3 -2
- package/dist/build/rspack/index.d.mts +3 -2
- package/dist/build/rspack/index.mjs +3 -2
- package/dist/build/rspack/module-federation.cjs +3 -3
- 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 +83 -5
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.d.cts +12 -1
- package/dist/build/rspack/plugin.d.cts.map +1 -1
- package/dist/build/rspack/plugin.d.mts +12 -1
- package/dist/build/rspack/plugin.d.mts.map +1 -1
- package/dist/build/rspack/plugin.mjs +80 -5
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/rspack/utils.cjs +5 -4
- package/dist/build/rspack/utils.cjs.map +1 -1
- package/dist/build/rspack/utils.mjs +3 -2
- package/dist/build/rspack/utils.mjs.map +1 -1
- package/dist/build/shared-deps.cjs +50 -42
- package/dist/build/shared-deps.cjs.map +1 -1
- package/dist/build/shared-deps.d.cts +27 -2
- package/dist/build/shared-deps.d.cts.map +1 -1
- package/dist/build/shared-deps.d.mts +27 -2
- package/dist/build/shared-deps.d.mts.map +1 -1
- package/dist/build/shared-deps.mjs +48 -43
- package/dist/build/shared-deps.mjs.map +1 -1
- package/dist/errors.cjs +1 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/orpc-client.cjs +17 -0
- package/dist/orpc-client.d.cts +2 -0
- package/dist/orpc-client.d.mts +2 -0
- package/dist/orpc-client.mjs +5 -0
- package/dist/orpc-openapi.cjs +17 -0
- package/dist/orpc-openapi.d.cts +2 -0
- package/dist/orpc-openapi.d.mts +2 -0
- package/dist/orpc-openapi.mjs +5 -0
- package/dist/orpc.cjs +8 -7
- package/dist/plugin.cjs +9 -7
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +23 -24
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +23 -24
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +8 -7
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/errors.cjs +2 -2
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.d.cts +4 -4
- package/dist/runtime/errors.d.cts.map +1 -1
- package/dist/runtime/errors.d.mts +4 -4
- package/dist/runtime/errors.d.mts.map +1 -1
- package/dist/runtime/errors.mjs +1 -1
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs +41 -37
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +3 -3
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +3 -3
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +12 -9
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +33 -0
- package/dist/runtime/mf-config.cjs.map +1 -0
- package/dist/runtime/mf-config.d.cts +41 -0
- package/dist/runtime/mf-config.d.cts.map +1 -0
- package/dist/runtime/mf-config.d.mts +41 -0
- package/dist/runtime/mf-config.d.mts.map +1 -0
- package/dist/runtime/mf-config.mjs +29 -0
- package/dist/runtime/mf-config.mjs.map +1 -0
- package/dist/runtime/services/module-federation.service.cjs +19 -56
- package/dist/runtime/services/module-federation.service.cjs.map +1 -1
- package/dist/runtime/services/module-federation.service.d.cts.map +1 -1
- package/dist/runtime/services/module-federation.service.d.mts.map +1 -1
- package/dist/runtime/services/module-federation.service.mjs +18 -55
- package/dist/runtime/services/module-federation.service.mjs.map +1 -1
- package/dist/runtime/services/normalize.cjs +3 -2
- package/dist/runtime/services/normalize.cjs.map +1 -1
- package/dist/runtime/services/normalize.mjs +2 -2
- package/dist/runtime/services/normalize.mjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.cjs +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs +3 -3
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts +1 -1
- package/dist/runtime/services/plugin-loader.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.d.mts +1 -1
- package/dist/runtime/services/plugin-loader.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin-loader.service.mjs +2 -2
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/plugin.service.cjs +1 -1
- package/dist/runtime/services/plugin.service.cjs.map +1 -1
- package/dist/runtime/services/plugin.service.d.cts +6 -7
- package/dist/runtime/services/plugin.service.d.cts.map +1 -1
- package/dist/runtime/services/plugin.service.d.mts +6 -7
- package/dist/runtime/services/plugin.service.d.mts.map +1 -1
- package/dist/runtime/services/plugin.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +1 -1
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.d.cts.map +1 -1
- package/dist/runtime/services/secrets.service.d.mts.map +1 -1
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/runtime/validation.cjs +1 -1
- package/dist/runtime/validation.cjs.map +1 -1
- package/dist/runtime/validation.mjs.map +1 -1
- package/dist/testing/index.cjs +2 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +0 -2
- package/dist/testing/index.d.cts.map +1 -1
- package/dist/testing/index.d.mts +0 -2
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/types.d.cts +6 -6
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +6 -6
- package/dist/types.d.mts.map +1 -1
- package/dist/zod.cjs +4 -3
- package/dist/zod.mjs +2 -2
- package/package.json +200 -182
- package/src/build/rspack/dev-server-middleware.ts +233 -0
- package/src/build/rspack/fix-mf-data-uri-plugin.ts +49 -0
- package/src/build/rspack/index.ts +14 -0
- package/src/build/rspack/module-federation.ts +6 -0
- package/src/build/rspack/plugin.ts +252 -0
- package/src/build/rspack/utils.ts +60 -0
- package/src/build/shared-deps.ts +79 -0
- package/src/effect.ts +1 -0
- package/src/errors.ts +140 -0
- package/src/index.ts +26 -0
- package/src/orpc-client.ts +2 -0
- package/src/orpc-openapi.ts +2 -0
- package/src/orpc.ts +9 -0
- package/src/plugin.ts +220 -0
- package/src/runtime/errors.ts +332 -0
- package/src/runtime/index.ts +258 -0
- package/src/runtime/mf-config.ts +39 -0
- package/src/runtime/services/module-federation.service.ts +181 -0
- package/src/runtime/services/normalize.ts +18 -0
- package/src/runtime/services/plugin-lifecycle.service.ts +86 -0
- package/src/runtime/services/plugin-loader.service.ts +254 -0
- package/src/runtime/services/plugin.service.ts +66 -0
- package/src/runtime/services/secrets.service.ts +74 -0
- package/src/runtime/services.ts +5 -0
- package/src/runtime/validation.ts +23 -0
- package/src/testing/index.ts +87 -0
- package/src/testing/mocks/module-federation.service.ts +41 -0
- package/src/types.ts +309 -0
- package/src/zod-core.ts +4 -0
- package/src/zod.ts +1 -0
- package/dist/package.cjs +0 -45
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -27
- package/dist/package.mjs.map +0 -1
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
//#region src/build/shared-deps.d.ts
|
|
2
2
|
interface SharedDependencyConfig {
|
|
3
3
|
version: string;
|
|
4
|
+
requiredVersion: string | false;
|
|
4
5
|
singleton: boolean;
|
|
5
6
|
strictVersion: boolean;
|
|
6
7
|
eager: boolean;
|
|
7
8
|
}
|
|
8
9
|
type SharedDependencies = Record<string, SharedDependencyConfig>;
|
|
10
|
+
declare const pluginSharedDependencies: {
|
|
11
|
+
"every-plugin": {
|
|
12
|
+
requiredVersion: string | false;
|
|
13
|
+
singleton: boolean;
|
|
14
|
+
strictVersion: boolean;
|
|
15
|
+
eager: boolean;
|
|
16
|
+
version: string;
|
|
17
|
+
};
|
|
18
|
+
effect: {
|
|
19
|
+
requiredVersion: string | false;
|
|
20
|
+
singleton: boolean;
|
|
21
|
+
strictVersion: boolean;
|
|
22
|
+
eager: boolean;
|
|
23
|
+
version: string;
|
|
24
|
+
};
|
|
25
|
+
zod: {
|
|
26
|
+
requiredVersion: string | false;
|
|
27
|
+
singleton: boolean;
|
|
28
|
+
strictVersion: boolean;
|
|
29
|
+
eager: boolean;
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;
|
|
9
34
|
declare function getPluginSharedDependencies(): SharedDependencies;
|
|
35
|
+
declare function getPluginSharedDependenciesVersionRange(): Record<string, string>;
|
|
10
36
|
declare function getMajorMinorVersion(version: string): string;
|
|
11
|
-
declare function getPluginSharedDependenciesVersionRange(): SharedDependencies;
|
|
12
37
|
//#endregion
|
|
13
|
-
export { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
|
|
38
|
+
export { PluginSharedDependencyName, SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange, pluginSharedDependencies };
|
|
14
39
|
//# sourceMappingURL=shared-deps.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"shared-deps.d.cts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;KAYD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
//#region src/build/shared-deps.d.ts
|
|
2
2
|
interface SharedDependencyConfig {
|
|
3
3
|
version: string;
|
|
4
|
+
requiredVersion: string | false;
|
|
4
5
|
singleton: boolean;
|
|
5
6
|
strictVersion: boolean;
|
|
6
7
|
eager: boolean;
|
|
7
8
|
}
|
|
8
9
|
type SharedDependencies = Record<string, SharedDependencyConfig>;
|
|
10
|
+
declare const pluginSharedDependencies: {
|
|
11
|
+
"every-plugin": {
|
|
12
|
+
requiredVersion: string | false;
|
|
13
|
+
singleton: boolean;
|
|
14
|
+
strictVersion: boolean;
|
|
15
|
+
eager: boolean;
|
|
16
|
+
version: string;
|
|
17
|
+
};
|
|
18
|
+
effect: {
|
|
19
|
+
requiredVersion: string | false;
|
|
20
|
+
singleton: boolean;
|
|
21
|
+
strictVersion: boolean;
|
|
22
|
+
eager: boolean;
|
|
23
|
+
version: string;
|
|
24
|
+
};
|
|
25
|
+
zod: {
|
|
26
|
+
requiredVersion: string | false;
|
|
27
|
+
singleton: boolean;
|
|
28
|
+
strictVersion: boolean;
|
|
29
|
+
eager: boolean;
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;
|
|
9
34
|
declare function getPluginSharedDependencies(): SharedDependencies;
|
|
35
|
+
declare function getPluginSharedDependenciesVersionRange(): Record<string, string>;
|
|
10
36
|
declare function getMajorMinorVersion(version: string): string;
|
|
11
|
-
declare function getPluginSharedDependenciesVersionRange(): SharedDependencies;
|
|
12
37
|
//#endregion
|
|
13
|
-
export { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
|
|
38
|
+
export { PluginSharedDependencyName, SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange, pluginSharedDependencies };
|
|
14
39
|
//# sourceMappingURL=shared-deps.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"shared-deps.d.mts","names":[],"sources":["../../src/build/shared-deps.ts"],"mappings":";UAgBiB,sBAAA;EACf,OAAA;EACA,eAAA;EACA,SAAA;EACA,aAAA;EACA,KAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,MAAA,SAAe,sBAAA;AAAA,cAsBnC,wBAAA;;;;;;;;;;;;;;;;;;;;;;;KAYD,0BAAA,gBAA0C,wBAAA;AAAA,iBAEtC,2BAAA,CAAA,GAA+B,kBAAA;AAAA,iBAI/B,uCAAA,CAAA,GAA2C,MAAA;AAAA,iBAS3C,oBAAA,CAAqB,OAAA"}
|
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
2
5
|
|
|
3
6
|
//#region src/build/shared-deps.ts
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
let pkg;
|
|
10
|
+
try {
|
|
11
|
+
pkg = JSON.parse(readFileSync(join(__dirname, "../../package.json"), "utf-8"));
|
|
12
|
+
} catch {
|
|
13
|
+
pkg = require("every-plugin/package.json");
|
|
14
|
+
}
|
|
15
|
+
const DEFAULT_SHARE_CONFIG = {
|
|
16
|
+
requiredVersion: false,
|
|
17
|
+
singleton: true,
|
|
18
|
+
strictVersion: false,
|
|
19
|
+
eager: false
|
|
20
|
+
};
|
|
21
|
+
function extractExactVersion(input) {
|
|
22
|
+
const match = input.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/);
|
|
23
|
+
return match ? match[0] : input.replace(/^[\^~>=<\s]+/, "");
|
|
24
|
+
}
|
|
25
|
+
function getInstalledPackageVersion(packageName, fallbackVersion) {
|
|
26
|
+
try {
|
|
27
|
+
return require(`${packageName}/package.json`).version;
|
|
28
|
+
} catch {
|
|
29
|
+
return extractExactVersion(fallbackVersion);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const pluginSharedDependencies = {
|
|
33
|
+
"every-plugin": {
|
|
34
|
+
version: pkg.version,
|
|
35
|
+
...DEFAULT_SHARE_CONFIG
|
|
36
|
+
},
|
|
37
|
+
effect: {
|
|
38
|
+
version: getInstalledPackageVersion("effect", pkg.peerDependencies.effect),
|
|
39
|
+
...DEFAULT_SHARE_CONFIG
|
|
40
|
+
},
|
|
41
|
+
zod: {
|
|
42
|
+
version: getInstalledPackageVersion("zod", pkg.peerDependencies.zod),
|
|
43
|
+
...DEFAULT_SHARE_CONFIG
|
|
44
|
+
}
|
|
45
|
+
};
|
|
4
46
|
function getPluginSharedDependencies() {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
strictVersion: false,
|
|
10
|
-
eager: false
|
|
11
|
-
},
|
|
12
|
-
effect: {
|
|
13
|
-
version: peerDependencies.effect,
|
|
14
|
-
singleton: true,
|
|
15
|
-
strictVersion: false,
|
|
16
|
-
eager: false
|
|
17
|
-
},
|
|
18
|
-
zod: {
|
|
19
|
-
version: peerDependencies.zod,
|
|
20
|
-
singleton: true,
|
|
21
|
-
strictVersion: false,
|
|
22
|
-
eager: false
|
|
23
|
-
},
|
|
24
|
-
"@orpc/contract": {
|
|
25
|
-
version: dependencies["@orpc/contract"],
|
|
26
|
-
singleton: true,
|
|
27
|
-
strictVersion: false,
|
|
28
|
-
eager: false
|
|
29
|
-
},
|
|
30
|
-
"@orpc/server": {
|
|
31
|
-
version: dependencies["@orpc/server"],
|
|
32
|
-
singleton: true,
|
|
33
|
-
strictVersion: false,
|
|
34
|
-
eager: false
|
|
35
|
-
}
|
|
36
|
-
};
|
|
47
|
+
return pluginSharedDependencies;
|
|
48
|
+
}
|
|
49
|
+
function getPluginSharedDependenciesVersionRange() {
|
|
50
|
+
return Object.fromEntries(Object.entries(getPluginSharedDependencies()).map(([name, config]) => [name, getMajorMinorVersion(config.version)]));
|
|
37
51
|
}
|
|
38
52
|
function getMajorMinorVersion(version) {
|
|
39
53
|
const match = version.replace(/^[\^~>=<]+/, "").match(/^(\d+)\.(\d+)/);
|
|
40
54
|
if (!match) return "^0.0.0";
|
|
41
55
|
return `^${match[1]}.${match[2]}.0`;
|
|
42
56
|
}
|
|
43
|
-
function getPluginSharedDependenciesVersionRange() {
|
|
44
|
-
const deps = getPluginSharedDependencies();
|
|
45
|
-
const result = {};
|
|
46
|
-
for (const [key, config] of Object.entries(deps)) result[key] = {
|
|
47
|
-
...config,
|
|
48
|
-
version: getMajorMinorVersion(config.version)
|
|
49
|
-
};
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
57
|
|
|
53
58
|
//#endregion
|
|
54
|
-
export { getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
|
|
59
|
+
export { getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange, pluginSharedDependencies };
|
|
55
60
|
//# sourceMappingURL=shared-deps.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-deps.mjs","names":[
|
|
1
|
+
{"version":3,"file":"shared-deps.mjs","names":[],"sources":["../../src/build/shared-deps.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\n\nlet pkg: typeof import(\"../../package.json\");\n\ntry {\n pkg = JSON.parse(readFileSync(join(__dirname, \"../../package.json\"), \"utf-8\"));\n} catch {\n pkg = require(\"every-plugin/package.json\");\n}\n\nexport interface SharedDependencyConfig {\n version: string;\n requiredVersion: string | false;\n singleton: boolean;\n strictVersion: boolean;\n eager: boolean;\n}\n\nexport type SharedDependencies = Record<string, SharedDependencyConfig>;\n\nconst DEFAULT_SHARE_CONFIG: Omit<SharedDependencyConfig, \"version\"> = {\n requiredVersion: false,\n singleton: true,\n strictVersion: false,\n eager: false,\n};\n\nfunction extractExactVersion(input: string): string {\n const match = input.match(/\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?/);\n return match ? match[0] : input.replace(/^[\\^~>=<\\s]+/, \"\");\n}\n\nfunction getInstalledPackageVersion(packageName: string, fallbackVersion: string): string {\n try {\n return require(`${packageName}/package.json`).version as string;\n } catch {\n return extractExactVersion(fallbackVersion);\n }\n}\n\nexport const pluginSharedDependencies = {\n \"every-plugin\": { version: pkg.version, ...DEFAULT_SHARE_CONFIG },\n effect: {\n version: getInstalledPackageVersion(\"effect\", pkg.peerDependencies.effect),\n ...DEFAULT_SHARE_CONFIG,\n },\n zod: {\n version: getInstalledPackageVersion(\"zod\", pkg.peerDependencies.zod),\n ...DEFAULT_SHARE_CONFIG,\n },\n} satisfies SharedDependencies;\n\nexport type PluginSharedDependencyName = keyof typeof pluginSharedDependencies;\n\nexport function getPluginSharedDependencies(): SharedDependencies {\n return pluginSharedDependencies;\n}\n\nexport function getPluginSharedDependenciesVersionRange(): Record<string, string> {\n return Object.fromEntries(\n Object.entries(getPluginSharedDependencies()).map(([name, config]) => [\n name,\n getMajorMinorVersion(config.version),\n ]),\n );\n}\n\nexport function getMajorMinorVersion(version: string): string {\n const clean = version.replace(/^[\\^~>=<]+/, \"\");\n const match = clean.match(/^(\\d+)\\.(\\d+)/);\n if (!match) return \"^0.0.0\";\n return `^${match[1]}.${match[2]}.0`;\n}\n"],"mappings":";;;;;;AAKA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AACzD,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAI;AAEJ,IAAI;AACF,OAAM,KAAK,MAAM,aAAa,KAAK,WAAW,qBAAqB,EAAE,QAAQ,CAAC;QACxE;AACN,OAAM,QAAQ,4BAA4B;;AAa5C,MAAM,uBAAgE;CACpE,iBAAiB;CACjB,WAAW;CACX,eAAe;CACf,OAAO;CACR;AAED,SAAS,oBAAoB,OAAuB;CAClD,MAAM,QAAQ,MAAM,MAAM,oCAAoC;AAC9D,QAAO,QAAQ,MAAM,KAAK,MAAM,QAAQ,gBAAgB,GAAG;;AAG7D,SAAS,2BAA2B,aAAqB,iBAAiC;AACxF,KAAI;AACF,SAAO,QAAQ,GAAG,YAAY,eAAe,CAAC;SACxC;AACN,SAAO,oBAAoB,gBAAgB;;;AAI/C,MAAa,2BAA2B;CACtC,gBAAgB;EAAE,SAAS,IAAI;EAAS,GAAG;EAAsB;CACjE,QAAQ;EACN,SAAS,2BAA2B,UAAU,IAAI,iBAAiB,OAAO;EAC1E,GAAG;EACJ;CACD,KAAK;EACH,SAAS,2BAA2B,OAAO,IAAI,iBAAiB,IAAI;EACpE,GAAG;EACJ;CACF;AAID,SAAgB,8BAAkD;AAChE,QAAO;;AAGT,SAAgB,0CAAkE;AAChF,QAAO,OAAO,YACZ,OAAO,QAAQ,6BAA6B,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CACpE,MACA,qBAAqB,OAAO,QAAQ,CACrC,CAAC,CACH;;AAGH,SAAgB,qBAAqB,SAAyB;CAE5D,MAAM,QADQ,QAAQ,QAAQ,cAAc,GAAG,CAC3B,MAAM,gBAAgB;AAC1C,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,IAAI,MAAM,GAAG,GAAG,MAAM,GAAG"}
|
package/dist/errors.cjs
CHANGED
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { z } from \"./zod\";\n\n/**\n * Error pattern constants for categorizing infrastructure errors\n */\nexport const ERROR_PATTERNS = {\n
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { z } from \"./zod\";\n\n/**\n * Error pattern constants for categorizing infrastructure errors\n */\nexport const ERROR_PATTERNS = {\n CONNECTION_REFUSED: [\"ECONNREFUSED\"],\n HOST_NOT_FOUND: [\"ENOTFOUND\", \"EHOSTUNREACH\"],\n TIMEOUT: [\"ETIMEDOUT\", \"ESOCKETTIMEDOUT\", \"timeout\"],\n CONNECTION_RESET: [\"ECONNRESET\", \"EPIPE\"],\n PERMISSION: [\"EACCES\", \"EPERM\", \"permission denied\"],\n AUTH: [\"401\", \"unauthorized\", \"authentication failed\"],\n RATE_LIMITED: [\"429\", \"too many requests\", \"rate limit\"],\n SERVICE_UNAVAILABLE: [\"503\", \"service unavailable\"],\n} as const;\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 * @deprecated Use individual imports or PluginErrors instead\n */\nexport const CommonPluginErrors = PluginErrors;\n\nexport {\n extractFromFiberFailure,\n formatORPCError,\n isRetryableORPCCode,\n ModuleFederationError,\n PluginRuntimeError,\n toPluginRuntimeError,\n ValidationError,\n wrapORPCError,\n} from \"./runtime/errors\";\n"],"mappings":";;;;;;;;AAKA,MAAa,iBAAiB;CAC5B,oBAAoB,CAAC,eAAe;CACpC,gBAAgB,CAAC,aAAa,eAAe;CAC7C,SAAS;EAAC;EAAa;EAAmB;EAAU;CACpD,kBAAkB,CAAC,cAAc,QAAQ;CACzC,YAAY;EAAC;EAAU;EAAS;EAAoB;CACpD,MAAM;EAAC;EAAO;EAAgB;EAAwB;CACtD,cAAc;EAAC;EAAO;EAAqB;EAAa;CACxD,qBAAqB,CAAC,OAAO,sBAAsB;CACpD;;;;;;;;;;;;;;;AAiBD,MAAa,eAAe;CAC1B,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,wCAAgB,EAAE,SAAS;EAC3B,kCAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,kCAAU,EAAE,KAAK;GAAC;GAAU;GAAS;GAAQ,CAAC,CAAC,UAAU;EAC1D,CAAC;CACH;AAED,MAAa,eAAe;CAC1B,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,oCAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;EACnC,2CAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EACrD,mCAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAC3C,mCAAW,EAAE,KAAK;GAAC;GAAY;GAAU;GAAY,CAAC,CAAC,UAAU;EAClE,CAAC;CACH;AAED,MAAa,sBAAsB;CACjC,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,oCAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACvC,2CAAmB,EAAE,SAAS,CAAC,QAAQ,MAAM;EAC7C,yCAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAClD,CAAC;CACH;AAED,MAAa,cAAc;CACzB,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,uCAAe,EAAE,8BAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EAC7C,0CAAkB,EACf,8BACC,EAAE,OAAO;GACP,+BAAO,EAAE,QAAQ;GACjB,iCAAS,EAAE,QAAQ;GACnB,8BAAM,EAAE,QAAQ,CAAC,UAAU;GAC5B,CAAC,CACH,CACA,UAAU;EACd,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,kCAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,oCAAY,EAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,6CAAqB,EAAE,8BAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EACnD,gCAAQ,EAAE,QAAQ,CAAC,UAAU;EAC9B,CAAC;CACH;AAED,MAAa,UAAU;CACrB,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,mCAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EAC7C,mCAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,mCAAW,EAAE,SAAS,CAAC,QAAQ,KAAK;EACrC,CAAC;CACH;AAED,MAAa,mBAAmB;CAC9B,QAAQ;CACR,8BAAM,EAAE,OAAO;EACb,mCAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,8BAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,8BAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACjC,oCAAY,EAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;;;;;AAMD,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AAKD,MAAa,qBAAqB"}
|
package/dist/errors.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;cAKa,cAAA;EAAA;;;;;;;;;;;;;AA0Bb;;;;;;;;;;cAAa,YAAA;EAAA;;;;;;;;;;;cASA,YAAA;EAAA;;;;;;;;;;;;cAUA,mBAAA;EAAA;;;;;;;cASA,WAAA;EAAA;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;cAKa,cAAA;EAAA;;;;;;;;;;;;;AA0Bb;;;;;;;;;;cAAa,YAAA;EAAA;;;;;;;;;;;cASA,YAAA;EAAA;;;;;;;;;;;;cAUA,mBAAA;EAAA;;;;;;;cASA,WAAA;EAAA;;;;;;;;;;cAgBA,SAAA;EAAA;;;;;;cAQA,SAAA;EAAA;;;;;;cAQA,OAAA;EAAA;;;;;;;cASA,gBAAA;EAAA;;;;;;;;;;;;cAcA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAcA,kBAAA;EAAA"}
|
package/dist/errors.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;cAKa,cAAA;EAAA;;;;;;;;;;;;;AA0Bb;;;;;;;;;;cAAa,YAAA;EAAA;;;;;;;;;;;cASA,YAAA;EAAA;;;;;;;;;;;;cAUA,mBAAA;EAAA;;;;;;;cASA,WAAA;EAAA;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../src/errors.ts"],"mappings":";;;;;;;cAKa,cAAA;EAAA;;;;;;;;;;;;;AA0Bb;;;;;;;;;;cAAa,YAAA;EAAA;;;;;;;;;;;cASA,YAAA;EAAA;;;;;;;;;;;;cAUA,mBAAA;EAAA;;;;;;;cASA,WAAA;EAAA;;;;;;;;;;cAgBA,SAAA;EAAA;;;;;;cAQA,SAAA;EAAA;;;;;;cAQA,OAAA;EAAA;;;;;;;cASA,gBAAA;EAAA;;;;;;;;;;;;cAcA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAcA,kBAAA;EAAA"}
|
package/dist/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":["z"],"sources":["../src/errors.ts"],"sourcesContent":["import { z } from \"./zod\";\n\n/**\n * Error pattern constants for categorizing infrastructure errors\n */\nexport const ERROR_PATTERNS = {\n
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":["z"],"sources":["../src/errors.ts"],"sourcesContent":["import { z } from \"./zod\";\n\n/**\n * Error pattern constants for categorizing infrastructure errors\n */\nexport const ERROR_PATTERNS = {\n CONNECTION_REFUSED: [\"ECONNREFUSED\"],\n HOST_NOT_FOUND: [\"ENOTFOUND\", \"EHOSTUNREACH\"],\n TIMEOUT: [\"ETIMEDOUT\", \"ESOCKETTIMEDOUT\", \"timeout\"],\n CONNECTION_RESET: [\"ECONNRESET\", \"EPIPE\"],\n PERMISSION: [\"EACCES\", \"EPERM\", \"permission denied\"],\n AUTH: [\"401\", \"unauthorized\", \"authentication failed\"],\n RATE_LIMITED: [\"429\", \"too many requests\", \"rate limit\"],\n SERVICE_UNAVAILABLE: [\"503\", \"service unavailable\"],\n} as const;\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 * @deprecated Use individual imports or PluginErrors instead\n */\nexport const CommonPluginErrors = PluginErrors;\n\nexport {\n extractFromFiberFailure,\n formatORPCError,\n isRetryableORPCCode,\n ModuleFederationError,\n PluginRuntimeError,\n toPluginRuntimeError,\n ValidationError,\n wrapORPCError,\n} from \"./runtime/errors\";\n"],"mappings":";;;;;;;AAKA,MAAa,iBAAiB;CAC5B,oBAAoB,CAAC,eAAe;CACpC,gBAAgB,CAAC,aAAa,eAAe;CAC7C,SAAS;EAAC;EAAa;EAAmB;EAAU;CACpD,kBAAkB,CAAC,cAAc,QAAQ;CACzC,YAAY;EAAC;EAAU;EAAS;EAAoB;CACpD,MAAM;EAAC;EAAO;EAAgB;EAAwB;CACtD,cAAc;EAAC;EAAO;EAAqB;EAAa;CACxD,qBAAqB,CAAC,OAAO,sBAAsB;CACpD;;;;;;;;;;;;;;;AAiBD,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,gBAAgBA,cAAE,SAAS;EAC3B,UAAUA,cAAE,QAAQ,CAAC,UAAU;EAC/B,UAAUA,cAAE,KAAK;GAAC;GAAU;GAAS;GAAQ,CAAC,CAAC,UAAU;EAC1D,CAAC;CACH;AAED,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,YAAYA,cAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;EACnC,mBAAmBA,cAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EACrD,WAAWA,cAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAC3C,WAAWA,cAAE,KAAK;GAAC;GAAY;GAAU;GAAY,CAAC,CAAC,UAAU;EAClE,CAAC;CACH;AAED,MAAa,sBAAsB;CACjC,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,YAAYA,cAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACvC,mBAAmBA,cAAE,SAAS,CAAC,QAAQ,MAAM;EAC7C,iBAAiBA,cAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAClD,CAAC;CACH;AAED,MAAa,cAAc;CACzB,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,eAAeA,cAAE,MAAMA,cAAE,QAAQ,CAAC,CAAC,UAAU;EAC7C,kBAAkBA,cACf,MACCA,cAAE,OAAO;GACP,OAAOA,cAAE,QAAQ;GACjB,SAASA,cAAE,QAAQ;GACnB,MAAMA,cAAE,QAAQ,CAAC,UAAU;GAC5B,CAAC,CACH,CACA,UAAU;EACd,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,UAAUA,cAAE,QAAQ,CAAC,UAAU;EAC/B,YAAYA,cAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,qBAAqBA,cAAE,MAAMA,cAAE,QAAQ,CAAC,CAAC,UAAU;EACnD,QAAQA,cAAE,QAAQ,CAAC,UAAU;EAC9B,CAAC;CACH;AAED,MAAa,UAAU;CACrB,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,WAAWA,cAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EAC7C,WAAWA,cAAE,QAAQ,CAAC,UAAU;EAChC,WAAWA,cAAE,SAAS,CAAC,QAAQ,KAAK;EACrC,CAAC;CACH;AAED,MAAa,mBAAmB;CAC9B,QAAQ;CACR,MAAMA,cAAE,OAAO;EACb,WAAWA,cAAE,QAAQ,CAAC,UAAU;EAChC,MAAMA,cAAE,QAAQ,CAAC,UAAU;EAC3B,MAAMA,cAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACjC,YAAYA,cAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;;;;;AAMD,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AAKD,MAAa,qBAAqB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_errors = require('./runtime/errors.cjs');
|
|
2
3
|
const require_errors$1 = require('./errors.cjs');
|
|
3
4
|
const require_plugin = require('./plugin.cjs');
|
|
@@ -26,4 +27,5 @@ exports.formatORPCError = require_errors.formatORPCError;
|
|
|
26
27
|
exports.getNormalizedRemoteName = require_runtime_services_normalize.getNormalizedRemoteName;
|
|
27
28
|
exports.isRetryableORPCCode = require_errors.isRetryableORPCCode;
|
|
28
29
|
exports.toPluginRuntimeError = require_errors.toPluginRuntimeError;
|
|
30
|
+
exports.withPlugins = require_plugin.withPlugins;
|
|
29
31
|
exports.wrapORPCError = require_errors.wrapORPCError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleFederationError, PluginRuntimeError, ValidationError, extractFromFiberFailure, formatORPCError, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.cjs";
|
|
2
2
|
import { BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, FORBIDDEN, NOT_FOUND, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.cjs";
|
|
3
|
-
import { LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin } from "./plugin.cjs";
|
|
3
|
+
import { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin, withPlugins } from "./plugin.cjs";
|
|
4
4
|
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugins, SecretsConfig } from "./types.cjs";
|
|
5
5
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.cjs";
|
|
6
6
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.cjs";
|
|
7
|
-
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginErrors, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError };
|
|
7
|
+
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, CreatePluginFn, CreatePluginWithPlugins, ERROR_PATTERNS, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginErrors, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, withPlugins, wrapORPCError };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleFederationError, PluginRuntimeError, ValidationError, extractFromFiberFailure, formatORPCError, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
2
2
|
import { BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, FORBIDDEN, NOT_FOUND, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.mjs";
|
|
3
|
-
import { LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin } from "./plugin.mjs";
|
|
3
|
+
import { CreatePluginFn, CreatePluginWithPlugins, LoadedPluginWithBinding, Plugin, PluginConfigFor, createPlugin, withPlugins } from "./plugin.mjs";
|
|
4
4
|
import { AnyPlugin, EveryPlugin, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugins, SecretsConfig } from "./types.mjs";
|
|
5
5
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
6
6
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.mjs";
|
|
7
|
-
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginErrors, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError };
|
|
7
|
+
export { type AnyPlugin, BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, CreatePluginFn, CreatePluginWithPlugins, ERROR_PATTERNS, type EveryPlugin, FORBIDDEN, type InitializedPlugin, type LoadedPlugin, LoadedPluginWithBinding, ModuleFederationError, NOT_FOUND, Plugin, type PluginClientType, PluginConfigFor, type PluginConfigInput, type PluginContext, type PluginContract, PluginErrors, type PluginInstance, type PluginMetadata, type PluginRegistry, type PluginRouterType, PluginRuntime, type PluginRuntimeConfig, PluginRuntimeError, type PluginSecrets, type PluginVariables, RATE_LIMITED, type RegisteredPlugins, SERVICE_UNAVAILABLE, type SecretsConfig, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, withPlugins, wrapORPCError };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleFederationError, PluginRuntimeError, ValidationError, extractFromFiberFailure, formatORPCError, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
2
2
|
import { BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, FORBIDDEN, NOT_FOUND, PluginErrors, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED } from "./errors.mjs";
|
|
3
|
-
import { createPlugin } from "./plugin.mjs";
|
|
3
|
+
import { createPlugin, withPlugins } from "./plugin.mjs";
|
|
4
4
|
import { getNormalizedRemoteName } from "./runtime/services/normalize.mjs";
|
|
5
5
|
import { PluginRuntime, createPluginRuntime } from "./runtime/index.mjs";
|
|
6
6
|
|
|
7
|
-
export { BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, FORBIDDEN, ModuleFederationError, NOT_FOUND, PluginErrors, PluginRuntime, PluginRuntimeError, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError };
|
|
7
|
+
export { BAD_REQUEST, CONNECTION_ERROR, CommonPluginErrors, ERROR_PATTERNS, FORBIDDEN, ModuleFederationError, NOT_FOUND, PluginErrors, PluginRuntime, PluginRuntimeError, RATE_LIMITED, SERVICE_UNAVAILABLE, TIMEOUT, UNAUTHORIZED, ValidationError, createPlugin, createPluginRuntime, extractFromFiberFailure, formatORPCError, getNormalizedRemoteName, isRetryableORPCCode, toPluginRuntimeError, withPlugins, wrapORPCError };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var _orpc_client = require("@orpc/client");
|
|
4
|
+
Object.keys(_orpc_client).forEach(function (k) {
|
|
5
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () { return _orpc_client[k]; }
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var _orpc_react_query = require("@orpc/react-query");
|
|
12
|
+
Object.keys(_orpc_react_query).forEach(function (k) {
|
|
13
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return _orpc_react_query[k]; }
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var _orpc_openapi = require("@orpc/openapi");
|
|
4
|
+
Object.keys(_orpc_openapi).forEach(function (k) {
|
|
5
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function () { return _orpc_openapi[k]; }
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
var _orpc_zod = require("@orpc/zod");
|
|
12
|
+
Object.keys(_orpc_zod).forEach(function (k) {
|
|
13
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return _orpc_zod[k]; }
|
|
16
|
+
});
|
|
17
|
+
});
|
package/dist/orpc.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
let _orpc_experimental_publisher_ioredis = require("@orpc/experimental-publisher/ioredis");
|
|
3
4
|
let _orpc_experimental_publisher_memory = require("@orpc/experimental-publisher/memory");
|
|
4
5
|
let _orpc_experimental_publisher_upstash_redis = require("@orpc/experimental-publisher/upstash-redis");
|
|
@@ -29,18 +30,18 @@ Object.keys(_orpc_contract).forEach(function (k) {
|
|
|
29
30
|
});
|
|
30
31
|
});
|
|
31
32
|
|
|
32
|
-
var
|
|
33
|
-
Object.keys(
|
|
33
|
+
var _orpc_experimental_publisher = require("@orpc/experimental-publisher");
|
|
34
|
+
Object.keys(_orpc_experimental_publisher).forEach(function (k) {
|
|
34
35
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
35
36
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
37
|
+
get: function () { return _orpc_experimental_publisher[k]; }
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
|
|
40
|
-
var
|
|
41
|
-
Object.keys(
|
|
41
|
+
var _orpc_server = require("@orpc/server");
|
|
42
|
+
Object.keys(_orpc_server).forEach(function (k) {
|
|
42
43
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
43
44
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
45
|
+
get: function () { return _orpc_server[k]; }
|
|
45
46
|
});
|
|
46
47
|
});
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
2
|
const require_errors = require('./runtime/errors.cjs');
|
|
3
3
|
let _orpc_contract = require("@orpc/contract");
|
|
4
4
|
let effect = require("effect");
|
|
5
5
|
let _orpc_server = require("@orpc/server");
|
|
6
6
|
|
|
7
7
|
//#region src/plugin.ts
|
|
8
|
-
|
|
9
|
-
* Factory function to create plugins
|
|
10
|
-
*/
|
|
11
|
-
function createPlugin(config) {
|
|
8
|
+
const createPlugin = function createPlugin(config) {
|
|
12
9
|
const configSchema = {
|
|
13
10
|
variables: config.variables,
|
|
14
11
|
secrets: config.secrets,
|
|
@@ -20,8 +17,8 @@ function createPlugin(config) {
|
|
|
20
17
|
contract = config.contract;
|
|
21
18
|
configSchema = configSchema;
|
|
22
19
|
_deps = null;
|
|
23
|
-
initialize(pluginConfig) {
|
|
24
|
-
return (config.initialize ?? (() => effect.Effect.succeed({})))(pluginConfig).pipe(effect.Effect.tap((deps) => effect.Effect.sync(() => {
|
|
20
|
+
initialize(pluginConfig, plugins = {}) {
|
|
21
|
+
return (config.initialize ?? (() => effect.Effect.succeed({})))(pluginConfig, plugins).pipe(effect.Effect.tap((deps) => effect.Effect.sync(() => {
|
|
25
22
|
this._deps = deps;
|
|
26
23
|
})), effect.Effect.map(() => this._deps), effect.Effect.mapError((error) => error));
|
|
27
24
|
}
|
|
@@ -48,8 +45,13 @@ function createPlugin(config) {
|
|
|
48
45
|
context: config.context
|
|
49
46
|
};
|
|
50
47
|
return PluginConstructor;
|
|
48
|
+
};
|
|
49
|
+
function withPlugins() {
|
|
50
|
+
return (config) => createPlugin(config);
|
|
51
51
|
}
|
|
52
|
+
createPlugin.withPlugins = withPlugins;
|
|
52
53
|
|
|
53
54
|
//#endregion
|
|
54
55
|
exports.createPlugin = createPlugin;
|
|
56
|
+
exports.withPlugins = withPlugins;
|
|
55
57
|
//# sourceMappingURL=plugin.cjs.map
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["Effect","extractFromFiberFailure","ORPCError"],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["Effect","extractFromFiberFailure","ORPCError"],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport { ORPCError } from \"@orpc/contract\";\nimport type { Context, Implementer, Router } from \"@orpc/server\";\nimport { implement, onError } from \"@orpc/server\";\nimport { Effect, type Scope } from \"effect\";\nimport { extractFromFiberFailure, formatORPCError } 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\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<TDeps, Error, Scope.Scope>;\n createRouter: (\n deps: TDeps,\n builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>,\n ) => Router<TContract, any>;\n shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;\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 TDeps extends Context = Record<never, never>,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\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 TDeps extends Context = Record<never, never>,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<TDeps, unknown, Scope.Scope>;\n\n shutdown(): Effect.Effect<void, never>;\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 deps The initialized plugin dependencies\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(deps: TDeps): Router<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 TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\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 TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, 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, TDeps> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n\n private _deps: TDeps | null = null;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<TDeps, unknown, Scope.Scope> {\n const init = config.initialize ?? (() => Effect.succeed({} as TDeps));\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.tap((deps) =>\n Effect.sync(() => {\n this._deps = deps;\n }),\n ),\n Effect.map(() => this._deps as TDeps),\n Effect.mapError((error) => error as unknown),\n );\n }\n\n shutdown(): Effect.Effect<void, never> {\n const self = this;\n return Effect.gen(function* () {\n if (config.shutdown && self._deps) {\n yield* config.shutdown(self._deps).pipe(Effect.catchAll(() => Effect.void));\n }\n });\n }\n\n createRouter(deps: TDeps): Router<TContract, any> {\n const base = implement(config.contract).$context<ContextOutput<TRequestContext>>();\n const builder = (base as any).use(\n onError((error: unknown) => {\n const unwrapped = extractFromFiberFailure(error);\n\n if (unwrapped !== error && unwrapped instanceof ORPCError) {\n throw unwrapped;\n }\n\n formatORPCError(error);\n }),\n );\n const router = config.createRouter(deps, builder as any);\n return router as Router<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\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 };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\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 TDeps extends Context = Record<never, never>,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\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 TDeps extends Context = Record<never, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, TDeps, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;;AA+GA,MAAa,eAA+B,SAAS,aAOnD,QAAsE;CACtE,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;CAED,MAAM,cAAyE;;EAE7E;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EAExB,AAAQ,QAAsB;EAE9B,WACE,cACA,UAAmC,EAAE,EACO;AAG5C,WAFa,OAAO,qBAAqBA,cAAO,QAAQ,EAAE,CAAU,GAExD,cAAc,QAAa,CAAC,KACtCA,cAAO,KAAK,SACVA,cAAO,WAAW;AAChB,SAAK,QAAQ;KACb,CACH,EACDA,cAAO,UAAU,KAAK,MAAe,EACrCA,cAAO,UAAU,UAAU,MAAiB,CAC7C;;EAGH,WAAuC;GACrC,MAAM,OAAO;AACb,UAAOA,cAAO,IAAI,aAAa;AAC7B,QAAI,OAAO,YAAY,KAAK,MAC1B,QAAO,OAAO,SAAS,KAAK,MAAM,CAAC,KAAKA,cAAO,eAAeA,cAAO,KAAK,CAAC;KAE7E;;EAGJ,aAAa,MAAqC;GAEhD,MAAM,sCADiB,OAAO,SAAS,CAAC,UAA0C,CACpD,+BACnB,UAAmB;IAC1B,MAAM,YAAYC,uCAAwB,MAAM;AAEhD,QAAI,cAAc,SAAS,qBAAqBC,yBAC9C,OAAM;AAGR,mCAAgB,MAAM;KACtB,CACH;AAED,UADe,OAAO,aAAa,MAAM,QAAe;;;CAK5D,MAAM,oBAAoB;AAU1B,mBAAkB,UAAU;EAC1B,UAAU,OAAO;EACjB,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;AAED,QAAO;;AAaT,SAAgB,cAA6E;AAC3F,SAOE,WACG,aAAyD,OAAc;;AAG9E,aAAa,cAAc"}
|