Commit Graph

1026 Commits

Author SHA1 Message Date
Tienson Qin
114c0524fa fix: handle situations when datom entity has gone or children exists 2024-05-15 10:34:34 +08:00
Gabriel Horner
0238aff2ba fix: replace uses of :string closed with :default closed
and remove :string from closed possibilities
2024-05-14 10:34:54 -04:00
Gabriel Horner
4a7dab2763 fix: can't add or update closed values 2024-05-14 09:29:00 -04:00
Gabriel Horner
45bb11d28d fix: db tests and :op typo 2024-05-13 17:05:32 -04:00
Gabriel Horner
a2a951ddcb fix: switching to another number closed value
The bug was creating a new block each time a switch was made
because existing closed values didn't have a created-from-property
2024-05-13 13:23:02 -04:00
Gabriel Horner
e55927086f fix: creating :number and :url closed values from config
Also add schema hack for fully-loaded being persisted. Also
add :default property examples to example properties graph now that it's
possible
2024-05-13 12:33:31 -04:00
Tienson Qin
ce4cad2cc7 Refactor/move property handler to outliner dep (#11311)
The end goal is to get rid of `db/transact!` and send outliner ops to
the db worker.

Currently, some property ops are async, set-block-property! will also
need to be async because when setting a non-ref value (e.g. a number
str "2"), we need to query whether a block with the value exists, this
unfortunately, will be an async query, so we're risking turning more
functions to async in the future which makes it hard to reason about
the implementation.
2024-05-13 18:16:21 +08:00
Gabriel Horner
fcf6ebd0e4 fix: page properties for :default, :number and :url
Also fix page property example in properties graph and removed
unused branches in validation
2024-05-10 16:40:42 -04:00
Gabriel Horner
64786bb258 fix: create :number and :url properties from scripts 2024-05-10 15:19:10 -04:00
Tienson Qin
11c902eb1e refactor: make all user-facing property types refs 2024-05-10 18:03:07 +08:00
Tienson Qin
4a9aa50a7d refactor: use :string type only for internal properties 2024-05-10 11:22:28 +08:00
Gabriel Horner
70d92c8f7a fix: pdf related properties for db graphs
Added to new property ns as file and file-path are too generic to be top-level.
Also fixed bugs in page creation
2024-05-09 13:38:31 -04:00
Gabriel Horner
123cb8fc42 fix: cleanup property tuple validation
Had an unnecessary entity refetch. Also move ui assumptions about :many
validation to ui as this needlessly limits what :many could store
2024-05-09 10:57:18 -04:00
Tienson Qin
339883800d fix: property tuple validation 2024-05-09 16:29:55 +08:00
Tienson Qin
61db29ceba Remove [:block/schema :cardinality]
Uses :db/cardinality instead.
2024-05-09 11:24:46 +08:00
Tienson Qin
45f14d4b76 refactor: property/schema.properties
Replace [:block/schema :properties] with ref type property/schema.properties.

This commit also introduces :logseq.class/base so that all the other
classes will be its children.
2024-05-09 08:29:11 +08:00
Tienson Qin
5013d34c2f chore: cleanup :block/_left usage 2024-05-09 04:36:14 +08:00
Gabriel Horner
00e153e866 fix: closed value :number can also be float 2024-05-08 15:23:57 -04:00
Gabriel Horner
949d676f02 fix: number closed value not saved as its original value
A :number closed value saved as a string is problematic for a couple
reasons:
* Not storing a number by the user's intended value means a loss of any
  numeric functionality the property provides. Basic things like sorting
  by the numeric property don't work. This has caused us problems in the
  past and we invented hacky workarounds like logseq.query/nlp-date to
  compensate for this
* Creates inconsistency in how numbers are saved as non-closed values
  are not saved as string. This affects not only the validation layer
  but also creates bugs when querying for these property values as the
  querying interface is inconsistent
2024-05-08 13:49:22 -04:00
Gabriel Horner
298c37ffc7 fix: lints + schema key which shouldn't have been removed 2024-05-08 12:31:08 -04:00
Gabriel Horner
22f15a3fb3 fix: validating closed value ents
Also fix closed value membership not being checked from CLI
2024-05-08 11:47:45 -04:00
Gabriel Horner
be9237d101 refactor: move rules deps usage into helper fn
Dries up task dependency that was copied in query-dsl
2024-05-07 22:11:27 -04:00
Gabriel Horner
489e7f3422 fix: :default-queries for db graphs
closes LOG-3042. Moved :default-queries to default-config as this allows
for any future fix to automatically update for a user. There's also a
breaking change with this config key from :block/journal? so moving this
to default-config makes the migration easier e.g. just tell users to
remove the config key
2024-05-07 18:03:50 -04:00
Tienson Qin
1cb0896e3b refactor: remove [:block/schema :values]
Some changes:
1. use :block/closed-value-property instead to record which property
this value entity belongs to.
2. use :block/content instead of [:block/schema :value].
3. :page and :date have been removed from closed-value-property-types
because there could be a page/date that's a closed value for multiple
properties, we have no idea what's the `:block/order` for a specific
property.
2024-05-07 23:33:04 +08:00
Gabriel Horner
ead9f30f1b fix: typing hashtag sets heading
also remove unused var
2024-05-07 10:53:32 -04:00
Tienson Qin
4e32a5042a fix: reset *max-key when loading graph 2024-05-07 21:52:56 +08:00
Tienson Qin
308c3bcd17 fix: reset max key when generate-n-keys-between 2024-05-07 20:07:06 +08:00
Tienson Qin
ee0d89ad85 refactor: replace [:block/schema :value] with :property/schema.value 2024-05-07 17:26:56 +08:00
Gabriel Horner
4c3fc530b9 fix: task rule and filter for db graphs
Part of LOG-3042
2024-05-06 16:55:45 -04:00
Gabriel Horner
4059062919 fix: block property rules for new properties structure 2024-05-06 16:40:55 -04:00
Gabriel Horner
0d95786a7f fix: remove unused db attributes from db graph schema
part of LOG-3042
2024-05-06 11:59:32 -04:00
Gabriel Horner
719ba8cdbe Merge branch 'feat/db' into refactor/db-properties-schema 2024-05-06 08:38:32 -04:00
rcmerci
2e67aed55d refactor(rtc): replace origin rtc-start&stop 2024-05-04 11:46:08 +08:00
Gabriel Horner
333490fde6 enhance: create-graph scripts can generate classes via :classes
Any script can pass a :classes config key. schema script no longer needs
to manage db ids or db idents
2024-05-03 16:24:46 -04:00
Tienson Qin
457a74343f refactor: no need to create parent && hidden page for :default value 2024-05-03 00:02:55 +08:00
Gabriel Horner
88e38b16f4 fix: more lints including removing dead code 2024-05-02 10:35:44 -04:00
Tienson Qin
89edb3af9a fix: can't remove Many values 2024-05-02 18:03:17 +08:00
Gabriel Horner
d4ecc393f0 fix: schema with :block/order changes 2024-05-01 16:47:25 -04:00
Tienson Qin
1ec4796eff refactor: replace :block/left with :block/order
Finally no need to worry about parent-left conflicts and broken chain.
With :block/order, we only need to re-compute new orders for siblings
with same order (it can happens if there're bugs in our code, or
updates from rtc), but it doesn't break UI.

Another huge potential benefit after discussing with Zhiyuan is:
Ee might be able to simplify both RTC and undo/redo, currently, we
need to handle each new op for both of them, with recently
refactorings like properties being db attributes, :block/order
is a string instead of a ref, we can handle most property value
conflicts using last-write-wins, and others (e.g. :block/parent,
property with :default type) specifically.

I haven't fixed the issues of using :block/left in RTC and undo/redo,
because we might change both soon.
2024-05-02 01:12:22 +08:00
Gabriel Horner
27ed8c7f29 enhance: allow user classes to have db idents
This allows imported and eventually user classes to have db idents.
Updated schema example graph which now imports classes as
:schema.class/X. Also fix schema properties which were removed from
the debug file and remove unused property uuids
2024-05-01 12:20:26 -04:00
Gabriel Horner
5c81b61774 fix: file graphs can't load b/c db specific attribute fetched 2024-05-01 09:07:23 -04:00
Gabriel Horner
2540bb3014 fix: type validations
:default doesn't have closed and tweak validation error messages
2024-04-30 14:14:25 -04:00
Gabriel Horner
77914fbcdf fix: db tests and lint 2024-04-30 12:31:12 -04:00
Gabriel Horner
670b46f221 fix: validate property values again
caused by property pair revert 5d4ae66d86
2024-04-30 12:25:12 -04:00
Gabriel Horner
efcffd6e19 fix: rules and most db tests
caused by property pair revert 5d4ae66d86
2024-04-30 10:33:33 -04:00
Gabriel Horner
a35bc9b0d6 Bump nbb-logseq version for datascript and ordered-map changes 2024-04-30 10:10:11 -04:00
Tienson Qin
cdf546dce7 convert fractional-index js to cljs 2024-04-29 15:30:35 +08:00
Tienson Qin
723f0a5bab fix: class ordered properties 2024-04-29 12:27:18 +08:00
Tienson Qin
8275449b3c feat: drag && drop block properties 2024-04-29 11:35:11 +08:00
Tienson Qin
dda5f2200e wip: add global :block/order for properties 2024-04-29 00:27:41 +08:00