@flakiness/sdk 2.0.0 → 2.1.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.
Files changed (2) hide show
  1. package/lib/index.js +11 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1069,7 +1069,17 @@ var ReportUpload = class {
1069
1069
  }));
1070
1070
  }
1071
1071
  async upload() {
1072
- const response = await this._api("/api/upload/start", this._options.flakinessAccessToken);
1072
+ const [orgSlug, projectSlug] = this._report.flakinessProject ? this._report.flakinessProject.split("/") : [];
1073
+ const response = await this._api("/api/upload/start", this._options.flakinessAccessToken, {
1074
+ // When bearer token is a Device OAuth token with a user session, upload/start
1075
+ // endpoint requires passing explicit orgSlug / projectSlug.
1076
+ // This is NOT required and is ignored for automation-scoped tokens,
1077
+ // like Github OIDC of `FLAKINESS_ACCESS_TOKEN`.
1078
+ // Since this SDK is also used to power Flakiness CLI, we pass these here
1079
+ // unconditionally.
1080
+ orgSlug,
1081
+ projectSlug
1082
+ });
1073
1083
  if (response?.error || !response.result)
1074
1084
  return { success: false, message: response.error };
1075
1085
  const webUrl = new URL2(response.result.webUrl, this._options.flakinessEndpoint).toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flakiness/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",