cortexdb-connectors 0.2.7__tar.gz → 0.2.8__tar.gz
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.
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/PKG-INFO +1 -1
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/__init__.py +40 -40
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/base.py +17 -8
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/cli.py +584 -584
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/confluence/__init__.py +359 -359
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/discord/__init__.py +646 -646
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/gitlab/__init__.py +749 -749
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/hubspot/__init__.py +489 -489
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/intercom/__init__.py +631 -631
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/linear/__init__.py +705 -705
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/pagerduty/__init__.py +298 -298
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/salesforce/__init__.py +399 -399
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/servicenow/__init__.py +460 -460
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/state.py +145 -145
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/teams/__init__.py +656 -656
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/webhooks.py +940 -940
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/zendesk/__init__.py +496 -496
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/PKG-INFO +1 -1
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/pyproject.toml +87 -87
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_base.py +416 -367
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_slack.py +294 -294
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/README.md +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/freshdesk/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/github/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/google_workspace/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/insights/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/insights/api.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/insights/detectors.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/insights/engine.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/jira/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/notion/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/slack/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/tldv/__init__.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors/worker.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/SOURCES.txt +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/dependency_links.txt +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/entry_points.txt +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/requires.txt +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/cortexdb_connectors.egg-info/top_level.txt +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/setup.cfg +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_connector_coverage.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_github.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_ingest_e2e.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_streaming_cursor.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_webhooks.py +0 -0
- {cortexdb_connectors-0.2.7 → cortexdb_connectors-0.2.8}/tests/test_webhooks_replay.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cortexdb-connectors
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: Data connectors for CortexDB — ingest from Slack, GitHub, GitLab, Jira, Linear, Confluence, Notion, PagerDuty, Discord, Teams, Google Workspace, Salesforce, HubSpot, Zendesk, Intercom, and ServiceNow into the v1 memory API.
|
|
5
5
|
Author-email: CortexDB Team <team@cortexdb.ai>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"""cortexdb_connectors — data connector SDK for the CortexDB v1 API.
|
|
2
|
-
|
|
3
|
-
Each connector subclass implements `fetch_events`, `normalize`, and
|
|
4
|
-
`map_permissions`; the base class POSTs every normalised Episode to
|
|
5
|
-
`/v1/experience` with the required Authorization + X-Cortex-Actor
|
|
6
|
-
headers. Use the `cortexdb-sync` CLI to run a connector once or in a
|
|
7
|
-
poll loop; or `from cortexdb_connectors.slack import SlackConnector`
|
|
8
|
-
to drive it programmatically.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
__version__ = "0.2.
|
|
12
|
-
|
|
13
|
-
from cortexdb_connectors.base import (
|
|
14
|
-
Actor,
|
|
15
|
-
CortexConnector,
|
|
16
|
-
EntityRef,
|
|
17
|
-
Episode,
|
|
18
|
-
EpisodeType,
|
|
19
|
-
RawEvent,
|
|
20
|
-
Source,
|
|
21
|
-
SyncResult,
|
|
22
|
-
SyncState,
|
|
23
|
-
Visibility,
|
|
24
|
-
VisibilityLevel,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
__all__ = [
|
|
28
|
-
"__version__",
|
|
29
|
-
"Actor",
|
|
30
|
-
"CortexConnector",
|
|
31
|
-
"EntityRef",
|
|
32
|
-
"Episode",
|
|
33
|
-
"EpisodeType",
|
|
34
|
-
"RawEvent",
|
|
35
|
-
"Source",
|
|
36
|
-
"SyncResult",
|
|
37
|
-
"SyncState",
|
|
38
|
-
"Visibility",
|
|
39
|
-
"VisibilityLevel",
|
|
40
|
-
]
|
|
1
|
+
"""cortexdb_connectors — data connector SDK for the CortexDB v1 API.
|
|
2
|
+
|
|
3
|
+
Each connector subclass implements `fetch_events`, `normalize`, and
|
|
4
|
+
`map_permissions`; the base class POSTs every normalised Episode to
|
|
5
|
+
`/v1/experience` with the required Authorization + X-Cortex-Actor
|
|
6
|
+
headers. Use the `cortexdb-sync` CLI to run a connector once or in a
|
|
7
|
+
poll loop; or `from cortexdb_connectors.slack import SlackConnector`
|
|
8
|
+
to drive it programmatically.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
__version__ = "0.2.8"
|
|
12
|
+
|
|
13
|
+
from cortexdb_connectors.base import (
|
|
14
|
+
Actor,
|
|
15
|
+
CortexConnector,
|
|
16
|
+
EntityRef,
|
|
17
|
+
Episode,
|
|
18
|
+
EpisodeType,
|
|
19
|
+
RawEvent,
|
|
20
|
+
Source,
|
|
21
|
+
SyncResult,
|
|
22
|
+
SyncState,
|
|
23
|
+
Visibility,
|
|
24
|
+
VisibilityLevel,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"__version__",
|
|
29
|
+
"Actor",
|
|
30
|
+
"CortexConnector",
|
|
31
|
+
"EntityRef",
|
|
32
|
+
"Episode",
|
|
33
|
+
"EpisodeType",
|
|
34
|
+
"RawEvent",
|
|
35
|
+
"Source",
|
|
36
|
+
"SyncResult",
|
|
37
|
+
"SyncState",
|
|
38
|
+
"Visibility",
|
|
39
|
+
"VisibilityLevel",
|
|
40
|
+
]
|
|
@@ -13,6 +13,7 @@ from __future__ import annotations
|
|
|
13
13
|
import hashlib
|
|
14
14
|
import logging
|
|
15
15
|
import os
|
|
16
|
+
import re
|
|
16
17
|
import uuid
|
|
17
18
|
from abc import ABC, abstractmethod
|
|
18
19
|
from dataclasses import dataclass, field
|
|
@@ -24,6 +25,11 @@ DEFAULT_API_URL = "https://api-v1.cortexdb.ai"
|
|
|
24
25
|
|
|
25
26
|
logger = logging.getLogger("cortexdb_connectors")
|
|
26
27
|
|
|
28
|
+
# v1 ActorRef grammar (server: cortex-types identity.rs): `kind:local` where
|
|
29
|
+
# kind ∈ _ACTOR_KINDS and local matches [A-Za-z0-9_.@-]+ (no colons!).
|
|
30
|
+
_ACTOR_KINDS = frozenset({"user", "agent", "service", "system"})
|
|
31
|
+
_ACTOR_LOCAL_ILLEGAL = re.compile(r"[^A-Za-z0-9_.@-]")
|
|
32
|
+
|
|
27
33
|
# Hard ceiling on content size sent to the server. Real items never approach
|
|
28
34
|
# this; it exists only to stop a pathological payload from exceeding the request
|
|
29
35
|
# body limit. When it trips we truncate on a UTF-8 boundary and log LOUDLY — we
|
|
@@ -376,14 +382,17 @@ class CortexConnector(ABC):
|
|
|
376
382
|
),
|
|
377
383
|
}
|
|
378
384
|
if episode.actor and episode.actor.id:
|
|
379
|
-
#
|
|
380
|
-
#
|
|
381
|
-
#
|
|
382
|
-
#
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
# Source actor ids are not guaranteed bare: Jira Cloud accountIds
|
|
386
|
+
# are `712020:<uuid>`, so a colon does NOT mean the connector
|
|
387
|
+
# already supplied a kind. Treat the prefix as a kind only when it
|
|
388
|
+
# is one the server accepts; otherwise the whole source id is the
|
|
389
|
+
# local part under `user:`, sanitized to the server's charset
|
|
390
|
+
# (which forbids ':' anywhere in the local part).
|
|
391
|
+
kind, sep, local = episode.actor.id.partition(":")
|
|
392
|
+
if not sep or kind not in _ACTOR_KINDS or not local:
|
|
393
|
+
kind, local = "user", episode.actor.id
|
|
394
|
+
local = _ACTOR_LOCAL_ILLEGAL.sub("_", local)
|
|
395
|
+
envelope["observed_actor"] = {"id": f"{kind}:{local}"}
|
|
387
396
|
|
|
388
397
|
return envelope
|
|
389
398
|
|