Commit Graph

28 Commits

Author SHA1 Message Date
Pascal Hartig
554d2f9b83 Bump ES level to 2021
Summary: Updating the remaining tsconfigs to build for an ES2021 target.

Reviewed By: antonk52

Differential Revision: D48687661

fbshipit-source-id: 2761704d251f701594ca5d362a17731f287088ed
2023-08-29 05:06:18 -07:00
Lorenzo Blasa
ff6f98fc0d Import File implementation
Summary: Implementation was missing for the browser. This provides a default implementation.

Reviewed By: aigoncharov

Differential Revision: D48311198

fbshipit-source-id: fd067600f571234e0fbccfb90853b62f175ff8fb
2023-08-14 11:33:06 -07:00
Andrey Goncharov
b55d730dd7 Integrate filter exceptions with DataTable
Summary: See previous diff for context

Reviewed By: LukeDefeo

Differential Revision: D47472005

fbshipit-source-id: 6e7d8873d275f826c38fab16c72e1621fd2784e1
2023-07-18 05:25:59 -07:00
Andrey Goncharov
8397b2bab8 Add filter exceptions to DataSource
Summary: Filter exceptions allow us to add singular items to table views. Extremely useful for Bloks Debugger where we have to jump between multiple types of rows that could be filtered out

Reviewed By: LukeDefeo

Differential Revision: D47472006

fbshipit-source-id: 74d21a65d364ec5ab88652effc06aade20ad80b2
2023-07-18 05:25:59 -07:00
Michel Weststrate
c8776175c3 Added support for secondary indices for fast lookups
Summary:
Add support for secondary indices, to allow for cheap lookups, like a set of events for a specific UI element in the events table:

```

#### getAllRecordsByIndex

Usage: `getAllRecordsByIndex({ indexedAttribute: value, indexAttribute2: value2, .... })`

This method allows fast lookups for objects that match specific attributes exactly.
Returns all items matching the specified index query.
Note that the results are unordered, unless
records have not been updated using upsert / update, in that case
insertion order is maintained.
If no index has been specified for this exact keyset in the indexQuery (see options.indices), this method will throw.

Example:
```

```
const ds = createDataSource([eatCookie, drinkCoffee, submitBug], {
  key: 'id',
  indices: [
    ['title']
    ['id', 'title'],
    ['title', 'done'],
  ],
});

// Find first element with title === cookie (or undefined)
const todo = ds.getFirstRecordByIndex({
    title: 'cookie',
})

// Find all elements where title === cookie, and done === false
const todos = ds.getAllRecordsByIndex({
  title: 'cookie',
  done: false,
})
```

Reviewed By: antonk52

Differential Revision: D47396435

fbshipit-source-id: 20c4527be83532863b9b07ab20ebf20a80c3c35d
2023-07-14 07:46:52 -07:00
Andrey Goncharov
f59a2e5fba Allow unsubscribing from client events
Summary: In the next diffs, we are going to show a message only once when the plugin gets activated. This diff adds a way to unsubscribe from Flipper events after the first execution.

Reviewed By: LukeDefeo

Differential Revision: D47366239

fbshipit-source-id: 18cb99df865f9cf26c055a99b7d1b7058dcb123c
2023-07-12 08:56:50 -07:00
Andrey Goncharov
7644c9092a Expose activated state to plugins
Reviewed By: LukeDefeo

Differential Revision: D47365658

fbshipit-source-id: 4ce2a65e9439c51e635548d84a25a2cdcde9a0d3
2023-07-12 08:56:50 -07:00
Andrey Goncharov
84e481e7e9 Expose dark mode flag to plugin authors
Summary:
Should be available now with
```
getFlipperLib().settings().isDarkMode
```

Differential Revision: D46685851

fbshipit-source-id: 0777437b7ca06051cc3fd4dc1b794242f453f2b5
2023-06-13 08:18:14 -07:00
Pascal Hartig
bf2f1283d3 Unbreak error logging
Summary:
*Potentially.

A big thanks to lblasa and aigoncharov for helping with debugging. Looking at
`ptail -f errorlog_flipper_javascript` reveals that messages now include a spurious amount of unescaped newlines. E.g. P768993195

