everything-dev 1.51.3 → 1.51.5

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.
@@ -36,8 +36,8 @@ declare const DevOptionsSchema: z.ZodObject<{
36
36
  }, z.core.$strip>;
37
37
  declare const DevResultSchema: z.ZodObject<{
38
38
  status: z.ZodEnum<{
39
- error: "error";
40
39
  started: "started";
40
+ error: "error";
41
41
  }>;
42
42
  description: z.ZodString;
43
43
  processes: z.ZodArray<z.ZodString>;
@@ -377,20 +377,20 @@ declare const KeyPublishResultSchema: z.ZodObject<{
377
377
  error: z.ZodOptional<z.ZodString>;
378
378
  }, z.core.$strip>;
379
379
  declare const OverrideSectionSchema: z.ZodEnum<{
380
- plugins: "plugins";
381
- ui: "ui";
382
380
  host: "host";
381
+ ui: "ui";
383
382
  api: "api";
383
+ plugins: "plugins";
384
384
  }>;
385
385
  declare const RuntimeOverrideTargetBaseSchema: z.ZodEnum<{
386
- plugins: "plugins";
387
386
  ui: "ui";
388
387
  api: "api";
388
+ plugins: "plugins";
389
389
  }>;
390
390
  declare const RuntimeOverrideTargetSchema: z.ZodUnion<readonly [z.ZodEnum<{
391
- plugins: "plugins";
392
391
  ui: "ui";
393
392
  api: "api";
393
+ plugins: "plugins";
394
394
  }>, z.ZodString]>;
395
395
  declare const InitOptionsSchema: z.ZodObject<{
396
396
  extends: z.ZodOptional<z.ZodString>;
@@ -400,10 +400,10 @@ declare const InitOptionsSchema: z.ZodObject<{
400
400
  source: z.ZodOptional<z.ZodString>;
401
401
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
402
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
403
- plugins: "plugins";
404
- ui: "ui";
405
403
  host: "host";
404
+ ui: "ui";
406
405
  api: "api";
406
+ plugins: "plugins";
407
407
  }>>>;
408
408
  noInteractive: z.ZodDefault<z.ZodBoolean>;
409
409
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -420,10 +420,10 @@ declare const InitResultSchema: z.ZodObject<{
420
420
  extends: z.ZodString;
421
421
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
422
422
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
423
- plugins: "plugins";
424
- ui: "ui";
425
423
  host: "host";
424
+ ui: "ui";
426
425
  api: "api";
426
+ plugins: "plugins";
427
427
  }>>>;
428
428
  filesCopied: z.ZodNumber;
429
429
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -511,8 +511,8 @@ declare const StatusResultSchema: z.ZodObject<{
511
511
  }, z.core.$strip>;
512
512
  declare const TypesGenOptionsSchema: z.ZodObject<{
513
513
  env: z.ZodOptional<z.ZodEnum<{
514
- development: "development";
515
514
  production: "production";
515
+ development: "development";
516
516
  }>>;
517
517
  dryRun: z.ZodDefault<z.ZodBoolean>;
518
518
  }, z.core.$strip>;
@@ -698,8 +698,8 @@ declare const bosContract: {
698
698
  interactive: z.ZodOptional<z.ZodBoolean>;
699
699
  }, z.core.$strip>, z.ZodObject<{
700
700
  status: z.ZodEnum<{
701
- error: "error";
702
701
  started: "started";
702
+ error: "error";
703
703
  }>;
704
704
  description: z.ZodString;
705
705
  processes: z.ZodArray<z.ZodString>;
@@ -1024,10 +1024,10 @@ declare const bosContract: {
1024
1024
  source: z.ZodOptional<z.ZodString>;
1025
1025
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
1026
1026
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1027
- plugins: "plugins";
1028
- ui: "ui";
1029
1027
  host: "host";
1028
+ ui: "ui";
1030
1029
  api: "api";
1030
+ plugins: "plugins";
1031
1031
  }>>>;
1032
1032
  noInteractive: z.ZodDefault<z.ZodBoolean>;
1033
1033
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -1043,10 +1043,10 @@ declare const bosContract: {
1043
1043
  extends: z.ZodString;
1044
1044
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
1045
1045
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1046
- plugins: "plugins";
1047
- ui: "ui";
1048
1046
  host: "host";
1047
+ ui: "ui";
1049
1048
  api: "api";
1049
+ plugins: "plugins";
1050
1050
  }>>>;
1051
1051
  filesCopied: z.ZodNumber;
1052
1052
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1132,8 +1132,8 @@ declare const bosContract: {
1132
1132
  }, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
1133
1133
  typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
1134
1134
  env: z.ZodOptional<z.ZodEnum<{
1135
- development: "development";
1136
1135
  production: "production";
1136
+ development: "development";
1137
1137
  }>>;
1138
1138
  dryRun: z.ZodDefault<z.ZodBoolean>;
1139
1139
  }, z.core.$strip>, z.ZodObject<{
@@ -36,8 +36,8 @@ declare const DevOptionsSchema: z.ZodObject<{
36
36
  }, z.core.$strip>;
37
37
  declare const DevResultSchema: z.ZodObject<{
38
38
  status: z.ZodEnum<{
39
- error: "error";
40
39
  started: "started";
40
+ error: "error";
41
41
  }>;
42
42
  description: z.ZodString;
43
43
  processes: z.ZodArray<z.ZodString>;
@@ -377,20 +377,20 @@ declare const KeyPublishResultSchema: z.ZodObject<{
377
377
  error: z.ZodOptional<z.ZodString>;
378
378
  }, z.core.$strip>;
379
379
  declare const OverrideSectionSchema: z.ZodEnum<{
380
- plugins: "plugins";
381
- ui: "ui";
382
380
  host: "host";
381
+ ui: "ui";
383
382
  api: "api";
383
+ plugins: "plugins";
384
384
  }>;
385
385
  declare const RuntimeOverrideTargetBaseSchema: z.ZodEnum<{
386
- plugins: "plugins";
387
386
  ui: "ui";
388
387
  api: "api";
388
+ plugins: "plugins";
389
389
  }>;
390
390
  declare const RuntimeOverrideTargetSchema: z.ZodUnion<readonly [z.ZodEnum<{
391
- plugins: "plugins";
392
391
  ui: "ui";
393
392
  api: "api";
393
+ plugins: "plugins";
394
394
  }>, z.ZodString]>;
395
395
  declare const InitOptionsSchema: z.ZodObject<{
396
396
  extends: z.ZodOptional<z.ZodString>;
@@ -400,10 +400,10 @@ declare const InitOptionsSchema: z.ZodObject<{
400
400
  source: z.ZodOptional<z.ZodString>;
401
401
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
402
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
403
- plugins: "plugins";
404
- ui: "ui";
405
403
  host: "host";
404
+ ui: "ui";
406
405
  api: "api";
406
+ plugins: "plugins";
407
407
  }>>>;
408
408
  noInteractive: z.ZodDefault<z.ZodBoolean>;
409
409
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -420,10 +420,10 @@ declare const InitResultSchema: z.ZodObject<{
420
420
  extends: z.ZodString;
421
421
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
422
422
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
423
- plugins: "plugins";
424
- ui: "ui";
425
423
  host: "host";
424
+ ui: "ui";
426
425
  api: "api";
426
+ plugins: "plugins";
427
427
  }>>>;
428
428
  filesCopied: z.ZodNumber;
429
429
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -511,8 +511,8 @@ declare const StatusResultSchema: z.ZodObject<{
511
511
  }, z.core.$strip>;
512
512
  declare const TypesGenOptionsSchema: z.ZodObject<{
513
513
  env: z.ZodOptional<z.ZodEnum<{
514
- development: "development";
515
514
  production: "production";
515
+ development: "development";
516
516
  }>>;
517
517
  dryRun: z.ZodDefault<z.ZodBoolean>;
518
518
  }, z.core.$strip>;
@@ -698,8 +698,8 @@ declare const bosContract: {
698
698
  interactive: z.ZodOptional<z.ZodBoolean>;
699
699
  }, z.core.$strip>, z.ZodObject<{
700
700
  status: z.ZodEnum<{
701
- error: "error";
702
701
  started: "started";
702
+ error: "error";
703
703
  }>;
704
704
  description: z.ZodString;
705
705
  processes: z.ZodArray<z.ZodString>;
@@ -1024,10 +1024,10 @@ declare const bosContract: {
1024
1024
  source: z.ZodOptional<z.ZodString>;
1025
1025
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
1026
1026
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1027
- plugins: "plugins";
1028
- ui: "ui";
1029
1027
  host: "host";
1028
+ ui: "ui";
1030
1029
  api: "api";
1030
+ plugins: "plugins";
1031
1031
  }>>>;
1032
1032
  noInteractive: z.ZodDefault<z.ZodBoolean>;
1033
1033
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -1043,10 +1043,10 @@ declare const bosContract: {
1043
1043
  extends: z.ZodString;
1044
1044
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
1045
1045
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1046
- plugins: "plugins";
1047
- ui: "ui";
1048
1046
  host: "host";
1047
+ ui: "ui";
1049
1048
  api: "api";
1049
+ plugins: "plugins";
1050
1050
  }>>>;
1051
1051
  filesCopied: z.ZodNumber;
1052
1052
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1132,8 +1132,8 @@ declare const bosContract: {
1132
1132
  }, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
1133
1133
  typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
1134
1134
  env: z.ZodOptional<z.ZodEnum<{
1135
- development: "development";
1136
1135
  production: "production";
1136
+ development: "development";
1137
1137
  }>>;
1138
1138
  dryRun: z.ZodDefault<z.ZodBoolean>;
1139
1139
  }, z.core.$strip>, z.ZodObject<{
package/dist/fastkv.cjs CHANGED
@@ -33,7 +33,7 @@ function getRegistryConfigKey(accountId, gatewayId, pathSegments = []) {
33
33
  return `apps/${accountId}/${gatewayId}${pathSegments.length > 0 ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}` : ""}/bos.config.json`;
34
34
  }
35
35
  function parseBosUrl(bosUrl) {
36
- const match = bosUrl.match(/^bos:\/\/([^/]+)\/(.+)$/);
36
+ const match = bosUrl.split("#")[0].match(/^bos:\/\/([^/]+)\/(.+)$/);
37
37
  if (!match?.[1] || !match[2]) throw new Error(`Invalid BOS URL: ${bosUrl}`);
38
38
  const pathSegments = match[2].split("/").filter(Boolean).map((segment) => decodeURIComponent(segment));
39
39
  if (pathSegments.length === 0) throw new Error(`Invalid BOS URL: ${bosUrl}`);
@@ -1 +1 @@
1
- {"version":3,"file":"fastkv.cjs","names":["fetchJsonOrNull"],"sources":["../src/fastkv.ts"],"sourcesContent":["export type NetworkId = \"mainnet\" | \"testnet\";\n\ninterface FastKvEntry {\n value: unknown;\n}\n\ninterface FastKvListResponse {\n entries?: Array<FastKvEntry | null>;\n}\n\nimport { fetchJsonOrNull } from \"./http-client\";\n\nfunction getNetworkIdForAccount(accountId: string): NetworkId {\n return accountId.endsWith(\".testnet\") ? \"testnet\" : \"mainnet\";\n}\n\nexport function getFastKvBaseUrlForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_URL || \"https://kv.test.fastnear.com\"\n : process.env.REGISTRY_FASTKV_MAINNET_URL || \"https://kv.main.fastnear.com\";\n}\n\nfunction getFastKvBaseUrlForAccount(accountId: string): string {\n return getNetworkIdForAccount(accountId) === \"testnet\"\n ? getFastKvBaseUrlForNetwork(\"testnet\")\n : getFastKvBaseUrlForNetwork(\"mainnet\");\n}\n\nexport function buildRegistryConfigUrl(accountId: string, gatewayId: string): string {\n const baseUrl = getFastKvBaseUrlForAccount(accountId);\n const namespace = getRegistryNamespaceForAccount(accountId);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function buildRegistryConfigUrlForNetwork(\n network: NetworkId,\n accountId: string,\n gatewayId: string,\n): string {\n const baseUrl = getFastKvBaseUrlForNetwork(network);\n const namespace = getRegistryNamespaceForNetwork(network);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function getRegistryNamespaceForAccount(accountId: string): string {\n return accountId.endsWith(\".testnet\")\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nexport function getRegistryNamespaceForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nfunction getRegistryConfigKey(\n accountId: string,\n gatewayId: string,\n pathSegments: string[] = [],\n): string {\n const suffix =\n pathSegments.length > 0\n ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join(\"/\")}`\n : \"\";\n return `apps/${accountId}/${gatewayId}${suffix}/bos.config.json`;\n}\n\nexport function parseBosUrl(bosUrl: string): {\n accountId: string;\n gatewayId: string;\n pathSegments: string[];\n} {\n const match = bosUrl.match(/^bos:\\/\\/([^/]+)\\/(.+)$/);\n if (!match?.[1] || !match[2]) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const pathSegments = match[2]\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => decodeURIComponent(segment));\n if (pathSegments.length === 0) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const [gatewayId, ...pathSegmentsTail] = pathSegments;\n if (!gatewayId) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n return {\n accountId: match[1],\n gatewayId,\n pathSegments: pathSegmentsTail,\n };\n}\n\nexport async function fetchBosConfigFromFastKv<T>(bosUrl: string): Promise<T> {\n const { accountId, gatewayId, pathSegments } = parseBosUrl(bosUrl);\n const payload = await fetchJson<FastKvListResponse>(\n `${getFastKvBaseUrlForAccount(accountId)}/v0/latest/${encodeURIComponent(getRegistryNamespaceForAccount(accountId))}/${encodeURIComponent(accountId)}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n key: getRegistryConfigKey(accountId, gatewayId, pathSegments),\n limit: 1,\n }),\n },\n );\n const value = payload?.entries?.find(Boolean)?.value;\n\n if (!value) {\n throw new Error(`No config found for ${bosUrl}`);\n }\n\n if (typeof value === \"string\") {\n return JSON.parse(value) as T;\n }\n\n if (typeof value !== \"object\") {\n throw new Error(`Invalid config value for ${bosUrl}`);\n }\n\n return value as T;\n}\n\nexport interface PluginManifest {\n schemaVersion: number;\n kind: string;\n plugin: { name: string; version: string };\n runtime: { remoteEntry: string };\n contract: {\n kind: string;\n types: { path: string; exportName: string; typeName: string; sha256: string };\n };\n additionalExports?: Array<{ path: string; exports: string[]; sha256: string }>;\n}\n\nexport async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {\n const baseUrl = cdnUrl.replace(/\\/$/, \"\");\n return fetchJsonOrNull<PluginManifest>(`${baseUrl}/plugin.manifest.json`, { retries: 0 });\n}\n\nasync function fetchJson<T>(url: string, init?: RequestInit): Promise<T | null> {\n const headers: Record<string, string> = {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n ...(init?.headers as Record<string, string> | undefined),\n };\n return fetchJsonOrNull<T>(url, {\n method: init?.method,\n headers,\n body: init?.body ?? undefined,\n retries: 3,\n });\n}\n"],"mappings":";;;;AAYA,SAAS,uBAAuB,WAA8B;AAC5D,QAAO,UAAU,SAAS,WAAW,GAAG,YAAY;;AAGtD,SAAgB,2BAA2B,SAA4B;AACrE,QAAO,YAAY,YACf,QAAQ,IAAI,+BAA+B,iCAC3C,QAAQ,IAAI,+BAA+B;;AAGjD,SAAS,2BAA2B,WAA2B;AAC7D,QAAO,uBAAuB,UAAU,KAAK,YACzC,2BAA2B,UAAU,GACrC,2BAA2B,UAAU;;AAG3C,SAAgB,uBAAuB,WAAmB,WAA2B;CACnF,MAAM,UAAU,2BAA2B,UAAU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C,QAAO;EACL,WAAW,MAAM;EACjB;EACA,cAAc;EACf;;AAGH,eAAsB,yBAA4B,QAA4B;CAC5E,MAAM,EAAE,WAAW,WAAW,iBAAiB,YAAY,OAAO;CAWlE,MAAM,SAAQ,MAVQ,UACpB,GAAG,2BAA2B,UAAU,CAAC,aAAa,mBAAmB,+BAA+B,UAAU,CAAC,CAAC,GAAG,mBAAmB,UAAU,IACpJ;EACE,QAAQ;EACR,MAAM,KAAK,UAAU;GACnB,KAAK,qBAAqB,WAAW,WAAW,aAAa;GAC7D,OAAO;GACR,CAAC;EACH,CACF,GACsB,SAAS,KAAK,QAAQ,EAAE;AAE/C,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,uBAAuB,SAAS;AAGlD,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,MAAM,MAAM;AAG1B,KAAI,OAAO,UAAU,SACnB,OAAM,IAAI,MAAM,4BAA4B,SAAS;AAGvD,QAAO;;AAeT,eAAsB,0BAA0B,QAAgD;AAE9F,QAAOA,oCAAgC,GADvB,OAAO,QAAQ,OAAO,GACW,CAAC,wBAAwB,EAAE,SAAS,GAAG,CAAC;;AAG3F,eAAe,UAAa,KAAa,MAAuC;CAC9E,MAAM,UAAkC;EACtC,QAAQ;EACR,gBAAgB;EAChB,GAAI,MAAM;EACX;AACD,QAAOA,oCAAmB,KAAK;EAC7B,QAAQ,MAAM;EACd;EACA,MAAM,MAAM,QAAQ;EACpB,SAAS;EACV,CAAC"}
1
+ {"version":3,"file":"fastkv.cjs","names":["fetchJsonOrNull"],"sources":["../src/fastkv.ts"],"sourcesContent":["export type NetworkId = \"mainnet\" | \"testnet\";\n\ninterface FastKvEntry {\n value: unknown;\n}\n\ninterface FastKvListResponse {\n entries?: Array<FastKvEntry | null>;\n}\n\nimport { fetchJsonOrNull } from \"./http-client\";\n\nfunction getNetworkIdForAccount(accountId: string): NetworkId {\n return accountId.endsWith(\".testnet\") ? \"testnet\" : \"mainnet\";\n}\n\nexport function getFastKvBaseUrlForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_URL || \"https://kv.test.fastnear.com\"\n : process.env.REGISTRY_FASTKV_MAINNET_URL || \"https://kv.main.fastnear.com\";\n}\n\nfunction getFastKvBaseUrlForAccount(accountId: string): string {\n return getNetworkIdForAccount(accountId) === \"testnet\"\n ? getFastKvBaseUrlForNetwork(\"testnet\")\n : getFastKvBaseUrlForNetwork(\"mainnet\");\n}\n\nexport function buildRegistryConfigUrl(accountId: string, gatewayId: string): string {\n const baseUrl = getFastKvBaseUrlForAccount(accountId);\n const namespace = getRegistryNamespaceForAccount(accountId);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function buildRegistryConfigUrlForNetwork(\n network: NetworkId,\n accountId: string,\n gatewayId: string,\n): string {\n const baseUrl = getFastKvBaseUrlForNetwork(network);\n const namespace = getRegistryNamespaceForNetwork(network);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function getRegistryNamespaceForAccount(accountId: string): string {\n return accountId.endsWith(\".testnet\")\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nexport function getRegistryNamespaceForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nfunction getRegistryConfigKey(\n accountId: string,\n gatewayId: string,\n pathSegments: string[] = [],\n): string {\n const suffix =\n pathSegments.length > 0\n ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join(\"/\")}`\n : \"\";\n return `apps/${accountId}/${gatewayId}${suffix}/bos.config.json`;\n}\n\nexport function parseBosUrl(bosUrl: string): {\n accountId: string;\n gatewayId: string;\n pathSegments: string[];\n} {\n const strippedUrl = bosUrl.split(\"#\")[0];\n const match = strippedUrl.match(/^bos:\\/\\/([^/]+)\\/(.+)$/);\n if (!match?.[1] || !match[2]) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const pathSegments = match[2]\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => decodeURIComponent(segment));\n if (pathSegments.length === 0) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const [gatewayId, ...pathSegmentsTail] = pathSegments;\n if (!gatewayId) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n return {\n accountId: match[1],\n gatewayId,\n pathSegments: pathSegmentsTail,\n };\n}\n\nexport async function fetchBosConfigFromFastKv<T>(bosUrl: string): Promise<T> {\n const { accountId, gatewayId, pathSegments } = parseBosUrl(bosUrl);\n const payload = await fetchJson<FastKvListResponse>(\n `${getFastKvBaseUrlForAccount(accountId)}/v0/latest/${encodeURIComponent(getRegistryNamespaceForAccount(accountId))}/${encodeURIComponent(accountId)}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n key: getRegistryConfigKey(accountId, gatewayId, pathSegments),\n limit: 1,\n }),\n },\n );\n const value = payload?.entries?.find(Boolean)?.value;\n\n if (!value) {\n throw new Error(`No config found for ${bosUrl}`);\n }\n\n if (typeof value === \"string\") {\n return JSON.parse(value) as T;\n }\n\n if (typeof value !== \"object\") {\n throw new Error(`Invalid config value for ${bosUrl}`);\n }\n\n return value as T;\n}\n\nexport interface PluginManifest {\n schemaVersion: number;\n kind: string;\n plugin: { name: string; version: string };\n runtime: { remoteEntry: string };\n contract: {\n kind: string;\n types: { path: string; exportName: string; typeName: string; sha256: string };\n };\n additionalExports?: Array<{ path: string; exports: string[]; sha256: string }>;\n}\n\nexport async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {\n const baseUrl = cdnUrl.replace(/\\/$/, \"\");\n return fetchJsonOrNull<PluginManifest>(`${baseUrl}/plugin.manifest.json`, { retries: 0 });\n}\n\nasync function fetchJson<T>(url: string, init?: RequestInit): Promise<T | null> {\n const headers: Record<string, string> = {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n ...(init?.headers as Record<string, string> | undefined),\n };\n return fetchJsonOrNull<T>(url, {\n method: init?.method,\n headers,\n body: init?.body ?? undefined,\n retries: 3,\n });\n}\n"],"mappings":";;;;AAYA,SAAS,uBAAuB,WAA8B;AAC5D,QAAO,UAAU,SAAS,WAAW,GAAG,YAAY;;AAGtD,SAAgB,2BAA2B,SAA4B;AACrE,QAAO,YAAY,YACf,QAAQ,IAAI,+BAA+B,iCAC3C,QAAQ,IAAI,+BAA+B;;AAGjD,SAAS,2BAA2B,WAA2B;AAC7D,QAAO,uBAAuB,UAAU,KAAK,YACzC,2BAA2B,UAAU,GACrC,2BAA2B,UAAU;;AAG3C,SAAgB,uBAAuB,WAAmB,WAA2B;CACnF,MAAM,UAAU,2BAA2B,UAAU;CACrD,MAAM,YAAY,+BAA+B,UAAU;CAC3D,MAAM,MAAM,mBAAmB,qBAAqB,WAAW,UAAU,CAAC;AAC1E,QAAO,GAAG,QAAQ,aAAa,mBAAmB,UAAU,CAAC,GAAG,mBAAmB,UAAU,CAAC,GAAG;;AAGnG,SAAgB,iCACd,SACA,WACA,WACQ;CACR,MAAM,UAAU,2BAA2B,QAAQ;CACnD,MAAM,YAAY,+BAA+B,QAAQ;CACzD,MAAM,MAAM,mBAAmB,qBAAqB,WAAW,UAAU,CAAC;AAC1E,QAAO,GAAG,QAAQ,aAAa,mBAAmB,UAAU,CAAC,GAAG,mBAAmB,UAAU,CAAC,GAAG;;AAGnG,SAAgB,+BAA+B,WAA2B;AACxE,QAAO,UAAU,SAAS,WAAW,GACjC,QAAQ,IAAI,qCAAqC,wBACjD,QAAQ,IAAI,qCAAqC;;A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7 @@ function getRegistryConfigKey(accountId, gatewayId, pathSegments = []) {
32
32
  return `apps/${accountId}/${gatewayId}${pathSegments.length > 0 ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join("/")}` : ""}/bos.config.json`;
33
33
  }
34
34
  function parseBosUrl(bosUrl) {
35
- const match = bosUrl.match(/^bos:\/\/([^/]+)\/(.+)$/);
35
+ const match = bosUrl.split("#")[0].match(/^bos:\/\/([^/]+)\/(.+)$/);
36
36
  if (!match?.[1] || !match[2]) throw new Error(`Invalid BOS URL: ${bosUrl}`);
37
37
  const pathSegments = match[2].split("/").filter(Boolean).map((segment) => decodeURIComponent(segment));
38
38
  if (pathSegments.length === 0) throw new Error(`Invalid BOS URL: ${bosUrl}`);
@@ -1 +1 @@
1
- {"version":3,"file":"fastkv.mjs","names":[],"sources":["../src/fastkv.ts"],"sourcesContent":["export type NetworkId = \"mainnet\" | \"testnet\";\n\ninterface FastKvEntry {\n value: unknown;\n}\n\ninterface FastKvListResponse {\n entries?: Array<FastKvEntry | null>;\n}\n\nimport { fetchJsonOrNull } from \"./http-client\";\n\nfunction getNetworkIdForAccount(accountId: string): NetworkId {\n return accountId.endsWith(\".testnet\") ? \"testnet\" : \"mainnet\";\n}\n\nexport function getFastKvBaseUrlForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_URL || \"https://kv.test.fastnear.com\"\n : process.env.REGISTRY_FASTKV_MAINNET_URL || \"https://kv.main.fastnear.com\";\n}\n\nfunction getFastKvBaseUrlForAccount(accountId: string): string {\n return getNetworkIdForAccount(accountId) === \"testnet\"\n ? getFastKvBaseUrlForNetwork(\"testnet\")\n : getFastKvBaseUrlForNetwork(\"mainnet\");\n}\n\nexport function buildRegistryConfigUrl(accountId: string, gatewayId: string): string {\n const baseUrl = getFastKvBaseUrlForAccount(accountId);\n const namespace = getRegistryNamespaceForAccount(accountId);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function buildRegistryConfigUrlForNetwork(\n network: NetworkId,\n accountId: string,\n gatewayId: string,\n): string {\n const baseUrl = getFastKvBaseUrlForNetwork(network);\n const namespace = getRegistryNamespaceForNetwork(network);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function getRegistryNamespaceForAccount(accountId: string): string {\n return accountId.endsWith(\".testnet\")\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nexport function getRegistryNamespaceForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nfunction getRegistryConfigKey(\n accountId: string,\n gatewayId: string,\n pathSegments: string[] = [],\n): string {\n const suffix =\n pathSegments.length > 0\n ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join(\"/\")}`\n : \"\";\n return `apps/${accountId}/${gatewayId}${suffix}/bos.config.json`;\n}\n\nexport function parseBosUrl(bosUrl: string): {\n accountId: string;\n gatewayId: string;\n pathSegments: string[];\n} {\n const match = bosUrl.match(/^bos:\\/\\/([^/]+)\\/(.+)$/);\n if (!match?.[1] || !match[2]) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const pathSegments = match[2]\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => decodeURIComponent(segment));\n if (pathSegments.length === 0) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const [gatewayId, ...pathSegmentsTail] = pathSegments;\n if (!gatewayId) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n return {\n accountId: match[1],\n gatewayId,\n pathSegments: pathSegmentsTail,\n };\n}\n\nexport async function fetchBosConfigFromFastKv<T>(bosUrl: string): Promise<T> {\n const { accountId, gatewayId, pathSegments } = parseBosUrl(bosUrl);\n const payload = await fetchJson<FastKvListResponse>(\n `${getFastKvBaseUrlForAccount(accountId)}/v0/latest/${encodeURIComponent(getRegistryNamespaceForAccount(accountId))}/${encodeURIComponent(accountId)}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n key: getRegistryConfigKey(accountId, gatewayId, pathSegments),\n limit: 1,\n }),\n },\n );\n const value = payload?.entries?.find(Boolean)?.value;\n\n if (!value) {\n throw new Error(`No config found for ${bosUrl}`);\n }\n\n if (typeof value === \"string\") {\n return JSON.parse(value) as T;\n }\n\n if (typeof value !== \"object\") {\n throw new Error(`Invalid config value for ${bosUrl}`);\n }\n\n return value as T;\n}\n\nexport interface PluginManifest {\n schemaVersion: number;\n kind: string;\n plugin: { name: string; version: string };\n runtime: { remoteEntry: string };\n contract: {\n kind: string;\n types: { path: string; exportName: string; typeName: string; sha256: string };\n };\n additionalExports?: Array<{ path: string; exports: string[]; sha256: string }>;\n}\n\nexport async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {\n const baseUrl = cdnUrl.replace(/\\/$/, \"\");\n return fetchJsonOrNull<PluginManifest>(`${baseUrl}/plugin.manifest.json`, { retries: 0 });\n}\n\nasync function fetchJson<T>(url: string, init?: RequestInit): Promise<T | null> {\n const headers: Record<string, string> = {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n ...(init?.headers as Record<string, string> | undefined),\n };\n return fetchJsonOrNull<T>(url, {\n method: init?.method,\n headers,\n body: init?.body ?? undefined,\n retries: 3,\n });\n}\n"],"mappings":";;;AAYA,SAAS,uBAAuB,WAA8B;AAC5D,QAAO,UAAU,SAAS,WAAW,GAAG,YAAY;;AAGtD,SAAgB,2BAA2B,SAA4B;AACrE,QAAO,YAAY,YACf,QAAQ,IAAI,+BAA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AAQ,CACf,KAAK,YAAY,mBAAmB,QAAQ,CAAC;AAChD,KAAI,aAAa,WAAW,EAC1B,OAAM,IAAI,MAAM,oBAAoB,SAAS;CAG/C,MAAM,CAAC,WAAW,GAAG,oBAAoB;AACzC,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,oBAAoB,SAAS;AAG/C,QAAO;EACL,WAAW,MAAM;EACjB;EACA,cAAc;EACf;;AAGH,eAAsB,yBAA4B,QAA4B;CAC5E,MAAM,EAAE,WAAW,WAAW,iBAAiB,YAAY,OAAO;CAWlE,MAAM,SAAQ,MAVQ,UACpB,GAAG,2BAA2B,UAAU,CAAC,aAAa,mBAAmB,+BAA+B,UAAU,CAAC,CAAC,GAAG,mBAAmB,UAAU,IACpJ;EACE,QAAQ;EACR,MAAM,KAAK,UAAU;GACnB,KAAK,qBAAqB,WAAW,WAAW,aAAa;GAC7D,OAAO;GACR,CAAC;EACH,CACF,GACsB,SAAS,KAAK,QAAQ,EAAE;AAE/C,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,uBAAuB,SAAS;AAGlD,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,MAAM,MAAM;AAG1B,KAAI,OAAO,UAAU,SACnB,OAAM,IAAI,MAAM,4BAA4B,SAAS;AAGvD,QAAO;;AAeT,eAAsB,0BAA0B,QAAgD;AAE9F,QAAO,gBAAgC,GADvB,OAAO,QAAQ,OAAO,GACW,CAAC,wBAAwB,EAAE,SAAS,GAAG,CAAC;;AAG3F,eAAe,UAAa,KAAa,MAAuC;CAC9E,MAAM,UAAkC;EACtC,QAAQ;EACR,gBAAgB;EAChB,GAAI,MAAM;EACX;AACD,QAAO,gBAAmB,KAAK;EAC7B,QAAQ,MAAM;EACd;EACA,MAAM,MAAM,QAAQ;EACpB,SAAS;EACV,CAAC"}
1
+ {"version":3,"file":"fastkv.mjs","names":[],"sources":["../src/fastkv.ts"],"sourcesContent":["export type NetworkId = \"mainnet\" | \"testnet\";\n\ninterface FastKvEntry {\n value: unknown;\n}\n\ninterface FastKvListResponse {\n entries?: Array<FastKvEntry | null>;\n}\n\nimport { fetchJsonOrNull } from \"./http-client\";\n\nfunction getNetworkIdForAccount(accountId: string): NetworkId {\n return accountId.endsWith(\".testnet\") ? \"testnet\" : \"mainnet\";\n}\n\nexport function getFastKvBaseUrlForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_URL || \"https://kv.test.fastnear.com\"\n : process.env.REGISTRY_FASTKV_MAINNET_URL || \"https://kv.main.fastnear.com\";\n}\n\nfunction getFastKvBaseUrlForAccount(accountId: string): string {\n return getNetworkIdForAccount(accountId) === \"testnet\"\n ? getFastKvBaseUrlForNetwork(\"testnet\")\n : getFastKvBaseUrlForNetwork(\"mainnet\");\n}\n\nexport function buildRegistryConfigUrl(accountId: string, gatewayId: string): string {\n const baseUrl = getFastKvBaseUrlForAccount(accountId);\n const namespace = getRegistryNamespaceForAccount(accountId);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function buildRegistryConfigUrlForNetwork(\n network: NetworkId,\n accountId: string,\n gatewayId: string,\n): string {\n const baseUrl = getFastKvBaseUrlForNetwork(network);\n const namespace = getRegistryNamespaceForNetwork(network);\n const key = encodeURIComponent(getRegistryConfigKey(accountId, gatewayId));\n return `${baseUrl}/v0/latest/${encodeURIComponent(namespace)}/${encodeURIComponent(accountId)}/${key}`;\n}\n\nexport function getRegistryNamespaceForAccount(accountId: string): string {\n return accountId.endsWith(\".testnet\")\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nexport function getRegistryNamespaceForNetwork(network: NetworkId): string {\n return network === \"testnet\"\n ? process.env.REGISTRY_FASTKV_TESTNET_NAMESPACE || \"dev.everything.near\"\n : process.env.REGISTRY_FASTKV_MAINNET_NAMESPACE || \"dev.everything.near\";\n}\n\nfunction getRegistryConfigKey(\n accountId: string,\n gatewayId: string,\n pathSegments: string[] = [],\n): string {\n const suffix =\n pathSegments.length > 0\n ? `/${pathSegments.map((segment) => encodeURIComponent(segment)).join(\"/\")}`\n : \"\";\n return `apps/${accountId}/${gatewayId}${suffix}/bos.config.json`;\n}\n\nexport function parseBosUrl(bosUrl: string): {\n accountId: string;\n gatewayId: string;\n pathSegments: string[];\n} {\n const strippedUrl = bosUrl.split(\"#\")[0];\n const match = strippedUrl.match(/^bos:\\/\\/([^/]+)\\/(.+)$/);\n if (!match?.[1] || !match[2]) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const pathSegments = match[2]\n .split(\"/\")\n .filter(Boolean)\n .map((segment) => decodeURIComponent(segment));\n if (pathSegments.length === 0) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n const [gatewayId, ...pathSegmentsTail] = pathSegments;\n if (!gatewayId) {\n throw new Error(`Invalid BOS URL: ${bosUrl}`);\n }\n\n return {\n accountId: match[1],\n gatewayId,\n pathSegments: pathSegmentsTail,\n };\n}\n\nexport async function fetchBosConfigFromFastKv<T>(bosUrl: string): Promise<T> {\n const { accountId, gatewayId, pathSegments } = parseBosUrl(bosUrl);\n const payload = await fetchJson<FastKvListResponse>(\n `${getFastKvBaseUrlForAccount(accountId)}/v0/latest/${encodeURIComponent(getRegistryNamespaceForAccount(accountId))}/${encodeURIComponent(accountId)}`,\n {\n method: \"POST\",\n body: JSON.stringify({\n key: getRegistryConfigKey(accountId, gatewayId, pathSegments),\n limit: 1,\n }),\n },\n );\n const value = payload?.entries?.find(Boolean)?.value;\n\n if (!value) {\n throw new Error(`No config found for ${bosUrl}`);\n }\n\n if (typeof value === \"string\") {\n return JSON.parse(value) as T;\n }\n\n if (typeof value !== \"object\") {\n throw new Error(`Invalid config value for ${bosUrl}`);\n }\n\n return value as T;\n}\n\nexport interface PluginManifest {\n schemaVersion: number;\n kind: string;\n plugin: { name: string; version: string };\n runtime: { remoteEntry: string };\n contract: {\n kind: string;\n types: { path: string; exportName: string; typeName: string; sha256: string };\n };\n additionalExports?: Array<{ path: string; exports: string[]; sha256: string }>;\n}\n\nexport async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {\n const baseUrl = cdnUrl.replace(/\\/$/, \"\");\n return fetchJsonOrNull<PluginManifest>(`${baseUrl}/plugin.manifest.json`, { retries: 0 });\n}\n\nasync function fetchJson<T>(url: string, init?: RequestInit): Promise<T | null> {\n const headers: Record<string, string> = {\n accept: \"application/json\",\n \"content-type\": \"application/json\",\n ...(init?.headers as Record<string, string> | undefined),\n };\n return fetchJsonOrNull<T>(url, {\n method: init?.method,\n headers,\n body: init?.body ?? undefined,\n retries: 3,\n });\n}\n"],"mappings":";;;AAYA,SAAS,uBAAuB,WAA8B;AAC5D,QAAO,UAAU,SAAS,WAAW,GAAG,YAAY;;AAGtD,SAAgB,2BAA2B,SAA4B;AACrE,QAAO,YAAY,YACf,QAAQ,IAAI,+BAA+B,iCAC3C,QAAQ,IAAI,+BAA+B;;AAGjD,SAAS,2BAA2B,WAA2B;AAC7D,QAAO,uBAAuB,UAAU,KAAK,YACzC,2BAA2B,UAAU,GACrC,2BAA2B,UAAU;;AAG3C,SAAgB,uBAAuB,WAAmB,WAA2B;CACnF,MAAM,UAAU,2BAA2B,UAAU;CACrD,MAAM,YAAY,+BAA+B,UAAU;CAC3D,MAAM,MAAM,mBAAmB,qBAAqB,WAAW,UAAU,CAAC;AAC1E,QAAO,GAAG,QAAQ,aAAa,mBAAmB,UAAU,CAAC,GAAG,mBAAmB,UAAU,CAAC,GAAG;;AAGnG,SAAgB,iCACd,SACA,WACA,WACQ;CACR,MAAM,UAAU,2BAA2B,QAAQ;CACnD,MAAM,YAAY,+BAA+B,QAAQ;CACzD,MAAM,MAAM,mBAAmB,qBAAqB,WAAW,UAAU,CAAC;AAC1E,QAAO,G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AAW,aAAa;GAC7D,OAAO;GACR,CAAC;EACH,CACF,GACsB,SAAS,KAAK,QAAQ,EAAE;AAE/C,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,uBAAuB,SAAS;AAGlD,KAAI,OAAO,UAAU,SACnB,QAAO,KAAK,MAAM,MAAM;AAG1B,KAAI,OAAO,UAAU,SACnB,OAAM,IAAI,MAAM,4BAA4B,SAAS;AAGvD,QAAO;;AAeT,eAAsB,0BAA0B,QAAgD;AAE9F,QAAO,gBAAgC,GADvB,OAAO,QAAQ,OAAO,GACW,CAAC,wBAAwB,EAAE,SAAS,GAAG,CAAC;;AAG3F,eAAe,UAAa,KAAa,MAAuC;CAC9E,MAAM,UAAkC;EACtC,QAAQ;EACR,gBAAgB;EAChB,GAAI,MAAM;EACX;AACD,QAAO,gBAAmB,KAAK;EAC7B,QAAQ,MAAM;EACd;EACA,MAAM,MAAM,QAAQ;EACpB,SAAS;EACV,CAAC"}
package/dist/plugin.d.cts CHANGED
@@ -64,8 +64,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
64
64
  interactive: z.ZodOptional<z.ZodBoolean>;
65
65
  }, z.core.$strip>, z.ZodObject<{
66
66
  status: z.ZodEnum<{
67
- error: "error";
68
67
  started: "started";
68
+ error: "error";
69
69
  }>;
70
70
  description: z.ZodString;
71
71
  processes: z.ZodArray<z.ZodString>;
@@ -390,10 +390,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
390
390
  source: z.ZodOptional<z.ZodString>;
391
391
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
392
392
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
393
- plugins: "plugins";
394
- ui: "ui";
395
393
  host: "host";
394
+ ui: "ui";
396
395
  api: "api";
396
+ plugins: "plugins";
397
397
  }>>>;
398
398
  noInteractive: z.ZodDefault<z.ZodBoolean>;
399
399
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -409,10 +409,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
409
409
  extends: z.ZodString;
410
410
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
411
411
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
412
- plugins: "plugins";
413
- ui: "ui";
414
412
  host: "host";
413
+ ui: "ui";
415
414
  api: "api";
415
+ plugins: "plugins";
416
416
  }>>>;
