notion_ruby_mapping 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/README.md +2 -0
- data/exe/erdToNotionDb.rb +41 -0
- data/exe/notionErDiagram.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/base.rb +7 -0
- data/lib/notion_ruby_mapping/blocks/child_database_block.rb +4 -0
- data/lib/notion_ruby_mapping/blocks/child_page_block.rb +4 -0
- data/lib/notion_ruby_mapping/blocks/list.rb +7 -0
- data/lib/notion_ruby_mapping/blocks/page.rb +4 -1
- data/lib/notion_ruby_mapping/controllers/mermaid.rb +72 -0
- data/lib/notion_ruby_mapping/controllers/mermaid_database.rb +182 -0
- data/lib/notion_ruby_mapping/controllers/notion_cache.rb +8 -0
- data/lib/notion_ruby_mapping/controllers/search.rb +29 -0
- data/lib/notion_ruby_mapping/properties/property.rb +3 -5
- data/lib/notion_ruby_mapping/properties/relation_property.rb +16 -3
- data/lib/notion_ruby_mapping/properties/text_property.rb +2 -2
- data/lib/notion_ruby_mapping/version.rb +1 -1
- data/lib/notion_ruby_mapping.rb +2 -2
- data/notion_ruby_mapping.gemspec +1 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78822f6707fe646abb09c9240dce59ac8adac8c27c300baae8282e16ecd54278
|
4
|
+
data.tar.gz: 40aa622383799df9e197bf9eafd829d2e7699a9c66194a42812f750a2bb97b1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab8f1e29cb52504ea7c1b8877743e99d31cd1dd2b08e790a28038d966ea5319e48d733657eeae936b8c55a0af2ed87b010411568770ef57e023e0f4f3c49a9c6
|
7
|
+
data.tar.gz: a625b8e93d57e4ba506f67526a8f5a95bb872a0a879eaa9154bd719b2fa0c5f2374cab20a7fda448dcdaa03bf4f2f4b800725061c9f3bc0bb76ecaf5a67b3e1b
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -125,6 +125,8 @@ NotionRubyMapping.configuration { |c| c.notion_token = ENV["NOTION_API_TOKEN"] }
|
|
125
125
|
|
126
126
|
## 3. ChangeLog
|
127
127
|
|
128
|
+
- 2023/1/25 [v0.7.2] bug fix for creating relation property / add erdToNotionRb.rb script
|
129
|
+
- 2022/12/16 [v0.7.1] bug fix for query rollup property
|
128
130
|
- 2022/11/28 [v0.7.0] add this_week filter and NotionRubyMapping.configure
|
129
131
|
- 2022/11/13 [v0.6.8] remove error checking for start and end dates, add Users.all, and change Rollup and Formula query specification
|
130
132
|
- 2022/9/2 [v0.6.7] add support for Status property, is_toggleable for headings block, and page property values
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require "notion_ruby_mapping"
|
4
|
+
include NotionRubyMapping
|
5
|
+
|
6
|
+
if ARGV.length < 2
|
7
|
+
print "Usage: erdToNotion.rb code_block_id target_page_id [--inline]"
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
mermaid_url, target_page_url, inline_flag = ARGV
|
12
|
+
inline = inline_flag == "--inline"
|
13
|
+
NotionRubyMapping.configure { |c| c.notion_token = ENV["NOTION_API_KEY"] }
|
14
|
+
nc = NotionCache.instance
|
15
|
+
mermaid_block = Block.find mermaid_url
|
16
|
+
unless mermaid_block.is_a? CodeBlock
|
17
|
+
print "#{mermaid_url} is not CodeBlock's id"
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
# Parse mermaid ER
|
22
|
+
mermaid = Mermaid.new mermaid_block.rich_text_array.full_text
|
23
|
+
|
24
|
+
# Retrieve child databases
|
25
|
+
target_page = Page.find target_page_url
|
26
|
+
target_page_id = target_page.id
|
27
|
+
db_titles = target_page.children.select { |b| b.is_a? ChildDatabaseBlock }.map(&:title)
|
28
|
+
exist_dbs = Search.new(query: "(#{db_titles.join('|')})", database_only: true).exec.select do |db|
|
29
|
+
nc.hex_id(db.parent_id) == target_page_id
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attach existing databases to mermaid database
|
33
|
+
exist_dbs.each do |db|
|
34
|
+
mermaid.attach_database db
|
35
|
+
end
|
36
|
+
|
37
|
+
mermaid.create_notion_db target_page, inline
|
38
|
+
mermaid.update_databases
|
39
|
+
mermaid.rename_reverse_name
|
40
|
+
mermaid.update_rollup
|
41
|
+
|
data/exe/notionErDiagram.rb
CHANGED
@@ -29,7 +29,7 @@ if ARGV.length < 2
|
|
29
29
|
exit
|
30
30
|
end
|
31
31
|
database_id, code_block_id = ARGV
|
32
|
-
|
32
|
+
NotionRubyMapping.configure { |c| c.notion_token = ENV["NOTION_API_KEY"] }
|
33
33
|
block = Block.find code_block_id
|
34
34
|
unless block.is_a? CodeBlock
|
35
35
|
print "#{code_block_id} is not CodeBlock's id"
|
@@ -256,6 +256,13 @@ module NotionRubyMapping
|
|
256
256
|
klass.find parent_json[type], dry_run: dry_run
|
257
257
|
end
|
258
258
|
|
259
|
+
def parent_id
|
260
|
+
parent_json = @json && @json["parent"]
|
261
|
+
raise StandardError, "Unknown parent" if parent_json.nil?
|
262
|
+
|
263
|
+
parent_json[parent_json["type"]]
|
264
|
+
end
|
265
|
+
|
259
266
|
# @return [NotionRubyMapping::PropertyCache] get or created PropertyCache object
|
260
267
|
# @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#8f0b28e09dd74e2a9ff06126c48d64d4
|
261
268
|
def properties
|
@@ -21,6 +21,8 @@ module NotionRubyMapping
|
|
21
21
|
@property = value
|
22
22
|
when :user_object
|
23
23
|
@user_object = true
|
24
|
+
when :search
|
25
|
+
@search = value
|
24
26
|
end
|
25
27
|
@query = query
|
26
28
|
@index = 0
|
@@ -74,6 +76,11 @@ module NotionRubyMapping
|
|
74
76
|
query: -> { @nc.users_request @query.query_json },
|
75
77
|
create_object: ->(json) { UserObject.new json: json },
|
76
78
|
&block
|
79
|
+
elsif @search
|
80
|
+
each_sub base: @search,
|
81
|
+
query: -> { @nc.search @search.payload.merge(@query.query_json) },
|
82
|
+
create_object: ->(json) { Base.create_from_json json },
|
83
|
+
&block
|
77
84
|
end
|
78
85
|
self
|
79
86
|
end
|
@@ -53,7 +53,10 @@ module NotionRubyMapping
|
|
53
53
|
# @return [NotionRubyMapping::Database, String]
|
54
54
|
# @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#e3f1d21e0f724f589e48431468772eed
|
55
55
|
def create_child_database(title, *assigns, dry_run: false)
|
56
|
-
|
56
|
+
db = Database.new json: {"title" => [TextObject.new(title).property_values_json]},
|
57
|
+
assign: assigns, parent: {"type" => "page_id", "page_id" => @id}
|
58
|
+
yield db, db.properties if block_given?
|
59
|
+
db.save dry_run: dry_run
|
57
60
|
end
|
58
61
|
|
59
62
|
# @return [String] title
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NotionRubyMapping
|
4
|
+
class Mermaid
|
5
|
+
# @param [String] full_text
|
6
|
+
def initialize(full_text)
|
7
|
+
@lines = full_text.split "\n"
|
8
|
+
@databases = Hash.new {}
|
9
|
+
parse_text
|
10
|
+
end
|
11
|
+
attr_reader :lines, :databases
|
12
|
+
|
13
|
+
def parse_text
|
14
|
+
return unless @lines.shift =~ /^erDiagram/
|
15
|
+
|
16
|
+
until @lines.empty?
|
17
|
+
case @lines.shift
|
18
|
+
when / *(\w+) *[|}][|o]--[o|][|{] *(\w+) *: *"(.*)" */
|
19
|
+
db_or_create(Regexp.last_match(1)).append_relation db_or_create(Regexp.last_match(2)), Regexp.last_match(3)
|
20
|
+
when / *(\w+) *{ */
|
21
|
+
append_db_with_attributes Regexp.last_match(1)
|
22
|
+
else
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def db_or_create(db_name)
|
29
|
+
@databases[db_name] ||= MermaidDatabase.new db_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def append_db_with_attributes(db_name)
|
33
|
+
db = db_or_create db_name
|
34
|
+
until @lines.empty?
|
35
|
+
case @lines.shift
|
36
|
+
when /^ *} *$/
|
37
|
+
break
|
38
|
+
when /^ *Database +title +"(.*)" *$/
|
39
|
+
db.name = Regexp.last_match(1)
|
40
|
+
when /^ *([^ ]+) +[^ ]+ +"(.*)" *$/
|
41
|
+
db.add_property Regexp.last_match(1), Regexp.last_match(2)
|
42
|
+
when /^ *([^ ]+) +([^ ]+) *$/
|
43
|
+
db.add_property Regexp.last_match(1), Regexp.last_match(2)
|
44
|
+
else
|
45
|
+
nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def attach_database(db)
|
51
|
+
@databases.values.select { |mdb| mdb.name == db.database_title.full_text }.first&.attach_database(db)
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_notion_db(target_page, inline)
|
55
|
+
@databases.values.each do |mdb|
|
56
|
+
mdb.create_notion_db(target_page, inline) unless mdb.real_db
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def update_databases
|
61
|
+
@databases.each_value(&:update_database)
|
62
|
+
end
|
63
|
+
|
64
|
+
def rename_reverse_name
|
65
|
+
@databases.each_value(&:rename_reverse_name)
|
66
|
+
end
|
67
|
+
|
68
|
+
def update_rollup
|
69
|
+
@databases.each_value(&:update_rollup)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
module NotionRubyMapping
|
2
|
+
class MermaidDatabase
|
3
|
+
|
4
|
+
def initialize(key)
|
5
|
+
@key = key
|
6
|
+
@name = key
|
7
|
+
@title = nil
|
8
|
+
@properties = {}
|
9
|
+
@relations = {}
|
10
|
+
@real_db = nil
|
11
|
+
@reverse_name_queue = {}
|
12
|
+
end
|
13
|
+
attr_reader :properties, :relations, :real_db, :title
|
14
|
+
attr_accessor :name
|
15
|
+
|
16
|
+
def add_property(key, value)
|
17
|
+
if key == "title"
|
18
|
+
@title = value
|
19
|
+
else
|
20
|
+
@properties[value] = key
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def append_relation(other, relation)
|
25
|
+
@relations[relation] = other
|
26
|
+
end
|
27
|
+
|
28
|
+
def attach_database(db)
|
29
|
+
@real_db = db
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param [NotionRubyMapping::Page] target_page
|
33
|
+
def create_notion_db(target_page, inline)
|
34
|
+
unless @title
|
35
|
+
print "Database must have a title property"
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
@real_db = target_page.create_child_database(@name, TitleProperty, @title) do |d, _|
|
39
|
+
d.is_inline = inline
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_properties
|
44
|
+
ps = @real_db.properties
|
45
|
+
title_property = ps.select { |p| p.is_a? TitleProperty }.first
|
46
|
+
title_property.new_name = @title unless title_property.name == @title
|
47
|
+
@properties.each do |(value, key)|
|
48
|
+
name, *options = value.split("|")
|
49
|
+
property = ps.values_at(name).first
|
50
|
+
case key
|
51
|
+
when /checkbox|created_by|created_time|date|email|files|last_edited_by|last_edited_time|people|phone_number|text|url|status/
|
52
|
+
klass = {
|
53
|
+
checkbox: CheckboxProperty, created_by: CreatedByProperty, created_time: CreatedTimeProperty,
|
54
|
+
date: DateProperty, email: EmailProperty, files: FilesProperty, last_edited_by: LastEditedByProperty,
|
55
|
+
last_edited_time: LastEditedTimeProperty, people: PeopleProperty, phone_number: PhoneNumberProperty,
|
56
|
+
rich_text: RichTextProperty, url: UrlProperty, status: StatusProperty
|
57
|
+
}[key.to_sym]
|
58
|
+
@real_db.add_property klass, name unless property
|
59
|
+
when "formula"
|
60
|
+
f_e = options.first&.gsub "@", '"'
|
61
|
+
if property
|
62
|
+
property.formula_expression = f_e unless property.formula_expression == f_e
|
63
|
+
else
|
64
|
+
@real_db.add_property(FormulaProperty, name) { |dp| dp.formula_expression = f_e }
|
65
|
+
end
|
66
|
+
when "multi_select"
|
67
|
+
if property
|
68
|
+
(options - (property.multi_select_options.map { |h| h["name"] })).each do |select_name|
|
69
|
+
property.add_multi_select_option name: select_name, color: "default"
|
70
|
+
end
|
71
|
+
else
|
72
|
+
@real_db.add_property(MultiSelectProperty, name) do |dp|
|
73
|
+
options.each do |select_name|
|
74
|
+
dp.add_multi_select_option name: select_name, color: "default"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
when "number"
|
79
|
+
format_value = options.empty? ? "number" : options.first
|
80
|
+
if property
|
81
|
+
property.format = format_value unless property.format == format_value
|
82
|
+
else
|
83
|
+
@real_db.add_property(NumberProperty, name) { |p| p.format = format_value }
|
84
|
+
end
|
85
|
+
when "select"
|
86
|
+
if property
|
87
|
+
(options - (property.select_options.map { |h| h["name"] })).each do |select_name|
|
88
|
+
property.add_select_option name: select_name, color: "default"
|
89
|
+
end
|
90
|
+
else
|
91
|
+
@real_db.add_property(SelectProperty, name) do |dp|
|
92
|
+
options.each do |select_name|
|
93
|
+
dp.add_select_option name: select_name, color: "default"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
else
|
98
|
+
nil
|
99
|
+
end
|
100
|
+
end
|
101
|
+
@relations.each do |value, relation_db|
|
102
|
+
db_id = relation_db.real_db.id
|
103
|
+
forward, reverse = value.split "|"
|
104
|
+
property = ps.values_at(forward).first
|
105
|
+
if property
|
106
|
+
if reverse
|
107
|
+
next if property.database_id == db_id && property.synced_property_name == reverse
|
108
|
+
|
109
|
+
property.replace_relation_database database_id: db_id
|
110
|
+
relation_db.append_reverse_name_queue self, forward, reverse
|
111
|
+
else
|
112
|
+
next if property.database_id == db_id
|
113
|
+
|
114
|
+
property.replace_relation_database database_id: db_id, type: "single_property"
|
115
|
+
end
|
116
|
+
else
|
117
|
+
@real_db.add_property(RelationProperty, forward) do |p|
|
118
|
+
if reverse
|
119
|
+
p.replace_relation_database database_id: relation_db.real_db.id
|
120
|
+
relation_db.append_reverse_name_queue self, forward, reverse
|
121
|
+
else
|
122
|
+
p.replace_relation_database database_id: relation_db.real_db.id, type: "single_property"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
@real_db.property_schema_json
|
128
|
+
end
|
129
|
+
|
130
|
+
def append_reverse_name_queue(other_db, forward, reverse)
|
131
|
+
@reverse_name_queue[reverse] = [other_db, forward]
|
132
|
+
end
|
133
|
+
|
134
|
+
def update_database
|
135
|
+
update_properties
|
136
|
+
@real_db.save
|
137
|
+
end
|
138
|
+
|
139
|
+
def rename_reverse_name
|
140
|
+
save = false
|
141
|
+
@reverse_name_queue.each do |reverse, (other_db, forward)|
|
142
|
+
frp = other_db.real_db.properties[forward]
|
143
|
+
rp_id = frp.synced_property_id
|
144
|
+
rrp = @real_db.properties.filter { |pp| pp.property_id == rp_id }.first
|
145
|
+
if rrp && rrp.name != reverse
|
146
|
+
rrp.new_name = reverse
|
147
|
+
save = true
|
148
|
+
end
|
149
|
+
end
|
150
|
+
@real_db.save if save
|
151
|
+
end
|
152
|
+
|
153
|
+
def update_rollup_schema
|
154
|
+
ps = @real_db.properties
|
155
|
+
@properties.each do |(value, key)|
|
156
|
+
next unless key == "rollup"
|
157
|
+
|
158
|
+
name, *options = value.split("|")
|
159
|
+
property = ps.values_at(name).first
|
160
|
+
|
161
|
+
relation_name, rollup_name, function = options
|
162
|
+
if property
|
163
|
+
property.function = function unless property.function == function
|
164
|
+
property.relation_property_name = relation_name unless property.relation_property_name == relation_name
|
165
|
+
property.rollup_property_name = rollup_name unless property.rollup_property_name == rollup_name
|
166
|
+
else
|
167
|
+
@real_db.add_property(RollupProperty, name) do |dp|
|
168
|
+
dp.function = function
|
169
|
+
dp.relation_property_name = relation_name
|
170
|
+
dp.rollup_property_name = rollup_name
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
@real_db.property_schema_json
|
175
|
+
end
|
176
|
+
|
177
|
+
def update_rollup
|
178
|
+
update_rollup_schema
|
179
|
+
@real_db.save
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -262,6 +262,14 @@ module NotionRubyMapping
|
|
262
262
|
response.body
|
263
263
|
end
|
264
264
|
|
265
|
+
def search(query)
|
266
|
+
request(:post, search_path, options = query)
|
267
|
+
end
|
268
|
+
|
269
|
+
def search_path
|
270
|
+
"v1/search"
|
271
|
+
end
|
272
|
+
|
265
273
|
def update_block_request(block_id, payload)
|
266
274
|
request :patch, block_path(block_id), payload
|
267
275
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module NotionRubyMapping
|
2
|
+
class Search
|
3
|
+
|
4
|
+
def initialize(ascending: false, database_only: false, page_only: false, query: nil)
|
5
|
+
@ascending = ascending
|
6
|
+
@database_only = database_only
|
7
|
+
@page_only = page_only
|
8
|
+
@query = query
|
9
|
+
end
|
10
|
+
|
11
|
+
def exec(dry_run: false)
|
12
|
+
if dry_run
|
13
|
+
Base.dry_run_script :post, NotionCache.instance.search_path, payload
|
14
|
+
else
|
15
|
+
response = NotionCache.instance.search payload
|
16
|
+
List.new json: response, type: :search, value: self, query: Query.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def payload
|
21
|
+
ans = {}
|
22
|
+
ans["sort"] = {"direction" => "ascending", "timestamp" => "last_edited_time"} if @ascending
|
23
|
+
ans["filter"] = {"value" => "database", "property" => "object" } if @database_only
|
24
|
+
ans["filter"] = {"value" => "page", "property" => "object" } if @page_only
|
25
|
+
ans["query"] = @query if @query
|
26
|
+
ans
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -143,12 +143,10 @@ module NotionRubyMapping
|
|
143
143
|
# @param [Object] value query value
|
144
144
|
# @return [NotionRubyMapping::Query] generated Query object
|
145
145
|
def make_filter_query(key, value, condition: nil, another_type: nil)
|
146
|
-
if
|
147
|
-
Query.new filter: {"property" => @name,
|
148
|
-
elsif condition
|
149
|
-
Query.new filter: {"property" => @name, condition => {another_type => {key => value}}}
|
146
|
+
if condition
|
147
|
+
Query.new filter: {"property" => @name, type => {condition => {another_type => {key => value}}}}
|
150
148
|
elsif another_type
|
151
|
-
Query.new filter: {"property" => @name, another_type => {key => value}}
|
149
|
+
Query.new filter: {"property" => @name, type => {another_type => {key => value}}}
|
152
150
|
elsif @name == "__timestamp__"
|
153
151
|
Query.new filter: {"timestamp" => type, type => {key => value}}
|
154
152
|
else
|
@@ -54,12 +54,13 @@ module NotionRubyMapping
|
|
54
54
|
# @param [String] database_id
|
55
55
|
# @param [String] synced_property_name
|
56
56
|
# @see https://www.notion.so/hkob/RelationProperty-f608ab41a1f0476b98456620346fba03#7f5029fb7f6e4c009f22888b233e6f64
|
57
|
-
def replace_relation_database(database_id: nil, type: "dual_property"
|
57
|
+
def replace_relation_database(database_id: nil, type: "dual_property")
|
58
58
|
assert_database_property __method__
|
59
59
|
@will_update = true
|
60
60
|
@json["database_id"] = database_id if database_id
|
61
61
|
@json["type"] = type
|
62
|
-
@json[
|
62
|
+
@json[type] = {}
|
63
|
+
@json.delete type == "dual_property" ? "single_property" : "dual_property"
|
63
64
|
@json
|
64
65
|
end
|
65
66
|
|
@@ -96,6 +97,18 @@ module NotionRubyMapping
|
|
96
97
|
ans
|
97
98
|
end
|
98
99
|
|
100
|
+
def database_id
|
101
|
+
@json["database_id"]
|
102
|
+
end
|
103
|
+
|
104
|
+
def synced_property_id
|
105
|
+
@json["type"] == "dual_property" ? @json["dual_property"]["synced_property_id"] : nil
|
106
|
+
end
|
107
|
+
|
108
|
+
def synced_property_name
|
109
|
+
@json["type"] == "dual_property" ? @json["dual_property"]["synced_property_name"] : nil
|
110
|
+
end
|
111
|
+
|
99
112
|
# @return [Hash] created json
|
100
113
|
def property_values_json
|
101
114
|
assert_page_property __method__
|
@@ -113,7 +126,7 @@ module NotionRubyMapping
|
|
113
126
|
|
114
127
|
# @return [Hash]
|
115
128
|
def property_schema_json_sub
|
116
|
-
|
129
|
+
@json
|
117
130
|
end
|
118
131
|
end
|
119
132
|
end
|
@@ -43,13 +43,13 @@ module NotionRubyMapping
|
|
43
43
|
# @return [FalseClass]
|
44
44
|
def clear_will_update
|
45
45
|
super
|
46
|
-
@text_objects.clear_will_update
|
46
|
+
@text_objects.clear_will_update if page?
|
47
47
|
false
|
48
48
|
end
|
49
49
|
|
50
50
|
# @return [TrueClass, FalseClass] will update?
|
51
51
|
def will_update
|
52
|
-
@will_update || page? && @text_objects.will_update
|
52
|
+
@will_update || (page? && @text_objects.will_update)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/notion_ruby_mapping.rb
CHANGED
@@ -12,7 +12,8 @@ require_relative "notion_ruby_mapping/version"
|
|
12
12
|
link_preview_block link_to_page_block numbered_list_item_block paragraph_block pdf_block quote_block
|
13
13
|
synced_block table_block table_row_block table_of_contents_block template_block to_do_block
|
14
14
|
toggle_block video_block],
|
15
|
-
controllers: %w[notion_cache payload property_cache query rich_text_array discussion_thread
|
15
|
+
controllers: %w[notion_cache payload property_cache query rich_text_array discussion_thread search mermaid
|
16
|
+
mermaid_database],
|
16
17
|
objects: %w[rich_text_object emoji_object equation_object file_object mention_object text_object user_object
|
17
18
|
comment_object],
|
18
19
|
properties: %w[property checkbox_property multi_property created_by_property date_base_property created_time_property
|
@@ -32,4 +33,3 @@ module NotionRubyMapping
|
|
32
33
|
end
|
33
34
|
module_function :configure
|
34
35
|
end
|
35
|
-
|
data/notion_ruby_mapping.gemspec
CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency "rake"
|
43
43
|
spec.add_development_dependency "rspec"
|
44
44
|
spec.add_development_dependency "rubocop"
|
45
|
+
spec.add_development_dependency "rubocop-rspec"
|
45
46
|
spec.add_development_dependency "webmock"
|
46
47
|
|
47
48
|
# For more information and examples about making a new gem, check out our
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_ruby_mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki KOBAYASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: webmock
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +140,7 @@ description: Mapping tool from Notion Database/Page/Block to Ruby Objects.
|
|
126
140
|
email:
|
127
141
|
- hkob@metro-cit.ac.jp
|
128
142
|
executables:
|
143
|
+
- erdToNotionDb.rb
|
129
144
|
- notionErDiagram.rb
|
130
145
|
- notionSitemap.rb
|
131
146
|
extensions: []
|
@@ -146,6 +161,7 @@ files:
|
|
146
161
|
- examples/change_title.md
|
147
162
|
- examples/renumbering_pages.md
|
148
163
|
- examples/set_icon_to_all_icon_unsettled_pages.md
|
164
|
+
- exe/erdToNotionDb.rb
|
149
165
|
- exe/notionErDiagram.rb
|
150
166
|
- exe/notionSitemap.rb
|
151
167
|
- images/post_set_icon.png
|
@@ -197,11 +213,14 @@ files:
|
|
197
213
|
- lib/notion_ruby_mapping/blocks/url_caption_base_block.rb
|
198
214
|
- lib/notion_ruby_mapping/blocks/video_block.rb
|
199
215
|
- lib/notion_ruby_mapping/controllers/discussion_thread.rb
|
216
|
+
- lib/notion_ruby_mapping/controllers/mermaid.rb
|
217
|
+
- lib/notion_ruby_mapping/controllers/mermaid_database.rb
|
200
218
|
- lib/notion_ruby_mapping/controllers/notion_cache.rb
|
201
219
|
- lib/notion_ruby_mapping/controllers/payload.rb
|
202
220
|
- lib/notion_ruby_mapping/controllers/property_cache.rb
|
203
221
|
- lib/notion_ruby_mapping/controllers/query.rb
|
204
222
|
- lib/notion_ruby_mapping/controllers/rich_text_array.rb
|
223
|
+
- lib/notion_ruby_mapping/controllers/search.rb
|
205
224
|
- lib/notion_ruby_mapping/objects/comment_object.rb
|
206
225
|
- lib/notion_ruby_mapping/objects/emoji_object.rb
|
207
226
|
- lib/notion_ruby_mapping/objects/equation_object.rb
|
@@ -257,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
276
|
- !ruby/object:Gem::Version
|
258
277
|
version: '0'
|
259
278
|
requirements: []
|
260
|
-
rubygems_version: 3.
|
279
|
+
rubygems_version: 3.4.5
|
261
280
|
signing_key:
|
262
281
|
specification_version: 4
|
263
282
|
summary: Notion Ruby mapping tool
|