@flakiness/sdk
Advanced tools
+23
-168
@@ -1234,147 +1234,7 @@ var __defProp = Object.defineProperty; | ||
| // src/flakinessProjectConfig.ts | ||
| import fs6 from "fs"; | ||
| import path2 from "path"; | ||
| function createConfigPath(dir) { | ||
| return path2.join(dir, ".flakiness", "config.json"); | ||
| } | ||
| var gConfigPath; | ||
| function ensureConfigPath() { | ||
| if (!gConfigPath) | ||
| gConfigPath = computeConfigPath(); | ||
| return gConfigPath; | ||
| } | ||
| function computeConfigPath() { | ||
| for (let p = process.cwd(); p !== path2.resolve(p, ".."); p = path2.resolve(p, "..")) { | ||
| const configPath = createConfigPath(p); | ||
| if (fs6.existsSync(configPath)) | ||
| return configPath; | ||
| } | ||
| try { | ||
| const worktree = GitWorktree.create(process.cwd()); | ||
| return createConfigPath(worktree.rootPath()); | ||
| } catch (e) { | ||
| return createConfigPath(process.cwd()); | ||
| } | ||
| } | ||
| var FlakinessProjectConfig = class _FlakinessProjectConfig { | ||
| constructor(_configPath, _config) { | ||
| this._configPath = _configPath; | ||
| this._config = _config; | ||
| } | ||
| /** | ||
| * Loads the Flakiness project configuration from disk. | ||
| * | ||
| * Searches for an existing `.flakiness/config.json` file starting from the current working | ||
| * directory and walking up the directory tree. If no config exists, it determines the | ||
| * appropriate location (git root or current directory) for future saves. | ||
| * | ||
| * @returns {Promise<FlakinessProjectConfig>} Promise that resolves to a FlakinessProjectConfig | ||
| * instance. If no config file exists, returns an instance with default/empty values. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = await FlakinessProjectConfig.load(); | ||
| * const projectId = config.projectPublicId(); | ||
| * ``` | ||
| */ | ||
| static async load() { | ||
| const configPath = ensureConfigPath(); | ||
| const data = await fs6.promises.readFile(configPath, "utf-8").catch((e) => void 0); | ||
| const json = data ? JSON.parse(data) : {}; | ||
| return new _FlakinessProjectConfig(configPath, json); | ||
| } | ||
| /** | ||
| * Creates a new empty Flakiness project configuration. | ||
| * | ||
| * Creates a configuration instance with no values set. Use this when you want to build | ||
| * a configuration from scratch. Call `save()` to persist it to disk. | ||
| * | ||
| * @returns {FlakinessProjectConfig} A new empty configuration instance. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = FlakinessProjectConfig.createEmpty(); | ||
| * config.setProjectPublicId('my-project-id'); | ||
| * await config.save(); | ||
| * ``` | ||
| */ | ||
| static createEmpty() { | ||
| return new _FlakinessProjectConfig(ensureConfigPath(), {}); | ||
| } | ||
| /** | ||
| * Returns the absolute path to the configuration file. | ||
| * | ||
| * @returns {string} Absolute path to `.flakiness/config.json`. | ||
| */ | ||
| path() { | ||
| return this._configPath; | ||
| } | ||
| /** | ||
| * Returns the project's public ID, if configured. | ||
| * | ||
| * The project public ID is used to associate reports with a specific Flakiness.io project. | ||
| * | ||
| * @returns {string | undefined} Project public ID, or `undefined` if not set. | ||
| */ | ||
| projectPublicId() { | ||
| return this._config.projectPublicId; | ||
| } | ||
| /** | ||
| * Returns the report viewer URL, either custom or default. | ||
| * | ||
| * @returns {string} Custom report viewer URL if configured, otherwise the default | ||
| * `https://report.flakiness.io`. | ||
| */ | ||
| reportViewerUrl() { | ||
| return this._config.customReportViewerUrl ?? "https://report.flakiness.io"; | ||
| } | ||
| /** | ||
| * Sets or clears the custom report viewer URL. | ||
| * | ||
| * @param {string | undefined} url - Custom report viewer URL to use, or `undefined` to | ||
| * clear and use the default URL. | ||
| */ | ||
| setCustomReportViewerUrl(url) { | ||
| if (url) | ||
| this._config.customReportViewerUrl = url; | ||
| else | ||
| delete this._config.customReportViewerUrl; | ||
| } | ||
| /** | ||
| * Sets the project's public ID. | ||
| * | ||
| * @param {string | undefined} projectId - Project public ID to set, or `undefined` to clear. | ||
| */ | ||
| setProjectPublicId(projectId) { | ||
| this._config.projectPublicId = projectId; | ||
| } | ||
| /** | ||
| * Saves the configuration to disk. | ||
| * | ||
| * Writes the current configuration values to `.flakiness/config.json`. Creates the | ||
| * `.flakiness` directory if it doesn't exist. | ||
| * | ||
| * @returns {Promise<void>} Promise that resolves when the file has been written. | ||
| * | ||
| * @throws {Error} Throws if unable to create directories or write the file. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = await FlakinessProjectConfig.load(); | ||
| * config.setProjectPublicId('my-project'); | ||
| * await config.save(); | ||
| * ``` | ||
| */ | ||
| async save() { | ||
| await fs6.promises.mkdir(path2.dirname(this._configPath), { recursive: true }); | ||
| await fs6.promises.writeFile(this._configPath, JSON.stringify(this._config, null, 2)); | ||
| } | ||
| }; | ||
| // src/staticServer.ts | ||
| import debug2 from "debug"; | ||
| import * as fs7 from "fs"; | ||
| import * as fs6 from "fs"; | ||
| import * as http from "http"; | ||
| import * as path3 from "path"; | ||
| import * as path2 from "path"; | ||
| var log2 = debug2("fk:static_server"); | ||
@@ -1400,3 +1260,3 @@ var StaticServer = class { | ||
| this._pathPrefix = "/" + pathPrefix.replace(/^\//, "").replace(/\/$/, ""); | ||
| this._absoluteFolderPath = path3.resolve(folderPath); | ||
| this._absoluteFolderPath = path2.resolve(folderPath); | ||
| this._cors = cors; | ||
@@ -1498,4 +1358,4 @@ this._server = http.createServer((req, res) => this._handleRequest(req, res)); | ||
| const relativePath = url.slice(this._pathPrefix.length); | ||
| const safeSuffix = path3.normalize(decodeURIComponent(relativePath)).replace(/^(\.\.[\/\\])+/, ""); | ||
| const filePath = path3.join(this._absoluteFolderPath, safeSuffix); | ||
| const safeSuffix = path2.normalize(decodeURIComponent(relativePath)).replace(/^(\.\.[\/\\])+/, ""); | ||
| const filePath = path2.join(this._absoluteFolderPath, safeSuffix); | ||
| if (!filePath.startsWith(this._absoluteFolderPath)) { | ||
@@ -1505,3 +1365,3 @@ this._errorResponse(req, res, 403, "Forbidden"); | ||
| } | ||
| fs7.stat(filePath, (err, stats) => { | ||
| fs6.stat(filePath, (err, stats) => { | ||
| if (err || !stats.isFile()) { | ||
@@ -1511,7 +1371,7 @@ this._errorResponse(req, res, 404, "File Not Found"); | ||
| } | ||
| const ext = path3.extname(filePath).toLowerCase(); | ||
| const ext = path2.extname(filePath).toLowerCase(); | ||
| const contentType = this._mimeTypes[ext] || "application/octet-stream"; | ||
| res.writeHead(200, { "Content-Type": contentType }); | ||
| log2(`[200] ${req.method} ${req.url} -> ${filePath}`); | ||
| const readStream = fs7.createReadStream(filePath); | ||
| const readStream = fs6.createReadStream(filePath); | ||
| readStream.pipe(res); | ||
@@ -1527,9 +1387,7 @@ readStream.on("error", (err2) => { | ||
| // src/showReport.ts | ||
| async function showReport(reportFolder) { | ||
| const config = await FlakinessProjectConfig.load(); | ||
| const projectPublicId = config.projectPublicId(); | ||
| const reportViewerEndpoint = config.reportViewerUrl(); | ||
| async function showReport(reportFolder, options) { | ||
| const reportViewerUrl = options?.reportViewerUrl ?? "https://report.flakiness.io"; | ||
| const token = randomUUIDBase62(); | ||
| const server = new StaticServer(token, reportFolder, [ | ||
| reportViewerEndpoint, | ||
| reportViewerUrl, | ||
| // trace.playwright.dev is used to load & display Playwright Test traces. | ||
@@ -1539,7 +1397,5 @@ "https://trace.playwright.dev" | ||
| await server.start(9373, "127.0.0.1"); | ||
| const url = new URL(reportViewerEndpoint); | ||
| const url = new URL(reportViewerUrl); | ||
| url.searchParams.set("port", String(server.port())); | ||
| url.searchParams.set("token", token); | ||
| if (projectPublicId) | ||
| url.searchParams.set("ppid", projectPublicId); | ||
| console.log(chalk.cyan(` | ||
@@ -1554,19 +1410,19 @@ Serving Flakiness report at ${url.toString()} | ||
| // src/writeReport.ts | ||
| import fs8 from "fs"; | ||
| import path4 from "path"; | ||
| import fs7 from "fs"; | ||
| import path3 from "path"; | ||
| async function writeReport(report, attachments, outputFolder) { | ||
| const reportPath = path4.join(outputFolder, "report.json"); | ||
| const attachmentsFolder = path4.join(outputFolder, "attachments"); | ||
| await fs8.promises.rm(outputFolder, { recursive: true, force: true }); | ||
| await fs8.promises.mkdir(outputFolder, { recursive: true }); | ||
| await fs8.promises.writeFile(reportPath, JSON.stringify(report), "utf-8"); | ||
| const reportPath = path3.join(outputFolder, "report.json"); | ||
| const attachmentsFolder = path3.join(outputFolder, "attachments"); | ||
| await fs7.promises.rm(outputFolder, { recursive: true, force: true }); | ||
| await fs7.promises.mkdir(outputFolder, { recursive: true }); | ||
| await fs7.promises.writeFile(reportPath, JSON.stringify(report), "utf-8"); | ||
| if (attachments.length) | ||
| await fs8.promises.mkdir(attachmentsFolder); | ||
| await fs7.promises.mkdir(attachmentsFolder); | ||
| const movedAttachments = []; | ||
| for (const attachment of attachments) { | ||
| const attachmentPath = path4.join(attachmentsFolder, attachment.id); | ||
| const attachmentPath = path3.join(attachmentsFolder, attachment.id); | ||
| if (attachment.type === "file") | ||
| await fs8.promises.cp(attachment.path, attachmentPath); | ||
| await fs7.promises.cp(attachment.path, attachmentPath); | ||
| else if (attachment.type === "buffer") | ||
| await fs8.promises.writeFile(attachmentPath, attachment.body); | ||
| await fs7.promises.writeFile(attachmentPath, attachment.body); | ||
| movedAttachments.push({ | ||
@@ -1584,3 +1440,2 @@ type: "file", | ||
| CPUUtilization, | ||
| FlakinessProjectConfig, | ||
| GitWorktree, | ||
@@ -1587,0 +1442,0 @@ RAMUtilization, |
+1
-1
| { | ||
| "name": "@flakiness/sdk", | ||
| "version": "1.1.0", | ||
| "version": "2.0.0", | ||
| "private": false, | ||
@@ -5,0 +5,0 @@ "repository": { |
+26
-2
@@ -99,4 +99,28 @@ # Flakiness Node.js SDK | ||
| ### Project Configuration | ||
| - **`FlakinessProjectConfig`** - Manage project configuration stored in `.flakiness/config.json` | ||
| ## Uploading Reports | ||
| `uploadReport()` authenticates using one of the following methods (in order of priority): | ||
| 1. **Access token** — pass `flakinessAccessToken` option or set the `FLAKINESS_ACCESS_TOKEN` environment variable. | ||
| 2. **GitHub Actions OIDC** — when running inside GitHub Actions, `uploadReport` can authenticate automatically without an access token. This works when both conditions are met: | ||
| - The report has `flakinessProject` set to a flakiness project identifier (e.g. `"org/proj"`). | ||
| - The flakiness project is bound to the GitHub repository that runs the action. | ||
| Your GitHub Actions workflow must grant the `id-token: write` permission: | ||
| ```yaml | ||
| permissions: | ||
| id-token: write | ||
| ``` | ||
| ```typescript | ||
| const report: FlakinessReport.Report = { | ||
| flakinessProject: 'my-org/my-project', | ||
| // ... rest of the report | ||
| }; | ||
| // No access token needed — OIDC authentication is used automatically. | ||
| await uploadReport(report, attachments); | ||
| ``` | ||
| If neither method is available, the upload is skipped with a `'skipped'` status. | ||
@@ -10,3 +10,2 @@ export { CIUtils } from './ciUtils.js'; | ||
| export { writeReport } from './writeReport.js'; | ||
| export { FlakinessProjectConfig } from './flakinessProjectConfig.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"} |
@@ -11,2 +11,5 @@ /** | ||
| * the Flakiness report. | ||
| * @param {object} [options] - Optional configuration. | ||
| * @param {string} [options.reportViewerUrl] - Custom report viewer URL. Defaults to | ||
| * `https://report.flakiness.io`. | ||
| * | ||
@@ -18,3 +21,5 @@ * @example | ||
| */ | ||
| export declare function showReport(reportFolder: string): Promise<void>; | ||
| export declare function showReport(reportFolder: string, options?: { | ||
| reportViewerUrl?: string; | ||
| }): Promise<void>; | ||
| //# sourceMappingURL=showReport.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"showReport.d.ts","sourceRoot":"","sources":["../../src/showReport.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,iBAyBpD"} | ||
| {"version":3,"file":"showReport.d.ts","sourceRoot":"","sources":["../../src/showReport.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,iBAmBA"} |
@@ -134,4 +134,6 @@ import { FlakinessReport } from '@flakiness/flakiness-report'; | ||
| * Defaults to the `FLAKINESS_ACCESS_TOKEN` environment variable. If no token is provided | ||
| * through this option or the environment variable, the upload will be skipped with a | ||
| * 'skipped' status. Obtain this token from your Flakiness.io project settings. | ||
| * through this option or the environment variable, the function will attempt to authenticate | ||
| * via GitHub Actions OIDC when running in GitHub Actions (requires `report.flakinessProject` | ||
| * to be set and the project to be bound to the repository). If no authentication method | ||
| * is available, the upload will be skipped with a 'skipped' status. | ||
| * | ||
@@ -167,3 +169,3 @@ * @example 'flakiness-io-1234567890abcdef...' | ||
| * This function handles the complete upload process including: | ||
| * - Authentication using access tokens | ||
| * - Authentication using access tokens or GitHub Actions OIDC | ||
| * - Report compression and upload | ||
@@ -174,2 +176,13 @@ * - Attachment upload with automatic compression for text-based content | ||
| * | ||
| * ## Authentication | ||
| * | ||
| * The function authenticates using one of the following methods (in priority order): | ||
| * 1. **Access token** — provided via `flakinessAccessToken` option or `FLAKINESS_ACCESS_TOKEN` env var. | ||
| * 2. **GitHub Actions OIDC** — when running in GitHub Actions with no access token, the function | ||
| * automatically authenticates via OIDC. This requires: | ||
| * - `report.flakinessProject` to be set to a project identifier (e.g. `"org/proj"`). | ||
| * - The flakiness project to be bound to the GitHub repository running the action. | ||
| * - The workflow to have `id-token: write` permission. | ||
| * 3. If neither is available, the upload is skipped. | ||
| * | ||
| * The function operates in "safe mode" by default, meaning it won't throw errors on upload | ||
@@ -176,0 +189,0 @@ * failures unless explicitly configured to do so. |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"uploadReport.d.ts","sourceRoot":"","sources":["../../src/uploadReport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAY9D;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,IAAI,EAAE,QAAQ,CAAC;IACf,4EAA4E;IAC5E,EAAE,EAAE,eAAe,CAAC,YAAY,CAAC;IACjC,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,EAAE,EAAE,eAAe,CAAC,YAAY,CAA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,MAAM,CAAA;CAAE,GACxC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,UAAU,MAAM;IACd,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,CAAC,MAAM,EAC9B,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAqDvB"} |
| type JSONConfig = { | ||
| projectPublicId?: string; | ||
| customReportViewerUrl?: string; | ||
| }; | ||
| /** | ||
| * Manages Flakiness project configuration stored in `.flakiness/config.json`. | ||
| * | ||
| * The configuration file is automatically located by searching upward from the current working | ||
| * directory for an existing `.flakiness` folder, or by placing it at the git repository root | ||
| * if no existing config is found. | ||
| */ | ||
| export declare class FlakinessProjectConfig { | ||
| private _configPath; | ||
| private _config; | ||
| /** | ||
| * Loads the Flakiness project configuration from disk. | ||
| * | ||
| * Searches for an existing `.flakiness/config.json` file starting from the current working | ||
| * directory and walking up the directory tree. If no config exists, it determines the | ||
| * appropriate location (git root or current directory) for future saves. | ||
| * | ||
| * @returns {Promise<FlakinessProjectConfig>} Promise that resolves to a FlakinessProjectConfig | ||
| * instance. If no config file exists, returns an instance with default/empty values. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = await FlakinessProjectConfig.load(); | ||
| * const projectId = config.projectPublicId(); | ||
| * ``` | ||
| */ | ||
| static load(): Promise<FlakinessProjectConfig>; | ||
| /** | ||
| * Creates a new empty Flakiness project configuration. | ||
| * | ||
| * Creates a configuration instance with no values set. Use this when you want to build | ||
| * a configuration from scratch. Call `save()` to persist it to disk. | ||
| * | ||
| * @returns {FlakinessProjectConfig} A new empty configuration instance. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = FlakinessProjectConfig.createEmpty(); | ||
| * config.setProjectPublicId('my-project-id'); | ||
| * await config.save(); | ||
| * ``` | ||
| */ | ||
| static createEmpty(): FlakinessProjectConfig; | ||
| constructor(_configPath: string, _config: JSONConfig); | ||
| /** | ||
| * Returns the absolute path to the configuration file. | ||
| * | ||
| * @returns {string} Absolute path to `.flakiness/config.json`. | ||
| */ | ||
| path(): string; | ||
| /** | ||
| * Returns the project's public ID, if configured. | ||
| * | ||
| * The project public ID is used to associate reports with a specific Flakiness.io project. | ||
| * | ||
| * @returns {string | undefined} Project public ID, or `undefined` if not set. | ||
| */ | ||
| projectPublicId(): string | undefined; | ||
| /** | ||
| * Returns the report viewer URL, either custom or default. | ||
| * | ||
| * @returns {string} Custom report viewer URL if configured, otherwise the default | ||
| * `https://report.flakiness.io`. | ||
| */ | ||
| reportViewerUrl(): string; | ||
| /** | ||
| * Sets or clears the custom report viewer URL. | ||
| * | ||
| * @param {string | undefined} url - Custom report viewer URL to use, or `undefined` to | ||
| * clear and use the default URL. | ||
| */ | ||
| setCustomReportViewerUrl(url: string | undefined): void; | ||
| /** | ||
| * Sets the project's public ID. | ||
| * | ||
| * @param {string | undefined} projectId - Project public ID to set, or `undefined` to clear. | ||
| */ | ||
| setProjectPublicId(projectId: string | undefined): void; | ||
| /** | ||
| * Saves the configuration to disk. | ||
| * | ||
| * Writes the current configuration values to `.flakiness/config.json`. Creates the | ||
| * `.flakiness` directory if it doesn't exist. | ||
| * | ||
| * @returns {Promise<void>} Promise that resolves when the file has been written. | ||
| * | ||
| * @throws {Error} Throws if unable to create directories or write the file. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const config = await FlakinessProjectConfig.load(); | ||
| * config.setProjectPublicId('my-project'); | ||
| * await config.save(); | ||
| * ``` | ||
| */ | ||
| save(): Promise<void>; | ||
| } | ||
| export {}; | ||
| //# sourceMappingURL=flakinessProjectConfig.d.ts.map |
| {"version":3,"file":"flakinessProjectConfig.d.ts","sourceRoot":"","sources":["../../src/flakinessProjectConfig.ts"],"names":[],"mappings":"AAmCA,KAAK,UAAU,GAAG;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IA4C/B,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,OAAO;IA5CjB;;;;;;;;;;;;;;;OAeG;WACU,IAAI,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAOpD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,WAAW;gBAKR,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU;IAG7B;;;;OAIG;IACH,IAAI;IAIJ;;;;;;OAMG;IACH,eAAe;IAIf;;;;;OAKG;IACH,eAAe;IAIf;;;;;OAKG;IACH,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAC,SAAS;IAO9C;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAC,SAAS;IAI9C;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI;CAIX"} |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 16 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 16 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
126
23.53%29
-3.33%111862
-6.03%49
-3.92%2496
-8.4%