From memory, these were not there when I wrote the categorizer when I was able to copy-paste from ptail to the unit tests.

D44729490 added prettifying to the results inadvertently.

Reviewed By: lblasa

Differential Revision: D46685543

fbshipit-source-id: 98da5eff92900042fc5306ca5d5652d8940ff2e1
2023-06-13 08:17:03 -07:00
Anton Kastritskiy
c01b6b9f16 expose isHeadlessBuild to flipper plugins
Reviewed By: passy

Differential Revision: D46364476

fbshipit-source-id: bad584e3892cc0fb0fdaba0e8b3c79952596d34d
2023-06-02 06:49:49 -07:00
Lorenzo Blasa
6430403da0 Jest update v26.6.3 -> v29.5.1
Summary:
^

Basically, update Jest and fix any raised issues. Mainly:
- Update necessary dependencies
- Update snapshots
- `useFakeTimers` caused a few issues which meant that the way we hook into the performance object had to be tweaked. The main code change is: `//fbsource/xplat/sonar/desktop/scripts/jest-setup-after.tsx`
- `mocked` -> `jest.mocked`

Changelog: Update Jest to v29.5.1

Reviewed By: antonk52

Differential Revision: D46319818

fbshipit-source-id: d218ca8f7e43abac6b00844953ddeb7f4e1010a2
2023-05-31 14:19:29 -07:00
Anton Kastritskiy
ff6b0043c4 avoid creating a copy of an array of entire view to look up index
Summary: What title says

Reviewed By: lblasa

Differential Revision: D46275672

fbshipit-source-id: 65c6566a042b576b83ababdf6470ddf2f626d3e4
2023-05-30 08:01:18 -07:00
Anton Kastritskiy
6c84732742 extract get view index into data source view method
Reviewed By: ivanmisuno

Differential Revision: D46224361

fbshipit-source-id: 193becb59eee469ba3e68611e588671947406f7e
2023-05-26 11:55:11 -07:00
Anton Kastritskiy
fda21e96e8 Update typescript to 4.9.5
Reviewed By: passy

Differential Revision: D46068908

