@flakiness/sdk 0.145.0 → 0.146.0

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,4 +1,4 @@
1
- // src/flakinessConfig.ts
1
+ // src/flakinessProjectConfig.ts
2
2
  import fs from "fs";
3
3
  import path2 from "path";
4
4
 
@@ -123,7 +123,7 @@ function normalizePath(aPath) {
123
123
  return aPath;
124
124
  }
125
125
 
126
- // src/flakinessConfig.ts
126
+ // src/flakinessProjectConfig.ts
127
127
  function createConfigPath(dir) {
128
128
  return path2.join(dir, ".flakiness", "config.json");
129
129
  }
@@ -146,7 +146,7 @@ function computeConfigPath() {
146
146
  return createConfigPath(process.cwd());
147
147
  }
148
148
  }
149
- var FlakinessConfig = class _FlakinessConfig {
149
+ var FlakinessProjectConfig = class _FlakinessProjectConfig {
150
150
  constructor(_configPath, _config) {
151
151
  this._configPath = _configPath;
152
152
  this._config = _config;
@@ -155,20 +155,10 @@ var FlakinessConfig = class _FlakinessConfig {
155
155
  const configPath = ensureConfigPath();
156
156
  const data = await fs.promises.readFile(configPath, "utf-8").catch((e) => void 0);
157
157
  const json = data ? JSON.parse(data) : {};
158
- return new _FlakinessConfig(configPath, json);
159
- }
160
- static async projectOrDie(session) {
161
- const config = await _FlakinessConfig.load();
162
- const projectPublicId = config.projectPublicId();
163
- if (!projectPublicId)
164
- throw new Error(`Please link to flakiness project with 'npx flakiness link'`);
165
- const project = await session.api.project.getProject.GET({ projectPublicId }).catch((e) => void 0);
166
- if (!project)
167
- throw new Error(`Failed to fetch linked project; please re-link with 'npx flakiness link'`);
168
- return project;
158
+ return new _FlakinessProjectConfig(configPath, json);
169
159
  }
170
160
  static createEmpty() {
171
- return new _FlakinessConfig(ensureConfigPath(), {});
161
+ return new _FlakinessProjectConfig(ensureConfigPath(), {});
172
162
  }
173
163
  path() {
174
164
  return this._configPath;
@@ -176,6 +166,9 @@ var FlakinessConfig = class _FlakinessConfig {
176
166
  projectPublicId() {
177
167
  return this._config.projectPublicId;
178
168
  }
169
+ reportViewerEndpoint() {
170
+ return this._config.customReportViewerEndpoint ?? "https://report.flakiness.io";
171
+ }
179
172
  setProjectPublicId(projectId) {
180
173
  this._config.projectPublicId = projectId;
181
174
  }
@@ -185,6 +178,6 @@ var FlakinessConfig = class _FlakinessConfig {
185
178
  }
186
179
  };
187
180
  export {
188
- FlakinessConfig
181
+ FlakinessProjectConfig
189
182
  };
190
- //# sourceMappingURL=flakinessConfig.js.map
183
+ //# sourceMappingURL=flakinessProjectConfig.js.map