Compare commits

...

491 Commits
2.3.3 ... 2.4.2

Author SHA1 Message Date
Andrey Antukh
7ca98ddf21 📎 Add missing entry on changelog 2025-01-22 16:07:07 +01:00
Pablo Alba
15157c54b1 🐛 Fix shape-ref cycles 2025-01-22 16:05:50 +01:00
Pablo Alba
232b29cd89 Merge pull request #5627 from penpot/niwinz-file-gc-improvements
 Minor improvements to file-gc code merged in other commit
2025-01-21 09:58:29 +01:00
Andrey Antukh
da0704081f 📎 Normalize default opts for db/plan function 2025-01-20 23:23:31 +01:00
Andrey Antukh
066b1235a6 🐛 Pass correct default options on db/plan fn 2025-01-20 23:23:31 +01:00
Pablo Alba
141694dc8d Merge pull request #5598 from penpot/niwinz-file-gc-improvements
 Add efficiency improvements to file-gc task
2025-01-20 21:14:32 +01:00
Andrey Antukh
151aedcf91 ♻️ Make the components cleaning mechanism on file-gc task more efficient 2025-01-20 16:35:14 +01:00
Andrey Antukh
5513daf17d ♻️ Make the media cleaning mechanism on file-gc task more efficient
Replaces the use of db/cursor with db/plan, that teorethically allows
processing large results without consuming all result set in memory
2025-01-20 16:34:05 +01:00
Andrey Antukh
fde0f3c182 🐛 Pass correct default options on db/plan fn 2025-01-20 16:34:05 +01:00
Aitor Moreno
7b408e4db1 Merge pull request #5622 from penpot/niwinz-api-doc-fix
🐛 Fix api docs page issue
2025-01-20 15:21:45 +01:00
Pablo Alba
b8fd829f9d Merge pull request #5621 from penpot/marina/testab-hover-state-add-file
 A/B test switching '+' to 'Add file' in an empty project
2025-01-20 12:49:19 +01:00
Andrey Antukh
089a66881c Make frontend app setup logging message more easy to be read
Mainly printing flag per line, making it more easily for human eye look
if some feature is active or not
2025-01-20 12:40:28 +01:00
Andrey Antukh
667b5fb6ee 🐛 Fix missing methods reference from api docs page 2025-01-20 12:30:20 +01:00
Andrey Antukh
f0f89151c5 Merge pull request #5620 from penpot/palba-consolidate-board-icon-change
Consolidate board icon change
2025-01-20 12:22:07 +01:00
Andrey Antukh
1221d60357 Merge pull request #5617 from penpot/alotor-hotfix-plugins
🐛 Fix problem in plugins with `replaceColor` method
2025-01-20 12:21:16 +01:00
alonso.torres
f553fa10d8 🐛 Fix problem in plugins with replaceColor method 2025-01-20 12:02:54 +01:00
Marina López
96947b0219 A/B test switching '+' to 'Add file' in an empty project 2025-01-20 11:56:15 +01:00
Pablo Alba
e2900d9012 🎉 Change of boards icon 2025-01-20 11:07:13 +01:00
Pablo Alba
1f0e470419 Revert "🎉 Add A/B test of use of boards if we just change the icon for “standard” one"
This reverts commit 0c586551c4.
2025-01-20 11:06:25 +01:00
Andrey Antukh
079a945c2f Merge branch 'main' into staging 2025-01-20 11:02:08 +01:00
Madalena Melo
542d709541 📚 Add viewer role documentation
Add viewer role to the team roles; also made some tweaks to the descriptions of the other roles
2025-01-20 11:01:38 +01:00
Madalena Melo
4f1d5a19e4 Change the order to add clarity to admin and owner roles
Switched the order of the roles to make it more logical and add more clarity about admins and owners ability to edit
2025-01-20 10:26:52 +01:00
Madalena Melo
91b0c47244 Add detail to role descriptions
Added more context to each role's description; I tried to keep it brief while including more information about what each role can do both within the team as well as in terms of team management
2025-01-20 10:26:46 +01:00
Madalena Melo
a7a49e4b39 Viewer Role - Update index.njk
Add viewer role to the team roles; also made some tweaks to the descriptions of the other roles
2025-01-20 10:26:39 +01:00
Andrey Antukh
ba81b2b14d Merge pull request #5613 from penpot/superalex-fix-staging-reply-to-comment
🐛 Fix reply to comment
2025-01-17 15:23:28 +01:00
Alejandro Alonso
423c237d42 🐛 Fix reply to comment 2025-01-17 11:57:44 +01:00
Andrey Antukh
5a55884b9f Merge pull request #5602 from penpot/hiru-fix-detach-2
🐛 Fix detach when top copy is dangling and nested copy is not
2025-01-16 12:21:33 +01:00
Andrey Antukh
38fd343c53 Merge remote-tracking branch 'origin/main' into staging 2025-01-16 12:20:27 +01:00
adi-lb-phoenix
94976aa2b1 📚 Fix incorrect flag on configuration.md 2025-01-16 12:19:03 +01:00
Andrés Moya
5247d217ab 🐛 Fix detach when top copy is dangling and nested copy is not 2025-01-16 10:45:54 +01:00
Andrey Antukh
40693e6857 🐛 Make the PENPOT_SECRET_KEY optional
Fix a regression introduced with 2.4
2025-01-16 09:59:19 +01:00
Andrey Antukh
5c428b5aa5 🐛 Fix repeated password update on login
because the default options were not being passed in the verification
2025-01-16 09:59:19 +01:00
Andrey Antukh
e92ddee33a 🐳 Move devenv secret key env asignation to scripts
from the docker compose
2025-01-16 09:59:19 +01:00
Eva Marco
c121f459ba Merge pull request #5571 from penpot/andy-docs-radius
📚 Change term for border radius
2025-01-15 10:18:05 +01:00
Andrey Antukh
698a258290 Merge remote-tracking branch 'origin/main' into staging 2025-01-14 17:47:32 +01:00
Yamila Moreno
aa023d847d 🐳 Set correct internal url frontend url for exporter 2025-01-14 17:37:14 +01:00
Andrey Antukh
53f57dad0b Merge pull request #5575 from penpot/azazeln28-fix-text-editor-issue-9285
🐛 Fix text editor copy/paste issue
2025-01-14 16:50:34 +01:00
AzazelN28
d7d7535ab4 🐛 Fix text editor copy/paste issue 2025-01-14 11:20:38 +01:00
Pablo Alba
accc662e1c 🐛 Fix login is not shown on 404 2025-01-14 09:51:12 +01:00
andy
1efc1516e2 📚 Change term for border radius 2025-01-13 15:53:06 +01:00
Alejandro
b5d731ca72 Merge pull request #5559 from penpot/palba-fix-flags-not-setting-login
🐛 Fix feature flags not setting on login
2025-01-13 10:57:37 +01:00
Pablo Alba
e380289e34 🐛 Fix feature flags not setting on login 2025-01-10 21:25:55 +01:00
Andrey Antukh
b22323a484 Merge pull request #5547 from penpot/alotor-bugs-1
🐛 Fix problem when changing color libraries
2025-01-10 15:16:01 +01:00
alonso.torres
58dd23f9c7 🐛 Fix problem when changing color libraries 2025-01-10 12:33:16 +01:00
Andrey Antukh
54e7551d56 🐛 Backport comments decoding from develop
Mainly for backward compatibility with database
layout on comments tables from develop / v2.5
2025-01-10 12:20:53 +01:00
Andrey Antukh
404297f837 Merge pull request #5537 from penpot/azazeln28-fix-text-editor-issue-9716
🐛 Fix text editor issue 9716
2025-01-10 10:24:23 +01:00
Andrey Antukh
33f853ff2e Merge pull request #5511 from penpot/alotor-fix-touched-import
🐛 Fix error when importing files with touched components
2025-01-09 17:13:22 +01:00
alonso.torres
d16513be9d 🐛 Fix error when importing files with touched components 2025-01-09 16:58:40 +01:00
AzazelN28
ad077696b0 🐛 Fix Unknown node type when replacing whole root node 2025-01-09 16:28:32 +01:00
Andrey Antukh
1cbeafe85c Merge pull request #5525 from penpot/palba-testabc-add-library
A/B/C test for rename and change look and feel of "libraries" button
2025-01-09 08:34:05 +01:00
Pablo Alba
76c8523f44 Add test ABC renaming "Libraries" to "Add library" 2025-01-08 13:20:52 +01:00
Pablo Alba
f277d8b125 Revert " Add test AB renaming "Libraries" to "Add library""
This reverts commit 664cacbe9d.
2025-01-08 11:05:50 +01:00
Andrey Antukh
60af8d0bcb Merge pull request #5520 from penpot/azazeln28-fix-text-editor-issue-9285
Fix Copy/Paste text into the text block
2025-01-07 14:26:11 +01:00
Juanfran
d652ed8e68 Merge pull request #5519 from penpot/alotor-fix-plugins-current-user
🐛 Fix problem with currentUser in plugins
2025-01-07 14:05:07 +01:00
AzazelN28
09d73a2f51 🐛 Fix pasting text changes opacity to 0 2025-01-07 13:48:32 +01:00
alonso.torres
7d4535ebd4 🐛 Fix problem with currentUser in plugins 2025-01-07 13:03:56 +01:00
Andrey Antukh
a5a53219bf Merge remote-tracking branch 'origin/main' into staging 2025-01-07 12:00:09 +01:00
Marina López
8716f81765 Merge pull request #5456 from daledesilva/patch-1
📚 Add submission form link to deployment page
2025-01-07 10:58:05 +01:00
Andrey Antukh
7aa46a1f62 🔥 Remove 2.4.1 from changelog 2025-01-07 10:51:46 +01:00
Andrey Antukh
d62eb3d3f4 Merge pull request #5504 from penpot/palba-add-feature-flags-to-events
 Add feature flags info to posthog events
2025-01-07 09:34:22 +01:00
Pablo Alba
e4c427609d Add feature flags info to posthog events 2025-01-07 09:19:04 +01:00
Aitor Moreno
883a26845a Merge pull request #5510 from penpot/alotor-fix-thumbnail-generation
🐛 Fix problem with thumbnail generation when changing between ver…
2025-01-02 12:46:59 +01:00
alonso.torres
bcdf5d86ae 🐛 Fix problem with thumbnail generation when changing between versions 2025-01-02 12:01:30 +01:00
Pablo Alba
3eab9da74e Merge pull request #5492 from penpot/alotor-christmas-bugfixes
🐛 Fix problem with component swap style
2024-12-26 16:39:23 +01:00
alonso.torres
2813fda136 🐛 Fix problem with component swap style 2024-12-23 12:37:24 +01:00
Andrey Antukh
a0022a804b Merge branch 'backrunner-patch/backrunner_nginx-conf' into staging 2024-12-23 10:28:34 +01:00
BackRunner
068acb4303 🐛 Fix assets proxy ssl handshake error 2024-12-23 10:28:10 +01:00
Andrey Antukh
d6f98a6c79 📎 Add externs for worker build 2024-12-23 10:03:10 +01:00
Andrey Antukh
7b6c2da6da 📎 Add externs for main build
With all combinations of small symbols for indicate
to compiler to not use them for internal renaming
2024-12-23 10:03:10 +01:00
Andrey Antukh
affed049ee Merge remote-tracking branch 'origin/main' into staging 2024-12-19 10:27:12 +01:00
alonso.torres
377f636b8e 🐛 Fix problem with reorder on grid layout layers 2024-12-18 13:32:30 +01:00
Alejandro Alonso
2d512ef273 🐛 Fix path edition for plugins 2024-12-18 10:12:01 +01:00
Andrey Antukh
b8ebbe8c3c Merge pull request #5468 from penpot/palba-abtest-add-library-button2
 Add test AB renaming "Libraries" to "Add library"
2024-12-13 12:20:56 +01:00
Pablo Alba
09c184200d Merge pull request #5471 from penpot/niwinz-bugfix-5
🐛 Fix unhandled exception on accepting invitation
2024-12-13 12:15:35 +01:00
Andrey Antukh
bbe0b22a8b 🐛 Fix unhandled exception on accepting invitation
In an interaction with the audit log; happens when an old invitation
(with created-by as nil) is accepted.
2024-12-13 11:48:37 +01:00
Andrey Antukh
8603085a69 Merge pull request #5470 from penpot/palba-add-config-not-show-release
🎉 Add config flag to hide release info
2024-12-13 11:28:27 +01:00
Andrey Antukh
29ec44482d Merge pull request #5463 from penpot/andy-docs-adjustments
📚 Remove broken video about History versions
2024-12-13 11:17:27 +01:00
Andrey Antukh
fd4d4ec6e3 Merge pull request #5465 from penpot/palba-fix-viewer-role-thumbnails
🐛 Fix viewer role is unable to generate thumbnails on dashboard
2024-12-13 11:16:32 +01:00
Pablo Alba
0945dd2920 🎉 Add config flag to hide release info 2024-12-13 11:14:59 +01:00
Pablo Alba
664cacbe9d Add test AB renaming "Libraries" to "Add library" 2024-12-13 10:51:41 +01:00
Pablo Alba
08516ac7ca Revert " Add test AB renaming "Libraries" to "Add library""
This reverts commit ec7f8a6aa7.
2024-12-13 10:51:25 +01:00
Pablo Alba
24e51eef5b 🐛 Fix viewer role is unable to generate thumbnails on dashboard 2024-12-12 15:15:27 +01:00
Andrey Antukh
ee62016c34 Merge pull request #5462 from penpot/palba-dont-show-release-info
🐛 Fix a new user shouldn't see the "What's new" popup
2024-12-12 12:27:14 +01:00
andy
7c10f20b95 📚 Remove deprecated video at History version 2024-12-12 11:57:08 +01:00
Pablo Alba
4958da63e5 🐛 Fix a new user shouldn't see the "What's new" popup 2024-12-12 11:45:58 +01:00
andy
f39a994fed 📚 Import/export images replacements and other adjustments 2024-12-12 08:38:00 +01:00
andy
5ef59d5e2e 📚 New penpot file format 2024-12-12 08:37:53 +01:00
andy
98221c6b51 📚 Images and text adjustments 2024-12-12 08:37:40 +01:00
Madalena Melo
74713cde63 File history versions
https://tree.taiga.io/project/penpot/task/9377
2024-12-12 08:37:32 +01:00
andrés gonzález
a5084c35b5 Merge pull request #5461 from penpot/andy-docs-blending
📚 Info about layers blend and opacity
2024-12-12 08:29:41 +01:00
andrés gonzález
cdce1df919 Merge pull request #5460 from penpot/andy-shortcuts-update
📚 History shortcut removed
2024-12-12 08:27:48 +01:00
andy
c75b886548 📚 Info about layers blend and opacity 2024-12-12 07:03:54 +01:00
andy
abd41e825e 📚 History shortcut removed 2024-12-12 06:22:51 +01:00
Andrey Antukh
97b9a7d31c 🐛 Remove hardcoded limit of 20 on the snapshot list rpc method 2024-12-11 14:13:04 +01:00
Dale de Silva
dbeebf181f 📚 Add submission form link to deployment page
The plugin submission page is hard to find while looking at the plugin help docs (As it's not linked from there). It should eventually be a page of its own but there isn't enough content yet (or an illustration) to support it.
2024-12-11 23:51:11 +11:00
Andrey Antukh
0eec09acbf Merge pull request #5441 from penpot/juan-slides-2.4
Juan slides 2.4
2024-12-11 12:49:31 +01:00
Elhombretecla
81e250e27d 🎉 Add slides for 2.4 release 2024-12-11 12:36:29 +01:00
Alejandro
9f1f8cc80c Merge pull request #5438 from penpot/andy-docs-selfhostsettings
📚 Recommended settings for selfhost
2024-12-11 07:57:23 +01:00
andy
2440c81b42 📚 Recommended settings for selfhost 2024-12-11 07:42:01 +01:00
Alejandro
ada078abab Merge pull request #5439 from penpot/niwinz-delete-xlog-gc-task
🔥 Remove file-xlog-gc task
2024-12-11 07:29:39 +01:00
Andrey Antukh
31319a0d04 Merge pull request #5442 from penpot/alotor-view-only-menu
🐛 Remove file history versions menu options on view mode
2024-12-10 15:20:57 +01:00
alonso.torres
b9cb415507 🐛 Remove file history versions menu options on view mode 2024-12-10 14:41:00 +01:00
Andrey Antukh
36121d862d Merge pull request #5440 from penpot/palba-ab-share-in-workspace
 Fix test A/B add share button to the workspace
2024-12-10 13:48:49 +01:00
Pablo Alba
d8964a69bc Fix test A/B add share button to the workspace 2024-12-10 13:33:04 +01:00
Andrey Antukh
39da7d7ab6 Merge pull request #5429 from penpot/palba-bugfixing-01
🐛 Palba bugfixing 01
2024-12-10 12:33:38 +01:00
Andrey Antukh
1bb25bb89d 🔥 Remove file-xlog-gc task
It is no longer necessary because snapshots are managed by the objects-gc task
2024-12-10 12:19:12 +01:00
Pablo Alba
b0a3f2b72a 🐛 Fix history panel remains open after restoring a version 2024-12-10 11:00:54 +01:00
Pablo Alba
f2f3d9f7eb 💄 Fix css format (spacing) 2024-12-10 10:53:12 +01:00
Pablo Alba
cf72b35e73 🐛 Fix separator lines have no color at some menus 2024-12-10 10:53:12 +01:00
Andrey Antukh
fe8d9cf159 Merge pull request #5418 from penpot/palba-abtest-add-sugested-libraries
 Add test AB for adding a few "Suggested" libraries
2024-12-10 09:50:41 +01:00
Andrey Antukh
4cfe33bc5c Merge pull request #5436 from penpot/azazeln28-fix-text-editor-v2-copy-paste-issues
🐛 Fix copy/paste issues
2024-12-10 09:29:31 +01:00
Andrey Antukh
e5d8bc91fb 💄 Fix describe-library-blocks component syntax decl style 2024-12-10 09:26:07 +01:00
Andrey Antukh
ce1ba3f28f 💄 Fix sample-library-entry component syntax style 2024-12-10 09:21:45 +01:00
Pablo Alba
257d72ee9d Add test AB for adding a few "Suggested" libraries 2024-12-10 09:16:55 +01:00
Alejandro
0766b341bd Merge pull request #5432 from penpot/niwinz-bugfix-2
🐛 Bug fixes
2024-12-10 08:05:00 +01:00
AzazelN28
4ef631fd6a 🐛 Fix copy/paste issues 2024-12-09 16:10:39 +01:00
Andrey Antukh
a923d39603 🐛 Fix incorrect teams query on profile deletion
The current approach prevents profile deletion when
there are some extra (soft)deleted teams where the profile
is owner
2024-12-09 10:15:13 +01:00
Andrey Antukh
2f79d71262 🐛 Fix incorrect event handling on file-menu
Don't wait team to be present for open the menu,
because with slow connection speed it can cause
unexpected ux glitche showing menu when the component
inner request is resoved
2024-12-09 10:15:13 +01:00
Andrey Antukh
4881bf3619 Merge pull request #5412 from penpot/palba-abtest-add-library-button
 Add test AB renaming "Libraries" to "Add library"
2024-12-09 09:53:35 +01:00
Eva Marco
69df69c4bb Merge pull request #5424 from penpot/superalex-bugfixing-30
🐛 Bug fixing
2024-12-05 16:12:16 +01:00
Alejandro
2c36a4076f Merge pull request #5427 from penpot/eva-fix-firefox-scrollbar
🐛 Fix horizontal scroll on firefox
2024-12-05 13:30:52 +01:00
Andrey Antukh
3ac6f59b7b Merge pull request #5428 from penpot/qol-versions-limit-warning
 Add autosaved versions warning
2024-12-05 13:26:59 +01:00
alonso.torres
c68a0d3967 Add autosaved versions warning 2024-12-05 13:18:03 +01:00
Andrey Antukh
aeb1ac41da 🐛 Prevent upload media objects to deleted files 2024-12-05 12:39:43 +01:00
Eva Marco
b58830260c 🐛 Fix horizontal scroll on firefox 2024-12-05 12:21:22 +01:00
Alejandro Alonso
4114d9b56f 🐛 Fix shortcut for history not working 2024-12-05 10:52:59 +01:00
Alejandro
553b9eb4bb Merge pull request #5425 from penpot/ladybenko-9477-backport
[backport] 🐛 Fix missing rename shortcut translation
2024-12-05 10:43:37 +01:00
María Valderrama
12e97c73f3 🐛 Fix missing rename shortcut translation 2024-12-05 09:59:00 +01:00
Alejandro
bd1286aace Merge pull request #5422 from penpot/eva-fix-demote-owner
🐛  Fix admin can demote owner
2024-12-05 09:37:22 +01:00
Alejandro Alonso
630f42f7ac 🐛 Fix internal error when creating a guide 2024-12-05 09:30:10 +01:00
Eva Marco
bf40cd98e8 🐛 Fix admin can demote owner 2024-12-05 09:27:32 +01:00
Pablo Alba
ec7f8a6aa7 Add test AB renaming "Libraries" to "Add library" 2024-12-04 13:55:55 +01:00
andrés gonzález
4d3192546c 📚 Update changelog with some links format 2024-12-04 09:49:33 +01:00
andrés gonzález
2184926bbb 📚 Update changelog with "New .penpot file format" 2024-12-04 09:42:20 +01:00
Aitor Moreno
fffc3b1b58 Merge pull request #5396 from penpot/niwinz-bugfix-1
🐛 Fix regression on drawing text with auto-size
2024-11-29 15:55:34 +01:00
Andrey Antukh
e0cc999345 🐛 Fix regression on drawing text with auto-size
Using editor v1
Caused by 2ed743b6be
2024-11-29 13:23:39 +01:00
Andrey Antukh
8e836f79fb Merge pull request #5390 from penpot/palba-fix-bad-redirect-remove-from-team
🐛 Fix bad redirect after being removed from a team
2024-11-29 13:01:27 +01:00
Pablo Alba
093a58b9ec 🐛 Fix bad redirect after being removed from a team 2024-11-29 10:55:17 +01:00
Andrey Antukh
5e2b847202 Merge pull request #5383 from penpot/azazeln28-fix-text-editor-more-issues
🐛 Fix text editor issues
2024-11-29 10:17:43 +01:00
Andrey Antukh
ef207cfe70 Merge pull request #5386 from penpot/palba-create-events
Create several events
2024-11-28 12:10:45 +01:00
Pablo Alba
f72c37a198 Add events for use library assets 2024-11-28 11:25:12 +01:00
Pablo Alba
dbf3d0d7c1 Add event "navigate-to-library-file" 2024-11-28 11:23:28 +01:00
Pablo Alba
903c8c021d Add event "change-inspect-tab" 2024-11-27 13:51:21 +01:00
Pablo Alba
9b8ef0a2e5 Add event "duplicate-page" 2024-11-27 13:51:21 +01:00
Pablo Alba
22e64c1c81 Add event "resolve-comment-thread" 2024-11-27 13:51:21 +01:00
Pablo Alba
14c917d003 Add event "create-prototype" 2024-11-27 13:51:21 +01:00
AzazelN28
4377a0dcc4 🐛 Fix an error that kept empty inlines 2024-11-27 12:29:38 +01:00
AzazelN28
db6ca6f905 🐛 Fix wrong line-height value 2024-11-27 12:05:42 +01:00
Aitor Moreno
ede8ee6a78 Merge pull request #5384 from penpot/alotor-fix-editor
🐛 Fix problem with editor line-height
2024-11-27 12:01:58 +01:00
alonso.torres
37b50497f3 🐛 Fix problem with editor line-height 2024-11-27 11:51:13 +01:00
Aitor Moreno
e3d2b99acc Merge pull request #5381 from penpot/niwinz-bugfix-1
🐛 Fix incorrect thumbnail rendering on dashboard
2024-11-27 11:48:25 +01:00
AzazelN28
7101b94557 🐛 Fix selectAll when editor is empty 2024-11-27 11:42:18 +01:00
Aitor Moreno
5ffab1953d Merge pull request #5382 from penpot/niwinz-bugfix-2
🐛 Fix regression with component thumbnails
2024-11-27 11:34:50 +01:00
Andrey Antukh
75e7cfb69e 🐛 Fix regression with component thumbnails 2024-11-27 11:15:58 +01:00
Andrey Antukh
65b7e5c3a5 🐛 Fix incorrect thumbnail rendering on dashboard 2024-11-27 10:42:56 +01:00
Andrey Antukh
30a06249ff Merge pull request #5377 from penpot/azazeln28-fix-text-editor-issues
🐛 Fix text editor issues
2024-11-27 09:08:39 +01:00
AzazelN28
59ca09c24e 🐛 Fix text editor issues 2024-11-27 08:56:52 +01:00
Andrey Antukh
1aeafdfca7 Merge pull request #5378 from penpot/yms-fix-k8s-documentation
📚 Add links to Kubernetes documentation
2024-11-27 08:54:37 +01:00
Andrey Antukh
a714085523 Merge branch 'niwinz-plugins-reify' into staging 2024-11-27 08:32:54 +01:00
alonso.torres
eccc4226c7 Migrate proxies to new format 2024-11-27 08:32:07 +01:00
Yamila Moreno
4d6d85b3de 📚 Add links to Kubernetes documentation 2024-11-26 15:25:51 +01:00
Aitor Moreno
c607b61af6 Merge pull request #5349 from penpot/palba-add-event-for-pdf
 Add export format info to export-shapes event
2024-11-26 12:53:52 +01:00
Andrey Antukh
e16ec9c719 Add facility for create anonymous objects
Speciailly designed to be work in plugins where code
is submited to hard deep freeze on the sandboxing
process.
2024-11-25 16:35:44 +01:00
Pablo Alba
59e5656bd7 Merge pull request #5370 from penpot/niwinz-bugfix-4
🐛 Fix incorrect access to flows on add-new-interaction event
2024-11-25 15:41:13 +01:00
Andrey Antukh
723eef9565 🐛 Fix incorrect access to flows on add-new-interaction event 2024-11-25 13:32:45 +01:00
Belén Albeza
8448036d67 Merge pull request #5368 from penpot/niwinz-bugfix-3
🐛 Fix import format detection and error handling
2024-11-25 13:30:46 +01:00
Andrey Antukh
e1c9691567 Improve scss compilation error handling
Don't stop watch scss process on compilation error
2024-11-25 12:44:10 +01:00
Andrey Antukh
577b731b22 🐛 Fix import format detection and error handling 2024-11-25 12:29:59 +01:00
Andrey Antukh
ef3588d05f Merge pull request #5355 from penpot/azazeln28-fix-component-list-jumps
🐛 Fix component list jumps
2024-11-25 11:44:05 +01:00
Andrey Antukh
d4893523bc Merge pull request #5367 from penpot/niwinz-bugfix-2
🐛 Fix release 2.3 onboarding text typos
2024-11-25 11:43:47 +01:00
AzazelN28
f10792619d 🐛 Fix component list jumps 2024-11-25 11:35:33 +01:00
Alejandro
7a0702650a Merge pull request #5366 from penpot/niwinz-bugfix-1
🐛 Bugfixes
2024-11-25 11:32:28 +01:00
Elhombretecla
ee1230c488 🐛 Fix release 2.3 onboarding text typos 2024-11-25 11:30:51 +01:00
Andrey Antukh
ede1176606 Merge pull request #5340 from penpot/palba-testab-board-icon
🎉 Add A/B test of use of boards if we just change the icon for “standard” one
2024-11-25 11:24:23 +01:00
Andrey Antukh
9506606e15 Merge pull request #5359 from penpot/alotor-fixes-2
🐛 Fix problem with scroll in history versions
2024-11-25 11:23:47 +01:00
Andrey Antukh
7e5f93ca3d Merge pull request #5358 from penpot/azazeln28-fix-assets-filters
🐛 Fix assets filters
2024-11-25 11:23:14 +01:00
Andrey Antukh
6655563aba Merge pull request #5357 from penpot/superalex-fix-generate-translation-files-with-markdown-and-links
🐛 Fix generate translation files with markdown and links
2024-11-25 11:18:13 +01:00
Andrey Antukh
8ee9b45243 Merge pull request #5346 from penpot/alotor-fixes-1
Alotor fixes 1
2024-11-25 11:16:25 +01:00
Alejandro
caa6897f81 Merge pull request #5342 from penpot/niwinz-thumbnails-fix
 Make the file and shape thumbnails not dependent on PUBLIC_URI
2024-11-25 11:13:04 +01:00
Andrey Antukh
660bc1a4dd 🐛 Fix incorrect team rename operation 2024-11-25 10:01:36 +01:00
Andrey Antukh
3ddd45e99b 🐛 Fix incorrect internal form initialization 2024-11-25 10:01:36 +01:00
Andrey Antukh
9b71e04e1c 🐛 Fix exception on user-feedback rpc method
And normalizes configuration parameters
2024-11-25 10:01:36 +01:00
alonso.torres
39620fe9c4 🐛 Hover on history version entry to show options 2024-11-25 09:51:41 +01:00
alonso.torres
db7c1fc7dd 🐛 Fix problem with some texts desynchronization 2024-11-25 09:51:41 +01:00
Alejandro Alonso
c89abf56ac 🐛 Fix translate files generations with markdown and links 2024-11-25 07:20:32 +01:00
alonso.torres
d22f6e37c9 Add pin version to main menu 2024-11-22 15:47:19 +01:00
AzazelN28
19b9b3cbd9 🐛 Fix missing main menu entry version history 2024-11-22 15:35:13 +01:00
alonso.torres
c1d3e4cd6e 🐛 Fix problem with scroll in history versions 2024-11-22 15:34:32 +01:00
AzazelN28
2164593757 🐛 Fix assets filters 2024-11-22 14:47:43 +01:00
Andrey Antukh
9485ce03b5 Merge pull request #5338 from penpot/azazeln28-fix-missing-text-editor-changes
📎 Fix some text editor missing changes
2024-11-22 12:54:42 +01:00
Aitor Moreno
ba832389d1 Merge pull request #5354 from penpot/superalex-fix-text-layer-default-name-with-v2-editor
🐛 Fix text layer default name with v2 text editor
2024-11-22 12:20:59 +01:00
Alejandro Alonso
a8ee9be7b9 🐛 Fix text layer default name with v2 text editor 2024-11-22 11:14:39 +01:00
AzazelN28
c8c83c1e1d 📎 Fix some missing changes 2024-11-22 11:06:16 +01:00
Andrey Antukh
afcfbdedda Merge pull request #5341 from penpot/palba-fix-leave-team
🐛 Fix bad redirect after leaving team
2024-11-22 08:31:21 +01:00
Pablo Alba
53f55444cd Add export format info to export-shapes event 2024-11-21 16:33:06 +01:00
Pablo Alba
fa8665df88 Merge pull request #5337 from penpot/juanfran-fix-typo-keepaspectratio
🐛 Fix typo in keepAspectRatio #9336
2024-11-21 09:13:21 +01:00
Andrey Antukh
5cc678ddc3 Remove not necessary check on upgrade-version notification 2024-11-20 16:43:14 +01:00
Andrey Antukh
64c8741233 🐛 Make thumbnails independent of current public uri
Mainly always resolve the public uri at frontend, making the
PENPOT_PUBLIC_URI less necessary to be changed. This improves
the experience of on-premise configuration.

Also removes unnecesary calls for thumbnail generation
on components.
2024-11-20 16:43:14 +01:00
Pablo Alba
0cae9d6ad5 🐛 Fix bad redirect after leaving team 2024-11-20 15:37:08 +01:00
Pablo Alba
0c586551c4 🎉 Add A/B test of use of boards if we just change the icon for “standard” one 2024-11-20 15:12:54 +01:00
Juanfran
2f4cb19745 🐛 Fix typo in keepAspectRatio #9336 2024-11-20 12:43:51 +01:00
Alejandro
b80ccbec0f Merge pull request #5334 from penpot/niwinz-bug-features
🐛 Preserve frontend-only flags already present on team
2024-11-20 06:27:24 +01:00
Andrey Antukh
246415be2b Merge pull request #5306 from penpot/azazeln28-update-text-editor
⬆️ Update text editor
2024-11-19 19:20:04 +01:00
Andrey Antukh
7faa9e970e 🐛 Fix esm module incompatibilities on text-editor with node 2024-11-19 17:20:16 +01:00
Andrey Antukh
04a0d867b0 Import text-editor code into the repository 2024-11-19 17:05:30 +01:00
Andrey Antukh
a18214a1a5 🐛 Preserve frontend-only flags already present on team 2024-11-19 16:39:21 +01:00
AzazelN28
68397edd4d 🐛 Fix text editor selection 2024-11-19 14:47:38 +01:00
AzazelN28
1e2d9a15a3 🐛 Fix text editor shortcuts 2024-11-19 14:47:38 +01:00
AzazelN28
0f101fad9f ⬆️ Update text editor 2024-11-19 14:47:38 +01:00
Andrey Antukh
a91737b4d7 Merge pull request #5331 from penpot/alotor-exit-comments
🐛 Fix escape key to exit comments mode
2024-11-19 10:59:13 +01:00
alonso.torres
284d5ecb77 🐛 Fix escape key to exit comments mode 2024-11-19 10:44:54 +01:00
Alejandro
5d95d755ad Merge pull request #5315 from penpot/niwinz-team-access-request-quotes
🎉 Add quote definitions for team access requests
2024-11-19 06:52:04 +01:00
Andrey Antukh
4466abd150 Merge pull request #5320 from penpot/alotor-fix-problem-layouts
🐛 Fix problem with layout reflow
2024-11-18 18:44:42 +01:00
Andrey Antukh
27690c3da6 Add test runner for cljs on common module
In the same way as frontend tests are run and fix some
tokens related tests
2024-11-18 17:51:23 +01:00
alonso.torres
f436d72f51 Changed some events for versions 2024-11-18 16:38:38 +01:00
Alejandro
20ea188070 Merge pull request #5321 from penpot/niwinz-improvements-features
 Feature flags improvements
2024-11-18 15:52:20 +01:00
Alejandro
c4f076910b Merge pull request #5326 from penpot/alotor-fix-problem-texts
🐛 Fix problem with texts crashing
2024-11-18 12:59:40 +01:00
alonso.torres
72f2395142 🐛 Fix problem with texts crashing 2024-11-18 12:41:21 +01:00
Andrey Antukh
47d28758d7 Clean frontend and backend features on exportation 2024-11-15 15:57:25 +01:00
Andrey Antukh
b7573c0b72 Change frontend-only features automatic team assignation rules
The frontend-only features are now ignored from files and from teams
and they do not autoassigns automatically to team and file on file
creation or update operations.
2024-11-15 15:57:25 +01:00
alonso.torres
2ed743b6be 🐛 Fix problem with layout reflow 2024-11-15 15:12:52 +01:00
Andrey Antukh
036e335fc4 🎉 Add quote definitions for team access requests 2024-11-15 11:14:30 +01:00
Andrey Antukh
0e99b37c21 Merge remote-tracking branch 'origin/main' into staging 2024-11-15 10:17:18 +01:00
Andrey Antukh
bb370b3e50 Merge pull request #5314 from penpot/superalex-fix-wasm-build
🐛 Fix compilation for wasm communication in release mode
2024-11-15 09:44:24 +01:00
Andrey Antukh
45d56f40e1 Merge remote-tracking branch 'origin/develop' into staging 2024-11-15 09:35:21 +01:00
Andrey Antukh
a02a316165 Merge remote-tracking branch 'origin/staging' into develop 2024-11-15 09:34:28 +01:00
Alejandro Alonso
4a1ab75d8f 🐛 Fix compilation for wasm communication in release mode 2024-11-15 09:30:59 +01:00
Andrey Antukh
bbfcff0772 🐛 Update build data and version on all frontend templates
not only index.html
2024-11-14 18:48:48 +01:00
Andrey Antukh
21cdd1200a :paperlip: Add minor update to render-wasm build script 2024-11-14 18:18:22 +01:00
Andrey Antukh
aeda6271cd Improve release build process for render wasm 2024-11-14 18:14:43 +01:00
Andrey Antukh
058c3707c8 Improve consistency on devenv initialization 2024-11-14 17:23:45 +01:00
Andrey Antukh
b81ffa422f 📎 Update devenv entrypoint 2024-11-14 14:38:40 +01:00
Andrey Antukh
e54f213b3f 🐛 Set a different cache directory for emcsdk 2024-11-14 14:29:19 +01:00
Andrey Antukh
97072b112c 🐛 Add another attempt to fix build related to render-wasm 2024-11-14 13:08:06 +01:00
Andrey Antukh
16ff29538b 🐛 Fix issue on frontend build script 2024-11-14 12:39:12 +01:00
Andrey Antukh
48b72229c3 📎 Add workaround for missing cargo on PATH on render-wasm build script 2024-11-14 12:36:43 +01:00
Andrey Antukh
fa8af898ba 🐛 Add cargo to PATH environment on devenv 2024-11-14 12:35:45 +01:00
Anonymous
42e4a4a2dd 🌐 Add translations for: Swedish.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/sv/
2024-11-14 12:14:47 +01:00
Anonymous
e778bc8b18 🌐 Add translations for: Dutch.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/nl/
2024-11-14 12:14:46 +01:00
Anonymous
6d60ca0474 🌐 Add translations for: Latvian.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/lv/
2024-11-14 12:14:46 +01:00
Anonymous
41f906110e 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 85.6% (1338 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-11-14 12:14:46 +01:00
Anonymous
8d7be1e273 🌐 Add translations for: Czech.
Currently translated at 92.1% (1440 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/cs/
2024-11-14 12:14:46 +01:00
Anonymous
13adc88637 🌐 Add translations for: Hebrew.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/he/
2024-11-14 12:14:46 +01:00
Anonymous
84f063a5b4 🌐 Add translations for: Indonesian.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/id/
2024-11-14 12:14:46 +01:00
Anonymous
647357a892 🌐 Add translations for: German.
Currently translated at 91.5% (1431 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/de/
2024-11-14 12:14:46 +01:00
Anonymous
c1eed3a364 🌐 Add translations for: Turkish.
Currently translated at 92.3% (1444 of 1563 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/tr/
2024-11-14 12:14:46 +01:00
Andrey Antukh
2dd7f241d3 Merge pull request #5303 from penpot/qol-feature-versions-plugins
 Add versions support in plugins
2024-11-14 12:14:22 +01:00
Alejandro
66c6e0232e Merge pull request #5301 from penpot/niwinz-binfile-v3-finetuning
🐛 Fix pending tasks and issues on binfile-v3 format
2024-11-14 12:12:48 +01:00
alonso.torres
4de43b32e8 Add versions support in plugins 2024-11-14 12:02:15 +01:00
Andrey Antukh
1d735e5b12 📎 Resync translation files
Mainly update translation string location comments on all locale files
2024-11-14 12:01:31 +01:00
Andrey Antukh
15d3107c48 Adapt workspace main menu to binfile-v3 config flag 2024-11-14 12:01:31 +01:00
Andrey Antukh
2d1158efa3 🐛 Fix issue with encoding/decoding thumbnails on binfile-v3 format 2024-11-14 11:45:11 +01:00
Andrey Antukh
f78f843f7c Use .penpot extension for binfile-v3 export format 2024-11-14 11:45:08 +01:00
Alejandro
07e40e78cd Merge pull request #5304 from penpot/niwinz-minor-improvements-renderer
 Make workspace and features system aware of render.wasm loading
2024-11-14 11:40:01 +01:00
Andrey Antukh
57f5e3c30a Merge branch 'translations' into develop 2024-11-14 11:36:09 +01:00
Andrey Antukh
32cd388b06 📎 Rehash and sort translation files 2024-11-14 11:35:28 +01:00
Andrey Antukh
d3829ec630 Merge remote-tracking branch 'weblate/develop' into translations 2024-11-14 11:32:50 +01:00
Andrey Antukh
1be204e22d Add render.wasm to the frontend build process 2024-11-14 11:20:39 +01:00
Andrey Antukh
5d4511fc6a Make workspace and features system aware of render.wasm loading 2024-11-14 11:20:39 +01:00
Alejandro
dd1997e23c Merge pull request #5302 from penpot/niwinz-develop-hotfix-1
🐛 Relax ldap provider requirements
2024-11-14 09:49:49 +01:00
Andrey Antukh
36914d1dc4 🐛 Relax ldap provider requirements 2024-11-14 09:40:38 +01:00
Andrey Antukh
1fdc724761 Merge pull request #5294 from penpot/superalex-feature-flag-for-render-wasm
🎉 Add feature flag for wasm render
2024-11-14 08:59:48 +01:00
Alejandro
3c6403224d Merge pull request #5267 from penpot/niwinz-backend-update-integrant
♻️ Update integrant to latest version
2024-11-14 07:50:49 +01:00
Andrey Antukh
88fb5e7ab5 ♻️ Update integrant to latest version
This upgrade also includes complete elimination of use spec
from the backend codebase, completing the long running migration
to fully use malli for validation and decoding.
2024-11-13 19:09:19 +01:00
Pablo Alba
8ed508012e Merge pull request #5290 from penpot/niwinz-team-request-access-bugfix
🐛 Several bugfixes related to the request-access feature
2024-11-13 14:37:48 +01:00
Belén Albeza
58d744a342 Merge pull request #5295 from penpot/superalex-refactor-naming-anidated-shapes-wasm
🎉 Refactor naming anidated shapes with children for wasm render
2024-11-13 14:26:57 +01:00
Andrey Antukh
8f72d8583e Merge pull request #5296 from penpot/palba-bugs-viewer-role
Bugs viewer role
2024-11-13 14:17:29 +01:00
Andrey Antukh
57d7dfaa0a Add final adjustements for binfile-v3 feature 2024-11-13 14:16:21 +01:00
Andrey Antukh
4f4ef6f1f2 Refresh members after accept team request access 2024-11-13 14:16:21 +01:00
Andrey Antukh
6eadea8485 Improve multi-input initial value handling
And removes the hard coupling of invite-email from it
2024-11-13 14:16:21 +01:00
Andrey Antukh
607e0c5c1d Move team invitations and access requests to a separate namespace
This commit also comes with:

- a fix for incorrect conflict handling on team access request creation
- a fix for incorrect handling of file-data when it is offloaded
- replace some inneficient queries with effcient ones
- remove redundant validation on creation of request-access
2024-11-13 14:16:18 +01:00
Pablo Alba
e31b4b58ce 🐛 Fix viewer role can use shortcut for create project 2024-11-13 14:03:07 +01:00
Alejandro
e659b8eb6e Merge pull request #5298 from penpot/niwinz-update-changelog
📎 Add missing breaking change notification on changelog
2024-11-13 13:36:18 +01:00
Andrey Antukh
962408c1ae 📎 Add missing breaking change notification on changelog
About the redis version pinning to version 7.2
2024-11-13 13:35:55 +01:00
Alejandro Alonso
c1d213a0cd 🎉 Refactor naming anidated shapes with children for wasm render 2024-11-13 13:35:28 +01:00
Alejandro
7e5115ecd9 Merge pull request #5293 from penpot/ladybenko-9265-solid-fills
Draw solid rect fills
2024-11-13 13:12:19 +01:00
Belén Albeza
539d5dfc08 🎉 Draw solid fills for shapes 2024-11-13 13:05:42 +01:00
Andrey Antukh
343f63a7cc Merge remote-tracking branch 'origin/staging' into develop 2024-11-13 12:54:22 +01:00
Alejandro Alonso
e3268739ed 🎉 Add feature flag for wasm render 2024-11-13 12:50:09 +01:00
Andrey Antukh
df416af19b Merge pull request #5280 from penpot/palba-enhancements-viewer-role
Enhancements for viewer role
2024-11-13 12:50:09 +01:00
Andrey Antukh
c0f026c332 💄 Add minor cosmetic changes to verify-token ns 2024-11-13 12:37:36 +01:00
Pablo Alba
d4cf817b83 🐛 Fix libraries and templates section is shown for viewer role 2024-11-13 11:50:09 +01:00
Belén Albeza
669bca5fa5 ♻️ Remove unneeded display list for shapes 2024-11-13 10:59:03 +01:00
Belén Albeza
49b4eabe8b 🐛 Fix transform matrix being carried to non-children shapes 2024-11-13 10:57:14 +01:00
Andrey Antukh
03acfc2b3c Merge pull request #5289 from penpot/superalex-recurisve-wasm-drawing-shapes
🎉 Recursive drawing shapes in rust
2024-11-13 09:56:40 +01:00
Alejandro Alonso
b149f96500 🎉 Recursive drawing shapes in rust 2024-11-13 07:45:47 +01:00
Belén Albeza
132b1800c2 Merge pull request #5286 from penpot/superalex-render-modifiers
🎉 Save shape data in rust memory
2024-11-12 15:06:20 +01:00
Alejandro Alonso
65ee2f9081 🎉 Save shape data in rust memory 2024-11-12 12:13:06 +01:00
Yaron Shahrabani
4faa9ddd8d 🌐 Add translations for: Hebrew.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/he/
2024-11-12 12:00:39 +01:00
Andrey Antukh
48909dc3c4 Merge remote-tracking branch 'origin/staging' into develop 2024-11-12 11:38:24 +01:00
Andrey Antukh
72313c770c Merge pull request #5281 from penpot/ladybenko-9202-update-devenv
🔧 Add rustfmt to the devenv
2024-11-12 11:29:50 +01:00
Andrey Antukh
c05a69509e 🐛 Fix invalid return value on worker api when worker is not available
Mainly happens on tests
2024-11-12 11:25:16 +01:00
Andrey Antukh
44ffdc4f97 Merge pull request #5266 from penpot/hiru-merge-tokens
Update design tokens
2024-11-12 10:46:53 +01:00
Andrés Moya
5a6c2c5054 🎉 Merge design-tokens branch
commit b4440aad04
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Fri Nov 8 16:08:07 2024 +0100

    🔧 Fix wrong code in merge

commit 5fee74cea8
Merge: a34207634 4f845b5c4
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Fri Nov 8 12:38:59 2024 +0100

    Merge remote-tracking branch 'origin/develop' into token-studio-develop

commit 4f845b5c4d
Merge: fb3f74e74 960f095c1
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Fri Nov 8 12:38:34 2024 +0100

    Merge remote-tracking branch 'upstream/develop' into develop

commit a34207634b
Merge: a757556e9 2c4eb96ab
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri Nov 8 12:12:31 2024 +0100

    Merge pull request #328 from tokens-studio/fix-merge-issues

    [WIP] Restore style-dictionary prerelease

commit 2c4eb96ab1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 12:03:58 2024 +0100

    Remove comment block

commit 424b930990
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 11:59:08 2024 +0100

    Remove patch file

commit cfd291db5e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 11:46:42 2024 +0100

    Restore default

commit c76569e4b7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 11:40:31 2024 +0100

    Downgrade

commit 456da5a46e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 10:16:29 2024 +0100

    🐛 Fix name on fnc crashing the process

commit 072cec7a22
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Nov 8 09:58:42 2024 +0100

    Add testing block

commit a757556e9c
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 18:32:09 2024 +0100

    Revert "🐛 Fix import of tinycolor2"

    This reverts commit 8e4574888d.

commit 8e4574888d
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 18:17:24 2024 +0100

    🐛 Fix import of tinycolor2

commit 78a1a615d9
Merge: a910f06b2 fb3f74e74
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 14:07:58 2024 +0100

    Merge remote-tracking branch 'origin/develop' into token-studio-develop

commit fb3f74e74f
Merge: 20590a5d1 96f8832bc
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 14:06:45 2024 +0100

    Merge remote-tracking branch 'upstream/develop' into develop

commit 20590a5d18
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 14:02:55 2024 +0100

    🔧 fix

commit e9c32841a9
Merge: 040a94f71 33ff74e53
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Nov 7 13:49:11 2024 +0100

    Merge remote-tracking branch 'upstream/develop' into develop

commit a910f06b2f
Merge: b3b8121d6 3d99c2a5e
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Nov 6 16:26:19 2024 +0100

    Merge pull request #326 from tokens-studio/stroke-context-menu

    [WIP]  Allow setting stroke-color via context-menu

commit 3d99c2a5eb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Nov 6 15:43:20 2024 +0100

     Allow setting stroke-color via context-menu

commit 040a94f719
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Tue Nov 5 13:16:56 2024 +0100

    🔧 Disable tokens in dev env by default

commit b3b8121d60
Merge: 32865c41c a33e0a386
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Nov 4 13:45:44 2024 +0100

    Merge pull request #320 from tokens-studio/fix-dot-rename

    🐛 Fix renaming token to other namespace not working

commit a33e0a386e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Nov 4 13:43:38 2024 +0100

    ♻️Ensure collection return

commit 32865c41c9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 30 08:49:30 2024 +0100

    ♻ Remove zip.js compability warning when starting shadow-cljs

commit 315431fd49
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Mon Nov 4 13:02:32 2024 +0100

    🔧 Update dependencies

commit b47c5f9e60
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Oct 31 15:18:39 2024 +0100

    🐛 Fix sidebar tabs when there are no design tokens

commit a1fd7a912e
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Wed Oct 30 10:52:08 2024 +0100

    🔧 Use bun only for dev env (is needed to run frontend tests)

commit 60761eec07
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 29 17:06:32 2024 +0100

    🐛 Fix renaming token to other namespace not working

commit 62b859b84e
Merge: bc3ab8981 4f7622cb9
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Oct 29 16:27:25 2024 +0100

    Merge pull request #318 from tokens-studio/fix-delete-set

    🐛 When deleting set remove it from theme

commit 4f7622cb93
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 29 14:19:42 2024 +0100

    🐛 When deleting set remove it from theme

commit bc3ab8981e
Author: Eva Marco <evamarcod@gmail.com>
Date:   Fri Oct 25 14:54:00 2024 +0200

    ♻️ Review sets code and add DS components

commit bef648a63f
Merge: cd7763ca0 0923dcc43
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Oct 28 09:06:34 2024 +0100

    Merge pull request #312 from tokens-studio/import-sd-2

     Import: Verify data with StyleDictionary

commit 0923dcc43f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Oct 25 14:40:14 2024 +0200

    ♻ Make `process-sd-tokens` more readable

commit cd7763ca08
Merge: a1c401594 0ff5df4b8
Author: Andrés Moya <hirunatan@hammo.org>
Date:   Thu Oct 24 14:50:56 2024 +0200

    Merge pull request #313 from tokens-studio/eva-review-themes

    ♻️  Review themes section

commit 0ff5df4b8d
Author: Eva Marco <evamarcod@gmail.com>
Date:   Wed Oct 23 16:28:30 2024 +0200

    ♻️ Review themes section

commit f5596b2b3f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 24 10:13:03 2024 +0200

    🐛 Temporary fix for import on sets with groups (/ delimiter)

commit a1c401594c
Merge: 03ea5414b 52d8bed0f
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 24 09:42:25 2024 +0200

    Merge pull request #314 from tokens-studio/fix/deployment

    Fix/deployment

commit 52d8bed0fc
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Oct 24 09:29:38 2024 +0200

    Remove all gimlet and custom workflow code

commit 66dce0e795
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 22 10:14:47 2024 +0200

     Detect reference errors when importing tokens

commit d3ded00bc6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 23 14:13:49 2024 +0200

    🐛 Fix text-editor missing from token tests

commit bf3880a21c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 23 10:05:24 2024 +0200

    🐛 Remove box shadow from supported tokens

commit 951f558d1f
Merge: fa8037c4b 03ea5414b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 23 12:05:58 2024 +0200

    Merge branch 'develop' into token-studio-develop

commit 7debdefa22
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Oct 21 16:03:19 2024 +0200

    🐛 Fix outdated notifications map

commit 03ea5414be
Author: Eva Marco <evamarcod@gmail.com>
Date:   Mon Oct 21 17:14:17 2024 +0200

    ♻️ Review create and edit modal

commit 31b5f5cefa
Author: Eva Marco <evamarcod@gmail.com>
Date:   Mon Oct 21 16:36:47 2024 +0200

    ♻️ Format code

commit 96af0f065d
Merge: 2bdbd81a1 77ba6c135
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Oct 21 10:10:55 2024 +0200

    Merge pull request #310 from tokens-studio/fix-set-rename

    🐛 Keep selection when renaming set

commit 77ba6c135e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Oct 21 10:08:03 2024 +0200

    🐛 Keep selection when renaming set

commit fa8037c4b5
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 17 17:40:25 2024 +0200

    Deploy

commit 2bdbd81a19
Merge: aaac7fb04 9fe4919a2
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 17 17:11:05 2024 +0200

    Merge pull request #308 from tokens-studio/merge-develop-2

    Sync with upstream develop

commit 9fe4919a2b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 17 17:04:19 2024 +0200

    Migrate msg -> ntf

commit 6af6dd1288
Merge: aaac7fb04 b4c2f2eca
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 17 17:03:23 2024 +0200

    Merge branch 'develop' into token-studio-develop

commit aaac7fb041
Merge: 41dc6083c c6ed081a0
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 17 16:41:54 2024 +0200

    Merge pull request #305 from tokens-studio/dtcg-import

    DTCG Tokens Import / Export

commit c6ed081a0b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 10 13:08:35 2024 +0200

     Implement token import / export

commit 41dc6083cf
Merge: bbf5fce0c 85fee87bc
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 10 12:41:38 2024 +0200

    Merge pull request #298 from tokens-studio/dnd

    Sets Drag & Drop

commit 85fee87bc4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 8 10:24:07 2024 +0200

    🎉 Token Sets dnd re-ordering

commit a85a7d2b2f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 8 17:09:58 2024 +0200

    🐛 Fix logic in oassoc-in-before wher top items couldn't be move to bottom

commit bbf5fce0c9
Merge: bc4969c25 07beef572
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Oct 9 13:21:38 2024 +0200

    Merge pull request #297 from tokens-studio/feature-flag

     Add feature flag for design tokens

commit 07beef5727
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 9 11:00:51 2024 +0200

    Remove $PENPOT_FLAGS from frontend deployment

commit 11c8fa468f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 9 10:30:59 2024 +0200

    Manually override ff flags

commit b0ec9034dc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 9 10:09:45 2024 +0200

    Enable FF for gimlet

commit 18e0948b0c
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Mon Oct 7 14:16:08 2024 +0200

     Add feature flag for design tokens

commit bc4969c25d
Merge: d58932c2e 2baa1aa73
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 3 15:44:02 2024 +0200

    Merge pull request #296 from tokens-studio/fix-reference-color-preview

    Fix reference color preview

commit 2baa1aa734
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 3 15:30:39 2024 +0200

    Show resolved color

commit b3e73b9abc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 3 15:18:41 2024 +0200

    Move over helper

commit 5de1f450c1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Oct 3 15:14:38 2024 +0200

    Move over token value reference check function

commit d58932c2e5
Merge: 6f086326f 69cc9d02b
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Oct 3 13:26:27 2024 +0200

    Merge pull request #290 from tokens-studio/refactor-themes-sets

    Refactor themes sets

commit 69cc9d02ba
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 17:23:04 2024 +0200

    Cleanup: item->token

commit d097b5b179
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 17:10:26 2024 +0200

    Cleanup

commit 921f4a6660
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 17:10:07 2024 +0200

    Restore all logic tests

commit 1097c1f282
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 17:02:10 2024 +0200

    Restore apply overwrite

commit f9a49f82f8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 17:00:31 2024 +0200

    Restore apply-multiple

commit f2900c6519
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 16:57:53 2024 +0200

    Cleanup: Sort

commit 1df40ea07a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 16:57:20 2024 +0200

    Restore apply-tokens test

commit eceffda095
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 16:47:17 2024 +0200

    Added todo

commit e55f323d60
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 15:47:59 2024 +0200

    Fix tests

commit 2634388d09
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:37:24 2024 +0200

    Remove logging

commit fa6b8cb6de
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:31:56 2024 +0200

    Use d/nilf

commit 2b6075d1a2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:21:18 2024 +0200

    Cleanup

commit 306a5e5f85
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:20:27 2024 +0200

    Sets don't have a specific order inside themes

commit 5170d328bd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:19:02 2024 +0200

    Fix docstring

commit 4a818d55c8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:18:49 2024 +0200

    Rename, fix docstring

commit bbdc9e95f7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:17:20 2024 +0200

    Add todo

commit b12d5938e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:10:41 2024 +0200

    Replace generic arg name

commit 041e04dcb1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 14:09:51 2024 +0200

    Remove unneeded ->

commit a235327c3e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 11:33:14 2024 +0200

    Cleanup

commit 0ffcda404b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 11:09:52 2024 +0200

    Cleanup

commit 93cc8214fa
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 11:05:39 2024 +0200

    Fix border-radius and sizing panels

commit 845de5d885
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 10:52:48 2024 +0200

    Fix export

commit fdca6e4edf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 10:46:55 2024 +0200

    Fix measures options

commit 028809f1d5
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 10:22:09 2024 +0200

    Cleanup

commit 053d0fc923
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 10:15:35 2024 +0200

    Cleanup function

commit 0b081d24e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 10:03:34 2024 +0200

    Only show warning when string has /

commit 669594e3c1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 09:42:56 2024 +0200

    Cleanup

commit 57a133e09d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 09:42:49 2024 +0200

    Add ordered tokens test

commit 43e5367988
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Oct 2 09:42:42 2024 +0200

    Fix testing from cljs

commit fa3e2c90e6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 15:45:14 2024 +0200

    Fix renaming via context menu

commit 7418d1fa2c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 15:42:09 2024 +0200

    Dont support token set grouping for now

commit 3681678dc4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 14:40:05 2024 +0200

    Migrate token tests to tokens-lib

commit bca4ea3819
Merge: 9268b18e5 6f086326f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 12:58:26 2024 +0200

    Merge remote-tracking branch 'origin/token-studio-develop' into refactor-themes-sets

commit 9268b18e56
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 12:53:01 2024 +0200

    Fix edit button

commit f1f2767e2a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 12:49:03 2024 +0200

    Activating initial sets by adding them to the token theme

commit 5825fa656b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 09:56:03 2024 +0200

    Fix tests

commit 993df23624
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 09:55:58 2024 +0200

    Remove unneeded tests

commit 442732117b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 09:55:23 2024 +0200

    Disable logic tests for now (nee new setup)

commit 0d870610e1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Oct 1 09:14:54 2024 +0200

    Fix infer warnings in tokens test

commit 231baac31d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 16:41:51 2024 +0200

    Fix renaming token creating new token

commit 4b39b6970a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 16:26:26 2024 +0200

    Fix theme sets not being in order of the root order

commit c5173d2df8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:33:17 2024 +0200

    Remove hidden token theme when activating a theme

commit 0ea0834b1a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:21:15 2024 +0200

    Cleanup

commit bfa90d0347
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:18:26 2024 +0200

    Fix duplicate token event

commit b0d46e1767
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:15:05 2024 +0200

    Cleanup

commit 3182ff1e15
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:08:18 2024 +0200

    Cleanup

commit dc0a1c1555
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:07:22 2024 +0200

    Cleanup

commit 18d120bbaa
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 15:04:12 2024 +0200

    Fix token creation without set

commit c75ab61732
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 14:44:42 2024 +0200

    Fix renamed theme staying in active-themes

commit df8f67b5d3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 13:52:50 2024 +0200

    Update workspace tokens

commit 1194eb7c61
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 09:39:11 2024 +0200

    Remove unused functions

commit a49992a74e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 09:38:01 2024 +0200

    Fix token updating

commit 5d61ddb385
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 09:33:35 2024 +0200

    Fix property applying

commit a59e391b38
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 09:19:06 2024 +0200

    Fix token deletion menu

commit cfec4ae958
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 09:08:14 2024 +0200

    Cleanup

commit 99a3ed98c9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 08:46:31 2024 +0200

    Only load context menu when open

commit 8c58ed80ac
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 08:31:18 2024 +0200

    Fix id

commit 066ee9c489
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 30 08:23:22 2024 +0200

    Tokens in sidebar

commit cce4014fbe
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 27 15:36:07 2024 +0200

    Fix token create

commit b7cedf219b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 27 11:21:30 2024 +0200

    Cleanup

commit 93ed1ded17
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 27 11:14:34 2024 +0200

    Token resolving on add fixed

commit 1d50bacfbc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 17:21:02 2024 +0200

    Fix set renaming not being updated in themes

commit 7c4cbe5265
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 16:40:38 2024 +0200

    Cleanup

commit 2f13814285
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 16:37:30 2024 +0200

    Cleanup

commit 9f2b96332c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 16:16:44 2024 +0200

    Fix up active themes tokens method

commit 577fa2bc81
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:38:36 2024 +0200

    Cleanup

commit c8494c9931
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:32:46 2024 +0200

    Remove unused

commit 3843253a5d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:27:16 2024 +0200

    Dont render starting slash

commit 5f6a76dfce
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:24:02 2024 +0200

    Use currently active sets as sets for temporary theme

commit 29a2478bb5
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:15:50 2024 +0200

    Fix theme group drop-down not updating group value

commit b3ff480e81
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 15:08:54 2024 +0200

    Hide temporary theme

commit 2104fc04df
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 14:28:27 2024 +0200

    Fix theme select

commit 9c97b31d28
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 13:21:53 2024 +0200

    Fix theme creation/editing

commit 895f92e7c2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 12:03:03 2024 +0200

    Hide temporary token theme from user

commit e216d84484
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 26 11:28:14 2024 +0200

    Set toggling without a theme

commit 6f086326f5
Merge: 2f4a012be c755b764a
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 25 16:22:20 2024 +0200

    Merge pull request #289 from tokens-studio/revert-288-active-themes

    Revert "Adds `active-themes` to `TokensLib`"

commit c755b764a2
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 25 16:21:53 2024 +0200

    Revert "Adds `active-themes` to `TokensLib`"

commit 0b2b8a71fb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 15:08:52 2024 +0200

    Token deletion

commit 9c1a509fa4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 14:59:20 2024 +0200

    Set renaming

commit d2ed6b5501
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 14:45:31 2024 +0200

    Add set

commit 2f4a012beb
Merge: fb38e4378 6d75993fd
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 25 13:48:41 2024 +0200

    Merge pull request #288 from tokens-studio/active-themes

    Adds `active-themes` to `TokensLib`

commit 99e551925a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 11:08:54 2024 +0200

    Updates

commit 4d4c4355ad
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 08:33:34 2024 +0200

    Selection by name

commit ec96e7918d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 25 08:16:29 2024 +0200

    Token theme deletion

commit 844819a50c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 15:25:29 2024 +0200

    Activate themes via lib

commit 4c327f38ef
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 23 15:18:46 2024 +0200

    Replace sets

commit f5c122b0db
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 20 14:42:48 2024 +0200

    Remove legacy

commit c6770f43c7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 20 14:38:53 2024 +0200

    Move out of legacy

commit 43e5e78053
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 20 14:35:47 2024 +0200

    Cleanup

commit f5249196f9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 20 14:27:19 2024 +0200

    Sets sidebar

commit 501256f16b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Sep 20 09:34:54 2024 +0200

    Disable namespace loading info in console from shadow-cljs

commit 9b2993a344
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 19 16:22:47 2024 +0200

    Fix theme select

commit 191d957984
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 19 16:06:53 2024 +0200

    Use theme listing

commit 743f61f2cd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 19 15:44:56 2024 +0200

    Adding themes

commit 7758e48c48
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 19 10:52:15 2024 +0200

    Add legacy macro

commit 80e8903754
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 19 10:26:17 2024 +0200

    Refactor: Use tokens-lib for getting tokens theme

commit 6d75993fd7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 14:24:35 2024 +0200

    Move theme-path impl to ITokenTheme

commit 49579d75c6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 13:42:56 2024 +0200

    Simplify as this

commit d7d974242e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 11:18:12 2024 +0200

    Add active-themes to data serialization tests

commit f2569a1c4a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 11:13:41 2024 +0200

    Cleanup

commit 44e4e85201
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 11:10:07 2024 +0200

    Add schema validation

commit 5e39f33bff
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 24 11:06:12 2024 +0200

    Rename with theme prefix

commit 416297d298
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 23 17:37:16 2024 +0200

    Implement active-themes

commit fb38e4378a
Merge: 1a9d703bb 5b7b343f6
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 18 18:10:42 2024 +0200

    Merge pull request #273 from tokens-studio/color-token

    Color token

commit 5b7b343f62
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 17:25:55 2024 +0200

    Cleanup

commit f5b62a5fc1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 17:23:42 2024 +0200

    Style the form to fit the color ramp exactly

commit 8804d1432e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 17:15:45 2024 +0200

    Update the input field value when chosing color from color ramp

commit 6084c49582
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 17:03:18 2024 +0200

    Share color picker effect to set hue slider css variables

commit 2a3fc9e7bd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 17:03:08 2024 +0200

    Pointer

commit 061cd08e66
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:43:35 2024 +0200

    Remove unused functions

commit 48a8b1bc55
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:30:32 2024 +0200

    Fix color updating

commit c007170603
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:28:31 2024 +0200

    Cleanup

commit b68e7af844
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:27:30 2024 +0200

    Use tinycolor to convert hex color

commit e0e7b98ed7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:21:43 2024 +0200

    Docstring

commit 3bd2278dec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 11:15:11 2024 +0200

    Use penpot logging system instead of custom debug flag

commit 77141887a8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 10:57:05 2024 +0200

    Pass in value with error

commit 3a21643158
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 10:38:16 2024 +0200

    Add shared error handling

commit 308fff05c3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 18 10:19:59 2024 +0200

    Dont show name error when editing new token and not touching name field

commit 49ff0df7f6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 17 16:35:08 2024 +0200

    Add tinycolor bindings

commit 3c4e0e2447
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 16 16:57:01 2024 +0200

    Add color ramp

commit ac51309f81
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Sep 16 15:59:04 2024 +0200

    Add placeholder color swatch

commit 2b886c54e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 29 12:52:18 2024 +0200

    Color ramp wip

commit 0b29767c95
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 30 11:51:21 2024 +0200

    Add color token

commit 1a9d703bb1
Merge: 0697e6988 f0a9444ab
Author: Andrés Moya <hirunatan@hammo.org>
Date:   Wed Sep 18 11:00:06 2024 +0200

    Merge pull request #284 from tokens-studio/refactor-theme-groups

    tokens-lib refactor: Get collection of theme groups

commit f0a9444ab6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 17 10:48:23 2024 +0200

    tokens-lib refactor: Get collection of theme groups

commit 0697e69888
Merge: 1d7536687 0e15da5ed
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Sep 17 09:44:00 2024 +0200

    Merge pull request #283 from tokens-studio/refactor-types-2

    Refactor types 2

commit 0e15da5ede
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Tue Sep 17 00:51:33 2024 +0200

    🔧 Make tokens again a flat ordered map

commit 5f703d6a79
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Mon Sep 16 17:47:05 2024 +0200

    🔧 Make themes a two-level only tree

commit 3a4ec32f8e
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Sep 12 10:04:03 2024 +0200

    🔧 add groups handling v2

commit e2ff6f7ba6
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Sep 5 17:51:02 2024 +0200

    🔧 Add first draft of token set groups attributes

commit fa8f8ac54b
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Thu Sep 5 16:49:29 2024 +0200

    🔧 add groups handling

commit 316d333c96
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Wed Sep 4 02:00:31 2024 +0200

    🔧 Add token themes in tokens-lib custom type

commit 1d7536687a
Merge: 6cba685e8 27073e22e
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Sep 12 17:27:39 2024 +0200

    Merge pull request #282 from tokens-studio/enable-ff

    Enable sets/themes for all

commit 6cba685e87
Merge: 6f37a43be a1e4d6b3b
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Sep 12 13:17:26 2024 +0200

    Merge pull request #281 from tokens-studio/token-refactor-common

    Fixes missing name attribute

commit 27073e22e3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 12 13:16:35 2024 +0200

    Enable sets/themes for all

commit a1e4d6b3b3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 12 10:36:05 2024 +0200

    Fix context menu missing name param

commit 309476fdfd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Sep 12 10:23:45 2024 +0200

    Cleanup

commit 6f37a43be1
Merge: 361b02a76 0dca04733
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 11 15:35:45 2024 +0200

    Merge pull request #262 from tokens-studio/refactor-types-1

    🔧 Add tokens-lib custom type

commit 361b02a76a
Merge: 1568a7afb 0cd7d4dd7
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 11 15:11:22 2024 +0200

    Merge pull request #279 from tokens-studio/fix-inspect-tokens-tab

    Disable tokens tab in inspect mode

commit 1568a7afb5
Merge: f5ab6e65f 20e2c4edb
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 11 15:11:02 2024 +0200

    Merge pull request #278 from tokens-studio/fix-set-token-name

    Allow giving name of tokens in other sets

commit 0cd7d4dd7a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 11 11:09:06 2024 +0200

    Disable tokens tab in inspect mode

commit f5ab6e65fc
Merge: 012e79603 56374171d
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 11 11:02:55 2024 +0200

    Merge pull request #277 from tokens-studio/group-select-themes

    Themes & Sets: Add groups select to modal

commit 20e2c4edb1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Sep 11 10:17:46 2024 +0200

    Allow giving name of tokens in other sets

commit 012e79603f
Merge: 27409f43d 9876c2e4f
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Sep 11 09:09:51 2024 +0200

    Merge pull request #276 from tokens-studio/token-sets-context-menu

    Token Sets & Themes: Sets context menu

commit 56374171d6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 15:44:11 2024 +0200

    Fix theme groups not showing up in create state

commit 281b801112
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 15:42:44 2024 +0200

    Show dropdown only when groups exist

commit 21f42021d8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 15:37:01 2024 +0200

    Add groups select

commit df16d0c222
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 15:16:52 2024 +0200

    Add abstract dropdown component

commit d54c5476d8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 14:33:45 2024 +0200

    Add dropdown button

commit 9876c2e4fc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Sep 10 12:51:07 2024 +0200

    Add context menu

commit 0dca047339
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Tue Sep 3 14:20:55 2024 +0200

    fix token update

commit d147d844fb
Author: Andrés Moya <andres.moya@kaleidos.net>
Date:   Fri Aug 16 12:11:18 2024 +0200

    🔧 Add tokens-lib custom type

commit 27409f43d2
Merge: 734acd27b ae5aaf833
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri Aug 30 11:15:31 2024 +0200

    Merge pull request #264 from tokens-studio/token-sets-themes-ui

    Token sets themes UI

commit ae5aaf8332
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 29 16:02:22 2024 +0200

    Cleanup

commit 54b754c38c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 29 16:01:31 2024 +0200

    Cleanup

commit ca611c6668
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 29 15:59:58 2024 +0200

    Cleanup

commit 6bae2efe9d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 29 14:26:11 2024 +0200

    Validate against names in all token sets

commit 734acd27b9
Merge: 93ce6b6eb 1ed6d92d8
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Aug 27 17:09:47 2024 +0200

    Merge pull request #263 from tokens-studio/token-sets-themes

    Token sets themes

commit e363b58774
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 15:22:02 2024 +0200

    HACK: Fix empty sets showing up in listing

commit b24b178e29
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 15:00:15 2024 +0200

    Make resizable

commit d6823e8583
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:49:11 2024 +0200

    Always switch to temporary theme when toggling sets in sidebar

commit 3bb99e8f7c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:37:24 2024 +0200

    Remove default theme name, disable empty themen name submit

commit 3b7432a859
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:32:26 2024 +0200

    Use non editable context in form

commit 4dd3367bdd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:26:06 2024 +0200

    Allow creating token sets

commit d4910ce2fc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:25:52 2024 +0200

    Auto select new token sets

commit 4f96550bca
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 14:13:29 2024 +0200

    Use context

commit db22beb857
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 10:20:38 2024 +0200

    Fix iterating over unordered sets

commit 965016b63f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 27 10:04:12 2024 +0200

    Allow token renaming

commit 293250a30d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 16:35:49 2024 +0200

    Rename

commit 1d599cbf7d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 16:33:07 2024 +0200

    Always render ungroupd themes first

commit 0d2d1a8b8a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 16:23:23 2024 +0200

    Link up actions

commit cb46e11162
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 16:14:27 2024 +0200

    Add edit button

commit c807baaf7a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 15:54:44 2024 +0200

    Add custom select with grouped options

commit f25db592a0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 15:07:58 2024 +0200

    Clone over select

commit 2e23543c11
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 15:04:45 2024 +0200

    Show create text when no theme is available

commit 4060b6d40f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 15:02:38 2024 +0200

    Style empty state, jump to create theme dialog when no themes exist

commit 7cd9c60fb6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:36:00 2024 +0200

    Disable user-selection

commit 5939db771e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:34:41 2024 +0200

    Link up delete button & fix create theme ui jumping

commit 1405720e0b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:32:21 2024 +0200

    Cleanup

commit b5e08c5b8b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:32:01 2024 +0200

    Add theme creation form

commit f37cf8be5e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:31:34 2024 +0200

    Add defaults for theme form

commit 84b5be5547
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:17:37 2024 +0200

    Fix button being chosen as main button for form submit

commit 7aff690e7b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 14:17:30 2024 +0200

    Wire up theme updating

commit 70b570f112
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 13:49:57 2024 +0200

    Show only on create

commit 36f92aa241
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 13:47:44 2024 +0200

    Allow group and name updating

commit a0dd3f63bf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 13:41:02 2024 +0200

    Allow controlling state of theme editing

commit fe702988f9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 26 13:40:49 2024 +0200

    Cleanup

commit 12e915dec8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 17:48:43 2024 +0200

    Style edit button

commit a52e20f49d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 17:22:05 2024 +0200

    Cleanup

commit 967fab416a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 17:20:20 2024 +0200

    Add back button

commit 3ce2531b42
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 17:11:38 2024 +0200

    Design

commit db1250a315
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 17:07:47 2024 +0200

    Add footer buttons

commit 6f7b69c7ee
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 16:58:49 2024 +0200

    Allow toggling individual set themes

commit 7e7203eb7c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 16:44:11 2024 +0200

    Allow passing custom functions

commit 8a20e3a698
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 16:34:33 2024 +0200

    Allow tokens sets component to be controlled

commit 1c0233098d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 16:28:06 2024 +0200

    Add sets list for theme

commit c7fa0f2cf8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 16:27:42 2024 +0200

    Cleanup

commit cac421f862
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 15:41:32 2024 +0200

    Design

commit 7970440ffc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 15:30:17 2024 +0200

    Toggle theme via ui

commit cc7de14539
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 15:08:53 2024 +0200

    Add basic toggle switch

commit d23c5cbbbe
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 14:53:22 2024 +0200

    Move the temporary ui to modal

commit b62722bdbb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 14:11:13 2024 +0200

    Add themes modal dialog

commit 1ed6d92d87
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 13:36:46 2024 +0200

    Remove margin

commit b48bfde5c8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 11:43:19 2024 +0200

    Automatically open when creating set

commit 1cc1d94a27
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 11:42:14 2024 +0200

    Automatically open when adding token

commit 40846b87c2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 11:39:13 2024 +0200

    Add tokens header

commit acc3606cbb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 11:36:54 2024 +0200

    Align Eye

commit 97f119f3da
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 11:32:54 2024 +0200

    Add delete set action button

commit 88c899c5c6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 10:17:52 2024 +0200

    Wrap themes ui in header

commit a9a5f69c93
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 10:15:37 2024 +0200

    Cleanup

commit bac16aadd8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 23 10:14:45 2024 +0200

    Migrate to official UI

commit b1cf641587
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 14:56:41 2024 +0200

    Fix cancelling set prompt breaking user state

commit e4f01d1d5e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 11:59:06 2024 +0200

    Fix logic

commit 157cc5a994
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 11:21:53 2024 +0200

    Automatically show themes and sets on dev and PR previews

commit 37a3fbcec2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 11:02:01 2024 +0200

    Fix not possible naming token to same token name in other set

commit 8343a9f3b5
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 10:59:40 2024 +0200

    Fix description

commit 4b47fa5d7a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 10:58:31 2024 +0200

    Fix names clash

commit 7a2a521075
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 10:54:41 2024 +0200

    Allow passing config

commit 6c802bc132
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 22 09:37:47 2024 +0200

    Rename

commit c130dc39c3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 19:11:53 2024 +0200

    Resolve tokens from other active sets

commit 8264da3a2a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 15:36:40 2024 +0200

    Use active sets tokens for form

commit 6c6be35292
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 15:12:13 2024 +0200

    Fix token updates not taking order

commit 011fc734f6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 14:42:39 2024 +0200

    Make passing of names-map explicit

commit 7c3716a709
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:18:52 2024 +0200

    Move temporary ui behind flag

commit 98207b02bf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:18:47 2024 +0200

    Remove log

commit 0df89cf60d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:17:12 2024 +0200

    Use storage to toggle themes ui

commit 2df577cba2
Merge: 4e81a94d0 93ce6b6eb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:04:00 2024 +0200

    Merge remote-tracking branch 'origin/token-studio-develop' into token-sets-themes

commit 4e81a94d0f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:03:39 2024 +0200

    Remove unused functions

commit 4f02d8b47d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 11:01:23 2024 +0200

    Fix multi run test

commit 74801e72d3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 10:54:22 2024 +0200

    Fix simple token creation / scaffolding test

commit cfefbadb64
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 21 10:29:14 2024 +0200

    Fix id

commit 93ce6b6eb3
Merge: 9dd681c15 f9704fe7a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 22:14:51 2024 +0530

    Merge pull request #256 from tokens-studio/token-sets-ui

    Token sets UI

commit f9704fe7aa
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 20 18:40:02 2024 +0200

    Fix padding without sets

commit 2487f34b72
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 21:34:07 2024 +0530

    formatting

commit b3e939d12a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 21:30:59 2024 +0530

    add a hardcoded flag to display/hide token sets section

commit 247e3a1559
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 21:25:22 2024 +0530

    fix some styling issues

commit 5b1eaf4b8f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 20:55:02 2024 +0530

    remove unused prop and some optimizations

commit 463ab3c866
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 20:41:25 2024 +0530

    change current-set to selected-set

commit 5358cd1c52
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 20 16:14:32 2024 +0200

    Fix tests crashing

commit 3a2f4df387
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 17:08:31 2024 +0530

    add source code comment

commit 1a3184d327
Merge: 187ab3166 9dd681c15
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 17:02:00 2024 +0530

    Merge branch 'token-studio-develop' into token-sets-ui

commit 187ab31667
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 17:00:19 2024 +0530

    format

commit feb5cec84b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:57:53 2024 +0530

    ad sets-section wrapper

commit f052b75dac
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:38:18 2024 +0530

    formatting

commit e62323ac0a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:35:33 2024 +0530

    add variable

commit d4c88d4441
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:32:36 2024 +0530

    remove folder open icon

commit 4bad9fa6f8
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:30:51 2024 +0530

    add chevron icon

commit e4f5b6005e
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 16:30:38 2024 +0530

    move sets-sidebar component to sidebar tokens

commit 98b5791e27
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 20 15:37:37 2024 +0530

    remove set-item-set-selected and remove class

commit 6049c32839
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 15:46:42 2024 +0200

    Compute tokens from each activated set

commit 8e02dced2f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 10:49:46 2024 +0200

    Extract to function

commit 97436531d0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 10:46:48 2024 +0200

    Showing only active sets

commit 8660c372dc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 09:41:23 2024 +0200

    Add theme deletion

commit 3413d4b42f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 09:09:09 2024 +0200

    Add tests

commit 93a23c66ec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 09:01:08 2024 +0200

    Docstrings

commit e8bbb75008
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 08:49:03 2024 +0200

    Implement group theme switching

commit 9a745ea8bc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 08:05:19 2024 +0200

    Add active theme toggling

commit f0e0e9334e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 19 07:29:20 2024 +0200

    Cleanup

commit ae1c30ad56
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 14:22:56 2024 +0200

    Allow providing set name

commit e502def755
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 14:21:25 2024 +0200

    Show themes

commit 62712ef8da
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 13:59:18 2024 +0200

    Cleanup styles

commit 6a7ced3204
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 13:36:54 2024 +0200

    Add token set visibility toggle

commit 636c3b822c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 12:22:57 2024 +0200

    Example styling

commit c2a045ad5b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 11:44:41 2024 +0200

    Add selected sets UI

commit 0f95ddef8f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 11:32:36 2024 +0200

    Add new sets to active theme

commit 3e41e7d234
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 11:32:20 2024 +0200

    Fix workspace-data key missing

commit 879ef1123f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 10:32:59 2024 +0200

    Create temporary theme when creating set

commit 9329513949
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 08:04:41 2024 +0200

    Add token set deletion

commit ae39586d8c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 07:10:15 2024 +0200

    Add temporary theme

commit 4c1bc81b19
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 07:10:08 2024 +0200

    Add name

commit 7406af2e79
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 07:09:59 2024 +0200

    Add theme creation

commit 8482a128de
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 07:09:17 2024 +0200

    Fix expeted id instead of set

commit 3695ba3438
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 07:09:07 2024 +0200

    Add token theme data scaffold

commit 35759792a3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 06:24:15 2024 +0200

    Render grouped themes ui

commit f0aaa29d66
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 06:24:03 2024 +0200

    Add type functions

commit cefa498f4d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 16 06:23:53 2024 +0200

    Add group and selected properties to theme

commit f3d4346c0d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 18:52:42 2024 +0200

    Add create token-set event

commit 1f0c1dbbe6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 18:52:31 2024 +0200

    Update shapes on token set switch

commit 587a2936e6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 18:26:37 2024 +0200

    Add simple UI

commit 73078d802a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 18:26:20 2024 +0200

    Add refs

commit eaf568f154
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 14:26:22 2024 +0200

    Get tokens from current or first token set

commit ead8a983ab
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 14:26:12 2024 +0200

    Move to token-set namespace

commit 9dd681c156
Merge: b2962b560 43e064a76
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Aug 15 12:28:19 2024 +0200

    Merge pull request #254 from tokens-studio/fix-token-editing

    Fix token editing

commit 43e064a768
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 10:12:45 2024 +0200

    Update doc string

commit 4bd3b14adb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 10:07:12 2024 +0200

    Add unit to tests

commit e4e488a9ee
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 10:03:25 2024 +0200

    Adds style-dictionary test

commit c6d13af071
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 09:21:49 2024 +0200

    Fix validation not working while editing [*]

    [*] We've passed the resolved tokens to the validation,
    but the validation needs the original tokens set.

commit 6be2ca8491
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 15 09:21:18 2024 +0200

    Fix resolved value not showing up when editing token

commit b2962b5603
Merge: c7d4db900 ecf4fb8bd
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Aug 14 19:41:36 2024 +0200

    Merge pull request #251 from tokens-studio/fix-spacing-token

    Fixes design tab spacing token

commit ecf4fb8bd0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 14 16:52:46 2024 +0200

    Fix popover position

commit 1ba2acea7c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 14 16:39:43 2024 +0200

    Fix crash for applying spacing layout token

commit cf9ef2ae60
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 14 15:33:24 2024 +0200

    Remove unused function

commit 74c6228c25
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Aug 14 17:15:30 2024 +0530

    add dom/stop-propagation

commit 188e7d220a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 14 09:25:17 2024 +0200

    Fix name

commit c7d4db900e
Merge: d8621974c 726b0a267
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Aug 14 09:16:23 2024 +0200

    Merge pull request #245 from tokens-studio/use-token-name-ref

    Use token name ref

commit 1135b7e2db
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 18:30:00 2024 +0200

    Update token sets

commit 71439637aa
Merge: 21c42626a d8621974c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:56:06 2024 +0530

    Merge branch 'token-studio-develop' into token-sets-ui

commit 21c42626ae
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:51:31 2024 +0530

    remove comment

commit 007cf0fb8a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:50:55 2024 +0530

    remove comments and unused import

commit 46c73fe51f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:44:08 2024 +0530

    formatting

commit 66170eb889
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:42:08 2024 +0530

    make current-set-id the key on div element

commit 68c0d93f91
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:12:38 2024 +0530

    change sets list div to ul

commit 7addba71fb
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 21:07:52 2024 +0530

    remove debug statements

commit 950257a212
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 20:42:42 2024 +0530

    change eye icon size

commit 9aadb8c72f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 16:18:24 2024 +0200

    Add test

commit fa230a4224
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 19:31:34 2024 +0530

    add folder-open icon and use for open groups

commit 2f2ed0a42f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 15:45:38 2024 +0200

    Cleanup

commit a4865522cc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 15:25:36 2024 +0200

    Select token set on create

commit ba31914ca4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 14:41:58 2024 +0200

    Fix typo

commit c275923621
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 14:41:49 2024 +0200

    Fix indent

commit ec01ce7550
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 14:41:18 2024 +0200

    Ensure vector

commit bcd4b6d9ec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 13:31:43 2024 +0200

    Fix schema errors

commit 547358d579
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 13 11:57:06 2024 +0200

    Add token set changes

commit bcf61f34fe
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 14:11:30 2024 +0530

    add current set and selected set

commit ad9a4e7244
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Aug 13 01:17:18 2024 +0530

    Add full lenght highlight

commit 9ff3a135a8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 12 10:50:47 2024 +0200

    Cleanup

commit 6c3415b92c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 14:56:11 2024 +0200

    Differentiate groups and sets

commit dbddd7fb68
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 14:26:30 2024 +0200

    Add token themes & sets schema

commit 726b0a2671
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 9 18:04:33 2024 +0200

    Fix :applied-tokens not being updated

commit 51a27c07ec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 9 18:03:47 2024 +0200

    Use token identifier

commit 9ff4567955
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 9 18:03:20 2024 +0200

    Remove unused function

commit 5552295d61
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Aug 9 17:37:36 2024 +0200

    Add docstring

commit b93b0b209a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Aug 8 21:40:35 2024 +0530

    Add hover styles and collapse capabilities

commit bb3a22a219
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Aug 8 18:46:58 2024 +0530

    add hide/show icon

commit e992bf0aa6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 15:13:04 2024 +0200

    Fix sizing test

commit 8b8b909fb7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 15:12:28 2024 +0200

    Parse values with unit

commit 2d67a92d64
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:39:58 2024 +0200

    Fix getter

commit a073520d0e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:22:40 2024 +0200

    Restore tests to work with new identifier

commit e27e2d357c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:09:12 2024 +0200

    Add simple applying test

commit d98e982664
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:07:32 2024 +0200

    Cleanup

commit 31674db11d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:07:24 2024 +0200

    Skip parsing on numbers

commit 0684d893e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 11:06:49 2024 +0200

    Return resolved & parsed token names map

commit 37f23855e8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 09:52:51 2024 +0200

    Fix re-find only accepting string values throw

commit 2e8e33d701
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 09:40:26 2024 +0200

    Add token value parsing function

commit 980238e27b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 8 09:22:32 2024 +0200

    Move find-token-references to token namespace

commit b28a45c2d8
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Aug 8 00:14:36 2024 +0530

    add more changes working tree display

commit fcea989586
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Aug 7 22:39:41 2024 +0530

    add more changes

commit 1434ddb5d5
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Aug 7 20:58:21 2024 +0530

    change fotn color

commit 252797183c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 7 15:14:32 2024 +0200

    Use :name as the token identifier [*]

    [*] Using uuid as the token identiefier for :applied-tokens is not
    correct as we want to merge all sets together by their name, to get the
    final values.

commit d8621974c2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 7 17:14:05 2024 +0200

    Update with upstream

commit 192f847d50
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 7 17:13:39 2024 +0200

    Ignore rxjs errors

commit c9673ca828
Merge: d7ee804ca 22f3dba84
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 7 16:21:08 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit d7ee804ca3
Merge: eb9b4be6e edb89bccc
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Aug 7 12:53:02 2024 +0200

    Merge pull request #243 from tokens-studio/fix-tests

    Temporary fix for tests

commit edb89bcccb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Aug 7 12:38:24 2024 +0200

    Temporary fix for tests [*]

    [*] Async tests got broken with the latest upstream.

    This will still print a bunch of warnings from rxjs but the tests are
    still running.

commit eb9b4be6ea
Merge: e02611da2 4ae467987
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Aug 7 08:26:08 2024 +0200

    Merge pull request #241 from tokens-studio/sync-master

    Sync penpot master

commit 02a19a6b33
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Aug 7 00:57:13 2024 +0530

    Next commit

commit 22e497398f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Aug 7 00:08:12 2024 +0530

    Initial commit

commit 4ae467987a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 11:25:31 2024 +0200

    Update changes

commit 3bd0318999
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 11:16:38 2024 +0200

    Update lock file

commit dd8780db69
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 11:16:30 2024 +0200

    Use register

commit 5fbbdd36fd
Merge: e02611da2 36ac81bb4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Aug 6 11:06:51 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit e02611da20
Merge: 57c9d6d3a f7e770192
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Aug 6 10:31:13 2024 +0200

    Merge pull request #238 from tokens-studio/213-opacity-fixes-03

    Fixes Opacity

commit f7e7701923
Merge: 6cb3afe87 57c9d6d3a
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Aug 6 08:23:39 2024 +0200

    Merge branch 'token-studio-develop' into 213-opacity-fixes-03

commit 57c9d6d3a9
Merge: 3c7261e75 fe9bb69c7
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Aug 6 06:38:31 2024 +0200

    Merge pull request #239 from tokens-studio/236-stroke-width-fix

    Fix stroke width applying crash

commit fe9bb69c75
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 11:45:32 2024 +0200

    Update CHANGELOG

commit c9d1fe44e9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 11:43:46 2024 +0200

    Add stroke-width test

commit 2a97749d23
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 11:42:36 2024 +0200

    Add shape property passing

commit 3826afb76b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 11:18:19 2024 +0200

    Fix applying stroke

commit 6cb3afe87f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 11:05:49 2024 +0200

    Add opacity tests

commit 62a9dd6582
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 10:54:46 2024 +0200

    Cleanup

commit ad468582b3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 10:53:59 2024 +0200

    Add changelog

commit c29024bd62
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Aug 5 10:51:35 2024 +0200

    Dont update values outside of 0..1 (e.g.: 20)

commit 1f88c8288a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 11:08:15 2024 +0200

    Parse double to preserve opacity

commit 3c7261e75b
Merge: ab72bdf09 72c5c3ec9
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri Aug 2 08:56:30 2024 +0200

    Merge pull request #231 from tokens-studio/update-token-shapes

    Update token shapes

commit 72c5c3ec9a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 15:45:37 2024 +0200

    Cleanup

commit 13163a4571
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 15:37:53 2024 +0200

    Clean up debugging code

commit 0c757f05e3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 15:37:39 2024 +0200

    Apply actions directly

commit fc6d64fb5d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 15:32:33 2024 +0200

    Fix import

commit 518441e582
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 12:12:03 2024 +0200

    Fix spacing token click will add padding

commit fdce370bb6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 12:05:15 2024 +0200

    Disable debug

commit 9ebd743635
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 11:09:36 2024 +0200

    Testing comment

commit cc6f34f78a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 11:07:02 2024 +0200

    Fix trying to update shapes for deleted tokens crash

commit feb438f882
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 10:41:45 2024 +0200

    Safety net

commit 68b32448d1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 10:41:03 2024 +0200

    Fix exact match of diff adding nil attrs group and crashing the app

commit ac27f95091
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 09:41:28 2024 +0200

    Fix undo deleting the token on update

commit 68415b6668
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 09:14:21 2024 +0200

    Update tokens after shape update

commit e52623c728
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Aug 1 09:13:58 2024 +0200

    Update shapes in one undo step, resolve tokens from state not cache atom

commit a1fefe66ae
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 31 17:26:50 2024 +0200

    Working updates!

commit d22234fe2a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 31 16:51:55 2024 +0200

    Cleanup

commit 0166c38486
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 31 16:43:03 2024 +0200

    Split logical attribute groups

commit 69d9359237
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 31 14:36:09 2024 +0200

    Collecting update functions by attributes

commit 6225f59ea0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 31 14:04:00 2024 +0200

    Cleanup

commit ab72bdf09c
Merge: dde8ab068 1d4b41750
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Jul 30 08:02:50 2024 +0200

    Merge pull request #224 from tokens-studio/ux-context-menu

    Ux context menu

commit 1d4b417501
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 30 06:57:21 2024 +0200

    Fix missing function shorthand

commit f69db7ce9e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 18:43:47 2024 +0200

    Cleanup

commit 5e33eab7d0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 18:31:11 2024 +0200

    Fix position updating

commit 9340ba9cc0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 18:30:59 2024 +0200

    Allow passing custom on-update-shape function

commit ededd23849
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 17:48:30 2024 +0200

    Trigger Build

commit b423a9c782
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 17:43:32 2024 +0200

    Always update all layout-gap on token pill click

commit 70904dbc64
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 16:38:40 2024 +0200

    Trigger Build

commit 9ba4776c8e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 16:34:26 2024 +0200

    Trigger Build

commit c92decedeb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 16:21:42 2024 +0200

    Trigger Build

commit a893a66ec8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 16:07:33 2024 +0200

    Fix crash on applying col/row gap

commit 3f14af9e03
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 16:00:46 2024 +0200

    Fix highlighting for dimensions token

commit 596d662ca8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 15:24:17 2024 +0200

    Cleanup

commit 1eea55ad43
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 15:09:35 2024 +0200

    Test

commit 55ed79d968
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 14:22:37 2024 +0200

    Move to sidebar, should not be rendered in root

commit 6fc370bb30
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 14:22:07 2024 +0200

    Fix token position wrong, component gets rendered on user mount

commit 1633f8035e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 29 13:51:17 2024 +0200

    Indent

commit 9bec2509c9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 10:11:36 2024 +0200

    Better context-menu position, remove hardcoded value

commit 1e481412e8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 09:12:23 2024 +0200

    Remove old token applying events

commit cc41a42dfa
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 09:11:03 2024 +0200

    Update CHANGELOG

commit a3a4883875
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 08:58:26 2024 +0200

    Cleanup

commit f094654837
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 08:56:02 2024 +0200

    Fix only shape ids being applied

commit f93a5ab109
Merge: 957ad0dae dde8ab068
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 25 08:42:17 2024 +0200

    Merge remote-tracking branch 'origin/token-studio-develop' into ux-context-menu

commit 957ad0dae3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 16:21:48 2024 +0200

    Always highlight if one of the attributes is active, but only apply minimal set on pill click

commit b9b4abf1e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 16:10:41 2024 +0200

    Fix edit modal not opening

commit cb942996a9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 16:05:43 2024 +0200

    Fix render-loop after token was deleted

commit 37bef1e2ea
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 16:05:29 2024 +0200

    Cleanup

commit b392c3ba65
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 15:46:14 2024 +0200

    Move token change events to changes ns

commit 56e72b5247
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 15:29:40 2024 +0200

    Refactor - Separate core into namespaces: changes, token_types

commit 03370c267d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 15:02:10 2024 +0200

    Cleanup

commit d5a03e154b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:57:33 2024 +0200

    Cleanup

commit 386a4c94ba
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:51:59 2024 +0200

    Disallow clicking pill when nothing is selected

commit 5e911d814c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:49:39 2024 +0200

    Show attribute actions only when something is selected

commit 310033fd75
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:20:08 2024 +0200

    Inline attributes

commit 46250003d3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:17:43 2024 +0200

    Reuse all-or-sepearate-actions for border-radius

commit 871402bd84
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:07:42 2024 +0200

    Fix overriding of existing radius-4

commit 38499e2f1f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:07:29 2024 +0200

    Fix properties

commit 893e533afe
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 14:01:56 2024 +0200

    Cleanup

commit e6889fc92e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 13:41:32 2024 +0200

    Fix typo

commit c11c1e0c03
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 13:41:08 2024 +0200

    Use all-or-sepearate-actions for gap

commit 335808bf03
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 13:41:00 2024 +0200

    Remove unneeded actions

commit cbd5d42069
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 13:36:38 2024 +0200

    Simplify

commit 113fc9891b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 13:29:26 2024 +0200

    Simplify component & css

commit fbd2ab833d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 10:59:26 2024 +0200

    Inline separator

commit 08cc777096
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 10:58:34 2024 +0200

    Restructure

commit 81c83f9dd4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 10:55:22 2024 +0200

    Recurse tree instead of repetition

commit f20313e7f8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 09:43:28 2024 +0200

    Add dimensions sub-menu

commit 1776591fec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 09:42:09 2024 +0200

    Fix react index warning

commit aa75f30858
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 24 09:19:31 2024 +0200

    Allow type overriding via prop

commit 62f7f8a74f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 16:35:07 2024 +0200

    Add sizing

commit 65dbafafb8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 16:02:14 2024 +0200

    Add width/height applying

commit 214a323682
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 16:01:56 2024 +0200

    Add abstract method for a all or seperate actions

commit da3f2f820c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 15:28:13 2024 +0200

    Add generic context menu actions

commit cabc3d3f36
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 14:55:14 2024 +0200

    Simplify passed prop date

commit bad9056d54
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 11:35:07 2024 +0200

    Update gap

commit 4cf8b2c143
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 10:54:23 2024 +0200

    Extract gap as extra function

commit 39822a3b31
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 10:49:19 2024 +0200

    Add single padding

commit 0e858d880d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 23 10:37:51 2024 +0200

    Add horizontal/vertical padding toggle

commit dde8ab0680
Merge: 64da0983f cb051d2e5
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jul 23 13:02:21 2024 +0530

    Merge pull request #223 from tokens-studio/fic-spacing-crash-on-non-layout

    Fix app crashing when spacing padding is applied to a shape without a…

commit 2411eeb644
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 18:23:12 2024 +0200

    Add separate gap

commit c00023319a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 18:13:37 2024 +0200

    Extract data

commit fd2f5537cf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 18:07:16 2024 +0200

    Extract common logic

commit 2836ff2693
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 17:07:42 2024 +0200

    Fix actions

commit f731a30f81
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 13:54:36 2024 +0200

    Allow removing other attributes with apply-token function

commit 91033d6dea
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 22 11:30:27 2024 +0200

    Fix indent

commit 64da0983f3
Merge: 2f17b79be 337e1c9fa
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jul 19 00:30:15 2024 +0530

    Merge pull request #222 from tokens-studio/fix-stroke-width-crash

    Fix application crashing when stroke width is applied to a shape with…

commit cb051d2e5b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jul 19 00:28:00 2024 +0530

    Fix app crashing when spacing padding is applied to a shape without a layout

commit 337e1c9fa0
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Jul 18 23:13:51 2024 +0530

    Fix application crashing when stroke width is applied to a shape without a stroke

commit 359ec592fb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 15:40:33 2024 +0200

    Single attribute context menu

commit ae2da534e9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 15:40:18 2024 +0200

    Move radius updating to core

commit 9bf763efb3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 15:19:48 2024 +0200

    Add all action

commit 77fe4d556f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 15:10:51 2024 +0200

    Convert border-radius to new UX

commit 7b2d11019c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 15:10:01 2024 +0200

    Only show atrribute actions when shapes are selected

commit bf994fcd56
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 14:40:57 2024 +0200

    Rename

commit 3ad009b515
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 14:40:35 2024 +0200

    Fix lint

commit 82b44e6569
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 14:40:07 2024 +0200

    Inline concat

commit da0389e304
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 14:38:19 2024 +0200

    Improved logic to run once for all shapes

commit 90618ec89a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 11:41:25 2024 +0200

    Add separator between default actions and attribute actions

commit 2f17b79bef
Merge: c2777ed6e bc1f27eac
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Jul 8 13:53:10 2024 +0200

    Merge pull request #216 from tokens-studio/ux-improvements

    UX improvements

commit db7391e4cb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 11:40:05 2024 +0200

    Separate entries

commit e75f9a7c7f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 11:06:57 2024 +0200

    Add predicate for all test

commit 62ecee2cf8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 8 10:24:23 2024 +0200

    Add grouping function by type

commit 3c67872d3c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 14:44:57 2024 +0200

    Add future test cases for providing a toggle all/attributes

commit 5a358e3d0c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 14:13:14 2024 +0200

    Extract singular token applied predicate

commit bc1f27eac9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 09:18:36 2024 +0200

    Trigger Build

commit 0fad53ea6c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 08:55:01 2024 +0200

    Convert stroke to event

commit c7a46c31b4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 08:53:45 2024 +0200

    Convert layout spacing to function

commit c70bb876b2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jul 5 08:31:38 2024 +0200

    Add changelog

commit 4fc7efd3b7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 16:03:32 2024 +0200

    Restore performance measuring lines

commit 4a329a6318
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 15:52:58 2024 +0200

    Override http server

commit 828e3a719f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 15:29:42 2024 +0200

    Disable running tests from shadow-cljs directly

commit 785961f7c6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 14:31:50 2024 +0200

    Cleanup

commit 55713275b6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 14:14:06 2024 +0200

    Add test for overriding token

commit f20c08f31b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 14:05:20 2024 +0200

    Specify tests

commit 893e790787
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:41:00 2024 +0200

    Only remove given token

commit b73cdd15e0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:28:15 2024 +0200

    Add helper to remove attributes from applied-tokens

commit 658e7ebd0a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:15:06 2024 +0200

    Cleanup

commit 694baeee0c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:12:49 2024 +0200

    Add sizing test

commit 7abfaef1cb
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:08:46 2024 +0200

    Test applying rotation

commit 322c8ef8ec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 11:06:48 2024 +0200

    Update opacity

commit b43d16008f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:51:08 2024 +0200

    Extract to helpers

commit 1f0f35e754
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:48:27 2024 +0200

    Remove unused

commit a842cb2d7d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:41:57 2024 +0200

    Cleanup

commit 8f806ef1fe
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:41:46 2024 +0200

    Test single property updates

commit f3261c9b0f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:41:10 2024 +0200

    Fix emit! side-effect

commit 818aa043ca
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:40:59 2024 +0200

    Wrap in undo sequence

commit 596480d177
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:05:36 2024 +0200

    Add test to verify toggle removes token for applied & unapplied

commit ab62c5b4ef
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:00:58 2024 +0200

    Add helper to apply token to shape

commit 581ced0ab8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 10:00:44 2024 +0200

    Abstract into helper

commit e85de19a5e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 09:29:48 2024 +0200

    Add multiple shapes test

commit 8370fd06d4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 09:29:43 2024 +0200

    Remove cb

commit 3793e98660
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 09:29:16 2024 +0200

    Disable complete log

commit b12e59a8d7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jul 4 09:13:02 2024 +0200

    Rename event to toggle-token

commit 71976ed7e9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 18:24:09 2024 +0200

    Add helpers for creating test tokens

commit 0730ecef46
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 17:15:23 2024 +0200

    Cleanup

commit 219d184e6c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 17:06:08 2024 +0200

    Add multiple tokens for tests

commit a7e735bd81
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 17:04:47 2024 +0200

    Add helper for asnc stores

commit ed7aad6c4e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 16:11:39 2024 +0200

    Async token event tests working

commit e203646085
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 11:16:16 2024 +0200

    Naming

commit 1e70a4d714
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 11:09:50 2024 +0200

    Implement using rx observables instead of side-effects

commit 97db3c29ca
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jul 3 09:50:54 2024 +0200

    Trying to convert to rx structure

commit 50635ae879
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 2 16:06:41 2024 +0200

    Found error in handler logic, need rx streams

commit 3e5126251c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 2 15:19:31 2024 +0200

    Add failing logic test

commit 10d92f598c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 2 15:03:09 2024 +0200

    Add nodemon watcher

commit c486ea81f4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 2 15:03:04 2024 +0200

    Cleanup

commit f2358b9827
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jul 2 08:22:27 2024 +0200

    Use toggle function

commit c2777ed6e3
Merge: 5c5b37826 224b656d5
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Jul 1 18:43:17 2024 +0200

    Merge pull request #211 from tokens-studio/fix-sub-name-space

    Fix token naming clashes

commit 5cef23267c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 14:14:36 2024 +0200

    Move to tokens ns, add test

commit cf07de3bcf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 14:05:06 2024 +0200

    Add tests for token-applied?

commit e38a943ce0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 13:51:20 2024 +0200

    Move token-applied? to token ns

commit 224b656d57
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 10:40:38 2024 +0200

    Add CHANGELOG

commit 111be97228
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 10:31:16 2024 +0200

    Remove logs

commit ec511cc589
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 10:30:03 2024 +0200

    Fix setting token to own path

commit 9d637cbe5e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 10:16:52 2024 +0200

    Path selector test predicate is enough

commit 4a85ef3608
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 10:16:15 2024 +0200

    Split path/selector for disallowing creating tokens at path segments

commit a98f59469e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jul 1 09:56:45 2024 +0200

    Add - to allowed token-name

commit 174d91a519
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 14:39:36 2024 +0200

    Add function to check if a token can be placed under a name path

commit 48a7c52664
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 14:17:42 2024 +0200

    Separate errors

commit 2fa152d364
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 13:51:32 2024 +0200

    Move to token namespace

commit 504369ec13
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 13:43:41 2024 +0200

    Move tokens-name-tree to core, add test

commit ef5f019200
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 13:34:54 2024 +0200

    Add helper utility to convert name to path

commit 6da855c741
Merge: 3a500fb8a a4bbef991
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 11:24:55 2024 +0200

    Merge branch 'fix-token-reference-issue' into 199-branch-name

commit a4bbef9917
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jun 28 14:43:49 2024 +0530

    Fix token reference issue when name has .

commit 3a500fb8a7
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 19:40:06 2024 +0530

    Update CHANGELOG.md with PR link

commit 00dabaf38c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 26 16:08:21 2024 +0200

    Remove comment form

commit f24c314d63
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 26 16:04:50 2024 +0200

    Update

commit f9530c5a10
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 26 16:01:41 2024 +0200

    Restrict token naming

commit 5c5b378262
Merge: 3a594d239 4aac3eee7
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri Jun 28 08:19:57 2024 +0200

    Merge pull request #204 from tokens-studio/fix-deploy

    Fix deploy

commit 4aac3eee7f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 08:18:43 2024 +0200

    Test synchronize

commit 325ad66a46
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 28 08:16:26 2024 +0200

    Fix branches not being re-deployed after push

commit 3a594d2393
Merge: bd5a0d2d1 b2a983fd0
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu Jun 27 16:31:14 2024 +0200

    Merge pull request #203 from tokens-studio/fix-new-document-token

    Fix creating a token issue on empty document

commit b2a983fd05
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jun 27 16:07:47 2024 +0200

    Fix creating a token issue on empty document

commit bd5a0d2d1b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 26 15:06:22 2024 +0200

    Cleanup

commit 19c6c6d3bf
Merge: 7fa31b143 c9a40ee9b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:58:01 2024 +0530

    Merge pull request #195 from tokens-studio/json-export-changelog

    Add Json export Changelog

commit c9a40ee9b3
Merge: 350654f96 7fa31b143
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:57:49 2024 +0530

    Merge branch 'token-studio-develop' into json-export-changelog

commit 350654f968
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:51:23 2024 +0530

    Update CHANGELOG.md image

commit 7fa31b143e
Merge: 357a0781b bf1c9e2c1
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:48:08 2024 +0530

    Merge pull request #198 from tokens-studio/json-dtcg-format

    Make tokens JSON export DTCG compatible

commit bf1c9e2c18
Merge: 96bfce13b 357a0781b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:47:54 2024 +0530

    Merge branch 'token-studio-develop' into json-dtcg-format

commit 357a0781bb
Merge: 5ca916f8c 86fd667a1
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Jun 26 14:11:08 2024 +0200

    Merge pull request #194 from tokens-studio/style-dictionar-validation

    Token Insert/Edit Validation + Value Preview

commit 96bfce13be
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 17:28:10 2024 +0530

    Update CHANGELOG.md image

commit d6f1e2efc9
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 12:36:01 2024 +0530

    Update CHANGELOG

commit 158d5cba31
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 26 12:32:07 2024 +0530

    Make tokens JSON export DTCG compatible

commit aabbe2fd94
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 25 22:34:09 2024 +0530

    Update CHANGELOG

commit 86fd667a11
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 17:06:52 2024 +0200

    Hide template section in preview document

commit 56976e2499
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 17:04:13 2024 +0200

    Update CHANGELOG

commit 9f6c587c95
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:46:15 2024 +0200

    Remove duplicate similar errors

commit 9f3e1743a1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:45:01 2024 +0200

    Cleanup

commit e1b683f670
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:43:52 2024 +0200

    Cleanup

commit b4d1ef3fc7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:40:48 2024 +0200

    Cleanup

commit b924bbc9c7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:39:43 2024 +0200

    Cleanup

commit 656cc00923
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:38:28 2024 +0200

    Add missing deps

commit b89dc759be
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:36:21 2024 +0200

    Cleanup

commit 135ecf0e3a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:33:07 2024 +0200

    Cleanup

commit af374276e4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 16:30:57 2024 +0200

    Extract missing reference error check

commit 2c42ca5a4b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 14:24:20 2024 +0200

    Cleanup

commit b905ff7d2c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 14:18:07 2024 +0200

    Validate forms again on submit

commit eb123bf8ef
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 12:15:14 2024 +0200

    Extract token validation

commit 6e9623153c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:55:57 2024 +0200

    Remove caching layer for now

commit d0f8e9612a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:52:39 2024 +0200

    Validate name before submitting

commit 5df0cf545e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:33:18 2024 +0200

    Remove form-touched work-around

commit eac7d9288b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:30:53 2024 +0200

    Fix on-submit taking old ref-values when user submits before errors have been validated

commit 05f6cfc4b0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:30:45 2024 +0200

    Remove unneeded state

commit 33131fa943
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:15:43 2024 +0200

    Restore token saving

commit ca98747dea
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 11:02:21 2024 +0200

    Add description with schema

commit d2bdc6c624
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 25 10:40:31 2024 +0200

    Fix ref logic

commit 5ca916f8c4
Merge: 1ca3f2970 ee057c498
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 20:53:31 2024 +0530

    Merge pull request #191 from tokens-studio/tokens-json-export

    Tokens json export

commit ee057c498e
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 20:44:08 2024 +0530

    Simplify tranform tokens function

commit e0be30bb79
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 15:58:19 2024 +0200

    Dont show error when unfocusing name input field, but keep form disabled

commit 29e3171bd9
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 19:07:53 2024 +0530

    Incorporate styling changes to match Penpot design language

commit c98162d0bf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 15:24:22 2024 +0200

    Move callback function to component

commit fb7b11a139
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 18:50:36 2024 +0530

    Remove : from token type in export

commit db26b38e81
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 18:47:12 2024 +0530

    Modify transform tokens to nest within token names

commit 28f25da9e8
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 14:29:29 2024 +0200

    Move to tests

commit 111900c122
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 14:23:28 2024 +0200

    Cleanup

commit 10033ead91
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 14:23:03 2024 +0200

    Add specific esm testing environment for tokens

commit 2b3f602312
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 17:50:24 2024 +0530

    Move json encode functionalities to tokens namespace

commit ba6a6059c1
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 14:07:21 2024 +0200

    Move to custom ns

commit 69d9c8e88f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 12:44:29 2024 +0200

    Add esm test

commit ab51b43365
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 12:44:05 2024 +0200

    Add type

commit 0a73cbc6f1
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 14:18:57 2024 +0530

    Move transform and download functionality to core.cljs

commit bbb09567f6
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 24 14:18:35 2024 +0530

    Remove sample json data

commit 5c42514170
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 24 09:59:22 2024 +0200

    Add style dictionary find-token-reference test

commit 75bdda6b07
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Sun Jun 23 00:16:15 2024 +0530

    add some formatting

commit 62fc2cf652
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Sun Jun 23 00:10:02 2024 +0530

    Add initial working export tokens-json

commit 5f25bd8a7b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 19:41:04 2024 +0200

    Add comments

commit 59780a9d4d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 19:40:03 2024 +0200

    Add token finding function

commit 598e4d36fc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:19:59 2024 +0200

    Disable on value error

commit 910485008f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:19:13 2024 +0200

    Fix name not updating button

commit 39eb964cb7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:18:56 2024 +0200

    Reduce debounce timeout

commit dd62c7fe18
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:00:56 2024 +0200

    Give new tokens without a name a temporary hardcoded string

commit 1dcdddb2db
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:00:45 2024 +0200

    Check for self references

commit 941fb041b6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 17:00:00 2024 +0200

    Add form styling

commit 8db47b5877
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 15:09:46 2024 +0200

    Use initial value

commit 53f01ef46c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 15:04:30 2024 +0200

    Use input as cache key

commit 35ee732701
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 14:59:08 2024 +0200

    Debounced update of resolved value

commit f00ac72fbe
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 10:10:45 2024 +0200

    Revert to use-var

commit e394216f00
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 21 10:02:21 2024 +0200

    Move form out of modal specific code

commit 1ca3f29708
Merge: f000a5145 80ec74f77
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu Jun 20 17:03:45 2024 +0200

    Merge pull request #190 from tokens-studio/pr-test

    Test

commit 80ec74f77e
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 17:00:38 2024 +0200

    Fix resolver and add an oauth2 proxy

commit ef6074a5af
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 15:35:33 2024 +0200

    Test

commit f000a51451
Merge: 15041a8b9 125e14615
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu Jun 20 13:29:37 2024 +0200

    Merge pull request #189 from tokens-studio/clean-ci

    Fix proxy cache for config map

commit 125e146150
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 13:28:13 2024 +0200

    fix proxy cache for config map

commit 15041a8b9a
Merge: 31344a532 5c93cf9cd
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu Jun 20 13:04:29 2024 +0200

    Merge pull request #188 from tokens-studio/clean-ci

    Fix font issues

commit 5c93cf9cd3
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 13:03:49 2024 +0200

    Fix font issues
    Fix minio resolution not working
    Fix redis auth on by default

commit 31344a5322
Merge: ea5dbe275 867fd2391
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu Jun 20 02:18:31 2024 +0200

    Merge pull request #187 from tokens-studio/clean-ci

    Cleanup

commit 867fd23917
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 02:15:35 2024 +0200

    Cleanup

commit ea5dbe275e
Merge: dcf4b7ce6 41bd4c621
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu Jun 20 02:06:50 2024 +0200

    Merge pull request #185 from tokens-studio/feat/mailslurper

    Feat/mailslurper

commit 41bd4c621f
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 02:06:21 2024 +0200

    Last round of changes

commit 228665f5f2
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 00:58:10 2024 +0200

    Pr should be a prefix

commit be6b217ef0
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 00:49:33 2024 +0200

    Fix to use the sanitize the backend tag

commit 87b1bc12c2
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu Jun 20 00:40:10 2024 +0200

    Change asset storage

commit 4b61e0d80c
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 21:09:18 2024 +0200

    Fix branch name detection

commit f5514b419a
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 21:02:16 2024 +0200

    Use a raw tag

commit 349bdbb776
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 20:52:33 2024 +0200

    Change to use branch names instead of shas

commit 0fd4f814d8
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 20:47:35 2024 +0200

    Remove node affinity

commit 79b49bae27
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 20:31:21 2024 +0200

    Update namespace

commit dcf4b7ce64
Merge: 596c1997b f45789596
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 20:16:39 2024 +0200

    Merge pull request #186 from tokens-studio/feat/clean-images

    Add clean images workflow

commit f457895961
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 18:15:53 2024 +0000

    Add clean images workflow

commit b40f222d16
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 20:06:35 2024 +0200

    Add quote

commit 99d6df4588
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 19:58:44 2024 +0200

    Build backend as part of PR

commit 034d5ad5ab
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 19:57:19 2024 +0200

    Overhaul penpot chart

commit 885322d479
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 17:17:00 2024 +0200

    Reestore fields

commit 0830a26be9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 17:11:28 2024 +0200

    Add error state for invalid name

commit 905ccfdec9
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 16:36:00 2024 +0200

    Capitalize chart

commit e3d73be7c5
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 16:35:46 2024 +0200

    Make sure the uppercase goes through

commit 072baf9c7b
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 16:30:45 2024 +0200

    Test PR again

commit 3e20e15ffd
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 16:22:28 2024 +0200

    Try fix PR chart

commit 6ed788aa5a
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 16:15:20 2024 +0200

    Add patch to enable SMTP

commit 0c45d15fe7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 16:01:40 2024 +0200

    Variadic function doesn't work for hooks

commit 596c1997b8
Merge: f3d5b10e1 21ef1586f
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:57:35 2024 +0200

    Merge pull request #184 from tokens-studio/feat/mailslurper

    Move config from chart to include the smtp settings

commit 21ef1586f0
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:56:03 2024 +0200

    Move config

commit f3d5b10e1f
Merge: 2ce3a180e 3e94d4685
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:37:02 2024 +0200

    Merge pull request #183 from tokens-studio/feat/mailslurper

    Typo in infra manifest

commit 3e94d46850
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:35:15 2024 +0200

    Typo

commit 2ce3a180eb
Merge: caa41146c 569db9d1e
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:27:59 2024 +0200

    Merge pull request #182 from tokens-studio/feat/mailslurper

    Try cleanup namespace control

commit 569db9d1e6
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 15:25:12 2024 +0200

    Try cleanup namespace control

commit caa41146c4
Merge: a2292eb38 5e32a5bbf
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:56:29 2024 +0200

    Merge pull request #181 from tokens-studio/feat/mailslurper

    Remove onechart for simple manifests

commit 5e32a5bbfd
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:53:21 2024 +0200

    Remove onechart for simple manifests

commit a2292eb387
Merge: 4c236ab42 deb7ba982
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:43:24 2024 +0200

    Merge pull request #180 from tokens-studio/feat/mailslurper

    Setup mailslurper

commit deb7ba9823
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:42:04 2024 +0200

    Setup mailslurper

commit 4c236ab423
Merge: 168a5d57d 386bf1bc2
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:10:43 2024 +0200

    Merge pull request #179 from tokens-studio/fix/persistence

    Add persistence to penpot deploys

commit 386bf1bc2f
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Wed Jun 19 14:09:35 2024 +0200

    Add persistence to penpot deploys

commit 1596dbe155
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 13:54:09 2024 +0200

    Add function to verify already used names

commit deb9cb1120
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 11:26:29 2024 +0200

    Remove debugging code

commit f169d49397
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 11:18:41 2024 +0200

    Remove double cljs conversion

commit 0a73c3aa95
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 11:09:01 2024 +0200

    Validation in modal

commit 168a5d57d4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 10:49:35 2024 +0200

    Add template

commit a4ef2ee8bf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 10:42:42 2024 +0200

    Add changelog

commit 83515250da
Merge: 0d4e3e862 5a8a32ddc
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed Jun 19 10:10:43 2024 +0200

    Merge pull request #168 from tokens-studio/style-dictionary

    References & Expressions in Tokens

commit 5a8a32ddc7
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 09:43:36 2024 +0200

    Remove items with missing references

commit 23de79bd04
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 19 09:40:26 2024 +0200

    Remove unneeded function

commit 0d4e3e8629
Merge: 35135635c 0105e4206
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:58:54 2024 +0530

    Merge pull request #174 from tokens-studio/fix-dimensions-keys-applied

    Fix keys applied when dimensions or sizing token is applied directly

commit 35135635c4
Merge: 2ed3ea6d6 0afddac5d
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:58:43 2024 +0530

    Merge pull request #175 from tokens-studio/fix-min-max-height-error

    Fix/ min and max height-width application

commit 2ed3ea6d6a
Merge: 1ebd2ee3d 3bbee9532
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:58:25 2024 +0530

    Merge pull request #177 from tokens-studio/remove-registration-questionnaire

    Remove registration questionnaire

commit 3bbee9532f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:38:28 2024 +0530

    Fix error message

commit f99239341f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:18:39 2024 +0530

    add message to undo this change in the future

commit f405612a25
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 19 12:16:54 2024 +0530

    Remove Onboarding Questionnaire

commit 0afddac5d1
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 18 23:52:54 2024 +0530

    Fix/ min and max height-width application

commit 0105e42068
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 18 23:21:17 2024 +0530

    Fix keys applied when dimensions or sizing token is applied directly

commit b4d7680cb4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 11:29:02 2024 +0200

    Show resolved value

commit 742bb6de05
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 11:28:09 2024 +0200

    Handle tokens with issues in ui

commit a390942722
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 11:19:09 2024 +0200

    Resolve token value

commit cf52e873e2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 11:13:26 2024 +0200

    Cleanup

commit 5c2891b247
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 11:10:51 2024 +0200

    Use resolved tokens from style-dictionary

commit 9261c53aff
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 10:23:52 2024 +0200

    Don't override original value, add resolved value, add missing reference error

commit d65d880845
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 18 09:59:36 2024 +0200

    Silence errors

commit 09609c18ef
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 17 17:07:02 2024 +0200

    Remove compile style dictionary

commit f0bc262a18
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 17 17:05:51 2024 +0200

    Working version

commit 5a64947b08
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 17 16:13:34 2024 +0200

    Add patched StyleDictionary

commit 0a86e3a651
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri Jun 14 10:52:30 2024 +0200

    Simplify

commit c9df90577f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Jun 13 09:27:53 2024 +0200

    Add compiled library

commit 965da83c97
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 17:14:34 2024 +0200

    Add workspace-tokens helper

commit 9bc48a3a1a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 17:14:27 2024 +0200

    Allow passing custom cache atom

commit 908cc2240f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 16:48:13 2024 +0200

    Docs

commit a79d1013bf
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 16:45:24 2024 +0200

    Prevent reprocessing the style-dictionary cache multiple times

commit 73e8b80521
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 16:19:39 2024 +0200

    Cleanup

commit 2f45ab1b62
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 16:19:03 2024 +0200

    Add hook for using resolved tokens cache

commit 0921f8043b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed Jun 12 16:10:02 2024 +0200

    Allow passing of tokens

commit b1b6b5292c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 17:52:29 2024 +0200

    Disable invalid token style for now

commit 4fec7d5af2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 17:52:12 2024 +0200

    Applying resolved token value

commit 66b4b892df
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 16:43:54 2024 +0200

    Fix data-keys being converted to camel-case

commit 4b90e90974
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 16:41:50 2024 +0200

    Backporting resolved tokens to the original structure

commit 1519f8f560
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 15:12:30 2024 +0200

    Move to ns

commit e691628648
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 10:42:25 2024 +0200

    Test out tokens-studio data

commit efd4c5dcca
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue Jun 11 10:24:12 2024 +0200

    Add performance measuring

commit a5b22d5427
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 10 15:50:48 2024 +0200

    Got resolve working

commit 7da772d6a2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 10 11:54:34 2024 +0200

    Add sd function

commit 1023ba866a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 10 10:52:03 2024 +0200

    Add StyleDictionary as compiled lib

commit 1ebd2ee3d7
Merge: dc36f4f6d 8d444b4b0
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jun 14 12:40:44 2024 +0530

    Merge pull request #172 from tokens-studio/hide-unfunctional-token-sections

    Hide non functional token sections

commit 8d444b4b02
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Jun 13 21:33:38 2024 +0530

    Hide non functional token types from UI

commit dc36f4f6d3
Merge: 93c249c77 f10a4f28e
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Jun 13 12:59:49 2024 +0530

    Merge pull request #164 from tokens-studio/other-token-types-context-menu

    Add context menu for opacity, rotation and stroke width tokens

commit f10a4f28ea
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 12 16:18:51 2024 +0530

    Add context menu for opacity, rotation and stroke width

commit 93c249c77a
Merge: 01d2a25c8 3f55536fc
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 12 15:29:30 2024 +0530

    Merge pull request #161 from tokens-studio/dimensions-context-menu

    Dimensions context menu

commit 3f55536fc0
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 10 23:25:11 2024 +0530

    Add custom context menu and fix styling issues with subcontext menu

commit 842b76f3c1
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jun 7 01:37:26 2024 +0530

    replace 30px with variables

commit e86038d52f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri Jun 7 01:27:18 2024 +0530

    Add CSS to deal with margin before the Sub Context Menu titles

commit 91eb59696c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu Jun 6 23:09:22 2024 +0530

    Remove children attribute and use submenu instead

commit 67a34c91d8
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 23:19:43 2024 +0530

    Add leading spaces to subcontext menu titles

commit 307f472528
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 22:23:27 2024 +0530

    remove print statement

commit a5c235754c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 22:06:59 2024 +0530

    Cleanup debug statements

commit a98d6b4c07
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 22:06:31 2024 +0530

    Add context menu functionalities for dimensions token

commit ed0d9e1cf5
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 13:49:18 2024 +0530

    initial dimensions context menu

commit 819c50eaf8
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed Jun 5 13:49:00 2024 +0530

    change dimension to dimensions across

commit 01d2a25c8c
Merge: e8b755c75 ea593221b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 4 17:02:04 2024 +0530

    Merge pull request #160 from tokens-studio/sizing-token-context-menu

    Add new changes from token-studio-develop merge

commit ea593221b3
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 4 15:52:52 2024 +0530

    Add new changes from token-studio-develop merge

commit e8b755c757
Merge: 202b72dcd 88d3fc234
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 4 15:47:58 2024 +0530

    Merge pull request #159 from tokens-studio/sizing-token-context-menu

    Add context menu functionalities on sizing tokens

commit 88d3fc234d
Merge: a553253d2 202b72dcd
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue Jun 4 15:46:02 2024 +0530

    Resolve merge conflicts in context_menu.cljs

commit 202b72dcd0
Merge: 1056c6b44 057934c88
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Tue Jun 4 11:23:49 2024 +0200

    Merge pull request #132 from tokens-studio/feat/branch-deploys

    Prefer wait over deploy for build

commit 057934c883
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Tue Jun 4 11:11:58 2024 +0200

    Cleanup PR

commit 3b3fbc2ccd
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Tue Jun 4 11:06:00 2024 +0200

    fix deploys

commit 1056c6b448
Merge: dc14933f3 580076355
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue Jun 4 10:39:03 2024 +0200

    Merge pull request #158 from tokens-studio/142-when-a-token-is-applied-on-a-shape-in-the-context-menu-there-should-be-check-box-indicating-which-attribute-is-applied

    Show checkmark next to selected token attributes

commit a553253d28
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 3 23:34:51 2024 +0530

    remove println statement

commit 193ad115a2
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon Jun 3 23:25:59 2024 +0530

    Add context menu functionalities on sizing tokens

commit 580076355b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 3 15:21:08 2024 +0200

    Show checkmark for applied tokens

commit 65942ef63b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 3 13:39:26 2024 +0200

    Use set of attributes for action generation

commit c1096e15da
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 3 13:39:16 2024 +0200

    Cleanup

commit dc14933f3a
Merge: e89f03393 3c3ef57da
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon Jun 3 10:51:04 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit e89f03393b
Merge: 5c7e235c9 86e6421b6
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon Jun 3 10:48:49 2024 +0200

    Merge pull request #157 from tokens-studio/florian/input-select

    Allow token selection with keyboard from right side

commit 86e6421b68
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 31 16:25:30 2024 +0200

    Disable selection when entering with mouse

commit 710fa0d817
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 31 16:22:01 2024 +0200

    Allow arrow selection

commit 5c7e235c97
Merge: d624a559a c3cee77ef
Author: Akshay Gupta <akshay@hyma.io>
Date:   Fri May 31 18:31:37 2024 +0530

    Merge pull request #155 from tokens-studio/spacing-context-menu

    Spacing context menu

commit c3cee77efb
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri May 31 18:19:42 2024 +0530

    remove unused imports and refactor functions

commit d624a559aa
Merge: 420b8cf52 d16f1c773
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri May 31 10:46:51 2024 +0200

    Merge pull request #150 from tokens-studio/flex-row-gap-commit

    Spacing tokens

commit 76347228fe
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 30 22:25:21 2024 +0530

    Add all spacing token context menu functionalities

commit 84d96a1004
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 29 18:47:17 2024 +0530

    Add initial spacing context menu entries

commit d16f1c773e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 14:53:40 2024 +0200

    Change both properties

commit 7376cb634a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 14:32:09 2024 +0200

    Add padding x/y tokens

commit 0e7e37afc2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 14:21:33 2024 +0200

    Add padding editable select

commit 28bdf62454
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 13:50:31 2024 +0200

    Integrate changes

commit 420b8cf524
Merge: bdefc97c2 c2c0fbf40
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed May 29 13:20:44 2024 +0200

    Merge pull request #146 from tokens-studio/135-flex-row--gap-token-updating-from-the-right-sidebar

    135 flex row  gap token updating from the right sidebar

commit 78f3d54dee
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 10:55:40 2024 +0200

    Add commit

commit c2c0fbf40a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:37:24 2024 +0200

    Add spacing/row options

commit 1ad998de23
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:28:38 2024 +0200

    Use editable-select for col-gap/row-gap

commit fb5f7e870a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:23:47 2024 +0200

    Fix drop-down button spacing

commit 5c83247256
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:20:14 2024 +0200

    Prevent selection on disabled selects

commit c6f5da8873
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:16:55 2024 +0200

    Move select styles to select component

commit 9a7c944763
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:04:49 2024 +0200

    Remove unused classname

commit 985d8d33ff
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 09:02:26 2024 +0200

    Add event to passed arguments [*]

    [*] Needed for layout_container component

commit 384da8555d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 29 08:50:50 2024 +0200

    Dynamically pass props to input

commit bdefc97c21
Merge: 144b164fa bb3ee2278
Author: Akshay Gupta <akshay@hyma.io>
Date:   Tue May 28 17:36:59 2024 +0530

    Merge pull request #140 from tokens-studio/general-token-context-menu-functions

    General token context menu functions and specific context menu functions for border radius

commit bb3ee22780
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 28 17:03:26 2024 +0530

    pass context menu attributes as map and some minor fixes

commit e02777b855
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Tue May 28 10:23:20 2024 +0200

    Be explicit in tagging for prs

commit 144b164fa0
Merge: 169d71b2d 96a7cf2e9
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue May 28 10:06:12 2024 +0200

    Merge pull request #139 from tokens-studio/fix-staging

    Fix staging

commit eeb87e49a2
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Tue May 28 09:58:15 2024 +0200

    Cleanup github token usage

commit 9066ad9e39
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 28 02:22:25 2024 +0530

    Add border radius specific context menu functions

commit 464bdf3d9c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 15:09:36 2024 +0200

    Use single undo operation for width/height change

commit 96a7cf2e98
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 14:50:55 2024 +0200

    Convert kebab keys into camelCase

commit 47d75e7e2a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 14:43:28 2024 +0200

    Remove closed for now

commit 6ed5dc138d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 14:43:11 2024 +0200

    Fix editing/saving

commit 169d71b2df
Merge: 65563e2d3 6bacd1d66
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon May 27 11:22:27 2024 +0200

    Merge pull request #138 from tokens-studio/124-disable-1password-completion

    124 disable 1password completion

commit 6bacd1d663
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 11:13:05 2024 +0200

    Disable password manager completion

commit 86d7979e1e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 27 11:12:36 2024 +0200

    Remove unused component

commit d1fc43d8d6
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 27 10:38:35 2024 +0200

    Try force deploy branch PR

commit 370a5d9bb8
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon May 27 13:02:24 2024 +0530

    Add initial context menu token specific functionality

commit 65563e2d3c
Merge: 968c6437f 7a8722de1
Author: Akshay Gupta <akshay@hyma.io>
Date:   Fri May 24 18:13:00 2024 +0530

    Merge pull request #133 from tokens-studio/editing-tokens

    :feat editing tokens

commit 968c6437fb
Merge: 75b935187 cbad5033c
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri May 24 11:46:45 2024 +0200

    Merge pull request #134 from tokens-studio/123-other-fields-to-update

    Width/Height Token Changing from the sidebar

commit cbad5033c2
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 11:25:30 2024 +0200

    Cleanup

commit f52e2e3a41
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 10:34:20 2024 +0200

    Differentiate width/height sizing selected properties

commit 49d9b52b12
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 10:01:13 2024 +0200

    Cleanup

commit ea9d850412
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 10:00:43 2024 +0200

    Fix selectionStart not being detectable (selectionStart doesnt work for number)

commit b6061cc4a0
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 10:00:26 2024 +0200

    Fix instant value change applies shape attributes

commit bc620ba2cd
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 08:55:04 2024 +0200

    Update width value

commit 595831118d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 08:36:28 2024 +0200

    Allow aligning dropwdown to the left

commit 406e8d110c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 24 07:34:43 2024 +0200

    De-Applying token

commit 7a8722de1b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Fri May 24 00:14:17 2024 +0530

    Add ability to edit existing token attributes

commit 5131b79060
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu May 23 16:22:31 2024 +0200

    Prefer wait over deploy for build

commit 75b9351871
Merge: 557195cd5 84ad8a6be
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Thu May 23 16:19:31 2024 +0200

    Merge pull request #131 from tokens-studio/feat/branch-deploys

    Test PR deploys

commit 84ad8a6be6
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu May 23 15:39:21 2024 +0200

    Escape interpolation

commit f9e1a65631
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu May 23 15:23:27 2024 +0200

    Trigger cleanup as well

commit 66f67ddff4
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Thu May 23 15:13:43 2024 +0200

    Test PR deploys

commit 2dd994799c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 23 09:41:16 2024 +0200

    Abstract API

commit e181065bda
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 23 09:29:17 2024 +0200

    Formatting

commit 1ed692230b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 23 09:24:12 2024 +0200

    Abstract functionality

commit 557195cd55
Merge: 2818d097a 80ff7f769
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu May 23 11:05:12 2024 +0200

    Merge pull request #130 from tokens-studio/129-bug-file-is-crashing-post-applying-a-border-radius-token-to-a-shape

    Fix non-optional keys breaking staging server

commit 80ff7f769c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 23 10:53:18 2024 +0200

    Fix non-optional keys breaking staging server

commit 273a9530ea
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 23 13:14:28 2024 +0530

    initial edit commit

commit 2818d097ab
Merge: 1a144192a cc0e4af4b
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu May 23 08:43:51 2024 +0200

    Merge pull request #128 from tokens-studio/119-higlight-applied-token-in-the-editing-field

    Show token value inside shapes panel (border-radius)

commit cc0e4af4bc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 16:37:19 2024 +0200

    Fix token value not being removed after submit

commit b1379ed7de
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 16:35:44 2024 +0200

    Fix refocus prop not being removed

commit 5bccfa9e2f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 16:29:18 2024 +0200

    Dont submit token when text is selected

commit 5806ae7426
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 16:20:40 2024 +0200

    Abstract functions

commit 2eb5efb274
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 16:13:58 2024 +0200

    Cleanup

commit 850bf80ffc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 15:59:22 2024 +0200

    Replace token with value when inserted after token input

commit 6f5930bf15
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 15:43:40 2024 +0200

    Clear token value on blur

commit 2efd6e1584
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 15:36:26 2024 +0200

    Refocus input on token deletion

commit 86b493522c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 15:12:56 2024 +0200

    Remove unneeded focus hack

commit 1a144192a9
Merge: cbfcc5056 04c43acf3
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed May 22 15:00:05 2024 +0200

    Merge pull request #127 from tokens-studio/fix-sass-pipe-break

    Dont break pipe when sass has an error

commit 70336ea45e
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 14:26:37 2024 +0200

    Style focused pill

commit 7e79cf274d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 14:17:56 2024 +0200

    Fix input background being clipped on hover

commit 42df426375
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 14:13:33 2024 +0200

    Style pill and input combination

commit 7c80f87f30
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 14:13:23 2024 +0200

    Show value instead of label, add title

commit 019759392c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 10:23:57 2024 +0200

    Unlink token when pressing backspace on empty input field

commit 7da382dfed
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 21 15:47:18 2024 +0200

    Clear value when pressing backspace as last action

commit 35f384ce9b
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 21 15:40:34 2024 +0200

    Use custom input value logic when token is applied

commit 50354ccb71
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 21 15:40:19 2024 +0200

    Fix state being reset at start

commit 975f41bc08
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 21 15:21:01 2024 +0200

    Display regular input field when token is applied [*]

    [*] Numeric input renders default 0

commit 04c43acf39
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 13:48:13 2024 +0200

    Dont break pipe when sass has an error

commit cbfcc50563
Merge: 44f55308a eb168a6f9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 22 13:46:26 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit 44f55308a6
Merge: e874ed5b6 2b1066535
Author: Akshay Gupta <akshay@hyma.io>
Date:   Wed May 22 15:14:54 2024 +0530

    Merge pull request #126 from tokens-studio/rotation-token

    Add ability to apply rotation token

commit 2b10665356
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 22 15:11:01 2024 +0530

    close applied tokens map schema

commit 13a8872dbd
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 22 15:08:05 2024 +0530

    add rotation to applied tokens schema

commit 3793f1791a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 22 13:08:59 2024 +0530

    Add ability to apply rotation token

commit e874ed5b6c
Merge: cb7d4409e eca133426
Author: Akshay Gupta <akshay@hyma.io>
Date:   Tue May 21 17:11:21 2024 +0530

    Merge pull request #125 from tokens-studio/remember-token-section-state

    Remember token section open/close state

commit eca1334266
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 21 16:52:47 2024 +0530

    Remember token section open/close state

commit cb7d4409e2
Merge: a1f09d69b 9b13444c4
Author: Akshay Gupta <akshay@hyma.io>
Date:   Tue May 21 13:28:34 2024 +0530

    Merge pull request #116 from tokens-studio/spacing-token-layout-update

    spacing token to update only row or column gap as per flex direction

commit a1f09d69b0
Merge: 162e7b6c5 344a27602
Author: Akshay Gupta <akshay@hyma.io>
Date:   Tue May 21 13:27:42 2024 +0530

    Merge pull request #117 from tokens-studio/sort-tokens-by-insert-order

    sort tokens by insert order

commit 344a27602b
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon May 20 22:25:46 2024 +0530

    sort tokens by insert order

commit 9b13444c44
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Mon May 20 21:59:28 2024 +0530

    spacing token to update only row or column gap as per flex direction

commit 162e7b6c58
Merge: 90ab485e7 5954a8698
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 20 12:59:50 2024 +0200

    Merge branch 'token-studio-develop' of github.com:tokens-studio/tokens-studio-for-penpot into feat/port-tracking-and-smoke

commit 90ab485e78
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 20 12:56:43 2024 +0200

    Needs depend on smoke

commit 5954a8698b
Merge: ec36e06b7 851054c61
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 20 12:45:42 2024 +0200

    Merge pull request #114 from tokens-studio/feat/port-tracking-and-smoke

    Add port label tracking and add a smoke test

commit 851054c617
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 20 12:11:29 2024 +0200

    Add port label tracking and add a smoke test

commit ec36e06b7b
Merge: 0bd3b0598 3caa9d780
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri May 17 14:59:28 2024 +0200

    Merge pull request #113 from tokens-studio/108-custom-editable-select-for-token-completion

    Custom editable select for token completion

commit 3caa9d780a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 11:37:36 2024 +0200

    Show checkmark icon for applied tokens

commit ad26d9e2d3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 10:55:24 2024 +0200

    More styling

commit 85a40d19ed
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 10:26:32 2024 +0200

    Extract component

commit b61a59d375
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 10:16:01 2024 +0200

    Extract key down handler

commit ced325e009
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 10:15:22 2024 +0200

    Return selected item map instead of value [*]

    [*] Multiple tokens could have the same value

commit e69bfb8c54
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 09:05:18 2024 +0200

    Style select

commit 8dd2ba7d78
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 09:04:50 2024 +0200

    Fix naming

commit cb980ace44
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 09:04:35 2024 +0200

    Use regular map for options

commit 165e222117
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 08:17:51 2024 +0200

    Only show dropdown when options contain items

commit b0dcbae3ac
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 08:13:55 2024 +0200

    Fix border clipping

commit 6a8887d9cc
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 08:04:23 2024 +0200

    Remove text transform

commit d2107e7f69
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 08:02:06 2024 +0200

    Fix width of drop down

commit 91271b9e41
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 17 07:57:55 2024 +0200

    Custom editable-select

commit 0bd3b0598b
Merge: 23ee54b4b a3d4d6226
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 18:43:05 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit 23ee54b4b7
Merge: bde2b4b3a c654766f8
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Thu May 16 18:37:46 2024 +0200

    Merge pull request #111 from tokens-studio/71-apply-token-from-the-shapes-panel-right-side

    Apply border radius token from the shapes panel

commit bde2b4b3a5
Merge: 3e7a42213 c44ac862f
Author: Akshay Gupta <akshay@hyma.io>
Date:   Thu May 16 17:15:59 2024 +0530

    Merge pull request #110 from tokens-studio/duplicate-token

    add functionality to duplicate token from context menu

commit c44ac862f0
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 16 15:48:39 2024 +0530

    simplify duplicate token function

commit c654766f87
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 11:43:37 2024 +0200

    Cleanup outdated props

commit 5205b684e9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 11:36:08 2024 +0200

    Fix token not being applied

commit e1ae3d55af
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 16 14:08:11 2024 +0530

    ad functionality to duplicate token from context menu

commit 23bee8415a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 09:59:55 2024 +0200

    Fix missing dependency

commit 48c85d7200
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 09:55:57 2024 +0200

    Simplify token application

commit 0d154679e9
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 09:44:11 2024 +0200

    Add docstrings

commit c60c5ac34f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 09:33:20 2024 +0200

    Apply tokens directly to shape

commit cdca00a986
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu May 16 09:02:48 2024 +0200

    Extract token apply function

commit 4e3af1407d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 18:28:04 2024 +0200

    Fix styling of dropdown items?

commit 9a58188dc3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 18:20:47 2024 +0200

    Show border-radius tokens as options

commit d9dbaad281
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 18:20:28 2024 +0200

    Add tokens map generators

commit 5e301605ad
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 17:44:06 2024 +0200

    Extract token grouping to core

commit 622843f18d
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 17:43:49 2024 +0200

    Take tokens as ref

commit 8f852bf48f
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 17:26:10 2024 +0200

    Use :as

commit 3e7a422136
Merge: f8972efea 591e33340
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed May 15 17:14:41 2024 +0200

    Merge pull request #104 from tokens-studio/fix-sizing-dimensions-mixup

    Fix sizing/dimensions token mixup

commit 591e333400
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Wed May 15 15:40:07 2024 +0200

    Fix sizing/dimensions token mixup

commit f8972efea0
Merge: d4dd49bdb d69cca2d9
Author: Akshay Gupta <akshay@hyma.io>
Date:   Wed May 15 18:56:42 2024 +0530

    Merge pull request #103 from tokens-studio/simple-context-menu

    fix delimiter mismatch and add missing data/tokens package

commit d69cca2d9c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 15 18:50:30 2024 +0530

    fix delimiter mismatch and add missing data/tokens package

commit d4dd49bdb7
Merge: 157bb01e8 ec5a11731
Author: Akshay Gupta <akshay@hyma.io>
Date:   Wed May 15 18:31:13 2024 +0530

    Merge pull request #97 from tokens-studio/simple-context-menu

    Simple context menu

commit ec5a117318
Merge: d3d454a43 157bb01e8
Author: Akshay Gupta <akshay@hyma.io>
Date:   Wed May 15 18:30:53 2024 +0530

    Merge branch 'token-studio-develop' into simple-context-menu

commit d3d454a43c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 15 14:50:24 2024 +0530

    move delete token to tokens actions section

commit 5fa2048b23
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 15 14:40:46 2024 +0530

    re-use workspace context menu entry and fix double nested ul

commit 316db61c8a
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 15 13:23:47 2024 +0530

    remove warning modal when deletion of a token

commit fcd7a35b46
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 15 12:59:18 2024 +0530

    move context menu functions to data/tokens

commit 157bb01e8f
Merge: b9e9f9fb1 584ac6341
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Tue May 14 16:39:16 2024 +0200

    Merge pull request #99 from tokens-studio/fix/containerization

    Downtune replica amount. Cleanup redis host

commit 584ac6341d
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Tue May 14 16:37:16 2024 +0200

    Downtune replica amount. Cleanup redis host

commit b9e9f9fb13
Merge: d67311b12 4d14d78ee
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue May 14 16:27:19 2024 +0200

    Merge pull request #98 from tokens-studio/icons-spacing

    Add more space between icon and label, fix icon offset

commit 4d14d78eed
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 14 16:01:11 2024 +0200

    Add more space between icon and label, fix icon offset

commit d67311b126
Merge: 230b271be e6f86cda6
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Tue May 14 15:26:01 2024 +0200

    Merge pull request #96 from tokens-studio/95-placeholder-icons

    Add token placeholder icons

commit 8cb9d9c352
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 14 18:48:48 2024 +0530

    Add delete token functionality in context menu

commit 31b487ed86
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 14 18:25:08 2024 +0530

    remoev translation function

commit 24f1693684
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Tue May 14 18:10:13 2024 +0530

    Add Context Menu for tokens and simple placeholder functions

commit e6f86cda64
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 14 14:24:36 2024 +0200

    Add token placeholder icons

commit 230b271be3
Merge: 740024061 677b28218
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 14 12:00:45 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit 7400240616
Merge: 550045cb3 aa8b1f4c7
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 16:42:34 2024 +0200

    Merge pull request #94 from tokens-studio/fix/containerization

    Chart does auto inject the release name

commit aa8b1f4c73
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 16:41:51 2024 +0200

    Chart does auto inject the release name

commit 550045cb3b
Merge: 50f69936a 60207fd01
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 16:21:37 2024 +0200

    Merge pull request #93 from tokens-studio/fix/containerization

    Circumvent bug

commit 60207fd01e
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 16:21:01 2024 +0200

    Circumvent bug

commit 50f69936a4
Merge: d90755531 f9d4b9f69
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 16:10:32 2024 +0200

    Merge pull request #92 from tokens-studio/fix/containerization

    Add missing secretName

commit f9d4b9f699
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 16:09:56 2024 +0200

    Add missing secretName

commit d907555314
Merge: d3c0abc11 e50a46409
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 15:32:21 2024 +0200

    Merge pull request #90 from tokens-studio/fix/containerization

    Add redis. Ingress should be under front end for some reason

commit e50a46409f
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 15:31:03 2024 +0200

    Add redis. Ingress should be under front end for some reason

commit d3c0abc11a
Merge: 64dc685f2 98d7895e2
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Mon May 13 15:09:48 2024 +0200

    Merge pull request #85 from tokens-studio/84-border-width

    Stroke Width

commit 64dc685f2a
Merge: 071df4074 79ce39612
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 15:07:23 2024 +0200

    Merge pull request #89 from tokens-studio/fix/containerization

    Fix pull secrets needed to be a reference

commit 79ce396122
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 15:06:22 2024 +0200

    Fix pull secrets needed to be a reference

commit 071df4074f
Merge: 309abec88 0ce5c165d
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 14:43:15 2024 +0200

    Merge pull request #88 from tokens-studio/fix/containerization

    Update secrets

commit 0ce5c165db
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 14:41:58 2024 +0200

    Update secrets

commit 309abec88a
Merge: 425155153 10aaa966f
Author: SorsOps <80043879+SorsOps@users.noreply.github.com>
Date:   Mon May 13 14:26:44 2024 +0200

    Merge pull request #87 from tokens-studio/fix/containerization

    Change deploy to use alternate chart as truecharts using a weird helm…

commit 10aaa966f9
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Mon May 13 14:25:07 2024 +0200

    Change deploy to use alternate chart as truecharts using a weird helm dependency

commit 98d7895e2a
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Mon May 13 11:23:30 2024 +0200

    Add stroke-width token

commit 4251551535
Merge: eafd4f01e ae263363e
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri May 10 17:36:50 2024 +0200

    Merge pull request #83 from tokens-studio/82-opacity

    Add opacity

commit eafd4f01eb
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Fri May 10 14:34:05 2024 +0200

    Use raw manifests

commit 153ea95a55
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Fri May 10 14:02:34 2024 +0200

    Typo

commit 16c893fa60
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Fri May 10 14:01:08 2024 +0200

    Add matrix for docker build

commit 0e94c9851a
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Fri May 10 13:59:09 2024 +0200

    Move workflow file

commit 07583b5e34
Author: SorsOps <80043879+sorsOps@users.noreply.github.com>
Date:   Fri May 10 13:57:17 2024 +0200

    Add deployment config

commit ae263363ed
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 9 21:36:38 2024 +0530

    Add opacity

commit 4e3ee7bdab
Merge: 5efcb0f42 42b25479b
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Fri May 10 12:05:06 2024 +0200

    Merge pull request #81 from tokens-studio/value-resolve

    Value resolve

commit 42b25479b3
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 10 10:36:56 2024 +0200

    Highlight invalid token values

commit 5813acea02
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 10 10:26:22 2024 +0200

    Log whole token

commit df48295903
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 10 10:22:09 2024 +0200

    Add resolving function and move to core ns

commit 5efcb0f424
Merge: 2ed4ece23 6d5beb758
Author: Akshay Gupta <akshay@hyma.io>
Date:   Fri May 10 12:25:23 2024 +0530

    Merge pull request #78 from tokens-studio/fix-assets-panel-view

    Fix assets panel tab view

commit 2ed4ece23d
Merge: d81b1f328 9a243e3b4
Author: Akshay Gupta <akshay@hyma.io>
Date:   Fri May 10 12:22:03 2024 +0530

    Merge pull request #76 from tokens-studio/token-pills-wrap

    Add flex wrap to token pills wrapper

commit d81b1f328d
Merge: 68a201374 0c856702c
Author: Akshay Gupta <akshay@hyma.io>
Date:   Fri May 10 12:21:38 2024 +0530

    Merge pull request #80 from tokens-studio/add-spacing-function

    Add simple token spacing application

commit 0c856702c6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Fri May 10 08:36:40 2024 +0200

    Remove unneeded import

commit 76a38bcb0c
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 9 21:36:38 2024 +0530

    Add simple token spacing application

commit 6d5beb7583
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 9 18:42:33 2024 +0530

    Fix assets panel tab view

commit 9a243e3b4f
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Thu May 9 17:51:48 2024 +0530

    Add flex wrap to token pills wrapper

commit 68a201374c
Merge: 11d4496e9 69ed15e78
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed May 8 14:29:15 2024 +0200

    Merge pull request #74 from tokens-studio/70-sort-sections-by-tokens

    Sort token groups

commit 11d4496e9a
Merge: 6fa1d6eec fd3922936
Author: Florian Schrödl <contact@florianschroedl.com>
Date:   Wed May 8 14:29:02 2024 +0200

    Merge pull request #68 from tokens-studio/65-dimensions

    Dimensions Token

commit 6fa1d6eecc
Merge: 6bb4eec80 3d13015e3
Author: Akshay Gupta <akshay@hyma.io>
Date:   Wed May 8 17:52:33 2024 +0530

    Merge pull request #66 from tokens-studio/close-token-modal

    add ability to close modal once save token button is clicked

commit 69ed15e789
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Remove search bar

commit e5a7f87d1c
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Sort token groups

commit fd39229367
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Add shape dimensions updating

commit a9aac4c867
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Move emit to the shape update function [*]

    [*] A shape update might need multiple emit functions

commit 3d13015e30
Author: Akshay Gupta <gravity.akshay@gmail.com>
Date:   Wed May 8 15:16:11 2024 +0530

    add ability to close modal once save token button is clicked

commit 28e6db9bb4
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Reuse attribute keys from token schema

commit 6bb4eec805
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Remove unneeded on-apply prop

commit 76f42a0aec
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Cleanup on-apply-token function

commit f71ce60b11
Merge: e5c564041 e7b065ac6
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Tue May 7 14:39:33 2024 +0200

    Merge remote-tracking branch 'penpot/develop' into token-studio-develop

commit e5c5640413
Author: Florian Schroedl <flo.schroedl@gmail.com>
Date:   Thu Apr 25 19:00:00 2024 +0200

    Start tokens studio plugin base
2024-11-12 10:35:32 +01:00
Pablo Alba
1c49dd80a4 Add from-invitation property to register-profile event 2024-11-11 17:18:53 +01:00
Pablo Alba
cbc92e9f1e Add created-by to invitations, and an event related 2024-11-11 17:00:54 +01:00
Belén Albeza
9b7d0563b9 🔧 Add rustfmt to the devenv 2024-11-11 15:25:31 +01:00
Pablo Alba
e1e13bcfb1 Fix a viewer can drop a .penpot file on dashboard 2024-11-11 13:19:30 +01:00
Pablo Alba
134c23c70c Add a help icon to plugins menu items disabled by viewer role 2024-11-11 13:08:52 +01:00
Pablo Alba
c89b6e2d6d Add error control on plugins permissions peek 2024-11-11 09:07:39 +01:00
Andrey Antukh
0d08549a04 🐛 Fix regression on sm/vec and sm/set schemas
Introduced in previous commits
2024-11-08 19:50:59 +01:00
Andrey Antukh
960f095c1b Merge pull request #5261 from penpot/palba-viewer-and-plugins
 Integrate viewer role with plugin menus and popup
2024-11-08 10:49:18 +01:00
Pablo Alba
d9eff00a71 Integrate viewer role with plugin menus and popup 2024-11-08 10:37:57 +01:00
Belén Albeza
7b196e1ca5 Merge pull request #5235 from penpot/azazeln28-handle-webgl-context
🎉 Handle WebGL Context
2024-11-08 09:38:45 +01:00
Alejandro
0981517bc6 Merge pull request #5263 from penpot/niwinz-bugfix-3
 Prevent logging EOF exceptions on SSE responses
2024-11-08 07:39:04 +01:00
Alejandro
8ae29ceaa2 Merge pull request #5256 from penpot/niwinz-bugfix-2
Fix incorrect behavior of ::sm/vec and ::sm/set decoder
2024-11-08 07:30:15 +01:00
Andrey Antukh
9eaa55b711 Prevent logging EOF exceptions on SSE responses
They are not necessary and they are pretty common, because
the user can interrupt the connection at any time.
2024-11-07 20:50:24 +01:00
Andrey Antukh
0c4b1cc4fc 📎 Update yarn.lock with text-editor dependency change 2024-11-07 20:24:33 +01:00
Edgars Andersons
5501859fa6 🌐 Add translations for: Latvian.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/lv/
2024-11-07 17:00:30 +01:00
Andrey Antukh
96f8832bcf Merge pull request #5260 from penpot/azazeln28-fix-text-editor-selection-issue
🐛 Fix text editor bug
2024-11-07 13:50:32 +01:00
AzazelN28
0b54215b84 🐛 Fix text editor bug 2024-11-07 13:06:34 +01:00
Andrey Antukh
33ff74e534 🐛 Use portal: protocol for local npm deps resolution 2024-11-07 12:41:49 +01:00
AzazelN28
23d3661ea5 🎉 Handle WebGL context state change 2024-11-07 11:36:27 +01:00
Andrey Antukh
46a6aff4da Merge pull request #5242 from penpot/niwinz-design-tokens
🎉 Merge tokens-studio
2024-11-07 10:33:24 +01:00
Andrey Antukh
cb21eeda94 🐛 Fix build 2024-11-07 09:42:36 +01:00
Andrey Antukh
b27edb4259 🐛 Use proper schema for move-file rpc method 2024-11-06 16:29:11 +01:00
Andrey Antukh
73d85b9884 🐛 Fix incorrect behavior of ::sm/vec and ::sm/set decoder 2024-11-06 16:29:11 +01:00
Andrey Antukh
dc41fe7616 Merge pull request #5226 from penpot/palba-rename-layers
🎉 Rename selected layer via shortcut and context menu option
2024-11-06 09:49:56 +01:00
Pablo Alba
48c41df054 🎉 Rename selected layer via shortcut and context menu option 2024-11-06 09:22:38 +01:00
Andrey Antukh
b86f2ba90d Merge pull request #5246 from penpot/luis-fix-updated-library-tab
🐛 Fix selected tab when updated library
2024-11-06 08:59:01 +01:00
Edgars Andersons
bf5a7e20d9 🌐 Add translations for: Latvian.
Currently translated at 98.0% (1424 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/lv/
2024-11-05 18:00:18 +01:00
Andrés Moya
3393963363 🔧 Apply feature flag to measures inputs 2024-11-05 16:22:20 +01:00
Andrés Moya
e641e93fd5 🐛 Fix sidebar tabs when there are no design tokens 2024-11-05 15:08:09 +01:00
Andrés Moya
99fcd3556e 🔧 Disable tokens in dev env by default 2024-11-05 14:21:09 +01:00
Andrey Antukh
b82679deaf 🎉 Merge tokens-studio 2024-11-05 14:21:09 +01:00
Andrey Antukh
0cd446421d 🐛 Fix some issues with vendored libraries and build process
related to how package.json is defined and how modules
are exported
2024-11-05 14:18:51 +01:00
Andrey Antukh
6014612046 Merge pull request #5252 from penpot/hiru-fix-manage
🐛 Fix merge error in manage script
2024-11-05 13:52:03 +01:00
Andrés Moya
eb211c0c8e 🐛 Fix merge error in manage script 2024-11-05 13:48:46 +01:00
Andrey Antukh
e6a9e27802 Merge remote-tracking branch 'origin/staging' into develop 2024-11-05 09:10:14 +01:00
Andrey Antukh
4ccd84f9c4 Merge pull request #5243 from penpot/niwinz-modules-improvements-1
♻️ Refactor bundle mechanism
2024-11-04 16:47:12 +01:00
Andrey Antukh
96102fc878 Update devenv default watch command for handle libs 2024-11-04 14:31:59 +01:00
luisddm
7f93060872 🐛 Fix selected tab when updated library 2024-11-04 09:23:20 +01:00
Edgars Andersons
c3ef12f145 🌐 Add translations for: Latvian.
Currently translated at 95.3% (1385 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/lv/
2024-11-02 14:00:19 +00:00
Andrey Antukh
39106c1e14 Improve e2e performance on CI 2024-11-01 10:04:03 +01:00
Andrey Antukh
607deb31dc ♻️ Refactor bundle mechanism
Mainly leave shadow-cljs for build cljs stuff and use esbuild
for bundle all js dependencies, completly avoiding all possible
incompatibility issues between js libraries and google closure
compiler.
2024-11-01 10:04:03 +01:00
Linerly
9a35c04bf0 🌐 Add translations for: Indonesian.
Currently translated at 100.0% (1453 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/id/
2024-11-01 07:04:40 +01:00
Andrey Antukh
366bca5f93 Merge remote-tracking branch 'origin/staging' into develop 2024-10-30 13:50:20 +01:00
Andrey Antukh
97a1bf15ef Improve how topic is managed on ws notifications 2024-10-30 13:39:38 +01:00
Andrey Antukh
9409078069 Add usage quotes for snapshots 2024-10-30 13:39:38 +01:00
Andrey Antukh
5b35cf7456 Add minor improvements to circleci config 2024-10-30 13:39:38 +01:00
Andrey Antukh
a9d3dfab1a Use schema instead of spec for validate worker submit options 2024-10-30 13:39:38 +01:00
Andrey Antukh
32126d1874 ♻️ Refactor file changes gc tasks
Make it more friendly with the current snapshoting mechanism
2024-10-30 13:39:38 +01:00
Andrey Antukh
5f4af76d28 Add permission checking to file snapshot rpc methods 2024-10-30 13:39:38 +01:00
Pablo Alba
b4f868be91 Update libraries links to new versions 2024-10-30 13:25:54 +01:00
Andrey Antukh
b6f35a5c1e Merge pull request #5233 from penpot/alotor-events-versions
 Add events for versions
2024-10-30 13:22:19 +01:00
alonso.torres
55fda698ec Add events for versions 2024-10-30 13:09:49 +01:00
Madalena Melo
c2467e12ba 🌐 Added translation for: Thai. 2024-10-30 12:07:45 +01:00
Denys Kisil
df74ad0e18 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 92.3% (1342 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-10-30 12:07:31 +01:00
Linerly
e2bdc67bd2 🌐 Add translations for: Indonesian.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/id/
2024-10-30 12:07:31 +01:00
Andrey Antukh
acf273e4e3 Merge pull request #5225 from penpot/azazeln28-panning-performance-improvement
 Improve panning code
2024-10-29 19:43:54 +01:00
Andrey Antukh
410bf7edfd Merge pull request #5229 from penpot/ladybenko-9177-viewport-wasm
 Create a separate viewport for wasm/canvas
2024-10-29 19:42:38 +01:00
Belén Albeza
345d97792f Create a separate viewport for wasm/canvas 2024-10-29 18:05:17 +01:00
Andrey Antukh
6b07c4179c Merge pull request #5221 from penpot/alotor-file-version
 File history versions management
2024-10-29 14:50:08 +01:00
alonso.torres
74d911f856 Add integration tests 2024-10-29 14:41:34 +01:00
alonso.torres
ecb7f0a2f6 File history versions management 2024-10-29 14:23:35 +01:00
AzazelN28
1e0e0aabf2 Improve panning code 2024-10-29 14:06:45 +01:00
Belén Albeza
fa4f2aa5cc Merge pull request #5201 from penpot/niwinz-shape-with-selrect-as-f32-array
 Shape with buffer
2024-10-29 13:47:37 +01:00
Andrey Antukh
7cb8eb783a Merge pull request #5223 from penpot/yms-remove-gitter-badge
📎 Remove gitter and add discourse badge
2024-10-29 12:30:02 +01:00
Yamila Moreno
ef679f6722 📎 Remove gitter and add discourse badge 2024-10-29 12:00:37 +01:00
Andrey Antukh
6443db64d7 Merge remote-tracking branch 'origin/staging' into develop 2024-10-29 11:42:42 +01:00
Aitor Moreno
e1fb022878 Merge pull request #5205 from penpot/niwinz-bugfix-8
🐛 General bugfixes
2024-10-29 11:32:52 +01:00
Alejandro Alonso
96bb282674 Fix many corner issues related to shape data structure change 2024-10-29 11:30:31 +01:00
Belén Albeza
4623f36042 Write shapes directly to wasm memory 2024-10-29 11:30:31 +01:00
Belén Albeza
29e0964ebc ♻️ Refactor rust/wasm code organization 2024-10-29 11:30:31 +01:00
Andrey Antukh
043c23899a 🎉 Add first impl of wasm-friendly for Shape data structure 2024-10-29 11:30:31 +01:00
Andrey Antukh
4cf5dc0791 Add minor improvement on error reporting on shape validation 2024-10-29 11:17:55 +01:00
Andrey Antukh
deaf6ef068 📎 Show version on dbg header 2024-10-29 11:17:54 +01:00
Andrey Antukh
75011ca0ff 🐛 Fix incorrect pred composition on number schema types
Fixes the following:

  => (sm/validate (sm/schema [::sm/int {:max 10}]) nil)
  Cannot invoke "Object.getClass()" because "x" is null
2024-10-29 11:17:01 +01:00
Andrey Antukh
ba3f84fd6c Increase internal s3 http client limits
Tries to improve performance of accidental spikes/bursts of
requests to s3 service. This is not a final solution to all issues
caused by unexpected burst, is a simple improvement to the current
apprach.
2024-10-29 11:17:01 +01:00
Andrey Antukh
f8c7f84c18 Use penpot own executor for s3 response completion executor 2024-10-29 11:17:01 +01:00
Andrey Antukh
7772ac0a85 Expose ::wrk/executor as ExecutorService instance
Instead of a plain Executor instance
2024-10-29 11:17:01 +01:00
Andrey Antukh
9329c2ebd9 🐛 Fix incorrect handling of EOF on s3 upload thread 2024-10-29 11:17:01 +01:00
Andrey Antukh
65f182001b 📎 Update backend scripts/repl with a default config 2024-10-29 11:17:01 +01:00
Andrey Antukh
fe83c5faea Add better reporting for s3 storage backend errors 2024-10-29 11:17:01 +01:00
Andrey Antukh
5b860ee601 🐛 Fix corner case on selection storage backend from settings
Related to how backward compatibility is handled with previous
settings.
2024-10-29 11:17:01 +01:00
Andrey Antukh
cb9839223e Add safer mechanism for tempfile naming
Using a uuidv8 that has strong guarranties about councurrent
ids generation that a simple random long
2024-10-29 11:17:01 +01:00
Andrey Antukh
15c42fba5e 🐛 Add retry mechanism for internal tmp file handling on s3 backend 2024-10-29 11:17:01 +01:00
Alejandro
e7d7291947 Merge pull request #5196 from penpot/niwinz-remove-graaljs
⬆️ Update deps (part 1) and remove graalvm js
2024-10-29 08:48:50 +01:00
Alejandro
04121efb13 Merge pull request #5219 from penpot/niwinz-parallel-circleci
🎉 Add parallel test jobs configuration for CircleCI
2024-10-29 07:50:44 +01:00
Andrey Antukh
32b9134722 🎉 Add parallel test jobs configuration for circleci 2024-10-28 16:28:08 +01:00
Andrey Antukh
8b60200ec6 Merge remote-tracking branch 'origin/staging' into develop 2024-10-28 11:39:42 +01:00
elhombretecla
7155b6a191 Update README.md
Adds plugins text
2024-10-28 11:30:35 +01:00
Andrey Antukh
a57a772394 Merge pull request #5216 from penpot/yms-fix-readme-badges
📎 Fix readme badges
2024-10-28 11:07:03 +01:00
Andrey Antukh
e9f6eefaeb Merge pull request #5198 from penpot/palba-testab-share-from-workspace
🎉 Add A/B test to start directly at the workspace
2024-10-28 11:06:42 +01:00
Yamila Moreno
4188f074ca 📎 Fix readme badges 2024-10-28 10:05:35 +01:00
Andrey Antukh
e0a4ec8b87 Merge pull request #5207 from penpot/palba-viewer-role-can-unpublish
🐛 Fix view role user have menu option for unpublish a library
2024-10-28 10:04:28 +01:00
Pablo Alba
122acb3eee 🐛 Fix view role user have menu option for unpublish a library 2024-10-28 09:48:40 +01:00
Pablo Alba
9728f1ba80 🐛 Fix unexpected failure on plugins-menu and info-menu 2024-10-28 09:48:33 +01:00
Andrey Antukh
93ca268ee7 Merge pull request #5203 from penpot/palba-rename-welcome-file
 Rename welcome file
2024-10-26 15:11:51 +02:00
Pablo Alba
b852dc86c0 🎉 Add A/B test to start directly at the workspace 2024-10-25 17:45:47 +02:00
Aitor Moreno
361b5decbe Merge pull request #5191 from penpot/palba-testab-templates-link
🎉 Add test A/B for add a link to the libraries page
2024-10-25 15:16:22 +02:00
Aitor Moreno
cd3c2b4bf7 Merge pull request #5160 from penpot/code-challenge-lambda-world-2024
:neckbeard: Winner of Code Challenge Lambda World 2024
2024-10-25 14:49:03 +02:00
Aitor Moreno
5718c1f287 Merge pull request #5200 from penpot/alotor-performance-improvement
 Improved performance for root frame movement
2024-10-25 14:48:10 +02:00
Andrey Antukh
d7caf5ed1a Merge pull request #5202 from penpot/yms-pin-latest-open-source-redis-version
⬆️ Pin redis@7.2 in docker-compose, as it's the latest open source version
2024-10-25 13:02:24 +02:00
Yamila Moreno
aa7cbc9f08 ⬆️ Pin redis@7.2 in docker-compose
It's the latest open source version
2024-10-25 12:29:31 +02:00
Pablo Alba
afb5ab7430 Rename welcome file 2024-10-25 12:23:35 +02:00
Andrey Antukh
c2ba7cdbc7 Merge remote-tracking branch 'origin/staging' into develop 2024-10-25 10:12:38 +02:00
alonso.torres
2f8be445d6 Improved performance for root frame movement 2024-10-24 17:00:16 +02:00
Belén Albeza
09e1bac41c Merge pull request #5190 from penpot/ladybenko-9046-emscripten
🎉 Switch new renderer to Emscripten (from wasm-bindgen)
2024-10-23 17:44:44 +02:00
Andrey Antukh
fc7fe41c98 Rename to render-wasm and make it load using dynamic import 2024-10-23 17:18:04 +02:00
Eva Marco
c7308ce634 Merge pull request #5181 from penpot/luis-replace-icon-buttons-workspace
♻️ Replace buttons on workspace
2024-10-23 16:13:51 +02:00
luisddm
e45fa1380d ♻️ Replace buttons on workspace
♻️ Replace buttons on workspace

♻️ Format files

🐛 Fix pull request issues
2024-10-23 14:46:47 +02:00
Belén Albeza
e4eb80f643 🎉 Switch new renderer to Emscripten (from wasm-bindgen) 2024-10-23 13:14:17 +02:00
Andrey Antukh
cc6e071f48 ♻️ Remove all usage of graalvm js runtime
And replace it with a commandline call to nodejs
for execute a custom svgo based command line script.
2024-10-22 23:30:56 +02:00
Andrey Antukh
283ea16627 Merge pull request #5197 from penpot/luis-fix-inspector-indentation-ellipsis-viewer
🐛 Fix intentation and ellipsis in the left sidebar when inspector is activated in viewer mode
2024-10-22 20:24:28 +02:00
Andrey Antukh
15b33488c6 ⬆️ Update exporter dependencies 2024-10-22 20:23:38 +02:00
Andrey Antukh
0e2be44e17 ⬆️ Update frontend dependencies 2024-10-22 20:23:38 +02:00
Andrey Antukh
f949649ba3 ⬆️ Update backend dependencies 2024-10-22 20:23:38 +02:00
Andrey Antukh
b31a6f33a5 ⬆️ Update dependencies on common 2024-10-22 20:23:38 +02:00
Andrey Antukh
51ecbf15a9 ⬆️ Update yetti and http server dependency 2024-10-22 20:23:38 +02:00
Andrey Antukh
0fd783e65e Make nodejs available on backend docker image
Used for execute svgo-cli.js script
2024-10-22 20:23:38 +02:00
Andrey Antukh
1da5fd106a 🐛 Fix future linter issue on common schema ns 2024-10-22 20:23:34 +02:00
luisddm
17aafe6775 🐛 Fix intentation and ellipsis in the left sidebar when inspector is activated in viewer mode 2024-10-22 18:47:01 +02:00
Andrés Moya
9064b9f849 🐛 Fix file builder hangs on export 2024-10-22 11:14:47 +02:00
Pablo Alba
9fc8760dc5 🎉 Add test A/B for add a link to the libraries page 2024-10-21 17:45:54 +02:00
Andrey Antukh
22800e71df Merge pull request #5189 from penpot/palba-bugs-viewer-role
Issues on viewer role
2024-10-21 17:28:56 +02:00
Pablo Alba
352b09a891 🐛 Fix bad order in roles dropdown 2024-10-21 17:05:53 +02:00
Pablo Alba
68f560e29b 🐛 Fix corner case of change rol to viewer when editing a text 2024-10-21 17:05:53 +02:00
Pablo Alba
4622dd0e0d 🐛 Fix bad team permissions showing on team page for viewer 2024-10-21 16:06:38 +02:00
Andrey Antukh
ed822d9f46 ⬆️ Update text editor bundle 2024-10-21 12:36:01 +02:00
Andrey Antukh
c1359d9677 💄 Add minor improvement to doc formatting 2024-10-21 12:36:01 +02:00
Andrey Antukh
ac33df2054 🐛 Remove plugin data from binfile v3 export 2024-10-21 12:36:01 +02:00
Andrey Antukh
b800fcafb4 💄 Add minor improvements to dashboard project menu 2024-10-21 12:36:01 +02:00
Andrey Antukh
6b997928e5 💄 Add minor improvements to dashboard file menu 2024-10-21 12:36:01 +02:00
Andrey Antukh
ee533e2644 Prevent warning of button inside button on dashboard 2024-10-21 12:36:01 +02:00
Andrey Antukh
d6da8afdce Add improved abstraction for team permissions
Relevant changes:
- replace user-viewer? with can-edit removing many double
  negations on the code
- always use team permissions making the permissions access uniform
  around all the code
- expose team permissions to ui tree through ctx/team-permissions
  context
2024-10-21 12:36:01 +02:00
Andrey Antukh
b3fcbd91e4 🐛 Remove the usage of namespaced keywords on toplevel global state
Because debuging the global state value becomes dificult when
exist a name clash on namespaced keywords and not namespaced keywords.
2024-10-21 12:36:01 +02:00
Andrey Antukh
51c6abb261 Disable rename support on the ui for binfile-v3
Not supported on backend
2024-10-21 12:36:01 +02:00
Andrey Antukh
43b86d403c Remove unused props from binfile-v3 progress report message 2024-10-21 12:36:01 +02:00
Andrey Antukh
6a1399dd50 Merge remote-tracking branch 'origin/staging' into develop 2024-10-21 11:20:27 +02:00
Andrey Antukh
6e62472759 Merge pull request #5172 from penpot/niwinz-binfile-v3
🎉 Add binfile-v3 export/import file format
2024-10-18 17:34:20 +02:00
Andrey Antukh
6c9f4a8fd5 ♻️ Reorganize files export and import related code on frontend 2024-10-18 17:19:29 +02:00
Andrey Antukh
8618cb950f 🎉 Add binfile-v3 export/import file format 2024-10-18 17:19:29 +02:00
Andrey Antukh
4fb5d3fb20 🐛 Add missing :key prop on legacy-zip format exportation component 2024-10-18 17:19:29 +02:00
Andrey Antukh
e0669ebbf8 Add minor improvements to schema and spec namespaces 2024-10-18 17:19:29 +02:00
Andrey Antukh
015fd5bc3a Expose a list of valid buckets on main storage ns 2024-10-18 17:19:29 +02:00
Andrey Antukh
88d85706ad ♻️ Refactor context-menu component 2024-10-18 17:19:29 +02:00
Andrey Antukh
782d733bc9 Improve error response formatting 2024-10-18 17:19:29 +02:00
Andrey Antukh
1318019ccb Merge remote-tracking branch 'origin/staging' into develop 2024-10-18 17:19:10 +02:00
Andrey Antukh
1aa2c0f9de Merge pull request #5135 from penpot/palba-eva-viewer-role
  Add viewer role
2024-10-18 10:31:40 +02:00
Pablo Alba
bd08e99080 ♻️ Clean up and refactors of viewer role 2024-10-18 10:12:59 +02:00
Pablo Alba
66530ca868 ♻️ Minor fixes on viewer role on workspace 2024-10-17 16:29:41 +02:00
Andrey Antukh
b4c2f2ecaa Merge pull request #5170 from penpot/palba-fix-missing-permisions-on-file-etag-cache
🐛 Fix missing permissions on file cache
2024-10-17 11:58:10 +02:00
Andrey Antukh
a739688780 Merge remote-tracking branch 'origin/staging' into develop 2024-10-16 17:59:28 +02:00
Andrey Antukh
790f6ce4ed 💄 Add cosmetic changes to get-file rpc method 2024-10-16 17:58:04 +02:00
Andrey Antukh
40d7bb04b4 Reuse permission from rpc/cond middleware for get-file rpc method 2024-10-16 17:58:04 +02:00
Pablo Alba
22d7cfc7fa 🐛 Fix missing permissions on file cache 2024-10-16 17:58:04 +02:00
Andrey Antukh
d4c775b1f4 🐛 Fix unexpected rare condition exception on rpc cond middleware 2024-10-16 17:58:00 +02:00
Eva Marco
536c25c206 ♻️ Resolve minor errors on viewer role on dashboard 2024-10-16 10:37:52 +02:00
Pablo Alba
6fb65de100 Close menus and modals on role change 2024-10-15 13:38:46 +02:00
Eva Marco
043c4105db Add viewer only mode on webhook 2024-10-15 13:38:46 +02:00
Pablo Alba
823792339f Kick out of a team - Visibility of System Status 2024-10-15 13:38:46 +02:00
Pablo Alba
226ab7233b Add viewer role to workspace 2024-10-15 13:38:46 +02:00
Pablo Alba
cf150891df Add view mode to dashboard 2024-10-15 13:32:33 +02:00
Andrey Antukh
c841ed6419 Merge remote-tracking branch 'origin/staging' into develop 2024-10-15 09:30:03 +02:00
Linerly
65c1eb3a63 🌐 Add translations for: Indonesian.
Currently translated at 97.8% (1422 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/id/
2024-10-12 18:16:34 +02:00
Andrey Antukh
8165635fad Merge remote-tracking branch 'origin/staging' into develop 2024-10-11 12:50:58 +02:00
alonso.torres
286a834f4a Merge remote-tracking branch 'origin/staging' into develop 2024-10-11 09:13:15 +02:00
Andrés Moya
c14d28dc1e :neckbeard: Winner of Code Challenge Lambda World 2024
https://community.penpot.app/t/were-attending-the-lambda-world-conf-october-2-4th/6647/2
2024-10-10 17:20:57 +02:00
Andrey Antukh
556ec45efc Merge pull request #5153 from penpot/yms-improve-flags-configuration-in-docker-compose
🐳 Improve flags configuration in docker-compose
2024-10-10 16:48:57 +02:00
Andrey Antukh
754e09b0de Merge remote-tracking branch 'origin/staging' into develop 2024-10-10 16:44:58 +02:00
Yamila Moreno
308b2d95f3 🐳 Improve flags configuration in docker-compose 2024-10-10 16:13:46 +02:00
Andrey Antukh
66053ae9df Merge remote-tracking branch 'origin/staging' into develop 2024-10-10 14:51:16 +02:00
Andrey Antukh
77348bb9a4 Merge pull request #5111 from penpot/bameda-docker-use-nginx-unprivileged-base-image
🐳 Use nginx-unprivileged as base image
2024-10-10 14:48:28 +02:00
David Barragán Merino
14257ae422 🐳 Change maintainer in docker images 2024-10-10 13:47:48 +02:00
David Barragán Merino
e64c956693 🐳 Use nginx-unprivileged as base image 2024-10-10 13:47:48 +02:00
David Barragán Merino
4a6b246f0f Add commands to build the docker images individually 2024-10-10 13:47:33 +02:00
Inex Code
6f7bc54a39 🌐 Add translations for: Russian.
Currently translated at 96.1% (1397 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ru/
2024-10-10 12:15:49 +02:00
Eero Pitkänen
0c8678eb87 🐛 Fix dragging path points by returning closest point instead of only the distance 2024-10-10 11:15:49 +02:00
alonso.torres
5dd14b929a 📚 Update changelog 2024-10-08 15:36:01 +02:00
Stas Haas
06fadc45f2 🌐 Add translations for: German.
Currently translated at 98.6% (1433 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/de/
2024-10-01 17:16:03 +02:00
IsCycleBai
f633a673c4 🌐 Add translations for: Chinese (Simplified Han script).
Currently translated at 94.9% (1379 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/zh_Hans/
2024-10-01 17:16:03 +02:00
Amerey.eu
e8d2c5e30d 🌐 Add translations for: Czech.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/cs/
2024-09-28 08:15:50 +02:00
Tatsuto Yamamoto
2992ec064f 🌐 Add translations for: Japanese.
Currently translated at 16.5% (241 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ja/
2024-09-26 17:15:50 +02:00
Cesar Andres Estrella Paredes
911281b7b9 🌐 Add translations for: Spanish.
Currently translated at 99.3% (1444 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/es/
2024-09-26 17:15:49 +02:00
Denys Kisil
e2e6e7db85 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 91.2% (1326 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-09-20 12:02:00 +02:00
Denys Kisil
2b492134be 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 85.5% (1243 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-09-17 12:09:20 +02:00
Henrik Allberg
7bdc97fbfa 🌐 Add translations for: Swedish.
Currently translated at 99.5% (1446 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/sv/
2024-09-13 23:09:19 +02:00
Henrik Allberg
5059d71509 🌐 Add translations for: Swedish.
Currently translated at 99.5% (1446 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/sv/
2024-09-11 20:09:23 +00:00
Henrik Allberg
76c054a591 🌐 Add translations for: Swedish.
Currently translated at 60.9% (885 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/sv/
2024-09-10 19:09:36 +00:00
Jarne Förster
4471dca3f3 🌐 Add translations for: German.
Currently translated at 98.0% (1424 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/de/
2024-09-10 19:09:11 +00:00
Denys Kisil
6c3b82ed85 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 85.6% (1244 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-09-09 20:32:26 +02:00
Madalena Melo
f91434433e 🌐 Added translation for: Swedish. 2024-09-09 16:10:57 +02:00
Madalena Melo
b6f82be56a 🌐 Added translation for: Portuguese. 2024-09-09 16:10:46 +02:00
Denys Kisil
c633970f9d 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 78.5% (1141 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-09-08 14:09:15 +02:00
Denys Kisil
95e5b1ec5e 🌐 Add translations for: Ukrainian (ukr_UA).
Currently translated at 55.3% (804 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/ukr_UA/
2024-09-07 10:46:03 +02:00
Stas Haas
f84b3187a5 🌐 Add translations for: German.
Currently translated at 97.7% (1421 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/de/
2024-09-04 12:09:13 +02:00
Unreal Vision
087f779fef 🌐 Add translations for: French.
Currently translated at 96.3% (1400 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/fr/
2024-09-04 12:09:12 +02:00
Oğuz Ersen
ca283c2d26 🌐 Add translations for: Turkish.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/tr/
2024-08-26 13:09:24 +02:00
Stephan Paternotte
9008eb218b 🌐 Add translations for: Dutch.
Currently translated at 99.5% (1447 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/nl/
2024-08-24 17:09:57 +02:00
Yaron Shahrabani
089b77379d 🌐 Add translations for: Hebrew.
Currently translated at 99.5% (1446 of 1453 strings)

Translation: Penpot/frontend
Translate-URL: https://hosted.weblate.org/projects/penpot/frontend/he/
2024-08-24 17:09:56 +02:00
671 changed files with 84005 additions and 81573 deletions

View File

@@ -1,6 +1,130 @@
version: 2
version: 2.1
jobs:
build:
test-common:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "common/deps.edn"}}
- run:
name: "fmt check & linter"
working_directory: "./common"
command: |
yarn install
yarn run fmt:clj:check
yarn run lint:clj
- run:
name: "JVM tests"
working_directory: "./common"
command: |
clojure -M:dev:test
- run:
name: "NODE tests"
working_directory: "./common"
command: |
yarn run test
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "common/deps.edn"}}
test-frontend:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "frontend/deps.edn"}}
- run:
name: "prepopulate linter cache"
working_directory: "./common"
command: |
yarn install
yarn run lint:clj
- run:
name: "fmt check & linter"
working_directory: "./frontend"
command: |
yarn install
yarn run fmt:clj:check
yarn run fmt:js:check
yarn run lint:scss
yarn run lint:clj
- run:
name: "unit tests"
working_directory: "./frontend"
command: |
yarn install
yarn run test
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "frontend/deps.edn"}}
test-integration:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: large
environment:
JAVA_OPTS: -Xmx6g -Xms2g
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "frontend/deps.edn"}}
- run:
name: "integration tests"
working_directory: "./frontend"
command: |
yarn install
yarn run build:app:assets
yarn run build:app
yarn run build:app:libs
yarn run playwright install --with-deps chromium
yarn run test:e2e -x --workers=4
test-backend:
docker:
- image: penpotapp/devenv:latest
- image: cimg/postgres:14.5
@@ -20,104 +144,30 @@ jobs:
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "backend/deps.edn" }}-{{ checksum "frontend/deps.edn"}}-{{ checksum "common/deps.edn"}}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: cd .clj-kondo && cat config.edn
- run: cat .cljfmt.edn
- run: clj-kondo --version
- v1-dependencies-{{ checksum "backend/deps.edn" }}
- run:
name: "backend fmt check"
working_directory: "./backend"
command: |
yarn install
yarn run fmt:clj:check
- run:
name: "exporter fmt check"
working_directory: "./exporter"
command: |
yarn install
yarn run fmt:clj:check
- run:
name: "common fmt check"
working_directory: "./common"
command: |
yarn install
yarn run fmt:clj:check
- run:
name: "frontend fmt check"
working_directory: "./frontend"
command: |
yarn install
yarn run fmt:clj:check
yarn run fmt:js:check
- run:
name: "common linter check"
name: "prepopulate linter cache"
working_directory: "./common"
command: |
yarn install
yarn run lint:clj
- run:
name: "frontend linter check"
working_directory: "./frontend"
command: |
yarn install
yarn run lint:scss
yarn run lint:clj
- run:
name: "backend linter check"
name: "fmt check & linter"
working_directory: "./backend"
command: |
yarn install
yarn run fmt:clj:check
yarn run lint:clj
- run:
name: "exporter linter check"
working_directory: "./exporter"
command: |
yarn install
yarn run lint:clj
- run:
name: "common tests"
working_directory: "./common"
command: |
yarn test
clojure -M:dev:test
- run:
name: "frontend tests"
working_directory: "./frontend"
command: |
yarn install
yarn test
- run:
name: "frontend integration tests"
working_directory: "./frontend"
command: |
yarn install
yarn run build:app:assets
clojure -M:dev:shadow-cljs release main
yarn playwright install --with-deps chromium
yarn test:e2e
- run:
name: "backend tests"
name: "tests"
working_directory: "./backend"
command: |
clojure -M:dev:test
clojure -M:dev:test --reporter kaocha.report/documentation
environment:
PENPOT_TEST_DATABASE_URI: "postgresql://localhost/penpot_test"
@@ -128,4 +178,43 @@ jobs:
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "backend/deps.edn" }}-{{ checksum "frontend/deps.edn"}}-{{ checksum "common/deps.edn"}}
key: v1-dependencies-{{ checksum "backend/deps.edn" }}
test-exporter:
docker:
- image: penpotapp/devenv:latest
working_directory: ~/repo
resource_class: medium+
environment:
JAVA_OPTS: -Xmx4g -Xms100m -XX:+UseSerialGC
NODE_OPTIONS: --max-old-space-size=4096
steps:
- checkout
- run:
name: "prepopulate linter cache"
working_directory: "./common"
command: |
yarn install
yarn run lint:clj
- run:
name: "fmt check & linter"
working_directory: "./exporter"
command: |
yarn install
yarn run fmt:clj:check
yarn run lint:clj
workflows:
penpot:
jobs:
- test-frontend
- test-integration
- test-backend
- test-common
- test-exporter

View File

@@ -4,7 +4,6 @@
:remove-consecutive-blank-lines? false
:extra-indents {rumext.v2/fnc [[:inner 0]]
cljs.test/async [[:inner 0]]
app.common.schema/register! [[:inner 0] [:inner 1]]
promesa.exec/thread [[:inner 0]]
specify! [[:inner 0] [:inner 1]]}
}

View File

@@ -1,5 +1,56 @@
# CHANGELOG
## 2.4.2
### :bug: Bugs fixed
- Fix detach when top copy is dangling and nested copy is not [Taiga #9699](https://tree.taiga.io/project/penpot/issue/9699)
- Fix problem in plugins with `replaceColor` method [#174](https://github.com/penpot/penpot-plugins/issues/174)
- Fix issue with recursive commponents [Taiga #9903](https://tree.taiga.io/project/penpot/issue/9903)
- Fix missing methods reference on API Docs
- Fix memory usage issue on file-gc asynchronous task (related to snapshots feature)
## 2.4.1
### :bug: Bugs fixed
- Fix error when importing files with touched components [Taiga #9625](https://tree.taiga.io/project/penpot/issue/9625)
- Fix problem when changing color libraries [Plugins #184](https://github.com/penpot/penpot-plugins/issues/184)
## 2.4.0
### :rocket: Epics and highlights
### :boom: Breaking changes & Deprecations
- Use [nginx-unprivileged](https://hub.docker.com/r/nginxinc/nginx-unprivileged) as base image for
Penpot's frontend docker image. Now all the docker images runs with the same unprivileged user
(penpot). Because of that, the default NGINX listen port is now 8080 instead of 80, so
you will have to modify your infrastructure to apply this change.
- Redis 7.2 is explicitly pinned in our example docker-compose.yml file. This is done because,
starting with the next versions, Redis is no longer distributed under an open-source license.
On-premise users are obviously free to upgrade to the version they are using or a more modern one.
Keep in mind that if you were using a version other than 7.2, you may have to recreate the volume
associated with the Redis container because the 7.2 storage format may not be compatible with what
you already have stored on the volume, and Redis may not start. In the near future, we will evaluate
whether to move to an open-source version of Redis (such as https://valkey.io/).
### :heart: Community contributions (Thank you!)
### :sparkles: New features
- Viewer role for team members [Taiga #1056](https://tree.taiga.io/project/penpot/us/1056) & [Taiga #6590](https://tree.taiga.io/project/penpot/us/6590)
- File history versions management [Taiga #187](https://tree.taiga.io/project/penpot/us/187?milestone=411120)
- Rename selected layer via keyboard shortcut and context menu option [Taiga #8882](https://tree.taiga.io/project/penpot/us/8882)
- New .penpot file format [Taiga #8657](https://tree.taiga.io/project/penpot/us/8657)
### :bug: Bugs fixed
- Fix problem with some texts desynchronization [Taiga #9379](https://tree.taiga.io/project/penpot/issue/9379)
- Fix problem with reoder grid layers [#5446](https://github.com/penpot/penpot/issues/5446)
- Fix problem with swap component style [#9542](https://tree.taiga.io/project/penpot/issue/9542)
## 2.3.3
### :bug: Bugs fixed
@@ -176,6 +227,7 @@ time being.
- Fix problem with comments max length [Taiga #8778](https://tree.taiga.io/project/penpot/issue/8778)
- Fix copy/paste images in Safari [Taiga #8771](https://tree.taiga.io/project/penpot/issue/8771)
- Fix swap when the copy is the only child of a group [#5075](https://github.com/penpot/penpot/issues/5075)
- Fix file builder hangs when exporting [#5099](https://github.com/penpot/penpot/issues/5099)
## 2.1.5

View File

@@ -10,7 +10,7 @@
<p align="center">
<a href="https://www.mozilla.org/en-US/MPL/2.0" rel="nofollow"><img alt="License: MPL-2.0" src="https://img.shields.io/badge/MPL-2.0-blue.svg" style="max-width:100%;"></a>
<a href="https://gitter.im/penpot/community" rel="nofollow"><img alt="Gitter" src="https://badges.gitter.im/sereno-xyz/community.svg" style="max-width:100%;"></a>
<a href="https://community.penpot.app" rel="nofollow"><img alt="Penpot Community" src="https://img.shields.io/discourse/posts?server=https%3A%2F%2Fcommunity.penpot.app" style="max-width:100%;"></a>
<a href="https://tree.taiga.io/project/penpot/" title="Managed with Taiga.io" rel="nofollow"><img alt="Managed with Taiga.io" src="https://img.shields.io/badge/managed%20with-TAIGA.io-709f14.svg" style="max-width:100%;"></a>
<a href="https://gitpod.io/#https://github.com/penpot/penpot" rel="nofollow"><img alt="Gitpod ready-to-code" src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod" style="max-width:100%;"></a>
</p>

View File

@@ -3,10 +3,10 @@
:deps
{penpot/common {:local/root "../common"}
org.clojure/clojure {:mvn/version "1.12.0-alpha12"}
org.clojure/clojure {:mvn/version "1.12.0"}
org.clojure/tools.namespace {:mvn/version "1.5.0"}
com.github.luben/zstd-jni {:mvn/version "1.5.6-3"}
com.github.luben/zstd-jni {:mvn/version "1.5.6-6"}
io.prometheus/simpleclient {:mvn/version "0.16.0"}
io.prometheus/simpleclient_hotspot {:mvn/version "0.16.0"}
@@ -17,33 +17,33 @@
io.prometheus/simpleclient_httpserver {:mvn/version "0.16.0"}
io.lettuce/lettuce-core {:mvn/version "6.3.2.RELEASE"}
io.lettuce/lettuce-core {:mvn/version "6.4.0.RELEASE"}
java-http-clj/java-http-clj {:mvn/version "0.4.3"}
funcool/yetti
{:git/tag "v10.0"
:git/sha "520613f"
{:git/tag "v11.4"
:git/sha "ce50d42"
:git/url "https://github.com/funcool/yetti.git"
:exclusions [org.slf4j/slf4j-api]}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.939"}
metosin/reitit-core {:mvn/version "0.7.0"}
nrepl/nrepl {:mvn/version "1.1.2"}
cider/cider-nrepl {:mvn/version "0.48.0"}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.955"}
metosin/reitit-core {:mvn/version "0.7.2"}
nrepl/nrepl {:mvn/version "1.3.0"}
cider/cider-nrepl {:mvn/version "0.50.2"}
org.postgresql/postgresql {:mvn/version "42.7.3"}
org.xerial/sqlite-jdbc {:mvn/version "3.46.0.0"}
org.postgresql/postgresql {:mvn/version "42.7.4"}
org.xerial/sqlite-jdbc {:mvn/version "3.46.1.3"}
com.zaxxer/HikariCP {:mvn/version "5.1.0"}
com.zaxxer/HikariCP {:mvn/version "6.0.0"}
io.whitfin/siphash {:mvn/version "2.0.0"}
buddy/buddy-hashers {:mvn/version "2.0.167"}
buddy/buddy-sign {:mvn/version "3.5.351"}
buddy/buddy-sign {:mvn/version "3.6.1-359"}
com.github.ben-manes.caffeine/caffeine {:mvn/version "3.1.8"}
org.jsoup/jsoup {:mvn/version "1.17.2"}
org.jsoup/jsoup {:mvn/version "1.18.1"}
org.im4java/im4java
{:git/tag "1.4.0-penpot-2"
:git/sha "e2b3e16"
@@ -58,7 +58,7 @@
;; Pretty Print specs
pretty-spec/pretty-spec {:mvn/version "0.1.4"}
software.amazon.awssdk/s3 {:mvn/version "2.25.63"}
software.amazon.awssdk/s3 {:mvn/version "2.28.26"}
}
:paths ["src" "resources" "target/classes"]
@@ -74,7 +74,7 @@
:build
{:extra-deps
{io.github.clojure/tools.build {:git/tag "v0.10.3" :git/sha "15ead66"}}
{io.github.clojure/tools.build {:git/tag "v0.10.5" :git/sha "2a21b7a"}}
:ns-default build}
:test

View File

@@ -137,7 +137,6 @@
;; :v6 v6
;; }])))
(defn calculate-frames
[{:keys [data]}]
(->> (vals (:pages-index data))

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" monitorInterval="30">
<Configuration status="fatal" monitorInterval="30">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{YYYY-MM-dd HH:mm:ss.SSS}] %level{length=1} %logger{36} - %msg%n"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" monitorInterval="30">
<Configuration status="fatal" monitorInterval="30">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{YYYY-MM-dd HH:mm:ss.SSS}] %level{length=1} %logger{36} - %msg%n"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" monitorInterval="30">
<Configuration status="fatal" monitorInterval="30">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{YYYY-MM-dd HH:mm:ss.SSS}] %level{length=1} %logger{36} - %msg%n"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info" monitorInterval="60">
<Configuration status="fatal" monitorInterval="60">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{YYYY-MM-dd HH:mm:ss.SSS}] %level{length=1} %logger{36} - %msg%n"

View File

@@ -7,6 +7,8 @@ set -ex
rm -rf target;
mkdir -p target/classes;
mkdir -p target/dist;
mkdir -p target/dist/scripts;
echo "$CURRENT_VERSION" > target/classes/version.txt;
cp ../CHANGES.md target/classes/changelog.md;
@@ -15,6 +17,7 @@ mv target/penpot.jar target/dist/penpot.jar
cp resources/log4j2.xml target/dist/log4j2.xml
cp scripts/run.template.sh target/dist/run.sh;
cp scripts/manage.py target/dist/manage.py
cp scripts/svgo-cli.js target/dist/scripts/;
chmod +x target/dist/run.sh;
chmod +x target/dist/manage.py

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
export PENPOT_SECRET_KEY=super-secret-devenv-key
export PENPOT_HOST=devenv
export PENPOT_TENANT=dev
export PENPOT_FLAGS="\
$PENPOT_FLAGS \
enable-login-with-ldap \

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
export PENPOT_SECRET_KEY=super-secret-devenv-key
export PENPOT_HOST=devenv
export PENPOT_TENANT=dev
export PENPOT_FLAGS="\
$PENPOT_FLAGS \
enable-prepl-server \
@@ -10,6 +10,7 @@ export PENPOT_FLAGS="\
enable-webhooks \
enable-backend-asserts \
enable-audit-log \
enable-login-with-ldap \
enable-transit-readable-response \
enable-demo-users \
enable-feature-fdata-pointer-map \

214
backend/scripts/svgo-cli.js Normal file
View File

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@
(:require
[buddy.hashers :as hashers]))
(def default-params
(def ^:private default-options
{:alg :argon2id
:memory 32768 ;; 32 MiB
:iterations 3
@@ -16,12 +16,12 @@
(defn derive-password
[password]
(hashers/derive password default-params))
(hashers/derive password default-options))
(defn verify-password
[attempt password]
(try
(hashers/verify attempt password)
(hashers/verify attempt password default-options)
(catch Throwable _
{:update false
:valid false})))

View File

@@ -8,9 +8,8 @@
(:require
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[clj-ldap.client :as ldap]
[clojure.spec.alpha :as s]
[clojure.string]
[integrant.core :as ig]))
@@ -58,21 +57,26 @@
:email email
:backend "ldap"})))
(s/def ::fullname ::us/not-empty-string)
(s/def ::email ::us/email)
(s/def ::backend ::us/not-empty-string)
(def ^:private schema:info-data
[:map
[:fullname ::sm/text]
[:email ::sm/email]
[:backend ::sm/text]])
(s/def ::info-data
(s/keys :req-un [::fullname ::email ::backend]))
(def ^:private valid-info-data?
(sm/lazy-validator schema:info-data))
(def ^:private explain-info-data
(sm/lazy-explainer schema:info-data))
(defn authenticate
[cfg params]
(with-open [conn (connect cfg)]
(when-let [user (-> (assoc cfg ::conn conn)
(retrieve-user params))]
(when-not (s/valid? ::info-data user)
(let [explain (s/explain-str ::info-data user)]
(l/warn ::l/raw (str "invalid response from ldap, looks like ldap is not configured correctly\n" explain))
(when-not (valid-info-data? user)
(let [explain (explain-info-data user)]
(l/warn :hint "invalid response from ldap, looks like ldap is not configured correctly" :data user)
(ex/raise :type :restriction
:code :wrong-ldap-response
:explain explain)))
@@ -102,38 +106,31 @@
:host (:host cfg) :port (:port cfg) :cause cause)
nil))))
(s/def ::enabled? ::us/boolean)
(s/def ::host ::us/string)
(s/def ::port ::us/integer)
(s/def ::ssl ::us/boolean)
(s/def ::tls ::us/boolean)
(s/def ::query ::us/string)
(s/def ::base-dn ::us/string)
(s/def ::bind-dn ::us/string)
(s/def ::bind-password ::us/string)
(s/def ::attrs-email ::us/string)
(s/def ::attrs-fullname ::us/string)
(s/def ::attrs-username ::us/string)
(def ^:private schema:params
[:map
[:host {:optional true} :string]
[:port {:optional true} ::sm/int]
[:bind-dn {:optional true} :string]
[:bind-passwor {:optional true} :string]
[:query {:optional true} :string]
[:base-dn {:optional true} :string]
[:attrs-email {:optional true} :string]
[:attrs-username {:optional true} :string]
[:attrs-fullname {:optional true} :string]
[:ssl {:optional true} ::sm/boolean]
[:tls {:optional true} ::sm/boolean]])
(s/def ::provider-params
(s/keys :opt-un [::host ::port
::ssl ::tls
::enabled?
::bind-dn
::bind-password
::query
::attrs-email
::attrs-username
::attrs-fullname]))
(def ^:private check-params
(sm/check-fn schema:params :hint "Invalid LDAP provider parameters"))
(s/def ::provider
(s/nilable ::provider-params))
(defmethod ig/pre-init-spec ::provider
[_]
(s/spec ::provider))
(defmethod ig/assert-key ::provider
[_ params]
(when (:enabled params)
(some->> params check-params)))
(defmethod ig/init-key ::provider
[_ cfg]
(when (:enabled? cfg)
(when (:enabled cfg)
(try-connectivity cfg)))
(sm/register! ::provider schema:params)

View File

@@ -12,7 +12,7 @@
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uri :as u]
[app.config :as cf]
[app.db :as db]
@@ -32,11 +32,10 @@
[buddy.sign.jwk :as jwk]
[buddy.sign.jwt :as jwt]
[clojure.set :as set]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]
[ring.request :as rreq]
[ring.response :as-alias rres]))
[yetti.request :as yreq]
[yetti.response :as-alias yres]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HELPERS
@@ -140,8 +139,9 @@
(l/warn :hint "unable to retrieve JWKs (unexpected exception)"
:cause cause)))))
(defmethod ig/pre-init-spec ::providers/generic [_]
(s/keys :req [::http/client]))
(defmethod ig/assert-key ::providers/generic
[_ params]
(assert (http/client? (::http/client params)) "expected a valid http client"))
(defmethod ig/init-key ::providers/generic
[_ cfg]
@@ -197,6 +197,10 @@
;; GITHUB AUTH PROVIDER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- int-in-range?
[val start end]
(and (<= start val) (< val end)))
(defn- retrieve-github-email
[cfg tdata props]
(or (some-> props :github/email)
@@ -207,7 +211,7 @@
{:keys [status body]} (http/req! cfg params {:sync? true})]
(when-not (s/int-in-range? 200 300 status)
(when-not (int-in-range? status 200 300)
(ex/raise :type :internal
:code :unable-to-retrieve-github-emails
:hint "unable to retrieve github emails"
@@ -217,8 +221,9 @@
(->> body json/decode (filter :primary) first :email))))
(defmethod ig/pre-init-spec ::providers/github [_]
(s/keys :req [::http/client]))
(defmethod ig/assert-key ::providers/github
[_ params]
(assert (http/client? (::http/client params)) "expected a valid http client"))
(defmethod ig/init-key ::providers/github
[_ cfg]
@@ -394,7 +399,7 @@
:status (:status response)
:body (:body response))
(when-not (s/int-in-range? 200 300 (:status response))
(when-not (int-in-range? (:status response) 200 300)
(ex/raise :type :internal
:code :unable-to-retrieve-user-info
:hint "unable to retrieve user info"
@@ -418,15 +423,15 @@
(l/warn :hint "unable to get user info from JWT token (unexpected exception)"
:cause cause))))
(s/def ::backend ::us/not-empty-string)
(s/def ::email ::us/not-empty-string)
(s/def ::fullname ::us/not-empty-string)
(s/def ::props (s/map-of ::us/keyword any?))
(s/def ::info
(s/keys :req-un [::backend
::email
::fullname
::props]))
(def ^:private schema:info
[:map
[:backend ::sm/text]
[:email ::sm/email]
[:fullname ::sm/text]
[:props [:map-of :keyword :any]]])
(def ^:private valid-info?
(sm/validator schema:info))
(defn- get-info
[{:keys [::provider ::setup/props] :as cfg} {:keys [params] :as request}]
@@ -444,7 +449,7 @@
(l/trc :hint "user info" :info info)
(when-not (s/valid? ::info info)
(when-not (valid-info? info)
(l/warn :hint "received incomplete profile info object (please set correct scopes)" :info info)
(ex/raise :type :internal
:code :incomplete-user-info
@@ -492,8 +497,8 @@
(defn- redirect-response
[uri]
{::rres/status 302
::rres/headers {"location" (str uri)}})
{::yres/status 302
::yres/headers {"location" (str uri)}})
(defn- redirect-with-error
([error] (redirect-with-error error nil))
@@ -598,7 +603,7 @@
(defn- get-external-session-id
[request]
(let [session-id (rreq/get-header request "x-external-session-id")]
(let [session-id (yreq/get-header request "x-external-session-id")]
(when (string? session-id)
(if (or (> (count session-id) 256)
(= session-id "null")
@@ -618,8 +623,8 @@
state (tokens/generate (::setup/props cfg)
(d/without-nils params))
uri (build-auth-uri cfg state)]
{::rres/status 200
::rres/body {:redirect-uri uri}}))
{::yres/status 200
::yres/body {:redirect-uri uri}}))
(defn- callback-handler
[{:keys [::provider] :as cfg} request]
@@ -655,46 +660,37 @@
:provider provider
:hint "provider not configured"))))))})
(s/def ::client-id ::us/string)
(s/def ::client-secret ::us/string)
(s/def ::base-uri ::us/string)
(s/def ::token-uri ::us/string)
(s/def ::auth-uri ::us/string)
(s/def ::user-uri ::us/string)
(s/def ::scopes ::us/set-of-strings)
(s/def ::roles ::us/set-of-strings)
(s/def ::roles-attr ::us/string)
(s/def ::email-attr ::us/string)
(s/def ::name-attr ::us/string)
(def ^:private schema:provider
[:map {:title "provider"}
[:client-id ::sm/text]
[:client-secret ::sm/text]
[:base-uri {:optional true} ::sm/text]
[:token-uri {:optional true} ::sm/text]
[:auth-uri {:optional true} ::sm/text]
[:user-uri {:optional true} ::sm/text]
[:scopes {:optional true}
[::sm/set ::sm/text]]
[:roles {:optional true}
[::sm/set ::sm/text]]
[:roles-attr {:optional true} ::sm/text]
[:email-attr {:optional true} ::sm/text]
[:name-attr {:optional true} ::sm/text]])
(s/def ::provider
(s/keys :req-un [::client-id
::client-secret]
:opt-un [::base-uri
::token-uri
::auth-uri
::user-uri
::scopes
::roles
::roles-attr
::email-attr
::name-attr]))
(def ^:private schema:routes-params
[:map
::session/manager
::http/client
::setup/props
::db/pool
[::providers [:map-of :keyword [:maybe schema:provider]]]])
(s/def ::providers (s/map-of ::us/keyword (s/nilable ::provider)))
(s/def ::routes vector?)
(defmethod ig/pre-init-spec ::routes
[_]
(s/keys :req [::session/manager
::http/client
::setup/props
::db/pool
::providers]))
(defmethod ig/assert-key ::routes
[_ params]
(assert (sm/check schema:routes-params params)))
(defmethod ig/init-key ::routes
[_ cfg]
(let [cfg (update cfg :provider d/without-nils)]
(let [cfg (update cfg :providers d/without-nils)]
["" {:middleware [[session/authz cfg]
[provider-lookup cfg]]}
["/auth/oauth"

View File

@@ -37,6 +37,21 @@
(def ^:dynamic *state* nil)
(def ^:dynamic *options* nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DEFAULTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Threshold in MiB when we pass from using
;; in-memory byte-array's to use temporal files.
(def temp-file-threshold
(* 1024 1024 2))
;; A maximum (storage) object size allowed: 100MiB
(def ^:const max-object-size
(* 1024 1024 100))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def xf-map-id
(map :id))
@@ -56,6 +71,13 @@
(def conj-vec
(fnil conj []))
(defn initial-state
[]
{:storage-objects #{}
:files #{}
:teams #{}
:projects #{}})
(defn collect-storage-objects
[state items]
(update state :storage-objects into xf-map-media-id items))
@@ -87,6 +109,8 @@
attrs))
(defn update-index
([coll]
(update-index {} coll identity))
([index coll]
(update-index index coll identity))
([index coll attr]
@@ -110,10 +134,30 @@
(update :data feat.fdata/process-pointers deref)
(update :data feat.fdata/process-objects (partial into {}))))))))
(defn clean-file-features
[file]
(update file :features (fn [features]
(if (set? features)
(-> features
(cfeat/migrate-legacy-features)
(set/difference cfeat/frontend-only-features)
(set/difference cfeat/backend-only-features))
#{}))))
(defn get-project
[cfg project-id]
(db/get cfg :project {:id project-id}))
(def ^:private sql:get-teams
"SELECT t.* FROM team WHERE id = ANY(?)")
(defn get-teams
[cfg ids]
(let [conn (db/get-connection cfg)
ids (db/create-array conn "uuid" ids)]
(->> (db/exec! conn [sql:get-teams ids])
(map decode-row))))
(defn get-team
[cfg team-id]
(-> (db/get cfg :team {:id team-id})
@@ -167,9 +211,10 @@
(defn get-file-object-thumbnails
"Return all file object thumbnails for a given file."
[cfg file-id]
(db/query cfg :file-tagged-object-thumbnail
{:file-id file-id
:deleted-at nil}))
(->> (db/query cfg :file-tagged-object-thumbnail
{:file-id file-id
:deleted-at nil})
(not-empty)))
(defn get-file-thumbnail
"Return the thumbnail for the specified file-id"
@@ -224,26 +269,26 @@
(->> (db/exec! conn [sql ids])
(mapv #(assoc % :file-id id)))))))
(def ^:private sql:get-team-files
(def ^:private sql:get-team-files-ids
"SELECT f.id FROM file AS f
JOIN project AS p ON (p.id = f.project_id)
WHERE p.team_id = ?")
(defn get-team-files
(defn get-team-files-ids
"Get a set of file ids for the specified team-id"
[{:keys [::db/conn]} team-id]
(->> (db/exec! conn [sql:get-team-files team-id])
(->> (db/exec! conn [sql:get-team-files-ids team-id])
(into #{} xf-map-id)))
(def ^:private sql:get-team-projects
"SELECT p.id FROM project AS p
"SELECT p.* FROM project AS p
WHERE p.team_id = ?
AND p.deleted_at IS NULL")
(defn get-team-projects
"Get a set of project ids for the team"
[{:keys [::db/conn]} team-id]
(->> (db/exec! conn [sql:get-team-projects team-id])
[cfg team-id]
(->> (db/exec! cfg [sql:get-team-projects team-id])
(into #{} xf-map-id)))
(def ^:private sql:get-project-files
@@ -257,6 +302,10 @@
(->> (db/exec! conn [sql:get-project-files project-id])
(into #{} xf-map-id)))
(defn remap-thumbnail-object-id
[object-id file-id]
(str/replace-first object-id #"^(.*?)/" (str file-id "/")))
(defn- relink-shapes
"A function responsible to analyze all file data and
replace the old :component-file reference with the new
@@ -339,6 +388,12 @@
data
library-ids)))
(defn disable-database-timeouts!
[cfg]
(let [conn (db/get-connection cfg)]
(db/exec-one! conn ["SET LOCAL idle_in_transaction_session_timeout = 0"])
(db/exec-one! conn ["SET CONSTRAINTS ALL DEFERRED"])))
(defn- fix-version
[file]
(let [file (fmg/fix-version file)]
@@ -400,8 +455,11 @@
(fn [features]
(let [features (cfeat/check-supported-features! features)]
(-> (::features cfg #{})
(set/difference cfeat/frontend-only-features)
(set/union features))))))
(set/union features)
;; We never want to store
;; frontend-only features on file
(set/difference cfeat/frontend-only-features))))))
_ (when (contains? cf/flags :file-schema-validation)
(fval/validate-file-schema! file))
@@ -432,6 +490,20 @@
file))
(defn register-pending-migrations
"All features that are enabled and requires explicit migration are
added to the state for a posterior migration step."
[cfg {:keys [id features] :as file}]
(doseq [feature (-> (::features cfg)
(set/difference cfeat/no-migration-features)
(set/difference cfeat/backend-only-features)
(set/difference features))]
(vswap! *state* update :pending-to-migrate (fnil conj []) [feature id]))
file)
(defn apply-pending-migrations!
"Apply alredy registered pending migrations to files"
[cfg]

View File

@@ -49,15 +49,6 @@
(set! *warn-on-reflection* true)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DEFAULTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Threshold in MiB when we pass from using
;; in-memory byte-array's to use temporal files.
(def temp-file-threshold
(* 1024 1024 2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; LOW LEVEL STREAM IO API
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -65,11 +56,6 @@
(def ^:const buffer-size (:xnio/buffer-size yt/defaults))
(def ^:const penpot-magic-number 800099563638710213)
;; A maximum (storage) object size allowed: 100MiB
(def ^:const max-object-size
(* 1024 1024 100))
(def ^:dynamic *position* nil)
(defn get-mark
@@ -236,7 +222,7 @@
(defn copy-stream!
[^OutputStream output ^InputStream input ^long size]
(let [written (io/copy! input output :size size)]
(let [written (io/copy input output :size size)]
(l/trace :fn "copy-stream!" :position @*position* :size size :written written ::l/sync? true)
(swap! *position* + written)
written))
@@ -258,18 +244,18 @@
p (tmp/tempfile :prefix "penpot.binfile.")]
(assert-mark m :stream)
(when (> s max-object-size)
(when (> s bfc/max-object-size)
(ex/raise :type :validation
:code :max-file-size-reached
:hint (str/ffmt "unable to import storage object with size % bytes" s)))
(if (> s temp-file-threshold)
(if (> s bfc/temp-file-threshold)
(with-open [^OutputStream output (io/output-stream p)]
(let [readed (io/copy! input output :offset 0 :size s)]
(let [readed (io/copy input output :offset 0 :size s)]
(l/trace :fn "read-stream*!" :expected s :readed readed :position @*position* ::l/sync? true)
(swap! *position* + readed)
[s p]))
[s (io/read-as-bytes input :size s)])))
[s (io/read input :size s)])))
(defmacro assert-read-label!
[input expected-label]
@@ -381,10 +367,12 @@
::l/sync? true)
(doseq [item media]
(l/dbg :hint "write penpot file media object" :id (:id item) ::l/sync? true))
(l/dbg :hint "write penpot file media object"
:id (:id item) ::l/sync? true))
(doseq [item thumbnails]
(l/dbg :hint "write penpot file object thumbnail" :media-id (str (:media-id item)) ::l/sync? true))
(l/dbg :hint "write penpot file object thumbnail"
:media-id (str (:media-id item)) ::l/sync? true))
(doto output
(write-obj! file)
@@ -466,8 +454,8 @@
(defn- read-import-v1
[{:keys [::db/conn ::project-id ::profile-id ::input] :as cfg}]
(db/exec-one! conn ["SET LOCAL idle_in_transaction_session_timeout = 0"])
(db/exec-one! conn ["SET CONSTRAINTS ALL DEFERRED"])
(bfc/disable-database-timeouts! cfg)
(pu/with-open [input (zstd-input-stream input)
input (io/data-input-stream input)]
@@ -520,15 +508,6 @@
(update :object-id #(str/replace-first % #"^(.*?)/" (str file-id "/")))))
thumbnails))
(defn- clean-features
[file]
(update file :features (fn [features]
(if (set? features)
(-> features
(cfeat/migrate-legacy-features)
(set/difference cfeat/backend-only-features))
#{}))))
(defmethod read-section :v1/files
[{:keys [::db/conn ::input ::project-id ::bfc/overwrite ::name] :as system}]
@@ -539,7 +518,7 @@
file-id (:id file)
file-id' (bfc/lookup-index file-id)
file (clean-features file)
file (bfc/clean-file-features file)
thumbnails (:thumbnails file)]
(when (not= file-id expected-file-id)
@@ -559,7 +538,9 @@
(when (seq thumbnails)
(let [thumbnails (remap-thumbnails thumbnails file-id')]
(l/dbg :hint "updated index with thumbnails" :total (count thumbnails) ::l/sync? true)
(l/dbg :hint "updated index with thumbnails"
:total (count thumbnails)
::l/sync? true)
(vswap! bfc/*state* update :thumbnails bfc/into-vec thumbnails)))
(when (seq media)
@@ -709,7 +690,7 @@
(dm/assert!
"expected instance of jio/IOFactory for `input`"
(satisfies? jio/IOFactory output))
(io/coercible? output))
(let [id (uuid/next)
tp (dt/tpoint)
@@ -738,7 +719,7 @@
:cause @cs)))))
(defn import-files!
[cfg input]
[{:keys [::input] :as cfg}]
(dm/assert!
"expected valid profile-id and project-id on `cfg`"

View File

@@ -141,16 +141,15 @@
(write! cfg :team-font-variant id font))))
(defn- write-project!
[cfg project-id]
(let [project (bfc/get-project cfg project-id)]
(events/tap :progress
{:op :export
:section :write-project
:id project-id
:name (:name project)})
(l/trc :hint "write" :obj "project" :id (str project-id))
(write! cfg :project (str project-id) project)
(vswap! bfc/*state* update :projects conj project-id)))
[cfg project]
(events/tap :progress
{:op :export
:section :write-project
:id (:id project)
:name (:name project)})
(l/trc :hint "write" :obj "project" :id (str (:id project)))
(write! cfg :project (str (:id project)) project)
(vswap! bfc/*state* update :projects conj (:id project)))
(defn- write-file!
[cfg file-id]
@@ -191,7 +190,7 @@
[{:keys [::sto/storage] :as cfg} id]
(let [sobj (sto/get-object storage id)
data (with-open [input (sto/get-object-data storage sobj)]
(io/read-as-bytes input))]
(io/read input))]
(l/trc :hint "write" :obj "storage-object" :id (str id) :size (:size sobj))
(write! cfg :storage-object id (meta sobj) data)))
@@ -363,7 +362,7 @@
(bfc/get-team-projects cfg team-id))
(run! (partial write-file! cfg)
(bfc/get-team-files cfg team-id))
(bfc/get-team-files-ids cfg team-id))
(run! (partial write-storage-object! cfg)
(-> bfc/*state* deref :storage-objects))

View File

@@ -0,0 +1,963 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.binfile.v3
"A ZIP based binary file exportation"
(:refer-clojure :exclude [read])
(:require
[app.binfile.common :as bfc]
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.features :as cfeat]
[app.common.json :as json]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.thumbnails :as cth]
[app.common.types.color :as ctcl]
[app.common.types.component :as ctc]
[app.common.types.file :as ctf]
[app.common.types.page :as ctp]
[app.common.types.plugins :as ctpg]
[app.common.types.shape :as cts]
[app.common.types.typography :as cty]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
[app.storage :as sto]
[app.storage.impl :as sto.impl]
[app.util.events :as events]
[app.util.time :as dt]
[clojure.java.io :as jio]
[cuerdas.core :as str]
[datoteka.fs :as fs]
[datoteka.io :as io])
(:import
java.io.InputStream
java.io.OutputStreamWriter
java.util.zip.ZipEntry
java.util.zip.ZipFile
java.util.zip.ZipOutputStream))
;; --- SCHEMA
(def ^:private schema:manifest
[:map {:title "Manifest"}
[:version ::sm/int]
[:type :string]
[:generated-by {:optional true} :string]
[:files
[:vector
[:map
[:id ::sm/uuid]
[:name :string]
[:project-id ::sm/uuid]
[:features ::cfeat/features]]]]
[:relations {:optional true}
[:vector
[:tuple ::sm/uuid ::sm/uuid]]]])
(def ^:private schema:storage-object
[:map {:title "StorageObject"}
[:id ::sm/uuid]
[:size ::sm/int]
[:content-type :string]
[:bucket [::sm/one-of {:format :string} sto/valid-buckets]]
[:hash :string]])
(def ^:private schema:file-thumbnail
[:map {:title "FileThumbnail"}
[:file-id ::sm/uuid]
[:page-id ::sm/uuid]
[:frame-id ::sm/uuid]
[:tag :string]
[:media-id ::sm/uuid]])
;; --- ENCODERS
(def encode-file
(sm/encoder ::ctf/file sm/json-transformer))
(def encode-page
(sm/encoder ::ctp/page sm/json-transformer))
(def encode-shape
(sm/encoder ::cts/shape sm/json-transformer))
(def encode-media
(sm/encoder ::ctf/media sm/json-transformer))
(def encode-component
(sm/encoder ::ctc/component sm/json-transformer))
(def encode-color
(sm/encoder ::ctcl/color sm/json-transformer))
(def encode-typography
(sm/encoder ::cty/typography sm/json-transformer))
(def encode-plugin-data
(sm/encoder ::ctpg/plugin-data sm/json-transformer))
(def encode-storage-object
(sm/encoder schema:storage-object sm/json-transformer))
(def encode-file-thumbnail
(sm/encoder schema:file-thumbnail sm/json-transformer))
;; --- DECODERS
(def decode-manifest
(sm/decoder schema:manifest sm/json-transformer))
(def decode-media
(sm/decoder ::ctf/media sm/json-transformer))
(def decode-component
(sm/decoder ::ctc/component sm/json-transformer))
(def decode-color
(sm/decoder ::ctcl/color sm/json-transformer))
(def decode-file
(sm/decoder ::ctf/file sm/json-transformer))
(def decode-page
(sm/decoder ::ctp/page sm/json-transformer))
(def decode-shape
(sm/decoder ::cts/shape sm/json-transformer))
(def decode-typography
(sm/decoder ::cty/typography sm/json-transformer))
(def decode-plugin-data
(sm/decoder ::ctpg/plugin-data sm/json-transformer))
(def decode-storage-object
(sm/decoder schema:storage-object sm/json-transformer))
(def decode-file-thumbnail
(sm/decoder schema:file-thumbnail sm/json-transformer))
;; --- VALIDATORS
(def validate-manifest
(sm/check-fn schema:manifest))
(def validate-file
(sm/check-fn ::ctf/file))
(def validate-page
(sm/check-fn ::ctp/page))
(def validate-shape
(sm/check-fn ::cts/shape))
(def validate-media
(sm/check-fn ::ctf/media))
(def validate-color
(sm/check-fn ::ctcl/color))
(def validate-component
(sm/check-fn ::ctc/component))
(def validate-typography
(sm/check-fn ::cty/typography))
(def validate-plugin-data
(sm/check-fn ::ctpg/plugin-data))
(def validate-storage-object
(sm/check-fn schema:storage-object))
(def validate-file-thumbnail
(sm/check-fn schema:file-thumbnail))
;; --- EXPORT IMPL
(defn- write-entry!
[^ZipOutputStream output ^String path data]
(.putNextEntry output (ZipEntry. path))
(let [writer (OutputStreamWriter. output "UTF-8")]
(json/write writer data :indent true :key-fn json/write-camel-key)
(.flush writer))
(.closeEntry output))
(defn- get-file
[{:keys [::embed-assets ::include-libraries] :as cfg} file-id]
(when (and include-libraries embed-assets)
(throw (IllegalArgumentException.
"the `include-libraries` and `embed-assets` are mutally excluding options")))
(let [detach? (and (not embed-assets) (not include-libraries))]
(cond-> (bfc/get-file cfg file-id)
detach?
(-> (ctf/detach-external-references file-id)
(dissoc :libraries))
embed-assets
(update :data #(bfc/embed-assets cfg % file-id))
:always
(bfc/clean-file-features))))
(defn- resolve-extension
[mtype]
(case mtype
"image/png" ".png"
"image/jpeg" ".jpg"
"image/gif" ".gif"
"image/svg+xml" ".svg"
"image/webp" ".webp"
"font/woff" ".woff"
"font/woff2" ".woff2"
"font/ttf" ".ttf"
"font/otf" ".otf"
"application/octet-stream" ".bin"))
(defn- export-storage-objects
[{:keys [::output] :as cfg}]
(let [storage (sto/resolve cfg)]
(doseq [id (-> bfc/*state* deref :storage-objects not-empty)]
(let [sobject (sto/get-object storage id)
smeta (meta sobject)
ext (resolve-extension (:content-type smeta))
path (str "objects/" id ".json")
params (-> (meta sobject)
(assoc :id (:id sobject))
(assoc :size (:size sobject))
(encode-storage-object))]
(write-entry! output path params)
(with-open [input (sto/get-object-data storage sobject)]
(.putNextEntry output (ZipEntry. (str "objects/" id ext)))
(io/copy input output :size (:size sobject))
(.closeEntry output))))))
(defn- export-file
[{:keys [::file-id ::output] :as cfg}]
(let [file (get-file cfg file-id)
media (->> (bfc/get-file-media cfg file)
(map (fn [media]
(dissoc media :file-id))))
data (:data file)
typographies (:typographies data)
components (:components data)
colors (:colors data)
pages (:pages data)
pages-index (:pages-index data)
thumbnails (bfc/get-file-object-thumbnails cfg file-id)]
(vswap! bfc/*state* update :files assoc file-id
{:id file-id
:project-id (:project-id file)
:name (:name file)
:features (:features file)})
(let [file (cond-> (dissoc file :data)
(:options data)
(assoc :options (:options data))
:always
(encode-file))
path (str "files/" file-id ".json")]
(write-entry! output path file))
(doseq [[index page-id] (d/enumerate pages)]
(let [path (str "files/" file-id "/pages/" page-id ".json")
page (get pages-index page-id)
objects (:objects page)
page (-> page
(dissoc :objects)
(assoc :index index))
page (encode-page page)]
(write-entry! output path page)
(doseq [[shape-id shape] objects]
(let [path (str "files/" file-id "/pages/" page-id "/" shape-id ".json")
shape (assoc shape :page-id page-id)
shape (encode-shape shape)]
(write-entry! output path shape)))))
(vswap! bfc/*state* bfc/collect-storage-objects media)
(vswap! bfc/*state* bfc/collect-storage-objects thumbnails)
(doseq [{:keys [id] :as media} media]
(let [path (str "files/" file-id "/media/" id ".json")
media (encode-media media)]
(write-entry! output path media)))
(doseq [thumbnail thumbnails]
(let [data (cth/parse-object-id (:object-id thumbnail))
path (str "files/" file-id "/thumbnails/" (:tag data) "/" (:page-id data)
"/" (:frame-id data) ".json")
data (-> data
(assoc :media-id (:media-id thumbnail))
(encode-file-thumbnail))]
(write-entry! output path data)))
(doseq [[id component] components]
(let [path (str "files/" file-id "/components/" id ".json")
component (encode-component component)]
(write-entry! output path component)))
(doseq [[id color] colors]
(let [path (str "files/" file-id "/colors/" id ".json")
color (-> (encode-color color)
(dissoc :file-id))
color (cond-> color
(and (contains? color :path)
(str/empty? (:path color)))
(dissoc :path))]
(write-entry! output path color)))
(doseq [[id object] typographies]
(let [path (str "files/" file-id "/typographies/" id ".json")
color (encode-typography object)]
(write-entry! output path color)))))
(defn- export-files
[{:keys [::ids ::include-libraries ::output] :as cfg}]
(let [ids (into ids (when include-libraries (bfc/get-libraries cfg ids)))
rels (if include-libraries
(->> (bfc/get-files-rels cfg ids)
(mapv (juxt :file-id :library-file-id)))
[])]
(vswap! bfc/*state* assoc :files (d/ordered-map))
;; Write all the exporting files
(doseq [[index file-id] (d/enumerate ids)]
(-> cfg
(assoc ::file-id file-id)
(assoc ::file-seqn index)
(export-file)))
;; Write manifest file
(let [files (:files @bfc/*state*)
params {:type "penpot/export-files"
:version 1
:generated-by (str "penpot/" (:full cf/version))
:files (vec (vals files))
:relations rels}]
(write-entry! output "manifest.json" params))))
;; --- IMPORT IMPL
(defn- read-zip-entries
[^ZipFile input]
(into #{} (iterator-seq (.entries input))))
(defn- get-zip-entry*
[^ZipFile input ^String path]
(.getEntry input path))
(defn- get-zip-entry
[input path]
(let [entry (get-zip-entry* input path)]
(when-not entry
(ex/raise :type :validation
:code :inconsistent-penpot-file
:hint "the penpot file seems corrupt, missing underlying zip entry"
:path path))
entry))
(defn- get-zip-entry-size
[^ZipEntry entry]
(.getSize entry))
(defn- zip-entry-name
[^ZipEntry entry]
(.getName entry))
(defn- zip-entry-stream
^InputStream
[^ZipFile input ^ZipEntry entry]
(.getInputStream input entry))
(defn- zip-entry-reader
[^ZipFile input ^ZipEntry entry]
(-> (zip-entry-stream input entry)
(io/reader :encoding "UTF-8")))
(defn- zip-entry-storage-content
"Wraps a ZipFile and ZipEntry into a penpot storage compatible
object and avoid creating temporal objects"
[input entry]
(let [hash (delay (->> entry
(zip-entry-stream input)
(sto.impl/calculate-hash)))]
(reify
sto.impl/IContentObject
(get-size [_]
(get-zip-entry-size entry))
sto.impl/IContentHash
(get-hash [_]
(deref hash))
jio/IOFactory
(make-reader [this opts]
(jio/make-reader this opts))
(make-writer [_ _]
(throw (UnsupportedOperationException. "not implemented")))
(make-input-stream [_ _]
(zip-entry-stream input entry))
(make-output-stream [_ _]
(throw (UnsupportedOperationException. "not implemented"))))))
(defn- read-manifest
[^ZipFile input]
(let [entry (get-zip-entry input "manifest.json")]
(with-open [reader (zip-entry-reader input entry)]
(let [manifest (json/read reader :key-fn json/read-kebab-key)]
(decode-manifest manifest)))))
(defn- match-media-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/media/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- match-color-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/colors/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- match-component-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/components/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- match-typography-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/typographies/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- match-thumbnail-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/thumbnails/([^/]+)/([^/]+)/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ tag page-id frame-id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:tag tag
:page-id (parse-uuid page-id)
:frame-id (parse-uuid frame-id)
:file-id file-id}))))
(defn- match-page-entry-fn
[file-id]
(let [pattern (str "^files/" file-id "/pages/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- match-shape-entry-fn
[file-id page-id]
(let [pattern (str "^files/" file-id "/pages/" page-id "/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:page-id page-id
:id (parse-uuid id)}))))
(defn- match-storage-entry-fn
[]
(let [pattern (str "^objects/([^/]+).json$")
pattern (re-pattern pattern)]
(fn [entry]
(when-let [[_ id] (re-matches pattern (zip-entry-name entry))]
{:entry entry
:id (parse-uuid id)}))))
(defn- read-entry
[^ZipFile input entry]
(with-open [reader (zip-entry-reader input entry)]
(json/read reader :key-fn json/read-kebab-key)))
(defn- read-file
[{:keys [::input ::file-id]}]
(let [path (str "files/" file-id ".json")
entry (get-zip-entry input path)]
(-> (read-entry input entry)
(decode-file)
(validate-file))))
(defn- read-file-plugin-data
[{:keys [::input ::file-id]}]
(let [path (str "files/" file-id "/plugin-data.json")
entry (get-zip-entry* input path)]
(some->> entry
(read-entry input)
(decode-plugin-data)
(validate-plugin-data))))
(defn- read-file-media
[{:keys [::input ::file-id ::entries]}]
(->> (keep (match-media-entry-fn file-id) entries)
(reduce (fn [result {:keys [id entry]}]
(let [object (->> (read-entry input entry)
(decode-media)
(validate-media))
object (assoc object :file-id file-id)]
(if (= id (:id object))
(conj result object)
result)))
[])
(not-empty)))
(defn- read-file-colors
[{:keys [::input ::file-id ::entries]}]
(->> (keep (match-color-entry-fn file-id) entries)
(reduce (fn [result {:keys [id entry]}]
(let [object (->> (read-entry input entry)
(decode-color)
(validate-color))]
(if (= id (:id object))
(assoc result id object)
result)))
{})
(not-empty)))
(defn- read-file-components
[{:keys [::input ::file-id ::entries]}]
(->> (keep (match-component-entry-fn file-id) entries)
(reduce (fn [result {:keys [id entry]}]
(let [object (->> (read-entry input entry)
(decode-component)
(validate-component))]
(if (= id (:id object))
(assoc result id object)
result)))
{})
(not-empty)))
(defn- read-file-typographies
[{:keys [::input ::file-id ::entries]}]
(->> (keep (match-typography-entry-fn file-id) entries)
(reduce (fn [result {:keys [id entry]}]
(let [object (->> (read-entry input entry)
(decode-typography)
(validate-typography))]
(if (= id (:id object))
(assoc result id object)
result)))
{})
(not-empty)))
(defn- read-file-shapes
[{:keys [::input ::file-id ::page-id ::entries] :as cfg}]
(->> (keep (match-shape-entry-fn file-id page-id) entries)
(reduce (fn [result {:keys [id entry]}]
(let [object (->> (read-entry input entry)
(decode-shape)
(validate-shape))]
(if (= id (:id object))
(assoc result id object)
result)))
{})
(not-empty)))
(defn- read-file-pages
[{:keys [::input ::file-id ::entries] :as cfg}]
(->> (keep (match-page-entry-fn file-id) entries)
(keep (fn [{:keys [id entry]}]
(let [page (->> (read-entry input entry)
(decode-page))
page (dissoc page :options)]
(when (= id (:id page))
(let [objects (-> (assoc cfg ::page-id id)
(read-file-shapes))]
(assoc page :objects objects))))))
(sort-by :index)
(reduce (fn [result {:keys [id] :as page}]
(assoc result id (dissoc page :index)))
(d/ordered-map))))
(defn- read-file-thumbnails
[{:keys [::input ::file-id ::entries] :as cfg}]
(->> (keep (match-thumbnail-entry-fn file-id) entries)
(reduce (fn [result {:keys [page-id frame-id tag entry]}]
(let [object (->> (read-entry input entry)
(decode-file-thumbnail)
(validate-file-thumbnail))]
(if (and (= frame-id (:frame-id object))
(= page-id (:page-id object))
(= tag (:tag object)))
(conj result object)
result)))
[])
(not-empty)))
(defn- read-file-data
[{:keys [] :as cfg}]
(let [colors (read-file-colors cfg)
typographies (read-file-typographies cfg)
components (read-file-components cfg)
plugin-data (read-file-plugin-data cfg)
pages (read-file-pages cfg)]
{:pages (-> pages keys vec)
:pages-index (into {} pages)
:colors colors
:typographies typographies
:components components
:plugin-data plugin-data}))
(defn- import-file
[{:keys [::db/conn ::project-id ::file-id ::file-name] :as cfg}]
(let [file-id' (bfc/lookup-index file-id)
file (read-file cfg)
media (read-file-media cfg)
thumbnails (read-file-thumbnails cfg)]
(l/dbg :hint "processing file"
:id (str file-id')
:prev-id (str file-id)
:features (str/join "," (:features file))
:version (:version file)
::l/sync? true)
(events/tap :progress {:section :file :name file-name})
(when media
;; Update index with media
(l/dbg :hint "update media index"
:file-id (str file-id')
:total (count media)
::l/sync? true)
(vswap! bfc/*state* update :index bfc/update-index (map :id media))
(vswap! bfc/*state* update :media into media))
(when thumbnails
(l/dbg :hint "update thumbnails index"
:file-id (str file-id')
:total (count thumbnails)
::l/sync? true)
(vswap! bfc/*state* update :index bfc/update-index (map :media-id thumbnails))
(vswap! bfc/*state* update :thumbnails into thumbnails))
(let [data (-> (read-file-data cfg)
(d/without-nils)
(assoc :id file-id')
(cond-> (:options file)
(assoc :options (:options file))))
file (-> file
(assoc :id file-id')
(assoc :data data)
(assoc :name file-name)
(assoc :project-id project-id)
(dissoc :options)
(bfc/process-file))]
(->> file
(bfc/register-pending-migrations cfg)
(bfc/persist-file! cfg))
(when (::bfc/overwrite cfg)
(db/delete! conn :file-thumbnail {:file-id file-id'}))
file-id')))
(defn- import-file-relations
[{:keys [::db/conn ::manifest ::bfc/timestamp] :as cfg}]
(events/tap :progress {:section :relations})
(doseq [[file-id libr-id] (:relations manifest)]
(let [file-id (bfc/lookup-index file-id)
libr-id (bfc/lookup-index libr-id)]
(when (and file-id libr-id)
(l/dbg :hint "create file library link"
:file-id (str file-id)
:lib-id (str libr-id)
::l/sync? true)
(db/insert! conn :file-library-rel
{:synced-at timestamp
:file-id file-id
:library-file-id libr-id})))))
(defn- import-storage-objects
[{:keys [::input ::entries ::bfc/timestamp] :as cfg}]
(events/tap :progress {:section :storage-objects})
(let [storage (sto/resolve cfg)
entries (keep (match-storage-entry-fn) entries)]
(doseq [{:keys [id entry]} entries]
(let [object (->> (read-entry input entry)
(decode-storage-object)
(validate-storage-object))]
(when (not= id (:id object))
(ex/raise :type :validation
:code :inconsistent-penpot-file
:hint "the penpot file seems corrupt, found unexpected uuid (storage-object-id)"
:expected-id (str id)
:found-id (str (:id object))))
(let [ext (resolve-extension (:content-type object))
path (str "objects/" id ext)
content (->> path
(get-zip-entry input)
(zip-entry-storage-content input))]
(when (not= (:size object) (sto/get-size content))
(ex/raise :type :validation
:code :inconsistent-penpot-file
:hint "found corrupted storage object: size does not match"
:path path
:expected-size (:size object)
:found-size (sto/get-size content)))
(when (not= (:hash object) (sto/get-hash content))
(ex/raise :type :validation
:code :inconsistent-penpot-file
:hint "found corrupted storage object: hash does not match"
:path path
:expected-hash (:hash object)
:found-hash (sto/get-hash content)))
(let [params (-> object
(dissoc :id :size)
(assoc ::sto/content content)
(assoc ::sto/deduplicate? true)
(assoc ::sto/touched-at timestamp))
sobject (sto/put-object! storage params)]
(l/dbg :hint "persisted storage object"
:id (str (:id sobject))
:prev-id (str id)
:bucket (:bucket params)
::l/sync? true)
(vswap! bfc/*state* update :index assoc id (:id sobject))))))))
(defn- import-file-media
[{:keys [::db/conn] :as cfg}]
(events/tap :progress {:section :media})
(doseq [item (:media @bfc/*state*)]
(let [params (-> item
(update :id bfc/lookup-index)
(update :file-id bfc/lookup-index)
(d/update-when :media-id bfc/lookup-index)
(d/update-when :thumbnail-id bfc/lookup-index))]
(l/dbg :hint "inserting file media object"
:id (str (:id params))
:file-id (str (:file-id params))
::l/sync? true)
(db/insert! conn :file-media-object params
{::db/on-conflict-do-nothing? (::bfc/overwrite cfg)}))))
(defn- import-file-thumbnails
[{:keys [::db/conn] :as cfg}]
(events/tap :progress {:section :thumbnails})
(doseq [item (:thumbnails @bfc/*state*)]
(let [file-id (bfc/lookup-index (:file-id item))
media-id (bfc/lookup-index (:media-id item))
object-id (-> (assoc item :file-id file-id)
(cth/fmt-object-id))
params {:file-id file-id
:object-id object-id
:tag (:tag item)
:media-id media-id}]
(l/dbg :hint "inserting file object thumbnail"
:file-id (str file-id)
:media-id (str media-id)
::l/sync? true)
(db/insert! conn :file-tagged-object-thumbnail params
{::db/on-conflict-do-nothing? (::bfc/overwrite cfg)}))))
(defn- import-files
[{:keys [::bfc/timestamp ::input ::name] :or {timestamp (dt/now)} :as cfg}]
(dm/assert!
"expected zip file"
(instance? ZipFile input))
(dm/assert!
"expected valid instant"
(dt/instant? timestamp))
(let [manifest (-> (read-manifest input)
(validate-manifest))
entries (read-zip-entries input)]
(when-not (= "penpot/export-files" (:type manifest))
(ex/raise :type :validation
:code :invalid-binfile-v3-manifest
:hint "unexpected type on manifest"
:manifest manifest))
;; Check if all files referenced on manifest are present
(doseq [{file-id :id} (:files manifest)]
(let [path (str "files/" file-id ".json")]
(when-not (get-zip-entry input path)
(ex/raise :type :validation
:code :invalid-binfile-v3
:hint "some files referenced on manifest not found"
:path path
:file-id file-id))))
(events/tap :progress {:section :manifest})
(let [index (bfc/update-index (map :id (:files manifest)))
state {:media [] :index index}
cfg (-> cfg
(assoc ::entries entries)
(assoc ::manifest manifest)
(assoc ::bfc/timestamp timestamp))]
(binding [bfc/*state* (volatile! state)]
(db/tx-run! cfg (fn [cfg]
(bfc/disable-database-timeouts! cfg)
(let [ids (->> (:files manifest)
(reduce (fn [result {:keys [id] :as file}]
(let [name' (get file :name)
name' (if (map? name)
(get name id)
name')]
(conj result (-> cfg
(assoc ::file-id id)
(assoc ::file-name name')
(import-file)))))
[]))]
(import-file-relations cfg)
(import-storage-objects cfg)
(import-file-media cfg)
(import-file-thumbnails cfg)
(bfc/apply-pending-migrations! cfg)
ids)))))))
;; --- PUBLIC API
(defn export-files!
"Do the exportation of a specified file in custom penpot binary
format. There are some options available for customize the output:
`::include-libraries`: additionally to the specified file, all the
linked libraries also will be included (including transitive
dependencies).
`::embed-assets`: instead of including the libraries, embed in the
same file library all assets used from external libraries."
[{:keys [::ids] :as cfg} output]
(dm/assert!
"expected a set of uuid's for `::ids` parameter"
(and (set? ids)
(every? uuid? ids)))
(dm/assert!
"expected instance of jio/IOFactory for `input`"
(satisfies? jio/IOFactory output))
(let [id (uuid/next)
tp (dt/tpoint)
ab (volatile! false)
cs (volatile! nil)]
(try
(l/info :hint "start exportation" :export-id (str id))
(binding [bfc/*state* (volatile! (bfc/initial-state))]
(with-open [output (io/output-stream output)]
(with-open [output (ZipOutputStream. output)]
(let [cfg (assoc cfg ::output output)]
(export-files cfg)
(export-storage-objects cfg)))))
(catch java.util.zip.ZipException cause
(vreset! cs cause)
(vreset! ab true)
(throw cause))
(catch java.io.IOException _cause
;; Do nothing, EOF means client closes connection abruptly
(vreset! ab true)
nil)
(catch Throwable cause
(vreset! cs cause)
(vreset! ab true)
(throw cause))
(finally
(l/info :hint "exportation finished" :export-id (str id)
:elapsed (str (inst-ms (tp)) "ms")
:aborted @ab
:cause @cs)))))
(defn import-files!
[{:keys [::input] :as cfg}]
(dm/assert!
"expected valid profile-id and project-id on `cfg`"
(and (uuid? (::profile-id cfg))
(uuid? (::project-id cfg))))
(dm/assert!
"expected instance of jio/IOFactory for `input`"
(io/coercible? input))
(let [id (uuid/next)
tp (dt/tpoint)
cs (volatile! nil)]
(l/info :hint "import: started" :id (str id))
(try
(with-open [input (ZipFile. (fs/file input))]
(import-files (assoc cfg ::input input)))
(catch Throwable cause
(vreset! cs cause)
(throw cause))
(finally
(l/info :hint "import: terminated"
:id (str id)
:elapsed (dt/format-duration (tp))
:error? (some? @cs))))))

View File

@@ -26,11 +26,11 @@
[_ data]
(d/without-nils data))
(defmethod ig/prep-key :default
[_ data]
(if (map? data)
(d/without-nils data)
data))
(defmethod ig/expand-key :default
[k v]
{k (if (map? v)
(d/without-nils v)
v)})
(def default
{:database-uri "postgresql://postgres/penpot"
@@ -42,7 +42,6 @@
:rpc-rlimit-config "resources/rlimit.edn"
:rpc-climit-config "resources/climit.edn"
:auto-file-snapshot-total 10
:auto-file-snapshot-every 5
:auto-file-snapshot-timeout "3h"
@@ -101,7 +100,6 @@
[:telemetry-uri {:optional true} :string]
[:telemetry-with-taiga {:optional true} ::sm/boolean] ;; DELETE
[:auto-file-snapshot-total {:optional true} ::sm/int]
[:auto-file-snapshot-every {:optional true} ::sm/int]
[:auto-file-snapshot-timeout {:optional true} ::dt/duration]
@@ -126,7 +124,7 @@
[:worker-webhook-parallelism {:optional true} ::sm/int]
[:database-password {:optional true} [:maybe :string]]
[:database-uri {:optional true} :string]
[:database-uri {:optional true} ::sm/uri]
[:database-username {:optional true} [:maybe :string]]
[:database-readonly {:optional true} ::sm/boolean]
[:database-min-pool-size {:optional true} ::sm/int]
@@ -142,6 +140,10 @@
[:quotes-font-variants-per-team {:optional true} ::sm/int]
[:quotes-comment-threads-per-file {:optional true} ::sm/int]
[:quotes-comments-per-file {:optional true} ::sm/int]
[:quotes-snapshots-per-file {:optional true} ::sm/int]
[:quotes-snapshots-per-team {:optional true} ::sm/int]
[:quotes-team-access-requests-per-team {:optional true} ::sm/int]
[:quotes-team-access-requests-per-requester {:optional true} ::sm/int]
[:auth-data-cookie-domain {:optional true} :string]
[:auth-token-cookie-name {:optional true} :string]
@@ -188,7 +190,7 @@
[:profile-complaint-max-age {:optional true} ::dt/duration]
[:profile-complaint-threshold {:optional true} ::sm/int]
[:redis-uri {:optional true} :string]
[:redis-uri {:optional true} ::sm/uri]
[:email-domain-blacklist {:optional true} ::fs/path]
[:email-domain-whitelist {:optional true} ::fs/path]
@@ -216,14 +218,14 @@
[:storage-assets-fs-directory {:optional true} :string]
[:storage-assets-s3-bucket {:optional true} :string]
[:storage-assets-s3-region {:optional true} :keyword]
[:storage-assets-s3-endpoint {:optional true} :string]
[:storage-assets-s3-endpoint {:optional true} ::sm/uri]
[:storage-assets-s3-io-threads {:optional true} ::sm/int]
[:objects-storage-backend {:optional true} :keyword]
[:objects-storage-fs-directory {:optional true} :string]
[:objects-storage-s3-bucket {:optional true} :string]
[:objects-storage-s3-region {:optional true} :keyword]
[:objects-storage-s3-endpoint {:optional true} :string]
[:objects-storage-s3-endpoint {:optional true} ::sm/uri]
[:objects-storage-s3-io-threads {:optional true} ::sm/int]]))
(def default-flags

View File

@@ -11,7 +11,7 @@
[app.common.exceptions :as ex]
[app.common.geom.point :as gpt]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.transit :as t]
[app.common.uuid :as uuid]
[app.db.sql :as sql]
@@ -20,7 +20,6 @@
[app.util.time :as dt]
[clojure.java.io :as io]
[clojure.set :as set]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[next.jdbc :as jdbc]
[next.jdbc.date-time :as jdbc-dt])
@@ -49,27 +48,17 @@
;; Initialization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::connection-timeout ::us/integer)
(s/def ::max-size ::us/integer)
(s/def ::min-size ::us/integer)
(s/def ::name keyword?)
(s/def ::password ::us/string)
(s/def ::uri ::us/not-empty-string)
(s/def ::username ::us/string)
(s/def ::validation-timeout ::us/integer)
(s/def ::read-only? ::us/boolean)
(s/def ::pool-options
(s/keys :opt [::uri
::name
::min-size
::max-size
::connection-timeout
::validation-timeout
::username
::password
::mtx/metrics
::read-only?]))
(def ^:private schema:pool-options
[:map {:title "pool-options"}
[::connect-timeout {:optional true} ::sm/int]
[::max-size {:optional true} ::sm/int]
[::min-size {:optional true} ::sm/int]
[::name {:optional true} :keyword]
[::uri {:optional true} ::sm/uri]
[::password {:optional true} :string]
[::username {:optional true} :string]
[::validation-timeout {:optional true} ::sm/int]
[::read-only {:optional true} ::sm/boolean]])
(def defaults
{::name :main
@@ -79,27 +68,26 @@
::validation-timeout 10000
::idle-timeout 120000 ; 2min
::max-lifetime 1800000 ; 30m
::read-only? false})
::read-only false})
(defmethod ig/prep-key ::pool
[_ cfg]
(merge defaults (d/without-nils cfg)))
;; Don't validate here, just validate that a map is received.
(defmethod ig/pre-init-spec ::pool [_] ::pool-options)
(defmethod ig/assert-key ::pool
[_ options]
(assert (sm/check schema:pool-options options)))
(defmethod ig/init-key ::pool
[_ {:keys [::uri ::read-only?] :as cfg}]
(when uri
(l/info :hint "initialize connection pool"
:name (d/name (::name cfg))
:uri uri
:read-only read-only?
:with-credentials (and (contains? cfg ::username)
(contains? cfg ::password))
:min-size (::min-size cfg)
:max-size (::max-size cfg))
(create-pool cfg)))
[_ cfg]
(let [{:keys [::uri ::read-only] :as cfg}
(merge defaults cfg)]
(when uri
(l/info :hint "initialize connection pool"
:name (d/name (::name cfg))
:uri (str uri)
:read-only read-only
:credentials (and (contains? cfg ::username)
(contains? cfg ::password))
:min-size (::min-size cfg)
:max-size (::max-size cfg))
(create-pool cfg))))
(defmethod ig/halt-key! ::pool
[_ pool]
@@ -115,13 +103,15 @@
"SET idle_in_transaction_session_timeout = 300000;"))
(defn- create-datasource-config
[{:keys [::mtx/metrics ::uri] :as cfg}]
[{:keys [::uri] :as cfg}]
;; (app.common.pprint/pprint cfg)
(let [config (HikariConfig.)]
(doto config
(.setJdbcUrl (str "jdbc:" uri))
(.setPoolName (d/name (::name cfg)))
(.setAutoCommit true)
(.setReadOnly (::read-only? cfg))
(.setReadOnly (::read-only cfg))
(.setConnectionTimeout (::connection-timeout cfg))
(.setValidationTimeout (::validation-timeout cfg))
(.setIdleTimeout (::idle-timeout cfg))
@@ -132,8 +122,8 @@
(.setInitializationFailTimeout -1))
;; When metrics namespace is provided
(when metrics
(->> (::mtx/registry metrics)
(when-let [instance (::mtx/metrics cfg)]
(->> (mtx/get-registry instance)
(PrometheusMetricsTrackerFactory.)
(.setMetricsTrackerFactory config)))
@@ -150,10 +140,22 @@
[conn]
(instance? Connection conn))
(s/def ::conn some?)
(s/def ::nilable-pool (s/nilable ::pool))
(s/def ::pool pool?)
(s/def ::connectable some?)
(defn connectable?
[o]
(or (connection? o)
(pool? o)))
(sm/register!
{:type ::conn
:pred connection?})
(sm/register!
{:type ::connectable
:pred connectable?})
(sm/register!
{:type ::pool
:pred pool?})
(defn closed?
[pool]
@@ -268,19 +270,17 @@
:else (throw (IllegalArgumentException. "unable to resolve connectable"))))
(def ^:private params-mapping
{::return-keys? :return-keys
::return-keys :return-keys})
{::return-keys :return-keys})
(defn rename-opts
[opts]
(set/rename-keys opts params-mapping))
(def ^:private default-insert-opts
{:builder-fn sql/as-kebab-maps
:return-keys true})
(assoc sql/default-opts :return-keys true))
(def ^:private default-opts
{:builder-fn sql/as-kebab-maps})
sql/default-opts)
(defn exec!
([ds sv] (exec! ds sv nil))
@@ -331,7 +331,7 @@
(defn update!
"A helper that build an UPDATE SQL statement and executes it.
Given a connectable object, a table name, a hash map of columns and
Given a connectable object, a table name, a hash map of columns and
values to set, and either a hash map of columns and values to search
on or a vector of a SQL where clause and parameters, perform an
update on the table.
@@ -411,10 +411,20 @@
:hint "database object not found"))
row))
(def ^:private default-plan-opts
(-> default-opts
(assoc :fetch-size 1)
(assoc :concurrency :read-only)
(assoc :cursors :close)
(assoc :result-type :forward-only)))
(defn plan
[ds sql]
(-> (get-connectable ds)
(jdbc/plan sql sql/default-opts)))
([ds sql]
(-> (get-connectable ds)
(jdbc/plan sql default-plan-opts)))
([ds sql opts]
(-> (get-connectable ds)
(jdbc/plan sql (merge default-plan-opts opts)))))
(defn cursor
"Return a lazy seq of rows using server side cursors"

View File

@@ -15,14 +15,15 @@
(defn kebab-case [s] (str/replace s #"_" "-"))
(defn snake-case [s] (str/replace s #"-" "_"))
(def default-opts
{:table-fn snake-case
:column-fn snake-case})
(defn as-kebab-maps
[rs opts]
(jdbc-opt/as-unqualified-modified-maps rs (assoc opts :label-fn kebab-case)))
(def default-opts
{:table-fn snake-case
:column-fn snake-case
:builder-fn as-kebab-maps})
(defn insert
([table key-map]
(insert table key-map nil))

View File

@@ -12,18 +12,12 @@
[app.common.logging :as l]
[app.common.pprint :as pp]
[app.common.schema :as sm]
[app.common.spec :as us]
[app.config :as cf]
[app.db :as db]
[app.db.sql :as sql]
[app.email.invite-to-team :as-alias email.invite-to-team]
[app.email.join-team :as-alias email.join-team]
[app.email.request-team-access :as-alias email.request-team-access]
[app.metrics :as mtx]
[app.util.template :as tmpl]
[app.worker :as wrk]
[clojure.java.io :as io]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig])
(:import
@@ -223,50 +217,45 @@
[{:type "text/html"
:content html}]))}))
(s/def ::priority #{:high :low})
(s/def ::to (s/or :single ::us/email
:multi (s/coll-of ::us/email)))
(s/def ::from ::us/email)
(s/def ::reply-to ::us/email)
(s/def ::lang string?)
(s/def ::extra-data ::us/string)
(def ^:private schema:context
[:map
[:to [:or ::sm/email [::sm/vec ::sm/email]]]
[:reply-to {:optional true} ::sm/email]
[:from {:optional true} ::sm/email]
[:lang {:optional true} ::sm/text]
[:priority {:optional true} [:enum :high :low]]
[:extra-data {:optional true} ::sm/text]])
(s/def ::context
(s/keys :req-un [::to]
:opt-un [::reply-to ::from ::lang ::priority ::extra-data]))
(def ^:private check-context
(sm/check-fn schema:context))
(defn template-factory
([id] (template-factory id {}))
([id extra-context]
(s/assert keyword? id)
(fn [context]
(us/verify ::context context)
(when-let [spec (s/get-spec id)]
(s/assert spec context))
[& {:keys [id schema]}]
(assert (keyword? id) "id should be provided and it should be a keyword")
(let [check-fn (if schema
(sm/check-fn schema)
(constantly nil))]
(fn [context]
(let [context (-> context check-context check-fn)
email (build-email-template id context)]
(when-not email
(ex/raise :type :internal
:code :email-template-does-not-exists
:hint "seems like the template is wrong or does not exists."
:template-id id))
(let [context (merge (if (fn? extra-context)
(extra-context)
extra-context)
context)
email (build-email-template id context)]
(when-not email
(ex/raise :type :internal
:code :email-template-does-not-exists
:hint "seems like the template is wrong or does not exists."
:context {:id id}))
(cond-> (assoc email :id (name id))
(:extra-data context)
(assoc :extra-data (:extra-data context))
(cond-> (assoc email :id (name id))
(:extra-data context)
(assoc :extra-data (:extra-data context))
(:from context)
(assoc :from (:from context))
(:from context)
(assoc :from (:from context))
(:reply-to context)
(assoc :reply-to (:reply-to context))
(:to context)
(assoc :to (:to context)))))))
(:reply-to context)
(assoc :reply-to (:reply-to context))
(:to context)
(assoc :to (:to context)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PUBLIC HIGH-LEVEL API
@@ -280,7 +269,8 @@
"Schedule an already defined email to be sent using asynchronously
using worker task."
[{:keys [::conn ::factory] :as context}]
(us/verify some? conn)
(assert (db/connectable? conn) "expected a valid database connection or pool")
(let [email (if factory
(factory context)
(dissoc context ::conn))]
@@ -297,8 +287,6 @@
(declare send-to-logger!)
(s/def ::sendmail fn?)
(defmethod ig/init-key ::sendmail
[_ cfg]
(fn [params]
@@ -324,8 +312,9 @@
(when (contains? cf/flags :log-emails)
(send-to-logger! cfg params))))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::sendmail ::mtx/metrics]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (fn? (::sendmail params)) "expected valid sendmail handler"))
(defmethod ig/init-key ::handler
[_ {:keys [::sendmail]}]
@@ -352,125 +341,113 @@
;; EMAIL FACTORIES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::subject ::us/string)
(s/def ::content ::us/string)
(def ^:private schema:feedback
[:map
[:subject ::sm/text]
[:content ::sm/text]])
(s/def ::feedback
(s/keys :req-un [::subject ::content]))
(def feedback
(def user-feedback
"A profile feedback email."
(template-factory ::feedback))
(template-factory
:id ::feedback
:schema schema:feedback))
(s/def ::name ::us/string)
(s/def ::register
(s/keys :req-un [::name]))
(def ^:private schema:register
[:map [:name ::sm/text]])
(def register
"A new profile registration welcome email."
(template-factory ::register))
(template-factory
:id ::register
:schema schema:register))
(s/def ::token ::us/string)
(s/def ::password-recovery
(s/keys :req-un [::name ::token]))
(def ^:private schema:password-recovery
[:map
[:name ::sm/text]
[:token ::sm/text]])
(def password-recovery
"A password recovery notification email."
(template-factory ::password-recovery))
(template-factory
:id ::password-recovery
:schema schema:password-recovery))
(s/def ::pending-email ::us/email)
(s/def ::change-email
(s/keys :req-un [::name ::pending-email ::token]))
(def ^:private schema:change-email
[:map
[:name ::sm/text]
[:pending-email ::sm/email]
[:token ::sm/text]])
(def change-email
"Password change confirmation email"
(template-factory ::change-email))
(template-factory
:id ::change-email
:schema schema:change-email))
(s/def ::email.invite-to-team/invited-by ::us/string)
(s/def ::email.invite-to-team/team ::us/string)
(s/def ::email.invite-to-team/token ::us/string)
(s/def ::invite-to-team
(s/keys :req-un [::email.invite-to-team/invited-by
::email.invite-to-team/token
::email.invite-to-team/team]))
(def ^:private schema:invite-to-team
[:map
[:invited-by ::sm/text]
[:team ::sm/text]
[:token ::sm/text]])
(def invite-to-team
"Teams member invitation email."
(template-factory ::invite-to-team))
(template-factory
:id ::invite-to-team
:schema schema:invite-to-team))
(s/def ::email.join-team/invited-by ::us/string)
(s/def ::email.join-team/team ::us/string)
(s/def ::email.join-team/team-id ::us/uuid)
(s/def ::join-team
(s/keys :req-un [::email.join-team/invited-by
::email.join-team/team-id
::email.join-team/team]))
(def ^:private schema:join-team
[:map
[:invited-by ::sm/text]
[:team ::sm/text]
[:team-id ::sm/uuid]])
(def join-team
"Teams member joined after request email."
(template-factory ::join-team))
(template-factory
:id ::join-team
:schema schema:join-team))
(s/def ::email.request-team-access/requested-by ::us/string)
(s/def ::email.request-team-access/requested-by-email ::us/string)
(s/def ::email.request-team-access/team-name ::us/string)
(s/def ::email.request-team-access/team-id ::us/uuid)
(s/def ::email.request-team-access/file-name ::us/string)
(s/def ::email.request-team-access/file-id ::us/uuid)
(s/def ::email.request-team-access/page-id ::us/uuid)
(s/def ::request-file-access
(s/keys :req-un [::email.request-team-access/requested-by
::email.request-team-access/requested-by-email
::email.request-team-access/team-name
::email.request-team-access/team-id
::email.request-team-access/file-name
::email.request-team-access/file-id
::email.request-team-access/page-id]))
(def ^:private schema:request-file-access
[:map
[:requested-by ::sm/text]
[:requested-by-email ::sm/text]
[:team-name ::sm/text]
[:team-id ::sm/uuid]
[:file-name ::sm/text]
[:file-id ::sm/uuid]
[:page-id ::sm/uuid]])
(def request-file-access
"File access request email."
(template-factory ::request-file-access))
(s/def ::request-file-access-yourpenpot
(s/keys :req-un [::email.request-team-access/requested-by
::email.request-team-access/requested-by-email
::email.request-team-access/team-name
::email.request-team-access/team-id
::email.request-team-access/file-name
::email.request-team-access/file-id
::email.request-team-access/page-id]))
(template-factory
:id ::request-file-access
:schema schema:request-file-access))
(def request-file-access-yourpenpot
"File access on Your Penpot request email."
(template-factory ::request-file-access-yourpenpot))
(s/def ::request-file-access-yourpenpot-view
(s/keys :req-un [::email.request-team-access/requested-by
::email.request-team-access/requested-by-email
::email.request-team-access/team-name
::email.request-team-access/team-id
::email.request-team-access/file-name
::email.request-team-access/file-id
::email.request-team-access/page-id]))
(template-factory
:id ::request-file-access-yourpenpot
:schema schema:request-file-access))
(def request-file-access-yourpenpot-view
"File access on Your Penpot view mode request email."
(template-factory ::request-file-access-yourpenpot-view))
(template-factory
:id ::request-file-access-yourpenpot-view
:schema schema:request-file-access))
(s/def ::request-team-access
(s/keys :req-un [::email.request-team-access/requested-by
::email.request-team-access/requested-by-email
::email.request-team-access/team-name
::email.request-team-access/team-id]))
(def ^:private schema:request-team-access
[:map
[:requested-by ::sm/text]
[:requested-by-email ::sm/text]
[:team-name ::sm/text]
[:team-id ::sm/uuid]])
(def request-team-access
"Team access request email."
(template-factory ::request-team-access))
(template-factory
:id ::request-team-access
:schema schema:request-team-access))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BOUNCE/COMPLAINS HELPERS

View File

@@ -41,6 +41,7 @@
[app.common.types.shape.path :as ctsp]
[app.common.types.shape.text :as ctsx]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
[app.db.sql :as sql]
[app.features.fdata :as fdata]
@@ -1298,7 +1299,7 @@
(let [[mtype data] (parse-datauri href)
size (alength ^bytes data)
path (tmp/tempfile :prefix "penpot.media.download.")
written (io/write-to-file! data path :size size)]
written (io/write* path data :size size)]
(when (not= written size)
(ex/raise :type :internal
@@ -1381,7 +1382,9 @@
(defn get-optimized-svg
[sid]
(let [svg-text (get-sobject-content sid)
svg-text (svgo/optimize *system* svg-text)]
svg-text (if (contains? cf/flags :backend-svgo)
(svgo/optimize *system* svg-text)
svg-text)]
(csvg/parse svg-text)))
(def base-path "/data/cache")
@@ -1484,11 +1487,6 @@
:file-id (str (:id fdata))
:id (str (:id mobj)))
(instance? org.graalvm.polyglot.PolyglotException cause)
(l/inf :hint "skip processing media object: invalid svg found"
:file-id (str (:id fdata))
:id (str (:id mobj)))
(= (:type edata) :not-found)
(l/inf :hint "skip processing media object: underlying object does not exist"
:file-id (str (:id fdata))
@@ -1747,8 +1745,8 @@
(fn [system]
(binding [*system* system]
(when (string? label)
(fsnap/take-file-snapshot! system {:file-id file-id
:label (str "migration/" label)}))
(fsnap/create-file-snapshot! system nil file-id (str "migration/" label)))
(let [file (get-file system file-id)
file (process-file! system file :validate? validate?)]

View File

@@ -9,6 +9,7 @@
[app.auth.oidc :as-alias oidc]
[app.common.data :as d]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.transit :as t]
[app.db :as-alias db]
[app.http.access-token :as actoken]
@@ -24,14 +25,13 @@
[app.rpc :as-alias rpc]
[app.rpc.doc :as-alias rpc.doc]
[app.setup :as-alias setup]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[promesa.exec :as px]
[reitit.core :as r]
[reitit.middleware :as rr]
[ring.request :as rreq]
[ring.response :as-alias rres]
[yetti.adapter :as yt]))
[yetti.adapter :as yt]
[yetti.request :as yreq]
[yetti.response :as-alias yres]))
(declare router-handler)
@@ -39,31 +39,28 @@
;; HTTP SERVER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::handler fn?)
(s/def ::router some?)
(s/def ::port integer?)
(s/def ::host string?)
(s/def ::name string?)
(def default-params
{::port 6060
::host "0.0.0.0"
::max-body-size (* 1024 1024 30) ; default 30 MiB
::max-multipart-body-size (* 1024 1024 120)}) ; default 120 MiB
(s/def ::max-body-size integer?)
(s/def ::max-multipart-body-size integer?)
(s/def ::io-threads integer?)
(defmethod ig/expand-key ::server
[k v]
{k (merge default-params (d/without-nils v))})
(defmethod ig/prep-key ::server
[_ cfg]
(merge {::port 6060
::host "0.0.0.0"
::max-body-size (* 1024 1024 30) ; default 30 MiB
::max-multipart-body-size (* 1024 1024 120)} ; default 120 MiB
(d/without-nils cfg)))
(def ^:private schema:server-params
[:map
[::port ::sm/int]
[::host ::sm/text]
[::max-body-size {:optional true} ::sm/int]
[::max-multipart-body-size {:optional true} ::sm/int]
[::router {:optional true} [:fn r/router?]]
[::handler {:optional true} ::sm/fn]])
(defmethod ig/pre-init-spec ::server [_]
(s/keys :req [::port ::host]
:opt [::max-body-size
::max-multipart-body-size
::router
::handler
::io-threads]))
(defmethod ig/assert-key ::server
[_ params]
(assert (sm/check schema:server-params params)))
(defmethod ig/init-key ::server
[_ {:keys [::handler ::router ::host ::port] :as cfg}]
@@ -100,12 +97,12 @@
(defn- not-found-handler
[_]
{::rres/status 404})
{::yres/status 404})
(defn- router-handler
[router]
(letfn [(resolve-handler [request]
(if-let [match (r/match-by-path router (rreq/path request))]
(if-let [match (r/match-by-path router (yreq/path request))]
(let [params (:path-params match)
result (:result match)
handler (or (:handler result) not-found-handler)
@@ -114,11 +111,11 @@
(partial not-found-handler request)))
(on-error [cause request]
(let [{:keys [::rres/body] :as response} (errors/handle cause request)]
(let [{:keys [::yres/body] :as response} (errors/handle cause request)]
(cond-> response
(map? body)
(-> (update ::rres/headers assoc "content-type" "application/transit+json")
(assoc ::rres/body (t/encode-str body {:type :json-verbose}))))))]
(-> (update ::yres/headers assoc "content-type" "application/transit+json")
(assoc ::yres/body (t/encode-str body {:type :json-verbose}))))))]
(fn [request]
(let [handler (resolve-handler request)]
@@ -131,18 +128,26 @@
;; HTTP ROUTER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod ig/pre-init-spec ::router [_]
(s/keys :req [::session/manager
::ws/routes
::rpc/routes
::rpc.doc/routes
::oidc/routes
::setup/props
::assets/routes
::debug/routes
::db/pool
::mtx/routes
::awsns/routes]))
(def ^:private schema:routes
[:vector :any])
(def ^:private schema:router-params
[:map
[::ws/routes schema:routes]
[::rpc/routes schema:routes]
[::rpc.doc/routes schema:routes]
[::oidc/routes schema:routes]
[::assets/routes schema:routes]
[::debug/routes schema:routes]
[::mtx/routes schema:routes]
[::awsns/routes schema:routes]
::session/manager
::setup/props
::db/pool])
(defmethod ig/assert-key ::router
[_ params]
(assert (sm/check schema:router-params params)))
(defmethod ig/init-key ::router
[_ cfg]

View File

@@ -12,13 +12,13 @@
[app.main :as-alias main]
[app.setup :as-alias setup]
[app.tokens :as tokens]
[ring.request :as rreq]))
[yetti.request :as yreq]))
(def header-re #"^Token\s+(.*)")
(defn- get-token
[request]
(some->> (rreq/get-header request "authorization")
(some->> (yreq/get-header request "authorization")
(re-matches header-re)
(second)))

View File

@@ -9,14 +9,12 @@
(:require
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.spec :as us]
[app.common.uri :as u]
[app.db :as db]
[app.storage :as sto]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[ring.response :as-alias rres]))
[yetti.response :as-alias yres]))
(def ^:private cache-max-age
(dt/duration {:hours 24}))
@@ -37,8 +35,8 @@
(defn- serve-object-from-s3
[{:keys [::sto/storage] :as cfg} obj]
(let [{:keys [host port] :as url} (sto/get-object-url storage obj {:max-age signature-max-age})]
{::rres/status 307
::rres/headers {"location" (str url)
{::yres/status 307
::yres/headers {"location" (str url)
"x-host" (cond-> host port (str ":" port))
"x-mtype" (-> obj meta :content-type)
"cache-control" (str "max-age=" (inst-ms cache-max-age))}}))
@@ -51,8 +49,8 @@
headers {"x-accel-redirect" (:path purl)
"content-type" (:content-type mdata)
"cache-control" (str "max-age=" (inst-ms cache-max-age))}]
{::rres/status 204
::rres/headers headers}))
{::yres/status 204
::yres/headers headers}))
(defn- serve-object
"Helper function that returns the appropriate response depending on
@@ -69,7 +67,7 @@
obj (sto/get-object storage id)]
(if obj
(serve-object cfg obj)
{::rres/status 404})))
{::yres/status 404})))
(defn- generic-handler
"A generic handler helper/common code for file-media based handlers."
@@ -80,7 +78,7 @@
sobj (sto/get-object storage (kf mobj))]
(if sobj
(serve-object cfg sobj)
{::rres/status 404})))
{::yres/status 404})))
(defn file-objects-handler
"Handler that serves storage objects by file media id."
@@ -95,11 +93,10 @@
;; --- Initialization
(s/def ::path ::us/string)
(s/def ::routes vector?)
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::sto/storage ::path]))
(defmethod ig/assert-key ::routes
[_ params]
(assert (sto/valid-storage? (::sto/storage params)) "expected valid storage instance")
(assert (string? (::path params))))
(defmethod ig/init-key ::routes
[_ cfg]

View File

@@ -10,6 +10,7 @@
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.pprint :as pp]
[app.common.schema :as sm]
[app.db :as db]
[app.db.sql :as sql]
[app.http.client :as http]
@@ -18,29 +19,29 @@
[app.tokens :as tokens]
[app.worker :as-alias wrk]
[clojure.data.json :as j]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]
[promesa.exec :as px]
[ring.request :as rreq]
[ring.response :as-alias rres]))
[yetti.request :as yreq]
[yetti.response :as-alias yres]))
(declare parse-json)
(declare handle-request)
(declare parse-notification)
(declare process-report)
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::http/client
::setup/props
::db/pool]))
(defmethod ig/assert-key ::routes
[_ params]
(assert (http/client? (::http/client params)) "expect a valid http client")
(assert (sm/valid? ::setup/props (::setup/props params)) "expected valid setup props")
(assert (db/pool? (::db/pool params)) "expect valid database pool"))
(defmethod ig/init-key ::routes
[_ cfg]
(letfn [(handler [request]
(let [data (-> request rreq/body slurp)]
(let [data (-> request yreq/body slurp)]
(px/run! :vthread (partial handle-request cfg data)))
{::rres/status 200})]
{::yres/status 200})]
["/sns" {:handler handler
:allowed-methods #{:post}}]))

View File

@@ -7,20 +7,20 @@
(ns app.http.client
"Http client abstraction layer."
(:require
[app.common.spec :as us]
[clojure.spec.alpha :as s]
[app.common.schema :as sm]
[integrant.core :as ig]
[java-http-clj.core :as http]
[promesa.core :as p])
(:import
java.net.http.HttpClient))
(s/def ::client #(instance? HttpClient %))
(s/def ::client-holder
(s/keys :req [::client]))
(defn client?
[o]
(instance? HttpClient o))
(defmethod ig/pre-init-spec ::client [_]
(s/keys :req []))
(sm/register!
{:type ::client
:pred client?})
(defmethod ig/init-key ::client
[_ _]
@@ -30,7 +30,7 @@
(defn send!
([client req] (send! client req {}))
([client req {:keys [response-type sync?] :or {response-type :string sync? false}}]
(us/assert! ::client client)
(assert (client? client) "expected valid http client")
(if sync?
(http/send req {:client client :as response-type})
(try

View File

@@ -26,15 +26,14 @@
[app.util.blob :as blob]
[app.util.template :as tmpl]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[datoteka.io :as io]
[emoji.core :as emj]
[integrant.core :as ig]
[markdown.core :as md]
[markdown.transformers :as mdt]
[ring.request :as rreq]
[ring.response :as rres]))
[yetti.request :as yreq]
[yetti.response :as yres]))
;; (selmer.parser/cache-off!)
@@ -44,9 +43,9 @@
(defn index-handler
[_cfg _request]
{::rres/status 200
::rres/headers {"content-type" "text/html"}
::rres/body (-> (io/resource "app/templates/debug.tmpl")
{::yres/status 200
::yres/headers {"content-type" "text/html"}
::yres/body (-> (io/resource "app/templates/debug.tmpl")
(tmpl/render {:version (:full cf/version)}))})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -56,17 +55,17 @@
(defn prepare-response
[body]
(let [headers {"content-type" "application/transit+json"}]
{::rres/status 200
::rres/body body
::rres/headers headers}))
{::yres/status 200
::yres/body body
::yres/headers headers}))
(defn prepare-download-response
[body filename]
(let [headers {"content-disposition" (str "attachment; filename=" filename)
"content-type" "application/octet-stream"}]
{::rres/status 200
::rres/body body
::rres/headers headers}))
{::yres/status 200
::yres/body body
::yres/headers headers}))
(def sql:retrieve-range-of-changes
"select revn, changes from file_change where file_id=? and revn >= ? and revn <= ? order by revn")
@@ -108,8 +107,8 @@
(db/update! conn :file
{:data data}
{:id file-id})
{::rres/status 201
::rres/body "OK CREATED"})))
{::yres/status 201
::yres/body "OK CREATED"})))
:else
(prepare-response (blob/decode data))))))
@@ -123,7 +122,7 @@
[{:keys [::db/pool]} {:keys [::session/profile-id params] :as request}]
(let [profile (profile/get-profile pool profile-id)
project-id (:default-project-id profile)
data (some-> params :file :path io/read-as-bytes)]
data (some-> params :file :path io/read*)]
(if (and data project-id)
(let [fname (str "Imported file *: " (dt/now))
@@ -138,8 +137,8 @@
{:data data
:deleted-at nil}
{:id file-id})
{::rres/status 200
::rres/body "OK UPDATED"})
{::yres/status 200
::yres/body "OK UPDATED"})
(db/run! pool (fn [{:keys [::db/conn] :as cfg}]
(create-file cfg {:id file-id
@@ -149,15 +148,15 @@
(db/update! conn :file
{:data data}
{:id file-id})
{::rres/status 201
::rres/body "OK CREATED"}))))
{::yres/status 201
::yres/body "OK CREATED"}))))
{::rres/status 500
::rres/body "ERROR"})))
{::yres/status 500
::yres/body "ERROR"})))
(defn file-data-handler
[cfg request]
(case (rreq/method request)
(case (yreq/method request)
:get (retrieve-file-data cfg request)
:post (upload-file-data cfg request)
(ex/raise :type :http
@@ -238,12 +237,12 @@
1 (render-template-v1 report)
2 (render-template-v2 report)
3 (render-template-v3 report))]
{::rres/status 200
::rres/body result
::rres/headers {"content-type" "text/html; charset=utf-8"
{::yres/status 200
::yres/body result
::yres/headers {"content-type" "text/html; charset=utf-8"
"x-robots-tag" "noindex"}})
{::rres/status 404
::rres/body "not found"})))
{::yres/status 404
::yres/body "not found"})))
(def sql:error-reports
"SELECT id, created_at,
@@ -256,10 +255,10 @@
[{:keys [::db/pool]} _request]
(let [items (->> (db/exec! pool [sql:error-reports])
(map #(update % :created-at dt/format-instant :rfc1123)))]
{::rres/status 200
::rres/body (-> (io/resource "app/templates/error-list.tmpl")
{::yres/status 200
::yres/body (-> (io/resource "app/templates/error-list.tmpl")
(tmpl/render {:items items}))
::rres/headers {"content-type" "text/html; charset=utf-8"
::yres/headers {"content-type" "text/html; charset=utf-8"
"x-robots-tag" "noindex"}}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -295,15 +294,16 @@
cfg (assoc cfg
::bf.v1/overwrite false
::bf.v1/profile-id profile-id
::bf.v1/project-id project-id)]
(bf.v1/import-files! cfg path)
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body "OK CLONED"})
::bf.v1/project-id project-id
::bf.v1/input path)]
(bf.v1/import-files! cfg)
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body "OK CLONED"})
{::rres/status 200
::rres/body (io/input-stream path)
::rres/headers {"content-type" "application/octet-stream"
{::yres/status 200
::yres/body (io/input-stream path)
::yres/headers {"content-type" "application/octet-stream"
"content-disposition" (str "attachmen; filename=" (first file-ids) ".penpot")}}))))
@@ -329,11 +329,12 @@
::bf.v1/overwrite overwrite?
::bf.v1/migrate migrate?
::bf.v1/profile-id profile-id
::bf.v1/project-id project-id)]
(bf.v1/import-files! cfg path)
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body "OK"})))
::bf.v1/project-id project-id
::bf.v1/input path)]
(bf.v1/import-files! cfg)
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body "OK"})))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ACTIONS
@@ -363,34 +364,34 @@
(db/update! conn :profile {:is-blocked true} {:id (:id profile)})
(db/delete! conn :http-session {:profile-id (:id profile)})
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body (str/ffmt "PROFILE '%' BLOCKED" (:email profile))})
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body (str/ffmt "PROFILE '%' BLOCKED" (:email profile))})
(contains? params :unblock)
(do
(db/update! conn :profile {:is-blocked false} {:id (:id profile)})
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body (str/ffmt "PROFILE '%' UNBLOCKED" (:email profile))})
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body (str/ffmt "PROFILE '%' UNBLOCKED" (:email profile))})
(contains? params :resend)
(if (:is-blocked profile)
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body "PROFILE ALREADY BLOCKED"}
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body "PROFILE ALREADY BLOCKED"}
(do
(#'auth/send-email-verification! cfg profile)
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body (str/ffmt "RESENDED FOR '%'" (:email profile))}))
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body (str/ffmt "RESENDED FOR '%'" (:email profile))}))
:else
(do
(db/update! conn :profile {:is-active true} {:id (:id profile)})
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body (str/ffmt "PROFILE '%' ACTIVATED" (:email profile))}))))))
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body (str/ffmt "PROFILE '%' ACTIVATED" (:email profile))}))))))
(defn- reset-file-version
@@ -415,9 +416,9 @@
(db/tx-run! cfg srepl/process-file! file-id #(assoc % :version version))
{::rres/status 200
::rres/headers {"content-type" "text/plain"}
::rres/body "OK"}))
{::yres/status 200
::yres/headers {"content-type" "text/plain"}
::yres/body "OK"}))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -429,13 +430,13 @@
[{:keys [::db/pool]} _]
(try
(db/exec-one! pool ["select count(*) as count from server_prop;"])
{::rres/status 200
::rres/body "OK"}
{::yres/status 200
::yres/body "OK"}
(catch Throwable cause
(l/warn :hint "unable to execute query on health handler"
:cause cause)
{::rres/status 503
::rres/body "KO"})))
{::yres/status 503
::yres/body "KO"})))
(defn changelog-handler
[_ _]
@@ -444,11 +445,11 @@
(md->html [text]
(md/md-to-html-string text :replacement-transformers (into [transform-emoji] mdt/transformer-vector)))]
(if-let [clog (io/resource "changelog.md")]
{::rres/status 200
::rres/headers {"content-type" "text/html; charset=utf-8"}
::rres/body (-> clog slurp md->html)}
{::rres/status 404
::rres/body "NOT FOUND"})))
{::yres/status 200
::yres/headers {"content-type" "text/html; charset=utf-8"}
::yres/body (-> clog slurp md->html)}
{::yres/status 404
::yres/body "NOT FOUND"})))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; INIT
@@ -471,8 +472,10 @@
(ex/raise :type :authentication
:code :only-admins-allowed)))))})
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::db/pool ::session/manager]))
(defmethod ig/assert-key ::routes
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool")
(assert (session/manager? (::session/manager params)) "expected a valid session manager"))
(defmethod ig/init-key ::routes
[_ {:keys [::db/pool] :as cfg}]

View File

@@ -16,8 +16,8 @@
[app.http.session :as-alias session]
[app.util.inet :as inet]
[clojure.spec.alpha :as s]
[ring.request :as rreq]
[ring.response :as rres]))
[yetti.request :as yreq]
[yetti.response :as yres]))
(defn request->context
"Extracts error report relevant context data from request."
@@ -29,10 +29,10 @@
{:request/path (:path request)
:request/method (:method request)
:request/params (:params request)
:request/user-agent (rreq/get-header request "user-agent")
:request/user-agent (yreq/get-header request "user-agent")
:request/ip-addr (inet/parse-request request)
:request/profile-id (:uid claims)
:version/frontend (or (rreq/get-header request "x-frontend-version") "unknown")
:version/frontend (or (yreq/get-header request "x-frontend-version") "unknown")
:version/backend (:full cf/version)}))
@@ -46,34 +46,34 @@
(defmethod handle-error :authentication
[err _ _]
{::rres/status 401
::rres/body (ex-data err)})
{::yres/status 401
::yres/body (ex-data err)})
(defmethod handle-error :authorization
[err _ _]
{::rres/status 403
::rres/body (ex-data err)})
{::yres/status 403
::yres/body (ex-data err)})
(defmethod handle-error :restriction
[err _ _]
(let [{:keys [code] :as data} (ex-data err)]
(if (= code :method-not-allowed)
{::rres/status 405
::rres/body data}
{::rres/status 400
::rres/body data})))
{::yres/status 405
::yres/body data}
{::yres/status 400
::yres/body data})))
(defmethod handle-error :rate-limit
[err _ _]
(let [headers (-> err ex-data ::http/headers)]
{::rres/status 429
::rres/headers headers}))
{::yres/status 429
::yres/headers headers}))
(defmethod handle-error :concurrency-limit
[err _ _]
(let [headers (-> err ex-data ::http/headers)]
{::rres/status 429
::rres/headers headers}))
{::yres/status 429
::yres/headers headers}))
(defmethod handle-error :validation
[err request parent-cause]
@@ -84,22 +84,26 @@
(= code :schema-validation)
(= code :data-validation))
(let [explain (ex/explain data)]
{::rres/status 400
::rres/body (-> data
{::yres/status 400
::yres/body (-> data
(dissoc ::s/problems ::s/value ::s/spec ::sm/explain)
(cond-> explain (assoc :explain explain)))})
(= code :vern-conflict)
{::yres/status 409 ;; 409 - Conflict
::yres/body data}
(= code :request-body-too-large)
{::rres/status 413 ::rres/body data}
{::yres/status 413 ::yres/body data}
(= code :invalid-image)
(binding [l/*context* (request->context request)]
(let [cause (or parent-cause err)]
(l/warn :hint "unexpected error on processing image" :cause cause)
{::rres/status 400 ::rres/body data}))
{::yres/status 400 ::yres/body data}))
:else
{::rres/status 400 ::rres/body data})))
{::yres/status 400 ::yres/body data})))
(defmethod handle-error :assertion
[error request parent-cause]
@@ -110,46 +114,47 @@
(= code :data-validation)
(let [explain (ex/explain data)]
(l/error :hint "data assertion error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
:code :assertion
:data (-> data
(dissoc ::sm/explain)
(cond-> explain (assoc :explain explain)))}})
{::yres/status 500
::yres/body (-> data
(dissoc ::sm/explain)
(cond-> explain (assoc :explain explain))
(assoc :type :server-error)
(assoc :code :assertion))})
(= code :spec-validation)
(let [explain (ex/explain data)]
(l/error :hint "spec assertion error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
:code :assertion
:data (-> data
(dissoc ::s/problems ::s/value ::s/spec)
(cond-> explain (assoc :explain explain)))}})
{::yres/status 500
::yres/body (-> data
(dissoc ::s/problems ::s/value ::s/spec)
(cond-> explain (assoc :explain explain))
(assoc :type :server-error)
(assoc :code :assertion))})
:else
(do
(l/error :hint "assertion error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
:code :assertion
:data data}})))))
{::yres/status 500
::yres/body (-> data
(assoc :type :server-error)
(assoc :code :assertion))})))))
(defmethod handle-error :not-found
[err _ _]
{::rres/status 404
::rres/body (ex-data err)})
{::yres/status 404
::yres/body (ex-data err)})
(defmethod handle-error :internal
[error request parent-cause]
(binding [l/*context* (request->context request)]
(let [cause (or parent-cause error)]
(let [cause (or parent-cause error)
data (ex-data error)]
(l/error :hint "internal error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
:code :unhandled
:hint (ex-message error)
:data (ex-data error)}})))
{::yres/status 500
::yres/body (-> data
(assoc :type :server-error)
(update :code #(or % :unhandled))
(assoc :hint (ex-message error)))})))
(defmethod handle-error :default
[error request parent-cause]
@@ -173,20 +178,20 @@
:cause cause)
(cond
(= state "57014")
{::rres/status 504
::rres/body {:type :server-error
{::yres/status 504
::yres/body {:type :server-error
:code :statement-timeout
:hint (ex-message error)}}
(= state "25P03")
{::rres/status 504
::rres/body {:type :server-error
{::yres/status 504
::yres/body {:type :server-error
:code :idle-in-transaction-timeout
:hint (ex-message error)}}
:else
{::rres/status 500
::rres/body {:type :server-error
{::yres/status 500
::yres/body {:type :server-error
:code :unexpected
:hint (ex-message error)
:state state}}))))
@@ -200,25 +205,25 @@
(nil? edata)
(binding [l/*context* (request->context request)]
(l/error :hint "unexpected error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
{::yres/status 500
::yres/body {:type :server-error
:code :unexpected
:hint (ex-message error)}})
:else
(binding [l/*context* (request->context request)]
(l/error :hint "unhandled error" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
:code :unhandled
:hint (ex-message error)
:data edata}}))))
{::yres/status 500
::yres/body (-> edata
(assoc :type :server-error)
(update :code #(or % :unhandled))
(assoc :hint (ex-message error)))}))))
(defmethod handle-exception java.io.IOException
[cause _ _]
(l/wrn :hint "io exception" :cause cause)
{::rres/status 500
::rres/body {:type :server-error
{::yres/status 500
::yres/body {:type :server-error
:code :io-exception
:hint (ex-message cause)}})
@@ -244,4 +249,4 @@
(defn handle'
[cause request]
(::rres/body (handle cause request)))
(::yres/body (handle cause request)))

View File

@@ -15,10 +15,10 @@
[app.http.errors :as errors]
[app.util.pointer-map :as pmap]
[cuerdas.core :as str]
[ring.request :as rreq]
[ring.response :as rres]
[yetti.adapter :as yt]
[yetti.middleware :as ymw])
[yetti.middleware :as ymw]
[yetti.request :as yreq]
[yetti.response :as yres])
(:import
io.undertow.server.RequestTooBigException
java.io.InputStream
@@ -37,17 +37,17 @@
(defn- get-reader
^java.io.BufferedReader
[request]
(let [^InputStream body (rreq/body request)]
(let [^InputStream body (yreq/body request)]
(java.io.BufferedReader.
(java.io.InputStreamReader. body))))
(defn wrap-parse-request
[handler]
(letfn [(process-request [request]
(let [header (rreq/get-header request "content-type")]
(let [header (yreq/get-header request "content-type")]
(cond
(str/starts-with? header "application/transit+json")
(with-open [^InputStream is (rreq/body request)]
(with-open [^InputStream is (yreq/body request)]
(let [params (t/read! (t/reader is))]
(-> request
(assoc :body-params params)
@@ -85,7 +85,7 @@
(errors/handle cause request)))]
(fn [request]
(if (= (rreq/method request) :post)
(if (= (yreq/method request) :post)
(try
(-> request process-request handler)
(catch Throwable cause
@@ -113,57 +113,53 @@
(defn wrap-format-response
[handler]
(letfn [(transit-streamable-body [data opts]
(reify rres/StreamableResponseBody
(-write-body-to-stream [_ _ output-stream]
(try
(with-open [^OutputStream bos (buffered-output-stream output-stream buffer-size)]
(let [tw (t/writer bos opts)]
(t/write! tw data)))
(catch java.io.IOException _)
(catch Throwable cause
(binding [l/*context* {:value data}]
(l/error :hint "unexpected error on encoding response"
:cause cause)))
(finally
(.close ^OutputStream output-stream))))))
(letfn [(transit-streamable-body [data opts _ output-stream]
(try
(with-open [^OutputStream bos (buffered-output-stream output-stream buffer-size)]
(let [tw (t/writer bos opts)]
(t/write! tw data)))
(catch java.io.IOException _)
(catch Throwable cause
(binding [l/*context* {:value data}]
(l/error :hint "unexpected error on encoding response"
:cause cause)))
(finally
(.close ^OutputStream output-stream))))
(json-streamable-body [data]
(reify rres/StreamableResponseBody
(-write-body-to-stream [_ _ output-stream]
(try
(let [encode (or (-> data meta :encode/json) identity)
data (encode data)]
(with-open [^OutputStream bos (buffered-output-stream output-stream buffer-size)]
(with-open [^java.io.OutputStreamWriter writer (java.io.OutputStreamWriter. bos)]
(json/write writer data :key-fn json/write-camel-key :value-fn write-json-value))))
(catch java.io.IOException _)
(catch Throwable cause
(binding [l/*context* {:value data}]
(l/error :hint "unexpected error on encoding response"
:cause cause)))
(finally
(.close ^OutputStream output-stream))))))
(json-streamable-body [data _ output-stream]
(try
(let [encode (or (-> data meta :encode/json) identity)
data (encode data)]
(with-open [^OutputStream bos (buffered-output-stream output-stream buffer-size)]
(with-open [^java.io.OutputStreamWriter writer (java.io.OutputStreamWriter. bos)]
(json/write writer data :key-fn json/write-camel-key :value-fn write-json-value))))
(catch java.io.IOException _)
(catch Throwable cause
(binding [l/*context* {:value data}]
(l/error :hint "unexpected error on encoding response"
:cause cause)))
(finally
(.close ^OutputStream output-stream))))
(format-response-with-json [response _]
(let [body (::rres/body response)]
(let [body (::yres/body response)]
(if (or (boolean? body) (coll? body))
(-> response
(update ::rres/headers assoc "content-type" "application/json")
(assoc ::rres/body (json-streamable-body body)))
(update ::yres/headers assoc "content-type" "application/json")
(assoc ::yres/body (yres/stream-body (partial json-streamable-body body))))
response)))
(format-response-with-transit [response request]
(let [body (::rres/body response)]
(let [body (::yres/body response)]
(if (or (boolean? body) (coll? body))
(let [qs (rreq/query request)
(let [qs (yreq/query request)
opts (if (or (contains? cf/flags :transit-readable-response)
(str/includes? qs "transit_verbose"))
{:type :json-verbose}
{:type :json})]
(-> response
(update ::rres/headers assoc "content-type" "application/transit+json")
(assoc ::rres/body (transit-streamable-body body opts))))
(update ::yres/headers assoc "content-type" "application/transit+json")
(assoc ::yres/body (yres/stream-body (partial transit-streamable-body body opts)))))
response)))
(format-from-params [{:keys [query-params] :as request}]
@@ -172,7 +168,7 @@
(format-response [response request]
(let [accept (or (format-from-params request)
(rreq/get-header request "accept"))]
(yreq/get-header request "accept"))]
(cond
(or (= accept "application/transit+json")
(str/includes? accept "application/transit+json"))
@@ -221,11 +217,11 @@
(defn wrap-cors
[handler]
(fn [request]
(let [response (if (= (rreq/method request) :options)
{::rres/status 200}
(let [response (if (= (yreq/method request) :options)
{::yres/status 200}
(handler request))
origin (rreq/get-header request "origin")]
(update response ::rres/headers with-cors-headers origin))))
origin (yreq/get-header request "origin")]
(update response ::yres/headers with-cors-headers origin))))
(def cors
{:name ::cors
@@ -240,7 +236,7 @@
(when-let [allowed (:allowed-methods data)]
(fn [handler]
(fn [request]
(let [method (rreq/method request)]
(let [method (yreq/method request)]
(if (contains? allowed method)
(handler request)
{::rres/status 405}))))))})
{::yres/status 405}))))))})

View File

@@ -9,7 +9,7 @@
(:require
[app.common.data :as d]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uri :as u]
[app.config :as cf]
[app.db :as db]
@@ -19,11 +19,9 @@
[app.setup :as-alias setup]
[app.tokens :as tokens]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]
[ring.request :as rreq]
[yetti.request :as yrq]))
[yetti.request :as yreq]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DEFAULTS
@@ -52,21 +50,32 @@
(update! [_ data])
(delete! [_ key]))
(s/def ::manager #(satisfies? ISessionManager %))
(defn manager?
[o]
(satisfies? ISessionManager o))
(sm/register!
{:type ::manager
:pred manager?})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; STORAGE IMPL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::session-params
(s/keys :req-un [::user-agent
::profile-id
::created-at]))
(def ^:private schema:params
[:map {:title "session-params"}
[:user-agent ::sm/text]
[:profile-id ::sm/uuid]
[:created-at ::sm/inst]])
(def ^:private valid-params?
(sm/validator schema:params))
(defn- prepare-session-params
[key params]
(us/assert! ::us/not-empty-string key)
(us/assert! ::session-params params)
(assert (string? key) "expected key to be a string")
(assert (not (str/blank? key)) "expected key to be not empty")
(assert (valid-params? params) "expected valid params")
{:user-agent (:user-agent params)
:profile-id (:profile-id params)
@@ -117,8 +126,9 @@
(swap! cache dissoc token)
nil))))
(defmethod ig/pre-init-spec ::manager [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::manager
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid database pool"))
(defmethod ig/init-key ::manager
[_ {:keys [::db/pool]}]
@@ -141,11 +151,11 @@
(defn create-fn
[{:keys [::manager ::setup/props]} profile-id]
(us/assert! ::manager manager)
(us/assert! ::us/uuid profile-id)
(assert (manager? manager) "expected valid session manager")
(assert (uuid? profile-id) "expected valid uuid for profile-id")
(fn [request response]
(let [uagent (rreq/get-header request "user-agent")
(let [uagent (yreq/get-header request "user-agent")
params {:profile-id profile-id
:user-agent uagent
:created-at (dt/now)}
@@ -158,10 +168,10 @@
(defn delete-fn
[{:keys [::manager]}]
(us/assert! ::manager manager)
(assert (manager? manager) "expected valid session manager")
(fn [request response]
(let [cname (cf/get :auth-token-cookie-name default-auth-token-cookie-name)
cookie (yrq/get-cookie request cname)]
cookie (yreq/get-cookie request cname)]
(l/trace :hint "delete" :profile-id (:profile-id request))
(some->> (:value cookie) (delete! manager))
(-> response
@@ -183,7 +193,7 @@
(defn- get-token
[request]
(let [cname (cf/get :auth-token-cookie-name default-auth-token-cookie-name)
cookie (some-> (yrq/get-cookie request cname) :value)]
cookie (some-> (yreq/get-cookie request cname) :value)]
(when-not (str/empty? cookie)
cookie)))
@@ -199,7 +209,7 @@
(defn- wrap-soft-auth
[handler {:keys [::manager ::setup/props]}]
(us/assert! ::manager manager)
(assert (manager? manager) "expected valid session manager")
(letfn [(handle-request [request]
(try
(let [token (get-token request)
@@ -217,7 +227,7 @@
(defn- wrap-authz
[handler {:keys [::manager]}]
(us/assert! ::manager manager)
(assert (manager? manager) "expected valid session manager")
(fn [request]
(let [session (get-session manager (::token request))
request (cond-> request
@@ -308,16 +318,17 @@
;; TASK: SESSION GC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::tasks/max-age ::dt/duration)
;; FIXME: MOVE
(defmethod ig/pre-init-spec ::tasks/gc [_]
(s/keys :req [::db/pool]
:opt [::tasks/max-age]))
(defmethod ig/assert-key ::tasks/gc
[_ params]
(assert (db/pool? (::db/pool params)) "expected valid database pool")
(assert (dt/duration? (::tasks/max-age params))))
(defmethod ig/prep-key ::tasks/gc
[_ cfg]
(defmethod ig/expand-key ::tasks/gc
[k v]
(let [max-age (cf/get :auth-token-cookie-max-age default-cookie-max-age)]
(merge {::tasks/max-age max-age} (d/without-nils cfg))))
{k (merge {::tasks/max-age max-age} (d/without-nils v))}))
(def ^:private
sql:delete-expired

View File

@@ -9,6 +9,7 @@
(:refer-clojure :exclude [tap])
(:require
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.transit :as t]
[app.http.errors :as errors]
@@ -16,7 +17,7 @@
[promesa.exec :as px]
[promesa.exec.csp :as sp]
[promesa.util :as pu]
[ring.response :as rres])
[yetti.response :as yres])
(:import
java.io.OutputStream))
@@ -49,24 +50,21 @@
(defn response
[handler & {:keys [buf] :or {buf 32} :as opts}]
(fn [request]
{::rres/headers default-headers
::rres/status 200
::rres/body (reify rres/StreamableResponseBody
(-write-body-to-stream [_ _ output]
(binding [events/*channel* (sp/chan :buf buf :xf (keep encode))]
(let [listener (events/start-listener
(partial write! output)
(partial pu/close! output))]
(try
(let [result (handler)]
(events/tap :end result))
(catch java.io.EOFException cause
(events/tap :error (errors/handle' cause request)))
(catch Throwable cause
(l/err :hint "unexpected error on processing sse response"
:cause cause)
(events/tap :error (errors/handle' cause request)))
(finally
(sp/close! events/*channel*)
(px/await! listener)))))))}))
{::yres/headers default-headers
::yres/status 200
::yres/body (yres/stream-body
(fn [_ output]
(binding [events/*channel* (sp/chan :buf buf :xf (keep encode))]
(let [listener (events/start-listener
(partial write! output)
(partial pu/close! output))]
(try
(let [result (handler)]
(events/tap :end result))
(catch Throwable cause
(events/tap :error (errors/handle' cause request))
(when-not (ex/instance? java.io.EOFException cause)
(l/err :hint "unexpected error on processing sse response" :cause cause)))
(finally
(sp/close! events/*channel*)
(px/await! listener)))))))}))

View File

@@ -18,10 +18,8 @@
[app.msgbus :as mbus]
[app.util.time :as dt]
[app.util.websocket :as ws]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[promesa.exec.csp :as sp]
[ring.websocket :as rws]
[yetti.websocket :as yws]))
(def recv-labels
@@ -113,7 +111,6 @@
fsub (::file-subscription @state)
tsub (::team-subscription @state)
msg {:type :disconnect
:subs-id profile-id
:profile-id profile-id
:session-id session-id}]
@@ -138,9 +135,7 @@
(l/trace :fn "handle-message" :event "subscribe-team" :team-id team-id :conn-id id)
(let [prev-subs (get @state ::team-subscription)
channel (sp/chan :buf (sp/dropping-buffer 64)
:xf (comp
(remove #(= (:session-id %) session-id))
(map #(assoc % :subs-id team-id))))]
:xf (remove #(= (:session-id %) session-id)))]
(sp/pipe channel output-ch false)
(mbus/sub! msgbus :topic team-id :chan channel)
@@ -159,8 +154,7 @@
(l/trace :fn "handle-message" :event "subscribe-file" :file-id file-id :conn-id id)
(let [psub (::file-subscription @state)
fch (sp/chan :buf (sp/dropping-buffer 64)
:xf (comp (remove #(= (:session-id %) session-id))
(map #(assoc % :subs-id file-id))))]
:xf (remove #(= (:session-id %) session-id)))]
(let [subs {:file-id file-id :channel fch :topic file-id}]
(swap! state assoc ::file-subscription subs))
@@ -191,7 +185,6 @@
;; Notifify the rest of participants of the new connection.
(let [message {:type :join-file
:file-id file-id
:subs-id file-id
:session-id session-id
:profile-id profile-id}]
(mbus/pub! msgbus :topic file-id :message message))))
@@ -303,7 +296,7 @@
:else
(do
(l/trace :hint "websocket request" :profile-id profile-id :session-id session-id)
{::rws/listener (ws/listener request
{::yws/listener (ws/listener request
::ws/on-rcv-message (partial on-rcv-message cfg)
::ws/on-snd-message (partial on-snd-message cfg)
::ws/on-connect (partial on-connect cfg)
@@ -311,13 +304,17 @@
::profile-id profile-id
::session-id session-id)}))))
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::mbus/msgbus
::mtx/metrics
::db/pool
::session/manager]))
(s/def ::routes vector?)
(def ^:private schema:routes-params
[:map
::mbus/msgbus
::mtx/metrics
::db/pool
::session/manager])
(defmethod ig/assert-key ::routes
[_ params]
(assert (sm/valid? schema:routes-params params)))
(defmethod ig/init-key ::routes
[_ cfg]

View File

@@ -10,7 +10,7 @@
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
@@ -25,9 +25,7 @@
[app.util.services :as-alias sv]
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]))
[cuerdas.core :as str]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HELPERS
@@ -95,46 +93,28 @@
;; --- SPECS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; COLLECTOR
;; COLLECTOR API
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Defines a service that collects the audit/activity log using
;; internal database. Later this audit log can be transferred to
;; an external storage and data cleared.
(s/def ::profile-id ::us/uuid)
(s/def ::name ::us/string)
(s/def ::type ::us/string)
(s/def ::props (s/map-of ::us/keyword any?))
(s/def ::ip-addr ::us/string)
(def ^:private schema:event
[:map {:title "event"}
[::type ::sm/text]
[::name ::sm/text]
[::profile-id ::sm/uuid]
[::ip-addr {:optional true} ::sm/text]
[::props {:optional true} [:map-of :keyword :any]]
[::context {:optional true} [:map-of :keyword :any]]
[::webhooks/event? {:optional true} ::sm/boolean]
[::webhooks/batch-timeout {:optional true} ::dt/duration]
[::webhooks/batch-key {:optional true}
[:or ::sm/fn ::sm/text :keyword]]])
(s/def ::webhooks/event? ::us/boolean)
(s/def ::webhooks/batch-timeout ::dt/duration)
(s/def ::webhooks/batch-key
(s/or :fn fn? :str string? :kw keyword?))
(s/def ::event
(s/keys :req [::type ::name ::profile-id]
:opt [::ip-addr
::props
::webhooks/event?
::webhooks/batch-timeout
::webhooks/batch-key]))
(s/def ::collector
(s/keys :req [::wrk/executor ::db/pool]))
(defmethod ig/pre-init-spec ::collector [_]
(s/keys :req [::db/pool ::wrk/executor]))
(defmethod ig/init-key ::collector
[_ {:keys [::db/pool] :as cfg}]
(cond
(db/read-only? pool)
(l/warn :hint "audit disabled (db is read-only)")
:else
cfg))
(def ^:private check-event
(sm/check-fn schema:event))
(defn prepare-event
[cfg mdata params result]
@@ -273,12 +253,12 @@
"Submit audit event to the collector."
[cfg event]
(try
(let [event (d/without-nils event)
(let [event (-> (d/without-nils event)
(check-event))
cfg (-> cfg
(assoc ::rtry/when rtry/conflict-exception?)
(assoc ::rtry/max-retries 6)
(assoc ::rtry/label "persist-audit-log"))]
(us/verify! ::event event)
(rtry/invoke! cfg db/tx-run! handle-event! event))
(catch Throwable cause
(l/error :hint "unexpected error processing event" :cause cause))))
@@ -289,8 +269,8 @@
logic."
[cfg event]
(when (contains? cf/flags :audit-log)
(let [event (d/without-nils event)]
(us/verify! ::event event)
(let [event (-> (d/without-nils event)
(check-event))]
(db/run! cfg (fn [cfg]
(let [tnow (dt/now)
params (-> (event->params event)

View File

@@ -8,6 +8,7 @@
(:require
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.transit :as t]
[app.common.uuid :as uuid]
[app.config :as cf]
@@ -16,7 +17,6 @@
[app.setup :as-alias setup]
[app.tokens :as tokens]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[lambdaisland.uri :as u]
[promesa.exec :as px]))
@@ -108,8 +108,15 @@
(mark-archived! cfg rows)
(count events)))))))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool ::setup/props ::http/client]))
(def ^:private schema:handler-params
[:map
::db/pool
::setup/props
::http/client])
(defmethod ig/assert-key ::handler
[_ params]
(assert (sm/valid? schema:handler-params params) "valid params expected for handler"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -8,7 +8,6 @@
(:require
[app.common.logging :as l]
[app.db :as db]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private sql:clean-archived
@@ -22,8 +21,9 @@
(l/debug :hint "delete archived audit log entries" :deleted result)
result))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "valid database pool expected"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -12,7 +12,6 @@
[app.common.logging :as l]
[app.common.pprint :as pp]
[app.common.schema :as sm]
[app.common.spec :as us]
[app.config :as cf]
[app.db :as db]
[clojure.spec.alpha :as s]
@@ -38,7 +37,7 @@
(defn record->report
[{:keys [::l/context ::l/message ::l/props ::l/logger ::l/level ::l/cause] :as record}]
(us/assert! ::l/record record)
(assert (l/valid-record? record) "expectd valid log record")
(if (or (instance? java.util.concurrent.CompletionException cause)
(instance? java.util.concurrent.ExecutionException cause))
(-> record
@@ -91,8 +90,9 @@
(catch Throwable cause
(l/warn :hint "unexpected exception on database error logger" :cause cause))))
(defmethod ig/pre-init-spec ::reporter [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::reporter
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid database pool"))
(defmethod ig/init-key ::reporter
[_ cfg]

View File

@@ -9,12 +9,10 @@
(:require
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.config :as cf]
[app.http.client :as http]
[app.loggers.database :as ldb]
[app.util.json :as json]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[promesa.exec :as px]
[promesa.exec.csp :as sp]))
@@ -54,7 +52,7 @@
(defn record->report
[{:keys [::l/context ::l/id ::l/cause] :as record}]
(us/assert! ::l/record record)
(assert (l/valid-record? record) "expectd valid log record")
{:id id
:tenant (cf/get :tenant)
:host (cf/get :host)
@@ -75,8 +73,9 @@
(catch Throwable cause
(l/warn :hint "unhandled error" :cause cause)))))
(defmethod ig/pre-init-spec ::reporter [_]
(s/keys :req [::http/client]))
(defmethod ig/assert-key ::reporter
[_ params]
(assert (http/client? (::http/client params)) "expect valid http client"))
(defmethod ig/init-key ::reporter
[_ cfg]

View File

@@ -18,7 +18,6 @@
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.data.json :as json]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]))
@@ -60,8 +59,10 @@
(some->> (:project-id props) (lookup-webhooks-by-project pool))
(some->> (:file-id props) (lookup-webhooks-by-file pool))))
(defmethod ig/pre-init-spec ::process-event-handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::process-event-handler
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid database pool")
(assert (http/client? (::http/client params)) "expect valid http client"))
(defmethod ig/init-key ::process-event-handler
[_ cfg]
@@ -87,12 +88,14 @@
{:key-fn str/camel
:indent true})
(defmethod ig/pre-init-spec ::run-webhook-handler [_]
(s/keys :req [::http/client ::db/pool]))
(defmethod ig/assert-key ::run-webhook-handler
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid database pool")
(assert (http/client? (::http/client params)) "expect valid http client"))
(defmethod ig/prep-key ::run-webhook-handler
[_ cfg]
(merge {::max-errors 3} (d/without-nils cfg)))
(defmethod ig/expand-key ::run-webhook-handler
[k v]
{k (merge {::max-errors 3} (d/without-nils v))})
(defmethod ig/init-key ::run-webhook-handler
[_ {:keys [::db/pool ::max-errors] :as cfg}]

View File

@@ -9,6 +9,7 @@
[app.auth.ldap :as-alias ldap]
[app.auth.oidc :as-alias oidc]
[app.auth.oidc.providers :as-alias oidc.providers]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.config :as cf]
[app.db :as-alias db]
@@ -28,6 +29,7 @@
[app.msgbus :as-alias mbus]
[app.redis :as-alias rds]
[app.rpc :as-alias rpc]
[app.rpc.climit :as-alias climit]
[app.rpc.doc :as-alias rpc.doc]
[app.setup :as-alias setup]
[app.srepl :as-alias srepl]
@@ -169,7 +171,7 @@
{::db/uri (cf/get :database-uri)
::db/username (cf/get :database-username)
::db/password (cf/get :database-password)
::db/read-only? (cf/get :database-readonly false)
::db/read-only (cf/get :database-readonly false)
::db/min-size (cf/get :database-min-pool-size 0)
::db/max-size (cf/get :database-max-pool-size 60)
::mtx/metrics (ig/ref ::mtx/metrics)}
@@ -245,7 +247,7 @@
:base-dn (cf/get :ldap-base-dn)
:bind-dn (cf/get :ldap-bind-dn)
:bind-password (cf/get :ldap-bind-password)
:enabled? (contains? cf/flags :login-with-ldap)}
:enabled (contains? cf/flags :login-with-ldap)}
::oidc.providers/google
{}
@@ -302,9 +304,11 @@
::http.assets/cache-max-agesignature-max-age (dt/duration {:hours 24 :minutes 5})
::sto/storage (ig/ref ::sto/storage)}
:app.rpc/climit
{::mtx/metrics (ig/ref ::mtx/metrics)
::wrk/executor (ig/ref ::wrk/executor)}
::rpc/climit
{::mtx/metrics (ig/ref ::mtx/metrics)
::wrk/executor (ig/ref ::wrk/executor)
::climit/config (cf/get :rpc-climit-config)
::climit/enabled (contains? cf/flags :rpc-climit)}
:app.rpc/rlimit
{::wrk/executor (ig/ref ::wrk/executor)}
@@ -319,7 +323,6 @@
::mtx/metrics (ig/ref ::mtx/metrics)
::mbus/msgbus (ig/ref ::mbus/msgbus)
::rds/redis (ig/ref ::rds/redis)
::svgo/optimizer (ig/ref ::svgo/optimizer)
::rpc/climit (ig/ref ::rpc/climit)
::rpc/rlimit (ig/ref ::rpc/rlimit)
@@ -330,7 +333,7 @@
::email/whitelist (ig/ref ::email/whitelist)}
:app.rpc.doc/routes
{:methods (ig/ref :app.rpc/methods)}
{:app.rpc/methods (ig/ref :app.rpc/methods)}
:app.rpc/routes
{::rpc/methods (ig/ref :app.rpc/methods)
@@ -346,7 +349,6 @@
:file-gc (ig/ref :app.tasks.file-gc/handler)
:file-gc-scheduler (ig/ref :app.tasks.file-gc-scheduler/handler)
:offload-file-data (ig/ref :app.tasks.offload-file-data/handler)
:file-xlog-gc (ig/ref :app.tasks.file-xlog-gc/handler)
:tasks-gc (ig/ref :app.tasks.tasks-gc/handler)
:telemetry (ig/ref :app.tasks.telemetry/handler)
:storage-gc-deleted (ig/ref ::sto.gc-deleted/handler)
@@ -379,8 +381,7 @@
::email/default-from (cf/get :smtp-default-from)}
::email/handler
{::email/sendmail (ig/ref ::email/sendmail)
::mtx/metrics (ig/ref ::mtx/metrics)}
{::email/sendmail (ig/ref ::email/sendmail)}
:app.tasks.tasks-gc/handler
{::db/pool (ig/ref ::db/pool)}
@@ -403,10 +404,6 @@
{::db/pool (ig/ref ::db/pool)
::sto/storage (ig/ref ::sto/storage)}
:app.tasks.file-xlog-gc/handler
{::db/pool (ig/ref ::db/pool)
::sto/storage (ig/ref ::sto/storage)}
:app.tasks.telemetry/handler
{::db/pool (ig/ref ::db/pool)
::http.client/client (ig/ref ::http.client/client)
@@ -430,9 +427,6 @@
;; module requires the migrations to run before initialize.
::migrations (ig/ref :app.migrations/migrations)}
::svgo/optimizer
{}
:app.loggers.audit.archive-task/handler
{::setup/props (ig/ref ::setup/props)
::db/pool (ig/ref ::db/pool)
@@ -488,10 +482,7 @@
{::wrk/registry (ig/ref ::wrk/registry)
::db/pool (ig/ref ::db/pool)
::wrk/entries
[{:cron #app/cron "0 0 * * * ?" ;; hourly
:task :file-xlog-gc}
{:cron #app/cron "0 0 0 * * ?" ;; daily
[{:cron #app/cron "0 0 0 * * ?" ;; daily
:task :session-gc}
{:cron #app/cron "0 0 0 * * ?" ;; daily
@@ -523,11 +514,13 @@
::wrk/dispatcher
{::rds/redis (ig/ref ::rds/redis)
::mtx/metrics (ig/ref ::mtx/metrics)
::db/pool (ig/ref ::db/pool)}
::db/pool (ig/ref ::db/pool)
::wrk/tenant (cf/get :tenant)}
[::default ::wrk/runner]
{::wrk/parallelism (cf/get ::worker-default-parallelism 1)
::wrk/queue :default
::wrk/tenant (cf/get :tenant)
::rds/redis (ig/ref ::rds/redis)
::wrk/registry (ig/ref ::wrk/registry)
::mtx/metrics (ig/ref ::mtx/metrics)
@@ -536,6 +529,7 @@
[::webhook ::wrk/runner]
{::wrk/parallelism (cf/get ::worker-webhook-parallelism 1)
::wrk/queue :webhooks
::wrk/tenant (cf/get :tenant)
::rds/redis (ig/ref ::rds/redis)
::wrk/registry (ig/ref ::wrk/registry)
::mtx/metrics (ig/ref ::mtx/metrics)
@@ -553,7 +547,7 @@
(-> system-config
(cond-> (contains? cf/flags :backend-worker)
(merge worker-config))
(ig/prep)
(ig/expand)
(ig/init))))
(l/inf :hint "welcome to penpot"
:flags (str/join "," (map name cf/flags))
@@ -566,7 +560,7 @@
(alter-var-root #'system (fn [sys]
(when sys (ig/halt! sys))
(-> config
(ig/prep)
(ig/expand)
(ig/init)))))
(defn stop
@@ -622,12 +616,6 @@
(deref p))
(catch Throwable cause
(binding [*out* *err*]
(println "==== ERROR ===="))
(.printStackTrace cause)
(when-let [cause' (ex-cause cause)]
(binding [*out* *err*]
(println "==== CAUSE ===="))
(.printStackTrace cause'))
(ex/print-throwable cause)
(px/sleep 500)
(System/exit -1))))

View File

@@ -46,14 +46,15 @@
(s/keys :req-un [::path]
:opt-un [::mtype]))
(sm/register! ::upload
[:map {:title "Upload"}
[:filename :string]
[:size ::sm/int]
[:path ::fs/path]
[:mtype {:optional true} :string]
[:headers {:optional true}
[:map-of :string :string]]])
(sm/register!
^{::sm/type ::upload}
[:map {:title "Upload"}
[:filename :string]
[:size ::sm/int]
[:path ::fs/path]
[:mtype {:optional true} :string]
[:headers {:optional true}
[:map-of :string :string]]])
(defn validate-media-type!
([upload] (validate-media-type! upload cm/valid-image-types))
@@ -225,7 +226,7 @@
(letfn [(ttf->otf [data]
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".otf"))
_ (io/write-to-file! data finput)
_ (io/write* finput data)
res (sh/sh "fontforge" "-lang=ff" "-c"
(str/fmt "Open('%s'); Generate('%s')"
(str finput)
@@ -236,7 +237,7 @@
(otf->ttf [data]
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".ttf"))
_ (io/write-to-file! data finput)
_ (io/write* finput data)
res (sh/sh "fontforge" "-lang=ff" "-c"
(str/fmt "Open('%s'); Generate('%s')"
(str finput)
@@ -250,14 +251,14 @@
;; command.
(let [finput (tmp/tempfile :prefix "penpot.font." :suffix "")
foutput (fs/path (str finput ".woff"))
_ (io/write-to-file! data finput)
_ (io/write* finput data)
res (sh/sh "sfnt2woff" (str finput))]
(when (zero? (:exit res))
foutput)))
(woff->sfnt [data]
(let [finput (tmp/tempfile :prefix "penpot" :suffix "")
_ (io/write-to-file! data finput)
_ (io/write* finput data)
res (sh/sh "woff2sfnt" (str finput)
:out-enc :bytes)]
(when (zero? (:exit res))

View File

@@ -8,9 +8,8 @@
(:refer-clojure :exclude [run!])
(:require
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.metrics.definition :as-alias mdef]
[clojure.spec.alpha :as s]
[integrant.core :as ig])
(:import
io.prometheus.client.CollectorRegistry
@@ -34,41 +33,52 @@
(declare create-collector)
(declare handler)
(defprotocol IMetrics
(get-registry [_])
(get-collector [_ id])
(get-handler [_]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; METRICS SERVICE PROVIDER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::mdef/name string?)
(s/def ::mdef/help string?)
(s/def ::mdef/labels (s/every string? :kind vector?))
(s/def ::mdef/type #{:gauge :counter :summary :histogram})
(sm/register!
{:type ::collector
:pred #(instance? SimpleCollector %)
:type-properties
{:title "collector"
:description "An instance of SimpleCollector"}})
(s/def ::mdef/instance
#(instance? SimpleCollector %))
(sm/register!
{:type ::registry
:pred #(instance? CollectorRegistry %)
:type-properties
{:title "Metrics Registry"
:description "Instance of CollectorRegistry"}})
(s/def ::mdef/definition
(s/keys :req [::mdef/name
::mdef/help
::mdef/type]
:opt [::mdef/labels
::mdef/instance]))
(def ^:private schema:definitions
[:map-of :keyword
[:map {:title "definition"}
[::mdef/name :string]
[::mdef/help :string]
[::mdef/type [:enum :gauge :counter :summary :histogram]]
[::mdef/labels {:optional true} [::sm/vec :string]]
[::mdef/instance {:optional true} ::collector]]])
(s/def ::definitions
(s/map-of keyword? ::mdef/definition))
(defn metrics?
[o]
(satisfies? IMetrics o))
(s/def ::registry
#(instance? CollectorRegistry %))
(sm/register!
{:type ::metrics
:pred metrics?})
(s/def ::handler fn?)
(s/def ::metrics
(s/keys :req [::registry
::handler
::definitions]))
(def ^:private valid-definitions?
(sm/validator schema:definitions))
(s/def ::default ::definitions)
(defmethod ig/pre-init-spec ::metrics [_]
(s/keys :req-un [::default]))
(defmethod ig/assert-key ::metrics
[_ {:keys [default]}]
(assert (valid-definitions? default) "expected valid definitions"))
(defmethod ig/init-key ::metrics
[_ cfg]
@@ -81,12 +91,14 @@
{}
(:default cfg))]
(us/verify! ::definitions definitions)
{::handler (partial handler registry)
::definitions definitions
::registry registry}))
(reify
IMetrics
(get-handler [_]
(partial handler registry))
(get-collector [_ id]
(get definitions id))
(get-registry [_]
registry))))
(defn- handler
[registry _]
@@ -96,17 +108,14 @@
{:headers {"content-type" TextFormat/CONTENT_TYPE_004}
:body (.toString writer)}))
(s/def ::routes vector?)
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::metrics]))
(defmethod ig/assert-key ::routes
[_ {:keys [::metrics]}]
(assert (metrics? metrics) "expected a valid instance for metrics"))
(defmethod ig/init-key ::routes
[_ {:keys [::metrics]}]
(let [registry (::registry metrics)]
["/metrics" {:handler (partial handler registry)
:allowed-methods #{:get}}]))
["/metrics" {:handler (get-handler metrics)
:allowed-methods #{:get}}])
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation
@@ -126,8 +135,9 @@
(defmulti create-collector ::mdef/type)
(defn run!
[{:keys [::definitions]} & {:keys [id] :as params}]
(when-let [mobj (get definitions id)]
[instance & {:keys [id] :as params}]
(assert (metrics? instance) "expected valid metrics instance")
(when-let [mobj (get-collector instance id)]
(run-collector! mobj params)
true))

View File

@@ -11,7 +11,6 @@
[app.db :as db]
[app.migrations.clj.migration-0023 :as mg0023]
[app.util.migrations :as mg]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def migrations
@@ -412,7 +411,22 @@
:fn (mg/resource "app/migrations/sql/0129-mod-file-change-table.sql")}
{:name "0130-mod-file-change-table"
:fn (mg/resource "app/migrations/sql/0130-mod-file-change-table.sql")}])
:fn (mg/resource "app/migrations/sql/0130-mod-file-change-table.sql")}
{:name "0131-mod-webhook-table"
:fn (mg/resource "app/migrations/sql/0131-mod-webhook-table.sql")}
{:name "0132-mod-file-change-table"
:fn (mg/resource "app/migrations/sql/0132-mod-file-change-table.sql")}
{:name "0133-mod-file-table"
:fn (mg/resource "app/migrations/sql/0133-mod-file-table.sql")}
{:name "0134-mod-file-change-table"
:fn (mg/resource "app/migrations/sql/0134-mod-file-change-table.sql")}
{:name "0135-mod-team-invitation-table.sql"
:fn (mg/resource "app/migrations/sql/0135-mod-team-invitation-table.sql")}])
(defn apply-migrations!
[pool name migrations]
@@ -420,9 +434,9 @@
(mg/setup! conn)
(mg/migrate! conn {:name name :steps migrations})))
(defmethod ig/pre-init-spec ::migrations
[_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::migrations
[_ {:keys [::db/pool]}]
(assert (db/pool? pool) "expected valid pool"))
(defmethod ig/init-key ::migrations
[module {:keys [::db/pool]}]

View File

@@ -0,0 +1,6 @@
ALTER TABLE webhook
ADD COLUMN profile_id uuid NULL REFERENCES profile (id) ON DELETE SET NULL;
CREATE INDEX webhook__profile_id__idx
ON webhook (profile_id)
WHERE profile_id IS NOT NULL;

View File

@@ -0,0 +1,2 @@
ALTER TABLE file_change
ADD COLUMN created_by text NOT NULL DEFAULT 'system';

View File

@@ -0,0 +1,2 @@
ALTER TABLE file
ADD COLUMN vern int NOT NULL DEFAULT 0;

View File

@@ -0,0 +1,18 @@
ALTER TABLE file_change
ADD COLUMN updated_at timestamptz DEFAULT now(),
ADD COLUMN deleted_at timestamptz DEFAULT NULL,
ALTER COLUMN created_at SET DEFAULT now();
DROP INDEX file_change__created_at__idx;
DROP INDEX file_change__created_at__label__idx;
DROP INDEX file_change__label__idx;
CREATE INDEX file_change__deleted_at__idx
ON file_change (deleted_at, id)
WHERE deleted_at IS NOT NULL;
CREATE INDEX file_change__system_snapshots__idx
ON file_change (file_id, created_at)
WHERE data IS NOT NULL
AND created_by = 'system'
AND deleted_at IS NULL;

View File

@@ -0,0 +1,2 @@
ALTER TABLE team_invitation
ADD COLUMN created_by uuid NULL REFERENCES profile(id) ON DELETE SET NULL;

View File

@@ -9,22 +9,27 @@
(:require
[app.common.data :as d]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.transit :as t]
[app.config :as cfg]
[app.redis :as rds]
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[promesa.core :as p]
[promesa.exec :as px]
[promesa.exec.csp :as sp]))
(set! *warn-on-reflection* true)
(def ^:private prefix (cfg/get :tenant))
(defprotocol IMsgBus
(-sub [_ topics chan])
(-pub [_ topic message])
(-purge [_ chans]))
(defn- prefix-topic
[topic]
(str prefix "." topic))
@@ -32,30 +37,33 @@
(def ^:private xform-prefix-topic
(map (fn [obj] (update obj :topic prefix-topic))))
(declare ^:private redis-pub!)
(declare ^:private redis-sub!)
(declare ^:private redis-unsub!)
(declare ^:private start-io-loop!)
(declare ^:private redis-pub)
(declare ^:private redis-sub)
(declare ^:private redis-unsub)
(declare ^:private start-io-loop)
(declare ^:private subscribe-to-topics)
(declare ^:private unsubscribe-channels)
(s/def ::cmd-ch sp/chan?)
(s/def ::rcv-ch sp/chan?)
(s/def ::pub-ch sp/chan?)
(s/def ::state ::us/agent)
(s/def ::pconn ::rds/connection-holder)
(s/def ::sconn ::rds/connection-holder)
(s/def ::msgbus
(s/keys :req [::cmd-ch ::rcv-ch ::pub-ch ::state ::pconn ::sconn ::wrk/executor]))
(defn msgbus?
[o]
(satisfies? IMsgBus o))
(defmethod ig/pre-init-spec ::msgbus [_]
(s/keys :req [::rds/redis ::wrk/executor]))
(sm/register!
{:type ::msgbus
:pred msgbus?})
(defmethod ig/prep-key ::msgbus
[_ cfg]
(-> cfg
(assoc ::buffer-size 128)
(assoc ::timeout (dt/duration {:seconds 30}))))
(defmethod ig/expand-key ::msgbus
[k v]
{k (-> (d/without-nils v)
(assoc ::buffer-size 128)
(assoc ::timeout (dt/duration {:seconds 30})))})
(def ^:private schema:params
[:map ::rds/redis ::wrk/executor])
(defmethod ig/assert-key ::msgbus
[_ params]
(assert (sm/check schema:params params)))
(defmethod ig/init-key ::msgbus
[_ {:keys [::buffer-size ::wrk/executor ::timeout ::rds/redis] :as cfg}]
@@ -66,46 +74,66 @@
:xf xform-prefix-topic)
state (agent {})
pconn (rds/connect redis :timeout timeout)
pconn (rds/connect redis :type :default :timeout timeout)
sconn (rds/connect redis :type :pubsub :timeout timeout)
msgbus (-> cfg
_ (set-error-handler! state #(l/error :cause % :hint "unexpected error on agent" ::l/sync? true))
_ (set-error-mode! state :continue)
cfg (-> cfg
(assoc ::pconn pconn)
(assoc ::sconn sconn)
(assoc ::cmd-ch cmd-ch)
(assoc ::rcv-ch rcv-ch)
(assoc ::pub-ch pub-ch)
(assoc ::state state)
(assoc ::wrk/executor executor))]
(assoc ::state state))
(set-error-handler! state #(l/error :cause % :hint "unexpected error on agent" ::l/sync? true))
(set-error-mode! state :continue)
io-thr (start-io-loop cfg)]
(assoc msgbus ::io-thr (start-io-loop! msgbus))))
(reify
java.lang.AutoCloseable
(close [_]
(px/interrupt! io-thr)
(sp/close! cmd-ch)
(sp/close! rcv-ch)
(sp/close! pub-ch)
(d/close! pconn)
(d/close! sconn))
IMsgBus
(-sub [_ topics chan]
(l/debug :hint "subscribe" :topics topics :chan (hash chan))
(send-via executor state subscribe-to-topics cfg topics chan))
(-pub [_ topic message]
(let [message (assoc message :topic topic)]
(sp/put! pub-ch {:topic topic :message message})))
(-purge [_ chans]
(l/debug :hint "purge" :chans (count chans))
(send-via executor state unsubscribe-channels cfg chans)))))
(defmethod ig/halt-key! ::msgbus
[_ msgbus]
(px/interrupt! (::io-thr msgbus))
(sp/close! (::cmd-ch msgbus))
(sp/close! (::rcv-ch msgbus))
(sp/close! (::pub-ch msgbus))
(d/close! (::pconn msgbus))
(d/close! (::sconn msgbus)))
[_ instance]
(d/close! instance))
(defn sub!
[{:keys [::state ::wrk/executor] :as cfg} & {:keys [topic topics chan]}]
[instance & {:keys [topic topics chan]}]
(assert (satisfies? IMsgBus instance) "expected valid msgbus instance")
(let [topics (into [] (map prefix-topic) (if topic [topic] topics))]
(l/debug :hint "subscribe" :topics topics :chan (hash chan))
(send-via executor state subscribe-to-topics cfg topics chan)
(-sub instance topics chan)
nil))
(defn pub!
[{::keys [pub-ch]} & {:as params}]
(sp/put! pub-ch params))
[instance & {:keys [topic message]}]
(assert (satisfies? IMsgBus instance) "expected valid msgbus instance")
(-pub instance topic message))
(defn purge!
[{:keys [::state ::wrk/executor] :as msgbus} chans]
(l/debug :hint "purge" :chans (count chans))
(send-via executor state unsubscribe-channels msgbus chans)
[instance chans]
(assert (satisfies? IMsgBus instance) "expected valid msgbus instance")
(assert (every? sp/chan? chans) "expected a seq of chans")
(-purge instance chans)
nil)
;; --- IMPL
@@ -118,7 +146,7 @@
(let [nsubs (if (nil? nsubs) #{chan} (conj nsubs chan))]
(when (= 1 (count nsubs))
(l/trace :hint "open subscription" :topic topic ::l/sync? true)
(redis-sub! cfg topic))
(redis-sub cfg topic))
nsubs))
(defn- disj-subscription
@@ -129,7 +157,7 @@
(let [nsubs (disj nsubs chan)]
(when (empty? nsubs)
(l/trace :hint "close subscription" :topic topic ::l/sync? true)
(redis-unsub! cfg topic))
(redis-unsub cfg topic))
nsubs))
(defn- subscribe-to-topics
@@ -170,7 +198,7 @@
(when-not (sp/offer! rcv-ch val)
(l/warn :msg "dropping message on subscription loop"))))))
(defn- process-input!
(defn- process-input
[{:keys [::state ::wrk/executor] :as cfg} topic message]
(let [chans (get-in @state [:topics topic])]
(when-let [closed (loop [chans (seq chans)
@@ -183,9 +211,9 @@
(send-via executor state unsubscribe-channels cfg closed))))
(defn start-io-loop!
(defn start-io-loop
[{:keys [::sconn ::rcv-ch ::pub-ch ::state ::wrk/executor] :as cfg}]
(rds/add-listener! sconn (create-listener rcv-ch))
(rds/add-listener sconn (create-listener rcv-ch))
(px/thread
{:name "penpot/msgbus/io-loop"
@@ -209,12 +237,12 @@
(identical? port rcv-ch)
(let [{:keys [topic message]} val]
(process-input! cfg topic message)
(process-input cfg topic message)
(recur))
(identical? port pub-ch)
(do
(redis-pub! cfg val)
(redis-pub cfg val)
(recur)))))
(catch InterruptedException _
@@ -230,13 +258,12 @@
(l/debug :hint "io-loop thread terminated")))))
(defn- redis-pub!
(defn- redis-pub
"Publish a message to the redis server. Asynchronous operation,
intended to be used in core.async go blocks."
[{:keys [::pconn] :as cfg} {:keys [topic message]}]
(try
(p/await! (rds/publish! pconn topic (t/encode message)))
(p/await! (rds/publish pconn topic (t/encode message)))
(catch InterruptedException cause
(throw cause))
(catch Throwable cause
@@ -244,23 +271,23 @@
:message message
:cause cause))))
(defn- redis-sub!
(defn- redis-sub
"Create redis subscription. Blocking operation, intended to be used
inside an agent."
[{:keys [::sconn] :as cfg} topic]
(try
(rds/subscribe! sconn topic)
(rds/subscribe sconn [topic])
(catch InterruptedException cause
(throw cause))
(catch Throwable cause
(l/trace :hint "exception on subscribing" :topic topic :cause cause))))
(defn- redis-unsub!
(defn- redis-unsub
"Removes redis subscription. Blocking operation, intended to be used
inside an agent."
[{:keys [::sconn] :as cfg} topic]
(try
(rds/unsubscribe! sconn topic)
(rds/unsubscribe sconn [topic])
(catch InterruptedException cause
(throw cause))
(catch Throwable cause

View File

@@ -6,11 +6,12 @@
(ns app.redis
"The msgbus abstraction implemented using redis as underlying backend."
(:refer-clojure :exclude [eval])
(:require
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.metrics :as mtx]
[app.redis.script :as-alias rscript]
[app.util.cache :as cache]
@@ -18,13 +19,11 @@
[app.worker :as-alias wrk]
[clojure.core :as c]
[clojure.java.io :as io]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[integrant.core :as ig]
[promesa.core :as p]
[promesa.exec :as px])
(:import
clojure.lang.IDeref
clojure.lang.MapEntry
io.lettuce.core.KeyValue
io.lettuce.core.RedisClient
@@ -53,79 +52,24 @@
(set! *warn-on-reflection* true)
(declare initialize-resources)
(declare shutdown-resources)
(declare connect*)
(declare ^:private initialize-resources)
(declare ^:private shutdown-resources)
(declare ^:private impl-eval)
(s/def ::timer
#(instance? Timer %))
(defprotocol IRedis
(-connect [_ options])
(-get-or-connect [_ key options]))
(s/def ::default-connection
#(or (instance? StatefulRedisConnection %)
(and (instance? IDeref %)
(instance? StatefulRedisConnection (deref %)))))
(defprotocol IConnection
(publish [_ topic message])
(rpush [_ key payload])
(blpop [_ timeout keys])
(eval [_ script]))
(s/def ::pubsub-connection
#(or (instance? StatefulRedisPubSubConnection %)
(and (instance? IDeref %)
(instance? StatefulRedisPubSubConnection (deref %)))))
(s/def ::connection
(s/or :default ::default-connection
:pubsub ::pubsub-connection))
(s/def ::connection-holder
(s/keys :req [::connection]))
(s/def ::redis-uri
#(instance? RedisURI %))
(s/def ::resources
#(instance? ClientResources %))
(s/def ::pubsub-listener
#(instance? RedisPubSubListener %))
(s/def ::uri ::us/not-empty-string)
(s/def ::timeout ::dt/duration)
(s/def ::connect? ::us/boolean)
(s/def ::io-threads ::us/integer)
(s/def ::worker-threads ::us/integer)
(s/def ::cache cache/cache?)
(s/def ::redis
(s/keys :req [::resources
::redis-uri
::timer
::mtx/metrics]
:opt [::connection
::cache]))
(defmethod ig/prep-key ::redis
[_ cfg]
(let [cpus (px/get-available-processors)
threads (max 1 (int (* cpus 0.2)))]
(merge {::timeout (dt/duration "10s")
::io-threads (max 3 threads)
::worker-threads (max 3 threads)}
(d/without-nils cfg))))
(defmethod ig/pre-init-spec ::redis [_]
(s/keys :req [::uri ::mtx/metrics]
:opt [::timeout
::connect?
::io-threads
::worker-threads]))
(defmethod ig/init-key ::redis
[_ {:keys [::connect?] :as cfg}]
(let [state (initialize-resources cfg)]
(cond-> state
connect? (assoc ::connection (connect* cfg {})))))
(defmethod ig/halt-key! ::redis
[_ state]
(shutdown-resources state))
(defprotocol IPubSubConnection
(add-listener [_ listener])
(subscribe [_ topics])
(unsubscribe [_ topics]))
(def default-codec
(RedisCodec/of StringCodec/UTF8 ByteArrayCodec/INSTANCE))
@@ -133,23 +77,76 @@
(def string-codec
(RedisCodec/of StringCodec/UTF8 StringCodec/UTF8))
(defn- create-cache
[{:keys [::wrk/executor] :as cfg}]
(letfn [(on-remove [key val cause]
(l/trace :hint "evict connection (cache)" :key key :reason cause)
(some-> val d/close!))]
(cache/create :executor executor
:on-remove on-remove
:keepalive "5m")))
(sm/register!
{:type ::connection
:pred #(satisfies? IConnection %)
:type-properties
{:title "connection"
:description "redis connection instance"}})
(sm/register!
{:type ::pubsub-connection
:pred #(satisfies? IPubSubConnection %)
:type-properties
{:title "connection"
:description "redis connection instance"}})
(defn redis?
[o]
(satisfies? IRedis o))
(sm/register!
{:type ::redis
:pred redis?})
(def ^:private schema:script
[:map {:title "script"}
[::rscript/name qualified-keyword?]
[::rscript/path ::sm/text]
[::rscript/keys {:optional true} [:vector :any]]
[::rscript/vals {:optional true} [:vector :any]]])
(def valid-script?
(sm/lazy-validator schema:script))
(defmethod ig/expand-key ::redis
[k v]
(let [cpus (px/get-available-processors)
threads (max 1 (int (* cpus 0.2)))]
{k (-> (d/without-nils v)
(assoc ::timeout (dt/duration "10s"))
(assoc ::io-threads (max 3 threads))
(assoc ::worker-threads (max 3 threads)))}))
(def ^:private schema:redis-params
[:map {:title "redis-params"}
::wrk/executor
::mtx/metrics
[::uri ::sm/uri]
[::worker-threads ::sm/int]
[::io-threads ::sm/int]
[::timeout ::dt/duration]])
(defmethod ig/assert-key ::redis
[_ params]
(assert (sm/check schema:redis-params params)))
(defmethod ig/init-key ::redis
[_ params]
(initialize-resources params))
(defmethod ig/halt-key! ::redis
[_ instance]
(d/close! instance))
(defn- initialize-resources
"Initialize redis connection resources"
[{:keys [::uri ::io-threads ::worker-threads ::connect?] :as cfg}]
(l/info :hint "initialize redis resources"
:uri uri
:io-threads io-threads
:worker-threads worker-threads
:connect? connect?)
[{:keys [::uri ::io-threads ::worker-threads ::wrk/executor ::mtx/metrics] :as params}]
(l/inf :hint "initialize redis resources"
:uri (str uri)
:io-threads io-threads
:worker-threads worker-threads)
(let [timer (HashedWheelTimer.)
resources (.. (DefaultClientResources/builder)
@@ -158,147 +155,134 @@
(timer ^Timer timer)
(build))
redis-uri (RedisURI/create ^String uri)
cfg (-> cfg
(assoc ::resources resources)
(assoc ::timer timer)
(assoc ::redis-uri redis-uri))]
redis-uri (RedisURI/create ^String (str uri))
(assoc cfg ::cache (create-cache cfg))))
shutdown (fn [client conn]
(ex/ignoring (.close ^StatefulConnection conn))
(ex/ignoring (.close ^RedisClient client))
(l/trc :hint "disconnect" :hid (hash client)))
(defn- shutdown-resources
[{:keys [::resources ::cache ::timer]}]
(cache/invalidate! cache)
on-remove (fn [key val cause]
(l/trace :hint "evict connection (cache)" :key key :reason cause)
(some-> val d/close!))
(when resources
(.shutdown ^ClientResources resources))
(when timer
(.stop ^Timer timer)))
(defn connect*
[{:keys [::resources ::redis-uri] :as state}
{:keys [timeout codec type]
:or {codec default-codec type :default}}]
(us/assert! ::resources resources)
(let [client (RedisClient/create ^ClientResources resources ^RedisURI redis-uri)
timeout (or timeout (::timeout state))
conn (case type
:default (.connect ^RedisClient client ^RedisCodec codec)
:pubsub (.connectPubSub ^RedisClient client ^RedisCodec codec))]
(l/trc :hint "connect" :hid (hash client))
(.setTimeout ^StatefulConnection conn ^Duration timeout)
cache (cache/create :executor executor
:on-remove on-remove
:keepalive "5m")]
(reify
IDeref
(deref [_] conn)
AutoCloseable
java.lang.AutoCloseable
(close [_]
(ex/ignoring (.close ^StatefulConnection conn))
(ex/ignoring (.shutdown ^RedisClient client))
(l/trc :hint "disconnect" :hid (hash client))))))
(ex/ignoring (cache/invalidate! cache))
(ex/ignoring (.shutdown ^ClientResources resources))
(ex/ignoring (.stop ^Timer timer)))
IRedis
(-get-or-connect [this key options]
(let [create (fn [_] (-connect this options))]
(cache/get cache key create)))
(-connect [_ options]
(let [timeout (or (:timeout options) (::timeout params))
codec (get options :codec default-codec)
type (get options :type :default)
client (RedisClient/create ^ClientResources resources
^RedisURI redis-uri)]
(l/trc :hint "connect" :hid (hash client))
(if (= type :pubsub)
(let [conn (.connectPubSub ^RedisClient client
^RedisCodec codec)]
(.setTimeout ^StatefulConnection conn
^Duration timeout)
(reify
IPubSubConnection
(add-listener [_ listener]
(assert (instance? RedisPubSubListener listener) "expected listener instance")
(.addListener ^StatefulRedisPubSubConnection conn
^RedisPubSubListener listener))
(subscribe [_ topics]
(try
(let [topics (into-array String (map str topics))
cmd (.sync ^StatefulRedisPubSubConnection conn)]
(.subscribe ^RedisPubSubCommands cmd topics))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(unsubscribe [_ topics]
(try
(let [topics (into-array String (map str topics))
cmd (.sync ^StatefulRedisPubSubConnection conn)]
(.unsubscribe ^RedisPubSubCommands cmd topics))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
AutoCloseable
(close [_] (shutdown client conn))))
(let [conn (.connect ^RedisClient client ^RedisCodec codec)]
(.setTimeout ^StatefulConnection conn ^Duration timeout)
(reify
IConnection
(publish [_ topic message]
(assert (string? topic) "expected topic to be string")
(assert (bytes? message) "expected message to be a byte array")
(let [pcomm (.async ^StatefulRedisConnection conn)]
(.publish ^RedisAsyncCommands pcomm ^String topic ^bytes message)))
(rpush [_ key payload]
(assert (or (and (vector? payload)
(every? bytes? payload))
(bytes? payload)))
(try
(let [cmd (.sync ^StatefulRedisConnection conn)
data (if (vector? payload) payload [payload])
vals (make-array (. Class (forName "[B")) (count data))]
(loop [i 0 xs (seq data)]
(when xs
(aset ^"[[B" vals i ^bytes (first xs))
(recur (inc i) (next xs))))
(.rpush ^RedisCommands cmd
^String key
^"[[B" vals))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(blpop [_ timeout keys]
(try
(let [keys (into-array Object (map str keys))
cmd (.sync ^StatefulRedisConnection conn)
timeout (/ (double (inst-ms timeout)) 1000.0)]
(when-let [res (.blpop ^RedisCommands cmd
^double timeout
^"[Ljava.lang.String;" keys)]
(MapEntry/create
(.getKey ^KeyValue res)
(.getValue ^KeyValue res))))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(eval [_ script]
(assert (valid-script? script) "expected valid script")
(impl-eval conn metrics script))
AutoCloseable
(close [_] (shutdown client conn))))))))))
(defn connect
[state & {:as opts}]
(let [connection (connect* state opts)]
(-> state
(assoc ::connection connection)
(dissoc ::cache)
(vary-meta assoc `d/close! (fn [_] (d/close! connection))))))
[instance & {:as opts}]
(assert (satisfies? IRedis instance) "expected valid redis instance")
(-connect instance opts))
(defn get-or-connect
[{:keys [::cache] :as state} key options]
(us/assert! ::redis state)
(let [create (fn [_] (connect* state options))
connection (cache/get cache key create)]
(-> state
(dissoc ::cache)
(assoc ::connection connection))))
(defn add-listener!
[{:keys [::connection] :as conn} listener]
(us/assert! ::pubsub-connection connection)
(us/assert! ::pubsub-listener listener)
(.addListener ^StatefulRedisPubSubConnection @connection
^RedisPubSubListener listener)
conn)
(defn publish!
[{:keys [::connection]} topic message]
(us/assert! ::us/string topic)
(us/assert! ::us/bytes message)
(us/assert! ::default-connection connection)
(let [pcomm (.async ^StatefulRedisConnection @connection)]
(.publish ^RedisAsyncCommands pcomm ^String topic ^bytes message)))
(defn subscribe!
"Blocking operation, intended to be used on a thread/agent thread."
[{:keys [::connection]} & topics]
(us/assert! ::pubsub-connection connection)
(try
(let [topics (into-array String (map str topics))
cmd (.sync ^StatefulRedisPubSubConnection @connection)]
(.subscribe ^RedisPubSubCommands cmd topics))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(defn unsubscribe!
"Blocking operation, intended to be used on a thread/agent thread."
[{:keys [::connection]} & topics]
(us/assert! ::pubsub-connection connection)
(try
(let [topics (into-array String (map str topics))
cmd (.sync ^StatefulRedisPubSubConnection @connection)]
(.unsubscribe ^RedisPubSubCommands cmd topics))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(defn rpush!
[{:keys [::connection]} key payload]
(us/assert! ::default-connection connection)
(us/assert! (or (and (vector? payload)
(every? bytes? payload))
(bytes? payload)))
(try
(let [cmd (.sync ^StatefulRedisConnection @connection)
data (if (vector? payload) payload [payload])
vals (make-array (. Class (forName "[B")) (count data))]
(loop [i 0 xs (seq data)]
(when xs
(aset ^"[[B" vals i ^bytes (first xs))
(recur (inc i) (next xs))))
(.rpush ^RedisCommands cmd
^String key
^"[[B" vals))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(defn blpop!
[{:keys [::connection]} timeout & keys]
(us/assert! ::default-connection connection)
(try
(let [keys (into-array Object (map str keys))
cmd (.sync ^StatefulRedisConnection @connection)
timeout (/ (double (inst-ms timeout)) 1000.0)]
(when-let [res (.blpop ^RedisCommands cmd
^double timeout
^"[Ljava.lang.String;" keys)]
(MapEntry/create
(.getKey ^KeyValue res)
(.getValue ^KeyValue res))))
(catch RedisCommandInterruptedException cause
(throw (InterruptedException. (ex-message cause))))))
(defn open?
[{:keys [::connection]}]
(us/assert! ::pubsub-connection connection)
(.isOpen ^StatefulConnection @connection))
[instance key & {:as opts}]
(assert (satisfies? IRedis instance) "expected valid redis instance")
(-get-or-connect instance key opts))
(defn pubsub-listener
[& {:keys [on-message on-subscribe on-unsubscribe]}]
@@ -328,26 +312,10 @@
(on-unsubscribe nil topic count)))))
(def ^:private scripts-cache (atom {}))
(def noop-fn (constantly nil))
(s/def ::rscript/name qualified-keyword?)
(s/def ::rscript/path ::us/not-empty-string)
(s/def ::rscript/keys (s/every any? :kind vector?))
(s/def ::rscript/vals (s/every any? :kind vector?))
(s/def ::rscript/script
(s/keys :req [::rscript/name
::rscript/path]
:opt [::rscript/keys
::rscript/vals]))
(defn eval!
[{:keys [::mtx/metrics ::connection] :as state} script]
(us/assert! ::redis state)
(us/assert! ::default-connection connection)
(us/assert! ::rscript/script script)
(let [cmd (.async ^StatefulRedisConnection @connection)
(defn- impl-eval
[^StatefulRedisConnection connection metrics script]
(let [cmd (.async ^StatefulRedisConnection connection)
keys (into-array String (map str (::rscript/keys script)))
vals (into-array String (map str (::rscript/vals script)))
sname (::rscript/name script)]

View File

@@ -36,8 +36,8 @@
[cuerdas.core :as str]
[integrant.core :as ig]
[promesa.core :as p]
[ring.request :as rreq]
[ring.response :as rres]))
[yetti.request :as yreq]
[yetti.response :as yres]))
(s/def ::profile-id ::us/uuid)
@@ -64,16 +64,16 @@
response (if (fn? result)
(result request)
(let [result (rph/unwrap result)]
{::rres/status (::http/status mdata 200)
::rres/headers (::http/headers mdata {})
::rres/body result}))]
{::yres/status (::http/status mdata 200)
::yres/headers (::http/headers mdata {})
::yres/body result}))]
(-> response
(handle-response-transformation request mdata)
(handle-before-comple-hook mdata))))
(defn get-external-session-id
[request]
(when-let [session-id (rreq/get-header request "x-external-session-id")]
(when-let [session-id (yreq/get-header request "x-external-session-id")]
(when-not (or (> (count session-id) 256)
(= session-id "null")
(str/blank? session-id))
@@ -81,7 +81,7 @@
(defn- get-external-event-origin
[request]
(when-let [origin (rreq/get-header request "x-event-origin")]
(when-let [origin (yreq/get-header request "x-event-origin")]
(when-not (or (> (count origin) 256)
(= origin "null")
(str/blank? origin))
@@ -92,7 +92,7 @@
internal async flow into ring async flow."
[methods {:keys [params path-params method] :as request}]
(let [handler-name (:type path-params)
etag (rreq/get-header request "if-none-match")
etag (yreq/get-header request "if-none-match")
profile-id (or (::session/profile-id request)
(::actoken/profile-id request))
@@ -250,39 +250,49 @@
'app.rpc.commands.projects
'app.rpc.commands.search
'app.rpc.commands.teams
'app.rpc.commands.teams-invitations
'app.rpc.commands.verify-token
'app.rpc.commands.viewer
'app.rpc.commands.webhooks)
(map (partial process-method cfg))
(into {}))))
(defmethod ig/pre-init-spec ::methods [_]
(s/keys :req [::session/manager
::http.client/client
::db/pool
::mbus/msgbus
::ldap/provider
::sto/storage
::mtx/metrics
::setup/props]
:opt [::climit
::rlimit]))
(def ^:private schema:methods-params
[:map {:title "methods-params"}
::session/manager
::http.client/client
::db/pool
::mbus/msgbus
::sto/storage
::mtx/metrics
[::ldap/provider [:maybe ::ldap/provider]]
[::climit [:maybe ::climit]]
[::rlimit [:maybe ::rlimit]]
::setup/props])
(defmethod ig/assert-key ::methods
[_ params]
(assert (sm/check schema:methods-params params)))
(defmethod ig/init-key ::methods
[_ cfg]
(let [cfg (d/without-nils cfg)]
(resolve-command-methods cfg)))
(s/def ::methods
(s/map-of keyword? (s/tuple map? fn?)))
(def ^:private schema:methods
[:map-of :keyword [:tuple :map ::sm/fn]])
(s/def ::routes vector?)
(sm/register! ::methods schema:methods)
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req [::methods
::db/pool
::setup/props
::session/manager]))
(def ^:private valid-methods?
(sm/validator schema:methods))
(defmethod ig/assert-key ::routes
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid database pool")
(assert (some? (::setup/props params)))
(assert (session/manager? (::session/manager params)) "expect valid session manager")
(assert (valid-methods? (::methods params)) "expect valid methods map"))
(defmethod ig/init-key ::routes
[_ {:keys [::methods] :as cfg}]

View File

@@ -10,18 +10,15 @@
(:require
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.config :as cf]
[app.common.schema :as sm]
[app.metrics :as mtx]
[app.rpc :as-alias rpc]
[app.rpc.climit.config :as-alias config]
[app.util.cache :as cache]
[app.util.services :as-alias sv]
[app.util.time :as dt]
[app.worker :as-alias wrk]
[clojure.edn :as edn]
[clojure.set :as set]
[clojure.spec.alpha :as s]
[datoteka.fs :as fs]
[integrant.core :as ig]
[promesa.exec :as px]
@@ -32,6 +29,62 @@
(set! *warn-on-reflection* true)
(declare ^:private impl-invoke)
(declare ^:private id->str)
(declare ^:private create-cache)
(defprotocol IConcurrencyLimiter
(^:private get-config [_ limit-id] "get a config for a key")
(^:private invoke [_ config handler] "invoke a handler for a config"))
(sm/register!
{:type ::rpc/climit
:pred #(satisfies? IConcurrencyLimiter %)})
(def ^:private schema:config
[:map-of :keyword
[:map
[::id {:optional true} :keyword]
[::key {:optional true} :any]
[::label {:optional true} ::sm/text]
[::params {:optional true} :map]
[::permits {:optional true} ::sm/int]
[::queue {:optional true} ::sm/int]
[::timeout {:optional true} ::sm/int]]])
(def ^:private check-config
(sm/check-fn schema:config))
(def ^:private schema:climit-params
[:map
::mtx/metrics
::wrk/executor
[::enabled {:optional true} ::sm/boolean]
[::config {:optional true} ::fs/path]])
(defmethod ig/assert-key ::rpc/climit
[_ params]
(assert (sm/valid? schema:climit-params params)))
(defmethod ig/init-key ::rpc/climit
[_ {:keys [::config ::enabled ::mtx/metrics] :as cfg}]
(when enabled
(when-let [params (some->> config slurp edn/read-string check-config)]
(l/inf :hint "initializing concurrency limit" :config (str config))
(let [params (reduce-kv (fn [result k v]
(assoc result k (assoc v ::id k)))
params
params)
cache (create-cache cfg)]
(reify
IConcurrencyLimiter
(get-config [_ id]
(get params id))
(invoke [_ config handler]
(impl-invoke metrics cache config handler)))))))
(defn- id->str
([id]
(-> (str id)
@@ -41,59 +94,23 @@
(str (-> (str id) (subs 1)) "/" key)
(id->str id))))
(defn- create-cache
[{:keys [::wrk/executor]}]
(letfn [(on-remove [key _ cause]
(let [[id skey] key]
(l/trc :hint "disposed" :id (id->str id skey) :reason (str cause))))]
(cache/create :executor executor
:on-remove on-remove
:keepalive "5m")))
(s/def ::config/permits ::us/integer)
(s/def ::config/queue ::us/integer)
(s/def ::config/timeout ::us/integer)
(s/def ::config
(s/map-of keyword?
(s/keys :opt-un [::config/permits
::config/queue
::config/timeout])))
(defmethod ig/prep-key ::rpc/climit
[_ cfg]
(assoc cfg ::path (cf/get :rpc-climit-config)))
(s/def ::path ::fs/path)
(defmethod ig/pre-init-spec ::rpc/climit [_]
(s/keys :req [::mtx/metrics ::wrk/executor ::path]))
(defmethod ig/init-key ::rpc/climit
[_ {:keys [::path ::mtx/metrics] :as cfg}]
(when (contains? cf/flags :rpc-climit)
(when-let [params (some->> path slurp edn/read-string)]
(l/inf :hint "initializing concurrency limit" :config (str path))
(us/verify! ::config params)
{::cache (create-cache cfg)
::config params
::mtx/metrics metrics})))
(s/def ::cache cache/cache?)
(s/def ::instance
(s/keys :req [::cache ::config]))
(s/def ::rpc/climit
(s/nilable ::instance))
(defn- create-limiter
[config [id skey]]
(l/trc :hint "created" :id (id->str id skey))
[config id]
(l/trc :hint "created" :id id)
(pbh/create :permits (or (:permits config) (:concurrency config))
:queue (or (:queue config) (:queue-size config))
:timeout (:timeout config)
:type :semaphore))
(defn- create-cache
[{:keys [::wrk/executor]}]
(letfn [(on-remove [id _ cause]
(l/trc :hint "disposed" :id id :reason (str cause)))]
(cache/create :executor executor
:on-remove on-remove
:keepalive "5m")))
(defn measure!
(defn- measure
[metrics mlabels stats elapsed]
(let [mpermits (:max-permits stats)
permits (:permits stats)
@@ -117,8 +134,14 @@
:val (inst-ms elapsed)
:labels mlabels))))
(defn log!
[action req-id stats limit-id limit-label params elapsed]
(defn- prepare-params-for-debug
[params]
(-> (select-keys params [::rpc/profile-id :file-id :profile-id])
(set/rename-keys {::rpc/profile-id :profile-id})
(update-vals str)))
(defn- log
[action req-id stats limit-id limit-label limit-params elapsed]
(let [mpermits (:max-permits stats)
queue (:queue stats)
queue (- queue mpermits)
@@ -132,37 +155,42 @@
:label limit-label
:queue queue
:elapsed (some-> elapsed dt/format-duration)
:params (-> (select-keys params [::rpc/profile-id :file-id :profile-id])
(set/rename-keys {::rpc/profile-id :profile-id})
(update-vals str)))))
:params @limit-params)))
(def ^:private idseq (AtomicLong. 0))
(defn- invoke
[limiter metrics limit-id limit-key limit-label handler params]
(let [tpoint (dt/tpoint)
mlabels (into-array String [(id->str limit-id)])
limit-id (id->str limit-id limit-key)
stats (pbh/get-stats limiter)
req-id (.incrementAndGet ^AtomicLong idseq)]
(defn- impl-invoke
[metrics cache config handler]
(let [limit-id (::id config)
limit-key (::key config)
limit-label (::label config)
limit-params (delay
(prepare-params-for-debug
(::params config)))
mlabels (into-array String [(id->str limit-id)])
limit-id (id->str limit-id limit-key)
limiter (cache/get cache limit-id (partial create-limiter config))
tpoint (dt/tpoint)
req-id (.incrementAndGet ^AtomicLong idseq)]
(try
(measure! metrics mlabels stats nil)
(log! "enqueued" req-id stats limit-id limit-label params nil)
(let [stats (pbh/get-stats limiter)]
(measure metrics mlabels stats nil)
(log "enqueued" req-id stats limit-id limit-label limit-params nil))
(px/invoke! limiter (fn []
(let [elapsed (tpoint)
stats (pbh/get-stats limiter)]
(measure! metrics mlabels stats elapsed)
(log! "acquired" req-id stats limit-id limit-label params elapsed)
(handler params))))
(measure metrics mlabels stats elapsed)
(log "acquired" req-id stats limit-id limit-label limit-params elapsed)
(handler))))
(catch ExceptionInfo cause
(let [{:keys [type code]} (ex-data cause)]
(if (= :bulkhead-error type)
(let [elapsed (tpoint)]
(log! "rejected" req-id stats limit-id limit-label params elapsed)
(let [elapsed (tpoint)
stats (pbh/get-stats limiter)]
(log "rejected" req-id stats limit-id limit-label limit-params elapsed)
(ex/raise :type :concurrency-limit
:code code
:hint "concurrency limit reached"
@@ -173,8 +201,8 @@
(let [elapsed (tpoint)
stats (pbh/get-stats limiter)]
(measure! metrics mlabels stats nil)
(log! "finished" req-id stats limit-id limit-label params elapsed))))))
(measure metrics mlabels stats nil)
(log "finished" req-id stats limit-id limit-label limit-params elapsed))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MIDDLEWARE
@@ -204,71 +232,70 @@
(throw (IllegalArgumentException. "unable to normalize limit")))))
(defn wrap
[{:keys [::rpc/climit ::mtx/metrics]} handler mdata]
(let [cache (::cache climit)
config (::config climit)
label (::sv/name mdata)]
[cfg handler {label ::sv/name :as mdata}]
(if-let [climit (::rpc/climit cfg)]
(reduce (fn [handler [limit-id key-fn]]
(if-let [config (get-config climit limit-id)]
(let [key-fn (or key-fn noop-fn)]
(l/trc :hint "instrumenting method"
:method label
:limit (id->str limit-id)
:timeout (:timeout config)
:permits (:permits config)
:queue (:queue config)
:keyed (not= key-fn nil))
(if climit
(reduce (fn [handler [limit-id key-fn]]
(if-let [config (get config limit-id)]
(let [key-fn (or key-fn noop-fn)]
(l/trc :hint "instrumenting method"
:method label
:limit (id->str limit-id)
:timeout (:timeout config)
:permits (:permits config)
:queue (:queue config)
:keyed (not= key-fn noop-fn))
(if (and (= key-fn ::rpc/profile-id)
(false? (::rpc/auth mdata true)))
(if (and (= key-fn ::rpc/profile-id)
(false? (::rpc/auth mdata true)))
;; We don't enforce by-profile limit on methods that does
;; not require authentication
handler
;; We don't enforce by-profile limit on methods that does
;; not require authentication
handler
(fn [cfg params]
(let [config (-> config
(assoc ::key (key-fn params))
(assoc ::label label)
;; NOTE: only used for debugging output
(assoc ::params params))]
(invoke climit config (partial handler cfg params))))))
(fn [cfg params]
(let [limit-key (key-fn params)
cache-key [limit-id limit-key]
limiter (cache/get cache cache-key (partial create-limiter config))
handler (partial handler cfg)]
(invoke limiter metrics limit-id limit-key label handler params)))))
(do
(l/wrn :hint "no config found for specified queue" :id (id->str limit-id))
handler)))
handler
(concat global-limits (get-limits mdata)))
(do
(l/wrn :hint "no config found for specified queue" :id (id->str limit-id))
handler)))
handler
(concat global-limits (get-limits mdata)))
handler)))
handler))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PUBLIC API
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- build-exec-chain
[{:keys [::label ::rpc/climit ::mtx/metrics] :as cfg} f]
(let [config (get climit ::config)
cache (get climit ::cache)]
(reduce (fn [handler [limit-id limit-key :as ckey]]
(if-let [config (get config limit-id)]
[{:keys [::label ::rpc/climit] :as cfg} f]
(reduce (fn [handler [limit-id limit-key]]
(if-let [config (get-config climit limit-id)]
(let [config (-> config
(assoc ::key limit-key)
(assoc ::label label))]
(fn [cfg params]
(let [limiter (cache/get cache ckey (partial create-limiter config))
handler (partial handler cfg)]
(invoke limiter metrics limit-id limit-key label handler params)))
(do
(l/wrn :hint "config not found" :label label :id limit-id)
f)))
f
(get-limits cfg))))
(let [config (assoc config ::params params)]
(invoke climit config (partial handler cfg params)))))
(do
(l/wrn :hint "config not found" :label label :id limit-id)
f)))
f
(get-limits cfg)))
(defn invoke!
"Run a function in context of climit.
Intended to be used in virtual threads."
[{:keys [::executor] :as cfg} f params]
(let [f (if (some? executor)
(fn [cfg params] (px/await! (px/submit! executor (fn [] (f cfg params)))))
f)
f (build-exec-chain cfg f)]
[{:keys [::executor ::rpc/climit] :as cfg} f params]
(let [f (if climit
(let [f (if (some? executor)
(fn [cfg params] (px/await! (px/submit! executor (fn [] (f cfg params)))))
f)]
(build-exec-chain cfg f))
f)]
(f cfg params)))

View File

@@ -273,7 +273,8 @@
(merge {:viewed-tutorial? false
:viewed-walkthrough? false
:nudge {:big 10 :small 1}
:v2-info-shown true})
:v2-info-shown true
:release-notes-viewed (:main cf/version)})
(db/tjson))
password (or (:password params) "!")
@@ -383,7 +384,9 @@
invitation (when-let [token (:invitation-token params)]
(tokens/verify (::setup/props cfg) {:token token :iss :team-invitation}))
props (audit/profile->props profile)
props (-> (audit/profile->props profile)
(assoc :from-invitation (some? invitation)))
create-welcome-file-when-needed
(fn []

View File

@@ -8,6 +8,7 @@
(:refer-clojure :exclude [assert])
(:require
[app.binfile.v1 :as bf.v1]
[app.binfile.v3 :as bf.v3]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.db :as db]
@@ -24,7 +25,7 @@
[app.util.time :as dt]
[app.worker :as-alias wrk]
[promesa.exec :as px]
[ring.response :as rres]))
[yetti.response :as yres]))
(set! *warn-on-reflection* true)
@@ -35,51 +36,103 @@
[:map {:title "export-binfile"}
[:name [:string {:max 250}]]
[:file-id ::sm/uuid]
[:include-libraries :boolean]
[:embed-assets :boolean]])
[:version {:optional true} ::sm/int]
[:include-libraries ::sm/boolean]
[:embed-assets ::sm/boolean]])
(defn stream-export-v1
[cfg {:keys [file-id include-libraries embed-assets] :as params}]
(yres/stream-body
(fn [_ output-stream]
(try
(-> cfg
(assoc ::bf.v1/ids #{file-id})
(assoc ::bf.v1/embed-assets embed-assets)
(assoc ::bf.v1/include-libraries include-libraries)
(bf.v1/export-files! output-stream))
(catch Throwable cause
(l/err :hint "exception on exporting file"
:file-id (str file-id)
:cause cause))))))
(defn stream-export-v3
[cfg {:keys [file-id include-libraries embed-assets] :as params}]
(yres/stream-body
(fn [_ output-stream]
(try
(-> cfg
(assoc ::bf.v3/ids #{file-id})
(assoc ::bf.v3/embed-assets embed-assets)
(assoc ::bf.v3/include-libraries include-libraries)
(bf.v3/export-files! output-stream))
(catch Throwable cause
(l/err :hint "exception on exporting file"
:file-id (str file-id)
:cause cause))))))
(sv/defmethod ::export-binfile
"Export a penpot file in a binary format."
{::doc/added "1.15"
::webhooks/event? true
::sm/result schema:export-binfile}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id include-libraries embed-assets] :as params}]
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id version file-id] :as params}]
(files/check-read-permissions! pool profile-id file-id)
(fn [_]
{::rres/status 200
::rres/headers {"content-type" "application/octet-stream"}
::rres/body (reify rres/StreamableResponseBody
(-write-body-to-stream [_ _ output-stream]
(try
(-> cfg
(assoc ::bf.v1/ids #{file-id})
(assoc ::bf.v1/embed-assets embed-assets)
(assoc ::bf.v1/include-libraries include-libraries)
(bf.v1/export-files! output-stream))
(catch Throwable cause
(l/err :hint "exception on exporting file"
:file-id (str file-id)
:cause cause)))))}))
(let [version (or version 1)
body (case (int version)
1 (stream-export-v1 cfg params)
2 (throw (ex-info "not-implemented" {}))
3 (stream-export-v3 cfg params))]
{::yres/status 200
::yres/headers {"content-type" "application/octet-stream"}
::yres/body body})))
;; --- Command: import-binfile
(defn- import-binfile-v1
[{:keys [::wrk/executor] :as cfg} {:keys [project-id profile-id name file]}]
(let [cfg (-> cfg
(assoc ::bf.v1/project-id project-id)
(assoc ::bf.v1/profile-id profile-id)
(assoc ::bf.v1/name name)
(assoc ::bf.v1/input (:path file)))]
;; NOTE: the importation process performs some operations that are
;; not very friendly with virtual threads, and for avoid
;; unexpected blocking of other concurrent operations we dispatch
;; that operation to a dedicated executor.
(px/invoke! executor (partial bf.v1/import-files! cfg))))
(defn- import-binfile-v3
[{:keys [::wrk/executor] :as cfg} {:keys [project-id profile-id name file]}]
(let [cfg (-> cfg
(assoc ::bf.v3/project-id project-id)
(assoc ::bf.v3/profile-id profile-id)
(assoc ::bf.v3/name name)
(assoc ::bf.v3/input (:path file)))]
;; NOTE: the importation process performs some operations that are
;; not very friendly with virtual threads, and for avoid
;; unexpected blocking of other concurrent operations we dispatch
;; that operation to a dedicated executor.
(px/invoke! executor (partial bf.v3/import-files! cfg))))
(defn- import-binfile
[{:keys [::wrk/executor ::bf.v1/project-id ::db/pool] :as cfg} input]
;; NOTE: the importation process performs some operations that
;; are not very friendly with virtual threads, and for avoid
;; unexpected blocking of other concurrent operations we
;; dispatch that operation to a dedicated executor.
(let [result (px/invoke! executor (partial bf.v1/import-files! cfg input))]
[{:keys [::db/pool] :as cfg} {:keys [project-id version] :as params}]
(let [result (case (int version)
1 (import-binfile-v1 cfg params)
3 (import-binfile-v3 cfg params))]
(db/update! pool :project
{:modified-at (dt/now)}
{:id project-id})
result))
(def ^:private
schema:import-binfile
(def ^:private schema:import-binfile
[:map {:title "import-binfile"}
[:name [:string {:max 250}]]
[:name [:or [:string {:max 250}]
[:map-of ::sm/uuid [:string {:max 250}]]]]
[:project-id ::sm/uuid]
[:version {:optional true} ::sm/int]
[:file ::media/upload]])
(sv/defmethod ::import-binfile
@@ -88,12 +141,11 @@
::webhooks/event? true
::sse/stream? true
::sm/params schema:import-binfile}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id name project-id file] :as params}]
(projects/check-read-permissions! pool profile-id project-id)
(let [cfg (-> cfg
(assoc ::bf.v1/project-id project-id)
(assoc ::bf.v1/profile-id profile-id)
(assoc ::bf.v1/name name))]
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id project-id version] :as params}]
(projects/check-edition-permissions! pool profile-id project-id)
(let [params (-> params
(assoc :profile-id profile-id)
(assoc :version (or version 1)))]
(with-meta
(sse/response #(import-binfile cfg (:path file)))
(sse/response (partial import-binfile cfg params))
{::audit/props {:file nil}})))

View File

@@ -29,10 +29,11 @@
;; --- GENERAL PURPOSE INTERNAL HELPERS
(defn- decode-row
[{:keys [participants position] :as row}]
[{:keys [participants position mentions] :as row}]
(cond-> row
(db/pgpoint? position) (assoc :position (db/decode-pgpoint position))
(db/pgobject? participants) (assoc :participants (db/decode-transit-pgobject participants))))
(db/pgobject? participants) (assoc :participants (db/decode-transit-pgobject participants))
(db/pgarray? mentions) (assoc :mentions (db/decode-pgarray mentions #{}))))
(def xf-decode-row
(map decode-row))
@@ -461,8 +462,9 @@
:thread-id thread-id
:owner-id profile-id
:content content})
props {:file-id file-id
:share-id nil}]
comment (decode-row comment)
props {:file-id file-id
:share-id nil}]
;; Update thread modified-at attribute and assoc the current
;; profile to the participant set.

View File

@@ -17,7 +17,7 @@
[app.rpc.doc :as-alias doc]
[app.util.services :as sv]))
(declare ^:private send-feedback!)
(declare ^:private send-user-feedback!)
(def ^:private schema:send-user-feedback
[:map {:title "send-user-feedback"}
@@ -34,14 +34,16 @@
:hint "feedback not enabled"))
(let [profile (profile/get-profile pool profile-id)]
(send-feedback! pool profile params)
(send-user-feedback! pool profile params)
nil))
(defn- send-feedback!
(defn- send-user-feedback!
[pool profile params]
(let [dest (cf/get :feedback-destination)]
(let [dest (or (cf/get :user-feedback-destination)
;; LEGACY
(cf/get :feedback-destination))]
(eml/send! {::eml/conn pool
::eml/factory eml/feedback
::eml/factory eml/user-feedback
:from dest
:to dest
:profile profile

View File

@@ -17,6 +17,7 @@
[app.common.schema.desc-js-like :as-alias smdj]
[app.common.types.components-list :as ctkl]
[app.common.types.file :as ctf]
[app.common.uri :as uri]
[app.config :as cf]
[app.db :as db]
[app.db.sql :as-alias sql]
@@ -35,7 +36,8 @@
[app.util.services :as sv]
[app.util.time :as dt]
[app.worker :as wrk]
[cuerdas.core :as str]))
[cuerdas.core :as str]
[promesa.exec :as px]))
;; --- FEATURES
@@ -181,6 +183,7 @@
[:comment-thread-seqn [::sm/int {:min 0}]]
[:name [:string {:max 250}]]
[:revn [::sm/int {:min 0}]]
[:vern [::sm/int {:min 0}]]
[:modified-at ::dt/instant]
[:is-shared ::sm/boolean]
[:project-id ::sm/uuid]
@@ -243,16 +246,16 @@
file)))
(defn get-file
[{:keys [::db/conn] :as cfg} id & {:keys [project-id
migrate?
include-deleted?
lock-for-update?]
:or {include-deleted? false
lock-for-update? false
migrate? true}}]
(dm/assert!
"expected cfg with valid connection"
(db/connection-map? cfg))
[{:keys [::db/conn ::wrk/executor] :as cfg} id
& {:keys [project-id
migrate?
include-deleted?
lock-for-update?]
:or {include-deleted? false
lock-for-update? false
migrate? true}}]
(assert (db/connection? conn) "expected cfg with valid connection")
(let [params (merge {:id id}
(when (some? project-id)
@@ -261,55 +264,76 @@
{::db/check-deleted (not include-deleted?)
::db/remove-deleted (not include-deleted?)
::sql/for-update lock-for-update?})
(feat.fdata/resolve-file-data cfg)
(decode-row))]
(feat.fdata/resolve-file-data cfg))
;; NOTE: we perform the file decoding in a separate thread
;; because it has heavy and synchronous operations for
;; decoding file body that are not very friendly with virtual
;; threads.
file (px/invoke! executor #(decode-row file))]
(if (and migrate? (fmg/need-migration? file))
(migrate-file cfg file)
file)))
(defn get-minimal-file
[cfg id & {:as opts}]
(let [opts (assoc opts ::sql/columns [:id :modified-at :deleted-at :revn :data-ref-id :data-backend])]
(let [opts (assoc opts ::sql/columns [:id :modified-at :deleted-at :revn :vern :data-ref-id :data-backend])]
(db/get cfg :file {:id id} opts)))
(defn- get-minimal-file-with-perms
[cfg {:keys [:id ::rpc/profile-id]}]
(let [mfile (get-minimal-file cfg id)
perms (get-permissions cfg profile-id id)]
(assoc mfile :permissions perms)))
(defn get-file-etag
[{:keys [::rpc/profile-id]} {:keys [modified-at revn]}]
(str profile-id (dt/format-instant modified-at :iso) revn))
[{:keys [::rpc/profile-id]} {:keys [modified-at revn vern permissions]}]
(str profile-id "/" revn "/" vern "/"
(dt/format-instant modified-at :iso)
"/"
(uri/map->query-string permissions)))
(sv/defmethod ::get-file
"Retrieve a file by its ID. Only authenticated users."
{::doc/added "1.17"
::cond/get-object #(get-minimal-file %1 (:id %2))
::cond/get-object #(get-minimal-file-with-perms %1 %2)
::cond/key-fn get-file-etag
::sm/params schema:get-file
::sm/result schema:file-with-permissions}
[cfg {:keys [::rpc/profile-id id project-id] :as params}]
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
(let [perms (get-permissions conn profile-id id)]
(check-read-permissions! perms)
(let [team (teams/get-team conn
:profile-id profile-id
:project-id project-id
:file-id id)
::sm/result schema:file-with-permissions
::db/transaction true}
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id id project-id] :as params}]
;; The COND middleware makes initial request for a file and
;; permissions when the incoming request comes with an
;; ETAG. When ETAG does not matches, the request is resolved
;; and this code is executed, in this case the permissions
;; will be already prefetched and we just reuse them instead
;; of making an additional database queries.
(let [perms (or (:permissions (::cond/object params))
(get-permissions conn profile-id id))]
(check-read-permissions! perms)
file (-> (get-file cfg id :project-id project-id)
(assoc :permissions perms)
(check-version!))
(let [team (teams/get-team conn
:profile-id profile-id
:project-id project-id
:file-id id)
_ (-> (cfeat/get-team-enabled-features cf/flags team)
(cfeat/check-client-features! (:features params))
(cfeat/check-file-features! (:features file) (:features params)))
file (-> (get-file cfg id :project-id project-id)
(assoc :permissions perms)
(check-version!))]
;; This operation is needed for backward comapatibility with frontends that
;; does not support pointer-map resolution mechanism; this just resolves the
;; pointers on backend and return a complete file.
file (if (and (contains? (:features file) "fdata/pointer-map")
(not (contains? (:features params) "fdata/pointer-map")))
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg id)]
(update file :data feat.fdata/process-pointers deref))
file)]
(-> (cfeat/get-team-enabled-features cf/flags team)
(cfeat/check-client-features! (:features params))
(cfeat/check-file-features! (:features file) (:features params)))
(vary-meta file assoc ::cond/key (get-file-etag params file)))))))
;; This operation is needed for backward comapatibility with frontends that
;; does not support pointer-map resolution mechanism; this just resolves the
;; pointers on backend and return a complete file.
(if (and (contains? (:features file) "fdata/pointer-map")
(not (contains? (:features params) "fdata/pointer-map")))
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg id)]
(update file :data feat.fdata/process-pointers deref))
file))))
;; --- COMMAND QUERY: get-file-fragment (by id)
@@ -355,6 +379,7 @@
f.modified_at,
f.name,
f.revn,
f.vern,
f.is_shared,
ft.media_id AS thumbnail_id
from file as f
@@ -504,6 +529,7 @@
(def ^:private sql:team-shared-files
"select f.id,
f.revn,
f.vern,
f.data,
f.project_id,
f.created_at,
@@ -587,6 +613,7 @@
l.deleted_at,
l.name,
l.revn,
l.vern,
l.synced_at
FROM libs AS l
WHERE l.deleted_at IS NULL OR l.deleted_at > now();")
@@ -648,6 +675,7 @@
"with recent_files as (
select f.id,
f.revn,
f.vern,
f.project_id,
f.created_at,
f.modified_at,
@@ -670,11 +698,7 @@
(defn get-team-recent-files
[conn team-id]
(->> (db/exec! conn [sql:team-recent-files team-id])
(mapv (fn [row]
(if-let [media-id (:thumbnail-id row)]
(assoc row :thumbnail-uri (resolve-public-uri media-id))
(dissoc row :media-id))))))
(db/exec! conn [sql:team-recent-files team-id]))
(def ^:private schema:get-team-recent-files
[:map {:title "get-team-recent-files"}

View File

@@ -118,11 +118,12 @@
;; feature on frontend and make it permanent on file
features (-> (:features params #{})
(set/intersection cfeat/no-migration-features)
(set/difference cfeat/frontend-only-features)
(set/union features))
params (-> params
(assoc :profile-id profile-id)
(assoc :features features))]
(assoc :features (set/difference features cfeat/frontend-only-features)))]
(quotes/check! cfg {::quotes/id ::quotes/files-per-project
::quotes/team-id team-id

View File

@@ -15,10 +15,11 @@
[app.db.sql :as-alias sql]
[app.features.fdata :as feat.fdata]
[app.main :as-alias main]
[app.msgbus :as mbus]
[app.rpc :as-alias rpc]
[app.rpc.commands.files :as files]
[app.rpc.commands.profile :as profile]
[app.rpc.doc :as-alias doc]
[app.rpc.quotes :as quotes]
[app.storage :as sto]
[app.util.blob :as blob]
[app.util.pointer-map :as pmap]
@@ -26,173 +27,58 @@
[app.util.time :as dt]
[cuerdas.core :as str]))
(defn check-authorized!
[{:keys [::db/pool]} profile-id]
(when-not (or (= "devenv" (cf/get :host))
(let [profile (ex/ignoring (profile/get-profile pool profile-id))
admins (or (cf/get :admins) #{})]
(contains? admins (:email profile))))
(ex/raise :type :authentication
:code :authentication-required
:hint "only admins allowed")))
(def sql:get-file-snapshots
"SELECT id, label, revn, created_at
FROM file_change
WHERE file_id = ?
AND created_at < ?
AND label IS NOT NULL
ORDER BY created_at DESC
LIMIT ?")
"WITH changes AS (
SELECT id, label, revn, created_at, created_by, profile_id
FROM file_change
WHERE file_id = ?
AND data IS NOT NULL
AND (deleted_at IS NULL OR deleted_at > now())
), versions AS (
(SELECT * FROM changes WHERE created_by = 'system' LIMIT 1000)
UNION ALL
(SELECT * FROM changes WHERE created_by != 'system' LIMIT 1000)
)
SELECT * FROM versions
ORDER BY created_at DESC;")
(defn get-file-snapshots
[{:keys [::db/conn]} {:keys [file-id limit start-at]
:or {limit Long/MAX_VALUE}}]
(let [start-at (or start-at (dt/now))
limit (min limit 20)]
(->> (db/exec! conn [sql:get-file-snapshots file-id start-at limit])
(mapv (fn [row]
(update row :created-at dt/format-instant :rfc1123))))))
[conn file-id]
(db/exec! conn [sql:get-file-snapshots file-id]))
(def ^:private schema:get-file-snapshots
[:map [:file-id ::sm/uuid]])
[:map {:title "get-file-snapshots"}
[:file-id ::sm/uuid]])
(sv/defmethod ::get-file-snapshots
{::doc/added "1.20"
::doc/skip true
::sm/params schema:get-file-snapshots}
[cfg {:keys [::rpc/profile-id] :as params}]
(check-authorized! cfg profile-id)
(db/run! cfg get-file-snapshots params))
[cfg {:keys [::rpc/profile-id file-id] :as params}]
(db/run! cfg (fn [{:keys [::db/conn]}]
(files/check-read-permissions! conn profile-id file-id)
(get-file-snapshots conn file-id))))
(defn restore-file-snapshot!
[{:keys [::db/conn] :as cfg} {:keys [file-id id]}]
(let [storage (sto/resolve cfg {::db/reuse-conn true})
file (files/get-minimal-file conn file-id {::db/for-update true})
snapshot (db/get* conn :file-change
{:file-id file-id
:id id}
{::db/for-share true})]
(when-not snapshot
(ex/raise :type :not-found
:code :snapshot-not-found
:hint "unable to find snapshot with the provided label"
:id id
:file-id file-id))
(let [snapshot (feat.fdata/resolve-file-data cfg snapshot)]
(when-not (:data snapshot)
(ex/raise :type :precondition
:code :snapshot-without-data
:hint "snapshot has no data"
:label (:label snapshot)
:file-id file-id))
(l/dbg :hint "restoring snapshot"
:file-id (str file-id)
:label (:label snapshot)
:snapshot-id (str (:id snapshot)))
;; If the file was already offloaded, on restring the snapshot
;; we are going to replace the file data, so we need to touch
;; the old referenced storage object and avoid possible leaks
(when (feat.fdata/offloaded? file)
(sto/touch-object! storage (:data-ref-id file)))
(db/update! conn :file
{:data (:data snapshot)
:revn (inc (:revn file))
:version (:version snapshot)
:data-backend nil
:data-ref-id nil
:has-media-trimmed false
:features (:features snapshot)}
{:id file-id})
;; clean object thumbnails
(let [sql (str "update file_tagged_object_thumbnail "
" set deleted_at = now() "
" where file_id=? returning media_id")
res (db/exec! conn [sql file-id])]
(doseq [media-id (into #{} (keep :media-id) res)]
(sto/touch-object! storage media-id)))
;; clean file thumbnails
(let [sql (str "update file_thumbnail "
" set deleted_at = now() "
" where file_id=? returning media_id")
res (db/exec! conn [sql file-id])]
(doseq [media-id (into #{} (keep :media-id) res)]
(sto/touch-object! storage media-id)))
{:id (:id snapshot)
:label (:label snapshot)})))
(defn- resolve-snapshot-by-label
[conn file-id label]
(->> (db/query conn :file-change
{:file-id file-id
:label label}
{::sql/order-by [[:created-at :desc]]
::sql/columns [:file-id :id :label]})
(first)))
(def ^:private
schema:restore-file-snapshot
[:and
[:map
[:file-id ::sm/uuid]
[:id {:optional true} ::sm/uuid]
[:label {:optional true} :string]]
[::sm/contains-any #{:id :label}]])
(sv/defmethod ::restore-file-snapshot
{::doc/added "1.20"
::doc/skip true
::sm/params schema:restore-file-snapshot}
[cfg {:keys [::rpc/profile-id file-id id label] :as params}]
(check-authorized! cfg profile-id)
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
(let [params (cond-> params
(and (not id) (string? label))
(merge (resolve-snapshot-by-label conn file-id label)))]
(restore-file-snapshot! cfg params)))))
(def ^:private sql:get-file
"SELECT f.*,
p.id AS project_id,
p.team_id AS team_id
FROM file AS f
INNER JOIN project AS p ON (p.id = f.project_id)
WHERE f.id = ?")
(defn- get-file
[cfg file-id]
(let [file (->> (db/get cfg :file {:id file-id})
(let [file (->> (db/exec-one! cfg [sql:get-file file-id])
(feat.fdata/resolve-file-data cfg))]
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg file-id)]
(-> file
(update :data blob/decode)
(update :data feat.fdata/process-pointers deref)
(update :data feat.fdata/process-objects (partial into {}))
(update :data assoc ::id file-id)
(update :data blob/encode)))))
(defn take-file-snapshot!
[cfg {:keys [file-id label ::rpc/profile-id]}]
(let [file (get-file cfg file-id)
id (uuid/next)]
(l/debug :hint "creating file snapshot"
:file-id (str file-id)
:label label)
(db/insert! cfg :file-change
{:id id
:revn (:revn file)
:data (:data file)
:version (:version file)
:features (:features file)
:profile-id profile-id
:file-id (:id file)
:label label}
{::db/return-keys false})
{:id id :label label}))
(defn generate-snapshot-label
(defn- generate-snapshot-label
[]
(let [ts (-> (dt/now)
(dt/format-instant)
@@ -200,17 +86,218 @@
(str/rtrim "Z"))]
(str "snapshot-" ts)))
(def ^:private schema:take-file-snapshot
[:map [:file-id ::sm/uuid]])
(defn create-file-snapshot!
[cfg profile-id file-id label]
(let [file (get-file cfg file-id)
(sv/defmethod ::take-file-snapshot
;; NOTE: final user never can provide label as `:system`
;; keyword because the validator implies label always as
;; string; keyword is used for signal a special case
created-by
(if (= label :system)
"system"
"user")
deleted-at
(if (= label :system)
(dt/plus (dt/now) (cf/get-deletion-delay))
nil)
label
(if (= label :system)
(str "internal/snapshot/" (:revn file))
(or label (generate-snapshot-label)))
snapshot-id
(uuid/next)]
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/project-id (:project-id file))
(assoc ::quotes/team-id (:team-id file))
(assoc ::quotes/file-id (:id file))
(quotes/check! {::quotes/id ::quotes/snapshots-per-file}
{::quotes/id ::quotes/snapshots-per-team}))
(l/debug :hint "creating file snapshot"
:file-id (str file-id)
:id (str snapshot-id)
:label label)
(db/insert! cfg :file-change
{:id snapshot-id
:revn (:revn file)
:data (:data file)
:version (:version file)
:features (:features file)
:profile-id profile-id
:file-id (:id file)
:label label
:deleted-at deleted-at
:created-by created-by}
{::db/return-keys false})
{:id snapshot-id :label label}))
(def ^:private schema:create-file-snapshot
[:map
[:file-id ::sm/uuid]
[:label {:optional true} :string]])
(sv/defmethod ::create-file-snapshot
{::doc/added "1.20"
::doc/skip true
::sm/params schema:take-file-snapshot}
[cfg {:keys [::rpc/profile-id] :as params}]
(check-authorized! cfg profile-id)
(db/tx-run! cfg (fn [cfg]
(let [params (update params :label (fn [label]
(or label (generate-snapshot-label))))]
(take-file-snapshot! cfg params)))))
::sm/params schema:create-file-snapshot}
[cfg {:keys [::rpc/profile-id file-id label]}]
(db/tx-run! cfg
(fn [{:keys [::db/conn] :as cfg}]
(files/check-edition-permissions! conn profile-id file-id)
(create-file-snapshot! cfg profile-id file-id label))))
(defn restore-file-snapshot!
[{:keys [::db/conn ::mbus/msgbus] :as cfg} file-id snapshot-id]
(let [storage (sto/resolve cfg {::db/reuse-conn true})
file (files/get-minimal-file conn file-id {::db/for-update true})
vern (rand-int Integer/MAX_VALUE)
snapshot (some->> (db/get* conn :file-change
{:file-id file-id
:id snapshot-id}
{::db/for-share true})
(feat.fdata/resolve-file-data cfg))]
(when-not snapshot
(ex/raise :type :not-found
:code :snapshot-not-found
:hint "unable to find snapshot with the provided label"
:snapshot-id snapshot-id
:file-id file-id))
(when-not (:data snapshot)
(ex/raise :type :validation
:code :snapshot-without-data
:hint "snapshot has no data"
:label (:label snapshot)
:file-id file-id))
(l/dbg :hint "restoring snapshot"
:file-id (str file-id)
:label (:label snapshot)
:snapshot-id (str (:id snapshot)))
;; If the file was already offloaded, on restring the snapshot
;; we are going to replace the file data, so we need to touch
;; the old referenced storage object and avoid possible leaks
(when (feat.fdata/offloaded? file)
(sto/touch-object! storage (:data-ref-id file)))
(db/update! conn :file
{:data (:data snapshot)
:revn (inc (:revn file))
:vern vern
:version (:version snapshot)
:data-backend nil
:data-ref-id nil
:has-media-trimmed false
:features (:features snapshot)}
{:id file-id})
;; clean object thumbnails
(let [sql (str "update file_tagged_object_thumbnail "
" set deleted_at = now() "
" where file_id=? returning media_id")
res (db/exec! conn [sql file-id])]
(doseq [media-id (into #{} (keep :media-id) res)]
(sto/touch-object! storage media-id)))
;; clean file thumbnails
(let [sql (str "update file_thumbnail "
" set deleted_at = now() "
" where file_id=? returning media_id")
res (db/exec! conn [sql file-id])]
(doseq [media-id (into #{} (keep :media-id) res)]
(sto/touch-object! storage media-id)))
;; Send to the clients a notification to reload the file
(mbus/pub! msgbus
:topic (:id file)
:message {:type :file-restore
:file-id (:id file)
:vern vern})
{:id (:id snapshot)
:label (:label snapshot)}))
(def ^:private schema:restore-file-snapshot
[:map {:title "restore-file-snapshot"}
[:file-id ::sm/uuid]
[:id ::sm/uuid]])
(sv/defmethod ::restore-file-snapshot
{::doc/added "1.20"
::sm/params schema:restore-file-snapshot}
[cfg {:keys [::rpc/profile-id file-id id] :as params}]
(db/tx-run! cfg
(fn [{:keys [::db/conn] :as cfg}]
(files/check-edition-permissions! conn profile-id file-id)
(create-file-snapshot! cfg profile-id file-id :system)
(restore-file-snapshot! cfg file-id id))))
(def ^:private schema:update-file-snapshot
[:map {:title "update-file-snapshot"}
[:id ::sm/uuid]
[:label ::sm/text]])
(defn- update-file-snapshot!
[conn snapshot-id label]
(-> (db/update! conn :file-change
{:label label
:created-by "user"
:deleted-at nil}
{:id snapshot-id}
{::db/return-keys true})
(dissoc :data :features)))
(defn- get-snapshot
"Get a minimal snapshot from database and lock for update"
[conn id]
(db/get conn :file-change
{:id id}
{::sql/columns [:id :file-id :created-by :deleted-at]
::db/for-update true}))
(sv/defmethod ::update-file-snapshot
{::doc/added "1.20"
::sm/params schema:update-file-snapshot}
[cfg {:keys [::rpc/profile-id id label]}]
(db/tx-run! cfg
(fn [{:keys [::db/conn]}]
(let [snapshot (get-snapshot conn id)]
(files/check-edition-permissions! conn profile-id (:file-id snapshot))
(update-file-snapshot! conn id label)))))
(def ^:private schema:remove-file-snapshot
[:map {:title "remove-file-snapshot"}
[:id ::sm/uuid]])
(defn- delete-file-snapshot!
[conn snapshot-id]
(db/update! conn :file-change
{:deleted-at (dt/now)}
{:id snapshot-id}
{::db/return-keys false})
nil)
(sv/defmethod ::delete-file-snapshot
{::doc/added "1.20"
::sm/params schema:remove-file-snapshot}
[cfg {:keys [::rpc/profile-id id]}]
(db/tx-run! cfg
(fn [{:keys [::db/conn]}]
(let [snapshot (get-snapshot conn id)]
(files/check-edition-permissions! conn profile-id (:file-id snapshot))
(when (not= (:created-by snapshot) "user")
(ex/raise :type :validation
:code :system-snapshots-cant-be-deleted
:snapshot-id id
:profile-id profile-id))
(delete-file-snapshot! conn id)))))

View File

@@ -50,8 +50,7 @@
" where file_id=? and tag=? and deleted_at is null")
res (db/exec! conn [sql file-id tag])]
(->> res
(d/index-by :object-id (fn [row]
(files/resolve-public-uri (:media-id row))))
(d/index-by :object-id :media-id)
(d/without-nils))))
(defn- get-object-thumbnails
@@ -62,8 +61,7 @@
" where file_id=? and deleted_at is null")
res (db/exec! conn [sql file-id])]
(->> res
(d/index-by :object-id (fn [row]
(files/resolve-public-uri (:media-id row))))
(d/index-by :object-id :media-id)
(d/without-nils))))
([conn file-id object-ids]
@@ -75,8 +73,7 @@
res (db/exec! conn [sql file-id ids])]
(->> res
(d/index-by :object-id (fn [row]
(files/resolve-public-uri (:media-id row))))
(d/index-by :object-id :media-id)
(d/without-nils)))))
(sv/defmethod ::get-file-object-thumbnails
@@ -127,8 +124,11 @@
(if-let [frame (-> frames first)]
(let [frame-id (:id frame)
object-id (thc/fmt-object-id (:id file) page-id frame-id "frame")
frame (if-let [thumb (get thumbnails object-id)]
(assoc frame :thumbnail thumb :shapes [])
frame (if-let [media-id (get thumbnails object-id)]
(-> frame
(assoc :thumbnail-id media-id)
(assoc :shapes []))
(dissoc frame :thumbnail))
children-ids
@@ -402,7 +402,10 @@
[cfg {:keys [::rpc/profile-id file-id] :as params}]
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
(files/check-edition-permissions! conn profile-id file-id)
;; TODO For now we check read permissions instead of write,
;; to allow viewer users to update thumbnails. We might
;; review this approach on the future.
(files/check-read-permissions! conn profile-id file-id)
(when-not (db/read-only? conn)
(let [media (create-file-thumbnail! cfg params)]
{:uri (files/resolve-public-uri (:id media))

View File

@@ -34,7 +34,7 @@
[app.util.pointer-map :as pmap]
[app.util.services :as sv]
[app.util.time :as dt]
[app.worker :as-alias wrk]
[app.worker :as wrk]
[clojure.set :as set]
[promesa.exec :as px]))
@@ -44,7 +44,6 @@
(declare ^:private update-file*)
(declare ^:private process-changes-and-validate)
(declare ^:private take-snapshot?)
(declare ^:private delete-old-snapshots!)
;; PUBLIC API; intended to be used outside of this module
(declare update-file!)
@@ -60,6 +59,7 @@
[:id ::sm/uuid]
[:session-id ::sm/uuid]
[:revn {:min 0} ::sm/int]
[:vern {:min 0} ::sm/int]
[:features {:optional true} ::cfeat/features]
[:changes {:optional true} [:vector ::cpc/change]]
[:changes-with-metadata {:optional true}
@@ -147,7 +147,7 @@
params (-> params
(assoc :profile-id profile-id)
(assoc :features features)
(assoc :features (set/difference features cfeat/frontend-only-features))
(assoc :team team)
(assoc :file file)
(assoc :changes changes))
@@ -157,6 +157,14 @@
tpoint (dt/tpoint)]
(when (not= (:vern params)
(:vern file))
(ex/raise :type :validation
:code :vern-conflict
:hint "A different version has been restored for the file."
:context {:incoming-revn (:revn params)
:stored-revn (:revn file)}))
(when (> (:revn params)
(:revn file))
(ex/raise :type :validation
@@ -215,23 +223,25 @@
(let [storage (sto/resolve cfg ::db/reuse-conn true)]
(some->> (:data-ref-id file) (sto/touch-object! storage))))
;; TODO: move this to asynchronous task
(when (::snapshot-data file)
(delete-old-snapshots! cfg file))
(persist-file! cfg file)
(let [params (assoc params :file file)
response {:revn (:revn file)
:lagged (get-lagged-changes conn params)}
features (db/create-array conn "text" (:features file))]
features (db/create-array conn "text" (:features file))
deleted-at (if (::snapshot-data file)
(dt/plus timestamp (cf/get-deletion-delay))
(dt/plus timestamp (dt/duration {:hours 1})))]
;; Insert change (xlog)
;; Insert change (xlog) with deleted_at in a future data for
;; make them automatically eleggible for GC once they expires
(db/insert! conn :file-change
{:id (uuid/next)
:session-id session-id
:profile-id profile-id
:created-at timestamp
:updated-at timestamp
:deleted-at deleted-at
:file-id (:id file)
:revn (:revn file)
:version (:version file)
@@ -449,33 +459,6 @@
(> (inst-ms (dt/diff modified-at (dt/now)))
(inst-ms timeout))))))
;; Get the latest available snapshots without exceeding the total
;; snapshot limit.
(def ^:private sql:get-latest-snapshots
"SELECT fch.id, fch.created_at
FROM file_change AS fch
WHERE fch.file_id = ?
AND fch.label LIKE 'internal/%'
ORDER BY fch.created_at DESC
LIMIT ?")
;; Mark all snapshots that are outside the allowed total threshold
;; available for the GC.
(def ^:private sql:delete-snapshots
"UPDATE file_change
SET label = NULL
WHERE file_id = ?
AND label LIKE 'internal/%'
AND created_at < ?")
(defn- delete-old-snapshots!
[{:keys [::db/conn] :as cfg} {:keys [id] :as file}]
(when-let [snapshots (not-empty (db/exec! conn [sql:get-latest-snapshots id
(cf/get :auto-file-snapshot-total 10)]))]
(let [last-date (-> snapshots peek :created-at)
result (db/exec-one! conn [sql:delete-snapshots id last-date])]
(l/trc :hint "delete old snapshots" :file-id (str id) :total (db/get-update-count result)))))
(def ^:private sql:lagged-changes
"select s.id, s.revn, s.file_id,
s.session_id, s.changes
@@ -502,6 +485,7 @@
:file-id (:id file)
:session-id (:session-id params)
:revn (:revn file)
:vern (:vern file)
:changes changes})
(when (and (:is-shared file) (seq lchanges))

View File

@@ -67,7 +67,7 @@
:is-owner true
:is-admin true
:can-edit true}
{::db/return-keys? false}))
{::db/return-keys false}))
(doseq [params (sequence (comp
(map #(bfc/remap-id % :file-id))
@@ -176,7 +176,7 @@
(binding [bfc/*state* (volatile! {:index {team-id (uuid/next)}})]
(let [projs (bfc/get-team-projects cfg team-id)
files (bfc/get-team-files cfg team-id)
files (bfc/get-team-files-ids cfg team-id)
frels (bfc/get-files-rels cfg files)
team (-> (db/get-by-id conn :team team-id)
@@ -326,7 +326,7 @@
(def ^:private
schema:move-files
[:map {:title "move-files"}
[:ids ::sm/set-of-uuid]
[:ids [::sm/set {:min 1} ::sm/uuid]]
[:project-id ::sm/uuid]])
(sv/defmethod ::move-files
@@ -335,7 +335,7 @@
::webhooks/event? true
::sm/params schema:move-files}
[cfg {:keys [::rpc/profile-id] :as params}]
(db/tx-run! cfg #(move-files % (assoc params :profile-id profile-id))))
(db/tx-run! cfg move-files (assoc params :profile-id profile-id)))
;; --- COMMAND: Move project
@@ -396,14 +396,15 @@
(defn clone-template
[cfg {:keys [project-id profile-id] :as params} template]
(db/tx-run! cfg (fn [{:keys [::db/conn ::wrk/executor] :as cfg}]
;; NOTE: the importation process performs some operations that
;; are not very friendly with virtual threads, and for avoid
;; unexpected blocking of other concurrent operations we
;; dispatch that operation to a dedicated executor.
;; NOTE: the importation process performs some operations
;; that are not very friendly with virtual threads, and for
;; avoid unexpected blocking of other concurrent operations
;; we dispatch that operation to a dedicated executor.
(let [cfg (-> cfg
(assoc ::bf.v1/project-id project-id)
(assoc ::bf.v1/profile-id profile-id))
result (px/invoke! executor (partial bf.v1/import-files! cfg template))]
(assoc ::bf.v1/profile-id profile-id)
(assoc ::bf.v1/input template))
result (px/invoke! executor (partial bf.v1/import-files! cfg))]
(db/update! conn :project
{:modified-at (dt/now)}

View File

@@ -60,15 +60,25 @@
(media/validate-media-type! content)
(media/validate-media-size! content)
(db/run! cfg (fn [cfg]
(let [object (create-file-media-object cfg params)
props {:name (:name params)
:file-id file-id
:is-local (:is-local params)
:size (:size content)
:mtype (:mtype content)}]
(with-meta object
{::audit/replace-props props})))))
(db/run! cfg (fn [{:keys [::db/conn] :as cfg}]
;; We get the minimal file for proper checking if
;; file is not already deleted
(let [_ (files/get-minimal-file conn file-id)
mobj (create-file-media-object cfg params)]
(db/update! conn :file
{:modified-at (dt/now)
:has-media-trimmed false}
{:id file-id}
{::db/return-keys false})
(with-meta mobj
{::audit/replace-props
{:name (:name params)
:file-id file-id
:is-local (:is-local params)
:size (:size content)
:mtype (:mtype content)}})))))
(defn- big-enough-for-thumbnail?
"Checks if the provided image info is big enough for
@@ -142,20 +152,14 @@
:always
(assoc ::image (process-main-image info)))))
(defn create-file-media-object
[{:keys [::sto/storage ::db/conn ::wrk/executor]}
(defn- create-file-media-object
[{:keys [::sto/storage ::db/conn ::wrk/executor] :as cfg}
{:keys [id file-id is-local name content]}]
(let [result (px/invoke! executor (partial process-image content))
image (sto/put-object! storage (::image result))
thumb (when-let [params (::thumb result)]
(sto/put-object! storage params))]
(db/update! conn :file
{:modified-at (dt/now)
:has-media-trimmed false}
{:id file-id})
(db/exec-one! conn [sql:create-file-media-object
(or id (uuid/next))
file-id is-local name
@@ -182,7 +186,18 @@
::sm/params schema:create-file-media-object-from-url}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id] :as params}]
(files/check-edition-permissions! pool profile-id file-id)
(create-file-media-object-from-url cfg (assoc params :profile-id profile-id)))
;; We get the minimal file for proper checking if file is not
;; already deleted
(let [_ (files/get-minimal-file cfg file-id)
mobj (create-file-media-object-from-url cfg (assoc params :profile-id profile-id))]
(db/update! pool :file
{:modified-at (dt/now)
:has-media-trimmed false}
{:id file-id}
{::db/return-keys false})
mobj))
(defn download-image
[{:keys [::http/client]} uri]
@@ -216,7 +231,7 @@
{:response-type :input-stream :sync? true})
{:keys [size mtype]} (parse-and-validate response)
path (tmp/tempfile :prefix "penpot.media.download.")
written (io/write-to-file! body path :size size)]
written (io/write* path body :size size)]
(when (not= written size)
(ex/raise :type :internal

View File

@@ -422,7 +422,9 @@
:deleted-at deleted-at
:id profile-id}})
(rph/with-transform {} (session/delete-fn cfg)))))
(-> (rph/wrap nil)
(rph/with-transform (session/delete-fn cfg))))))
;; --- HELPERS
@@ -431,8 +433,11 @@
"WITH owner_teams AS (
SELECT tpr.team_id AS id
FROM team_profile_rel AS tpr
JOIN team AS t ON (t.id = tpr.team_id)
WHERE tpr.is_owner IS TRUE
AND tpr.profile_id = ?
AND (t.deleted_at IS NULL OR
t.deleted_at > now())
)
SELECT tpr.team_id AS id,
count(tpr.profile_id) - 1 AS participants

View File

@@ -222,7 +222,7 @@
::webhooks/event? true}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id id team-id is-pinned] :as params}]
(db/with-atomic [conn pool]
(check-edition-permissions! conn profile-id id)
(check-read-permissions! conn profile-id id)
(db/exec-one! conn [sql:update-project-pin team-id id profile-id is-pinned is-pinned])
nil))

View File

@@ -10,8 +10,8 @@
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.features :as cfeat]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.types.team :as tt]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
@@ -20,20 +20,18 @@
[app.loggers.audit :as audit]
[app.main :as-alias main]
[app.media :as media]
[app.msgbus :as mbus]
[app.rpc :as-alias rpc]
[app.rpc.commands.profile :as profile]
[app.rpc.doc :as-alias doc]
[app.rpc.helpers :as rph]
[app.rpc.permissions :as perms]
[app.rpc.quotes :as quotes]
[app.setup :as-alias setup]
[app.storage :as sto]
[app.tokens :as tokens]
[app.util.blob :as blob]
[app.util.services :as sv]
[app.util.time :as dt]
[app.worker :as wrk]
[cuerdas.core :as str]))
[clojure.set :as set]))
;; --- Helpers & Specs
@@ -82,7 +80,9 @@
(cond-> row
(some? features) (assoc :features (db/decode-pgarray features #{}))))
(defn- check-profile-muted
;; FIXME: move
(defn check-profile-muted
"Check if the member's email is part of the global bounce report"
[conn member]
(let [email (profile/clean-email (:email member))]
@@ -92,7 +92,7 @@
:email email
:hint "the profile has reported repeatedly as spam or has bounces"))))
(defn- check-email-bounce
(defn check-email-bounce
"Check if the email is part of the global complain report"
[conn email show?]
(when (eml/has-bounce-reports? conn email)
@@ -101,7 +101,7 @@
:email (if show? email "private")
:hint "this email has been repeatedly reported as bounce")))
(defn- check-email-spam
(defn check-email-spam
"Check if the member email is part of the global complain report"
[conn email show?]
(when (eml/has-complaint-reports? conn email)
@@ -265,6 +265,8 @@
[:fn #(or (contains? % :team-id)
(contains? % :file-id))]])
;; FIXME: split in two separated requests
(sv/defmethod ::get-team-users
"Get team users by team-id or by file-id"
{::doc/added "1.17"
@@ -302,20 +304,29 @@
inner join project as p on (f.project_id = p.id)
where p.team_id = ?")
(def sql:team-by-file
"select p.team_id as id
from project as p
join file as f on (p.id = f.project_id)
where f.id = ?")
(defn get-users
[conn team-id]
(db/exec! conn [sql:team-users team-id team-id team-id]))
(def sql:get-team-by-file
"SELECT t.*
FROM team AS t
JOIN project AS p ON (p.team_id = t.id)
JOIN file AS f ON (f.project_id = p.id)
WHERE f.id = ?")
(defn get-team-for-file
[conn file-id]
(->> [sql:team-by-file file-id]
(db/exec-one! conn)))
(let [team (->> (db/exec! conn [sql:get-team-by-file file-id])
(remove db/is-row-deleted?)
(map decode-row)
(first))]
(when-not team
(ex/raise :type :not-found
:code :object-not-found
:hint "database object not found"))
team))
;; --- Query: Team Stats
@@ -406,6 +417,7 @@
::quotes/profile-id profile-id})
(let [features (-> (cfeat/get-enabled-features cf/flags)
(set/difference cfeat/frontend-only-features)
(cfeat/check-client-features! (:features params)))
params (-> params
(assoc :profile-id profile-id)
@@ -503,8 +515,6 @@
;; --- Mutation: Leave Team
(declare role->params)
(defn leave-team
[conn {:keys [profile-id id reassign-to]}]
(let [perms (get-permissions conn profile-id id)
@@ -534,7 +544,7 @@
;; assign owner role to new profile
(db/update! conn :team-profile-rel
(role->params :owner)
(get tt/permissions-for-role :owner)
{:team-id id :profile-id reassign-to}))
;; and finally, if all other conditions does not match and the
@@ -606,24 +616,8 @@
;; --- Mutation: Team Update Role
;; Temporarily disabled viewer role
;; https://tree.taiga.io/project/penpot/issue/1083
(def valid-roles
#{:owner :admin :editor #_:viewer})
(def schema:role
[::sm/one-of valid-roles])
(defn role->params
[role]
(case role
:admin {:is-owner false :is-admin true :can-edit true}
:editor {:is-owner false :is-admin false :can-edit true}
:owner {:is-owner true :is-admin true :can-edit true}
:viewer {:is-owner false :is-admin false :can-edit false}))
(defn update-team-member-role
[conn {:keys [profile-id team-id member-id role] :as params}]
[{:keys [::db/conn ::mbus/msgbus]} {:keys [profile-id team-id member-id role] :as params}]
;; We retrieve all team members instead of query the
;; database for a single member. This is just for
;; convenience, if this becomes a bottleneck or problematic,
@@ -631,7 +625,6 @@
(let [perms (get-permissions conn profile-id team-id)
members (get-team-members conn team-id)
member (d/seek #(= member-id (:id %)) members)
is-owner? (:is-owner perms)
is-admin? (:is-admin perms)]
@@ -655,7 +648,14 @@
(ex/raise :type :validation
:code :cant-promote-to-owner))
(let [params (role->params role)]
(mbus/pub! msgbus
:topic member-id
:message {:type :team-role-change
:topic member-id
:team-id team-id
:role role})
(let [params (get tt/permissions-for-role role)]
;; Only allow single owner on team
(when (= role :owner)
(db/update! conn :team-profile-rel
@@ -673,14 +673,13 @@
[:map {:title "update-team-member-role"}
[:team-id ::sm/uuid]
[:member-id ::sm/uuid]
[:role schema:role]])
[:role ::tt/role]])
(sv/defmethod ::update-team-member-role
{::doc/added "1.17"
::sm/params schema:update-team-member-role}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id] :as params}]
(db/with-atomic [conn pool]
(update-team-member-role conn (assoc params :profile-id profile-id))))
[cfg {:keys [::rpc/profile-id] :as params}]
(db/tx-run! cfg update-team-member-role (assoc params :profile-id profile-id)))
;; --- Mutation: Delete Team Member
@@ -692,9 +691,10 @@
(sv/defmethod ::delete-team-member
{::doc/added "1.17"
::sm/params schema:delete-team-member}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id member-id] :as params}]
[{:keys [::db/pool ::mbus/msgbus] :as cfg} {:keys [::rpc/profile-id team-id member-id] :as params}]
(db/with-atomic [conn pool]
(let [perms (get-permissions conn profile-id team-id)]
(let [team (get-team pool :profile-id profile-id :team-id team-id)
perms (get-permissions conn profile-id team-id)]
(when-not (or (:is-owner perms)
(:is-admin perms))
(ex/raise :type :validation
@@ -707,6 +707,13 @@
(db/delete! conn :team-profile-rel {:profile-id member-id
:team-id team-id})
(mbus/pub! msgbus
:topic member-id
:message {:type :team-membership-change
:change :removed
:team-id team-id
:team-name (:name team)})
nil)))
;; --- Mutation: Update Team Photo
@@ -724,6 +731,7 @@
::sm/params schema:update-team-photo}
[cfg {:keys [::rpc/profile-id file] :as params}]
;; Validate incoming mime type
(media/validate-media-type! file #{"image/jpeg" "image/png" "image/webp"})
(update-team-photo cfg (assoc params :profile-id profile-id)))
@@ -745,534 +753,3 @@
{:id team-id})
(assoc team :photo-id (:id photo)))))
;; --- Mutation: Create Team Invitation
(def sql:upsert-team-invitation
"insert into team_invitation(id, team_id, email_to, role, valid_until)
values (?, ?, ?, ?, ?)
on conflict(team_id, email_to) do
update set role = ?, valid_until = ?, updated_at = now()
returning *")
(defn- create-invitation-token
[cfg {:keys [profile-id valid-until team-id member-id member-email role]}]
(tokens/generate (::setup/props cfg)
{:iss :team-invitation
:exp valid-until
:profile-id profile-id
:role role
:team-id team-id
:member-email member-email
:member-id member-id}))
(defn- create-profile-identity-token
[cfg profile-id]
(dm/assert!
"expected valid uuid for profile-id"
(uuid? profile-id))
(tokens/generate (::setup/props cfg)
{:iss :profile-identity
:profile-id profile-id
:exp (dt/in-future {:days 30})}))
(def ^:private schema:create-invitation
[:map {:title "params:create-invitation"}
[::rpc/profile-id ::sm/uuid]
[:team
[:map
[:id ::sm/uuid]
[:name :string]]]
[:profile
[:map
[:id ::sm/uuid]
[:fullname :string]]]
[:role [::sm/one-of valid-roles]]
[:email ::sm/email]])
(def ^:private check-create-invitation-params!
(sm/check-fn schema:create-invitation))
(defn- create-invitation
[{:keys [::db/conn] :as cfg} {:keys [team profile role email] :as params}]
(dm/assert!
"expected valid connection on cfg parameter"
(db/connection? conn))
(dm/assert!
"expected valid params for `create-invitation` fn"
(check-create-invitation-params! params))
(let [email (profile/clean-email email)
member (profile/get-profile-by-email conn email)]
(check-profile-muted conn member)
(check-email-bounce conn email true)
(check-email-spam conn email true)
;; When we have email verification disabled and invitation user is
;; already present in the database, we proceed to add it to the
;; team as-is, without email roundtrip.
;; TODO: if member does not exists and email verification is
;; disabled, we should proceed to create the profile (?)
(if (and (not (contains? cf/flags :email-verification))
(some? member))
(let [params (merge {:team-id (:id team)
:profile-id (:id member)}
(role->params role))]
;; Insert the invited member to the team
(db/insert! conn :team-profile-rel params
{::db/on-conflict-do-nothing? true})
;; If profile is not yet verified, mark it as verified because
;; accepting an invitation link serves as verification.
(when-not (:is-active member)
(db/update! conn :profile
{:is-active true}
{:id (:id member)}))
nil)
(let [id (uuid/next)
expire (dt/in-future "168h") ;; 7 days
invitation (db/exec-one! conn [sql:upsert-team-invitation id
(:id team) (str/lower email)
(name role) expire
(name role) expire])
updated? (not= id (:id invitation))
profile-id (:id profile)
tprops {:profile-id profile-id
:invitation-id (:id invitation)
:valid-until expire
:team-id (:id team)
:member-email (:email-to invitation)
:member-id (:id member)
:role role}
itoken (create-invitation-token cfg tprops)
ptoken (create-profile-identity-token cfg profile-id)]
(when (contains? cf/flags :log-invitation-tokens)
(l/info :hint "invitation token" :token itoken))
(let [props (-> (dissoc tprops :profile-id)
(audit/clean-props))
evname (if updated?
"update-team-invitation"
"create-team-invitation")
event (-> (audit/event-from-rpc-params params)
(assoc ::audit/name evname)
(assoc ::audit/props props))]
(audit/submit! cfg event))
(eml/send! {::eml/conn conn
::eml/factory eml/invite-to-team
:public-uri (cf/get :public-uri)
:to email
:invited-by (:fullname profile)
:team (:name team)
:token itoken
:extra-data ptoken})
itoken))))
(defn- add-user-to-team
[conn profile team role email]
(let [team-id (:id team)
member (db/get* conn :profile
{:email (str/lower email)}
{::sql/columns [:id :email]})
params (merge
{:team-id team-id
:profile-id (:id member)}
(role->params role))]
;; Do not allow blocked users to join teams.
(when (:is-blocked member)
(ex/raise :type :restriction
:code :profile-blocked))
(quotes/check!
{::db/conn conn
::quotes/id ::quotes/profiles-per-team
::quotes/profile-id (:id member)
::quotes/team-id team-id})
;; Insert the member to the team
(db/insert! conn :team-profile-rel params {::db/on-conflict-do-nothing? true})
;; Delete any request
(db/delete! conn :team-access-request
{:team-id team-id :requester-id (:id member)})
;; Delete any invitation
(db/delete! conn :team-invitation
{:team-id team-id :email-to (:email member)})
(eml/send! {::eml/conn conn
::eml/factory eml/join-team
:public-uri (cf/get :public-uri)
:to email
:invited-by (:fullname profile)
:team (:name team)
:team-id (:id team)})))
(def sql:valid-requests-email
"SELECT p.email
FROM team_access_request AS tr
JOIN profile AS p ON (tr.requester_id = p.id)
WHERE tr.team_id = ?
AND tr.auto_join_until > now()")
(defn- get-valid-requests-email
[conn team-id]
(db/exec! conn [sql:valid-requests-email team-id]))
(def ^:private xf:map-email
(map :email))
(defn- create-team-invitations
[{:keys [::db/conn] :as cfg} {:keys [profile team role emails] :as params}]
(let [join-requests (into #{} xf:map-email
(get-valid-requests-email conn (:id team)))
team-members (into #{} xf:map-email
(get-team-members conn (:id team)))
invitations (into #{}
(comp
;; We don't re-send inviation to
;; already existing members
(remove team-members)
;; We don't send invitations to
;; join-requested members
(remove join-requests)
(map (fn [email] (assoc params :email email)))
(keep (partial create-invitation cfg)))
emails)]
;; For requested invitations, do not send invitation emails, add
;; the user directly to the team
(->> (filter join-requests emails)
(run! (partial add-user-to-team conn profile team role)))
invitations))
(def ^:private schema:create-team-invitations
[:map {:title "create-team-invitations"}
[:team-id ::sm/uuid]
[:role schema:role]
[:emails [::sm/set ::sm/email]]])
(def ^:private max-invitations-by-request-threshold
"The number of invitations can be sent in a single rpc request"
25)
(sv/defmethod ::create-team-invitations
"A rpc call that allow to send a single or multiple invitations to
join the team."
{::doc/added "1.17"
::sm/params schema:create-team-invitations}
[cfg {:keys [::rpc/profile-id team-id emails] :as params}]
(let [perms (get-permissions cfg profile-id team-id)
profile (db/get-by-id cfg :profile profile-id)
emails (into #{} (map profile/clean-email) emails)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(when (> (count emails) max-invitations-by-request-threshold)
(ex/raise :type :validation
:code :max-invitations-by-request
:hint "the maximum of invitation on single request is reached"
:threshold max-invitations-by-request-threshold))
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/team-id team-id)
(assoc ::quotes/incr (count emails))
(quotes/check! {::quotes/id ::quotes/invitations-per-team}
{::quotes/id ::quotes/profiles-per-team}))
;; Check if the current profile is allowed to send emails
(check-profile-muted cfg profile)
(let [team (db/get-by-id cfg :team team-id)
;; NOTE: Is important pass RPC method params down to the
;; `create-team-invitations` because it uses the implicit
;; RPC properties from params for fill necessary data on
;; emiting an entry to the audit-log
invitations (db/tx-run! cfg create-team-invitations
(-> params
(assoc :profile profile)
(assoc :team team)
(assoc :emails emails)))]
(with-meta {:total (count invitations)
:invitations invitations}
{::audit/props {:invitations (count invitations)}}))))
;; --- Mutation: Create Team & Invite Members
(def ^:private schema:create-team-with-invitations
[:map {:title "create-team-with-invitations"}
[:name [:string {:max 250}]]
[:features {:optional true} ::cfeat/features]
[:id {:optional true} ::sm/uuid]
[:emails [::sm/set ::sm/email]]
[:role schema:role]])
(sv/defmethod ::create-team-with-invitations
{::doc/added "1.17"
::sm/params schema:create-team-with-invitations
::db/transaction true}
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id emails role name] :as params}]
(let [features (-> (cfeat/get-enabled-features cf/flags)
(cfeat/check-client-features! (:features params)))
params (-> params
(assoc :profile-id profile-id)
(assoc :features features))
team (create-team cfg params)
emails (into #{} (map profile/clean-email) emails)]
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/team-id (:id team))
(assoc ::quotes/incr (count emails))
(quotes/check! {::quotes/id ::quotes/teams-per-profile}
{::quotes/id ::quotes/invitations-per-team}
{::quotes/id ::quotes/profiles-per-team}))
(when (> (count emails) max-invitations-by-request-threshold)
(ex/raise :type :validation
:code :max-invitations-by-request
:hint "the maximum of invitation on single request is reached"
:threshold max-invitations-by-request-threshold))
(let [props {:name name :features features}
event (-> (audit/event-from-rpc-params params)
(assoc ::audit/name "create-team")
(assoc ::audit/props props))]
(audit/submit! cfg event))
;; Create invitations for all provided emails.
(let [profile (db/get-by-id conn :profile profile-id)
params (-> params
(assoc :team team)
(assoc :profile profile)
(assoc :role role))
invitations (->> emails
(map (fn [email] (assoc params :email email)))
(map (partial create-invitation cfg)))]
(vary-meta team assoc ::audit/props {:invitations (count invitations)}))))
;; --- Query: get-team-invitation-token
(def ^:private schema:get-team-invitation-token
[:map {:title "get-team-invitation-token"}
[:team-id ::sm/uuid]
[:email ::sm/email]])
(sv/defmethod ::get-team-invitation-token
{::doc/added "1.17"
::sm/params schema:get-team-invitation-token}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email] :as params}]
(check-read-permissions! pool profile-id team-id)
(let [email (profile/clean-email email)
invit (-> (db/get pool :team-invitation
{:team-id team-id
:email-to email})
(update :role keyword))
member (profile/get-profile-by-email pool (:email-to invit))
token (create-invitation-token cfg {:team-id (:team-id invit)
:profile-id profile-id
:valid-until (:valid-until invit)
:role (:role invit)
:member-id (:id member)
:member-email (or (:email member)
(profile/clean-email (:email-to invit)))})]
{:token token}))
;; --- Mutation: Update invitation role
(def ^:private schema:update-team-invitation-role
[:map {:title "update-team-invitation-role"}
[:team-id ::sm/uuid]
[:email ::sm/email]
[:role schema:role]])
(sv/defmethod ::update-team-invitation-role
{::doc/added "1.17"
::sm/params schema:update-team-invitation-role}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email role] :as params}]
(db/with-atomic [conn pool]
(let [perms (get-permissions conn profile-id team-id)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(db/update! conn :team-invitation
{:role (name role) :updated-at (dt/now)}
{:team-id team-id :email-to (profile/clean-email email)})
nil)))
;; --- Mutation: Delete invitation
(def ^:private schema:delete-team-invition
[:map {:title "delete-team-invitation"}
[:team-id ::sm/uuid]
[:email ::sm/email]])
(sv/defmethod ::delete-team-invitation
{::doc/added "1.17"
::sm/params schema:delete-team-invition}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email] :as params}]
(db/with-atomic [conn pool]
(let [perms (get-permissions conn profile-id team-id)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(let [invitation (db/delete! conn :team-invitation
{:team-id team-id
:email-to (profile/clean-email email)}
{::db/return-keys true})]
(rph/wrap nil {::audit/props {:invitation-id (:id invitation)}})))))
;; --- Mutation: Request Team Invitation
(def sql:upsert-team-access-request
"INSERT INTO team_access_request (id, team_id, requester_id, valid_until, auto_join_until)
VALUES (?, ?, ?, ?, ?)
ON conflict(id)
DO UPDATE SET valid_until = ?, auto_join_until = ?, updated_at = now()
RETURNING *")
(def sql:team-access-request
"SELECT id, (valid_until < now()) AS expired
FROM team_access_request
WHERE team_id = ?
AND requester_id = ?")
(def sql:team-owner
"SELECT profile_id
FROM team_profile_rel
WHERE team_id = ?
AND is_owner = true")
(defn- create-team-access-request
[{:keys [::db/conn] :as cfg} {:keys [team requester team-owner file is-viewer] :as params}]
(let [old-request (->> (db/exec-one! conn [sql:team-access-request (:id team) (:id requester)])
(decode-row))]
(when (false? (:expired old-request))
(ex/raise :type :validation
:code :request-already-sent
:hint "you have already made a request to join this team less than 24 hours ago"))
(let [id (or (:id old-request) (uuid/next))
valid_until (dt/in-future "24h")
auto_join_until (dt/in-future "168h") ;; 7 days
request (db/exec-one! conn [sql:upsert-team-access-request
id (:id team) (:id requester) valid_until auto_join_until
valid_until auto_join_until])
factory (cond
(and (some? file) (:is-default team) is-viewer)
eml/request-file-access-yourpenpot-view
(and (some? file) (:is-default team))
eml/request-file-access-yourpenpot
(some? file)
eml/request-file-access
:else
eml/request-team-access)
page-id (when (some? file)
(-> file :data :pages first))]
;; TODO needs audit?
(eml/send! {::eml/conn conn
::eml/factory factory
:public-uri (cf/get :public-uri)
:to (:email team-owner)
:requested-by (:fullname requester)
:requested-by-email (:email requester)
:team-name (:name team)
:team-id (:id team)
:file-name (:name file)
:file-id (:id file)
:page-id page-id})
request)))
(def ^:private schema:create-team-access-request
[:and
[:map {:title "create-team-access-request"}
[:file-id {:optional true} ::sm/uuid]
[:team-id {:optional true} ::sm/uuid]
[:is-viewer {:optional true} ::sm/boolean]]
[:fn (fn [params]
(or (contains? params :file-id)
(contains? params :team-id)))]])
(sv/defmethod ::create-team-access-request
"A rpc call that allow to request for an invitations to join the team."
{::doc/added "2.2.0"
::sm/params schema:create-team-access-request}
[cfg {:keys [::rpc/profile-id file-id team-id is-viewer] :as params}]
(db/tx-run! cfg
(fn [{:keys [::db/conn] :as cfg}]
(let [requester (db/get-by-id conn :profile profile-id)
team-id (if (some? team-id)
team-id
(:id (get-team-for-file conn file-id)))
team (db/get-by-id conn :team team-id)
owner-id (->> (db/exec! conn [sql:team-owner (:id team)])
(map decode-row)
(first)
:profile-id)
team-owner (db/get-by-id conn :profile owner-id)
file (when (some? file-id)
(db/get* conn :file
{:id file-id}
{::sql/columns [:id :name :data]}))
file (when (some? file)
(assoc file :data (blob/decode (:data file))))]
;;TODO needs quotes?
(when (or (nil? requester) (nil? team) (nil? team-owner) (and (some? file-id) (nil? file)))
(ex/raise :type :validation
:code :invalid-parameters))
;; Check that the requester is not muted
(check-profile-muted conn requester)
;; Check that the owner is not marked as bounce nor spam
(check-email-bounce conn (:email team-owner) false)
(check-email-spam conn (:email team-owner) true)
(let [request (create-team-access-request
cfg {:team team :requester requester :team-owner team-owner :file file :is-viewer is-viewer})]
(when request
(with-meta {:request request}
{::audit/props {:request 1}})))))))

View File

@@ -0,0 +1,576 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.rpc.commands.teams-invitations
(:require
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.features :as cfeat]
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.types.team :as types.team]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
[app.db.sql :as sql]
[app.email :as eml]
[app.loggers.audit :as audit]
[app.main :as-alias main]
[app.rpc :as-alias rpc]
[app.rpc.commands.files :as files]
[app.rpc.commands.profile :as profile]
[app.rpc.commands.teams :as teams]
[app.rpc.doc :as-alias doc]
[app.rpc.helpers :as rph]
[app.rpc.quotes :as quotes]
[app.setup :as-alias setup]
[app.tokens :as tokens]
[app.util.services :as sv]
[app.util.time :as dt]
[cuerdas.core :as str]))
;; --- Mutation: Create Team Invitation
(def sql:upsert-team-invitation
"insert into team_invitation(id, team_id, email_to, created_by, role, valid_until)
values (?, ?, ?, ?, ?, ?)
on conflict(team_id, email_to) do
update set role = ?, valid_until = ?, updated_at = now()
returning *")
(defn- create-invitation-token
[cfg {:keys [profile-id valid-until team-id member-id member-email role]}]
(tokens/generate (::setup/props cfg)
{:iss :team-invitation
:exp valid-until
:profile-id profile-id
:role role
:team-id team-id
:member-email member-email
:member-id member-id}))
(defn- create-profile-identity-token
[cfg profile-id]
(dm/assert!
"expected valid uuid for profile-id"
(uuid? profile-id))
(tokens/generate (::setup/props cfg)
{:iss :profile-identity
:profile-id profile-id
:exp (dt/in-future {:days 30})}))
(def ^:private schema:create-invitation
[:map {:title "params:create-invitation"}
[::rpc/profile-id ::sm/uuid]
[:team
[:map
[:id ::sm/uuid]
[:name :string]]]
[:profile
[:map
[:id ::sm/uuid]
[:fullname :string]]]
[:role ::types.team/role]
[:email ::sm/email]])
(def ^:private check-create-invitation-params!
(sm/check-fn schema:create-invitation))
(defn- create-invitation
[{:keys [::db/conn] :as cfg} {:keys [team profile role email] :as params}]
(dm/assert!
"expected valid connection on cfg parameter"
(db/connection? conn))
(dm/assert!
"expected valid params for `create-invitation` fn"
(check-create-invitation-params! params))
(let [email (profile/clean-email email)
member (profile/get-profile-by-email conn email)]
(teams/check-profile-muted conn member)
(teams/check-email-bounce conn email true)
(teams/check-email-spam conn email true)
;; When we have email verification disabled and invitation user is
;; already present in the database, we proceed to add it to the
;; team as-is, without email roundtrip.
;; TODO: if member does not exists and email verification is
;; disabled, we should proceed to create the profile (?)
(if (and (not (contains? cf/flags :email-verification))
(some? member))
(let [params (merge {:team-id (:id team)
:profile-id (:id member)}
(get types.team/permissions-for-role role))]
;; Insert the invited member to the team
(db/insert! conn :team-profile-rel params
{::db/on-conflict-do-nothing? true})
;; If profile is not yet verified, mark it as verified because
;; accepting an invitation link serves as verification.
(when-not (:is-active member)
(db/update! conn :profile
{:is-active true}
{:id (:id member)}))
nil)
(let [id (uuid/next)
expire (dt/in-future "168h") ;; 7 days
invitation (db/exec-one! conn [sql:upsert-team-invitation id
(:id team) (str/lower email)
(:id profile)
(name role) expire
(name role) expire])
updated? (not= id (:id invitation))
profile-id (:id profile)
tprops {:profile-id profile-id
:invitation-id (:id invitation)
:valid-until expire
:team-id (:id team)
:member-email (:email-to invitation)
:member-id (:id member)
:role role}
itoken (create-invitation-token cfg tprops)
ptoken (create-profile-identity-token cfg profile-id)]
(when (contains? cf/flags :log-invitation-tokens)
(l/info :hint "invitation token" :token itoken))
(let [props (-> (dissoc tprops :profile-id)
(audit/clean-props))
evname (if updated?
"update-team-invitation"
"create-team-invitation")
event (-> (audit/event-from-rpc-params params)
(assoc ::audit/name evname)
(assoc ::audit/props props))]
(audit/submit! cfg event))
(eml/send! {::eml/conn conn
::eml/factory eml/invite-to-team
:public-uri (cf/get :public-uri)
:to email
:invited-by (:fullname profile)
:team (:name team)
:token itoken
:extra-data ptoken})
itoken))))
(defn- add-user-to-team
[conn profile team role email]
(let [team-id (:id team)
member (db/get* conn :profile
{:email (str/lower email)}
{::sql/columns [:id :email]})
params (merge
{:team-id team-id
:profile-id (:id member)}
(get types.team/permissions-for-role role))]
;; Do not allow blocked users to join teams.
(when (:is-blocked member)
(ex/raise :type :restriction
:code :profile-blocked))
(quotes/check!
{::db/conn conn
::quotes/id ::quotes/profiles-per-team
::quotes/profile-id (:id member)
::quotes/team-id team-id})
;; Insert the member to the team
(db/insert! conn :team-profile-rel params {::db/on-conflict-do-nothing? true})
;; Delete any request
(db/delete! conn :team-access-request
{:team-id team-id :requester-id (:id member)})
;; Delete any invitation
(db/delete! conn :team-invitation
{:team-id team-id :email-to (:email member)})
(eml/send! {::eml/conn conn
::eml/factory eml/join-team
:public-uri (cf/get :public-uri)
:to email
:invited-by (:fullname profile)
:team (:name team)
:team-id (:id team)})))
(def sql:valid-requests-email
"SELECT p.email
FROM team_access_request AS tr
JOIN profile AS p ON (tr.requester_id = p.id)
WHERE tr.team_id = ?
AND tr.auto_join_until > now()")
(defn- get-valid-requests-email
[conn team-id]
(db/exec! conn [sql:valid-requests-email team-id]))
(def ^:private xf:map-email
(map :email))
(defn- create-team-invitations
[{:keys [::db/conn] :as cfg} {:keys [profile team role emails] :as params}]
(let [join-requests (into #{} xf:map-email
(get-valid-requests-email conn (:id team)))
team-members (into #{} xf:map-email
(teams/get-team-members conn (:id team)))
invitations (into #{}
(comp
;; We don't re-send inviation to
;; already existing members
(remove team-members)
;; We don't send invitations to
;; join-requested members
(remove join-requests)
(map (fn [email] (assoc params :email email)))
(keep (partial create-invitation cfg)))
emails)]
;; For requested invitations, do not send invitation emails, add
;; the user directly to the team
(->> (filter join-requests emails)
(run! (partial add-user-to-team conn profile team role)))
invitations))
(def ^:private schema:create-team-invitations
[:map {:title "create-team-invitations"}
[:team-id ::sm/uuid]
[:role ::types.team/role]
[:emails [::sm/set ::sm/email]]])
(def ^:private max-invitations-by-request-threshold
"The number of invitations can be sent in a single rpc request"
25)
(sv/defmethod ::create-team-invitations
"A rpc call that allow to send a single or multiple invitations to
join the team."
{::doc/added "1.17"
::doc/module :teams
::sm/params schema:create-team-invitations}
[cfg {:keys [::rpc/profile-id team-id emails] :as params}]
(let [perms (teams/get-permissions cfg profile-id team-id)
profile (db/get-by-id cfg :profile profile-id)
emails (into #{} (map profile/clean-email) emails)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(when (> (count emails) max-invitations-by-request-threshold)
(ex/raise :type :validation
:code :max-invitations-by-request
:hint "the maximum of invitation on single request is reached"
:threshold max-invitations-by-request-threshold))
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/team-id team-id)
(assoc ::quotes/incr (count emails))
(quotes/check! {::quotes/id ::quotes/invitations-per-team}
{::quotes/id ::quotes/profiles-per-team}))
;; Check if the current profile is allowed to send emails
(teams/check-profile-muted cfg profile)
(let [team (db/get-by-id cfg :team team-id)
;; NOTE: Is important pass RPC method params down to the
;; `create-team-invitations` because it uses the implicit
;; RPC properties from params for fill necessary data on
;; emiting an entry to the audit-log
invitations (db/tx-run! cfg create-team-invitations
(-> params
(assoc :profile profile)
(assoc :team team)
(assoc :emails emails)))]
(with-meta {:total (count invitations)
:invitations invitations}
{::audit/props {:invitations (count invitations)}}))))
;; --- Mutation: Create Team & Invite Members
(def ^:private schema:create-team-with-invitations
[:map {:title "create-team-with-invitations"}
[:name [:string {:max 250}]]
[:features {:optional true} ::cfeat/features]
[:id {:optional true} ::sm/uuid]
[:emails [::sm/set ::sm/email]]
[:role ::types.team/role]])
(sv/defmethod ::create-team-with-invitations
{::doc/added "1.17"
::doc/module :teams
::sm/params schema:create-team-with-invitations
::db/transaction true}
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id emails role name] :as params}]
(let [features (-> (cfeat/get-enabled-features cf/flags)
(cfeat/check-client-features! (:features params)))
params (-> params
(assoc :profile-id profile-id)
(assoc :features features))
team (teams/create-team cfg params)
emails (into #{} (map profile/clean-email) emails)]
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/team-id (:id team))
(assoc ::quotes/incr (count emails))
(quotes/check! {::quotes/id ::quotes/teams-per-profile}
{::quotes/id ::quotes/invitations-per-team}
{::quotes/id ::quotes/profiles-per-team}))
(when (> (count emails) max-invitations-by-request-threshold)
(ex/raise :type :validation
:code :max-invitations-by-request
:hint "the maximum of invitation on single request is reached"
:threshold max-invitations-by-request-threshold))
(let [props {:name name :features features}
event (-> (audit/event-from-rpc-params params)
(assoc ::audit/name "create-team")
(assoc ::audit/props props))]
(audit/submit! cfg event))
;; Create invitations for all provided emails.
(let [profile (db/get-by-id conn :profile profile-id)
params (-> params
(assoc :team team)
(assoc :profile profile)
(assoc :role role))
invitations (->> emails
(map (fn [email] (assoc params :email email)))
(map (partial create-invitation cfg)))]
(vary-meta team assoc ::audit/props {:invitations (count invitations)}))))
;; --- Query: get-team-invitation-token
(def ^:private schema:get-team-invitation-token
[:map {:title "get-team-invitation-token"}
[:team-id ::sm/uuid]
[:email ::sm/email]])
(sv/defmethod ::get-team-invitation-token
{::doc/added "1.17"
::doc/module :teams
::sm/params schema:get-team-invitation-token}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email] :as params}]
(teams/check-read-permissions! pool profile-id team-id)
(let [email (profile/clean-email email)
invit (-> (db/get pool :team-invitation
{:team-id team-id
:email-to email})
(update :role keyword))
member (profile/get-profile-by-email pool (:email-to invit))
token (create-invitation-token cfg {:team-id (:team-id invit)
:profile-id profile-id
:valid-until (:valid-until invit)
:role (:role invit)
:member-id (:id member)
:member-email (or (:email member)
(profile/clean-email (:email-to invit)))})]
{:token token}))
;; --- Mutation: Update invitation role
(def ^:private schema:update-team-invitation-role
[:map {:title "update-team-invitation-role"}
[:team-id ::sm/uuid]
[:email ::sm/email]
[:role ::types.team/role]])
(sv/defmethod ::update-team-invitation-role
{::doc/added "1.17"
::doc/module :teams
::sm/params schema:update-team-invitation-role}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email role] :as params}]
(db/with-atomic [conn pool]
(let [perms (teams/get-permissions conn profile-id team-id)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(db/update! conn :team-invitation
{:role (name role) :updated-at (dt/now)}
{:team-id team-id :email-to (profile/clean-email email)})
nil)))
;; --- Mutation: Delete invitation
(def ^:private schema:delete-team-invition
[:map {:title "delete-team-invitation"}
[:team-id ::sm/uuid]
[:email ::sm/email]])
(sv/defmethod ::delete-team-invitation
{::doc/added "1.17"
::sm/params schema:delete-team-invition}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id email] :as params}]
(db/with-atomic [conn pool]
(let [perms (teams/get-permissions conn profile-id team-id)]
(when-not (:is-admin perms)
(ex/raise :type :validation
:code :insufficient-permissions))
(let [invitation (db/delete! conn :team-invitation
{:team-id team-id
:email-to (profile/clean-email email)}
{::db/return-keys true})]
(rph/wrap nil {::audit/props {:invitation-id (:id invitation)}})))))
;; --- Mutation: Request Team Invitation
(def ^:private sql:get-team-owner
"SELECT p.*
FROM profile AS p
JOIN team_profile_rel AS tpr ON (tpr.profile_id = p.id)
WHERE tpr.team_id = ?
AND tpr.is_owner IS TRUE")
(defn- get-team-owner
"Return a complete profile of the team owner"
[conn team-id]
(->> (db/exec! conn [sql:get-team-owner team-id])
(remove db/is-row-deleted?)
(map profile/decode-row)
(first)))
(defn- check-existing-team-access-request
"Checks if an existing team access request is still valid"
[conn team-id profile-id]
(when-let [request (db/get* conn :team-access-request
{:team-id team-id
:requester-id profile-id})]
(when (dt/is-after? (:valid-until request) (dt/now))
(ex/raise :type :validation
:code :request-already-sent
:hint "you have already made a request to join this team less than 24 hours ago"))))
(def ^:private sql:upsert-team-access-request
"INSERT INTO team_access_request (id, team_id, requester_id, valid_until, auto_join_until)
VALUES (?, ?, ?, ?, ?)
ON CONFLICT (team_id, requester_id)
DO UPDATE SET valid_until = ?, auto_join_until = ?, updated_at = now()
RETURNING *")
(defn- upsert-team-access-request
"Create or update team access request for provided team and profile-id"
[conn team-id requester-id]
(check-existing-team-access-request conn team-id requester-id)
(let [valid-until (dt/in-future {:hours 24})
auto-join-until (dt/in-future {:days 7})
request-id (uuid/next)]
(db/exec-one! conn [sql:upsert-team-access-request
request-id team-id requester-id
valid-until auto-join-until
valid-until auto-join-until])))
(defn- get-file-for-team-access-request
"A specific method for obtain a file with name and page-id used for
team request access procediment"
[cfg file-id]
(let [file (files/get-file cfg file-id :migrate? false)]
(-> file
(dissoc :data)
(dissoc :deleted-at)
(assoc :page-id (-> file :data :pages first)))))
(def ^:private schema:create-team-access-request
[:and
[:map {:title "create-team-access-request"}
[:file-id {:optional true} ::sm/uuid]
[:team-id {:optional true} ::sm/uuid]
[:is-viewer {:optional true} ::sm/boolean]]
[:fn (fn [params]
(or (contains? params :file-id)
(contains? params :team-id)))]])
(sv/defmethod ::create-team-access-request
"A rpc call that allow to request for an invitations to join the team."
{::doc/added "2.2.0"
::doc/module :teams
::sm/params schema:create-team-access-request
::db/transaction true}
[{:keys [::db/conn] :as cfg}
{:keys [::rpc/profile-id file-id team-id is-viewer] :as params}]
(let [requester (profile/get-profile conn profile-id)
team (if team-id
(->> (db/get-by-id conn :team team-id)
(teams/decode-row))
(teams/get-team-for-file conn file-id))
team-id (:id team)
team-owner (get-team-owner conn team-id)
file (when (some? file-id)
(get-file-for-team-access-request cfg file-id))]
(-> cfg
(assoc ::quotes/profile-id profile-id)
(assoc ::quotes/team-id team-id)
(quotes/check! {::quotes/id ::quotes/team-access-requests-per-team}
{::quotes/id ::quotes/team-access-requests-per-requester}))
(teams/check-profile-muted conn requester)
(teams/check-email-bounce conn (:email team-owner) false)
(teams/check-email-spam conn (:email team-owner) true)
(let [request (upsert-team-access-request conn team-id profile-id)
factory (cond
(and (some? file) (:is-default team) is-viewer)
eml/request-file-access-yourpenpot-view
(and (some? file) (:is-default team))
eml/request-file-access-yourpenpot
(some? file)
eml/request-file-access
:else
eml/request-team-access)]
(eml/send! {::eml/conn conn
::eml/factory factory
:public-uri (cf/get :public-uri)
:to (:email team-owner)
:requested-by (:fullname requester)
:requested-by-email (:email requester)
:team-name (:name team)
:team-id team-id
:file-name (:name file)
:file-id file-id
:page-id (:page-id file)})
(with-meta {:request request}
{::audit/props {:request 1}}))))

View File

@@ -8,6 +8,7 @@
(:require
[app.common.exceptions :as ex]
[app.common.schema :as sm]
[app.common.types.team :as types.team]
[app.config :as cf]
[app.db :as db]
[app.db.sql :as-alias sql]
@@ -16,7 +17,6 @@
[app.main :as-alias main]
[app.rpc :as-alias rpc]
[app.rpc.commands.profile :as profile]
[app.rpc.commands.teams :as teams]
[app.rpc.doc :as-alias doc]
[app.rpc.helpers :as rph]
[app.rpc.quotes :as quotes]
@@ -92,7 +92,7 @@
params (merge
{:team-id team-id
:profile-id (:id member)}
(teams/role->params role))]
(get types.team/permissions-for-role role))]
;; Do not allow blocked users accept invitations.
(when (:is-blocked member)
@@ -128,7 +128,7 @@
[:iss :keyword]
[:exp ::dt/instant]
[:profile-id ::sm/uuid]
[:role teams/schema:role]
[:role ::types.team/role]
[:team-id ::sm/uuid]
[:member-email ::sm/email]
[:member-id {:optional true} ::sm/uuid]])
@@ -166,13 +166,28 @@
;; invited team.
(let [props {:team-id (:team-id claims)
:role (:role claims)
:invitation-id (:id invitation)}
event (-> (audit/event-from-rpc-params params)
(assoc ::audit/name "accept-team-invitation")
(assoc ::audit/props props))]
:invitation-id (:id invitation)}]
(audit/submit!
cfg
(-> (audit/event-from-rpc-params params)
(assoc ::audit/name "accept-team-invitation")
(assoc ::audit/props props)))
;; NOTE: Backward compatibility; old invitations can
;; have the `created-by` to be nil; so in this case we
;; don't submit this event to the audit-log
(when-let [created-by (:created-by invitation)]
(audit/submit!
cfg
(-> (audit/event-from-rpc-params params)
(assoc ::audit/profile-id created-by)
(assoc ::audit/name "accept-team-invitation-from")
(assoc ::audit/props (assoc props
:profile-id (:id profile)
:email (:email profile))))))
(accept-invitation cfg claims invitation profile)
(audit/submit! cfg event)
(assoc claims :state :created))
(ex/raise :type :validation

View File

@@ -15,12 +15,27 @@
[app.http.client :as http]
[app.loggers.webhooks :as webhooks]
[app.rpc :as-alias rpc]
[app.rpc.commands.teams :refer [check-edition-permissions! check-read-permissions!]]
[app.rpc.commands.teams :refer [check-read-permissions!] :as t]
[app.rpc.doc :as-alias doc]
[app.rpc.permissions :as perms]
[app.util.services :as sv]
[app.util.time :as dt]
[cuerdas.core :as str]))
(defn get-webhooks-permissions
[conn profile-id team-id creator-id]
(let [permissions (t/get-permissions conn profile-id team-id)
can-edit (boolean (or (:can-edit permissions)
(= profile-id creator-id)))]
(assoc permissions :can-edit can-edit)))
(def has-webhook-edit-permissions?
(perms/make-edition-predicate-fn get-webhooks-permissions))
(def check-webhook-edition-permissions!
(perms/make-check-fn has-webhook-edit-permissions?))
(defn decode-row
[{:keys [uri] :as row}]
(cond-> row
@@ -65,11 +80,12 @@
max-hooks-for-team)))))
(defn- insert-webhook!
[{:keys [::db/pool]} {:keys [team-id uri mtype is-active] :as params}]
[{:keys [::db/pool]} {:keys [team-id uri mtype is-active ::rpc/profile-id] :as params}]
(-> (db/insert! pool :webhook
{:id (uuid/next)
:team-id team-id
:uri (str uri)
:profile-id profile-id
:is-active is-active
:mtype mtype})
(decode-row)))
@@ -101,7 +117,7 @@
{::doc/added "1.17"
::sm/params schema:create-webhook}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id team-id] :as params}]
(check-edition-permissions! pool profile-id team-id)
(check-webhook-edition-permissions! pool profile-id team-id profile-id)
(validate-quotes! cfg params)
(validate-webhook! cfg nil params)
(insert-webhook! cfg params))
@@ -118,7 +134,7 @@
::sm/params schema:update-webhook}
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id id] :as params}]
(let [whook (-> (db/get pool :webhook {:id id}) (decode-row))]
(check-edition-permissions! pool profile-id (:team-id whook))
(check-webhook-edition-permissions! pool profile-id (:team-id whook) (:profile-id whook))
(validate-webhook! cfg whook params)
(update-webhook! cfg whook params)))
@@ -132,15 +148,17 @@
[{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id id]}]
(db/with-atomic [conn pool]
(let [whook (-> (db/get conn :webhook {:id id}) decode-row)]
(check-edition-permissions! conn profile-id (:team-id whook))
(check-webhook-edition-permissions! conn profile-id (:team-id whook) (:profile-id whook))
(db/delete! conn :webhook {:id id})
nil)))
;; --- Query: Webhooks
(def sql:get-webhooks
"select id, uri, mtype, is_active, error_code, error_count
from webhook where team_id = ? order by uri")
"SELECT id, uri, mtype, is_active, error_code, error_count, profile_id
FROM webhook
WHERE team_id = ?
ORDER BY uri")
(def ^:private schema:get-webhooks
[:map {:title "get-webhooks"}

View File

@@ -29,7 +29,7 @@
[app.util.services :as-alias sv]
[buddy.core.codecs :as bc]
[buddy.core.hash :as bh]
[ring.response :as-alias rres]))
[yetti.response :as-alias yres]))
(def
^{:dynamic true
@@ -48,20 +48,25 @@
(str "W/\"" (encode s) "\""))
(defn wrap
[_ f {:keys [::get-object ::key-fn ::reuse-key?] :as mdata}]
[_ f {:keys [::get-object ::key-fn ::reuse-key?] :or {reuse-key? true} :as mdata}]
(if (and (ifn? get-object) (ifn? key-fn))
(do
(l/trc :hint "instrumenting method" :service (::sv/name mdata))
(fn [cfg {:keys [::key] :as params}]
(if *enabled*
(let [key' (when (or key reuse-key?)
(some->> (get-object cfg params) (key-fn params) (fmt-key)))]
(let [object (when (some? key)
(get-object cfg params))
key' (when (some? object)
(->> object (key-fn params) (fmt-key)))]
(if (and (some? key) (= key key'))
(fn [_] {::rres/status 304})
(let [result (f cfg params)
(fn [_] {::yres/status 304})
(let [params (if (some? object)
(assoc params ::object object)
params)
result (f cfg params)
etag (or (and reuse-key? key')
(some-> result meta ::key fmt-key)
(some-> result key-fn fmt-key))]
(some->> result meta ::key fmt-key)
(some->> result (key-fn params) fmt-key))]
(rph/with-header result "etag" etag))))
(f cfg params))))
f))

View File

@@ -27,7 +27,7 @@
[cuerdas.core :as str]
[integrant.core :as ig]
[pretty-spec.core :as ps]
[ring.response :as-alias rres]))
[yetti.response :as-alias yres]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DOC (human readable)
@@ -87,11 +87,12 @@
(let [params (:query-params request)
pstyle (:type params "js")
context (assoc context :param-style pstyle)]
{::rres/status 200
::rres/body (-> (io/resource "app/templates/api-doc.tmpl")
{::yres/status 200
::yres/body (-> (io/resource "app/templates/api-doc.tmpl")
(tmpl/render context))}))
(fn [_]
{::rres/status 404})))
{::yres/status 404})))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; OPENAPI / SWAGGER (v3.1)
@@ -175,12 +176,12 @@
[context]
(if (contains? cf/flags :backend-openapi-doc)
(fn [_]
{::rres/status 200
::rres/headers {"content-type" "application/json; charset=utf-8"}
::rres/body (json/encode context)})
{::yres/status 200
::yres/headers {"content-type" "application/json; charset=utf-8"}
::yres/body (json/encode context)})
(fn [_]
{::rres/status 404})))
{::yres/status 404})))
(defn openapi-handler
[]
@@ -191,24 +192,23 @@
context {:public-uri (cf/get :public-uri)
:swagger-js swagger-js
:swagger-css swagger-cs}]
{::rres/status 200
::rres/headers {"content-type" "text/html"}
::rres/body (-> (io/resource "app/templates/openapi.tmpl")
{::yres/status 200
::yres/headers {"content-type" "text/html"}
::yres/body (-> (io/resource "app/templates/openapi.tmpl")
(tmpl/render context))}))
(fn [_]
{::rres/status 404})))
{::yres/status 404})))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MODULE INIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::routes vector?)
(defmethod ig/pre-init-spec ::routes [_]
(s/keys :req-un [::rpc/methods]))
(defmethod ig/assert-key ::routes
[_ params]
(assert (sm/valid? ::rpc/methods (::rpc/methods params)) "expected valid methods"))
(defmethod ig/init-key ::routes
[_ {:keys [methods] :as cfg}]
[_ {:keys [::rpc/methods] :as cfg}]
[(let [context (prepare-doc-context methods)]
[["/_doc"
{:handler (doc-handler context)

View File

@@ -11,7 +11,7 @@
[app.common.data.macros :as dm]
[app.http :as-alias http]
[app.rpc :as-alias rpc]
[ring.response :as-alias rres]))
[yetti.response :as-alias yres]))
;; A utilty wrapper object for wrap service responses that does not
;; implements the IObj interface that make possible attach metadata to
@@ -77,4 +77,4 @@
(fn [_ response]
(let [exp (if (integer? max-age) max-age (inst-ms max-age))
val (dm/fmt "max-age=%" (int (/ exp 1000.0)))]
(update response ::rres/headers assoc "cache-control" val)))))
(update response ::yres/headers assoc "cache-control" val)))))

View File

@@ -8,25 +8,24 @@
"A permission checking helper factories."
(:require
[app.common.exceptions :as ex]
[app.common.schema :as sm]
[app.common.spec :as us]
[clojure.spec.alpha :as s]))
[app.common.schema :as sm]))
(sm/register! ::permissions
[:map {:title "Permissions"}
[:type {:gen/elements [:membership :share-link]} :keyword]
[:is-owner ::sm/boolean]
[:is-admin ::sm/boolean]
[:can-edit ::sm/boolean]
[:can-read ::sm/boolean]
[:is-logged ::sm/boolean]])
(sm/register!
^{::sm/type ::permissions}
[:map {:title "Permissions"}
[:type {:gen/elements [:membership :share-link]} :keyword]
[:is-owner ::sm/boolean]
[:is-admin ::sm/boolean]
[:can-edit ::sm/boolean]
[:can-read ::sm/boolean]
[:is-logged ::sm/boolean]])
(s/def ::role #{:admin :owner :editor :viewer})
(def valid-roles
#{:admin :owner :editor :viewer})
(defn assign-role-flags
[params role]
(us/verify ::role role)
(assert (contains? valid-roles role) "expected a valid role")
(cond-> params
(= role :owner)
(assoc :is-owner true
@@ -51,7 +50,7 @@
(defn make-admin-predicate-fn
"A simple factory for admin permission predicate functions."
[qfn]
(us/assert fn? qfn)
(assert (fn? qfn) "expected a function")
(fn check
([perms] (:is-admin perms))
([conn & args] (check (apply qfn conn args)))))
@@ -59,7 +58,7 @@
(defn make-edition-predicate-fn
"A simple factory for edition permission predicate functions."
[qfn]
(us/assert fn? qfn)
(assert (fn? qfn) "expected a function")
(fn check
([perms] (:can-edit perms))
([conn & args] (check (apply qfn conn args)))))
@@ -67,7 +66,7 @@
(defn make-read-predicate-fn
"A simple factory for read permission predicate functions."
[qfn]
(us/assert fn? qfn)
(assert (fn? qfn) "expected a function")
(fn check
([perms] (:can-read perms))
([conn & args] (check (apply qfn conn args)))))
@@ -75,7 +74,7 @@
(defn make-comment-predicate-fn
"A simple factory for comment permission predicate functions."
[qfn]
(us/assert fn? qfn)
(assert (fn? qfn) "expected a function")
(fn check
([perms]
(and (:is-logged perms) (= (:who-comment perms) "all")))

View File

@@ -408,6 +408,121 @@
(assoc ::count-sql [sql:get-comments-per-file file-id])
(generic-check!)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; QUOTE: SNAPSHOTS-PER-FILE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:private schema:snapshots-per-file
[:map
[::profile-id ::sm/uuid]
[::project-id ::sm/uuid]
[::team-id ::sm/uuid]
[::file-id ::sm/uuid]])
(def ^:private valid-snapshots-per-file-quote?
(sm/lazy-validator schema:snapshots-per-file))
(def ^:private sql:get-snapshots-per-file
"SELECT count(*) AS total
FROM file_change AS fc
WHERE fc.file_id = ?
AND fc.created_by = 'user'
AND fc.deleted_at IS NULL
AND fc.data IS NOT NULL")
(defmethod check-quote ::snapshots-per-file
[{:keys [::profile-id ::file-id ::team-id ::project-id ::target] :as quote}]
(assert (valid-snapshots-per-file-quote? quote) "invalid quote parameters")
(-> quote
(assoc ::default (cf/get :quotes-snapshots-per-file Integer/MAX_VALUE))
(assoc ::quote-sql [sql:get-quotes-4 target file-id profile-id project-id
profile-id team-id profile-id profile-id])
(assoc ::count-sql [sql:get-snapshots-per-file file-id])
(generic-check!)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; QUOTE: SNAPSHOTS-PER-TEAM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:private schema:snapshots-per-team
[:map
[::profile-id ::sm/uuid]
[::team-id ::sm/uuid]])
(def ^:private valid-snapshots-per-team-quote?
(sm/lazy-validator schema:snapshots-per-team))
(def ^:private sql:get-snapshots-per-team
"SELECT count(*) AS total
FROM file_change AS fc
JOIN file AS f ON (f.id = fc.file_id)
JOIN project AS p ON (p.id = f.project_id)
WHERE p.team_id = ?
AND fc.created_by = 'user'
AND fc.deleted_at IS NULL
AND fc.data IS NOT NULL")
(defmethod check-quote ::snapshots-per-team
[{:keys [::profile-id ::team-id ::target] :as quote}]
(assert (valid-snapshots-per-team-quote? quote) "invalid quote parameters")
(-> quote
(assoc ::default (cf/get :quotes-snapshots-per-team Integer/MAX_VALUE))
(assoc ::quote-sql [sql:get-quotes-2 target team-id profile-id profile-id])
(assoc ::count-sql [sql:get-snapshots-per-team team-id])
(generic-check!)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; QUOTE: TEAM-ACCESS-REQUESTS-PER-TEAM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:private schema:team-access-requests-per-team
[:map
[::profile-id ::sm/uuid]
[::team-id ::sm/uuid]])
(def ^:private valid-team-access-requests-per-team-quote?
(sm/lazy-validator schema:team-access-requests-per-team))
(def ^:private sql:get-team-access-requests-per-team
"SELECT count(*) AS total
FROM team_access_request AS tar
WHERE tar.team_id = ?")
(defmethod check-quote ::team-access-requests-per-team
[{:keys [::profile-id ::team-id ::target] :as quote}]
(assert (valid-team-access-requests-per-team-quote? quote) "invalid quote parameters")
(-> quote
(assoc ::default (cf/get :quotes-team-access-requests-per-team Integer/MAX_VALUE))
(assoc ::quote-sql [sql:get-quotes-2 target team-id profile-id profile-id])
(assoc ::count-sql [sql:get-team-access-requests-per-team team-id])
(generic-check!)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; QUOTE: TEAM-ACCESS-REQUESTS-PER-REQUESTER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:private schema:team-access-requests-per-requester
[:map
[::profile-id ::sm/uuid]])
(def ^:private valid-team-access-requests-per-requester-quote?
(sm/lazy-validator schema:team-access-requests-per-requester))
(def ^:private sql:get-team-access-requests-per-requester
"SELECT count(*) AS total
FROM team_access_request AS tar
WHERE tar.requester_id = ?")
(defmethod check-quote ::team-access-requests-per-requester
[{:keys [::profile-id ::target] :as quote}]
(assert (valid-team-access-requests-per-requester-quote? quote) "invalid quote parameters")
(-> quote
(assoc ::default (cf/get :quotes-team-access-requests-per-requester Integer/MAX_VALUE))
(assoc ::quote-sql [sql:get-quotes-1 target profile-id])
(assoc ::count-sql [sql:get-team-access-requests-per-requester profile-id])
(generic-check!)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; QUOTE: DEFAULT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@@ -46,7 +46,7 @@
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uri :as uri]
[app.common.uuid :as uuid]
[app.config :as cf]
@@ -61,7 +61,6 @@
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.edn :as edn]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[datoteka.fs :as fs]
[integrant.core :as ig]
@@ -95,9 +94,46 @@
(defmulti parse-limit (fn [[_ strategy _]] strategy))
(defmulti process-limit (fn [_ _ _ o] (::strategy o)))
(sm/register!
{:type ::rpc/rlimit
:pred #(instance? clojure.lang.Agent %)})
(def ^:private schema:strategy
[:enum :window :bucket])
(def ^:private schema:limit-tuple
[:tuple :keyword schema:strategy :string])
(def ^:private schema:limit
[:and
[:map
[::name :any]
[::strategy schema:strategy]
[::key :string]
[::opts :string]]
[:or
[:map
[::capacity ::sm/int]
[::rate ::sm/int]
[::internal ::dt/duration]
[::params [::sm/vec :any]]]
[:map
[::nreq ::sm/int]
[::unit [:enum :days :hours :minutes :seconds :weeks]]]]])
(def ^:private schema:limits
[:map-of :keyword [::sm/vec schema:limit]])
(def ^:private valid-limit-tuple?
(sm/lazy-validator schema:limit-tuple))
(def ^:private valid-rlimit-instance?
(sm/lazy-validator ::rpc/rlimit))
(defmethod parse-limit :window
[[name strategy opts :as vlimit]]
(us/assert! ::limit-tuple vlimit)
(assert (valid-limit-tuple? vlimit) "expected valid limit tuple")
(merge
{::name name
::strategy strategy}
@@ -118,7 +154,8 @@
(defmethod parse-limit :bucket
[[name strategy opts :as vlimit]]
(us/assert! ::limit-tuple vlimit)
(assert (valid-limit-tuple? vlimit) "expected valid limit tuple")
(if-let [[_ capacity rate interval] (re-find bucket-opts-re opts)]
(let [interval (dt/duration interval)
rate (parse-long rate)
@@ -140,7 +177,7 @@
(let [script (-> bucket-rate-limit-script
(assoc ::rscript/keys [(str key "." service "." user-id)])
(assoc ::rscript/vals (conj params (dt/->seconds now))))
result (rds/eval! redis script)
result (rds/eval redis script)
allowed? (boolean (nth result 0))
remaining (nth result 1)
reset (* (/ (inst-ms interval) rate)
@@ -164,7 +201,7 @@
script (-> window-rate-limit-script
(assoc ::rscript/keys [(str key "." service "." user-id "." (dt/format-instant ts))])
(assoc ::rscript/vals [nreq (dt/->seconds ttl)]))
result (rds/eval! redis script)
result (rds/eval redis script)
allowed? (boolean (nth result 0))
remaining (nth result 1)]
(l/trace :hint "limit processed"
@@ -245,8 +282,8 @@
(defn wrap
[{:keys [::rpc/rlimit ::rds/redis] :as cfg} f mdata]
(us/assert! ::rpc/rlimit rlimit)
(us/assert! ::rds/redis redis)
(assert (rds/redis? redis) "expected a valid redis instance")
(assert (or (nil? rlimit) (valid-rlimit-instance? rlimit)) "expected a valid rlimit instance")
(if rlimit
(let [skey (keyword (::rpc/type cfg) (->> mdata ::sv/spec name))
@@ -275,42 +312,19 @@
;; CONFIG WATCHER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::strategy (s/and ::us/keyword #{:window :bucket}))
(s/def ::capacity ::us/integer)
(s/def ::rate ::us/integer)
(s/def ::interval ::dt/duration)
(s/def ::key ::us/string)
(s/def ::opts ::us/string)
(s/def ::params vector?)
(s/def ::unit #{:days :hours :minutes :seconds :weeks})
(s/def ::nreq ::us/integer)
(s/def ::refresh ::dt/duration)
(def ^:private schema:config
[:map-of
[:or :keyword [:set :keyword]]
[:vector schema:limit-tuple]])
(s/def ::limit-tuple
(s/tuple ::us/keyword ::strategy string?))
(def ^:private check-config
(sm/check-fn schema:config))
(s/def ::limits
(s/map-of keyword? (s/every ::limit :kind vector?)))
(def ^:private check-refresh
(sm/check-fn ::dt/duration))
(s/def ::limit
(s/and
(s/keys :req [::name ::strategy ::key ::opts])
(s/or :bucket
(s/keys :req [::capacity
::rate
::interval
::params])
:window
(s/keys :req [::nreq
::unit]))))
(s/def ::rpc/rlimit
(s/nilable
#(instance? clojure.lang.Agent %)))
(s/def ::config
(s/map-of (s/or :kw keyword? :set set?)
(s/every ::limit-tuple :kind vector?)))
(def ^:private check-limits
(sm/check-fn schema:limits))
(defn read-config
[path]
@@ -336,13 +350,9 @@
{}
config)))]
(when-let [config (some->> path slurp edn/read-string)]
(us/verify! ::config config)
(let [refresh (->> config meta :refresh dt/duration)
limits (->> config compile-pass-1 compile-pass-2)]
(us/verify! ::limits limits)
(us/verify! ::refresh refresh)
(when-let [config (some->> path slurp edn/read-string check-config)]
(let [refresh (->> config meta :refresh dt/duration check-refresh)
limits (->> config compile-pass-1 compile-pass-2 check-limits)]
{::refresh refresh
::limits limits}))))
@@ -385,8 +395,9 @@
(when-let [path (cf/get :rpc-rlimit-config)]
(and (fs/exists? path) (fs/regular-file? path) path)))
(defmethod ig/pre-init-spec :app.rpc/rlimit [_]
(s/keys :req [::wrk/executor]))
(defmethod ig/assert-key :app.rpc/rlimit
[_ {:keys [::wrk/executor]}]
(assert (sm/valid? ::wrk/executor executor) "expect valid executor"))
(defmethod ig/init-key ::rpc/rlimit
[_ {:keys [::wrk/executor] :as cfg}]

View File

@@ -9,7 +9,7 @@
(:require
[app.common.data :as d]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uuid :as uuid]
[app.db :as db]
[app.main :as-alias main]
@@ -17,7 +17,6 @@
[app.setup.templates]
[buddy.core.codecs :as bc]
[buddy.core.nonce :as bn]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(defn- generate-random-key
@@ -73,12 +72,9 @@
(db/run! system (fn [{:keys [::db/conn]}]
(db/exec-one! conn [sql:add-prop prop value false value false])))))
(s/def ::key ::us/string)
(s/def ::props (s/map-of ::us/keyword some?))
(defmethod ig/pre-init-spec ::props [_]
(s/keys :req [::db/pool]
:opt [::key]))
(defmethod ig/assert-key ::props
[_ params]
(assert (db/pool? (::db/pool params)) "expected valid database pool"))
(defmethod ig/init-key ::props
[_ {:keys [::db/pool ::key] :as cfg}]
@@ -94,3 +90,7 @@
(assoc :secret-key secret)
(assoc :tokens-key (keys/derive secret :salt "tokens"))
(update :instance-id handle-instance-id conn (db/read-only? pool))))))
;; FIXME
(sm/register! ::props :any)

View File

@@ -10,6 +10,7 @@
[app.db :as db]
[app.rpc :as-alias rpc]
[app.rpc.climit :as-alias climit]
[app.rpc.commands.files :as files]
[app.rpc.commands.files-update :as fupdate]
[app.rpc.commands.management :as management]
[app.rpc.commands.profile :as profile]
@@ -51,9 +52,11 @@
:project-id (:default-project-id profile)}
template-stream (tmpl/get-template-stream cfg "welcome")
file-id (-> (management/clone-template cfg params template-stream)
first)]
first)
file-name (str fullname "'s first file")]
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
(files/rename-file conn {:id file-id :name file-name})
(fupdate/update-file! cfg file-id update-welcome-shape fullname)
(profile/update-profile-props cfg id {:welcome-file-id file-id})
(db/exec-one! conn [sql:mark-file-object-thumbnails-deleted file-id])

View File

@@ -8,7 +8,6 @@
"Server Repl."
(:require
[app.common.logging :as l]
[app.common.spec :as us]
[app.config :as cf]
[app.srepl.cli]
[app.srepl.main]
@@ -16,7 +15,6 @@
[app.util.locks :as locks]
[clojure.core.server :as ccs]
[clojure.main :as cm]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(defn- repl-init
@@ -44,16 +42,14 @@
;; --- State initialization
(s/def ::port ::us/integer)
(s/def ::host ::us/not-empty-string)
(defmethod ig/assert-key ::server
[_ params]
(assert (int? (::port params)) "expected valid port")
(assert (string? (::host params)) "expected valid host"))
(defmethod ig/pre-init-spec ::server
[_]
(s/keys :req [::host ::port]))
(defmethod ig/prep-key ::server
[[type _] cfg]
(assoc cfg ::flag (keyword (str (name type) "-server"))))
(defmethod ig/expand-key ::server
[[type :as k] v]
{k (assoc v ::flag (keyword (str (name type) "-server")))})
(defmethod ig/init-key ::server
[[type _] {:keys [::flag ::port ::host] :as cfg}]

View File

@@ -122,22 +122,19 @@
WHERE file_id = ANY(?)
AND id IS NOT NULL")
(defn get-file-snapshots
(defn search-file-snapshots
"Get a seq parirs of file-id and snapshot-id for a set of files
and specified label"
[conn label ids]
[conn file-ids label]
(db/exec! conn [sql:snapshots-with-file label
(db/create-array conn "uuid" ids)]))
(db/create-array conn "uuid" file-ids)]))
(defn take-team-snapshot!
[system team-id label]
(let [conn (db/get-connection system)]
(->> (feat.comp-v2/get-and-lock-team-files conn team-id)
(map (fn [file-id]
{:file-id file-id
:label label}))
(reduce (fn [result params]
(fsnap/take-file-snapshot! conn params)
(reduce (fn [result file-id]
(fsnap/create-file-snapshot! system nil file-id label)
(inc result))
0))))
@@ -147,7 +144,7 @@
ids (->> (feat.comp-v2/get-and-lock-team-files conn team-id)
(into #{}))
snap (get-file-snapshots conn label ids)
snap (search-file-snapshots conn ids label)
ids' (into #{} (map :file-id) snap)
team (-> (feat.comp-v2/get-team conn team-id)
@@ -157,8 +154,8 @@
(throw (RuntimeException. "no uniform snapshot available")))
(feat.comp-v2/update-team! conn team)
(reduce (fn [result params]
(fsnap/restore-file-snapshot! conn params)
(reduce (fn [result {:keys [file-id id]}]
(fsnap/restore-file-snapshot! system file-id id)
(inc result))
0
snap)))
@@ -167,7 +164,7 @@
[system file-id update-fn & {:keys [label validate? with-libraries?] :or {validate? true} :as opts}]
(when (string? label)
(fsnap/take-file-snapshot! system {:file-id file-id :label label}))
(fsnap/create-file-snapshot! system nil file-id label))
(let [conn (db/get-connection system)
file (get-file system file-id opts)

View File

@@ -311,33 +311,29 @@
collectable file-changes entry."
[& {:keys [file-id label]}]
(let [file-id (h/parse-uuid file-id)]
(db/tx-run! main/system fsnap/take-file-snapshot! {:file-id file-id :label label})))
(db/tx-run! main/system fsnap/create-file-snapshot! {:file-id file-id :label label})))
(defn restore-file-snapshot!
[file-id label]
(let [file-id (h/parse-uuid file-id)]
(db/tx-run! main/system
(fn [{:keys [::db/conn] :as system}]
(when-let [snapshot (->> (h/get-file-snapshots conn label #{file-id})
(when-let [snapshot (->> (h/search-file-snapshots conn #{file-id} label)
(map :id)
(first))]
(fsnap/restore-file-snapshot! system
{:id (:id snapshot)
:file-id file-id}))))))
(fsnap/restore-file-snapshot! system file-id (:id snapshot)))))))
(defn list-file-snapshots!
[file-id & {:keys [limit]}]
[file-id & {:as _}]
(let [file-id (h/parse-uuid file-id)]
(db/tx-run! main/system
(fn [system]
(let [params {:file-id file-id :limit limit}]
(->> (fsnap/get-file-snapshots system (d/without-nils params))
(print-table [:label :id :revn :created-at])))))))
(fn [{:keys [::db/conn]}]
(->> (fsnap/get-file-snapshots conn file-id)
(print-table [:label :id :revn :created-at]))))))
(defn take-team-snapshot!
[team-id & {:keys [label rollback?] :or {rollback? true}}]
(let [team-id (h/parse-uuid team-id)
label (or label (fsnap/generate-snapshot-label))]
(let [team-id (h/parse-uuid team-id)]
(-> (assoc main/system ::db/rollback rollback?)
(db/tx-run! h/take-team-snapshot! team-id label))))

View File

@@ -11,7 +11,7 @@
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
@@ -19,7 +19,6 @@
[app.storage.impl :as impl]
[app.storage.s3 :as ss3]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[datoteka.fs :as fs]
[integrant.core :as ig])
@@ -34,23 +33,43 @@
:assets-s3 :s3
nil)))
(def valid-buckets
#{"file-media-object"
"team-font-variant"
"file-object-thumbnail"
"file-thumbnail"
"profile"
"file-data"
"file-data-fragment"
"file-change"})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Storage Module State
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(s/def ::id #{:assets-fs :assets-s3 :fs :s3})
(s/def ::s3 ::ss3/backend)
(s/def ::fs ::sfs/backend)
(s/def ::type #{:fs :s3})
(def ^:private schema:backends
[:map-of :keyword
[:maybe
[:or ::ss3/backend ::sfs/backend]]])
(s/def ::backends
(s/map-of ::us/keyword
(s/nilable
(s/or :s3 ::ss3/backend
:fs ::sfs/backend))))
(def ^:private valid-backends?
(sm/validator schema:backends))
(defmethod ig/pre-init-spec ::storage [_]
(s/keys :req [::db/pool ::backends]))
(def ^:private schema:storage
[:map {:title "storage"}
[::backends schema:backends]
[::backend [:enum :s3 :fs]]
::db/connectable])
(def valid-storage?
(sm/validator schema:storage))
(sm/register! ::storage schema:storage)
(defmethod ig/assert-key ::storage
[_ params]
(assert (db/pool? (::db/pool params)) "expected valid database pool")
(assert (valid-backends? (::backends params)) "expected valid backends map"))
(defmethod ig/init-key ::storage
[_ {:keys [::backends ::db/pool] :as cfg}]
@@ -68,14 +87,6 @@
(assoc ::backend backend)
(assoc ::db/connectable pool))))
(s/def ::backend keyword?)
(s/def ::storage
(s/keys :req [::backends ::db/pool ::db/connectable]
:opt [::backend]))
(s/def ::storage-with-backend
(s/and ::storage #(contains? % ::backend)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Database Objects
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -190,15 +201,16 @@
(dm/export impl/object?)
(defn get-object
[{:keys [::db/connectable] :as storage} id]
(us/assert! ::storage storage)
[{:keys [::db/connectable] :as storage} id]
(assert (valid-storage? storage))
(retrieve-database-object connectable id))
(defn put-object!
"Creates a new object with the provided content."
[{:keys [::backend] :as storage} {:keys [::content] :as params}]
(us/assert! ::storage-with-backend storage)
(us/assert! ::impl/content content)
(assert (valid-storage? storage))
(assert (impl/content? content) "expected an instance of content")
(let [object (create-database-object storage params)]
(if (::created? (meta object))
;; Store the data finally on the underlying storage subsystem.
@@ -209,7 +221,7 @@
(defn touch-object!
"Mark object as touched."
[{:keys [::db/connectable] :as storage} object-or-id]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(let [id (if (impl/object? object-or-id) (:id object-or-id) object-or-id)]
(-> (db/update! connectable :storage-object
{:touched-at (dt/now)}
@@ -221,7 +233,7 @@
"Return an input stream instance of the object content."
^InputStream
[storage object]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(when (or (nil? (:expired-at object))
(dt/is-after? (:expired-at object) (dt/now)))
(-> (impl/resolve-backend storage (:backend object))
@@ -230,7 +242,7 @@
(defn get-object-bytes
"Returns a byte array of object content."
[storage object]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(when (or (nil? (:expired-at object))
(dt/is-after? (:expired-at object) (dt/now)))
(-> (impl/resolve-backend storage (:backend object))
@@ -240,7 +252,7 @@
([storage object]
(get-object-url storage object nil))
([storage object options]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(when (or (nil? (:expired-at object))
(dt/is-after? (:expired-at object) (dt/now)))
(-> (impl/resolve-backend storage (:backend object))
@@ -250,7 +262,7 @@
"Get the Path to the object. Only works with `:fs` type of
storages."
[storage object]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(let [backend (impl/resolve-backend storage (:backend object))]
(when (and (= :fs (::type backend))
(or (nil? (:expired-at object))
@@ -259,7 +271,7 @@
(defn del-object!
[{:keys [::db/connectable] :as storage} object-or-id]
(us/assert! ::storage storage)
(assert (valid-storage? storage))
(let [id (if (impl/object? object-or-id) (:id object-or-id) object-or-id)
res (db/update! connectable :storage-object
{:deleted-at (dt/now)}
@@ -267,9 +279,12 @@
(pos? (db/get-update-count res))))
(dm/export impl/calculate-hash)
(dm/export impl/get-hash)
(dm/export impl/get-size)
(defn configure
[storage connectable]
(assert (valid-storage? storage))
(assoc storage ::db/connectable connectable))
(defn resolve

View File

@@ -6,27 +6,29 @@
(ns app.storage.fs
(:require
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uri :as u]
[app.storage :as-alias sto]
[app.storage.impl :as impl]
[clojure.spec.alpha :as s]
[cuerdas.core :as str]
[datoteka.fs :as fs]
[datoteka.io :as io]
[integrant.core :as ig])
(:import
java.io.InputStream
java.io.OutputStream
java.nio.file.Files
java.nio.file.Path))
(set! *warn-on-reflection* true)
;; --- BACKEND INIT
(s/def ::directory ::us/string)
(defmethod ig/pre-init-spec ::backend [_]
(s/keys :opt [::directory]))
(defmethod ig/assert-key ::backend
[_ params]
;; FIXME: path (?)
(assert (string? (::directory params))))
(defmethod ig/init-key ::backend
[_ cfg]
@@ -39,18 +41,22 @@
::directory (str dir)
::uri (u/uri (str "file://" dir))))))
(s/def ::uri u/uri?)
(s/def ::backend
(s/keys :req [::directory
::uri]
:opt [::sto/type
::sto/id]))
(def ^:private schema:backend
[:map {:title "fs-backend"}
[::directory :string]
[::uri ::sm/uri]
[::sto/type [:= :fs]]])
(sm/register! ::backend schema:backend)
(def ^:private valid-backend?
(sm/validator schema:backend))
;; --- API IMPL
(defmethod impl/put-object :fs
[backend {:keys [id] :as object} content]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(let [base (fs/path (::directory backend))
path (fs/path (impl/id->path id))
full (fs/normalize (fs/join base path))]
@@ -58,15 +64,15 @@
(when-not (fs/exists? (fs/parent full))
(fs/create-dir (fs/parent full)))
(dm/with-open [src (io/input-stream content)
dst (io/output-stream full)]
(io/copy! src dst))
(with-open [^InputStream src (io/input-stream content)]
(with-open [^OutputStream dst (io/output-stream full)]
(io/copy src dst)))
object))
(defmethod impl/get-object-data :fs
[backend {:keys [id] :as object}]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(let [^Path base (fs/path (::directory backend))
^Path path (fs/path (impl/id->path id))
^Path full (fs/normalize (fs/join base path))]
@@ -78,12 +84,12 @@
(defmethod impl/get-object-bytes :fs
[backend object]
(dm/with-open [input (impl/get-object-data backend object)]
(io/read-as-bytes input)))
(with-open [^InputStream input (impl/get-object-data backend object)]
(io/read input)))
(defmethod impl/get-object-url :fs
[{:keys [::uri] :as backend} {:keys [id] :as object} _]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(update uri :path
(fn [existing]
(if (str/ends-with? existing "/")
@@ -92,7 +98,7 @@
(defmethod impl/del-object :fs
[backend {:keys [id] :as object}]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(let [base (fs/path (::directory backend))
path (fs/path (impl/id->path id))
path (fs/join base path)]
@@ -100,7 +106,7 @@
(defmethod impl/del-objects-in-bulk :fs
[backend ids]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(let [base (fs/path (::directory backend))]
(doseq [id ids]
(let [path (fs/path (impl/id->path id))

View File

@@ -16,10 +16,9 @@
[app.common.data :as d]
[app.common.logging :as l]
[app.db :as db]
[app.storage :as-alias sto]
[app.storage :as sto]
[app.storage.impl :as impl]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private sql:lock-sobjects
@@ -100,13 +99,14 @@
0
(get-buckets conn min-age)))
(defmethod ig/assert-key ::handler
[_ params]
(assert (sto/valid-storage? (::sto/storage params)) "expect valid storage")
(assert (db/pool? (::db/pool params)) "expect valid storage"))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::sto/storage ::db/pool]))
(defmethod ig/prep-key ::handler
[_ cfg]
(assoc cfg ::min-age (dt/duration {:hours 2})))
(defmethod ig/expand-key ::handler
[k v]
{k (assoc v ::min-age (dt/duration {:hours 2}))})
(defmethod ig/init-key ::handler
[_ {:keys [::min-age] :as cfg}]

View File

@@ -25,7 +25,6 @@
[app.db :as db]
[app.storage :as-alias sto]
[app.storage.impl :as impl]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private sql:has-team-font-variant-refs
@@ -226,8 +225,9 @@
;; HANDLER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expect valid storage"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -14,7 +14,6 @@
[buddy.core.codecs :as bc]
[buddy.core.hash :as bh]
[clojure.java.io :as jio]
[clojure.spec.alpha :as s]
[datoteka.io :as io])
(:import
java.nio.ByteBuffer
@@ -234,7 +233,3 @@
[v]
(satisfies? IContentObject v))
(s/def ::object object?)
(s/def ::content content?)

View File

@@ -11,7 +11,7 @@
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.logging :as l]
[app.common.spec :as us]
[app.common.schema :as sm]
[app.common.uri :as u]
[app.storage :as-alias sto]
[app.storage.impl :as impl]
@@ -19,7 +19,6 @@
[app.util.time :as dt]
[app.worker :as-alias wrk]
[clojure.java.io :as io]
[clojure.spec.alpha :as s]
[datoteka.fs :as fs]
[integrant.core :as ig]
[promesa.core :as p]
@@ -86,61 +85,68 @@
;; --- BACKEND INIT
(s/def ::region ::us/keyword)
(s/def ::bucket ::us/string)
(s/def ::prefix ::us/string)
(s/def ::endpoint ::us/string)
(s/def ::io-threads ::us/integer)
(def ^:private schema:config
[:map {:title "s3-backend-config"}
::wrk/executor
[::region {:optional true} :keyword]
[::bucket {:optional true} ::sm/text]
[::prefix {:optional true} ::sm/text]
[::endpoint {:optional true} ::sm/uri]
[::io-threads {:optional true} ::sm/int]])
(defmethod ig/pre-init-spec ::backend [_]
(s/keys :opt [::region ::bucket ::prefix ::endpoint ::io-threads ::wrk/executor]))
(defmethod ig/expand-key ::backend
[k v]
{k (merge {::region :eu-central-1} (d/without-nils v))})
(defmethod ig/prep-key ::backend
[_ {:keys [::prefix ::region] :as cfg}]
(cond-> (d/without-nils cfg)
(some? prefix) (assoc ::prefix prefix)
(nil? region) (assoc ::region :eu-central-1)))
(defmethod ig/assert-key ::backend
[_ params]
(assert (sm/check schema:config params)))
(defmethod ig/init-key ::backend
[_ cfg]
;; Return a valid backend data structure only if all optional
;; parameters are provided.
(when (and (contains? cfg ::region)
(string? (::bucket cfg)))
(let [client (build-s3-client cfg)
presigner (build-s3-presigner cfg)]
(assoc cfg
[_ params]
(when (and (contains? params ::region)
(contains? params ::bucket))
(let [client (build-s3-client params)
presigner (build-s3-presigner params)]
(assoc params
::sto/type :s3
::client @client
::presigner presigner
::close-fn #(.close ^java.lang.AutoCloseable client)))))
(defmethod ig/resolve-key ::backend
[_ params]
(dissoc params ::close-fn))
(defmethod ig/halt-key! ::backend
[_ {:keys [::close-fn]}]
(when (fn? close-fn)
(px/run! close-fn)))
(s/def ::client #(instance? S3AsyncClient %))
(s/def ::presigner #(instance? S3Presigner %))
(s/def ::backend
(s/keys :req [::region
::bucket
::client
::presigner]
:opt [::prefix
::sto/id]))
(def ^:private schema:backend
[:map {:title "s3-backend"}
;; [::region :keyword]
;; [::bucket ::sm/text]
[::client [:fn #(instance? S3AsyncClient %)]]
[::presigner [:fn #(instance? S3Presigner %)]]
[::prefix {:optional true} ::sm/text]
#_[::sto/type [:= :s3]]])
(sm/register! ::backend schema:backend)
(def ^:private valid-backend?
(sm/validator schema:backend))
;; --- API IMPL
(defmethod impl/put-object :s3
[backend object content]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(p/await! (put-object backend object content)))
(defmethod impl/get-object-data :s3
[backend object]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(loop [result (get-object-data backend object)
retryn 0]
@@ -167,22 +173,21 @@
(defmethod impl/get-object-bytes :s3
[backend object]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(p/await! (get-object-bytes backend object)))
(defmethod impl/get-object-url :s3
[backend object options]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(get-object-url backend object options))
(defmethod impl/del-object :s3
[backend object]
(us/assert! ::backend backend)
(p/await! (del-object backend object)))
(defmethod impl/del-objects-in-bulk :s3
[backend ids]
(us/assert! ::backend backend)
(assert (valid-backend? backend) "expected a valid backend instance")
(p/await! (del-object-in-bulk backend ids)))
;; --- HELPERS
@@ -221,7 +226,7 @@
builder (.region ^S3AsyncClientBuilder builder (lookup-region region))
builder (cond-> ^S3AsyncClientBuilder builder
(some? endpoint)
(.endpointOverride (URI. endpoint)))]
(.endpointOverride (URI. (str endpoint))))]
(.build ^S3AsyncClientBuilder builder))]
(reify
@@ -240,7 +245,7 @@
(.build))]
(-> (S3Presigner/builder)
(cond-> (some? endpoint) (.endpointOverride (URI. endpoint)))
(cond-> (some? endpoint) (.endpointOverride (URI. (str endpoint))))
(.region (lookup-region region))
(.serviceConfiguration ^S3Configuration config)
(.build))))
@@ -337,7 +342,8 @@
(defn- get-object-url
[{:keys [::presigner ::bucket ::prefix]} {:keys [id]} {:keys [max-age] :or {max-age default-max-age}}]
(us/assert dt/duration? max-age)
(assert (dt/duration? max-age) "expected valid duration instance")
(let [gor (.. (GetObjectRequest/builder)
(bucket bucket)
(key (dm/str prefix (impl/id->path id)))

View File

@@ -11,10 +11,10 @@
permanently delete these files (look at systemd-tempfiles)."
(:require
[app.common.logging :as l]
[app.common.schema :as sm]
[app.common.uuid :as uuid]
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.spec.alpha :as s]
[datoteka.fs :as fs]
[integrant.core :as ig]
[promesa.exec :as px]
@@ -29,12 +29,13 @@
(defonce queue (sp/chan :buf 128))
(defmethod ig/pre-init-spec ::cleaner [_]
(s/keys :req [::wrk/executor]))
(defmethod ig/assert-key ::cleaner
[_ {:keys [::wrk/executor]}]
(assert (sm/valid? ::wrk/executor executor)))
(defmethod ig/prep-key ::cleaner
[_ cfg]
(assoc cfg ::min-age (dt/duration "60m")))
(defmethod ig/expand-key ::cleaner
[k v]
{k (assoc v ::min-age (dt/duration "60m"))})
(defmethod ig/init-key ::cleaner
[_ cfg]

View File

@@ -7,36 +7,32 @@
(ns app.svgo
"A SVG Optimizer service"
(:require
[app.common.jsrt :as jsrt]
[app.common.logging :as l]
[app.worker :as-alias wrk]
[integrant.core :as ig]
[promesa.exec.semaphore :as ps]
[promesa.util :as pu]))
[app.util.shell :as shell]
[datoteka.fs :as fs]
[promesa.exec.semaphore :as ps]))
(def ^:dynamic *semaphore*
"A dynamic variable that can optionally contain a traffic light to
appropriately delimit the use of resources, managed externally."
nil)
(set! *warn-on-reflection* true)
(defn optimize
[{pool ::optimizer} data]
[system data]
(try
(some-> *semaphore* ps/acquire!)
(jsrt/run! pool
(fn [context]
(jsrt/set! context "svgData" data)
(jsrt/eval! context "penpotSvgo.optimize(svgData, {plugins: ['safeAndFastPreset']})")))
(let [script (fs/join fs/*cwd* "scripts/svgo-cli.js")
cmd ["node" (str script)]
result (shell/exec! system
:cmd cmd
:in data)]
(if (= (:exit result) 0)
(:out result)
(do
(l/raw! :warn (str "Error on optimizing svg, returning svg as-is." (:err result)))
data)))
(finally
(some-> *semaphore* ps/release!))))
(defmethod ig/init-key ::optimizer
[_ _]
(l/inf :hint "initializing svg optimizer pool")
(let [init (jsrt/resource->source "app/common/svg/optimizer.js")]
(jsrt/pool :init init)))
(defmethod ig/halt-key! ::optimizer
[_ pool]
(l/info :hint "stopping svg optimizer pool")
(pu/close! pool))

View File

@@ -12,7 +12,6 @@
[app.rpc.commands.files :as files]
[app.rpc.commands.profile :as profile]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:dynamic *team-deletion* false)
@@ -113,8 +112,9 @@
[_cfg props]
(l/wrn :hint "not implementation found" :rel (:object props)))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -26,8 +26,6 @@
[app.util.pointer-map :as pmap]
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.set :as set]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(declare ^:private get-file)
@@ -44,7 +42,7 @@
f.data_ref_id
FROM file_change AS f
WHERE f.file_id = ?
AND f.label IS NOT NULL
AND f.data IS NOT NULL
ORDER BY f.created_at ASC")
(def ^:private sql:mark-file-media-object-deleted
@@ -54,16 +52,21 @@
RETURNING id")
(def ^:private xf:collect-used-media
(comp (map :data) (mapcat bfc/collect-used-media)))
(comp
(map :data)
(mapcat bfc/collect-used-media)))
(defn- clean-file-media!
"Performs the garbage collection of file media objects."
[{:keys [::db/conn] :as cfg} {:keys [id] :as file}]
(let [used (into #{}
xf:collect-used-media
(cons file
(->> (db/cursor conn [sql:get-snapshots id])
(map (partial decode-file cfg)))))
(let [xform (comp
(map (partial decode-file cfg))
xf:collect-used-media)
used (->> (db/plan conn [sql:get-snapshots id])
(transduce xform conj #{}))
used (into used xf:collect-used-media [file])
ids (db/create-array conn "uuid" used)
unused (->> (db/exec! conn [sql:mark-file-media-object-deleted id ids])
(into #{} (map :id)))]
@@ -146,51 +149,47 @@
AND f.deleted_at IS null
ORDER BY f.modified_at ASC")
(def ^:private xf:map-id (map :id))
(defn- get-used-components
"Given a file and a set of components marked for deletion, return a
filtered set of component ids that are still un use"
[components library-id {:keys [data]}]
(filter #(ctf/used-in? data library-id % :component) components))
(defn- clean-deleted-components!
"Performs the garbage collection of unreferenced deleted components."
[{:keys [::db/conn] :as cfg} {:keys [data] :as file}]
(let [file-id (:id file)
get-used-components
(fn [data components]
;; Find which of the components are used in the file.
(into #{}
(filter #(ctf/used-in? data file-id % :component))
components))
deleted-components
(ctkl/deleted-components-seq data)
get-unused-components
(fn [components files]
;; Find and return a set of unused components (on all files).
(reduce (fn [components {:keys [data]}]
(if (seq components)
(->> (get-used-components data components)
(set/difference components))
(reduced components)))
xform
(mapcat (partial get-used-components deleted-components file-id))
components
files))
used-remote
(->> (db/plan conn [sql:get-files-for-library file-id])
(transduce (comp (map (partial decode-file cfg)) xform) conj #{}))
process-fdata
(fn [data unused]
(reduce (fn [data id]
(l/trc :hint "delete component"
:component-id (str id)
:file-id (str file-id))
(ctkl/delete-component data id))
data
unused))
used-local
(into #{} xform [file])
deleted (into #{} (ctkl/deleted-components-seq data))
unused (->> (db/cursor conn [sql:get-files-for-library file-id] {:chunk-size 1})
(map (partial decode-file cfg))
(cons file)
(get-unused-components deleted)
(mapv :id)
(set))
file (update file :data process-fdata unused)]
unused
(transduce xf:map-id disj
(into #{} xf:map-id deleted-components)
(concat used-remote used-local))
file
(update file :data
(fn [data]
(reduce (fn [data id]
(l/trc :hint "delete component"
:component-id (str id)
:file-id (str file-id))
(ctkl/delete-component data id))
data
unused)))]
(l/dbg :hint "clean" :rel "components" :file-id (str file-id) :total (count unused))
file))
@@ -315,8 +314,10 @@
;; HANDLER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool ::sto/storage]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool")
(assert (sto/valid-storage? (::sto/storage params)) "expected valid storage to be provided"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -12,7 +12,6 @@
[app.db :as db]
[app.util.time :as dt]
[app.worker :as wrk]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private
@@ -43,12 +42,13 @@
{:processed total}))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool"))
(defmethod ig/prep-key ::handler
[_ cfg]
(assoc cfg ::min-age (cf/get-deletion-delay)))
(defmethod ig/expand-key ::handler
[k v]
{k (assoc v ::min-age (cf/get-deletion-delay))})
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -1,68 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS INC
(ns app.tasks.file-xlog-gc
"A maintenance task that performs a garbage collection of the file
change (transaction) log."
(:require
[app.common.logging :as l]
[app.db :as db]
[app.features.fdata :as feat.fdata]
[app.storage :as sto]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private
sql:delete-files-xlog
"DELETE FROM file_change
WHERE id IN (SELECT id FROM file_change
WHERE label IS NULL
AND created_at < ?
ORDER BY created_at LIMIT ?)
RETURNING id, data_backend, data_ref_id")
(def xf:filter-offloded
(comp
(filter feat.fdata/offloaded?)
(keep :data-ref-id)))
(defn- delete-in-chunks
[{:keys [::chunk-size ::threshold] :as cfg}]
(let [storage (sto/resolve cfg ::db/reuse-conn true)]
(loop [total 0]
(let [chunk (db/exec! cfg [sql:delete-files-xlog threshold chunk-size])
length (count chunk)]
;; touch all references on offloaded changes entries
(doseq [data-ref-id (sequence xf:filter-offloded chunk)]
(l/trc :hint "touching referenced storage object"
:storage-object-id (str data-ref-id))
(sto/touch-object! storage data-ref-id))
(if (pos? length)
(recur (+ total length))
total)))))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/init-key ::handler
[_ cfg]
(fn [{:keys [props] :as task}]
(let [min-age (or (:min-age props)
(dt/duration "72h"))
chunk-size (:chunk-size props 5000)
threshold (dt/minus (dt/now) min-age)]
(-> cfg
(assoc ::db/rollback (:rollback props false))
(assoc ::threshold threshold)
(assoc ::chunk-size chunk-size)
(db/tx-run! (fn [cfg]
(let [total (delete-in-chunks cfg)]
(l/trc :hint "file xlog cleaned" :total total)
total)))))))

View File

@@ -13,7 +13,6 @@
[app.db :as db]
[app.storage :as sto]
[app.util.time :as dt]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private sql:get-profiles
@@ -27,7 +26,7 @@
(defn- delete-profiles!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-profiles min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-profiles min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id photo-id]}]
(l/trc :hint "permanently delete" :rel "profile" :id (str id))
@@ -50,7 +49,7 @@
(defn- delete-teams!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-teams min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-teams min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id photo-id deleted-at]}]
(l/trc :hint "permanently delete"
:rel "team"
@@ -78,7 +77,7 @@
(defn- delete-fonts!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-fonts min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-fonts min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id team-id deleted-at] :as font}]
(l/trc :hint "permanently delete"
:rel "team-font-variant"
@@ -110,7 +109,7 @@
(defn- delete-projects!
[{:keys [::db/conn ::min-age ::chunk-size] :as cfg}]
(->> (db/cursor conn [sql:get-projects min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-projects min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id team-id deleted-at]}]
(l/trc :hint "permanently delete"
:rel "project"
@@ -136,7 +135,7 @@
(defn- delete-files!
[{:keys [::db/conn ::sto/storage ::min-age ::chunk-size] :as cfg}]
(->> (db/cursor conn [sql:get-files min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-files min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id deleted-at project-id] :as file}]
(l/trc :hint "permanently delete"
:rel "file"
@@ -165,7 +164,7 @@
(defn delete-file-thumbnails!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-file-thumbnails min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-file-thumbnails min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [file-id revn media-id deleted-at]}]
(l/trc :hint "permanently delete"
:rel "file-thumbnail"
@@ -194,7 +193,7 @@
(defn delete-file-object-thumbnails!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-file-object-thumbnails min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-file-object-thumbnails min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [file-id object-id media-id deleted-at]}]
(l/trc :hint "permanently delete"
:rel "file-tagged-object-thumbnail"
@@ -223,7 +222,7 @@
(defn- delete-file-data-fragments!
[{:keys [::db/conn ::sto/storage ::min-age ::chunk-size] :as cfg}]
(->> (db/cursor conn [sql:get-file-data-fragments min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-file-data-fragments min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [file-id id deleted-at data-ref-id]}]
(l/trc :hint "permanently delete"
:rel "file-data-fragment"
@@ -249,7 +248,7 @@
(defn- delete-file-media-objects!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-file-media-objects min-age chunk-size] {:chunk-size 1})
(->> (db/cursor conn [sql:get-file-media-objects min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id file-id deleted-at] :as fmo}]
(l/trc :hint "permanently delete"
:rel "file-media-object"
@@ -266,6 +265,34 @@
(inc total))
0)))
(def ^:private sql:get-file-change
"SELECT id, file_id, deleted_at, data_backend, data_ref_id
FROM file_change
WHERE deleted_at IS NOT NULL
AND deleted_at < now() - ?::interval
ORDER BY deleted_at ASC
LIMIT ?
FOR UPDATE
SKIP LOCKED")
(defn- delete-file-change!
[{:keys [::db/conn ::min-age ::chunk-size ::sto/storage] :as cfg}]
(->> (db/cursor conn [sql:get-file-change min-age chunk-size] {:chunk-size 5})
(reduce (fn [total {:keys [id file-id deleted-at] :as xlog}]
(l/trc :hint "permanently delete"
:rel "file-change"
:id (str id)
:file-id (str file-id)
:deleted-at (dt/format-instant deleted-at))
(when (= "objects-storage" (:data-backend xlog))
(sto/touch-object! storage (:data-ref-id xlog)))
(db/delete! conn :file-change {:id id})
(inc total))
0)))
(def ^:private deletion-proc-vars
[#'delete-profiles!
#'delete-file-media-objects!
@@ -275,7 +302,8 @@
#'delete-files!
#'delete-projects!
#'delete-fonts!
#'delete-teams!])
#'delete-teams!
#'delete-file-change!])
(defn- execute-proc!
"A generic function that executes the specified proc iterativelly
@@ -289,14 +317,16 @@
(recur (+ total result))
total))))
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool ::sto/storage]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool")
(assert (sto/valid-storage? (::sto/storage params)) "expected valid storage to be provided"))
(defmethod ig/prep-key ::handler
[_ cfg]
(assoc cfg
::min-age (cf/get-deletion-delay)
::chunk-size 10))
(defmethod ig/expand-key ::handler
[k v]
{k (assoc v
::min-age (cf/get-deletion-delay)
::chunk-size 50)})
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -13,7 +13,6 @@
[app.db :as db]
[app.db.sql :as-alias sql]
[app.storage :as sto]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(defn- offload-file-data!
@@ -109,8 +108,10 @@
;; HANDLER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool ::sto/storage]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool")
(assert (sto/valid-storage? (::sto/storage params)) "expected valid storage to be provided"))
(defmethod ig/init-key ::handler
[_ cfg]

View File

@@ -11,19 +11,19 @@
[app.common.logging :as l]
[app.config :as cf]
[app.db :as db]
[clojure.spec.alpha :as s]
[integrant.core :as ig]))
(def ^:private
sql:delete-completed-tasks
"DELETE FROM task WHERE scheduled_at < now() - ?::interval")
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::db/pool]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (db/pool? (::db/pool params)) "expected a valid database pool"))
(defmethod ig/prep-key ::handler
[_ cfg]
(assoc cfg ::min-age (cf/get-deletion-delay)))
(defmethod ig/expand-key ::handler
[k v]
{k (assoc v ::min-age (cf/get-deletion-delay))})
(defmethod ig/init-key ::handler
[_ {:keys [::db/pool ::min-age] :as cfg}]

View File

@@ -17,7 +17,6 @@
[app.main :as-alias main]
[app.setup :as-alias setup]
[app.util.json :as json]
[clojure.spec.alpha :as s]
[integrant.core :as ig]
[promesa.exec :as px]))
@@ -205,10 +204,11 @@
;; TASK ENTRY POINT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod ig/pre-init-spec ::handler [_]
(s/keys :req [::http/client
::db/pool
::setup/props]))
(defmethod ig/assert-key ::handler
[_ params]
(assert (http/client? (::http/client params)) "expected a valid http client")
(assert (db/pool? (::db/pool params)) "expected a valid database pool")
(assert (some? (::setup/props params)) "expected setup props to be available"))
(defmethod ig/init-key ::handler
[_ {:keys [::db/pool ::setup/props] :as cfg}]

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