Skip to content

Commit 5ded23b

Browse files
committed
⬆️ Upgrade @erpc-cloud/config package + support Provider in builder store
1 parent ccc01c8 commit 5ded23b

File tree

7 files changed

+803
-14
lines changed

7 files changed

+803
-14
lines changed

.changeset/thick-carrots-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@konfeature/erpc-config-generator": patch
3+
---
4+
5+
Upgrade to @erpc-cloud/config v0.0.36 (supporting providers, proxy pools etc) + add providers in thebuilder store (so available with `decorate` method)`

bun.lock

Lines changed: 767 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-132 KB
Binary file not shown.

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"build": "tsup --splitting",
4848
"build:watch": "tsup --watch --splitting --format esm",
4949
"update:deps": "npm-check-updates -ui",
50+
"typecheck": "tsc",
5051
"example": "bun run build && bun run erpc-config --config ./example/simple.ts --out ./example/simple.js",
5152
"changeset:release": "bun run build && changeset publish",
5253
"changeset:version": "changeset version && bun install --lockfile-only"
@@ -55,16 +56,16 @@
5556
"@biomejs/biome": "1.9.4",
5657
"@changesets/changelog-git": "^0.2.0",
5758
"@changesets/changelog-github": "^0.5.0",
58-
"@changesets/cli": "^2.27.10",
59+
"@changesets/cli": "^2.27.12",
5960
"@types/bun": "latest",
60-
"bun": "^1.1.38",
61-
"npm-check-updates": "^17.1.11",
62-
"@erpc-cloud/config": "^0.0.11",
63-
"tsup": "^8.3.5"
61+
"bun": "^1.2.1",
62+
"npm-check-updates": "^17.1.14",
63+
"@erpc-cloud/config": "^0.0.36",
64+
"tsup": "^8.3.6"
6465
},
6566
"dependencies": {
66-
"bundle-require": "^5.0.0",
67-
"esbuild": "^0.24.0",
67+
"bundle-require": "^5.1.0",
68+
"esbuild": "^0.24.2",
6869
"gluegun": "^5.2.0"
6970
}
7071
}

src/builder/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ import type {
2424
*/
2525
class ConfigBuilder<
2626
TConfig extends Partial<Config> = object,
27-
TStore extends BuilderStore<string, string> = BuilderStore<never, never>,
27+
TStore extends BuilderStore<string, string, string> = BuilderStore<
28+
never,
29+
never,
30+
never
31+
>,
2832
> {
2933
private config: TConfig;
3034
private store: TStore;
3135

32-
constructor(config: Omit<Config, "rateLimiters" | "projects">) {
36+
constructor(
37+
config: Omit<Config, "rateLimiters" | "projects" | "proxyPools">
38+
) {
3339
this.config = config as TConfig;
3440
this.store = {
3541
upstreams: {},
@@ -231,7 +237,9 @@ class ConfigBuilder<
231237
* @returns A fresh builder instance.
232238
*/
233239
export function initErpcConfig<
234-
TInitial extends Omit<Config, "rateLimiters" | "projects">,
235-
>(baseConfig: TInitial): ConfigBuilder<TInitial, BuilderStore<never, never>> {
240+
TInitial extends Omit<Config, "rateLimiters" | "projects" | "proxyPools">,
241+
>(
242+
baseConfig: TInitial
243+
): ConfigBuilder<TInitial, BuilderStore<never, never, never>> {
236244
return new ConfigBuilder(baseConfig);
237245
}

src/cli/utils/assertion/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export function checkConfigValidity(config: Config): ConfigCheckResult {
4040
const stats: ConfigCheckResult["stats"] = {
4141
projects: 0,
4242
rateLimiters: 0,
43-
freeUpstreamDesired: 0,
4443
};
4544

4645
// Perform a few basics type checks

src/types/builder/store.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { NetworkConfig, UpstreamConfig } from "@erpc-cloud/config";
1+
import type {
2+
NetworkConfig,
3+
ProjectConfig,
4+
UpstreamConfig,
5+
} from "@erpc-cloud/config";
26

37
/**
48
* The store for the builder, containg some helper methods
@@ -7,9 +11,12 @@ export type BuilderStore<
711
// biome-ignore lint/suspicious/noExplicitAny: any key are supported
812
TUpstreamKeys extends keyof any,
913
// biome-ignore lint/suspicious/noExplicitAny: any key are supported
14+
TProviderKeys extends keyof any,
15+
// biome-ignore lint/suspicious/noExplicitAny: any key are supported
1016
TNetworkKeys extends keyof any,
1117
> = {
1218
upstreams: Record<TUpstreamKeys, BuilderStoreValues["upstreams"]>;
19+
providers: Record<TProviderKeys, BuilderStoreValues["providers"]>;
1320
networks: Record<TNetworkKeys, BuilderStoreValues["networks"]>;
1421
};
1522

@@ -18,13 +25,15 @@ export type BuilderStore<
1825
*/
1926
export type BuilderStoreValues = {
2027
upstreams: UpstreamConfig;
28+
// crapy import, not re-exported from erpc-config
29+
providers: ProjectConfig["providers"][number];
2130
networks: NetworkConfig;
2231
};
2332

2433
/**
2534
* Simple representation of the builder store, to ease type access
2635
*/
27-
export type AnyBuilderStore = BuilderStore<string, string>;
36+
export type AnyBuilderStore = BuilderStore<string, string, string>;
2837

2938
/**
3039
* Helper types to add new `TNewKeys` keys to the store in the `TScope` scope.

0 commit comments

Comments
 (0)