mirror of
https://github.com/logseq/logseq.git
synced 2026-05-24 12:44:22 +00:00
Merge remote-tracking branch 'origin/master' into enhance/rtc-migrate
This commit is contained in:
8
.github/workflows/build-android.yml
vendored
8
.github/workflows/build-android.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
||||
ref: ${{ github.event.inputs.git-ref }}
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache directory
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
@@ -73,13 +73,13 @@ jobs:
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Cache clojure deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
|
||||
30
.github/workflows/build-desktop-release.yml
vendored
30
.github/workflows/build-desktop-release.yml
vendored
@@ -67,7 +67,7 @@ jobs:
|
||||
ref: ${{ github.event.inputs.git-ref }}
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache directory
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
@@ -85,13 +85,13 @@ jobs:
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Cache clojure deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
@@ -187,12 +187,12 @@ jobs:
|
||||
echo "version=$pkgver" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
# - name: Cache Node Modules
|
||||
# uses: actions/cache@v3
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: |
|
||||
# **/node_modules
|
||||
@@ -233,7 +233,7 @@ jobs:
|
||||
echo "version=$pkgver" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -285,12 +285,12 @@ jobs:
|
||||
run: echo "version=$(cat ./static/VERSION)" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
# - name: Cache Node Modules
|
||||
# uses: actions/cache@v3
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: |
|
||||
# **/node_modules
|
||||
@@ -359,7 +359,7 @@ jobs:
|
||||
run: ls -al ./static
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -372,7 +372,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
- name: Cache yarn cache directory
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
@@ -388,7 +388,7 @@ jobs:
|
||||
p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
|
||||
|
||||
# - name: Cache Node Modules
|
||||
# uses: actions/cache@v3
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: |
|
||||
# **/node_modules
|
||||
@@ -432,7 +432,7 @@ jobs:
|
||||
echo "version=$pkgver" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -440,7 +440,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
- name: Cache yarn cache directory
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
@@ -461,7 +461,7 @@ jobs:
|
||||
p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}
|
||||
|
||||
# - name: Cache Node Modules
|
||||
# uses: actions/cache@v3
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: |
|
||||
# **/node_modules
|
||||
|
||||
6
.github/workflows/build-ios-release.yml
vendored
6
.github/workflows/build-ios-release.yml
vendored
@@ -27,18 +27,18 @@ jobs:
|
||||
with:
|
||||
xcode-version: 16.1
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Cache clojure deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
|
||||
8
.github/workflows/build-ios.yml
vendored
8
.github/workflows/build-ios.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Node.js, NPM and Yarn
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache directory
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
@@ -46,13 +46,13 @@ jobs:
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Cache clojure deps
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
|
||||
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@@ -41,14 +41,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
cli: ${{ env.CLOJURE_VERSION }}
|
||||
|
||||
- name: Clojure cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: clojure-deps
|
||||
with:
|
||||
path: |
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -139,7 +139,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
@@ -148,7 +148,7 @@ jobs:
|
||||
scripts/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
6
.github/workflows/clj-e2e.yml
vendored
6
.github/workflows/clj-e2e.yml
vendored
@@ -33,7 +33,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
bb: ${{ env.BABASHKA_VERSION }}
|
||||
|
||||
- name: Clojure cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: clojure-deps
|
||||
with:
|
||||
path: |
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
run: clojure -A:cljs -P
|
||||
|
||||
- name: Shadow-cljs cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .shadow-cljs
|
||||
# ensure update cache every time
|
||||
|
||||
6
.github/workflows/clj-rtc-e2e.yml
vendored
6
.github/workflows/clj-rtc-e2e.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
bb: ${{ env.BABASHKA_VERSION }}
|
||||
|
||||
- name: Clojure cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: clojure-deps
|
||||
with:
|
||||
path: |
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
run: clojure -A:cljs -P
|
||||
|
||||
- name: Shadow-cljs cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .shadow-cljs
|
||||
# ensure update cache every time
|
||||
|
||||
6
.github/workflows/db.yml
vendored
6
.github/workflows/db.yml
vendored
@@ -39,14 +39,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: deps/db/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
4
.github/workflows/deploy-db-test-pages.yml
vendored
4
.github/workflows/deploy-db-test-pages.yml
vendored
@@ -17,13 +17,13 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
|
||||
8
.github/workflows/graph-parser.yml
vendored
8
.github/workflows/graph-parser.yml
vendored
@@ -43,14 +43,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: deps/graph-parser/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
bb: ${{ env.BABASHKA_VERSION }}
|
||||
|
||||
- name: Clojure cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: clojure-deps
|
||||
with:
|
||||
path: |
|
||||
@@ -96,7 +96,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
8
.github/workflows/logseq-common.yml
vendored
8
.github/workflows/logseq-common.yml
vendored
@@ -35,14 +35,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: deps/publishing/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
run: bb test:load-all-namespaces-with-nbb .
|
||||
|
||||
- name: Clojure cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
id: clojure-deps
|
||||
with:
|
||||
path: |
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
6
.github/workflows/outliner.yml
vendored
6
.github/workflows/outliner.yml
vendored
@@ -45,14 +45,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: deps/outliner/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
6
.github/workflows/publishing.yml
vendored
6
.github/workflows/publishing.yml
vendored
@@ -43,14 +43,14 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: deps/publishing/yarn.lock
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
11
deps/cli/README.md
vendored
11
deps/cli/README.md
vendored
@@ -12,7 +12,7 @@ This section assumes you have installed the CLI from npm or via the [dev
|
||||
setup](#setup). If you haven't, substitute `node cli.mjs` for `logseq` e.g.
|
||||
`node.cli.mjs -h`.
|
||||
|
||||
All commands excepts for `search` can be used offline or on CI. The `search` command and any command that has an api-query-token option require the [HTTP Server](https://docs.logseq.com/#/page/local%20http%20server) to be turned on.
|
||||
All commands can be used offline or on CI. The `search` command and any command that has an api-query-token option require the [HTTP API Server](https://docs.logseq.com/#/page/local%20http%20server) to be turned on.
|
||||
|
||||
Now let's use it!
|
||||
|
||||
@@ -54,13 +54,20 @@ $ logseq show db-test
|
||||
| Graph created by commit | https://github.com/logseq/logseq/commit/3c93fd2637 |
|
||||
| Graph imported by | :cli/create-graph |
|
||||
|
||||
# Search your current graph and print results one per line like grep
|
||||
# Search your current graph and print highlighted results one per line like grep
|
||||
$ logseq search woot -a my-token
|
||||
Search found 100 results:
|
||||
dev:db-export woot woot.edn && dev:db-create woot2 woot.edn
|
||||
dev:db-diff woot woot2
|
||||
...
|
||||
|
||||
# Search a local graph
|
||||
$ logseq search woot page
|
||||
Search found 23 results:
|
||||
Node page
|
||||
Annotation page
|
||||
...
|
||||
|
||||
# Query a graph locally using `d/entity` id(s) like an integer or a :db/ident
|
||||
# Can also specify a uuid string to fetch an entity
|
||||
$ logseq query woot 10 :logseq.class/Tag
|
||||
|
||||
2
deps/cli/package.json
vendored
2
deps/cli/package.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@logseq/cli",
|
||||
"version": "0.1.0-alpha.1",
|
||||
"version": "0.1.0",
|
||||
"description": "Logseq CLI",
|
||||
"bin": {
|
||||
"logseq": "cli.mjs"
|
||||
|
||||
6
deps/cli/src/logseq/cli.cljs
vendored
6
deps/cli/src/logseq/cli.cljs
vendored
@@ -69,12 +69,12 @@
|
||||
:args->opts [:graphs] :coerce {:graphs []} :require [:graphs]}
|
||||
{:cmds ["search"]
|
||||
:fn (lazy-load-fn 'logseq.cli.commands.search/search)
|
||||
:desc "Search current DB graph"
|
||||
:args->opts [:search-terms] :coerce {:search-terms []} :require [:search-terms]
|
||||
:desc "Search DB graph"
|
||||
:args->opts [:graph :search-terms] :coerce {:search-terms []} :require [:graph]
|
||||
:spec cli-spec/search}
|
||||
{:cmds ["query"] :desc "Query DB graph(s)"
|
||||
:fn (lazy-load-fn 'logseq.cli.commands.query/query)
|
||||
:args->opts [:graph :args] :coerce {:args []} :no-keyword-opts true :require [:graph :args]
|
||||
:args->opts [:graph :args] :coerce {:args []} :no-keyword-opts true :require [:graph]
|
||||
:spec cli-spec/query}
|
||||
{:cmds ["export-edn"] :desc "Export DB graph as EDN"
|
||||
:fn (lazy-load-fn 'logseq.cli.commands.export-edn/export)
|
||||
|
||||
26
deps/cli/src/logseq/cli/commands/query.cljs
vendored
26
deps/cli/src/logseq/cli/commands/query.cljs
vendored
@@ -64,20 +64,34 @@
|
||||
m)))
|
||||
args))
|
||||
|
||||
(defn- local-datalog-query [db query*]
|
||||
(let [query (into query* [:in '$ '%]) ;; assumes no :in are in queries
|
||||
res (d/q query db (rules/extract-rules rules/db-query-dsl-rules))]
|
||||
;; Remove nesting for most queries which just have one :find binding
|
||||
(if (= 1 (count (first res))) (mapv first res) res)))
|
||||
|
||||
(defn- local-query
|
||||
[{{:keys [graph args graphs properties-readable]} :opts}]
|
||||
[{{:keys [graph args graphs properties-readable title-query]} :opts}]
|
||||
(let [graphs' (into [graph] graphs)]
|
||||
(doseq [graph' graphs']
|
||||
(if (fs/existsSync (cli-util/get-graph-dir graph'))
|
||||
(let [conn (apply sqlite-cli/open-db! (cli-util/->open-db-args graph))
|
||||
query* (when (string? (first args)) (common-util/safe-read-string {:log-error? false} (first args)))
|
||||
;; If datalog query detected run it or else default to entity lookups
|
||||
results (if (and (vector? query*) (= :find (first query*)))
|
||||
;; assumes no :in are in queries
|
||||
(let [query' (into query* [:in '$ '%])
|
||||
res (d/q query' @conn (rules/extract-rules rules/db-query-dsl-rules))]
|
||||
results (cond
|
||||
;; Run datalog query if detected
|
||||
(and (vector? query*) (= :find (first query*)))
|
||||
(local-datalog-query @conn query*)
|
||||
;; Runs predefined title query. Predefined queries could better off in a separate command
|
||||
;; since they could be more powerful and have different args than query command
|
||||
title-query
|
||||
(let [query '[:find (pull ?b [*])
|
||||
:in $ % ?search-term
|
||||
:where (block-content ?b ?search-term)]
|
||||
res (d/q query @conn (rules/extract-rules rules/db-query-dsl-rules)
|
||||
(string/join " " args))]
|
||||
;; Remove nesting for most queries which just have one :find binding
|
||||
(if (= 1 (count (first res))) (mapv first res) res))
|
||||
:else
|
||||
(local-entities-query @conn properties-readable args))]
|
||||
(when (> (count graphs') 1)
|
||||
(println "Results for graph" (pr-str graph')))
|
||||
|
||||
54
deps/cli/src/logseq/cli/commands/search.cljs
vendored
54
deps/cli/src/logseq/cli/commands/search.cljs
vendored
@@ -1,9 +1,12 @@
|
||||
(ns logseq.cli.commands.search
|
||||
"Search command"
|
||||
(:require [clojure.pprint :as pprint]
|
||||
(:require ["fs" :as fs]
|
||||
[clojure.pprint :as pprint]
|
||||
[clojure.string :as string]
|
||||
[logseq.cli.util :as cli-util]
|
||||
[datascript.core :as d]
|
||||
[logseq.cli.text-util :as cli-text-util]
|
||||
[logseq.cli.util :as cli-util]
|
||||
[logseq.db.common.sqlite-cli :as sqlite-cli]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defn- highlight
|
||||
@@ -23,21 +26,42 @@
|
||||
(recur new-result)
|
||||
new-result)))))
|
||||
|
||||
(defn search
|
||||
[{{:keys [search-terms api-query-token raw limit]} :opts}]
|
||||
(-> (p/let [resp (cli-util/api-fetch api-query-token
|
||||
"logseq.app.search"
|
||||
[(string/join " " search-terms) {:limit limit}])]
|
||||
(defn- format-results
|
||||
"Results are a list of strings. Handles highlighting search term in results and printing options like :raw"
|
||||
[results search-term {:keys [raw api?]}]
|
||||
(println "Search found" (count results) "results:")
|
||||
(if raw
|
||||
(pprint/pprint results)
|
||||
(let [highlight-fn (if api?
|
||||
highlight-content-query
|
||||
#(string/replace % search-term (highlight search-term)))]
|
||||
(println (string/join "\n"
|
||||
(->> results
|
||||
(map #(string/replace % "\n" "\\\\n"))
|
||||
(map highlight-fn)))))))
|
||||
|
||||
(defn- api-search
|
||||
[search-term {{:keys [api-query-token raw limit]} :opts}]
|
||||
(-> (p/let [resp (cli-util/api-fetch api-query-token "logseq.app.search" [search-term {:limit limit}])]
|
||||
(if (= 200 (.-status resp))
|
||||
(p/let [body (.json resp)]
|
||||
(let [{:keys [blocks]} (js->clj body :keywordize-keys true)]
|
||||
(println "Search found" (count blocks) "results:")
|
||||
(if raw
|
||||
(pprint/pprint blocks)
|
||||
(println (string/join "\n"
|
||||
(->> blocks
|
||||
(map :block/title)
|
||||
(map #(string/replace % "\n" "\\\\n"))
|
||||
(map highlight-content-query)))))))
|
||||
(format-results (map :block/title blocks) search-term {:raw raw :api? true})))
|
||||
(cli-util/api-handle-error-response resp)))
|
||||
(p/catch cli-util/command-catch-handler)))
|
||||
|
||||
(defn- local-search [search-term {{:keys [graph raw limit]} :opts}]
|
||||
(if (fs/existsSync (cli-util/get-graph-dir graph))
|
||||
(let [conn (apply sqlite-cli/open-db! (cli-util/->open-db-args graph))
|
||||
nodes (->> (d/datoms @conn :aevt :block/title)
|
||||
(filter (fn [datom]
|
||||
(string/includes? (:v datom) search-term)))
|
||||
(take limit)
|
||||
(map :v))]
|
||||
(format-results nodes search-term {:raw raw}))
|
||||
(cli-util/error "Graph" (pr-str graph) "does not exist")))
|
||||
|
||||
(defn search [{{:keys [graph search-terms api-query-token]} :opts :as m}]
|
||||
(if api-query-token
|
||||
(api-search (string/join " " (into [graph] search-terms)) m)
|
||||
(local-search (string/join " " search-terms) m)))
|
||||
3
deps/cli/src/logseq/cli/spec.cljs
vendored
3
deps/cli/src/logseq/cli/spec.cljs
vendored
@@ -28,12 +28,13 @@
|
||||
:properties-readable {:alias :p
|
||||
:coerce :boolean
|
||||
:desc "Make properties on entity queries show property values instead of ids"}
|
||||
:title-query {:alias :t
|
||||
:desc "Invokes local query on :block/title"}
|
||||
:api-query-token {:alias :a
|
||||
:desc "Query current graph with api server token"}})
|
||||
|
||||
(def search
|
||||
{:api-query-token {:alias :a
|
||||
:require true
|
||||
:desc "Api server token"}
|
||||
:raw {:alias :r
|
||||
:desc "Print raw response"}
|
||||
|
||||
31
deps/db/src/logseq/db/common/view.cljs
vendored
31
deps/db/src/logseq/db/common/view.cljs
vendored
@@ -473,20 +473,37 @@
|
||||
(db-property/property-value-content pvalue))
|
||||
pvalue)))
|
||||
result (if group-by-property-ident
|
||||
(->> filtered-entities
|
||||
(group-by readable-property-value-or-ent)
|
||||
(seq)
|
||||
(sort-by (fn [[by-value _]]
|
||||
(let [groups-sort-by-property-ident (or (:db/ident (:logseq.property.view/sort-groups-by-property view))
|
||||
:block/journal-day)
|
||||
desc? (:logseq.property.view/sort-groups-desc? view)
|
||||
result (->> filtered-entities
|
||||
(group-by readable-property-value-or-ent)
|
||||
(seq))
|
||||
keyfn (fn [groups-sort-by-property-ident]
|
||||
(fn [[by-value _]]
|
||||
(cond
|
||||
group-by-page?
|
||||
(:block/updated-at by-value)
|
||||
(let [v (get by-value groups-sort-by-property-ident)]
|
||||
(if (and (= groups-sort-by-property-ident :block/journal-day) (not desc?)
|
||||
(nil? (:block/journal-day by-value)))
|
||||
;; Use MAX_SAFE_INTEGER so non-journal pages (without :block/journal-day) are sorted
|
||||
;; after all journal pages when sorting by journal date.
|
||||
js/Number.MAX_SAFE_INTEGER
|
||||
v))
|
||||
group-by-closed-values?
|
||||
(:block/order by-value)
|
||||
ref-property?
|
||||
(db-property/property-value-content by-value)
|
||||
:else
|
||||
by-value))
|
||||
(if group-by-page? #(compare %2 %1) compare)))
|
||||
by-value)))]
|
||||
(sort (common-util/by-sorting
|
||||
(cond->
|
||||
[{:get-value (keyfn groups-sort-by-property-ident)
|
||||
:asc? (not desc?)}]
|
||||
(not= groups-sort-by-property-ident :block/title)
|
||||
(conj {:get-value (keyfn :block/title)
|
||||
:asc? (not desc?)})))
|
||||
result))
|
||||
(sort-entities db sorting filtered-entities))
|
||||
data' (if group-by-property-ident
|
||||
(map
|
||||
|
||||
49
deps/db/src/logseq/db/frontend/property.cljs
vendored
49
deps/db/src/logseq/db/frontend/property.cljs
vendored
@@ -12,6 +12,14 @@
|
||||
;; Main property vars
|
||||
;; ==================
|
||||
|
||||
;; Ignore this property when rtc,
|
||||
;; since users frequently click the sort button to view table content temporarily,
|
||||
;; but this action does not need to be synchronized with other clients.
|
||||
(def property-ignore-rtc
|
||||
{:rtc/ignore-attr-when-init-upload true
|
||||
:rtc/ignore-attr-when-init-download true
|
||||
:rtc/ignore-attr-when-syncing true})
|
||||
|
||||
(def ^:large-vars/data-var built-in-properties
|
||||
"Map of built in properties for db graphs with their :db/ident as keys.
|
||||
Each property has a config map with the following keys:
|
||||
@@ -122,6 +130,12 @@
|
||||
:schema {:type :entity
|
||||
:public? false
|
||||
:hide? true}}
|
||||
:block/journal-day {:title "Journal date"
|
||||
:attribute :block/journal-day
|
||||
:schema {:type :raw-number
|
||||
:public? false
|
||||
:hide? true}
|
||||
:queryable? true}
|
||||
:block/created-at {:title "Node created at"
|
||||
:attribute :block/created-at
|
||||
:schema {:type :datetime
|
||||
@@ -420,17 +434,26 @@
|
||||
:hide? true}
|
||||
:queryable? true}
|
||||
|
||||
:logseq.property.view/sort-groups-by-property {:title "View sort groups by"
|
||||
:schema
|
||||
{:type :property
|
||||
:hide? true
|
||||
:public? false}
|
||||
:rtc property-ignore-rtc}
|
||||
:logseq.property.view/sort-groups-desc? {:title "View sort groups DESC"
|
||||
:schema
|
||||
{:type :checkbox
|
||||
:hide? true
|
||||
:public? false}
|
||||
:properties {:logseq.property/scalar-default-value true}
|
||||
:rtc property-ignore-rtc}
|
||||
|
||||
:logseq.property.table/sorting {:title "View sorting"
|
||||
:schema
|
||||
{:type :coll
|
||||
:hide? true
|
||||
:public? false}
|
||||
;; ignore this property when rtc,
|
||||
;; since users frequently click the sort button to view table content temporarily,
|
||||
;; but this action does not need to be synchronized with other clients.
|
||||
:rtc {:rtc/ignore-attr-when-init-upload true
|
||||
:rtc/ignore-attr-when-init-download true
|
||||
:rtc/ignore-attr-when-syncing true}}
|
||||
:rtc property-ignore-rtc}
|
||||
|
||||
:logseq.property.table/filters {:title "View filters"
|
||||
:schema
|
||||
@@ -485,17 +508,13 @@
|
||||
:schema {:type :raw-number
|
||||
:hide? true
|
||||
:public? false}
|
||||
:rtc {:rtc/ignore-attr-when-init-upload true
|
||||
:rtc/ignore-attr-when-init-download true
|
||||
:rtc/ignore-attr-when-syncing true}}
|
||||
:rtc property-ignore-rtc}
|
||||
:logseq.property.asset/remote-metadata {:title "File remote metadata"
|
||||
:schema
|
||||
{:type :map
|
||||
:hide? true
|
||||
:public? false}
|
||||
:rtc {:rtc/ignore-attr-when-init-upload true
|
||||
:rtc/ignore-attr-when-init-download true
|
||||
:rtc/ignore-attr-when-syncing true}}
|
||||
:rtc property-ignore-rtc}
|
||||
:logseq.property.asset/resize-metadata {:title "Asset resize metadata"
|
||||
:schema {:type :map
|
||||
:hide? true
|
||||
@@ -561,16 +580,14 @@
|
||||
:schema {:type :datetime
|
||||
:public? false
|
||||
:hide? true}
|
||||
:rtc {:rtc/ignore-attr-when-init-upload true
|
||||
:rtc/ignore-attr-when-init-download true
|
||||
:rtc/ignore-attr-when-syncing true}})))
|
||||
:rtc property-ignore-rtc})))
|
||||
|
||||
(def db-attribute-properties
|
||||
"Internal properties that are also db schema attributes"
|
||||
#{:block/alias :block/tags :block/parent
|
||||
:block/order :block/collapsed? :block/page
|
||||
:block/refs :block/path-refs :block/link
|
||||
:block/title :block/closed-value-property
|
||||
:block/title :block/closed-value-property :block/journal-day
|
||||
:block/created-at :block/updated-at})
|
||||
|
||||
(assert (= db-attribute-properties
|
||||
|
||||
2
deps/db/src/logseq/db/frontend/schema.cljs
vendored
2
deps/db/src/logseq/db/frontend/schema.cljs
vendored
@@ -37,7 +37,7 @@
|
||||
(map (juxt :major :minor)
|
||||
[(parse-schema-version x) (parse-schema-version y)])))
|
||||
|
||||
(def version (parse-schema-version "65.11"))
|
||||
(def version (parse-schema-version "65.10"))
|
||||
|
||||
(defn major-version
|
||||
"Return a number.
|
||||
|
||||
@@ -424,6 +424,53 @@
|
||||
columns)))
|
||||
columns))
|
||||
|
||||
(defonce groups-sort-by-options
|
||||
[["Journal date" :block/journal-day]
|
||||
["Page name" :block/title]
|
||||
["Page updated date" :block/updated-at]
|
||||
["Page created date" :block/created-at]])
|
||||
(defonce groups-sort-by-name->property-identity
|
||||
(into {} groups-sort-by-options))
|
||||
(defonce groups-sort-by-property-identity->name
|
||||
(set/map-invert groups-sort-by-name->property-identity))
|
||||
|
||||
(rum/defc groups-sort
|
||||
[view-entity sort-by-value]
|
||||
(let [property-ident (or (:db/ident sort-by-value) :block/journal-day)]
|
||||
(shui/dropdown-menu-sub
|
||||
(shui/dropdown-menu-sub-trigger
|
||||
"Sort groups by")
|
||||
(shui/dropdown-menu-sub-content
|
||||
(for [[option _] groups-sort-by-options]
|
||||
(shui/dropdown-menu-checkbox-item
|
||||
{:key option
|
||||
:checked (= option (groups-sort-by-property-identity->name property-ident))
|
||||
:onCheckedChange (fn [checked?]
|
||||
(let [property-id (:db/id (db/entity (groups-sort-by-name->property-identity option)))]
|
||||
(if checked?
|
||||
(db-property-handler/set-block-property! (:db/id view-entity) :logseq.property.view/sort-groups-by-property
|
||||
property-id)
|
||||
(db-property-handler/remove-block-property! (:db/id view-entity) :logseq.property.view/sort-groups-by-property))))
|
||||
:onSelect (fn [e] (.preventDefault e))}
|
||||
option))))))
|
||||
|
||||
(rum/defc groups-sort-order
|
||||
[view-entity desc?]
|
||||
(shui/dropdown-menu-sub
|
||||
(shui/dropdown-menu-sub-trigger
|
||||
"Sort groups order")
|
||||
(shui/dropdown-menu-sub-content
|
||||
(for [option ["Descending" "Ascending"]]
|
||||
(shui/dropdown-menu-checkbox-item
|
||||
{:key option
|
||||
:checked (= option (if desc? "Descending" "Ascending"))
|
||||
:onCheckedChange (fn [checked?]
|
||||
(db-property-handler/set-block-property! (:db/id view-entity) :logseq.property.view/sort-groups-desc?
|
||||
(or (and checked? (= "Descending" option))
|
||||
(and (not checked?) (not= "Descending" option)))))
|
||||
:onSelect (fn [e] (.preventDefault e))}
|
||||
option)))))
|
||||
|
||||
(rum/defc more-actions
|
||||
[view-entity columns {:keys [column-visible? rows column-toggle-visibility]} {:keys [group-by-property-ident]}]
|
||||
(let [display-type (:db/ident (:logseq.property.view/type view-entity))
|
||||
@@ -433,13 +480,14 @@
|
||||
(:logseq.property.view/feature-type view-entity))
|
||||
(:logseq.property/query view-entity))
|
||||
[{:id :block/page
|
||||
:name "Block Page"}])
|
||||
:name "Page"}])
|
||||
(filter (fn [column]
|
||||
(when (:id column)
|
||||
(when-let [p (db/entity (:id column))]
|
||||
(and (not (db-property/many? p))
|
||||
(contains? #{:default :number :checkbox :url :node :date}
|
||||
(:logseq.property/type p)))))) columns))]
|
||||
(:logseq.property/type p)))))) columns))
|
||||
group-by-page? (some #{:block/page} (map :id group-by-columns))]
|
||||
(shui/dropdown-menu
|
||||
(shui/dropdown-menu-trigger
|
||||
{:asChild true}
|
||||
@@ -482,6 +530,10 @@
|
||||
(db-property-handler/remove-block-property! (:db/id view-entity) :logseq.property.view/group-by-property)))
|
||||
:onSelect (fn [e] (.preventDefault e))}
|
||||
(:name column))))))
|
||||
(when group-by-page?
|
||||
(groups-sort view-entity (:logseq.property.view/sort-groups-by-property view-entity)))
|
||||
(when group-by-property-ident
|
||||
(groups-sort-order view-entity (:logseq.property.view/sort-groups-desc? view-entity)))
|
||||
(shui/dropdown-menu-item
|
||||
{:key "export-edn"
|
||||
:on-click #(db-export-handler/export-view-nodes-data rows {:group-by? (some? group-by-property-ident)})}
|
||||
|
||||
@@ -426,7 +426,8 @@ independent of format as format specific heading characters are stripped"
|
||||
(defn journal-page?
|
||||
"sanitized page-name only"
|
||||
[page-name]
|
||||
(ldb/journal? (ldb/get-page (conn/get-db) page-name)))
|
||||
(when (string? page-name)
|
||||
(ldb/journal? (ldb/get-page (conn/get-db) page-name))))
|
||||
|
||||
(defn get-all-referenced-blocks-uuid
|
||||
"Get all uuids of blocks with any back link exists."
|
||||
|
||||
@@ -404,7 +404,8 @@
|
||||
["65.6" {:fix update-extends-to-cardinality-many}]
|
||||
["65.7" {:fix add-quick-add-page}]
|
||||
["65.8" {:fix add-missing-page-name}]
|
||||
["65.9" {:properties [:logseq.property.embedding/hnsw-label-updated-at]}]])
|
||||
["65.9" {:properties [:logseq.property.embedding/hnsw-label-updated-at]}]
|
||||
["65.10" {:properties [:block/journal-day :logseq.property.view/sort-groups-by-property :logseq.property.view/sort-groups-desc?]}]])
|
||||
|
||||
(let [[major minor] (last (sort (map (comp (juxt :major :minor) db-schema/parse-schema-version first)
|
||||
schema-version->updates)))]
|
||||
|
||||
@@ -193,12 +193,13 @@
|
||||
|
||||
(defmethod local-block-ops->remote-ops-aux :update-page-op
|
||||
[_ & {:keys [db block-uuid *remote-ops]}]
|
||||
(when-let [{page-name :block/name title :block/title}
|
||||
(when-let [{page-name :block/name title :block/title db-ident :db/ident}
|
||||
(d/entity db [:block/uuid block-uuid])]
|
||||
(swap! *remote-ops conj
|
||||
[:update-page {:block-uuid block-uuid
|
||||
:page-name page-name
|
||||
:block/title (or title page-name)}])))
|
||||
[:update-page (cond-> {:block-uuid block-uuid
|
||||
:page-name page-name
|
||||
:block/title (or title page-name)}
|
||||
db-ident (assoc :db/ident db-ident))])))
|
||||
|
||||
(defmethod local-block-ops->remote-ops-aux :remove-op
|
||||
[_ & {:keys [db remove-op *remote-ops]}]
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
[:cat :keyword
|
||||
[:map
|
||||
[:block-uuid :uuid]
|
||||
[:db/ident {:optional true} :keyword]
|
||||
[:page-name :string]
|
||||
[:block/title :string]]]]
|
||||
[:remove-page
|
||||
|
||||
Reference in New Issue
Block a user