Compare commits

...
Author SHA1 Message Date
StandardNotes CI 4cf9ebf52a chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-24 19:32:22 +00:00
Aman Harwara a3611c802f fix: move prefs button next to account menu button in footer (#1639) 2022-09-25 00:33:30 +05:30
StandardNotes CI 9be315730d chore(release): publish
- @standardnotes/[email protected].7
 - @standardnotes/[email protected]
2022-09-24 17:28:41 +00:00
Mo 789a78bda3 fix(mobile): accurate version number 2022-09-24 11:58:29 -05:00
StandardNotes CI 73e170dedd chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-24 16:32:37 +00:00
Aman Harwara e4b1b64119 fix: responsiveness when resizing window on web/desktop (#1637) 2022-09-24 21:24:10 +05:30
StandardNotes CI c2a1918843 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-24 11:03:09 +00:00
Aman Harwara d3621d70b1 feat: new note title format w/ prefs (#1629) 2022-09-24 16:04:31 +05:30
StandardNotes CI bf286f4854 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-24 09:32:43 +00:00
Aman Harwara 97835e64ac feat: flatten quick settings menu and add separate prefs button (#1631) 2022-09-24 14:26:55 +05:30
StandardNotes CI 285df04a59 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-23 19:29:51 +00:00
Mo 4d5429cc89 fix(mobile): adjust status bar color to match current theme (#1624)
* feat: sync page theme color metadata with active theme bg

* fix: lint

* refactor: extract to method

* feat: recieve theme scheme change on mobile

* fix: handle issue where status bar color changes when keyboard appears on iOS

* fix: disable bouncing on web view
2022-09-23 13:48:51 -05:00
StandardNotes CI da6622dc95 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-23 18:23:20 +00:00
Aman Harwara a548883863 fix: prefs view on desktop (#1628) 2022-09-23 23:22:01 +05:30
StandardNotes CI 1330201d2e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-23 17:16:32 +00:00
Aman Harwara 0af720146c feat: add prefs button to navigation panel on mobile (#1625) 2022-09-23 22:17:50 +05:30
StandardNotes CI 4d6992cf83 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
2022-09-23 15:54:05 +00:00
Aman Harwara 5de6f459c1 feat: sync page theme color metadata with active theme bg (#1623) 2022-09-23 20:53:00 +05:30
Mo 3c0d4fac76 fix: biometrics timing loading (#1622) 2022-09-23 09:59:16 -05:00
StandardNotes CI 4cdfcbfd95 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
2022-09-23 11:16:50 +00:00
Aman Harwara 51e50433d3 fix: protected overlay on mobile (#1621) 2022-09-23 16:16:04 +05:30
StandardNotes CI 696327ff03 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
2022-09-23 08:47:03 +00:00
Karol Sójko de64f1bfce fix(web): move email notification preferences to account pane (#1620) 2022-09-23 10:17:21 +02:00
StandardNotes CI 48d484675b chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-22 20:08:00 +00:00
Aman Harwara 86251b49d3 fix: better safe area padding on iOS (#1618) 2022-09-23 01:03:36 +05:30
StandardNotes CI 5961bc491d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
2022-09-22 18:54:43 +00:00
Karol Sójko e50f4eb92e Revert "Revert "feat(web): move emails notifications to one pane and enable opening settings via url (#1614)" (#1617)" (#1619)
This reverts commit 6824dd2d5f.
2022-09-22 20:18:19 +02:00
StandardNotes CI 4f8e75f36a chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
2022-09-22 17:21:08 +00:00
Karol Sójko 6824dd2d5f Revert "feat(web): move emails notifications to one pane and enable opening settings via url (#1614)" (#1617)
This reverts commit 1fe833bc24.
2022-09-22 18:50:41 +02:00
Mo 76ec8b0f90 refactor: new mobile experience opt in flow (#1616)
* refactor: new mobile experience opt in flow

* chore: lint
2022-09-22 11:20:26 -05:00
StandardNotes CI 3eebdbb77d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-22 15:22:42 +00:00
Aman Harwara ce252def33 feat: show selected editor icon in change editor button (#1615) 2022-09-22 20:22:49 +05:30
StandardNotes CI cb7af03ce8 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
2022-09-22 11:16:54 +00:00
Karol Sójko 1fe833bc24 feat(web): move emails notifications to one pane and enable opening settings via url (#1614)
* feat(web): move emails notifications to one pane and enable opening settings via url

* fix(web): rename notifications to email

* fix(snjs): add mute marketing emails to settings list options

* fix(web): linter issues
2022-09-22 12:40:08 +02:00
StandardNotes CI ac1f59cde7 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-22 08:08:31 +00:00
Aman Harwara db4ceca10e fix: manage subscription button on mobile webview (#1613) 2022-09-22 13:10:15 +05:30
StandardNotes CI 0176f47fe7 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-22 03:20:23 +00:00
Aman Harwara f281041221 feat: on mobile goto content tab after selecting revision (#1611) 2022-09-22 08:15:08 +05:30
StandardNotes CI ebd56cd5aa chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-21 19:32:23 +00:00
Aman Harwara 8fa566336c fix: iOS safe area using CSS (#1610) 2022-09-22 00:22:11 +05:30
Aman Harwara 9dfeac7489 fix: disable focus mode and dynamic panel switches on mobile (#1607) 2022-09-21 22:09:02 +05:30
Aman Harwara d1b71861ec feat: add lock button to navigation panel on mobile (#1609) 2022-09-21 21:40:32 +05:30
StandardNotes CI 766548f12d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
2022-09-21 15:42:20 +00:00
Aman Harwara 581a08cd09 fix: tag input auto-submitting when pressing space (#1608) 2022-09-21 20:39:29 +05:30
Aman Harwara ee0d44405d fix: revert webview alert changes (#1606) 2022-09-21 20:18:56 +05:30
Aman Harwara 1ae64dcac4 fix: iOS webview window size and padding (#1605) 2022-09-21 19:58:46 +05:30
StandardNotes CI 2be4fb4f83 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].5
2022-09-21 13:19:58 +00:00
Mo 271a8d1d70 fix(web): subscription sharing copy 2022-09-21 07:50:17 -05:00
Karol Sójko e809328fa8 feat(snjs): add retrieving web sockets token for establishing connection (#1602)
* feat(snjs): add retrieving web sockets token for establishing connection

* fix(snjs): imports

* fix(snjs): use only web sockets connection token

* fix(snjs): linter issue
2022-09-21 14:39:43 +02:00
StandardNotes CI 784cefa26f chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
2022-09-20 17:45:27 +00:00
Mo c5e225d335 fix: move wrapped storage to unwrapped if not encrypted (#1603) 2022-09-20 12:18:00 -05:00
StandardNotes CI cb4c0f1b5c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-20 14:32:24 +00:00
Aman Harwara 91d9364e95 fix: close menu & toggle notes list when note action occurs (#1601) 2022-09-20 19:33:14 +05:30
StandardNotes CI 023d1665b6 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-20 11:59:06 +00:00
Karol Sójko 4a773fa537 feat(api): add websocket api definitions 2022-09-20 13:21:02 +02:00
Aman Harwara dd5ca0c28c fix: window size on mobile (#1600) 2022-09-20 16:48:03 +05:30
StandardNotes CI 9aa7bc018e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-20 10:37:17 +00:00
Aman Harwara 571919c969 fix: default to notes list on launch on mobile (#1599) 2022-09-20 15:28:45 +05:30
StandardNotes CI 66a25c7556 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-19 20:47:02 +00:00
Aman Harwara e3be17c7f8 fix: show warning on mobile webview before app quits (#1598) 2022-09-20 01:48:40 +05:30
Mo c4d7761496 feat: mobile web bridge (#1597) 2022-09-19 14:47:15 -05:00
StandardNotes CI f80cc5b822 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-19 15:02:19 +00:00
Aman Harwara ecaa2a629f fix: preferences dropdown contrast and color (#1591) 2022-09-19 20:03:23 +05:30
StandardNotes CI 46f3e873a5 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
2022-09-19 13:17:25 +00:00
Karol Sójko 038320b2fd fix(snjs): pass unencrypted file size to comply with file service interface (#1595) 2022-09-19 14:36:53 +02:00
StandardNotes CI ee4a1acb9c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-18 12:37:48 +00:00
Aman Harwara efe0c38462 fix: move save status next to note actions on mobile (#1590) 2022-09-18 17:37:30 +05:30
StandardNotes CI 4336c9ed66 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-16 21:52:59 +00:00
Aman Harwara 85c90e07fc feat: add settings to fully switch between native/webview (#1587) 2022-09-17 02:52:38 +05:30
StandardNotes CI 146b3329e0 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-16 18:15:47 +00:00
Mo 0c3c98d7af refactor(mobile): default to web frame if isDev (#1586)
* refactor(mobile): default to web frame if isDev

* fix: ignore native challenges

* fix: use contentInset for padding
2022-09-16 12:44:06 -05:00
StandardNotes CI 5a8752b95a chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-16 13:35:11 +00:00
Aman Harwara 7807fa34f3 fix: long titles on non-mobile view (#1575) 2022-09-16 18:35:43 +05:30
StandardNotes CI ddf4c97477 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-15 18:43:48 +00:00
Aman Harwara 3a15142940 fix: biometrics input on mobile webview challenge modal (#1572) 2022-09-15 23:41:03 +05:30
StandardNotes CI 79518b6a5d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
2022-09-15 10:28:11 +00:00
Karol SójkoandAman Harwara 2d0ee10226 feat: sharing subscriptions UI (#1567)
* feat(web): add ui for subscription sharing

* fix(web): add missing triggers

* fix(snjs): setting authorization token on http service

* fix(web): add alert upon invite failure

* fix(web): display invitations list

* fix(web): canceling subscription invitations

* fix(web): fonts

* fix(web): linter issues

* fix: click event handler

* fix: styles

* feat: update styles

* feat: don't show bottom separator if all invites used

* fix(web): references to alert service

* fix(web): remove usebeforeunload

Co-authored-by: Aman Harwara <[email protected]>
2022-09-15 12:00:29 +02:00
StandardNotes CI 05068ef63a chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-15 09:30:06 +00:00
Karol Sójko 174b3845d1 fix(models): make @standardnotes/models publishable as it is required on the server side 2022-09-15 10:59:53 +02:00
StandardNotes CI a9ef41fdc1 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-14 15:17:51 +00:00
Aman Harwara 110c5ff47f fix: move mobile nav button next to note/file title (#1568) 2022-09-14 20:14:21 +05:30
StandardNotes CI f3738358c9 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2022-09-14 13:51:47 +00:00
Vardan Hakobyan b4bdbfe96a fix: display QR codes with correctly colored border so that scanner apps successfully recognize them (#1566) 2022-09-14 16:48:45 +04:00
StandardNotes CI 912c9ce707 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-14 09:36:52 +00:00
Vardan HakobyanandAman Harwara d7aca2c13a feat: mobile security prefs (#1496)
* feat: move mobile-specific security items to Web when rendered in WebView

* feat: better UI for biometrics section

* feat: move Multitasking Privacy section to WebView (mostly UI)

* feat: move Multitasking Privacy section to WebView (going to understand why in WebView multitasking privacy value is auto-changed after reopening the WebView)

* feat: store MultitaskingPrivacy value as "NonWrapped" so that it's the same both on mobile and WebView

* feat: open WebView correctly when "Storage Encryption" is disabled on mobile

* fix: remove unnecessary changes and comments

* chore: revert ios-related unneeded changes

* fix: let Android to correctly recognize the NativeMobileWeb environment when opening WebView on Android

* fix: correct styles for the selected state of Biometrics/Passcode options

* chore: code cleanup

* fix: store Multitasking/Screenshot Privacy in the `Default` storage value mode

* chore: remove comment

* fix: use application's method instead of directly updating Screenshot Privacy preference

* fix: remove unused variable

* fix: use methods from Application and MobileDeviceInterface in all places, remove duplicate code

* fix: hide Multitasking Privacy and Biometrics Lock in WebView

Co-authored-by: Aman Harwara
2022-09-14 13:07:10 +04:00
StandardNotes CI e73d187b65 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
2022-09-13 21:42:41 +00:00
Aman Harwara 896bb22f64 chore: update dependencies (#1543) 2022-09-14 02:42:25 +05:30
StandardNotes CI e7839cb141 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-13 17:00:59 +00:00
Aman Harwara 930bc2d8f7 chore(desktop): update dependencies (#1542) 2022-09-13 21:55:33 +05:30
StandardNotes CI 39fdac270e chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
2022-09-13 13:11:32 +00:00
Karol Sójko 66d364ff36 feat(features): add subscription sharing 2022-09-13 14:32:22 +02:00
StandardNotes CI 27b7f4e597 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
2022-09-13 08:58:14 +00:00
StandardNotes CI 8d04c2fb55 chore(release): components 2022-09-13 08:57:59 +00:00
Karol Sójko 55b1409a80 feat: add subscription manager to handle subscription sharing (#1517)
* feat: add subscription manager to handle subscription sharing

* fix(services): add missing methods to the interface

* fix(services): add subscription manager specs

* feat(snjs): add subscriptions e2e tests

* fix(snjs): add wait in subscription cancelling test

* fix(snjs): checking for canceled invitations in tests

* fix(snjs): add e2e test for restored limit of subscription invitations

* chore(lint): fix linter issues
2022-09-13 10:28:11 +02:00
StandardNotes CI 2b830c0fae chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2022-09-12 16:52:03 +00:00
Aman Harwara 39d0ee9181 feat: update mobile design (#1526) 2022-09-12 21:48:47 +05:30
StandardNotes CI 9fa093280d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-12 09:41:53 +00:00
Vardan Hakobyan 73ef93c1db fix: ability to open a new tab on iOS Safari (#1516)
* fix: ability to open a new tab on iOS Safari

* chore: fix `https deprecation` warning

* chore: better variable naming
2022-09-12 13:11:48 +04:00
StandardNotes CI 5d39934e47 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-09 08:32:54 +00:00
Aman Harwara 320fc3fd96 feat(mobile): add setting to always open web view on launch (#1500) 2022-09-09 13:32:23 +05:30
StandardNotes CI e2715709d4 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-09 07:19:45 +00:00
Aman Harwara 1efc352da5 fix: note/file list item longpress on iOS (#1506) 2022-09-09 12:16:15 +05:30
StandardNotes CI 1f27f0f790 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-08 20:13:43 +00:00
Vardan Hakobyan 461ebc2768 fix: let Android to correctly recognize the NativeMobileWeb environment when opening WebView on Android (#1503) 2022-09-09 01:15:32 +05:30
StandardNotes CI 1d93210f81 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-08 16:30:09 +00:00
Aman Harwara 91d5980a7e fix(web): autolock option style when selected (#1501) 2022-09-08 21:29:50 +05:30
StandardNotes CI 8ea069cf5c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-08 14:12:55 +00:00
Aman Harwara 9267e580b5 fix: note panel resizing (#1497) 2022-09-08 18:26:47 +05:30
StandardNotes CI 17131f7d67 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-07 13:06:48 +00:00
Aman Harwara ecd870cdaa fix: file preview & selected items panel size on mobile (#1492) 2022-09-07 18:02:37 +05:30
Aman Harwara 4617afe14e fix: footer and prefs dropdown cutoff by screen on some phones (#1491) 2022-09-07 17:36:49 +05:30
StandardNotes CI f21269fc69 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-07 07:11:27 +00:00
StandardNotes CI 3afbce385b chore(release): components 2022-09-07 07:11:13 +00:00
Aman Harwara 0e86b13a8f fix: add min-height to task textarea (#1490) 2022-09-07 12:09:53 +05:30
StandardNotes CI 9719c6fcac chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2022-09-01 09:10:28 +00:00
Karol Sójko 8792771d27 fix(encryption): make package public for resolution on @standardnotes/api package 2022-09-01 10:42:18 +02:00
StandardNotes CI aa7a22c6ac chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
2022-08-31 18:13:02 +00:00
Karol Sójko 91f5694a02 feat(api): add client methods for listing and canceling subscription invites (#1471)
* feat(api): add subscription server and client services and interfaces

* feat(api): add subscriptions invitation operations on server side

* fix(api): linter issues

* feat(api): add client methods for listing and canceling subscription invites

* fix(api): imports
2022-08-31 19:43:43 +02:00
StandardNotes CI 19a95dc404 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].9
2022-08-31 14:44:34 +00:00
Karol Sójko 089d3a2e66 feat(api): add subscription server and client services and interfaces (#1470)
* feat(api): add subscription server and client services and interfaces

* fix(api): linter issues

* feat(models): add subscription invitations

* feat(api): add subscriptions invitation operations on server side

* fix(api): linter issues
2022-08-31 16:08:52 +02:00
StandardNotes CI 370ce39eba chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].8
2022-08-29 15:01:54 +00:00
Aman Harwara 876c0e83ca fix: tag autocomplete result not clickable on iOS (#1455) 2022-08-29 20:00:42 +05:30
StandardNotes CI a203faf02d chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
2022-08-25 10:00:51 +00:00
Aman Harwara 520b3add0f fix: editor content being hidden under keyboard on mobile (#1410) 2022-08-25 15:01:44 +05:30
StandardNotes CI c336f9de18 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].6
2022-08-24 11:15:08 +00:00
Karol Sójko 2c69a514a8 fix(snjs): showing archived notes on trashed smart view (#1426) 2022-08-24 12:45:13 +02:00
StandardNotes CI 26fe530deb chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
2022-08-23 12:11:25 +00:00
StandardNotes CI 58f9789142 chore(release): components 2022-08-23 12:11:11 +00:00
Karol Sójko d2cebf930a chore(setup): fix running unit tests in all packages 2022-08-23 13:40:21 +02:00
Karol Sójko 7bff3dee24 fix(services): counting trashed and archived items 2022-08-23 13:20:34 +02:00
StandardNotes CI a2b6ec74b0 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @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].4
2022-08-23 10:05:48 +00:00
Karol Sójko 2bdd931f6d fix(web): archived and deleted counts on encryption panel (#1423)
* fix(web): archived and deleted counts on encryption panel

* fix(snjs): yarn build snjs before e2e test suite docker builds
2022-08-23 11:38:43 +02:00
372 changed files with 6868 additions and 1424 deletions
+18 -1
View File
@@ -1,2 +1,19 @@
node_modules
scripts
scripts
actions
.yarn
.vscode
.sass-cache
.husky
.github
.git
**/dist
**/coverage
**/node_modules
packages/components
packages/docs
packages/mobile/android
packages/mobile/ios
packages/mobile/html
packages/snjs/mocha
*.d.ts
+1 -1
View File
@@ -1,4 +1,4 @@
{
"extends": ["./node_modules/@standardnotes/config/src/.eslintrc"],
"ignorePatterns": [".eslintrc.js", "*.webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__"]
"ignorePatterns": [".eslintrc.js", "*.webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__", "**/**/coverage"]
}
+2
View File
@@ -26,6 +26,8 @@ jobs:
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build:snjs
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
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.
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
@@ -29,6 +29,7 @@
"build:mobile": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/mobile --exclude @standardnotes/components-meta run build",
"build:snjs": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/snjs --exclude @standardnotes/components-meta run build",
"build:services": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/services --exclude @standardnotes/components-meta run build",
"build:api": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/api --exclude @standardnotes/components-meta run build",
"start:server:web": "lerna run start --scope=@standardnotes/web",
"start:server:e2e": "lerna run start:test-server --scope=@standardnotes/snjs",
"prepare": "husky install",
+1
View File
@@ -1,2 +1,3 @@
node_modules
dist
coverage
+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.8.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-24)
**Note:** Version bump only for package @standardnotes/api
## [1.8.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-23)
**Note:** Version bump only for package @standardnotes/api
## [1.8.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-20)
### Bug Fixes
* move wrapped storage to unwrapped if not encrypted ([#1603](https://github.com/standardnotes/app/issues/1603)) ([c5e225d](https://github.com/standardnotes/app/commit/c5e225d335537257f44168b8ad05222afccb508a))
# [1.8.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-20)
### Features
* **api:** add websocket api definitions ([4a773fa](https://github.com/standardnotes/app/commit/4a773fa53796e17ce5df325ed7d40ba2cb686476))
## [1.7.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-15)
**Note:** Version bump only for package @standardnotes/api
## [1.7.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-13)
**Note:** Version bump only for package @standardnotes/api
# [1.7.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-13)
### Features
* add subscription manager to handle subscription sharing ([#1517](https://github.com/standardnotes/app/issues/1517)) ([55b1409](https://github.com/standardnotes/app/commit/55b1409a805c21ada70bf482a02cfe718a4c6576))
## [1.6.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-09)
**Note:** Version bump only for package @standardnotes/api
## [1.6.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-09-01)
**Note:** Version bump only for package @standardnotes/api
# [1.6.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-08-31)
### Features
* **api:** add client methods for listing and canceling subscription invites ([#1471](https://github.com/standardnotes/app/issues/1471)) ([91f5694](https://github.com/standardnotes/app/commit/91f5694a025a26e9b7878fc4c78a22c7f2f1dcef))
# [1.5.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-08-31)
### Features
* **api:** add subscription server and client services and interfaces ([#1470](https://github.com/standardnotes/app/issues/1470)) ([089d3a2](https://github.com/standardnotes/app/commit/089d3a2e669f5a24bb4a38fc7582b423980d2d22))
## [1.4.9](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-08-23)
**Note:** Version bump only for package @standardnotes/api
## [1.4.8](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-08-23)
**Note:** Version bump only for package @standardnotes/api
## [1.4.7](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2022-08-05)
**Note:** Version bump only for package @standardnotes/api
+4 -4
View File
@@ -10,10 +10,10 @@ module.exports = {
},
coverageThreshold: {
global: {
branches: 17,
functions: 43,
lines: 46,
statements: 46
branches: 20,
functions: 66,
lines: 63,
statements: 63
}
}
};
+7 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api",
"version": "1.4.7",
"version": "1.8.3",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -22,23 +22,25 @@
"prebuild": "yarn clean",
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"test:unit": "jest spec --coverage"
"lint:fix": "eslint . --ext .ts --fix",
"test": "jest spec --coverage"
},
"devDependencies": {
"@types/jest": "^28.1.5",
"@types/lodash": "^4.14.182",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"eslint": "^8.23.0",
"eslint-plugin-prettier": "*",
"jest": "^28.1.2",
"ts-jest": "^28.0.5"
"ts-jest": "^28.0.5",
"typescript": "*"
},
"dependencies": {
"@standardnotes/common": "^1.23.1",
"@standardnotes/common": "^1.32.0",
"@standardnotes/encryption": "workspace:*",
"@standardnotes/models": "workspace:*",
"@standardnotes/responses": "workspace:*",
"@standardnotes/security": "^1.1.0",
"@standardnotes/services": "workspace:*",
"@standardnotes/utils": "workspace:*",
"reflect-metadata": "^0.1.13"
}
@@ -0,0 +1,5 @@
export enum SubscriptionApiOperations {
Inviting,
CancelingInvite,
ListingInvites,
}
@@ -0,0 +1,163 @@
import { Invitation } from '@standardnotes/models'
import { SubscriptionInviteCancelResponse } from '../../Response/Subscription/SubscriptionInviteCancelResponse'
import { SubscriptionInviteListResponse } from '../../Response/Subscription/SubscriptionInviteListResponse'
import { SubscriptionInviteResponse } from '../../Response/Subscription/SubscriptionInviteResponse'
import { SubscriptionServerInterface } from '../../Server/Subscription/SubscriptionServerInterface'
import { SubscriptionApiOperations } from './SubscriptionApiOperations'
import { SubscriptionApiService } from './SubscriptionApiService'
describe('SubscriptionApiService', () => {
let subscriptionServer: SubscriptionServerInterface
const createService = () => new SubscriptionApiService(subscriptionServer)
beforeEach(() => {
subscriptionServer = {} as jest.Mocked<SubscriptionServerInterface>
subscriptionServer.invite = jest.fn().mockReturnValue({
data: { success: true, sharedSubscriptionInvitationUuid: '1-2-3' },
} as jest.Mocked<SubscriptionInviteResponse>)
subscriptionServer.cancelInvite = jest.fn().mockReturnValue({
data: { success: true },
} as jest.Mocked<SubscriptionInviteCancelResponse>)
subscriptionServer.listInvites = jest.fn().mockReturnValue({
data: { invitations: [{} as jest.Mocked<Invitation>] },
} as jest.Mocked<SubscriptionInviteListResponse>)
})
it('should invite a user', async () => {
const response = await createService().invite('[email protected]')
expect(response).toEqual({
data: {
success: true,
sharedSubscriptionInvitationUuid: '1-2-3',
},
})
expect(subscriptionServer.invite).toHaveBeenCalledWith({
api: '20200115',
identifier: '[email protected]',
})
})
it('should not invite a user if it is already inviting', async () => {
const service = createService()
Object.defineProperty(service, 'operationsInProgress', {
get: () => new Map([[SubscriptionApiOperations.Inviting, true]]),
})
let error = null
try {
await service.invite('[email protected]')
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should not invite a user if the server fails', async () => {
subscriptionServer.invite = jest.fn().mockImplementation(() => {
throw new Error('Oops')
})
let error = null
try {
await createService().invite('[email protected]')
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should cancel an invite', async () => {
const response = await createService().cancelInvite('1-2-3')
expect(response).toEqual({
data: {
success: true,
},
})
expect(subscriptionServer.cancelInvite).toHaveBeenCalledWith({
api: '20200115',
inviteUuid: '1-2-3',
})
})
it('should not cancel an invite if it is already canceling', async () => {
const service = createService()
Object.defineProperty(service, 'operationsInProgress', {
get: () => new Map([[SubscriptionApiOperations.CancelingInvite, true]]),
})
let error = null
try {
await service.cancelInvite('1-2-3')
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should not cancel an invite if the server fails', async () => {
subscriptionServer.cancelInvite = jest.fn().mockImplementation(() => {
throw new Error('Oops')
})
let error = null
try {
await createService().cancelInvite('1-2-3')
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should list invites', async () => {
const response = await createService().listInvites()
expect(response).toEqual({
data: {
invitations: [{} as jest.Mocked<Invitation>],
},
})
expect(subscriptionServer.listInvites).toHaveBeenCalledWith({
api: '20200115',
})
})
it('should not list invitations if it is already listing', async () => {
const service = createService()
Object.defineProperty(service, 'operationsInProgress', {
get: () => new Map([[SubscriptionApiOperations.ListingInvites, true]]),
})
let error = null
try {
await service.listInvites()
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should not list invites if the server fails', async () => {
subscriptionServer.listInvites = jest.fn().mockImplementation(() => {
throw new Error('Oops')
})
let error = null
try {
await createService().listInvites()
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
})
@@ -0,0 +1,81 @@
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 { SubscriptionInviteResponse } from '../../Response/Subscription/SubscriptionInviteResponse'
import { SubscriptionInviteListResponse } from '../../Response/Subscription/SubscriptionInviteListResponse'
import { SubscriptionInviteCancelResponse } from '../../Response/Subscription/SubscriptionInviteCancelResponse'
import { SubscriptionApiServiceInterface } from './SubscriptionApiServiceInterface'
import { SubscriptionApiOperations } from './SubscriptionApiOperations'
export class SubscriptionApiService implements SubscriptionApiServiceInterface {
private operationsInProgress: Map<SubscriptionApiOperations, boolean>
constructor(private subscriptionServer: SubscriptionServerInterface) {
this.operationsInProgress = new Map()
}
async listInvites(): Promise<SubscriptionInviteListResponse> {
if (this.operationsInProgress.get(SubscriptionApiOperations.ListingInvites)) {
throw new ApiCallError(ErrorMessage.GenericInProgress)
}
this.operationsInProgress.set(SubscriptionApiOperations.ListingInvites, true)
try {
const response = await this.subscriptionServer.listInvites({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
})
this.operationsInProgress.set(SubscriptionApiOperations.ListingInvites, false)
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
async cancelInvite(inviteUuid: string): Promise<SubscriptionInviteCancelResponse> {
if (this.operationsInProgress.get(SubscriptionApiOperations.CancelingInvite)) {
throw new ApiCallError(ErrorMessage.GenericInProgress)
}
this.operationsInProgress.set(SubscriptionApiOperations.CancelingInvite, true)
try {
const response = await this.subscriptionServer.cancelInvite({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
inviteUuid,
})
this.operationsInProgress.set(SubscriptionApiOperations.CancelingInvite, false)
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
async invite(inviteeEmail: string): Promise<SubscriptionInviteResponse> {
if (this.operationsInProgress.get(SubscriptionApiOperations.Inviting)) {
throw new ApiCallError(ErrorMessage.GenericInProgress)
}
this.operationsInProgress.set(SubscriptionApiOperations.Inviting, true)
try {
const response = await this.subscriptionServer.invite({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
identifier: inviteeEmail,
})
this.operationsInProgress.set(SubscriptionApiOperations.Inviting, false)
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
}
@@ -0,0 +1,11 @@
import { Uuid } from '@standardnotes/common'
import { SubscriptionInviteCancelResponse } from '../../Response/Subscription/SubscriptionInviteCancelResponse'
import { SubscriptionInviteListResponse } from '../../Response/Subscription/SubscriptionInviteListResponse'
import { SubscriptionInviteResponse } from '../../Response/Subscription/SubscriptionInviteResponse'
export interface SubscriptionApiServiceInterface {
invite(inviteeEmail: string): Promise<SubscriptionInviteResponse>
listInvites(): Promise<SubscriptionInviteListResponse>
cancelInvite(inviteUuid: Uuid): Promise<SubscriptionInviteCancelResponse>
}
@@ -0,0 +1,3 @@
export enum WebSocketApiOperations {
CreatingConnectionToken,
}
@@ -0,0 +1,61 @@
import { WebSocketConnectionTokenResponse } from '../../Response'
import { WebSocketServerInterface } from '../../Server/WebSocket/WebSocketServerInterface'
import { WebSocketApiOperations } from './WebSocketApiOperations'
import { WebSocketApiService } from './WebSocketApiService'
describe('WebSocketApiService', () => {
let webSocketServer: WebSocketServerInterface
const createService = () => new WebSocketApiService(webSocketServer)
beforeEach(() => {
webSocketServer = {} as jest.Mocked<WebSocketServerInterface>
webSocketServer.createConnectionToken = jest.fn().mockReturnValue({
data: { token: 'foobar' },
} as jest.Mocked<WebSocketConnectionTokenResponse>)
})
it('should create a websocket connection token', async () => {
const response = await createService().createConnectionToken()
expect(response).toEqual({
data: {
token: 'foobar',
},
})
expect(webSocketServer.createConnectionToken).toHaveBeenCalledWith({})
})
it('should not create a token if it is already creating', async () => {
const service = createService()
Object.defineProperty(service, 'operationsInProgress', {
get: () => new Map([[WebSocketApiOperations.CreatingConnectionToken, true]]),
})
let error = null
try {
await service.createConnectionToken()
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
it('should not create a token if the server fails', async () => {
webSocketServer.createConnectionToken = jest.fn().mockImplementation(() => {
throw new Error('Oops')
})
let error = null
try {
await createService().createConnectionToken()
} catch (caughtError) {
error = caughtError
}
expect(error).not.toBeNull()
})
})
@@ -0,0 +1,33 @@
import { ErrorMessage } from '../../Error/ErrorMessage'
import { ApiCallError } from '../../Error/ApiCallError'
import { WebSocketApiServiceInterface } from './WebSocketApiServiceInterface'
import { WebSocketApiOperations } from './WebSocketApiOperations'
import { WebSocketServerInterface } from '../../Server'
import { WebSocketConnectionTokenResponse } from '../../Response'
export class WebSocketApiService implements WebSocketApiServiceInterface {
private operationsInProgress: Map<WebSocketApiOperations, boolean>
constructor(private webSocketServer: WebSocketServerInterface) {
this.operationsInProgress = new Map()
}
async createConnectionToken(): Promise<WebSocketConnectionTokenResponse> {
if (this.operationsInProgress.get(WebSocketApiOperations.CreatingConnectionToken)) {
throw new ApiCallError(ErrorMessage.GenericInProgress)
}
this.operationsInProgress.set(WebSocketApiOperations.CreatingConnectionToken, true)
try {
const response = await this.webSocketServer.createConnectionToken({})
this.operationsInProgress.set(WebSocketApiOperations.CreatingConnectionToken, false)
return response
} catch (error) {
throw new ApiCallError(ErrorMessage.GenericFail)
}
}
}
@@ -0,0 +1,5 @@
import { WebSocketConnectionTokenResponse } from '../../Response'
export interface WebSocketApiServiceInterface {
createConnectionToken(): Promise<WebSocketConnectionTokenResponse>
}
+5
View File
@@ -1,2 +1,7 @@
export * from './Subscription/SubscriptionApiOperations'
export * from './Subscription/SubscriptionApiService'
export * from './Subscription/SubscriptionApiServiceInterface'
export * from './User/UserApiService'
export * from './User/UserApiServiceInterface'
export * from './WebSocket/WebSocketApiService'
export * from './WebSocket/WebSocketApiServiceInterface'
@@ -4,4 +4,6 @@ export enum ErrorMessage {
RateLimited = 'Too many successive server requests. Please wait a few minutes and try again.',
InsufficientPasswordMessage = 'Your password must be at least %LENGTH% characters in length. For your security, please choose a longer password or, ideally, a passphrase, and try again.',
PasscodeRequired = 'Your passcode is required in order to register for an account.',
GenericInProgress = 'An existing request is already in progress.',
GenericFail = 'A server error occurred. Please try again.',
}
@@ -1,4 +1,5 @@
import { Environment } from '@standardnotes/services'
import { Environment } from '@standardnotes/models'
import { HttpResponseMeta } from './HttpResponseMeta'
import { HttpService } from './HttpService'
@@ -24,4 +25,14 @@ describe('HttpService', () => {
expect(service['host']).toEqual('http://foo')
})
it('should set and use the authorization token', () => {
const service = createService()
expect(service['authorizationToken']).toBeUndefined()
service.setAuthorizationToken('foo-bar')
expect(service['authorizationToken']).toEqual('foo-bar')
})
})
+37 -6
View File
@@ -1,5 +1,5 @@
import { isString, joinPaths } from '@standardnotes/utils'
import { Environment } from '@standardnotes/services'
import { Environment } from '@standardnotes/models'
import { HttpRequestParams } from './HttpRequestParams'
import { HttpVerb } from './HttpVerb'
import { HttpRequest } from './HttpRequest'
@@ -12,6 +12,8 @@ import { HttpResponseMeta } from './HttpResponseMeta'
import { HttpErrorResponseBody } from './HttpErrorResponseBody'
export class HttpService implements HttpServiceInterface {
private authorizationToken?: string
constructor(
private environment: Environment,
private appVersion: string,
@@ -20,28 +22,57 @@ export class HttpService implements HttpServiceInterface {
private updateMetaCallback: (meta: HttpResponseMeta) => void,
) {}
setAuthorizationToken(authorizationToken: string): void {
this.authorizationToken = authorizationToken
}
setHost(host: string): void {
this.host = host
}
async get(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse> {
return this.runHttp({ url: joinPaths(this.host, path), params, verb: HttpVerb.Get, authentication })
return this.runHttp({
url: joinPaths(this.host, path),
params,
verb: HttpVerb.Get,
authentication: authentication ?? this.authorizationToken,
})
}
async post(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse> {
return this.runHttp({ url: joinPaths(this.host, path), params, verb: HttpVerb.Post, authentication })
return this.runHttp({
url: joinPaths(this.host, path),
params,
verb: HttpVerb.Post,
authentication: authentication ?? this.authorizationToken,
})
}
async put(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse> {
return this.runHttp({ url: joinPaths(this.host, path), params, verb: HttpVerb.Put, authentication })
return this.runHttp({
url: joinPaths(this.host, path),
params,
verb: HttpVerb.Put,
authentication: authentication ?? this.authorizationToken,
})
}
async patch(path: string, params: HttpRequestParams, authentication?: string): Promise<HttpResponse> {
return this.runHttp({ url: joinPaths(this.host, path), params, verb: HttpVerb.Patch, authentication })
return this.runHttp({
url: joinPaths(this.host, path),
params,
verb: HttpVerb.Patch,
authentication: authentication ?? this.authorizationToken,
})
}
async delete(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse> {
return this.runHttp({ url: joinPaths(this.host, path), params, verb: HttpVerb.Delete, authentication })
return this.runHttp({
url: joinPaths(this.host, path),
params,
verb: HttpVerb.Delete,
authentication: authentication ?? this.authorizationToken,
})
}
private async runHttp(httpRequest: HttpRequest): Promise<HttpResponse> {
@@ -3,6 +3,7 @@ import { HttpResponse } from './HttpResponse'
export interface HttpServiceInterface {
setHost(host: string): void
setAuthorizationToken(authorizationToken: string): void
get(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse>
post(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse>
put(path: string, params?: HttpRequestParams, authentication?: string): Promise<HttpResponse>
@@ -0,0 +1,10 @@
import { Uuid } from '@standardnotes/common'
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
export type SubscriptionInviteAcceptRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
inviteUuid: Uuid
[additionalParam: string]: unknown
}
@@ -0,0 +1,10 @@
import { Uuid } from '@standardnotes/common'
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
export type SubscriptionInviteCancelRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
inviteUuid: Uuid
[additionalParam: string]: unknown
}
@@ -0,0 +1,10 @@
import { Uuid } from '@standardnotes/common'
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
export type SubscriptionInviteDeclineRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
inviteUuid: Uuid
[additionalParam: string]: unknown
}
@@ -0,0 +1,7 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
export type SubscriptionInviteListRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
[additionalParam: string]: unknown
}
@@ -0,0 +1,8 @@
import { ApiEndpointParam } from '../ApiEndpointParam'
import { ApiVersion } from '../../Api/ApiVersion'
export type SubscriptionInviteRequestParams = {
[ApiEndpointParam.ApiVersion]: ApiVersion.v0
identifier: string
[additionalParam: string]: unknown
}
@@ -0,0 +1,3 @@
export type WebSocketConnectionTokenRequestParams = {
[additionalParam: string]: unknown
}

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