everything-dev 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/plugin.ts +8 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-dev",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "exports": {
package/src/plugin.ts CHANGED
@@ -47,7 +47,10 @@ interface BosDeps {
47
47
  nearPrivateKey?: string;
48
48
  }
49
49
 
50
- function getGatewayDomain(config: BosConfigType): string {
50
+ const DEFAULT_GATEWAY = "everything.dev";
51
+
52
+ function getGatewayDomain(config: BosConfigType | null): string {
53
+ if (!config) return DEFAULT_GATEWAY;
51
54
  const gateway = config.gateway as string | { production: string } | undefined;
52
55
  if (typeof gateway === "string") {
53
56
  return gateway.replace(/^https?:\/\//, "");
@@ -55,7 +58,7 @@ function getGatewayDomain(config: BosConfigType): string {
55
58
  if (gateway && typeof gateway === "object" && "production" in gateway) {
56
59
  return gateway.production.replace(/^https?:\/\//, "");
57
60
  }
58
- throw new Error("bos.config.json must have a 'gateway' field with production URL");
61
+ return DEFAULT_GATEWAY;
59
62
  }
60
63
 
61
64
  function getAccountForNetwork(config: BosConfigType, network: "mainnet" | "testnet"): string {
@@ -1284,11 +1287,10 @@ export default createPlugin({
1284
1287
  sync: builder.sync.handler(async ({ input }) => {
1285
1288
  const { configDir, bosConfig } = deps;
1286
1289
 
1287
- const DEFAULT_SYNC_ACCOUNT = "every.near";
1288
- const DEFAULT_SYNC_GATEWAY = "everything.dev";
1290
+ const DEFAULT_ACCOUNT = "every.near";
1289
1291
 
1290
- const account = input.account || bosConfig?.account || DEFAULT_SYNC_ACCOUNT;
1291
- const gateway = input.gateway || (bosConfig ? getGatewayDomain(bosConfig) : null) || DEFAULT_SYNC_GATEWAY;
1292
+ const account = input.account || bosConfig?.account || DEFAULT_ACCOUNT;
1293
+ const gateway = input.gateway || getGatewayDomain(bosConfig);
1292
1294
  const socialUrl = `https://near.social/mob.near/widget/State.Inspector?key=${account}/bos/gateways/${gateway}`;
1293
1295
 
1294
1296
  if (!bosConfig) {