417
417
  filesCopied: z.ZodNumber;
418
418
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -498,8 +498,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
498
498
  }, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
499
499
  typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
500
500
  env: z.ZodOptional<z.ZodEnum<{
501
- development: "development";
502
501
  production: "production";
502
+ development: "development";
503
503
  }>>;
504
504
  dryRun: z.ZodDefault<z.ZodBoolean>;
505
505
  }, z.core.$strip>, z.ZodObject<{
@@ -737,7 +737,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
737
737
  }> | undefined;
738
738
  } | null;
739
739
  runtimeConfig: {
740
- env: "development" | "production" | "staging";
740
+ env: "production" | "staging" | "development";
741
741
  account: string;
742
742
  networkId: "testnet" | "mainnet";
743
743
  host: {
package/dist/plugin.d.mts CHANGED
@@ -64,8 +64,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
64
64
  interactive: z.ZodOptional<z.ZodBoolean>;
65
65
  }, z.core.$strip>, z.ZodObject<{
66
66
  status: z.ZodEnum<{
67
- error: "error";
68
67
  started: "started";
68
+ error: "error";
69
69
  }>;
70
70
  description: z.ZodString;
71
71
  processes: z.ZodArray<z.ZodString>;
@@ -390,10 +390,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
390
390
  source: z.ZodOptional<z.ZodString>;
391
391
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
392
392
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
393
- plugins: "plugins";
394
- ui: "ui";
395
393
  host: "host";
394
+ ui: "ui";
396
395
  api: "api";
396
+ plugins: "plugins";
397
397
  }>>>;
398
398
  noInteractive: z.ZodDefault<z.ZodBoolean>;
399
399
  noInstall: z.ZodDefault<z.ZodBoolean>;
@@ -409,10 +409,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
409
409
  extends: z.ZodString;
410
410
  plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
411
411
  overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
412
- plugins: "plugins";
413
- ui: "ui";
414
412
  host: "host";
413
+ ui: "ui";
415
414
  api: "api";
415
+ plugins: "plugins";
416
416
  }>>>;
