better-notion 2.1.0__py3-none-any.whl → 2.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- better_notion/utils/agents/schemas.py +10 -2
- better_notion/utils/agents/workspace.py +90 -5
- {better_notion-2.1.0.dist-info → better_notion-2.1.1.dist-info}/METADATA +1 -1
- {better_notion-2.1.0.dist-info → better_notion-2.1.1.dist-info}/RECORD +7 -7
- {better_notion-2.1.0.dist-info → better_notion-2.1.1.dist-info}/WHEEL +0 -0
- {better_notion-2.1.0.dist-info → better_notion-2.1.1.dist-info}/entry_points.txt +0 -0
- {better_notion-2.1.0.dist-info → better_notion-2.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -458,8 +458,10 @@ class TaskSchema:
|
|
|
458
458
|
SelectOption.option("Low", "blue"),
|
|
459
459
|
],
|
|
460
460
|
),
|
|
461
|
-
#
|
|
462
|
-
|
|
461
|
+
# Dependencies: Self-referential relation (will be updated after database creation)
|
|
462
|
+
"Dependencies": PropertyBuilder.relation("Dependencies", dual_property=False),
|
|
463
|
+
# Related Work Issue: Relation to Work Issues (will be updated after database creation)
|
|
464
|
+
"Related Work Issue": PropertyBuilder.relation("Related Work Issue", dual_property=False),
|
|
463
465
|
"Estimated Hours": PropertyBuilder.number("Estimated Hours"),
|
|
464
466
|
"Actual Hours": PropertyBuilder.number("Actual Hours"),
|
|
465
467
|
"Assignee": PropertyBuilder.people("Assignee"),
|
|
@@ -557,6 +559,10 @@ class WorkIssueSchema:
|
|
|
557
559
|
"Proposed Solution": PropertyBuilder.text("Proposed Solution"),
|
|
558
560
|
"Related Idea": PropertyBuilder.relation("Related Idea", dual_property=False),
|
|
559
561
|
"Fix Tasks": PropertyBuilder.relation("Fix Tasks", dual_property=False),
|
|
562
|
+
# Blocking Tasks: Tasks blocked by this work issue (will be updated after database creation)
|
|
563
|
+
"Blocking Tasks": PropertyBuilder.relation("Blocking Tasks", dual_property=False),
|
|
564
|
+
# Caused Incidents: Incidents caused by this work issue (will be updated after database creation)
|
|
565
|
+
"Caused Incidents": PropertyBuilder.relation("Caused Incidents", dual_property=False),
|
|
560
566
|
}
|
|
561
567
|
|
|
562
568
|
|
|
@@ -599,6 +605,8 @@ class IncidentSchema:
|
|
|
599
605
|
],
|
|
600
606
|
),
|
|
601
607
|
"Fix Task": PropertyBuilder.relation("Fix Task", dual_property=False),
|
|
608
|
+
# Root Cause Work Issue: Relation to Work Issues (will be updated after database creation)
|
|
609
|
+
"Root Cause Work Issue": PropertyBuilder.relation("Root Cause Work Issue", dual_property=False),
|
|
602
610
|
"Root Cause": PropertyBuilder.text("Root Cause"),
|
|
603
611
|
"Detected Date": PropertyBuilder.date("Detected Date"),
|
|
604
612
|
"Resolved Date": PropertyBuilder.date("Resolved Date"),
|
|
@@ -141,6 +141,9 @@ class WorkspaceInitializer:
|
|
|
141
141
|
logger.error(error_msg)
|
|
142
142
|
raise Exception(error_msg) from e
|
|
143
143
|
|
|
144
|
+
# Update cross-database relations that require both databases to exist
|
|
145
|
+
await self._update_cross_database_relations()
|
|
146
|
+
|
|
144
147
|
# Save workspace metadata
|
|
145
148
|
self.save_database_ids()
|
|
146
149
|
|
|
@@ -340,13 +343,95 @@ class WorkspaceInitializer:
|
|
|
340
343
|
Note: The database was created with placeholder relations.
|
|
341
344
|
This method updates them to point to themselves.
|
|
342
345
|
"""
|
|
343
|
-
# Get the database
|
|
346
|
+
# Get the current database schema
|
|
344
347
|
db = await self._client.databases.get(database_id)
|
|
345
348
|
|
|
346
|
-
# Update Dependencies
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
349
|
+
# Update the Dependencies relation to point to itself
|
|
350
|
+
schema = db.schema
|
|
351
|
+
if "Dependencies" in schema:
|
|
352
|
+
schema["Dependencies"]["relation"]["database_id"] = database_id
|
|
353
|
+
|
|
354
|
+
# Update the database schema via API
|
|
355
|
+
await self._client._api._request(
|
|
356
|
+
"PATCH",
|
|
357
|
+
f"/databases/{database_id}",
|
|
358
|
+
json={"properties": schema}
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
logger.info(f"Updated self-referential relations for Tasks database {database_id}")
|
|
362
|
+
|
|
363
|
+
async def _update_cross_database_relations(self) -> None:
|
|
364
|
+
"""Update cross-database relations after all databases are created.
|
|
365
|
+
|
|
366
|
+
This updates:
|
|
367
|
+
- Tasks: Related Work Issue -> Work Issues
|
|
368
|
+
- Work Issues: Blocking Tasks -> Tasks
|
|
369
|
+
- Work Issues: Caused Incidents -> Incidents
|
|
370
|
+
- Incidents: Root Cause Work Issue -> Work Issues
|
|
371
|
+
"""
|
|
372
|
+
if "tasks" in self._database_ids:
|
|
373
|
+
await self._update_relation(
|
|
374
|
+
self._database_ids["tasks"],
|
|
375
|
+
"Related Work Issue",
|
|
376
|
+
self._database_ids.get("work_issues")
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
if "work_issues" in self._database_ids:
|
|
380
|
+
await self._update_relation(
|
|
381
|
+
self._database_ids["work_issues"],
|
|
382
|
+
"Blocking Tasks",
|
|
383
|
+
self._database_ids.get("tasks")
|
|
384
|
+
)
|
|
385
|
+
await self._update_relation(
|
|
386
|
+
self._database_ids["work_issues"],
|
|
387
|
+
"Caused Incidents",
|
|
388
|
+
self._database_ids.get("incidents")
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
if "incidents" in self._database_ids:
|
|
392
|
+
await self._update_relation(
|
|
393
|
+
self._database_ids["incidents"],
|
|
394
|
+
"Root Cause Work Issue",
|
|
395
|
+
self._database_ids.get("work_issues")
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
logger.info("Updated all cross-database relations")
|
|
399
|
+
|
|
400
|
+
async def _update_relation(
|
|
401
|
+
self,
|
|
402
|
+
database_id: str,
|
|
403
|
+
property_name: str,
|
|
404
|
+
target_database_id: Optional[str],
|
|
405
|
+
) -> None:
|
|
406
|
+
"""Update a relation property to point to the target database.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
database_id: Database to update
|
|
410
|
+
property_name: Name of the relation property
|
|
411
|
+
target_database_id: Target database ID (if None, skip update)
|
|
412
|
+
"""
|
|
413
|
+
if not target_database_id:
|
|
414
|
+
logger.warning(f"Skipping {property_name} update: target database not found")
|
|
415
|
+
return
|
|
416
|
+
|
|
417
|
+
# Get the current database schema
|
|
418
|
+
db = await self._client.databases.get(database_id)
|
|
419
|
+
schema = db.schema
|
|
420
|
+
|
|
421
|
+
# Update the relation property
|
|
422
|
+
if property_name in schema:
|
|
423
|
+
schema[property_name]["relation"]["database_id"] = target_database_id
|
|
424
|
+
|
|
425
|
+
# Update the database schema via API
|
|
426
|
+
await self._client._api._request(
|
|
427
|
+
"PATCH",
|
|
428
|
+
f"/databases/{database_id}",
|
|
429
|
+
json={"properties": schema}
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
logger.info(f"Updated {property_name} relation to {target_database_id}")
|
|
433
|
+
else:
|
|
434
|
+
logger.warning(f"Property {property_name} not found in database {database_id}")
|
|
350
435
|
|
|
351
436
|
def save_database_ids(self, path: Optional[Path] = None) -> None:
|
|
352
437
|
"""Save workspace metadata (database IDs and workspace info) to config file.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: better-notion
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: A high-level Python SDK for the Notion API with developer experience in mind.
|
|
5
5
|
Project-URL: Homepage, https://github.com/nesalia-inc/better-notion
|
|
6
6
|
Project-URL: Documentation, https://github.com/nesalia-inc/better-notion#readme
|
|
@@ -130,11 +130,11 @@ better_notion/utils/agents/dependency_resolver.py,sha256=PfHHDIQztGih4LwylMb0_My
|
|
|
130
130
|
better_notion/utils/agents/metadata.py,sha256=thQSXfYx9mWgmBud8HtlNTLr5SwH6E_O1AjSNSnMFoo,6614
|
|
131
131
|
better_notion/utils/agents/project_context.py,sha256=aJlzy5H2rL4sAfW2jHL_3K2VkBJ4ihUhCRVolkpuO78,7477
|
|
132
132
|
better_notion/utils/agents/rbac.py,sha256=8ZA8Y7wbOiVZDbpjpH7iC35SZrZ0jl4fcJ3xWCm3SsE,11820
|
|
133
|
-
better_notion/utils/agents/schemas.py,sha256=
|
|
133
|
+
better_notion/utils/agents/schemas.py,sha256=EpAEevoth-DGWepGMubRFjdvHfe7zrQxi9i4CHDvem8,22946
|
|
134
134
|
better_notion/utils/agents/state_machine.py,sha256=xUBEeDTbU1Xq-rsRo2sbr6AUYpYrV9DTHOtZT2cWES8,6699
|
|
135
|
-
better_notion/utils/agents/workspace.py,sha256
|
|
136
|
-
better_notion-2.1.
|
|
137
|
-
better_notion-2.1.
|
|
138
|
-
better_notion-2.1.
|
|
139
|
-
better_notion-2.1.
|
|
140
|
-
better_notion-2.1.
|
|
135
|
+
better_notion/utils/agents/workspace.py,sha256=-EzPLFPjaD9PCeLkSdu1ddRa9-RlHgFvLJ2qxFou7X8,19713
|
|
136
|
+
better_notion-2.1.1.dist-info/METADATA,sha256=5hImQwg_VfumZ1dMkCtz1QEWUtcYr8ywTvlPlREvnKE,11096
|
|
137
|
+
better_notion-2.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
138
|
+
better_notion-2.1.1.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
|
|
139
|
+
better_notion-2.1.1.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
|
|
140
|
+
better_notion-2.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|