fbshipit-source-id: 4c1ffff8690eec5a10c67d6c5d1aacf224e0f0d4
2023-05-23 03:15:10 -07:00
Szu-Kai Hsu
10f967fe60 feat: Update paste argument schema to support specified programming language (#4732)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/4732

This diff adds a `language` field into `CreatePasteArgs` type to potentially specify programming language in the paste service

Reviewed By: mweststrate

Differential Revision: D45701098

fbshipit-source-id: 080d76e5ff332518881e9c6b84aa47aaea680309
2023-05-10 07:36:49 -07:00
Andrey Goncharov
ff85744911 Make DataView report window changes
Summary: Project: https://docs.google.com/document/d/1x-1ShlxXCM2od9JMO6PP14Cuqq0OrVe1Qd7FUwTos9A/edit

Reviewed By: antonk52

Differential Revision: D44748055

fbshipit-source-id: 409c272b12fb29c156efdaa1ab26d4d6a2936645
2023-04-06 10:10:34 -07:00
Andrey Goncharov
7f111a11de Expose isConnected and currentUser
Summary: Requested by antonk52 and MSYS team

Reviewed By: passy

Differential Revision: D44662243

fbshipit-source-id: 2bace476c4e79b6a05bfb89ddc3e6acb437c6c3b
2023-04-04 05:26:31 -07:00
Andrey Goncharov
7edaf24d5c Deprecate isLoggedIn request
Summary: It no longer makes sense since we are going to export "isLoggedIn" atom that always stays up-to-date in subsequent diffs

Reviewed By: LukeDefeo

Differential Revision: D44631234

fbshipit-source-id: 3e3b29b77d250eef430e81eef80098afe38a1538
2023-04-04 05:26:31 -07:00
dependabot[bot]
df5ddf01a6 Bump js-base64 from 3.7.4 to 3.7.5 in /desktop (#4519)
Summary:
Bumps [js-base64](https://github.com/dankogai/js-base64) from 3.7.4 to 3.7.5.
<details>
<summary>Commits</summary>
<ul>
<li><a href="7e790b799e"><code>7e790b7</code></a> version 3.7.5</li>
<li><a href="f729053682"><code>f729053</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dankogai/js-base64/issues/167">https://github.com/facebook/flipper/issues/167</a> from ctomacheski/main</li>
<li><a href="a9a994f367"><code>a9a994f</code></a> improve performance by stop using the mapFn param on Uint8Array.from constructor</li>
<li>See full diff in <a href="https://github.com/dankogai/js-base64/compare/3.7.4...3.7.5">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=js-base64&package-manager=npm_and_yarn&previous-version=3.7.4&new-version=3.7.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Pull Request resolved: https://github.com/facebook/flipper/pull/4519

Reviewed By: mweststrate

Differential Revision: D43305193

Pulled By: ivanmisuno

fbshipit-source-id: e10eb134c079951e325c1f4d627eb1e60510c12d
2023-02-16 06:33:32 -08:00
Pascal Hartig
18b6ce6f24 Dep bump
Summary: Combining a bunch of individual tasks for dep upgrades into one diff.

Reviewed By: ivanmisuno

Differential Revision: D42706074

fbshipit-source-id: 054b2545ad1295699f47f4c6eb5065b7b9a1d6a0
2023-01-25 04:35:09 -08:00
Lorenzo Blasa
51ca3a6cd7 Expose env via flipperLib
Summary:
This change exposes the env variables via the FlipperLib interface used by plugins.

The variables are already white-listed and safe to be used by plugins according to documentation.

Reviewed By: antonk52

Differential Revision: D40852147

fbshipit-source-id: bbb3b052d33bf5cf75c81166af2400fe6a359256
2022-11-10 12:40:27 -08:00
Andrey Goncharov
82e5cfd368 Expose isLoggedIn to plugin creators
Summary: Re-expose one of the legacy exports we had before. Requested by MSYS

Reviewed By: passy

Differential Revision: D40979328

fbshipit-source-id: 7e8f089a182a62f392f3a720bee9b81698930f9d
2022-11-03 06:29:24 -07:00
Lorenzo Blasa
587f428cf8 Allow plugins to use css
Summary:
Flipper plugins fail when importing css from third-party dependencies. This diff tries to fix that.

Effectively, the plugin can import the css and export it when is bundled.

When we load the plugin, we check if there's a css file for it. If there's one, we return it and try to use it.

Reviewed By: aigoncharov

Differential Revision: D40758178

fbshipit-source-id: e53afffcc481504905d5eeb1aea1f9114ee2a86b
2022-10-27 22:50:30 -07:00
Andrey Goncharov
27fd60b659 Ignore persistToLocalStorage in headless mode
Summary:
In a headless mode we do not have access to local storage. As a result, headless plugins that try to use `persistToLocalStorage` option crash. We should ignore the option for these plugins for now and add a way to persist the plugin state to the disk in a headless mode in the future.

CHANGELOG: Ignore persistToLocalStorage in headless mode

Resolves https://github.com/facebook/flipper/issues/4190

Reviewed By: lblasa

Differential Revision: D40341873

fbshipit-source-id: 40774c0024f79cf1652f24146fd16f6a101ca99e
2022-10-14 02:26:43 -07:00
Andrey Goncharov
228de6c542 Add custom timeout to Device.installApp
Reviewed By: lblasa

Differential Revision: D39728545

fbshipit-source-id: be77a2e7ddac4071c9cafc88e67b793ee8c7631c
2022-09-23 10:20:53 -07:00
Andrey Goncharov
3314c77ce9 Add exportFileBinary to FlipperLib
Reviewed By: antonk52

Differential Revision: D39692937

fbshipit-source-id: 7b3c78d004a9734cd8ae660d5782be1f02c00009
2022-09-21 09:26:19 -07:00
Andrey Goncharov
650ff4bcfb Remove plugin bundling
Summary: Remove the notion of bundled plugins

Reviewed By: lblasa

Differential Revision: D39308888

fbshipit-source-id: aa88ddbf2801ad1da95f89e4c761259b697b0d66
2022-09-15 10:02:19 -07:00
Andrey Goncharov
97b8b8a1c4 Split flipper-plugin package
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.

Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs

Reviewed By: lblasa

Differential Revision: D38658285

fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
2022-09-15 10:02:19 -07:00