417
417
  filesCopied: z.ZodNumber;
418
418
  timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -498,8 +498,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
498
498
  }, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
499
499
  typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
500
500
  env: z.ZodOptional<z.ZodEnum<{
501
- development: "development";
502
501
  production: "production";
502
+ development: "development";
503
503
  }>>;
504
504
  dryRun: z.ZodDefault<z.ZodBoolean>;
505
505
  }, z.core.$strip>, z.ZodObject<{
@@ -737,7 +737,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
737
737
  }> | undefined;
738
738
  } | null;
739
739
  runtimeConfig: {
740
- env: "development" | "production" | "staging";
740
+ env: "production" | "staging" | "development";
741
741
  account: string;
742
742
  networkId: "testnet" | "mainnet";
743
743
  host: {
package/dist/types.d.cts CHANGED
@@ -379,9 +379,9 @@ declare const BosConfigSchema: z.ZodObject<{
379
379
  type BosConfig = z.infer<typeof BosConfigSchema>;
380
380
  declare const RuntimeConfigSchema: z.ZodObject<{
381
381
  env: z.ZodEnum<{
382
- development: "development";
383
382
  production: "production";
384
383
  staging: "staging";
384
+ development: "development";
385
385
  }>;
386
386
  account: z.ZodString;
387
387
  domain: z.ZodOptional<z.ZodString>;
@@ -508,9 +508,9 @@ declare const RuntimeConfigSchema: z.ZodObject<{
508
508
  type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
509
509
  declare const ClientRuntimeConfigSchema: z.ZodObject<{
510
510
  env: z.ZodEnum<{
511
- development: "development";
512
511
  production: "production";
513
512
  staging: "staging";
513
+ development: "development";
514
514
  }>;
515
515
  account: z.ZodString;
516
516
  networkId: z.ZodEnum<{
package/dist/types.d.mts CHANGED
@@ -379,9 +379,9 @@ declare const BosConfigSchema: z.ZodObject<{
379
379
  type BosConfig = z.infer<typeof BosConfigSchema>;
380
380
  declare const RuntimeConfigSchema: z.ZodObject<{
381
381
  env: z.ZodEnum<{
382
- development: "development";
383
382
  production: "production";
384
383
  staging: "staging";
384
+ development: "development";
385
385
  }>;
386
386
  account: z.ZodString;
387
387
  domain: z.ZodOptional<z.ZodString>;
@@ -508,9 +508,9 @@ declare const RuntimeConfigSchema: z.ZodObject<{
508
508
  type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
509
509
  declare const ClientRuntimeConfigSchema: z.ZodObject<{
510
510
  env: z.ZodEnum<{
511
- development: "development";
512
511
  production: "production";
513
512
  staging: "staging";
513
+ development: "development";
514
514
  }>;
515
515
  account: z.ZodString;
516
516
  networkId: z.ZodEnum<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-dev",
3
- "version": "1.51.3",
3
+ "version": "1.51.5",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20.11"
@@ -140,7 +140,7 @@
140
140
  "dotenv": "^17.3.1",
141
141
  "effect": "^3.21.0",
142
142
  "execa": "^9.5.2",
143
- "every-plugin": "^2.9.5",
143
+ "every-plugin": "^2.9.6",
144
144
  "glob": "^13.0.6",
145
145
  "gradient-string": "^3.0.0",
146
146
  "ink": "^6.8.0",