@adcp/client 4.19.0 → 4.20.0
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.
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/registry/index.d.ts +81 -4
- package/dist/lib/registry/index.d.ts.map +1 -1
- package/dist/lib/registry/index.js +188 -3
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/sync.d.ts +126 -0
- package/dist/lib/registry/sync.d.ts.map +1 -0
- package/dist/lib/registry/sync.js +345 -0
- package/dist/lib/registry/sync.js.map +1 -0
- package/dist/lib/registry/types.d.ts +7 -1
- package/dist/lib/registry/types.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.d.ts +341 -0
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js +1 -1
- package/dist/lib/types/schemas.generated.d.ts +71 -63
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +26 -15
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/tools.generated.d.ts +66 -25
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import type { RegistryClient } from './index';
|
|
3
|
+
import type { CatalogEvent, AgentSearchResult, AuthorizationEntry } from './types.generated';
|
|
4
|
+
export interface RegistrySyncConfig {
|
|
5
|
+
/** RegistryClient instance to use for API calls. */
|
|
6
|
+
client: RegistryClient;
|
|
7
|
+
/** Polling interval in milliseconds. Default: 30000 (30s). */
|
|
8
|
+
pollIntervalMs?: number;
|
|
9
|
+
/** Choose which indexes to maintain. */
|
|
10
|
+
indexes?: {
|
|
11
|
+
/** Agent inventory profiles. Default: true. */
|
|
12
|
+
agents?: boolean;
|
|
13
|
+
/** Authorization entries (agent→domain mappings). Default: true. */
|
|
14
|
+
authorizations?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Called on errors during polling/bootstrap. */
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
}
|
|
19
|
+
export type RegistrySyncState = 'idle' | 'bootstrapping' | 'syncing' | 'error';
|
|
20
|
+
export interface RegistrySyncEvents {
|
|
21
|
+
bootstrap: [{
|
|
22
|
+
agentCount: number;
|
|
23
|
+
authorizationCount: number;
|
|
24
|
+
}];
|
|
25
|
+
sync: [{
|
|
26
|
+
cursor: string;
|
|
27
|
+
eventsApplied: number;
|
|
28
|
+
}];
|
|
29
|
+
/** Emitted for each event applied during polling. Not emitted during bootstrap. */
|
|
30
|
+
event: [{
|
|
31
|
+
event: CatalogEvent;
|
|
32
|
+
}];
|
|
33
|
+
error: [{
|
|
34
|
+
error: Error;
|
|
35
|
+
}];
|
|
36
|
+
stateChange: [{
|
|
37
|
+
from: RegistrySyncState;
|
|
38
|
+
to: RegistrySyncState;
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
export interface AgentFilter {
|
|
42
|
+
type?: string;
|
|
43
|
+
channels?: string[];
|
|
44
|
+
markets?: string[];
|
|
45
|
+
categories?: string[];
|
|
46
|
+
property_types?: string[];
|
|
47
|
+
tags?: string[];
|
|
48
|
+
delivery_types?: string[];
|
|
49
|
+
has_tmp?: boolean;
|
|
50
|
+
min_properties?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* In-memory replica of the AdCP registry.
|
|
54
|
+
*
|
|
55
|
+
* Bootstraps from the agent search endpoint, then polls the event feed
|
|
56
|
+
* to maintain up-to-date indexes for zero-latency lookups.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const client = new RegistryClient({ apiKey: 'sk_...' });
|
|
61
|
+
* const sync = new RegistrySync({ client });
|
|
62
|
+
* await sync.start();
|
|
63
|
+
*
|
|
64
|
+
* // Zero-latency lookups
|
|
65
|
+
* const agent = sync.getAgent('https://ads.example.com');
|
|
66
|
+
* const authorized = sync.isAuthorized('https://ads.example.com', 'publisher.com');
|
|
67
|
+
* const ctv = sync.findAgents({ channels: ['ctv'], markets: ['US'] });
|
|
68
|
+
*
|
|
69
|
+
* sync.on('event', ({ event }) => console.log('registry change:', event.event_type));
|
|
70
|
+
* sync.stop();
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare class RegistrySync extends EventEmitter<RegistrySyncEvents> {
|
|
74
|
+
private readonly client;
|
|
75
|
+
private readonly pollIntervalMs;
|
|
76
|
+
private readonly indexAgents;
|
|
77
|
+
private readonly indexAuthorizations;
|
|
78
|
+
private readonly errorHandler;
|
|
79
|
+
private _state;
|
|
80
|
+
private cursor;
|
|
81
|
+
private pollTimer;
|
|
82
|
+
private agents;
|
|
83
|
+
private authByDomain;
|
|
84
|
+
private authByAgent;
|
|
85
|
+
constructor(config: RegistrySyncConfig);
|
|
86
|
+
/** Bootstrap from the registry and begin polling the event feed. */
|
|
87
|
+
start(): Promise<void>;
|
|
88
|
+
/** Stop polling. In-memory state is preserved. */
|
|
89
|
+
stop(): void;
|
|
90
|
+
/** Stop, clear all state. Call start() again to re-bootstrap. */
|
|
91
|
+
reset(): Promise<void>;
|
|
92
|
+
/** Get an agent by URL. */
|
|
93
|
+
getAgent(url: string): AgentSearchResult | undefined;
|
|
94
|
+
/** Get all agents in the index. */
|
|
95
|
+
getAgents(): AgentSearchResult[];
|
|
96
|
+
/** Find agents matching a filter. All specified dimensions use AND; values within arrays use OR. */
|
|
97
|
+
findAgents(filter: AgentFilter): AgentSearchResult[];
|
|
98
|
+
/** Get all authorizations for a publisher domain. */
|
|
99
|
+
getAuthorizationsForDomain(domain: string): AuthorizationEntry[];
|
|
100
|
+
/** Get all authorizations for an agent. */
|
|
101
|
+
getAuthorizationsForAgent(agentUrl: string): AuthorizationEntry[];
|
|
102
|
+
/**
|
|
103
|
+
* Check if an agent has any authorization for a publisher domain.
|
|
104
|
+
* Does not evaluate property_id scoping, time bounds, or effective dates.
|
|
105
|
+
* For scoped checks, use getAuthorizationsForDomain() and inspect entries directly.
|
|
106
|
+
*/
|
|
107
|
+
isAuthorized(agentUrl: string, domain: string): boolean;
|
|
108
|
+
get state(): RegistrySyncState;
|
|
109
|
+
getCursor(): string | null;
|
|
110
|
+
getStats(): {
|
|
111
|
+
agents: number;
|
|
112
|
+
authorizations: number;
|
|
113
|
+
};
|
|
114
|
+
private bootstrap;
|
|
115
|
+
private schedulePoll;
|
|
116
|
+
private pollLoop;
|
|
117
|
+
private poll;
|
|
118
|
+
/**
|
|
119
|
+
* Drain all available feed pages. Used during bootstrap (does not emit 'event' per event).
|
|
120
|
+
*/
|
|
121
|
+
private drainFeed;
|
|
122
|
+
private applyEvent;
|
|
123
|
+
private clearIndexes;
|
|
124
|
+
private setState;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/lib/registry/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,MAAM,EAAE,cAAc,CAAC;IACvB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,OAAO,CAAC,EAAE;QACR,+CAA+C;QAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,oEAAoE;QACpE,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,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,QAAQ;CAMjB"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistrySync = void 0;
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
5
|
+
// ====== RegistrySync ======
|
|
6
|
+
/**
|
|
7
|
+
* In-memory replica of the AdCP registry.
|
|
8
|
+
*
|
|
9
|
+
* Bootstraps from the agent search endpoint, then polls the event feed
|
|
10
|
+
* to maintain up-to-date indexes for zero-latency lookups.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const client = new RegistryClient({ apiKey: 'sk_...' });
|
|
15
|
+
* const sync = new RegistrySync({ client });
|
|
16
|
+
* await sync.start();
|
|
17
|
+
*
|
|
18
|
+
* // Zero-latency lookups
|
|
19
|
+
* const agent = sync.getAgent('https://ads.example.com');
|
|
20
|
+
* const authorized = sync.isAuthorized('https://ads.example.com', 'publisher.com');
|
|
21
|
+
* const ctv = sync.findAgents({ channels: ['ctv'], markets: ['US'] });
|
|
22
|
+
*
|
|
23
|
+
* sync.on('event', ({ event }) => console.log('registry change:', event.event_type));
|
|
24
|
+
* sync.stop();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
class RegistrySync extends node_events_1.EventEmitter {
|
|
28
|
+
client;
|
|
29
|
+
pollIntervalMs;
|
|
30
|
+
indexAgents;
|
|
31
|
+
indexAuthorizations;
|
|
32
|
+
errorHandler;
|
|
33
|
+
_state = 'idle';
|
|
34
|
+
cursor = null;
|
|
35
|
+
pollTimer = null;
|
|
36
|
+
// Indexes
|
|
37
|
+
agents = new Map();
|
|
38
|
+
authByDomain = new Map();
|
|
39
|
+
authByAgent = new Map();
|
|
40
|
+
constructor(config) {
|
|
41
|
+
super();
|
|
42
|
+
this.client = config.client;
|
|
43
|
+
this.pollIntervalMs = config.pollIntervalMs ?? 30_000;
|
|
44
|
+
this.indexAgents = config.indexes?.agents !== false;
|
|
45
|
+
this.indexAuthorizations = config.indexes?.authorizations !== false;
|
|
46
|
+
this.errorHandler = config.onError;
|
|
47
|
+
}
|
|
48
|
+
// ====== Lifecycle ======
|
|
49
|
+
/** Bootstrap from the registry and begin polling the event feed. */
|
|
50
|
+
async start() {
|
|
51
|
+
if (this._state === 'syncing' || this._state === 'bootstrapping')
|
|
52
|
+
return;
|
|
53
|
+
await this.bootstrap();
|
|
54
|
+
this.schedulePoll();
|
|
55
|
+
}
|
|
56
|
+
/** Stop polling. In-memory state is preserved. */
|
|
57
|
+
stop() {
|
|
58
|
+
if (this.pollTimer) {
|
|
59
|
+
clearTimeout(this.pollTimer);
|
|
60
|
+
this.pollTimer = null;
|
|
61
|
+
}
|
|
62
|
+
if (this._state === 'syncing') {
|
|
63
|
+
this.setState('idle');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Stop, clear all state. Call start() again to re-bootstrap. */
|
|
67
|
+
async reset() {
|
|
68
|
+
this.stop();
|
|
69
|
+
this.clearIndexes();
|
|
70
|
+
this.cursor = null;
|
|
71
|
+
this.setState('idle');
|
|
72
|
+
}
|
|
73
|
+
// ====== Agent Lookups ======
|
|
74
|
+
/** Get an agent by URL. */
|
|
75
|
+
getAgent(url) {
|
|
76
|
+
return this.agents.get(url);
|
|
77
|
+
}
|
|
78
|
+
/** Get all agents in the index. */
|
|
79
|
+
getAgents() {
|
|
80
|
+
return [...this.agents.values()];
|
|
81
|
+
}
|
|
82
|
+
/** Find agents matching a filter. All specified dimensions use AND; values within arrays use OR. */
|
|
83
|
+
findAgents(filter) {
|
|
84
|
+
return this.getAgents().filter(agent => {
|
|
85
|
+
const p = agent.inventory_profile;
|
|
86
|
+
if (filter.type && agent.type !== filter.type)
|
|
87
|
+
return false;
|
|
88
|
+
if (filter.channels?.length && !filter.channels.some(c => p.channels.includes(c)))
|
|
89
|
+
return false;
|
|
90
|
+
if (filter.markets?.length && !filter.markets.some(m => p.markets.includes(m)))
|
|
91
|
+
return false;
|
|
92
|
+
if (filter.categories?.length && !filter.categories.some(c => p.categories.includes(c)))
|
|
93
|
+
return false;
|
|
94
|
+
if (filter.property_types?.length && !filter.property_types.some(t => p.property_types.includes(t)))
|
|
95
|
+
return false;
|
|
96
|
+
if (filter.tags?.length && !filter.tags.some(t => p.tags.includes(t)))
|
|
97
|
+
return false;
|
|
98
|
+
if (filter.delivery_types?.length && !filter.delivery_types.some(d => p.delivery_types.includes(d)))
|
|
99
|
+
return false;
|
|
100
|
+
if (filter.has_tmp != null && p.has_tmp !== filter.has_tmp)
|
|
101
|
+
return false;
|
|
102
|
+
if (filter.min_properties != null && p.property_count < filter.min_properties)
|
|
103
|
+
return false;
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// ====== Authorization Lookups ======
|
|
108
|
+
/** Get all authorizations for a publisher domain. */
|
|
109
|
+
getAuthorizationsForDomain(domain) {
|
|
110
|
+
return this.authByDomain.get(domain) ?? [];
|
|
111
|
+
}
|
|
112
|
+
/** Get all authorizations for an agent. */
|
|
113
|
+
getAuthorizationsForAgent(agentUrl) {
|
|
114
|
+
return this.authByAgent.get(agentUrl) ?? [];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if an agent has any authorization for a publisher domain.
|
|
118
|
+
* Does not evaluate property_id scoping, time bounds, or effective dates.
|
|
119
|
+
* For scoped checks, use getAuthorizationsForDomain() and inspect entries directly.
|
|
120
|
+
*/
|
|
121
|
+
isAuthorized(agentUrl, domain) {
|
|
122
|
+
const entries = this.authByDomain.get(domain);
|
|
123
|
+
return entries != null && entries.some(e => e.agent_url === agentUrl);
|
|
124
|
+
}
|
|
125
|
+
// ====== State ======
|
|
126
|
+
get state() {
|
|
127
|
+
return this._state;
|
|
128
|
+
}
|
|
129
|
+
getCursor() {
|
|
130
|
+
return this.cursor;
|
|
131
|
+
}
|
|
132
|
+
getStats() {
|
|
133
|
+
let authCount = 0;
|
|
134
|
+
for (const entries of this.authByDomain.values())
|
|
135
|
+
authCount += entries.length;
|
|
136
|
+
return { agents: this.agents.size, authorizations: authCount };
|
|
137
|
+
}
|
|
138
|
+
// ====== Private: Bootstrap ======
|
|
139
|
+
async bootstrap() {
|
|
140
|
+
this.setState('bootstrapping');
|
|
141
|
+
try {
|
|
142
|
+
// Paginate searchAgents to load all agents
|
|
143
|
+
if (this.indexAgents) {
|
|
144
|
+
let cursor;
|
|
145
|
+
do {
|
|
146
|
+
const query = { limit: 200 };
|
|
147
|
+
if (cursor)
|
|
148
|
+
query.cursor = cursor;
|
|
149
|
+
const res = await this.client.searchAgents(query);
|
|
150
|
+
for (const agent of res.results) {
|
|
151
|
+
this.agents.set(agent.url, agent);
|
|
152
|
+
}
|
|
153
|
+
cursor = res.has_more && res.cursor ? res.cursor : undefined;
|
|
154
|
+
} while (cursor);
|
|
155
|
+
}
|
|
156
|
+
// Get initial feed cursor and apply any events
|
|
157
|
+
await this.drainFeed();
|
|
158
|
+
this.setState('syncing');
|
|
159
|
+
this.emit('bootstrap', {
|
|
160
|
+
agentCount: this.agents.size,
|
|
161
|
+
authorizationCount: this.getStats().authorizations,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
this.setState('error');
|
|
166
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
167
|
+
this.errorHandler?.(error);
|
|
168
|
+
this.emit('error', { error });
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// ====== Private: Polling ======
|
|
173
|
+
schedulePoll() {
|
|
174
|
+
this.pollTimer = setTimeout(() => this.pollLoop(), this.pollIntervalMs);
|
|
175
|
+
}
|
|
176
|
+
async pollLoop() {
|
|
177
|
+
try {
|
|
178
|
+
await this.poll();
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
182
|
+
this.emit('error', { error });
|
|
183
|
+
this.errorHandler?.(error);
|
|
184
|
+
}
|
|
185
|
+
// Schedule next poll even after errors (will retry), unless stopped
|
|
186
|
+
if (this._state === 'syncing') {
|
|
187
|
+
this.schedulePoll();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async poll() {
|
|
191
|
+
let totalEventsApplied = 0;
|
|
192
|
+
let hasMore = true;
|
|
193
|
+
while (hasMore) {
|
|
194
|
+
const feed = await this.client.getFeed({
|
|
195
|
+
cursor: this.cursor ?? undefined,
|
|
196
|
+
limit: 1000,
|
|
197
|
+
});
|
|
198
|
+
if (feed.cursor_expired) {
|
|
199
|
+
// Clear state and re-bootstrap inline; the existing poll loop continues
|
|
200
|
+
this.clearIndexes();
|
|
201
|
+
this.cursor = null;
|
|
202
|
+
await this.bootstrap();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
for (const event of feed.events) {
|
|
206
|
+
this.applyEvent(event);
|
|
207
|
+
this.emit('event', { event });
|
|
208
|
+
totalEventsApplied++;
|
|
209
|
+
}
|
|
210
|
+
if (feed.cursor) {
|
|
211
|
+
this.cursor = feed.cursor;
|
|
212
|
+
}
|
|
213
|
+
hasMore = feed.has_more && this.cursor != null;
|
|
214
|
+
}
|
|
215
|
+
if (totalEventsApplied > 0) {
|
|
216
|
+
this.emit('sync', { cursor: this.cursor, eventsApplied: totalEventsApplied });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Drain all available feed pages. Used during bootstrap (does not emit 'event' per event).
|
|
221
|
+
*/
|
|
222
|
+
async drainFeed() {
|
|
223
|
+
let hasMore = true;
|
|
224
|
+
while (hasMore) {
|
|
225
|
+
const feed = await this.client.getFeed({
|
|
226
|
+
cursor: this.cursor ?? undefined,
|
|
227
|
+
limit: 1000,
|
|
228
|
+
});
|
|
229
|
+
for (const event of feed.events) {
|
|
230
|
+
this.applyEvent(event);
|
|
231
|
+
}
|
|
232
|
+
this.cursor = feed.cursor;
|
|
233
|
+
hasMore = feed.has_more && this.cursor != null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// ====== Private: Event Application ======
|
|
237
|
+
applyEvent(event) {
|
|
238
|
+
const payload = event.payload;
|
|
239
|
+
switch (event.event_type) {
|
|
240
|
+
case 'agent.discovered':
|
|
241
|
+
case 'agent.profile_updated': {
|
|
242
|
+
if (!this.indexAgents)
|
|
243
|
+
break;
|
|
244
|
+
const existing = this.agents.get(event.entity_id);
|
|
245
|
+
if (existing && payload.inventory_profile) {
|
|
246
|
+
this.agents.set(event.entity_id, {
|
|
247
|
+
...existing,
|
|
248
|
+
inventory_profile: payload.inventory_profile,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else if (!existing) {
|
|
252
|
+
// New agent: use payload data or create stub
|
|
253
|
+
this.agents.set(event.entity_id, {
|
|
254
|
+
url: event.entity_id,
|
|
255
|
+
name: payload.name ?? event.entity_id,
|
|
256
|
+
type: payload.type ?? 'unknown',
|
|
257
|
+
inventory_profile: payload.inventory_profile ?? {
|
|
258
|
+
channels: [],
|
|
259
|
+
property_types: [],
|
|
260
|
+
markets: [],
|
|
261
|
+
categories: [],
|
|
262
|
+
category_taxonomy: 'iab_content_3.0',
|
|
263
|
+
tags: [],
|
|
264
|
+
delivery_types: [],
|
|
265
|
+
property_count: 0,
|
|
266
|
+
publisher_count: 0,
|
|
267
|
+
has_tmp: false,
|
|
268
|
+
},
|
|
269
|
+
match: { score: 0, matched_filters: [] },
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
case 'agent.removed': {
|
|
275
|
+
if (this.indexAgents)
|
|
276
|
+
this.agents.delete(event.entity_id);
|
|
277
|
+
if (this.indexAuthorizations)
|
|
278
|
+
this.authByAgent.delete(event.entity_id);
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
case 'authorization.granted': {
|
|
282
|
+
if (!this.indexAuthorizations)
|
|
283
|
+
break;
|
|
284
|
+
const entry = payload;
|
|
285
|
+
if (!entry.agent_url || !entry.publisher_domain || !entry.authorization_type)
|
|
286
|
+
break;
|
|
287
|
+
const domainEntries = this.authByDomain.get(entry.publisher_domain) ?? [];
|
|
288
|
+
if (!domainEntries.some(e => e.agent_url === entry.agent_url && e.authorization_type === entry.authorization_type)) {
|
|
289
|
+
domainEntries.push(entry);
|
|
290
|
+
this.authByDomain.set(entry.publisher_domain, domainEntries);
|
|
291
|
+
}
|
|
292
|
+
const agentEntries = this.authByAgent.get(entry.agent_url) ?? [];
|
|
293
|
+
if (!agentEntries.some(e => e.publisher_domain === entry.publisher_domain && e.authorization_type === entry.authorization_type)) {
|
|
294
|
+
agentEntries.push(entry);
|
|
295
|
+
this.authByAgent.set(entry.agent_url, agentEntries);
|
|
296
|
+
}
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
case 'authorization.revoked': {
|
|
300
|
+
if (!this.indexAuthorizations)
|
|
301
|
+
break;
|
|
302
|
+
const agentUrl = payload.agent_url;
|
|
303
|
+
const domain = payload.publisher_domain;
|
|
304
|
+
const authType = payload.authorization_type;
|
|
305
|
+
if (!agentUrl || !domain)
|
|
306
|
+
break;
|
|
307
|
+
const domainEntries = this.authByDomain.get(domain);
|
|
308
|
+
if (domainEntries) {
|
|
309
|
+
const filtered = domainEntries.filter(e => !(e.agent_url === agentUrl && (!authType || e.authorization_type === authType)));
|
|
310
|
+
if (filtered.length > 0)
|
|
311
|
+
this.authByDomain.set(domain, filtered);
|
|
312
|
+
else
|
|
313
|
+
this.authByDomain.delete(domain);
|
|
314
|
+
}
|
|
315
|
+
const agentEntries = this.authByAgent.get(agentUrl);
|
|
316
|
+
if (agentEntries) {
|
|
317
|
+
const filtered = agentEntries.filter(e => !(e.publisher_domain === domain && (!authType || e.authorization_type === authType)));
|
|
318
|
+
if (filtered.length > 0)
|
|
319
|
+
this.authByAgent.set(agentUrl, filtered);
|
|
320
|
+
else
|
|
321
|
+
this.authByAgent.delete(agentUrl);
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
// Property and publisher events: no-op for v1 (no property index yet)
|
|
326
|
+
default:
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// ====== Private: Helpers ======
|
|
331
|
+
clearIndexes() {
|
|
332
|
+
this.agents.clear();
|
|
333
|
+
this.authByDomain.clear();
|
|
334
|
+
this.authByAgent.clear();
|
|
335
|
+
}
|
|
336
|
+
setState(next) {
|
|
337
|
+
const from = this._state;
|
|
338
|
+
if (from === next)
|
|
339
|
+
return;
|
|
340
|
+
this._state = next;
|
|
341
|
+
this.emit('stateChange', { from, to: next });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
exports.RegistrySync = RegistrySync;
|
|
345
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/lib/registry/sync.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAuD3C,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,YAAa,SAAQ,0BAAgC;IAC/C,MAAM,CAAiB;IACvB,cAAc,CAAS;IACvB,WAAW,CAAU;IACrB,mBAAmB,CAAU;IAC7B,YAAY,CAAuC;IAE5D,MAAM,GAAsB,MAAM,CAAC;IACnC,MAAM,GAAkB,IAAI,CAAC;IAC7B,SAAS,GAAyC,IAAI,CAAC;IAE/D,UAAU;IACF,MAAM,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC9C,YAAY,GAAG,IAAI,GAAG,EAAgC,CAAC;IACvD,WAAW,GAAG,IAAI,GAAG,EAAgC,CAAC;IAE9D,YAAY,MAA0B;QACpC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC;QACtD,IAAI,CAAC,WAAW,GAAG,MAAM,C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CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACxC,CAAC;gBAED,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBACpD,IAAI,YAAY,EAAE,CAAC;oBACjB,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,KAAK,MAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAC1F,CAAC;oBACF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;wBAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;;wBAC7D,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzC,CAAC;gBACD,MAAM;YACR,CAAC;YAED,sEAAsE;YACtE;gBACE,MAAM;QACV,CAAC;IACH,CAAC;IAED,iCAAiC;IAEzB,YAAY;QAClB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAEO,QAAQ,CAAC,IAAuB;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AA3VD,oCA2VC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Generated types are in types.generated.ts (from OpenAPI spec).
|
|
5
5
|
* This file re-exports them with ergonomic names and adds client-specific types.
|
|
6
6
|
*/
|
|
7
|
-
export type { ResolvedBrand, LocalizedName, BrandRegistryItem, ResolvedProperty, PropertyIdentifier, PropertyRegistryItem, ValidationResult, RegistryError, PublisherPropertySelector, FederatedAgentWithDetails, AgentHealth, AgentStats, AgentCapabilities, PropertySummary, FederatedPublisher, DomainLookupResult, } from './types.generated';
|
|
7
|
+
export type { ResolvedBrand, LocalizedName, BrandRegistryItem, ResolvedProperty, PropertyIdentifier, PropertyRegistryItem, ValidationResult, RegistryError, PublisherPropertySelector, FederatedAgentWithDetails, AgentHealth, AgentStats, AgentCapabilities, PropertySummary, FederatedPublisher, DomainLookupResult, CatalogEvent, FeedResponse, AgentInventoryProfile, AgentSearchResult, AgentSearchResponse, CrawlRequestResponse, AuthorizationEntry, } from './types.generated';
|
|
8
8
|
export type { paths, operations, components } from './types.generated';
|
|
9
9
|
import type { operations } from './types.generated';
|
|
10
10
|
/** Request body for POST /api/brands/save */
|
|
@@ -23,6 +23,12 @@ export type CreateAdagentsRequest = NonNullable<operations['createAdagents']['re
|
|
|
23
23
|
export type ValidateProductAuthorizationRequest = NonNullable<operations['validateProductAuthorization']['requestBody']>['content']['application/json'];
|
|
24
24
|
/** Request body for POST /api/registry/expand/product-identifiers */
|
|
25
25
|
export type ExpandProductIdentifiersRequest = NonNullable<operations['expandProductIdentifiers']['requestBody']>['content']['application/json'];
|
|
26
|
+
/** Query parameters for GET /api/registry/feed */
|
|
27
|
+
export type FeedQuery = NonNullable<operations['getRegistryFeed']['parameters']['query']>;
|
|
28
|
+
/** Query parameters for GET /api/registry/agents/search */
|
|
29
|
+
export type AgentSearchQuery = NonNullable<operations['searchAgents']['parameters']['query']>;
|
|
30
|
+
/** Request body for POST /api/registry/crawl-request */
|
|
31
|
+
export type CrawlRequest = NonNullable<operations['requestCrawl']['requestBody']>['content']['application/json'];
|
|
26
32
|
/** @deprecated Use ResolvedProperty instead */
|
|
27
33
|
export type PropertyInfo = import('./types.generated').ResolvedProperty;
|
|
28
34
|
/** A single company match from a brand search query. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/registry/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAElH,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAE3G,iDAAiD;AACjD,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAExH,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEjH,mDAAmD;AACnD,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAC/C,UAAU,CAAC,kBAAkB,CAAC,CAAC,aAAa,CAAC,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