Skip to content

Commit

Permalink
Merge pull request #642 from TristanCacqueray/legacy-td-removal
Browse files Browse the repository at this point in the history
Consolidate the task data API with the entity API
  • Loading branch information
mergify[bot] authored Oct 11, 2021
2 parents 482157c + c4b9ae9 commit 9418d86
Show file tree
Hide file tree
Showing 50 changed files with 1,377 additions and 4,586 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file.

### Removed

- [api] The legacy task data last_updated/add/commit are replaced by the new crawler commit_info/add/commit api.

### Fixed

## [1.1.0] - 2021-09-21
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
.PHONY: up-stage

MESSAGES = monocle/user_group.proto monocle/task_data.proto monocle/search.proto monocle/config.proto
BACKEND_ONLY = monocle/change.proto monocle/project.proto monocle/crawler.proto
MESSAGES = monocle/user_group.proto monocle/search.proto monocle/config.proto
CRAWLER = monocle/change.proto monocle/crawler.proto
BACKEND_ONLY = monocle/project.proto
PINCLUDE = -I /usr/include $(PROTOC_FLAGS) -I ./protos/

codegen: codegen-python codegen-javascript codegen-stubs codegen-openapi codegen-haskell codegen-doc
Expand All @@ -20,12 +21,12 @@ codegen-stubs:
rm -Rf srcgen/

codegen-haskell:
sh -c 'for pb in $(MESSAGES) $(BACKEND_ONLY); do compile-proto-file --includeDir /usr/include --includeDir protos/ --includeDir ${PROTOBUF_SRC} --proto $${pb} --out haskell/codegen/; done'
sh -c 'for pb in $(MESSAGES) $(CRAWLER) $(BACKEND_ONLY); do compile-proto-file --includeDir /usr/include --includeDir protos/ --includeDir ${PROTOBUF_SRC} --proto $${pb} --out haskell/codegen/; done'
find haskell/codegen/ -type f -name "*.hs" -exec sed -i {} -e '1i{-# LANGUAGE NoGeneralisedNewtypeDeriving #-}' \;
find haskell/codegen/ -type f -name "*.hs" -exec ormolu -i {} \;

codegen-python:
protoc $(PINCLUDE) --python_out=./ --mypy_out=./ $(MESSAGES)
protoc $(PINCLUDE) --python_out=./ --mypy_out=./ $(MESSAGES) $(CRAWLER)
black monocle/*.py*

codegen-javascript:
Expand Down
1 change: 0 additions & 1 deletion codegen/MonocleCodegen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ protoToHaskell = fromProto headers mkService
"import Monocle.Client (MonocleClient, monocleReq)",
"import Monocle.Config",
"import Monocle.Crawler",
"import Monocle.TaskData",
"import Monocle.Search",
"import Monocle.UserGroup"
]
Expand Down
12 changes: 7 additions & 5 deletions contrib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import argparse
import json
import monocle.webapi as M
import monocle.task_data_pb2 as T
import monocle.crawler_pb2 as Crawler
import monocle.change_pb2 as Change


def usage():
Expand Down Expand Up @@ -48,9 +49,10 @@ def usage():
print("usage: add-td workspace crawler apikey json")
exit(1)
tdjson = json.loads(td)
td = T.TaskData(**tdjson)
query = M.TaskDataAddRequest(
index=workspace, crawler=crawler, apikey=apikey, items=[td]
td = Change.TaskData(**tdjson)
entity = Crawler.Entity(td_name=crawler)
query = M.AddDocRequest(
index=workspace, crawler=crawler, apikey=apikey, entity=entity, task_datas=[td]
)
resp = M.task_data_task_data_add(args.url, query)
resp = M.crawler_add_doc(args.url, query)
print(resp)
146 changes: 25 additions & 121 deletions doc/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9418d86

Please sign in to comment.