@lumibase/sdk 0.21.0 → 0.23.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/LICENSE +192 -21
- package/dist/index.cjs +128 -3
- package/dist/index.d.cts +139 -2
- package/dist/index.d.ts +139 -2
- package/dist/index.js +118 -3
- package/package.json +2 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,192 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
Copyright 2024-present LumiBase Contributors
|
|
181
|
+
|
|
182
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
183
|
+
you may not use this file except in compliance with the License.
|
|
184
|
+
You may obtain a copy of the License at
|
|
185
|
+
|
|
186
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
187
|
+
|
|
188
|
+
Unless required by applicable law or agreed to in writing, software
|
|
189
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
190
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
191
|
+
See the License for the specific language governing permissions and
|
|
192
|
+
limitations under the License.
|
package/dist/index.cjs
CHANGED
|
@@ -24,16 +24,20 @@ __export(index_exports, {
|
|
|
24
24
|
AudienceClient: () => AudienceClient,
|
|
25
25
|
LumiError: () => LumiError,
|
|
26
26
|
RealtimeClient: () => RealtimeClient,
|
|
27
|
+
ackCdcSubscription: () => ackCdcSubscription,
|
|
27
28
|
checkCdcPipelineHealth: () => checkCdcPipelineHealth,
|
|
28
29
|
createAgentArtifact: () => createAgentArtifact,
|
|
29
30
|
createAgentGoal: () => createAgentGoal,
|
|
30
31
|
createBookmark: () => createBookmark,
|
|
31
32
|
createCdcPipeline: () => createCdcPipeline,
|
|
33
|
+
createCdcSubscription: () => createCdcSubscription,
|
|
32
34
|
createLumiClient: () => createLumiClient,
|
|
33
35
|
decideAgentApproval: () => decideAgentApproval,
|
|
34
36
|
deleteBookmark: () => deleteBookmark,
|
|
35
37
|
deleteCdcPipeline: () => deleteCdcPipeline,
|
|
38
|
+
deleteCdcSubscription: () => deleteCdcSubscription,
|
|
36
39
|
deployCdc: () => deployCdc,
|
|
40
|
+
dispatchCdcSubscription: () => dispatchCdcSubscription,
|
|
37
41
|
dryRunAccessImport: () => dryRunAccessImport,
|
|
38
42
|
evaluateAgentArtifact: () => evaluateAgentArtifact,
|
|
39
43
|
exportAccessManifest: () => exportAccessManifest,
|
|
@@ -52,14 +56,19 @@ __export(index_exports, {
|
|
|
52
56
|
listAgentTools: () => listAgentTools,
|
|
53
57
|
listBookmarks: () => listBookmarks,
|
|
54
58
|
listCdcPipelines: () => listCdcPipelines,
|
|
59
|
+
listCdcSubscriptionDeliveries: () => listCdcSubscriptionDeliveries,
|
|
60
|
+
listCdcSubscriptions: () => listCdcSubscriptions,
|
|
55
61
|
mediaUrl: () => mediaUrl,
|
|
56
62
|
publishAgentArtifact: () => publishAgentArtifact,
|
|
57
63
|
readAgentMemoryContext: () => readAgentMemoryContext,
|
|
64
|
+
readCdcEvents: () => readCdcEvents,
|
|
58
65
|
readCdcPipeline: () => readCdcPipeline,
|
|
59
66
|
readCdcPipelineMetricHistory: () => readCdcPipelineMetricHistory,
|
|
60
67
|
readCdcPipelineMetrics: () => readCdcPipelineMetrics,
|
|
68
|
+
readCdcSubscription: () => readCdcSubscription,
|
|
61
69
|
readItem: () => readItem,
|
|
62
70
|
readItems: () => readItems,
|
|
71
|
+
replayCdcSubscription: () => replayCdcSubscription,
|
|
63
72
|
retryAgentRun: () => retryAgentRun,
|
|
64
73
|
rollbackAgentArtifact: () => rollbackAgentArtifact,
|
|
65
74
|
rollbackCdcDeployment: () => rollbackCdcDeployment,
|
|
@@ -70,6 +79,7 @@ __export(index_exports, {
|
|
|
70
79
|
toNextMetadata: () => toNextMetadata,
|
|
71
80
|
updateBookmark: () => updateBookmark,
|
|
72
81
|
updateCdcPipeline: () => updateCdcPipeline,
|
|
82
|
+
updateCdcSubscription: () => updateCdcSubscription,
|
|
73
83
|
validateCdcDeploymentEnv: () => validateCdcDeploymentEnv,
|
|
74
84
|
writeAgentMemory: () => writeAgentMemory
|
|
75
85
|
});
|
|
@@ -370,6 +380,7 @@ var RealtimeClient = class {
|
|
|
370
380
|
opts;
|
|
371
381
|
ws = null;
|
|
372
382
|
subscriptions = /* @__PURE__ */ new Map();
|
|
383
|
+
subscriptionFilters = /* @__PURE__ */ new Map();
|
|
373
384
|
presenceListeners = /* @__PURE__ */ new Set();
|
|
374
385
|
currentPresence = {};
|
|
375
386
|
sessionId = null;
|
|
@@ -402,14 +413,20 @@ var RealtimeClient = class {
|
|
|
402
413
|
* Subscribe to item mutation events for a specific collection.
|
|
403
414
|
* Multiple handlers per collection are supported.
|
|
404
415
|
*
|
|
416
|
+
* `opts.filter` is an optional Directus-style condition rule evaluated
|
|
417
|
+
* server-side over the event envelope (`collection`/`action`/`itemId`) —
|
|
418
|
+
* studio broadcasts are signal-only, so row data is never filterable. The
|
|
419
|
+
* filter is per-collection: the most recent subscribe call's filter wins.
|
|
420
|
+
*
|
|
405
421
|
* @returns Unsubscribe function.
|
|
406
422
|
*/
|
|
407
|
-
subscribe(collection, callback) {
|
|
423
|
+
subscribe(collection, callback, opts = {}) {
|
|
408
424
|
if (!this.subscriptions.has(collection)) {
|
|
409
425
|
this.subscriptions.set(collection, /* @__PURE__ */ new Set());
|
|
410
426
|
}
|
|
411
427
|
this.subscriptions.get(collection).add(callback);
|
|
412
|
-
this.
|
|
428
|
+
if (opts.filter) this.subscriptionFilters.set(collection, opts.filter);
|
|
429
|
+
this._send({ type: "subscribe", collection, ...opts.filter ? { filter: opts.filter } : {} });
|
|
413
430
|
return () => this.unsubscribe(collection, callback);
|
|
414
431
|
}
|
|
415
432
|
/** Remove a specific handler from a collection subscription. */
|
|
@@ -419,6 +436,7 @@ var RealtimeClient = class {
|
|
|
419
436
|
set.delete(callback);
|
|
420
437
|
if (set.size === 0) {
|
|
421
438
|
this.subscriptions.delete(collection);
|
|
439
|
+
this.subscriptionFilters.delete(collection);
|
|
422
440
|
this._send({ type: "unsubscribe", collection });
|
|
423
441
|
}
|
|
424
442
|
}
|
|
@@ -483,7 +501,8 @@ var RealtimeClient = class {
|
|
|
483
501
|
ws.addEventListener("open", () => {
|
|
484
502
|
this.backoffMs = this.opts.initialBackoffMs ?? 1e3;
|
|
485
503
|
for (const collection of this.subscriptions.keys()) {
|
|
486
|
-
this.
|
|
504
|
+
const filter = this.subscriptionFilters.get(collection);
|
|
505
|
+
this._sendRaw({ type: "subscribe", collection, ...filter ? { filter } : {} });
|
|
487
506
|
}
|
|
488
507
|
if (Object.keys(this.currentPresence).length > 0) {
|
|
489
508
|
this._sendRaw({ type: "presence", ...this.currentPresence });
|
|
@@ -1410,6 +1429,102 @@ function rollbackCdcDeployment(id) {
|
|
|
1410
1429
|
return res.data;
|
|
1411
1430
|
};
|
|
1412
1431
|
}
|
|
1432
|
+
function readCdcEvents(params = {}) {
|
|
1433
|
+
return async (client) => {
|
|
1434
|
+
const qs = new URLSearchParams();
|
|
1435
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
1436
|
+
if (params.collections?.length) qs.set("collections", params.collections.join(","));
|
|
1437
|
+
if (params.operations?.length) qs.set("operations", params.operations.join(","));
|
|
1438
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1439
|
+
if (params.wait !== void 0) qs.set("wait", String(params.wait));
|
|
1440
|
+
const s = qs.toString();
|
|
1441
|
+
const res = await client.rawRequest(`/api/v1/cdc/events${s ? `?${s}` : ""}`);
|
|
1442
|
+
return { data: res.data, meta: res.meta ?? { nextCursor: null, hasMore: false } };
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
function listCdcSubscriptions() {
|
|
1446
|
+
return async (client) => {
|
|
1447
|
+
const res = await client.rawRequest("/api/v1/cdc/subscriptions");
|
|
1448
|
+
return res.data;
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function createCdcSubscription(input) {
|
|
1452
|
+
return async (client) => {
|
|
1453
|
+
const res = await client.rawRequest("/api/v1/cdc/subscriptions", {
|
|
1454
|
+
method: "POST",
|
|
1455
|
+
body: JSON.stringify(input)
|
|
1456
|
+
});
|
|
1457
|
+
return res.data;
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
function readCdcSubscription(id) {
|
|
1461
|
+
return async (client) => {
|
|
1462
|
+
const res = await client.rawRequest(
|
|
1463
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`
|
|
1464
|
+
);
|
|
1465
|
+
return res.data;
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
function updateCdcSubscription(id, input) {
|
|
1469
|
+
return async (client) => {
|
|
1470
|
+
const res = await client.rawRequest(
|
|
1471
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`,
|
|
1472
|
+
{ method: "PATCH", body: JSON.stringify(input) }
|
|
1473
|
+
);
|
|
1474
|
+
return res.data;
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function deleteCdcSubscription(id) {
|
|
1478
|
+
return async (client) => {
|
|
1479
|
+
const res = await client.rawRequest(
|
|
1480
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`,
|
|
1481
|
+
{ method: "DELETE" }
|
|
1482
|
+
);
|
|
1483
|
+
return res.data;
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
function ackCdcSubscription(id, cursor) {
|
|
1487
|
+
return async (client) => {
|
|
1488
|
+
const res = await client.rawRequest(
|
|
1489
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/ack`,
|
|
1490
|
+
{ method: "POST", body: JSON.stringify({ cursor }) }
|
|
1491
|
+
);
|
|
1492
|
+
return res.data;
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function replayCdcSubscription(id, target) {
|
|
1496
|
+
return async (client) => {
|
|
1497
|
+
const body = {};
|
|
1498
|
+
if (target.cursor !== void 0) body.cursor = target.cursor;
|
|
1499
|
+
if (target.occurredAfter !== void 0) body.occurred_after = target.occurredAfter;
|
|
1500
|
+
const res = await client.rawRequest(
|
|
1501
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/replay`,
|
|
1502
|
+
{ method: "POST", body: JSON.stringify(body) }
|
|
1503
|
+
);
|
|
1504
|
+
return res.data;
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
function dispatchCdcSubscription(id) {
|
|
1508
|
+
return async (client) => {
|
|
1509
|
+
const res = await client.rawRequest(
|
|
1510
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/dispatch`,
|
|
1511
|
+
{ method: "POST" }
|
|
1512
|
+
);
|
|
1513
|
+
return res.data;
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
function listCdcSubscriptionDeliveries(id, params = {}) {
|
|
1517
|
+
return async (client) => {
|
|
1518
|
+
const qs = new URLSearchParams();
|
|
1519
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1520
|
+
if (params.page !== void 0) qs.set("page", String(params.page));
|
|
1521
|
+
const s = qs.toString();
|
|
1522
|
+
const res = await client.rawRequest(
|
|
1523
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/deliveries${s ? `?${s}` : ""}`
|
|
1524
|
+
);
|
|
1525
|
+
return { data: res.data, total: res.meta?.total ?? res.data.length };
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1413
1528
|
function listAgentGoals() {
|
|
1414
1529
|
return async (client) => {
|
|
1415
1530
|
const res = await client.rawRequest("/api/v1/agent/goals");
|
|
@@ -1717,16 +1832,20 @@ function jsonLdScript(item) {
|
|
|
1717
1832
|
AudienceClient,
|
|
1718
1833
|
LumiError,
|
|
1719
1834
|
RealtimeClient,
|
|
1835
|
+
ackCdcSubscription,
|
|
1720
1836
|
checkCdcPipelineHealth,
|
|
1721
1837
|
createAgentArtifact,
|
|
1722
1838
|
createAgentGoal,
|
|
1723
1839
|
createBookmark,
|
|
1724
1840
|
createCdcPipeline,
|
|
1841
|
+
createCdcSubscription,
|
|
1725
1842
|
createLumiClient,
|
|
1726
1843
|
decideAgentApproval,
|
|
1727
1844
|
deleteBookmark,
|
|
1728
1845
|
deleteCdcPipeline,
|
|
1846
|
+
deleteCdcSubscription,
|
|
1729
1847
|
deployCdc,
|
|
1848
|
+
dispatchCdcSubscription,
|
|
1730
1849
|
dryRunAccessImport,
|
|
1731
1850
|
evaluateAgentArtifact,
|
|
1732
1851
|
exportAccessManifest,
|
|
@@ -1745,14 +1864,19 @@ function jsonLdScript(item) {
|
|
|
1745
1864
|
listAgentTools,
|
|
1746
1865
|
listBookmarks,
|
|
1747
1866
|
listCdcPipelines,
|
|
1867
|
+
listCdcSubscriptionDeliveries,
|
|
1868
|
+
listCdcSubscriptions,
|
|
1748
1869
|
mediaUrl,
|
|
1749
1870
|
publishAgentArtifact,
|
|
1750
1871
|
readAgentMemoryContext,
|
|
1872
|
+
readCdcEvents,
|
|
1751
1873
|
readCdcPipeline,
|
|
1752
1874
|
readCdcPipelineMetricHistory,
|
|
1753
1875
|
readCdcPipelineMetrics,
|
|
1876
|
+
readCdcSubscription,
|
|
1754
1877
|
readItem,
|
|
1755
1878
|
readItems,
|
|
1879
|
+
replayCdcSubscription,
|
|
1756
1880
|
retryAgentRun,
|
|
1757
1881
|
rollbackAgentArtifact,
|
|
1758
1882
|
rollbackCdcDeployment,
|
|
@@ -1763,6 +1887,7 @@ function jsonLdScript(item) {
|
|
|
1763
1887
|
toNextMetadata,
|
|
1764
1888
|
updateBookmark,
|
|
1765
1889
|
updateCdcPipeline,
|
|
1890
|
+
updateCdcSubscription,
|
|
1766
1891
|
validateCdcDeploymentEnv,
|
|
1767
1892
|
writeAgentMemory
|
|
1768
1893
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1044,6 +1044,106 @@ interface CdcRollbackResult {
|
|
|
1044
1044
|
rolledBackAt?: string;
|
|
1045
1045
|
error?: string | Record<string, unknown>;
|
|
1046
1046
|
}
|
|
1047
|
+
type CdcOperation = "create" | "update" | "delete";
|
|
1048
|
+
type CdcActorType = "user" | "api_key" | "agent" | "system";
|
|
1049
|
+
type CdcSource = "api" | "agent" | "flow" | "system";
|
|
1050
|
+
type CdcPayloadMode = "reference" | "snapshot";
|
|
1051
|
+
type CdcSubscriptionKind = "pull" | "webhook" | "extension";
|
|
1052
|
+
type CdcSubscriptionStatus = "active" | "paused" | "dead" | "stale";
|
|
1053
|
+
/** A change-feed event envelope (schemaVersion 1). `id` is the idempotency key. */
|
|
1054
|
+
interface CdcEventEnvelope {
|
|
1055
|
+
id: string;
|
|
1056
|
+
type: string;
|
|
1057
|
+
schemaVersion: number;
|
|
1058
|
+
siteId: string;
|
|
1059
|
+
collection: string;
|
|
1060
|
+
itemId: string;
|
|
1061
|
+
operation: CdcOperation;
|
|
1062
|
+
occurredAt: string;
|
|
1063
|
+
actor: {
|
|
1064
|
+
type: CdcActorType;
|
|
1065
|
+
id?: string;
|
|
1066
|
+
};
|
|
1067
|
+
source: CdcSource;
|
|
1068
|
+
changedFields?: string[];
|
|
1069
|
+
/** Present only in snapshot payload mode; pii/phi already masked. */
|
|
1070
|
+
data?: Record<string, unknown> | null;
|
|
1071
|
+
/** This event's keyset token — ack/resume marker. */
|
|
1072
|
+
cursor: string;
|
|
1073
|
+
}
|
|
1074
|
+
interface CdcFeedPage {
|
|
1075
|
+
data: CdcEventEnvelope[];
|
|
1076
|
+
meta: {
|
|
1077
|
+
nextCursor: string | null;
|
|
1078
|
+
hasMore: boolean;
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
interface CdcFeedReadParams {
|
|
1082
|
+
cursor?: string;
|
|
1083
|
+
collections?: string[];
|
|
1084
|
+
operations?: CdcOperation[];
|
|
1085
|
+
limit?: number;
|
|
1086
|
+
/** Long-poll budget in seconds (0/omitted = return immediately; server caps at 25). */
|
|
1087
|
+
wait?: number;
|
|
1088
|
+
}
|
|
1089
|
+
interface CdcSubscriptionResource {
|
|
1090
|
+
id: string;
|
|
1091
|
+
siteId: string;
|
|
1092
|
+
name: string;
|
|
1093
|
+
kind: CdcSubscriptionKind;
|
|
1094
|
+
collections: string[];
|
|
1095
|
+
operations: CdcOperation[];
|
|
1096
|
+
payloadMode: CdcPayloadMode;
|
|
1097
|
+
cursor: string | null;
|
|
1098
|
+
status: CdcSubscriptionStatus;
|
|
1099
|
+
webhookId: string | null;
|
|
1100
|
+
extensionName: string | null;
|
|
1101
|
+
consecutiveFailures: number;
|
|
1102
|
+
lastDeliveredAt: string | null;
|
|
1103
|
+
createdAt: string;
|
|
1104
|
+
updatedAt: string;
|
|
1105
|
+
lag: {
|
|
1106
|
+
events: number;
|
|
1107
|
+
behindMs: number | null;
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
interface CdcSubscriptionCreateInput {
|
|
1111
|
+
name: string;
|
|
1112
|
+
kind: CdcSubscriptionKind;
|
|
1113
|
+
collections?: string[];
|
|
1114
|
+
operations?: CdcOperation[];
|
|
1115
|
+
payload_mode?: CdcPayloadMode;
|
|
1116
|
+
/** Required when kind=webhook (webhook must have a secret). */
|
|
1117
|
+
webhook_id?: string;
|
|
1118
|
+
/** Required when kind=extension. */
|
|
1119
|
+
extension_name?: string;
|
|
1120
|
+
}
|
|
1121
|
+
interface CdcSubscriptionPatchInput {
|
|
1122
|
+
name?: string;
|
|
1123
|
+
collections?: string[];
|
|
1124
|
+
operations?: CdcOperation[];
|
|
1125
|
+
payload_mode?: CdcPayloadMode;
|
|
1126
|
+
/** Admin flip only between active/paused; dead/stale exit via replay. */
|
|
1127
|
+
status?: "active" | "paused";
|
|
1128
|
+
}
|
|
1129
|
+
/** Provide exactly one of cursor or occurredAfter (within retention). */
|
|
1130
|
+
interface CdcReplayInput {
|
|
1131
|
+
cursor?: string;
|
|
1132
|
+
occurredAfter?: string;
|
|
1133
|
+
}
|
|
1134
|
+
interface CdcDeliveryResource {
|
|
1135
|
+
id: string;
|
|
1136
|
+
subscriptionId: string;
|
|
1137
|
+
eventIdFrom: string | null;
|
|
1138
|
+
eventIdTo: string | null;
|
|
1139
|
+
eventCount: number;
|
|
1140
|
+
attempt: number;
|
|
1141
|
+
status: "success" | "failed";
|
|
1142
|
+
httpStatus: number | null;
|
|
1143
|
+
errorMessage: string | null;
|
|
1144
|
+
durationMs: number;
|
|
1145
|
+
createdAt: string;
|
|
1146
|
+
}
|
|
1047
1147
|
interface UserResource {
|
|
1048
1148
|
id: string;
|
|
1049
1149
|
email: string;
|
|
@@ -1563,6 +1663,7 @@ declare class RealtimeClient {
|
|
|
1563
1663
|
private readonly opts;
|
|
1564
1664
|
private ws;
|
|
1565
1665
|
private readonly subscriptions;
|
|
1666
|
+
private readonly subscriptionFilters;
|
|
1566
1667
|
private presenceListeners;
|
|
1567
1668
|
private currentPresence;
|
|
1568
1669
|
private sessionId;
|
|
@@ -1578,9 +1679,16 @@ declare class RealtimeClient {
|
|
|
1578
1679
|
* Subscribe to item mutation events for a specific collection.
|
|
1579
1680
|
* Multiple handlers per collection are supported.
|
|
1580
1681
|
*
|
|
1682
|
+
* `opts.filter` is an optional Directus-style condition rule evaluated
|
|
1683
|
+
* server-side over the event envelope (`collection`/`action`/`itemId`) —
|
|
1684
|
+
* studio broadcasts are signal-only, so row data is never filterable. The
|
|
1685
|
+
* filter is per-collection: the most recent subscribe call's filter wins.
|
|
1686
|
+
*
|
|
1581
1687
|
* @returns Unsubscribe function.
|
|
1582
1688
|
*/
|
|
1583
|
-
subscribe(collection: string, callback: RealtimeEventCallback
|
|
1689
|
+
subscribe(collection: string, callback: RealtimeEventCallback, opts?: {
|
|
1690
|
+
filter?: Record<string, unknown>;
|
|
1691
|
+
}): () => void;
|
|
1584
1692
|
/** Remove a specific handler from a collection subscription. */
|
|
1585
1693
|
unsubscribe(collection: string, callback: RealtimeEventCallback): void;
|
|
1586
1694
|
/** Update the current user's presence. Sent immediately and on reconnect. */
|
|
@@ -2115,6 +2223,35 @@ declare function readCdcPipelineMetricHistory(id: string, since?: string | Date)
|
|
|
2115
2223
|
declare function deployCdc(input: CdcDeployInput): (client: LumiClient) => Promise<CdcDeploymentResult>;
|
|
2116
2224
|
declare function validateCdcDeploymentEnv(input: CdcValidateEnvInput): (client: LumiClient) => Promise<CdcEnvValidationResult>;
|
|
2117
2225
|
declare function rollbackCdcDeployment(id: string): (client: LumiClient) => Promise<CdcRollbackResult>;
|
|
2226
|
+
/**
|
|
2227
|
+
* Read a page of the change feed (`GET /cdc/events`). Consumers dedupe on
|
|
2228
|
+
* `event.id` (at-least-once) and resume from `meta.nextCursor`. A 410
|
|
2229
|
+
* `CURSOR_EXPIRED` (thrown as {@link LumiError}) means the cursor fell past
|
|
2230
|
+
* retention — resync from scratch or from the `earliestCursor` in the body.
|
|
2231
|
+
*/
|
|
2232
|
+
declare function readCdcEvents(params?: CdcFeedReadParams): (client: LumiClient) => Promise<CdcFeedPage>;
|
|
2233
|
+
declare function listCdcSubscriptions(): (client: LumiClient) => Promise<CdcSubscriptionResource[]>;
|
|
2234
|
+
declare function createCdcSubscription(input: CdcSubscriptionCreateInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2235
|
+
declare function readCdcSubscription(id: string): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2236
|
+
declare function updateCdcSubscription(id: string, input: CdcSubscriptionPatchInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2237
|
+
declare function deleteCdcSubscription(id: string): (client: LumiClient) => Promise<{
|
|
2238
|
+
ok: boolean;
|
|
2239
|
+
}>;
|
|
2240
|
+
/** Commit a pull checkpoint — forward-only (409 ACK_REGRESSION on rewind). */
|
|
2241
|
+
declare function ackCdcSubscription(id: string, cursor: string): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2242
|
+
/** Rewind within retention; resets dead/stale to active (the only exit). */
|
|
2243
|
+
declare function replayCdcSubscription(id: string, target: CdcReplayInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2244
|
+
/** On-demand dispatch (the no-queue fallback path). */
|
|
2245
|
+
declare function dispatchCdcSubscription(id: string): (client: LumiClient) => Promise<{
|
|
2246
|
+
dispatched: boolean;
|
|
2247
|
+
}>;
|
|
2248
|
+
declare function listCdcSubscriptionDeliveries(id: string, params?: {
|
|
2249
|
+
limit?: number;
|
|
2250
|
+
page?: number;
|
|
2251
|
+
}): (client: LumiClient) => Promise<{
|
|
2252
|
+
data: CdcDeliveryResource[];
|
|
2253
|
+
total: number;
|
|
2254
|
+
}>;
|
|
2118
2255
|
declare function listAgentGoals(): (client: LumiClient) => Promise<AgentGoalResource[]>;
|
|
2119
2256
|
declare function createAgentGoal(input: AgentGoalCreateInput): (client: LumiClient) => Promise<AgentGoalResource>;
|
|
2120
2257
|
declare function listAgentRuns(): (client: LumiClient) => Promise<AgentRunResource[]>;
|
|
@@ -2216,4 +2353,4 @@ declare function toNextMetadata(item: unknown): Record<string, unknown>;
|
|
|
2216
2353
|
*/
|
|
2217
2354
|
declare function jsonLdScript(item: unknown): string | undefined;
|
|
2218
2355
|
|
|
2219
|
-
export { ACCESS_EXPORT_SCHEMA, type AIApproval, type AIApprovalStatus, type AIChatResponse, type AIChatStatus, type AIContentAssistResult, type AIConversation, type AIFieldSuggestion, type AIMessage, type AccessConflict, type AccessConflictCheckInput, type AccessConflictReport, type AccessExportApiKey, type AccessExportBindings, type AccessExportManifest, type AccessExportPermission, type AccessExportPolicy, type AccessExportRole, type AccessImportApplyResult, type AccessImportDiff, type AccessImportDiffEntry, type AccessImportDiffSection, type AccessImportDryRunResult, type AccessImportIssue, type AccessImportMode, type AccessImportOptions, type AccessImportSummary, type ActivityResource, type AgentApprovalResource, type AgentArtifactCreateInput, type AgentArtifactResource, type AgentArtifactType, type AgentEvaluationResource, type AgentGenerateAppInput, type AgentGenerateAppResult, type AgentGoalCreateInput, type AgentGoalResource, type AgentMemoryContext, type AgentMemoryResource, type AgentMemoryWriteInput, type AgentRiskLevel, type AgentRunResource, type AgentToolResource, type ApiKeyCreateInput, type ApiKeyPolicyAttachment, type ApiKeyResource, type ApiKeyRoleAttachment, type ApiKeyRotateInput, type ApiKeySecretResult, AudienceClient, type AudienceClientOptions, type AudienceEvent, type AudienceNotification, type Brand, type CdcConnectorType, type CdcDeployInput, type CdcDeploymentResult, type CdcDeploymentStatus, type CdcDeploymentStep, type CdcDeploymentTarget, type CdcEnvValidationResult, type CdcHealthCheckResult, type CdcHealthMetricEntry, type CdcPipelineCreateInput, type CdcPipelineMetrics, type CdcPipelinePatchInput, type CdcPipelineResource, type CdcPipelineStatus, type CdcRollbackResult, type CdcValidateEnvInput, type ChannelEventCallback, type CollectionInput, type CollectionResource, type CompiledPermission, type ConnectionStatus, type ContentVersion, type CreateSCIMTokenParams, type DefaultSchema, type DeliverySeo, type DeploymentResource, type DeploymentTargetResource, type DomainCreateInput, type DomainResource, type DomainVerificationRecord, type ExtensionResource, type FieldDeleteOptions, type FieldInput, type FieldMutationOptions, type FieldRenameInput, type FieldResource, type FileResource, type FlowGraph, type FlowNode, type FlowResource, type FlowRun, type FlowRunResult, type FlowRunStatus, type FlowStatus, type FlowTriggerType, type FolderResource, type GenerateOptions, type GraphQLExtension, type ID, type ItemFilter, type ItemFilterOp, type ItemRow, type ListItemsParams, type ListItemsResponse, type ListMarketplaceExtensionsParams, type Locale, type LumiClient, type LumiClientOptions, LumiError, type LumiErrorBody, type LumiResponse, type MarketplaceExtension, type MarketplaceListResponse, type MaterializeDataResponse, type MaterializeProjection, type MaterializeRefreshResult, type MaterializeRefreshStrategy, type MaterializedCollection, type MediaTransform, type NotificationCallback, type PermissionAction, type PermissionBundle, type PermissionCheckResult, type PermissionRow, type PolicyDetail, type PolicyResource, type PresenceCallback, type PresenceEntry, type PresetResource, type PresetScope, type PrimaryKeyType, RealtimeClient, type RealtimeEvent, type RealtimeEventCallback, type RelationInput, type RelationResource, type RelationType, type RevisionRow, type RoleDetail, type RoleResource, type SCIMTokenCreated, type SCIMTokenMeta, type SCIMTokenRotated, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangedEvent, type SchemaDiff, type SchemaDiffEntry, type SchemaDiffInput, type SchemaDiffRisk, type SchemaRuntimeImpact, type ScopedViewPreset, type SearchHit, type SearchHitMeta, type SearchParams, type SearchResponse, type SettingResource, type ShareCreateInput, type ShareResource, type ShareSecretResult, type SiteConfigUpdate, type SiteResource, type StatusCallback, type StorageMode, type TeamMemberResource, type TeamResource, type TmEntry, type TmSource, type TmSuggestion, type TranslationResource, type TypegenCollection, type TypegenField, type TypegenManifest, type TypegenRelation, type TypegenSchemaFilters, type UploadConfigResource, type UploadTypeCatalogueEntry, type UserPreferencesPayload, type UserResource, type VersionCompare, type VersionFieldChange, type ViewPreset, type WebSocketFactory, type WebSocketLike, type WebhookResource, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createLumiClient, decideAgentApproval, deleteBookmark, deleteCdcPipeline, deployCdc, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, generateAgentApp, generateTypes, getEffectivePreset, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readItem, readItems, retryAgentRun, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, toNextMetadata, updateBookmark, updateCdcPipeline, validateCdcDeploymentEnv, writeAgentMemory };
|
|
2356
|
+
export { ACCESS_EXPORT_SCHEMA, type AIApproval, type AIApprovalStatus, type AIChatResponse, type AIChatStatus, type AIContentAssistResult, type AIConversation, type AIFieldSuggestion, type AIMessage, type AccessConflict, type AccessConflictCheckInput, type AccessConflictReport, type AccessExportApiKey, type AccessExportBindings, type AccessExportManifest, type AccessExportPermission, type AccessExportPolicy, type AccessExportRole, type AccessImportApplyResult, type AccessImportDiff, type AccessImportDiffEntry, type AccessImportDiffSection, type AccessImportDryRunResult, type AccessImportIssue, type AccessImportMode, type AccessImportOptions, type AccessImportSummary, type ActivityResource, type AgentApprovalResource, type AgentArtifactCreateInput, type AgentArtifactResource, type AgentArtifactType, type AgentEvaluationResource, type AgentGenerateAppInput, type AgentGenerateAppResult, type AgentGoalCreateInput, type AgentGoalResource, type AgentMemoryContext, type AgentMemoryResource, type AgentMemoryWriteInput, type AgentRiskLevel, type AgentRunResource, type AgentToolResource, type ApiKeyCreateInput, type ApiKeyPolicyAttachment, type ApiKeyResource, type ApiKeyRoleAttachment, type ApiKeyRotateInput, type ApiKeySecretResult, AudienceClient, type AudienceClientOptions, type AudienceEvent, type AudienceNotification, type Brand, type CdcActorType, type CdcConnectorType, type CdcDeliveryResource, type CdcDeployInput, type CdcDeploymentResult, type CdcDeploymentStatus, type CdcDeploymentStep, type CdcDeploymentTarget, type CdcEnvValidationResult, type CdcEventEnvelope, type CdcFeedPage, type CdcFeedReadParams, type CdcHealthCheckResult, type CdcHealthMetricEntry, type CdcOperation, type CdcPayloadMode, type CdcPipelineCreateInput, type CdcPipelineMetrics, type CdcPipelinePatchInput, type CdcPipelineResource, type CdcPipelineStatus, type CdcReplayInput, type CdcRollbackResult, type CdcSource, type CdcSubscriptionCreateInput, type CdcSubscriptionKind, type CdcSubscriptionPatchInput, type CdcSubscriptionResource, type CdcSubscriptionStatus, type CdcValidateEnvInput, type ChannelEventCallback, type CollectionInput, type CollectionResource, type CompiledPermission, type ConnectionStatus, type ContentVersion, type CreateSCIMTokenParams, type DefaultSchema, type DeliverySeo, type DeploymentResource, type DeploymentTargetResource, type DomainCreateInput, type DomainResource, type DomainVerificationRecord, type ExtensionResource, type FieldDeleteOptions, type FieldInput, type FieldMutationOptions, type FieldRenameInput, type FieldResource, type FileResource, type FlowGraph, type FlowNode, type FlowResource, type FlowRun, type FlowRunResult, type FlowRunStatus, type FlowStatus, type FlowTriggerType, type FolderResource, type GenerateOptions, type GraphQLExtension, type ID, type ItemFilter, type ItemFilterOp, type ItemRow, type ListItemsParams, type ListItemsResponse, type ListMarketplaceExtensionsParams, type Locale, type LumiClient, type LumiClientOptions, LumiError, type LumiErrorBody, type LumiResponse, type MarketplaceExtension, type MarketplaceListResponse, type MaterializeDataResponse, type MaterializeProjection, type MaterializeRefreshResult, type MaterializeRefreshStrategy, type MaterializedCollection, type MediaTransform, type NotificationCallback, type PermissionAction, type PermissionBundle, type PermissionCheckResult, type PermissionRow, type PolicyDetail, type PolicyResource, type PresenceCallback, type PresenceEntry, type PresetResource, type PresetScope, type PrimaryKeyType, RealtimeClient, type RealtimeEvent, type RealtimeEventCallback, type RelationInput, type RelationResource, type RelationType, type RevisionRow, type RoleDetail, type RoleResource, type SCIMTokenCreated, type SCIMTokenMeta, type SCIMTokenRotated, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangedEvent, type SchemaDiff, type SchemaDiffEntry, type SchemaDiffInput, type SchemaDiffRisk, type SchemaRuntimeImpact, type ScopedViewPreset, type SearchHit, type SearchHitMeta, type SearchParams, type SearchResponse, type SettingResource, type ShareCreateInput, type ShareResource, type ShareSecretResult, type SiteConfigUpdate, type SiteResource, type StatusCallback, type StorageMode, type TeamMemberResource, type TeamResource, type TmEntry, type TmSource, type TmSuggestion, type TranslationResource, type TypegenCollection, type TypegenField, type TypegenManifest, type TypegenRelation, type TypegenSchemaFilters, type UploadConfigResource, type UploadTypeCatalogueEntry, type UserPreferencesPayload, type UserResource, type VersionCompare, type VersionFieldChange, type ViewPreset, type WebSocketFactory, type WebSocketLike, type WebhookResource, ackCdcSubscription, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createCdcSubscription, createLumiClient, decideAgentApproval, deleteBookmark, deleteCdcPipeline, deleteCdcSubscription, deployCdc, dispatchCdcSubscription, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, generateAgentApp, generateTypes, getEffectivePreset, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, listCdcSubscriptionDeliveries, listCdcSubscriptions, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcEvents, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readCdcSubscription, readItem, readItems, replayCdcSubscription, retryAgentRun, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, toNextMetadata, updateBookmark, updateCdcPipeline, updateCdcSubscription, validateCdcDeploymentEnv, writeAgentMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -1044,6 +1044,106 @@ interface CdcRollbackResult {
|
|
|
1044
1044
|
rolledBackAt?: string;
|
|
1045
1045
|
error?: string | Record<string, unknown>;
|
|
1046
1046
|
}
|
|
1047
|
+
type CdcOperation = "create" | "update" | "delete";
|
|
1048
|
+
type CdcActorType = "user" | "api_key" | "agent" | "system";
|
|
1049
|
+
type CdcSource = "api" | "agent" | "flow" | "system";
|
|
1050
|
+
type CdcPayloadMode = "reference" | "snapshot";
|
|
1051
|
+
type CdcSubscriptionKind = "pull" | "webhook" | "extension";
|
|
1052
|
+
type CdcSubscriptionStatus = "active" | "paused" | "dead" | "stale";
|
|
1053
|
+
/** A change-feed event envelope (schemaVersion 1). `id` is the idempotency key. */
|
|
1054
|
+
interface CdcEventEnvelope {
|
|
1055
|
+
id: string;
|
|
1056
|
+
type: string;
|
|
1057
|
+
schemaVersion: number;
|
|
1058
|
+
siteId: string;
|
|
1059
|
+
collection: string;
|
|
1060
|
+
itemId: string;
|
|
1061
|
+
operation: CdcOperation;
|
|
1062
|
+
occurredAt: string;
|
|
1063
|
+
actor: {
|
|
1064
|
+
type: CdcActorType;
|
|
1065
|
+
id?: string;
|
|
1066
|
+
};
|
|
1067
|
+
source: CdcSource;
|
|
1068
|
+
changedFields?: string[];
|
|
1069
|
+
/** Present only in snapshot payload mode; pii/phi already masked. */
|
|
1070
|
+
data?: Record<string, unknown> | null;
|
|
1071
|
+
/** This event's keyset token — ack/resume marker. */
|
|
1072
|
+
cursor: string;
|
|
1073
|
+
}
|
|
1074
|
+
interface CdcFeedPage {
|
|
1075
|
+
data: CdcEventEnvelope[];
|
|
1076
|
+
meta: {
|
|
1077
|
+
nextCursor: string | null;
|
|
1078
|
+
hasMore: boolean;
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
interface CdcFeedReadParams {
|
|
1082
|
+
cursor?: string;
|
|
1083
|
+
collections?: string[];
|
|
1084
|
+
operations?: CdcOperation[];
|
|
1085
|
+
limit?: number;
|
|
1086
|
+
/** Long-poll budget in seconds (0/omitted = return immediately; server caps at 25). */
|
|
1087
|
+
wait?: number;
|
|
1088
|
+
}
|
|
1089
|
+
interface CdcSubscriptionResource {
|
|
1090
|
+
id: string;
|
|
1091
|
+
siteId: string;
|
|
1092
|
+
name: string;
|
|
1093
|
+
kind: CdcSubscriptionKind;
|
|
1094
|
+
collections: string[];
|
|
1095
|
+
operations: CdcOperation[];
|
|
1096
|
+
payloadMode: CdcPayloadMode;
|
|
1097
|
+
cursor: string | null;
|
|
1098
|
+
status: CdcSubscriptionStatus;
|
|
1099
|
+
webhookId: string | null;
|
|
1100
|
+
extensionName: string | null;
|
|
1101
|
+
consecutiveFailures: number;
|
|
1102
|
+
lastDeliveredAt: string | null;
|
|
1103
|
+
createdAt: string;
|
|
1104
|
+
updatedAt: string;
|
|
1105
|
+
lag: {
|
|
1106
|
+
events: number;
|
|
1107
|
+
behindMs: number | null;
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
interface CdcSubscriptionCreateInput {
|
|
1111
|
+
name: string;
|
|
1112
|
+
kind: CdcSubscriptionKind;
|
|
1113
|
+
collections?: string[];
|
|
1114
|
+
operations?: CdcOperation[];
|
|
1115
|
+
payload_mode?: CdcPayloadMode;
|
|
1116
|
+
/** Required when kind=webhook (webhook must have a secret). */
|
|
1117
|
+
webhook_id?: string;
|
|
1118
|
+
/** Required when kind=extension. */
|
|
1119
|
+
extension_name?: string;
|
|
1120
|
+
}
|
|
1121
|
+
interface CdcSubscriptionPatchInput {
|
|
1122
|
+
name?: string;
|
|
1123
|
+
collections?: string[];
|
|
1124
|
+
operations?: CdcOperation[];
|
|
1125
|
+
payload_mode?: CdcPayloadMode;
|
|
1126
|
+
/** Admin flip only between active/paused; dead/stale exit via replay. */
|
|
1127
|
+
status?: "active" | "paused";
|
|
1128
|
+
}
|
|
1129
|
+
/** Provide exactly one of cursor or occurredAfter (within retention). */
|
|
1130
|
+
interface CdcReplayInput {
|
|
1131
|
+
cursor?: string;
|
|
1132
|
+
occurredAfter?: string;
|
|
1133
|
+
}
|
|
1134
|
+
interface CdcDeliveryResource {
|
|
1135
|
+
id: string;
|
|
1136
|
+
subscriptionId: string;
|
|
1137
|
+
eventIdFrom: string | null;
|
|
1138
|
+
eventIdTo: string | null;
|
|
1139
|
+
eventCount: number;
|
|
1140
|
+
attempt: number;
|
|
1141
|
+
status: "success" | "failed";
|
|
1142
|
+
httpStatus: number | null;
|
|
1143
|
+
errorMessage: string | null;
|
|
1144
|
+
durationMs: number;
|
|
1145
|
+
createdAt: string;
|
|
1146
|
+
}
|
|
1047
1147
|
interface UserResource {
|
|
1048
1148
|
id: string;
|
|
1049
1149
|
email: string;
|
|
@@ -1563,6 +1663,7 @@ declare class RealtimeClient {
|
|
|
1563
1663
|
private readonly opts;
|
|
1564
1664
|
private ws;
|
|
1565
1665
|
private readonly subscriptions;
|
|
1666
|
+
private readonly subscriptionFilters;
|
|
1566
1667
|
private presenceListeners;
|
|
1567
1668
|
private currentPresence;
|
|
1568
1669
|
private sessionId;
|
|
@@ -1578,9 +1679,16 @@ declare class RealtimeClient {
|
|
|
1578
1679
|
* Subscribe to item mutation events for a specific collection.
|
|
1579
1680
|
* Multiple handlers per collection are supported.
|
|
1580
1681
|
*
|
|
1682
|
+
* `opts.filter` is an optional Directus-style condition rule evaluated
|
|
1683
|
+
* server-side over the event envelope (`collection`/`action`/`itemId`) —
|
|
1684
|
+
* studio broadcasts are signal-only, so row data is never filterable. The
|
|
1685
|
+
* filter is per-collection: the most recent subscribe call's filter wins.
|
|
1686
|
+
*
|
|
1581
1687
|
* @returns Unsubscribe function.
|
|
1582
1688
|
*/
|
|
1583
|
-
subscribe(collection: string, callback: RealtimeEventCallback
|
|
1689
|
+
subscribe(collection: string, callback: RealtimeEventCallback, opts?: {
|
|
1690
|
+
filter?: Record<string, unknown>;
|
|
1691
|
+
}): () => void;
|
|
1584
1692
|
/** Remove a specific handler from a collection subscription. */
|
|
1585
1693
|
unsubscribe(collection: string, callback: RealtimeEventCallback): void;
|
|
1586
1694
|
/** Update the current user's presence. Sent immediately and on reconnect. */
|
|
@@ -2115,6 +2223,35 @@ declare function readCdcPipelineMetricHistory(id: string, since?: string | Date)
|
|
|
2115
2223
|
declare function deployCdc(input: CdcDeployInput): (client: LumiClient) => Promise<CdcDeploymentResult>;
|
|
2116
2224
|
declare function validateCdcDeploymentEnv(input: CdcValidateEnvInput): (client: LumiClient) => Promise<CdcEnvValidationResult>;
|
|
2117
2225
|
declare function rollbackCdcDeployment(id: string): (client: LumiClient) => Promise<CdcRollbackResult>;
|
|
2226
|
+
/**
|
|
2227
|
+
* Read a page of the change feed (`GET /cdc/events`). Consumers dedupe on
|
|
2228
|
+
* `event.id` (at-least-once) and resume from `meta.nextCursor`. A 410
|
|
2229
|
+
* `CURSOR_EXPIRED` (thrown as {@link LumiError}) means the cursor fell past
|
|
2230
|
+
* retention — resync from scratch or from the `earliestCursor` in the body.
|
|
2231
|
+
*/
|
|
2232
|
+
declare function readCdcEvents(params?: CdcFeedReadParams): (client: LumiClient) => Promise<CdcFeedPage>;
|
|
2233
|
+
declare function listCdcSubscriptions(): (client: LumiClient) => Promise<CdcSubscriptionResource[]>;
|
|
2234
|
+
declare function createCdcSubscription(input: CdcSubscriptionCreateInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2235
|
+
declare function readCdcSubscription(id: string): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2236
|
+
declare function updateCdcSubscription(id: string, input: CdcSubscriptionPatchInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2237
|
+
declare function deleteCdcSubscription(id: string): (client: LumiClient) => Promise<{
|
|
2238
|
+
ok: boolean;
|
|
2239
|
+
}>;
|
|
2240
|
+
/** Commit a pull checkpoint — forward-only (409 ACK_REGRESSION on rewind). */
|
|
2241
|
+
declare function ackCdcSubscription(id: string, cursor: string): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2242
|
+
/** Rewind within retention; resets dead/stale to active (the only exit). */
|
|
2243
|
+
declare function replayCdcSubscription(id: string, target: CdcReplayInput): (client: LumiClient) => Promise<CdcSubscriptionResource>;
|
|
2244
|
+
/** On-demand dispatch (the no-queue fallback path). */
|
|
2245
|
+
declare function dispatchCdcSubscription(id: string): (client: LumiClient) => Promise<{
|
|
2246
|
+
dispatched: boolean;
|
|
2247
|
+
}>;
|
|
2248
|
+
declare function listCdcSubscriptionDeliveries(id: string, params?: {
|
|
2249
|
+
limit?: number;
|
|
2250
|
+
page?: number;
|
|
2251
|
+
}): (client: LumiClient) => Promise<{
|
|
2252
|
+
data: CdcDeliveryResource[];
|
|
2253
|
+
total: number;
|
|
2254
|
+
}>;
|
|
2118
2255
|
declare function listAgentGoals(): (client: LumiClient) => Promise<AgentGoalResource[]>;
|
|
2119
2256
|
declare function createAgentGoal(input: AgentGoalCreateInput): (client: LumiClient) => Promise<AgentGoalResource>;
|
|
2120
2257
|
declare function listAgentRuns(): (client: LumiClient) => Promise<AgentRunResource[]>;
|
|
@@ -2216,4 +2353,4 @@ declare function toNextMetadata(item: unknown): Record<string, unknown>;
|
|
|
2216
2353
|
*/
|
|
2217
2354
|
declare function jsonLdScript(item: unknown): string | undefined;
|
|
2218
2355
|
|
|
2219
|
-
export { ACCESS_EXPORT_SCHEMA, type AIApproval, type AIApprovalStatus, type AIChatResponse, type AIChatStatus, type AIContentAssistResult, type AIConversation, type AIFieldSuggestion, type AIMessage, type AccessConflict, type AccessConflictCheckInput, type AccessConflictReport, type AccessExportApiKey, type AccessExportBindings, type AccessExportManifest, type AccessExportPermission, type AccessExportPolicy, type AccessExportRole, type AccessImportApplyResult, type AccessImportDiff, type AccessImportDiffEntry, type AccessImportDiffSection, type AccessImportDryRunResult, type AccessImportIssue, type AccessImportMode, type AccessImportOptions, type AccessImportSummary, type ActivityResource, type AgentApprovalResource, type AgentArtifactCreateInput, type AgentArtifactResource, type AgentArtifactType, type AgentEvaluationResource, type AgentGenerateAppInput, type AgentGenerateAppResult, type AgentGoalCreateInput, type AgentGoalResource, type AgentMemoryContext, type AgentMemoryResource, type AgentMemoryWriteInput, type AgentRiskLevel, type AgentRunResource, type AgentToolResource, type ApiKeyCreateInput, type ApiKeyPolicyAttachment, type ApiKeyResource, type ApiKeyRoleAttachment, type ApiKeyRotateInput, type ApiKeySecretResult, AudienceClient, type AudienceClientOptions, type AudienceEvent, type AudienceNotification, type Brand, type CdcConnectorType, type CdcDeployInput, type CdcDeploymentResult, type CdcDeploymentStatus, type CdcDeploymentStep, type CdcDeploymentTarget, type CdcEnvValidationResult, type CdcHealthCheckResult, type CdcHealthMetricEntry, type CdcPipelineCreateInput, type CdcPipelineMetrics, type CdcPipelinePatchInput, type CdcPipelineResource, type CdcPipelineStatus, type CdcRollbackResult, type CdcValidateEnvInput, type ChannelEventCallback, type CollectionInput, type CollectionResource, type CompiledPermission, type ConnectionStatus, type ContentVersion, type CreateSCIMTokenParams, type DefaultSchema, type DeliverySeo, type DeploymentResource, type DeploymentTargetResource, type DomainCreateInput, type DomainResource, type DomainVerificationRecord, type ExtensionResource, type FieldDeleteOptions, type FieldInput, type FieldMutationOptions, type FieldRenameInput, type FieldResource, type FileResource, type FlowGraph, type FlowNode, type FlowResource, type FlowRun, type FlowRunResult, type FlowRunStatus, type FlowStatus, type FlowTriggerType, type FolderResource, type GenerateOptions, type GraphQLExtension, type ID, type ItemFilter, type ItemFilterOp, type ItemRow, type ListItemsParams, type ListItemsResponse, type ListMarketplaceExtensionsParams, type Locale, type LumiClient, type LumiClientOptions, LumiError, type LumiErrorBody, type LumiResponse, type MarketplaceExtension, type MarketplaceListResponse, type MaterializeDataResponse, type MaterializeProjection, type MaterializeRefreshResult, type MaterializeRefreshStrategy, type MaterializedCollection, type MediaTransform, type NotificationCallback, type PermissionAction, type PermissionBundle, type PermissionCheckResult, type PermissionRow, type PolicyDetail, type PolicyResource, type PresenceCallback, type PresenceEntry, type PresetResource, type PresetScope, type PrimaryKeyType, RealtimeClient, type RealtimeEvent, type RealtimeEventCallback, type RelationInput, type RelationResource, type RelationType, type RevisionRow, type RoleDetail, type RoleResource, type SCIMTokenCreated, type SCIMTokenMeta, type SCIMTokenRotated, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangedEvent, type SchemaDiff, type SchemaDiffEntry, type SchemaDiffInput, type SchemaDiffRisk, type SchemaRuntimeImpact, type ScopedViewPreset, type SearchHit, type SearchHitMeta, type SearchParams, type SearchResponse, type SettingResource, type ShareCreateInput, type ShareResource, type ShareSecretResult, type SiteConfigUpdate, type SiteResource, type StatusCallback, type StorageMode, type TeamMemberResource, type TeamResource, type TmEntry, type TmSource, type TmSuggestion, type TranslationResource, type TypegenCollection, type TypegenField, type TypegenManifest, type TypegenRelation, type TypegenSchemaFilters, type UploadConfigResource, type UploadTypeCatalogueEntry, type UserPreferencesPayload, type UserResource, type VersionCompare, type VersionFieldChange, type ViewPreset, type WebSocketFactory, type WebSocketLike, type WebhookResource, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createLumiClient, decideAgentApproval, deleteBookmark, deleteCdcPipeline, deployCdc, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, generateAgentApp, generateTypes, getEffectivePreset, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readItem, readItems, retryAgentRun, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, toNextMetadata, updateBookmark, updateCdcPipeline, validateCdcDeploymentEnv, writeAgentMemory };
|
|
2356
|
+
export { ACCESS_EXPORT_SCHEMA, type AIApproval, type AIApprovalStatus, type AIChatResponse, type AIChatStatus, type AIContentAssistResult, type AIConversation, type AIFieldSuggestion, type AIMessage, type AccessConflict, type AccessConflictCheckInput, type AccessConflictReport, type AccessExportApiKey, type AccessExportBindings, type AccessExportManifest, type AccessExportPermission, type AccessExportPolicy, type AccessExportRole, type AccessImportApplyResult, type AccessImportDiff, type AccessImportDiffEntry, type AccessImportDiffSection, type AccessImportDryRunResult, type AccessImportIssue, type AccessImportMode, type AccessImportOptions, type AccessImportSummary, type ActivityResource, type AgentApprovalResource, type AgentArtifactCreateInput, type AgentArtifactResource, type AgentArtifactType, type AgentEvaluationResource, type AgentGenerateAppInput, type AgentGenerateAppResult, type AgentGoalCreateInput, type AgentGoalResource, type AgentMemoryContext, type AgentMemoryResource, type AgentMemoryWriteInput, type AgentRiskLevel, type AgentRunResource, type AgentToolResource, type ApiKeyCreateInput, type ApiKeyPolicyAttachment, type ApiKeyResource, type ApiKeyRoleAttachment, type ApiKeyRotateInput, type ApiKeySecretResult, AudienceClient, type AudienceClientOptions, type AudienceEvent, type AudienceNotification, type Brand, type CdcActorType, type CdcConnectorType, type CdcDeliveryResource, type CdcDeployInput, type CdcDeploymentResult, type CdcDeploymentStatus, type CdcDeploymentStep, type CdcDeploymentTarget, type CdcEnvValidationResult, type CdcEventEnvelope, type CdcFeedPage, type CdcFeedReadParams, type CdcHealthCheckResult, type CdcHealthMetricEntry, type CdcOperation, type CdcPayloadMode, type CdcPipelineCreateInput, type CdcPipelineMetrics, type CdcPipelinePatchInput, type CdcPipelineResource, type CdcPipelineStatus, type CdcReplayInput, type CdcRollbackResult, type CdcSource, type CdcSubscriptionCreateInput, type CdcSubscriptionKind, type CdcSubscriptionPatchInput, type CdcSubscriptionResource, type CdcSubscriptionStatus, type CdcValidateEnvInput, type ChannelEventCallback, type CollectionInput, type CollectionResource, type CompiledPermission, type ConnectionStatus, type ContentVersion, type CreateSCIMTokenParams, type DefaultSchema, type DeliverySeo, type DeploymentResource, type DeploymentTargetResource, type DomainCreateInput, type DomainResource, type DomainVerificationRecord, type ExtensionResource, type FieldDeleteOptions, type FieldInput, type FieldMutationOptions, type FieldRenameInput, type FieldResource, type FileResource, type FlowGraph, type FlowNode, type FlowResource, type FlowRun, type FlowRunResult, type FlowRunStatus, type FlowStatus, type FlowTriggerType, type FolderResource, type GenerateOptions, type GraphQLExtension, type ID, type ItemFilter, type ItemFilterOp, type ItemRow, type ListItemsParams, type ListItemsResponse, type ListMarketplaceExtensionsParams, type Locale, type LumiClient, type LumiClientOptions, LumiError, type LumiErrorBody, type LumiResponse, type MarketplaceExtension, type MarketplaceListResponse, type MaterializeDataResponse, type MaterializeProjection, type MaterializeRefreshResult, type MaterializeRefreshStrategy, type MaterializedCollection, type MediaTransform, type NotificationCallback, type PermissionAction, type PermissionBundle, type PermissionCheckResult, type PermissionRow, type PolicyDetail, type PolicyResource, type PresenceCallback, type PresenceEntry, type PresetResource, type PresetScope, type PrimaryKeyType, RealtimeClient, type RealtimeEvent, type RealtimeEventCallback, type RelationInput, type RelationResource, type RelationType, type RevisionRow, type RoleDetail, type RoleResource, type SCIMTokenCreated, type SCIMTokenMeta, type SCIMTokenRotated, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangedEvent, type SchemaDiff, type SchemaDiffEntry, type SchemaDiffInput, type SchemaDiffRisk, type SchemaRuntimeImpact, type ScopedViewPreset, type SearchHit, type SearchHitMeta, type SearchParams, type SearchResponse, type SettingResource, type ShareCreateInput, type ShareResource, type ShareSecretResult, type SiteConfigUpdate, type SiteResource, type StatusCallback, type StorageMode, type TeamMemberResource, type TeamResource, type TmEntry, type TmSource, type TmSuggestion, type TranslationResource, type TypegenCollection, type TypegenField, type TypegenManifest, type TypegenRelation, type TypegenSchemaFilters, type UploadConfigResource, type UploadTypeCatalogueEntry, type UserPreferencesPayload, type UserResource, type VersionCompare, type VersionFieldChange, type ViewPreset, type WebSocketFactory, type WebSocketLike, type WebhookResource, ackCdcSubscription, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createCdcSubscription, createLumiClient, decideAgentApproval, deleteBookmark, deleteCdcPipeline, deleteCdcSubscription, deployCdc, dispatchCdcSubscription, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, generateAgentApp, generateTypes, getEffectivePreset, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, listCdcSubscriptionDeliveries, listCdcSubscriptions, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcEvents, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readCdcSubscription, readItem, readItems, replayCdcSubscription, retryAgentRun, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, toNextMetadata, updateBookmark, updateCdcPipeline, updateCdcSubscription, validateCdcDeploymentEnv, writeAgentMemory };
|
package/dist/index.js
CHANGED
|
@@ -293,6 +293,7 @@ var RealtimeClient = class {
|
|
|
293
293
|
opts;
|
|
294
294
|
ws = null;
|
|
295
295
|
subscriptions = /* @__PURE__ */ new Map();
|
|
296
|
+
subscriptionFilters = /* @__PURE__ */ new Map();
|
|
296
297
|
presenceListeners = /* @__PURE__ */ new Set();
|
|
297
298
|
currentPresence = {};
|
|
298
299
|
sessionId = null;
|
|
@@ -325,14 +326,20 @@ var RealtimeClient = class {
|
|
|
325
326
|
* Subscribe to item mutation events for a specific collection.
|
|
326
327
|
* Multiple handlers per collection are supported.
|
|
327
328
|
*
|
|
329
|
+
* `opts.filter` is an optional Directus-style condition rule evaluated
|
|
330
|
+
* server-side over the event envelope (`collection`/`action`/`itemId`) —
|
|
331
|
+
* studio broadcasts are signal-only, so row data is never filterable. The
|
|
332
|
+
* filter is per-collection: the most recent subscribe call's filter wins.
|
|
333
|
+
*
|
|
328
334
|
* @returns Unsubscribe function.
|
|
329
335
|
*/
|
|
330
|
-
subscribe(collection, callback) {
|
|
336
|
+
subscribe(collection, callback, opts = {}) {
|
|
331
337
|
if (!this.subscriptions.has(collection)) {
|
|
332
338
|
this.subscriptions.set(collection, /* @__PURE__ */ new Set());
|
|
333
339
|
}
|
|
334
340
|
this.subscriptions.get(collection).add(callback);
|
|
335
|
-
this.
|
|
341
|
+
if (opts.filter) this.subscriptionFilters.set(collection, opts.filter);
|
|
342
|
+
this._send({ type: "subscribe", collection, ...opts.filter ? { filter: opts.filter } : {} });
|
|
336
343
|
return () => this.unsubscribe(collection, callback);
|
|
337
344
|
}
|
|
338
345
|
/** Remove a specific handler from a collection subscription. */
|
|
@@ -342,6 +349,7 @@ var RealtimeClient = class {
|
|
|
342
349
|
set.delete(callback);
|
|
343
350
|
if (set.size === 0) {
|
|
344
351
|
this.subscriptions.delete(collection);
|
|
352
|
+
this.subscriptionFilters.delete(collection);
|
|
345
353
|
this._send({ type: "unsubscribe", collection });
|
|
346
354
|
}
|
|
347
355
|
}
|
|
@@ -406,7 +414,8 @@ var RealtimeClient = class {
|
|
|
406
414
|
ws.addEventListener("open", () => {
|
|
407
415
|
this.backoffMs = this.opts.initialBackoffMs ?? 1e3;
|
|
408
416
|
for (const collection of this.subscriptions.keys()) {
|
|
409
|
-
this.
|
|
417
|
+
const filter = this.subscriptionFilters.get(collection);
|
|
418
|
+
this._sendRaw({ type: "subscribe", collection, ...filter ? { filter } : {} });
|
|
410
419
|
}
|
|
411
420
|
if (Object.keys(this.currentPresence).length > 0) {
|
|
412
421
|
this._sendRaw({ type: "presence", ...this.currentPresence });
|
|
@@ -1333,6 +1342,102 @@ function rollbackCdcDeployment(id) {
|
|
|
1333
1342
|
return res.data;
|
|
1334
1343
|
};
|
|
1335
1344
|
}
|
|
1345
|
+
function readCdcEvents(params = {}) {
|
|
1346
|
+
return async (client) => {
|
|
1347
|
+
const qs = new URLSearchParams();
|
|
1348
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
1349
|
+
if (params.collections?.length) qs.set("collections", params.collections.join(","));
|
|
1350
|
+
if (params.operations?.length) qs.set("operations", params.operations.join(","));
|
|
1351
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1352
|
+
if (params.wait !== void 0) qs.set("wait", String(params.wait));
|
|
1353
|
+
const s = qs.toString();
|
|
1354
|
+
const res = await client.rawRequest(`/api/v1/cdc/events${s ? `?${s}` : ""}`);
|
|
1355
|
+
return { data: res.data, meta: res.meta ?? { nextCursor: null, hasMore: false } };
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
function listCdcSubscriptions() {
|
|
1359
|
+
return async (client) => {
|
|
1360
|
+
const res = await client.rawRequest("/api/v1/cdc/subscriptions");
|
|
1361
|
+
return res.data;
|
|
1362
|
+
};
|
|
1363
|
+
}
|
|
1364
|
+
function createCdcSubscription(input) {
|
|
1365
|
+
return async (client) => {
|
|
1366
|
+
const res = await client.rawRequest("/api/v1/cdc/subscriptions", {
|
|
1367
|
+
method: "POST",
|
|
1368
|
+
body: JSON.stringify(input)
|
|
1369
|
+
});
|
|
1370
|
+
return res.data;
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
function readCdcSubscription(id) {
|
|
1374
|
+
return async (client) => {
|
|
1375
|
+
const res = await client.rawRequest(
|
|
1376
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`
|
|
1377
|
+
);
|
|
1378
|
+
return res.data;
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
function updateCdcSubscription(id, input) {
|
|
1382
|
+
return async (client) => {
|
|
1383
|
+
const res = await client.rawRequest(
|
|
1384
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`,
|
|
1385
|
+
{ method: "PATCH", body: JSON.stringify(input) }
|
|
1386
|
+
);
|
|
1387
|
+
return res.data;
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
function deleteCdcSubscription(id) {
|
|
1391
|
+
return async (client) => {
|
|
1392
|
+
const res = await client.rawRequest(
|
|
1393
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}`,
|
|
1394
|
+
{ method: "DELETE" }
|
|
1395
|
+
);
|
|
1396
|
+
return res.data;
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
function ackCdcSubscription(id, cursor) {
|
|
1400
|
+
return async (client) => {
|
|
1401
|
+
const res = await client.rawRequest(
|
|
1402
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/ack`,
|
|
1403
|
+
{ method: "POST", body: JSON.stringify({ cursor }) }
|
|
1404
|
+
);
|
|
1405
|
+
return res.data;
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
function replayCdcSubscription(id, target) {
|
|
1409
|
+
return async (client) => {
|
|
1410
|
+
const body = {};
|
|
1411
|
+
if (target.cursor !== void 0) body.cursor = target.cursor;
|
|
1412
|
+
if (target.occurredAfter !== void 0) body.occurred_after = target.occurredAfter;
|
|
1413
|
+
const res = await client.rawRequest(
|
|
1414
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/replay`,
|
|
1415
|
+
{ method: "POST", body: JSON.stringify(body) }
|
|
1416
|
+
);
|
|
1417
|
+
return res.data;
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
function dispatchCdcSubscription(id) {
|
|
1421
|
+
return async (client) => {
|
|
1422
|
+
const res = await client.rawRequest(
|
|
1423
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/dispatch`,
|
|
1424
|
+
{ method: "POST" }
|
|
1425
|
+
);
|
|
1426
|
+
return res.data;
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
function listCdcSubscriptionDeliveries(id, params = {}) {
|
|
1430
|
+
return async (client) => {
|
|
1431
|
+
const qs = new URLSearchParams();
|
|
1432
|
+
if (params.limit !== void 0) qs.set("limit", String(params.limit));
|
|
1433
|
+
if (params.page !== void 0) qs.set("page", String(params.page));
|
|
1434
|
+
const s = qs.toString();
|
|
1435
|
+
const res = await client.rawRequest(
|
|
1436
|
+
`/api/v1/cdc/subscriptions/${encodeURIComponent(id)}/deliveries${s ? `?${s}` : ""}`
|
|
1437
|
+
);
|
|
1438
|
+
return { data: res.data, total: res.meta?.total ?? res.data.length };
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1336
1441
|
function listAgentGoals() {
|
|
1337
1442
|
return async (client) => {
|
|
1338
1443
|
const res = await client.rawRequest("/api/v1/agent/goals");
|
|
@@ -1639,16 +1744,20 @@ export {
|
|
|
1639
1744
|
AudienceClient,
|
|
1640
1745
|
LumiError,
|
|
1641
1746
|
RealtimeClient,
|
|
1747
|
+
ackCdcSubscription,
|
|
1642
1748
|
checkCdcPipelineHealth,
|
|
1643
1749
|
createAgentArtifact,
|
|
1644
1750
|
createAgentGoal,
|
|
1645
1751
|
createBookmark,
|
|
1646
1752
|
createCdcPipeline,
|
|
1753
|
+
createCdcSubscription,
|
|
1647
1754
|
createLumiClient,
|
|
1648
1755
|
decideAgentApproval,
|
|
1649
1756
|
deleteBookmark,
|
|
1650
1757
|
deleteCdcPipeline,
|
|
1758
|
+
deleteCdcSubscription,
|
|
1651
1759
|
deployCdc,
|
|
1760
|
+
dispatchCdcSubscription,
|
|
1652
1761
|
dryRunAccessImport,
|
|
1653
1762
|
evaluateAgentArtifact,
|
|
1654
1763
|
exportAccessManifest,
|
|
@@ -1667,14 +1776,19 @@ export {
|
|
|
1667
1776
|
listAgentTools,
|
|
1668
1777
|
listBookmarks,
|
|
1669
1778
|
listCdcPipelines,
|
|
1779
|
+
listCdcSubscriptionDeliveries,
|
|
1780
|
+
listCdcSubscriptions,
|
|
1670
1781
|
mediaUrl,
|
|
1671
1782
|
publishAgentArtifact,
|
|
1672
1783
|
readAgentMemoryContext,
|
|
1784
|
+
readCdcEvents,
|
|
1673
1785
|
readCdcPipeline,
|
|
1674
1786
|
readCdcPipelineMetricHistory,
|
|
1675
1787
|
readCdcPipelineMetrics,
|
|
1788
|
+
readCdcSubscription,
|
|
1676
1789
|
readItem,
|
|
1677
1790
|
readItems,
|
|
1791
|
+
replayCdcSubscription,
|
|
1678
1792
|
retryAgentRun,
|
|
1679
1793
|
rollbackAgentArtifact,
|
|
1680
1794
|
rollbackCdcDeployment,
|
|
@@ -1685,6 +1799,7 @@ export {
|
|
|
1685
1799
|
toNextMetadata,
|
|
1686
1800
|
updateBookmark,
|
|
1687
1801
|
updateCdcPipeline,
|
|
1802
|
+
updateCdcSubscription,
|
|
1688
1803
|
validateCdcDeploymentEnv,
|
|
1689
1804
|
writeAgentMemory
|
|
1690
1805
|
};
|
package/package.json
CHANGED