@barekey/sdk 0.3.0 → 0.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"public-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/public-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAqB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM9E,KAAK,oBAAoB,GAAG;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,uBAAuB,CAAC;CACxC,CAAC;AA4FF,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CAOtC"}
1
+ {"version":3,"file":"public-runtime.d.ts","sourceRoot":"","sources":["../../src/internal/public-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAqB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM9E,KAAK,oBAAoB,GAAG;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAAG;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,uBAAuB,CAAC;CACxC,CAAC;AAqGF,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CAOtC"}
@@ -28,6 +28,14 @@ function normalizeJsonConfig(input, source) {
28
28
  source,
29
29
  });
30
30
  }
31
+ function createMissingPublicRuntimeConfigurationError() {
32
+ return new FsNotAvailableError({
33
+ message: [
34
+ "Barekey could not resolve public runtime configuration in this environment because barekey.json can only be loaded from a local filesystem.",
35
+ "Pass organization, project, and environment to PublicBarekeyClient, or if you're using @barekey/react provide a configured client through <BarekeyProvider client={new PublicBarekeyClient({ organization, project, environment })}>.",
36
+ ].join(" "),
37
+ });
38
+ }
31
39
  async function resolveScope(options) {
32
40
  const explicitOrganization = "organization" in options ? options.organization : undefined;
33
41
  const explicitProject = "project" in options ? options.project : undefined;
@@ -60,7 +68,7 @@ async function resolveScope(options) {
60
68
  const loadedConfig = await loadBarekeyJsonConfig();
61
69
  if (loadedConfig === null) {
62
70
  if (!(await isFilesystemAvailable())) {
63
- throw new FsNotAvailableError();
71
+ throw createMissingPublicRuntimeConfigurationError();
64
72
  }
65
73
  throw new NoConfigurationProvidedError({
66
74
  message: "No Barekey configuration was found and no barekey.json file could be loaded.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barekey/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Barekey TypeScript SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -59,6 +59,15 @@ function normalizeJsonConfig(
59
59
  });
60
60
  }
61
61
 
62
+ function createMissingPublicRuntimeConfigurationError(): Error {
63
+ return new FsNotAvailableError({
64
+ message: [
65
+ "Barekey could not resolve public runtime configuration in this environment because barekey.json can only be loaded from a local filesystem.",
66
+ "Pass organization, project, and environment to PublicBarekeyClient, or if you're using @barekey/react provide a configured client through <BarekeyProvider client={new PublicBarekeyClient({ organization, project, environment })}>.",
67
+ ].join(" "),
68
+ });
69
+ }
70
+
62
71
  async function resolveScope(options: PublicBarekeyClientOptions): Promise<BarekeyResolvedScope> {
63
72
  const explicitOrganization = "organization" in options ? options.organization : undefined;
64
73
  const explicitProject = "project" in options ? options.project : undefined;
@@ -98,7 +107,7 @@ async function resolveScope(options: PublicBarekeyClientOptions): Promise<Bareke
98
107
  const loadedConfig = await loadBarekeyJsonConfig();
99
108
  if (loadedConfig === null) {
100
109
  if (!(await isFilesystemAvailable())) {
101
- throw new FsNotAvailableError();
110
+ throw createMissingPublicRuntimeConfigurationError();
102
111
  }
103
112
  throw new NoConfigurationProvidedError({
104
113
  message: "No Barekey configuration was found and no barekey.json file could be loaded.",