|
1 | | -"""SignalsPlatform Protocol — covers ``signal-marketplace`` + ``signal-owned``. |
| 1 | +"""SignalsPlatform Protocols for marketplace and owned signals. |
2 | 2 |
|
3 | | -A platform claiming either ``signal-marketplace`` (third-party data |
4 | | -brokers — LiveRamp, Oracle Data Cloud, third-party DMPs) or |
5 | | -``signal-owned`` (first-party data providers — publisher first-party |
6 | | -data, retailer customer-graph) implements the methods on this Protocol. |
7 | | -The slugs mirror ``schemas/cache/enums/specialism.json``. |
| 3 | +``signal-marketplace`` covers marketplace/provisioned signals that need |
| 4 | +buyer-triggered destination activation. ``signal-owned`` covers |
| 5 | +publisher-owned first-party signals that are already usable on that |
| 6 | +seller inventory and only need catalog discovery. The slugs mirror |
| 7 | +``schemas/cache/enums/specialism.json``. |
8 | 8 |
|
9 | | -Two methods: |
| 9 | +Common method: |
10 | 10 |
|
11 | 11 | * :meth:`get_signals` — sync catalog discovery |
| 12 | +
|
| 13 | +Marketplace-only method: |
| 14 | +
|
12 | 15 | * :meth:`activate_signal` — sync provisioning onto destination platforms |
13 | 16 |
|
14 | 17 | Async story: ``activate_signal`` is sync at the wire level — its |
|
19 | 22 | ``ctx.publish_status_change(resource_type='signal', ...)`` events as |
20 | 23 | each deployment reaches ``activating`` / ``deployed`` / ``failed``. |
21 | 24 |
|
22 | | -Mirrors the JS-side ``SignalsPlatform`` interface at |
| 25 | +Mirrors the JS-side signals interfaces at |
23 | 26 | ``src/lib/server/decisioning/specialisms/signals.ts``. |
24 | 27 | """ |
25 | 28 |
|
|
41 | 44 |
|
42 | 45 | #: Per-platform metadata generic; matches ``RequestContext[TMeta]`` and |
43 | 46 | #: ``Account[TMeta]`` upstream so a platform parameterizing |
44 | | -#: ``SignalsPlatform[TenantMeta]`` gets ``ctx.account.metadata``-style |
45 | | -#: typed access inside method bodies. |
| 47 | +#: ``SignalsPlatform[TenantMeta]`` or |
| 48 | +#: ``OwnedSignalsPlatform[TenantMeta]`` gets |
| 49 | +#: ``ctx.account.metadata``-style typed access inside method bodies. |
46 | 50 | TMeta = TypeVar("TMeta", default=dict[str, Any]) |
47 | 51 |
|
48 | 52 |
|
49 | 53 | @runtime_checkable |
50 | | -class SignalsPlatform(Protocol, Generic[TMeta]): |
51 | | - """Catalog discovery + activation for marketplace / owned signals. |
| 54 | +class OwnedSignalsPlatform(Protocol, Generic[TMeta]): |
| 55 | + """Catalog discovery for seller-owned first-party signals. |
52 | 56 |
|
53 | 57 | Methods may be sync (return ``T`` directly) or async (return |
54 | 58 | ``Awaitable[T]``); the dispatch adapter detects via |
@@ -81,6 +85,17 @@ def get_signals( |
81 | 85 | """ |
82 | 86 | ... |
83 | 87 |
|
| 88 | + |
| 89 | +@runtime_checkable |
| 90 | +class SignalsPlatform(OwnedSignalsPlatform[TMeta], Protocol, Generic[TMeta]): |
| 91 | + """Catalog discovery + activation for marketplace/provisioned signals. |
| 92 | +
|
| 93 | + Use this Protocol for ``signal-marketplace``. Use |
| 94 | + :class:`OwnedSignalsPlatform` for ``signal-owned`` platforms where |
| 95 | + returned signals are already usable in later media-buy targeting and |
| 96 | + there is no buyer-triggered destination provisioning step. |
| 97 | + """ |
| 98 | + |
84 | 99 | def activate_signal( |
85 | 100 | self, |
86 | 101 | req: ActivateSignalRequest, |
@@ -111,4 +126,4 @@ def activate_signal( |
111 | 126 | ... |
112 | 127 |
|
113 | 128 |
|
114 | | -__all__ = ["SignalsPlatform"] |
| 129 | +__all__ = ["OwnedSignalsPlatform", "SignalsPlatform"] |
0 commit comments