Compare commits

...
Author SHA1 Message Date
StandardNotes CI 1f5354c816 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
2023-07-11 15:46:44 +00:00
Karol Sójko f097f6e354 chore(api): fix request params and make api package publishable (#2351)
* chore(api): fix request params and make api package publishable

* chore(api): fix deps

* chore(encryption): fix privacy
2023-07-11 17:19:37 +02:00
StandardNotes CI 97456f7c0b chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected]
2023-07-11 09:02:46 +00:00
Karol Sójko 937f9d98d7 chore(api): fix missing exports 2023-07-11 10:34:35 +02:00
StandardNotes CI 07410cefb7 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-07-10 15:32:29 +00:00
Aman Harwara de6994f743 fix: Fixed issue where files would not download correctly on mobile if they had special characters in the name 2023-07-10 20:27:52 +05:30
StandardNotes CI 5c87f3a3b4 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].9
2023-07-10 13:32:35 +00:00
Mo b257af17aa internal: temporarily disable home server imports 2023-07-10 08:00:04 -05:00
StandardNotes CI 3a75afc817 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].8
2023-07-10 09:29:39 +00:00
Aman Harwara e4488dcb8c chore: take popover offset into account when fitting inside rect 2023-07-10 14:29:49 +05:30
StandardNotes CI bb997312e8 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected].7
2023-07-07 15:19:11 +00:00
Aman Harwara b229a96e58 chore: bump node version 2023-07-07 20:16:21 +05:30
Aman Harwara 7f0bb4e127 refactor: use Fetch API for HttpService (#2349) 2023-07-07 19:26:31 +05:30
StandardNotes CI bf9449b67d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
2023-07-07 06:37:18 +00:00
Aman Harwara 67359801bb chore: fix PageUp and PageDown not scrolling in preferences view 2023-07-06 22:13:34 +05:30
StandardNotes CI 53e978c30e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
2023-07-06 15:33:57 +00:00
Aman Harwara ebc9fcb995 chore: fix blank screen issue when moving iOS floating keyboard 2023-07-06 20:30:49 +05:30
StandardNotes CI 7923e9f198 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected].4
2023-07-06 14:32:38 +00:00
Aman Harwara 9081607dc7 chore: fix challenge modal automatically closing 2023-07-06 19:27:14 +05:30
Mo c8e52b667c internal: change password preprocessing step (#2347) 2023-07-06 08:51:06 -05:00
StandardNotes CI 5c6ccaf4e1 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].3
2023-07-05 16:57:29 +00:00
Mo 0ab6b5c6fe chore(fix): fixes sync response not correctly identifying all errors (#2346) 2023-07-05 11:28:45 -05:00
StandardNotes CI 2a050fd966 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].2
2023-07-05 16:26:01 +00:00
Mo 40f0d3d5bf chore: merge 2023-07-05 10:54:16 -05:00
Mo c9c93d143a internal: move home server into internal flag 2023-07-05 10:53:10 -05:00
StandardNotes CI a52828cd45 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2023-07-05 15:50:04 +00:00
Aman Harwara 2611c88cee chore: fix modal positioning when using themed desktop titlebar 2023-07-05 20:43:55 +05:30
StandardNotes CI d4db3e055c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].0
2023-07-04 15:29:47 +00:00
Karol Sójko 05528782a4 feat: New one-click Home Server, now in Labs. Launch your own self-hosted server instance with just 1 click from the Preferences window. (#2345)
* fix(desktop): add home server coming-soon message on windows platform

* fix(desktop): typos and remove feature block

* fix(desktop): instantiate home server only upon starting
2023-07-04 16:55:37 +02:00
StandardNotes CI 9664d31c4e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].3
2023-07-04 13:02:42 +00:00
Mo b06999d25b refactor: root key manager (#2344) 2023-07-04 07:31:50 -05:00
StandardNotes CI b4a90025c4 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2023-07-04 09:33:32 +00:00
Aman Harwara 31b42553be chore: improve super formatting toolbar positioning 2023-07-04 14:33:24 +05:30
StandardNotes CI 41311801c0 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
2023-07-03 19:20:31 +00:00
Mo ccc9d73b3b chore: make home server internal feature 2023-07-03 13:53:03 -05:00
StandardNotes CI 1f144e062e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
2023-07-03 14:58:46 +00:00
Mo 40f8985ede chore: implement removeApplication 2023-07-03 09:21:09 -05:00
Mo 27fc4be886 chore: fix mobile device interface 2023-07-03 09:08:27 -05:00
Mo 96f42643a9 feat: New one-click Home Server, now in Labs. Launch your own self-hosted server instance with just 1 click from the Preferences window. (#2341) 2023-07-03 08:30:48 -05:00
Mo d79e7b14b1 chore: legacy fixes (#2343) 2023-07-03 08:03:25 -05:00
Mo 6d5cbcb396 chore: ci 2023-07-03 07:03:06 -05:00
StandardNotes CI 20bbd70595 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2023-07-02 16:14:29 +00:00
Aman Harwara 5839f7d075 chore: fix empty super note error on exporting to markdown 2023-07-02 21:17:13 +05:30
StandardNotes CI 6a6cbe57a1 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
2023-07-02 15:46:14 +00:00
Aman Harwara a8bc20e99e fix: Fixed issue where subfolders would show one extra item count 2023-07-02 20:46:33 +05:30
StandardNotes CI d42acab032 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2023-07-02 10:59:59 +00:00
Aman Harwara efa0669dbc chore: show non-editable link bar to allow opening auto-links 2023-07-02 15:29:02 +05:30
StandardNotes CI a6d7844ad4 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2023-07-02 09:43:13 +00:00
Aman Harwara 929642195d feat: Link and formatting toolbars for super are now unified on web/desktop to allow formatting existing links and updated link editor on mobile (#2342) 2023-07-02 14:45:49 +05:30
StandardNotes CI f354a50c26 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-06-30 18:25:33 +00:00
Aman Harwara ab1937226f chore: make "potentially out of sync" warning more visible on mobile 2023-06-30 23:22:15 +05:30
StandardNotes CI 64729a816c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-06-30 16:30:45 +00:00
Aman Harwara c9a95c818b chore: fix session modal error after revoking session 2023-06-30 20:57:57 +05:30
StandardNotes CI a0bc6153d6 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
2023-06-30 14:51:02 +00:00
Aman Harwara 89849c9f90 fix: Fixed issue where clicking in file dialog context menu closed the dialog 2023-06-30 19:51:08 +05:30
Mo b032eb9c9b internal: incomplete vault systems behind feature flag (#2340) 2023-06-30 09:01:56 -05:00
StandardNotes CI d16e401bb9 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].9
2023-06-29 12:58:00 +00:00
Aman Harwara 476c5b4bdb chore: remove Labs status from Super 2023-06-29 17:57:07 +05:30
Aman Harwara 69de0e448f fix: Fixed issue where Conflicts view is shown but the list is empty 2023-06-29 17:54:38 +05:30
StandardNotes CI efe069db06 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].8
2023-06-27 20:39:44 +00:00
Aman Harwara edd3232c77 chore: update spreadsheets 2023-06-28 01:39:29 +05:30
StandardNotes CI 9ca0604352 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
2023-06-27 17:09:34 +00:00
Aman Harwara d3378a704a refactor: fix conflicts view when conflicted copies are already in trash (#2339) 2023-06-27 22:08:46 +05:30
StandardNotes CI f858f31492 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
2023-06-26 15:24:21 +00:00
Aman Harwara dffeb7e710 chore: fix signin menu closing on incorrect mfa 2023-06-26 19:56:00 +05:30
Aman Harwara c378288d6e chore: fix ios height issue 2023-06-26 19:37:49 +05:30
StandardNotes CI 65a09b77d3 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
2023-06-26 11:19:38 +00:00
Aman Harwara 24d159f6d8 chore: remove unused code 2023-06-26 16:20:03 +05:30
Aman Harwara 59fbf6f4c3 refactor: readonly note content 2023-06-26 16:12:35 +05:30
StandardNotes CI 28a52cb998 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
2023-06-26 10:12:21 +00:00
Mo 7f5041c4a8 chore: check for external request 2023-06-26 04:40:46 -05:00
StandardNotes CI 4b93dc35a8 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2023-06-25 20:42:27 +00:00
Mo bb804fff45 fix: fixes issue where a renewed session would in some cases would not save to disk, causing a reauthentication prompt to occur 2023-06-25 15:12:22 -05:00
StandardNotes CI 8362c4e92c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
2023-06-25 18:50:31 +00:00
Aman Harwara b8481dfbe3 Merge branch 'main' of github.com:standardnotes/app 2023-06-25 23:53:31 +05:30
Aman Harwara 046eaac548 refactor: packageprovider 2023-06-25 23:53:23 +05:30
StandardNotes CI 747ba1b342 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
2023-06-25 12:46:27 +00:00
Aman Harwara 7c3b8d4534 chore: fix test 2023-06-25 17:47:35 +05:30
Aman Harwara 0613436198 chore: select current result when closing super search dialog 2023-06-25 16:37:05 +05:30
Aman Harwara 63b95391a6 refactor: use actual maps for uuidmap 2023-06-25 16:14:52 +05:30
Aman Harwara 195420101a chore: fix conflict map addition/removal 2023-06-25 16:05:50 +05:30
StandardNotes CI 74ba220982 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
2023-06-25 09:26:54 +00:00
Aman Harwara e0e9249334 feat: Added a conflict resolution dialog and a Conflicts view for easier management of conflicts (#2337) 2023-06-25 14:27:51 +05:30
StandardNotes CI 49d43fd14b chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2023-06-23 20:59:33 +00:00
Shane Duffy 1ff34cf1a2 refactor: fix accessibility issue with note list items (#2338) 2023-06-24 02:01:05 +05:30
StandardNotes CI c6d30976e0 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2023-06-16 19:05:16 +00:00
Aman Harwara 26a9f8c497 chore: dayjs fix 2023-06-17 00:07:20 +05:30
StandardNotes CI d129d51bfe chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2023-06-06 17:18:30 +00:00
Aman Harwara 6e6402da81 chore: backup service test 2023-06-06 22:15:06 +05:30
Aman Harwara 0e938c5596 chore: context menu path 2023-06-06 21:51:12 +05:30
Aman Harwara db997955af refactor(desktop): backup paths 2023-06-06 20:58:08 +05:30
StandardNotes CI 9cae641693 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2023-06-02 20:48:54 +00:00
Aman Harwara 08c38fc7cf feat: You can now drag-n-drop notes onto tags to move them from one tag to another (#2334) 2023-06-03 01:46:29 +05:30
StandardNotes CI 153ec272d2 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-31 16:13:07 +00:00
Aman Harwara 7d691aa409 fix(desktop): Fixed issue where local backup location would default to "[object Promise]" 2023-05-31 21:16:14 +05:30
StandardNotes CI 9141da0832 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-30 14:50:20 +00:00
Aman Harwara 39414e6cab fix: Fixed issue where pane gestures on Android would break scroll in a daily journal tag 2023-05-30 19:52:41 +05:30
StandardNotes CI 1738485777 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-29 11:58:09 +00:00
Aman Harwara 0cb73b5d18 fix: Fixed issue on Android where pressing backspace in Super notes would delete characters on both side of the cursor (#2336) 2023-05-29 17:00:01 +05:30
StandardNotes CI 5d98c86592 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-26 08:31:36 +00:00
Aman Harwara ba828f31ad Merge branch 'main' of github.com:standardnotes/app 2023-05-26 13:28:38 +05:30
Aman Harwara c29832ab77 chore: buttons in dark themes 2023-05-26 13:28:28 +05:30
StandardNotes CI 6f10d88dee chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-25 11:08:56 +00:00
Karol Sójko 7b66ee1d40 chore: enable e2e for history tests (#2335) 2023-05-25 12:41:49 +02:00
StandardNotes CI 6c785e8565 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-25 08:29:21 +00:00
Aman Harwara c21ed0a8b6 chore: normal button color 2023-05-25 13:28:48 +05:30
Aman Harwara a89d182612 chore: non-primary button colors 2023-05-25 13:03:18 +05:30
StandardNotes CI 4403fc3515 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-24 19:04:32 +00:00
Aman Harwara 47b0ff42a0 Merge branch 'main' of github.com:standardnotes/app 2023-05-25 00:08:11 +05:30
Aman Harwara d9e0261c80 chore: adjust notes list swipe gesture on android 2023-05-25 00:08:03 +05:30
StandardNotes CI 8c3868a9d4 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-24 17:12:29 +00:00
Aman Harwara 77b60d920d chore: comments 2023-05-24 22:15:50 +05:30
Aman Harwara 22cedc1321 chore: upgrade lexical 2023-05-24 21:43:17 +05:30
Aman Harwara 502289aa50 chore: let system figure slashes for paths 2023-05-24 21:32:07 +05:30
StandardNotes CI 4ef8992d43 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-24 07:30:04 +00:00
Aman Harwara 228889c75c Merge branch 'main' of github.com:standardnotes/app 2023-05-24 12:24:09 +05:30
Aman Harwara 210d747a05 chore: fix backup copy error 2023-05-24 12:24:01 +05:30
StandardNotes CI 0d5833af3c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2023-05-23 16:35:24 +00:00
Aman Harwara 87410f7e34 Merge branch 'main' of github.com:standardnotes/app 2023-05-23 21:29:30 +05:30
Aman Harwara aaa8016792 chore: fix pane gestures breaking items list on android 2023-05-23 21:29:21 +05:30
StandardNotes CI 356a3751de chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].9
2023-05-23 14:14:40 +00:00
Aman Harwara 1d7079e90c fix: Fixed issue where some dialogs would become unresponsive 2023-05-23 19:15:30 +05:30
900 changed files with 29413 additions and 7783 deletions
+1
View File
@@ -17,6 +17,7 @@ on:
- 'packages/sncrypto-web/**'
- 'packages/snjs/**'
- 'packages/utils/**'
workflow_dispatch:
jobs:
test:
+1 -1
View File
@@ -1 +1 @@
16.15.1
18.6.0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1
View File
@@ -26,7 +26,6 @@
"build:snjs": "yarn workspaces foreach -p --topological-dev --verbose -R --from @standardnotes/snjs run build",
"build:services": "yarn workspaces foreach -pt --topological-dev --verbose -R --from @standardnotes/services run build",
"build:api": "yarn workspaces foreach -pt --topological-dev --verbose -R --from @standardnotes/api run build",
"start:server:web": "lerna run start --scope=@standardnotes/web",
"e2e": "lerna run start:test-server --scope=@standardnotes/snjs",
"reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock && yarn install",
"release:prod": "lerna version --conventional-commits --yes -m \"chore(release): publish\"",
+62
View File
@@ -3,6 +3,68 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.25](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-11)
**Note:** Version bump only for package @standardnotes/api
## [1.26.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-11)
**Note:** Version bump only for package @standardnotes/api
## [1.26.23](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-07)
**Note:** Version bump only for package @standardnotes/api
## [1.26.22](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-06)
**Note:** Version bump only for package @standardnotes/api
## [1.26.21](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-05)
**Note:** Version bump only for package @standardnotes/api
## [1.26.20](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-04)
**Note:** Version bump only for package @standardnotes/api
## [1.26.19](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-07-03)
**Note:** Version bump only for package @standardnotes/api
## [1.26.18](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-30)
**Note:** Version bump only for package @standardnotes/api
## [1.26.17](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-29)
**Note:** Version bump only for package @standardnotes/api
## [1.26.16](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-27)
**Note:** Version bump only for package @standardnotes/api
## [1.26.15](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-26)
**Note:** Version bump only for package @standardnotes/api
## [1.26.14](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Bug Fixes
* fixes issue where a renewed session would in some cases would not save to disk, causing a reauthentication prompt to occur ([bb804ff](https://github.com/standardnotes/app/commit/bb804fff45328eef3c66ec3a48dc000c21e37020))
## [1.26.13](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
## [1.26.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
## [1.26.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
## [1.26.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-05-22)
**Note:** Version bump only for package @standardnotes/api
+2 -1
View File
@@ -6,4 +6,5 @@ module.exports = {
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.json' }],
},
};
coverageThreshold: {},
}
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api",
"version": "1.26.10",
"version": "1.26.25",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -36,9 +36,8 @@
"typescript": "*"
},
"dependencies": {
"@standardnotes/common": "^1.46.6",
"@standardnotes/common": "^1.48.3",
"@standardnotes/domain-core": "^1.12.0",
"@standardnotes/encryption": "workspace:*",
"@standardnotes/models": "workspace:*",
"@standardnotes/responses": "workspace:*",
"@standardnotes/security": "^1.7.6",
@@ -1,14 +1,14 @@
import { ErrorMessage } from '../../Error/ErrorMessage'
import { ApiCallError } from '../../Error/ApiCallError'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '../../Request/ApiEndpointParam'
import { SubscriptionServerInterface } from '../../Server/Subscription/SubscriptionServerInterface'
import { AppleIAPConfirmResponseBody } from './../../Response/Subscription/AppleIAPConfirmResponseBody'
import { SubscriptionInviteAcceptResponseBody } from '../../Response/Subscription/SubscriptionInviteAcceptResponseBody'
import { SubscriptionInviteCancelResponseBody } from '../../Response/Subscription/SubscriptionInviteCancelResponseBody'
import { SubscriptionInviteListResponseBody } from '../../Response/Subscription/SubscriptionInviteListResponseBody'
import { SubscriptionInviteResponseBody } from '../../Response/Subscription/SubscriptionInviteResponseBody'
import { HttpResponse } from '@standardnotes/responses'
import { HttpResponse, ApiEndpointParam } from '@standardnotes/responses'
import { SubscriptionApiServiceInterface } from './SubscriptionApiServiceInterface'
import { SubscriptionApiOperations } from './SubscriptionApiOperations'
@@ -2,4 +2,5 @@ export enum UserApiOperations {
Registering,
SubmittingRequest,
DeletingAccount,
UpdatingUser,
}
@@ -5,8 +5,7 @@ import { ErrorMessage } from '../../Error/ErrorMessage'
import { ApiCallError } from '../../Error/ApiCallError'
import { UserServerInterface } from '../../Server/User/UserServerInterface'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '../../Request/ApiEndpointParam'
import { HttpResponse } from '@standardnotes/responses'
import { HttpResponse, ApiEndpointParam } from '@standardnotes/responses'
import { UserDeletionResponseBody } from '../../Response/User/UserDeletionResponseBody'
import { UserRegistrationResponseBody } from '../../Response/User/UserRegistrationResponseBody'
@@ -15,6 +14,7 @@ import { UserRequestServerInterface } from '../../Server/UserRequest/UserRequest
import { UserApiOperations } from './UserApiOperations'
import { UserApiServiceInterface } from './UserApiServiceInterface'
import { UserUpdateResponse } from '../../Response/User/UserUpdateResponse'
export class UserApiService implements UserApiServiceInterface {
private operationsInProgress: Map<UserApiOperations, boolean>
@@ -35,7 +35,7 @@ export class UserApiService implements UserApiServiceInterface {
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericRegistrationFail)
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
@@ -84,6 +84,23 @@ export class UserApiService implements UserApiServiceInterface {
}
}
async updateUser(updateDTO: { userUuid: string }): Promise<HttpResponse<UserUpdateResponse>> {
this.lockOperation(UserApiOperations.UpdatingUser)
try {
const response = await this.userServer.update({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
user_uuid: updateDTO.userUuid,
})
this.unlockOperation(UserApiOperations.UpdatingUser)
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
private lockOperation(operation: UserApiOperations): void {
if (this.operationsInProgress.get(operation)) {
throw new ApiCallError(ErrorMessage.GenericInProgress)
@@ -5,6 +5,7 @@ import { HttpResponse } from '@standardnotes/responses'
import { UserDeletionResponseBody } from '../../Response/User/UserDeletionResponseBody'
import { UserRegistrationResponseBody } from '../../Response/User/UserRegistrationResponseBody'
import { UserRequestResponseBody } from '../../Response/UserRequest/UserRequestResponseBody'
import { UserUpdateResponse } from '../../Response/User/UserUpdateResponse'
export interface UserApiServiceInterface {
register(registerDTO: {
@@ -13,9 +14,12 @@ export interface UserApiServiceInterface {
keyParams: RootKeyParamsInterface
ephemeral: boolean
}): Promise<HttpResponse<UserRegistrationResponseBody>>
updateUser(updateDTO: { userUuid: string }): Promise<HttpResponse<UserUpdateResponse>>
submitUserRequest(dto: {
userUuid: string
requestType: UserRequestType
}): Promise<HttpResponse<UserRequestResponseBody>>
deleteAccount(userUuid: string): Promise<HttpResponse<UserDeletionResponseBody>>
}
@@ -0,0 +1,144 @@
import { Environment } from '@standardnotes/models'
import { HttpVerb } from '@standardnotes/responses'
import { FetchRequestHandler } from './FetchRequestHandler'
import { HttpErrorResponseBody, HttpRequest } from '@standardnotes/responses'
import { ErrorMessage } from '../Error'
describe('FetchRequestHandler', () => {
const snjsVersion = 'snjsVersion'
const appVersion = 'appVersion'
const environment = Environment.Web
const requestHandler = new FetchRequestHandler(snjsVersion, appVersion, environment)
it('should create a request', () => {
const httpRequest: HttpRequest = {
url: 'http://localhost:3000/test',
verb: HttpVerb.Get,
external: false,
authentication: 'authentication',
customHeaders: [],
params: {
key: 'value',
},
}
const request = requestHandler['createRequest'](httpRequest)
expect(request).toBeInstanceOf(Request)
expect(request.url).toBe(httpRequest.url)
expect(request.method).toBe(httpRequest.verb)
expect(request.headers.get('X-SNJS-Version')).toBe(snjsVersion)
expect(request.headers.get('X-Application-Version')).toBe(`${Environment[environment]}-${appVersion}`)
expect(request.headers.get('Content-Type')).toBe('application/json')
})
it('should get url for url and params', () => {
const urlWithoutExistingParams = requestHandler['urlForUrlAndParams']('url', { key: 'value' })
expect(urlWithoutExistingParams).toBe('url?key=value')
const urlWithExistingParams = requestHandler['urlForUrlAndParams']('url?key=value', { key2: 'value2' })
expect(urlWithExistingParams).toBe('url?key=value&key2=value2')
})
it('should create request body if not GET', () => {
const body = requestHandler['createRequestBody']({
url: 'url',
verb: HttpVerb.Post,
external: false,
authentication: 'authentication',
customHeaders: [],
params: {
key: 'value',
},
})
expect(body).toBe('{"key":"value"}')
})
it('should not create request body if GET', () => {
const body = requestHandler['createRequestBody']({
url: 'url',
verb: HttpVerb.Get,
external: false,
authentication: 'authentication',
customHeaders: [],
params: {
key: 'value',
},
})
expect(body).toBeUndefined()
})
it('should handle json response', async () => {
const fetchResponse = new Response('{"key":"value"}', {
status: 200,
headers: {
'Content-Type': 'application/json',
},
})
const response = await requestHandler['handleFetchResponse'](fetchResponse)
expect(response).toEqual({
status: 200,
headers: new Map<string, string | null>([['content-type', 'application/json']]),
data: {
key: 'value',
},
key: 'value',
})
})
it('should handle non-json response', async () => {
const fetchResponse = new Response('body', {
status: 200,
headers: {
'Content-Type': 'text/plain',
},
})
const response = await requestHandler['handleFetchResponse'](fetchResponse)
expect(response.status).toBe(200)
expect(response.headers).toEqual(new Map<string, string | null>([['content-type', 'text/plain']]))
expect(response.data).toBeInstanceOf(ArrayBuffer)
})
it('should have ratelimit error when forbidden', async () => {
const fetchResponse = new Response('body', {
status: 403,
headers: {
'Content-Type': 'text/plain',
},
})
const response = await requestHandler['handleFetchResponse'](fetchResponse)
expect(response.status).toBe(403)
expect(response.headers).toEqual(new Map<string, string | null>([['content-type', 'text/plain']]))
expect((response.data as HttpErrorResponseBody).error).toEqual({
message: ErrorMessage.RateLimited,
})
})
describe('should return ErrorResponse when status is not >=200 and <500', () => {
it('should add unknown error message when response has no data', async () => {
const fetchResponse = new Response('', {
status: 599,
headers: {
'Content-Type': 'text/plain',
},
})
const response = await requestHandler['handleFetchResponse'](fetchResponse)
expect(response.status).toBe(599)
expect(response.headers).toEqual(new Map<string, string | null>([['content-type', 'text/plain']]))
expect((response.data as HttpErrorResponseBody).error).toEqual({
message: 'Unknown error',
})
})
})
})
@@ -0,0 +1,178 @@
import {
HttpErrorResponse,
HttpRequest,
HttpRequestParams,
HttpResponse,
HttpStatusCode,
HttpVerb,
isErrorResponse,
} from '@standardnotes/responses'
import { RequestHandlerInterface } from './RequestHandlerInterface'
import { Environment } from '@standardnotes/models'
import { isString } from 'lodash'
import { ErrorMessage } from '../Error'
export class FetchRequestHandler implements RequestHandlerInterface {
constructor(
protected readonly snjsVersion: string,
protected readonly appVersion: string,
protected readonly environment: Environment,
) {}
async handleRequest<T>(httpRequest: HttpRequest): Promise<HttpResponse<T>> {
const request = this.createRequest(httpRequest)
const response = await this.runRequest<T>(request, this.createRequestBody(httpRequest))
return response
}
private createRequest(httpRequest: HttpRequest): Request {
if (httpRequest.params && httpRequest.verb === HttpVerb.Get && Object.keys(httpRequest.params).length > 0) {
httpRequest.url = this.urlForUrlAndParams(httpRequest.url, httpRequest.params)
}
const headers: Record<string, string> = {}
if (!httpRequest.external) {
headers['X-SNJS-Version'] = this.snjsVersion
const appVersionHeaderValue = `${Environment[this.environment]}-${this.appVersion}`
headers['X-Application-Version'] = appVersionHeaderValue
if (httpRequest.authentication) {
headers['Authorization'] = 'Bearer ' + httpRequest.authentication
}
}
let contentTypeIsSet = false
if (httpRequest.customHeaders && httpRequest.customHeaders.length > 0) {
httpRequest.customHeaders.forEach(({ key, value }) => {
headers[key] = value
if (key === 'Content-Type') {
contentTypeIsSet = true
}
})
}
if (!contentTypeIsSet && !httpRequest.external) {
headers['Content-Type'] = 'application/json'
}
return new Request(httpRequest.url, {
method: httpRequest.verb,
headers,
})
}
private async runRequest<T>(request: Request, body?: string | Uint8Array | undefined): Promise<HttpResponse<T>> {
const fetchResponse = await fetch(request, {
body,
})
const response = await this.handleFetchResponse<T>(fetchResponse)
return response
}
private async handleFetchResponse<T>(fetchResponse: Response): Promise<HttpResponse<T>> {
const httpStatus = fetchResponse.status
const response: HttpResponse<T> = {
status: httpStatus,
headers: new Map<string, string | null>(),
data: {} as T,
}
fetchResponse.headers.forEach((value, key) => {
;(<Map<string, string | null>>response.headers).set(key, value)
})
try {
if (httpStatus !== HttpStatusCode.NoContent) {
let body
const contentTypeHeader = response.headers?.get('content-type') || response.headers?.get('Content-Type')
if (contentTypeHeader?.includes('application/json')) {
body = JSON.parse(await fetchResponse.text())
} else {
body = await fetchResponse.arrayBuffer()
}
/**
* v0 APIs do not have a `data` top-level object. In such cases, mimic
* the newer response body style by putting all the top-level
* properties inside a `data` object.
*/
if (!body.data) {
response.data = body
}
if (!isString(body)) {
Object.assign(response, body)
}
}
} catch (error) {
console.error(error)
}
if (httpStatus >= HttpStatusCode.Success && httpStatus < HttpStatusCode.InternalServerError) {
if (httpStatus === HttpStatusCode.Forbidden && isErrorResponse(response)) {
if (!response.data.error) {
response.data.error = {
message: ErrorMessage.RateLimited,
}
} else {
response.data.error.message = ErrorMessage.RateLimited
}
}
return response
} else {
const errorResponse = response as HttpErrorResponse
if (!errorResponse.data) {
errorResponse.data = {
error: {
message: 'Unknown error',
},
}
}
if (isString(errorResponse.data)) {
errorResponse.data = {
error: {
message: errorResponse.data,
},
}
}
if (!errorResponse.data.error) {
errorResponse.data.error = {
message: 'Unknown error',
}
}
return errorResponse
}
}
private urlForUrlAndParams(url: string, params: HttpRequestParams) {
const keyValueString = Object.keys(params as Record<string, unknown>)
.map((key) => {
return key + '=' + encodeURIComponent((params as Record<string, unknown>)[key] as string)
})
.join('&')
if (url.includes('?')) {
return url + '&' + keyValueString
} else {
return url + '?' + keyValueString
}
}
private createRequestBody(httpRequest: HttpRequest): string | Uint8Array | undefined {
if (
httpRequest.params !== undefined &&
[HttpVerb.Post, HttpVerb.Put, HttpVerb.Patch, HttpVerb.Delete].includes(httpRequest.verb)
) {
return JSON.stringify(httpRequest.params)
}
return httpRequest.rawBytes
}
}
+36 -169
View File
@@ -1,4 +1,4 @@
import { isString, joinPaths, sleep } from '@standardnotes/utils'
import { joinPaths, sleep } from '@standardnotes/utils'
import { Environment } from '@standardnotes/models'
import { Session, SessionToken } from '@standardnotes/domain-core'
import {
@@ -8,15 +8,14 @@ import {
HttpRequest,
HttpResponse,
HttpResponseMeta,
HttpErrorResponse,
isErrorResponse,
} from '@standardnotes/responses'
import { HttpServiceInterface } from './HttpServiceInterface'
import { XMLHttpRequestState } from './XMLHttpRequestState'
import { ErrorMessage } from '../Error/ErrorMessage'
import { Paths } from '../Server/Auth/Paths'
import { SessionRefreshResponseBody } from '../Response/Auth/SessionRefreshResponseBody'
import { FetchRequestHandler } from './FetchRequestHandler'
import { RequestHandlerInterface } from './RequestHandlerInterface'
export class HttpService implements HttpServiceInterface {
private session: Session | null
@@ -27,8 +26,11 @@ export class HttpService implements HttpServiceInterface {
private updateMetaCallback!: (meta: HttpResponseMeta) => void
private refreshSessionCallback!: (session: Session) => void
private requestHandler: RequestHandlerInterface
constructor(private environment: Environment, private appVersion: string, private snjsVersion: string) {
this.session = null
this.requestHandler = new FetchRequestHandler(this.snjsVersion, this.appVersion, this.environment)
}
setCallbacks(
@@ -53,7 +55,15 @@ export class HttpService implements HttpServiceInterface {
this.host = host
}
getHost(): string {
return this.host
}
async get<T>(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>> {
if (!this.host) {
throw new Error('Attempting to make network request before host is set')
}
return this.runHttp({
url: joinPaths(this.host, path),
params,
@@ -62,7 +72,20 @@ export class HttpService implements HttpServiceInterface {
})
}
async getExternal<T>(url: string, params?: HttpRequestParams): Promise<HttpResponse<T>> {
return this.runHttp({
url,
params,
verb: HttpVerb.Get,
external: true,
})
}
async post<T>(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>> {
if (!this.host) {
throw new Error('Attempting to make network request before host is set')
}
return this.runHttp({
url: joinPaths(this.host, path),
params,
@@ -99,25 +122,24 @@ export class HttpService implements HttpServiceInterface {
}
async runHttp<T>(httpRequest: HttpRequest): Promise<HttpResponse<T>> {
if (this.inProgressRefreshSessionPromise) {
if (this.__latencySimulatorMs) {
await sleep(this.__latencySimulatorMs, true)
}
const isRefreshRequest = httpRequest.url === joinPaths(this.host, Paths.v1.refreshSession)
if (this.inProgressRefreshSessionPromise && !isRefreshRequest) {
await this.inProgressRefreshSessionPromise
httpRequest.authentication = this.session?.accessToken.value
}
const request = this.createXmlRequest(httpRequest)
const response = await this.requestHandler.handleRequest<T>(httpRequest)
if (this.__latencySimulatorMs) {
await sleep(this.__latencySimulatorMs, true)
}
const response = await this.runRequest<T>(request, this.createRequestBody(httpRequest))
if (response.meta) {
if (response.meta && !httpRequest.external) {
this.updateMetaCallback?.(response.meta)
}
if (response.status === HttpStatusCode.ExpiredAccessToken) {
if (response.status === HttpStatusCode.ExpiredAccessToken && !isRefreshRequest && !httpRequest.external) {
if (this.inProgressRefreshSessionPromise) {
await this.inProgressRefreshSessionPromise
} else {
@@ -187,159 +209,4 @@ export class HttpService implements HttpServiceInterface {
return true
}
private createRequestBody(httpRequest: HttpRequest): string | Uint8Array | undefined {
if (
httpRequest.params !== undefined &&
[HttpVerb.Post, HttpVerb.Put, HttpVerb.Patch, HttpVerb.Delete].includes(httpRequest.verb)
) {
return JSON.stringify(httpRequest.params)
}
return httpRequest.rawBytes
}
private createXmlRequest(httpRequest: HttpRequest) {
const request = new XMLHttpRequest()
if (httpRequest.params && httpRequest.verb === HttpVerb.Get && Object.keys(httpRequest.params).length > 0) {
httpRequest.url = this.urlForUrlAndParams(httpRequest.url, httpRequest.params)
}
request.open(httpRequest.verb, httpRequest.url, true)
request.responseType = httpRequest.responseType ?? ''
if (!httpRequest.external) {
request.setRequestHeader('X-SNJS-Version', this.snjsVersion)
const appVersionHeaderValue = `${Environment[this.environment]}-${this.appVersion}`
request.setRequestHeader('X-Application-Version', appVersionHeaderValue)
if (httpRequest.authentication) {
request.setRequestHeader('Authorization', 'Bearer ' + httpRequest.authentication)
}
}
let contenTypeIsSet = false
if (httpRequest.customHeaders && httpRequest.customHeaders.length > 0) {
httpRequest.customHeaders.forEach(({ key, value }) => {
request.setRequestHeader(key, value)
if (key === 'Content-Type') {
contenTypeIsSet = true
}
})
}
if (!contenTypeIsSet && !httpRequest.external) {
request.setRequestHeader('Content-Type', 'application/json')
}
return request
}
private async runRequest<T>(request: XMLHttpRequest, body?: string | Uint8Array): Promise<HttpResponse<T>> {
return new Promise((resolve) => {
request.onreadystatechange = () => {
this.stateChangeHandlerForRequest(request, resolve)
}
request.send(body)
})
}
private stateChangeHandlerForRequest<T>(request: XMLHttpRequest, resolve: (response: HttpResponse<T>) => void) {
if (request.readyState !== XMLHttpRequestState.Completed) {
return
}
const httpStatus = request.status
const response: HttpResponse<T> = {
status: httpStatus,
headers: new Map<string, string | null>(),
data: {} as T,
}
const responseHeaderLines = request
.getAllResponseHeaders()
?.trim()
.split(/[\r\n]+/)
responseHeaderLines?.forEach((responseHeaderLine) => {
const parts = responseHeaderLine.split(': ')
const name = parts.shift() as string
const value = parts.join(': ')
;(<Map<string, string | null>>response.headers).set(name, value)
})
try {
if (httpStatus !== HttpStatusCode.NoContent) {
let body
const contentTypeHeader = response.headers?.get('content-type') || response.headers?.get('Content-Type')
if (contentTypeHeader?.includes('application/json')) {
body = JSON.parse(request.responseText)
} else {
body = request.response
}
/**
* v0 APIs do not have a `data` top-level object. In such cases, mimic
* the newer response body style by putting all the top-level
* properties inside a `data` object.
*/
if (!body.data) {
response.data = body
}
if (!isString(body)) {
Object.assign(response, body)
}
}
} catch (error) {
console.error(error)
}
if (httpStatus >= HttpStatusCode.Success && httpStatus < HttpStatusCode.InternalServerError) {
if (
httpStatus === HttpStatusCode.Forbidden &&
response.data &&
(response as HttpErrorResponse).data.error !== undefined
) {
;(response as HttpErrorResponse).data.error.message = ErrorMessage.RateLimited
}
resolve(response)
} else {
const errorResponse = response as HttpErrorResponse
if (!errorResponse.data) {
errorResponse.data = {
error: {
message: 'Unknown error',
},
}
}
if (isString(errorResponse.data)) {
errorResponse.data = {
error: {
message: errorResponse.data,
},
}
}
if (!errorResponse.data.error) {
errorResponse.data.error = {
message: 'Unknown error',
}
}
resolve(errorResponse)
}
}
private urlForUrlAndParams(url: string, params: HttpRequestParams) {
const keyValueString = Object.keys(params as Record<string, unknown>)
.map((key) => {
return key + '=' + encodeURIComponent((params as Record<string, unknown>)[key] as string)
})
.join('&')
if (url.includes('?')) {
return url + '&' + keyValueString
} else {
return url + '?' + keyValueString
}
}
}
@@ -3,8 +3,10 @@ import { HttpRequest, HttpRequestParams, HttpResponse, HttpResponseMeta } from '
export interface HttpServiceInterface {
setHost(host: string): void
getHost(): string
setSession(session: Session): void
get<T>(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>>
getExternal<T>(url: string, params?: HttpRequestParams): Promise<HttpResponse<T>>
post<T>(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>>
put<T>(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>>
patch<T>(path: string, params: HttpRequestParams, authentication?: string): Promise<HttpResponse<T>>
@@ -0,0 +1,5 @@
import { HttpRequest, HttpResponse } from '@standardnotes/responses'
export interface RequestHandlerInterface {
handleRequest<T>(httpRequest: HttpRequest): Promise<HttpResponse<T>>
}
@@ -1,7 +0,0 @@
export enum ApiEndpointParam {
LastSyncToken = 'sync_token',
PaginationToken = 'cursor_token',
SyncDlLimit = 'limit',
SyncPayloads = 'items',
ApiVersion = 'api',
}
@@ -0,0 +1,5 @@
export type CreateAsymmetricMessageParams = {
recipientUuid: string
encryptedMessage: string
replaceabilityIdentifier?: string
}
@@ -0,0 +1,3 @@
export type DeleteAsymmetricMessageRequestParams = {
messageUuid: string
}
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/ban-types
export type GetOutboundAsymmetricMessagesRequestParams = {}
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/ban-types
export type GetUserAsymmetricMessagesRequestParams = {}
@@ -0,0 +1,4 @@
export type UpdateAsymmetricMessageParams = {
messageUuid: string
encryptedMessage: string
}
@@ -0,0 +1,12 @@
import { ValetTokenOperation } from '@standardnotes/responses'
import { SharedVaultMoveType } from './SharedVaultMoveType'
export type CreateSharedVaultValetTokenParams = {
sharedVaultUuid: string
fileUuid?: string
remoteIdentifier: string
operation: ValetTokenOperation
unencryptedFileSize?: number
moveOperationType?: SharedVaultMoveType
sharedVaultToSharedVaultMoveTargetUuid?: string
}
@@ -0,0 +1 @@
export type SharedVaultMoveType = 'shared-vault-to-user' | 'user-to-shared-vault' | 'shared-vault-to-shared-vault'
@@ -0,0 +1,4 @@
export type AcceptInviteRequestParams = {
sharedVaultUuid: string
inviteUuid: string
}
@@ -0,0 +1,8 @@
import { SharedVaultPermission } from '@standardnotes/responses'
export type CreateSharedVaultInviteParams = {
sharedVaultUuid: string
recipientUuid: string
encryptedMessage: string
permissions: SharedVaultPermission
}
@@ -0,0 +1,4 @@
export type DeclineInviteRequestParams = {
sharedVaultUuid: string
inviteUuid: string
}
@@ -0,0 +1,3 @@
export type DeleteAllSharedVaultInvitesRequestParams = {
sharedVaultUuid: string
}
@@ -0,0 +1,4 @@
export type DeleteInviteRequestParams = {
sharedVaultUuid: string
inviteUuid: string
}
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/ban-types
export type GetOutboundUserInvitesRequestParams = {}
@@ -0,0 +1,3 @@
export type GetSharedVaultInvitesRequestParams = {
sharedVaultUuid: string
}
@@ -0,0 +1,2 @@
// eslint-disable-next-line @typescript-eslint/ban-types
export type GetUserInvitesRequestParams = {}
@@ -0,0 +1,8 @@
import { SharedVaultPermission } from '@standardnotes/responses'
export type UpdateSharedVaultInviteParams = {
sharedVaultUuid: string
inviteUuid: string
encryptedMessage: string
permissions?: SharedVaultPermission
}
@@ -0,0 +1,4 @@
export type DeleteSharedVaultUserRequestParams = {
sharedVaultUuid: string
userUuid: string
}
@@ -0,0 +1,3 @@
export type GetSharedVaultUsersRequestParams = {
sharedVaultUuid: string
}
@@ -1,8 +1,7 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '@standardnotes/responses'
export type SubscriptionInviteCancelRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[ApiEndpointParam.ApiVersion]: string
inviteUuid: string
[additionalParam: string]: unknown
}
@@ -1,8 +1,7 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '@standardnotes/responses'
export type SubscriptionInviteDeclineRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[ApiEndpointParam.ApiVersion]: string
inviteUuid: string
[additionalParam: string]: unknown
}
@@ -1,7 +1,6 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '@standardnotes/responses'
export type SubscriptionInviteListRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[ApiEndpointParam.ApiVersion]: string
[additionalParam: string]: unknown
}
@@ -1,8 +1,7 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '@standardnotes/responses'
export type SubscriptionInviteRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[ApiEndpointParam.ApiVersion]: string
identifier: string
[additionalParam: string]: unknown
}
@@ -1,13 +1,10 @@
import { AnyKeyParamsContent } from '@standardnotes/common'
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
import { ApiEndpointParam } from '@standardnotes/responses'
export type UserRegistrationRequestParams = AnyKeyParamsContent & {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[ApiEndpointParam.ApiVersion]: string
[additionalParam: string]: unknown
password: string
email: string
ephemeral: boolean
[additionalParam: string]: unknown
pkcPublicKey?: string
pkcEncryptedPrivateKey?: string
}
@@ -0,0 +1,6 @@
import { ApiEndpointParam } from '@standardnotes/responses'
export type UserUpdateRequestParams = {
[ApiEndpointParam.ApiVersion]: string
user_uuid: string
}
+3 -1
View File
@@ -1,4 +1,3 @@
export * from './ApiEndpointParam'
export * from './Authenticator/DeleteAuthenticatorRequestParams'
export * from './Authenticator/GenerateAuthenticatorAuthenticationOptionsRequestParams'
export * from './Authenticator/ListAuthenticatorsRequestParams'
@@ -14,6 +13,9 @@ export * from './Subscription/SubscriptionInviteCancelRequestParams'
export * from './Subscription/SubscriptionInviteDeclineRequestParams'
export * from './Subscription/SubscriptionInviteListRequestParams'
export * from './Subscription/SubscriptionInviteRequestParams'
export * from './User/UserDeletionRequestParams'
export * from './User/UserRegistrationRequestParams'
export * from './User/UserUpdateRequestParams'
export * from './UserRequest/UserRequestRequestParams'
export * from './WebSocket/WebSocketConnectionTokenRequestParams'
export * from './SharedVault/SharedVaultMoveType'
@@ -0,0 +1,5 @@
import { AsymmetricMessageServerHash } from '@standardnotes/responses'
export type CreateAsymmetricMessageResponse = {
message: AsymmetricMessageServerHash
}
@@ -0,0 +1,3 @@
export type DeleteAsymmetricMessageResponse = {
success: boolean
}
@@ -0,0 +1,5 @@
import { AsymmetricMessageServerHash } from '@standardnotes/responses'
export type GetOutboundAsymmetricMessagesResponse = {
messages: AsymmetricMessageServerHash[]
}
@@ -0,0 +1,5 @@
import { AsymmetricMessageServerHash } from '@standardnotes/responses'
export type GetUserAsymmetricMessagesResponse = {
messages: AsymmetricMessageServerHash[]
}

Some files were not shown because too many files have changed in this diff Show More