@fairmint/canton-node-sdk 0.0.272 → 0.0.274
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/README.md +26 -0
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts +18 -1
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js +8 -0
- package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js.map +1 -1
- package/build/src/clients/ledger-json-api/index.d.ts +6 -1
- package/build/src/clients/ledger-json-api/index.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/index.js +9 -1
- package/build/src/clients/ledger-json-api/index.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit.d.ts +52 -52
- package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait.d.ts +52 -52
- package/build/src/clients/ledger-json-api/operations/v2/commands/subscribe-to-raw-completions.d.ts +66 -0
- package/build/src/clients/ledger-json-api/operations/v2/commands/subscribe-to-raw-completions.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/commands/subscribe-to-raw-completions.js +65 -0
- package/build/src/clients/ledger-json-api/operations/v2/commands/subscribe-to-raw-completions.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.d.ts +26 -3
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.js +36 -5
- package/build/src/clients/ledger-json-api/operations/v2/events/get-events-by-contract-id.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.d.ts +17 -3
- package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.js +24 -7
- package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts +37 -2
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.js +42 -23
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-updates-page.d.ts +503 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-updates-page.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-updates-page.js +178 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/get-updates-page.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.d.ts +87 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.js +99 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts +31 -2
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.js +38 -7
- package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.d.ts +68 -20
- package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.d.ts.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.js +76 -50
- package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.js.map +1 -1
- package/build/src/clients/ledger-json-api/operations/v2/utils/party-scope.d.ts +36 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/party-scope.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/party-scope.js +45 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/party-scope.js.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.d.ts +113 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.d.ts.map +1 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.js +295 -0
- package/build/src/clients/ledger-json-api/operations/v2/utils/raw-frame-stream.js.map +1 -0
- package/build/src/core/http/HttpClient.d.ts +5 -0
- package/build/src/core/http/HttpClient.d.ts.map +1 -1
- package/build/src/core/http/HttpClient.js +40 -11
- package/build/src/core/http/HttpClient.js.map +1 -1
- package/build/src/core/operations/WebSocketOperationFactory.js +1 -1
- package/build/src/core/operations/WebSocketOperationFactory.js.map +1 -1
- package/build/src/core/types.d.ts +6 -0
- package/build/src/core/types.d.ts.map +1 -1
- package/build/src/core/utils/index.d.ts +1 -0
- package/build/src/core/utils/index.d.ts.map +1 -1
- package/build/src/core/utils/index.js +7 -1
- package/build/src/core/utils/index.js.map +1 -1
- package/build/src/core/utils/lossless-json.d.ts +52 -0
- package/build/src/core/utils/lossless-json.d.ts.map +1 -0
- package/build/src/core/utils/lossless-json.js +250 -0
- package/build/src/core/utils/lossless-json.js.map +1 -0
- package/build/src/core/ws/WebSocketClient.d.ts +5 -1
- package/build/src/core/ws/WebSocketClient.d.ts.map +1 -1
- package/build/src/core/ws/WebSocketClient.js +1 -1
- package/build/src/core/ws/WebSocketClient.js.map +1 -1
- package/build/src/utils/ledger/user-rights.d.ts +46 -0
- package/build/src/utils/ledger/user-rights.d.ts.map +1 -1
- package/build/src/utils/ledger/user-rights.js +68 -0
- package/build/src/utils/ledger/user-rights.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetRawUpdatesPage = exports.GetUpdatesPage = exports.GetUpdatesPageParamsSchema = void 0;
|
|
4
|
+
exports.decodeRawUpdatesPage = decodeRawUpdatesPage;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const errors_1 = require("../../../../../core/errors");
|
|
7
|
+
const ApiOperation_1 = require("../../../../../core/operations/ApiOperation");
|
|
8
|
+
const ApiOperationFactory_1 = require("../../../../../core/operations/ApiOperationFactory");
|
|
9
|
+
const lossless_json_1 = require("../../../../../core/utils/lossless-json");
|
|
10
|
+
const type_guards_1 = require("../../../../../core/utils/type-guards");
|
|
11
|
+
const updates_1 = require("../../../schemas/operations/updates");
|
|
12
|
+
const endpoint = '/v2/updates/get-updates-page';
|
|
13
|
+
/** Parameters of `getUpdatesPage` and `getRawUpdatesPage`: the Ledger API's `GetUpdatesPageRequest`. */
|
|
14
|
+
exports.GetUpdatesPageParamsSchema = zod_1.z.object({
|
|
15
|
+
/** What to read. Build it with `buildUpdateFormat`, e.g. `buildUpdateFormat({ anyParty: true })`. */
|
|
16
|
+
updateFormat: updates_1.UpdateFormatSchema,
|
|
17
|
+
/**
|
|
18
|
+
* Only updates after this offset. Zero or omitted means from the pruning offset (or the ledger begin). Every page of
|
|
19
|
+
* one read repeats the same value.
|
|
20
|
+
*/
|
|
21
|
+
beginOffsetExclusive: zod_1.z.number().int().min(0).optional(),
|
|
22
|
+
/** Only updates up to and including this offset; omitted means below the current ledger end. */
|
|
23
|
+
endOffsetInclusive: zod_1.z.number().int().min(0).optional(),
|
|
24
|
+
/** Most updates in the page; the participant applies its own default and limit. */
|
|
25
|
+
maxPageSize: zod_1.z.number().int().positive().optional(),
|
|
26
|
+
/** Pages from `endOffsetInclusive` downwards. */
|
|
27
|
+
descendingOrder: zod_1.z.boolean().optional(),
|
|
28
|
+
/** `nextPageToken` of the previous page, to read the next one with otherwise identical parameters. */
|
|
29
|
+
pageToken: zod_1.z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
/** The request body: the validated parameters, with absent ones left out. */
|
|
32
|
+
function buildPageRequest(params) {
|
|
33
|
+
return {
|
|
34
|
+
updateFormat: params.updateFormat,
|
|
35
|
+
...(params.beginOffsetExclusive !== undefined && { beginOffsetExclusive: params.beginOffsetExclusive }),
|
|
36
|
+
...(params.endOffsetInclusive !== undefined && { endOffsetInclusive: params.endOffsetInclusive }),
|
|
37
|
+
...(params.maxPageSize !== undefined && { maxPageSize: params.maxPageSize }),
|
|
38
|
+
...(params.descendingOrder !== undefined && { descendingOrder: params.descendingOrder }),
|
|
39
|
+
...(params.pageToken !== undefined && { pageToken: params.pageToken }),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reads one page of updates (`POST /v2/updates/get-updates-page`), parsed as JSON without any schema normalization.
|
|
44
|
+
*
|
|
45
|
+
* Read every page by passing each page's `nextPageToken` with otherwise identical parameters until it is absent.
|
|
46
|
+
* Without `endOffsetInclusive` the token is always present, so polling it tails the ledger. For the exact response
|
|
47
|
+
* text, use `getRawUpdatesPage`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const page = await client.getUpdatesPage({
|
|
52
|
+
* updateFormat: buildUpdateFormat({ anyParty: true, includeTopologyEvents: true }),
|
|
53
|
+
* beginOffsetExclusive: 1000,
|
|
54
|
+
* endOffsetInclusive: 2000,
|
|
55
|
+
* maxPageSize: 100,
|
|
56
|
+
* });
|
|
57
|
+
* ```;
|
|
58
|
+
*/
|
|
59
|
+
exports.GetUpdatesPage = (0, ApiOperationFactory_1.createApiOperation)({
|
|
60
|
+
paramsSchema: exports.GetUpdatesPageParamsSchema,
|
|
61
|
+
method: 'POST',
|
|
62
|
+
requestSemantics: 'read',
|
|
63
|
+
buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
|
|
64
|
+
buildRequestData: buildPageRequest,
|
|
65
|
+
});
|
|
66
|
+
/** The same request, resolving with the response body as text. Not exported: `GetRawUpdatesPage` decodes it. */
|
|
67
|
+
const GetUpdatesPageText = (0, ApiOperationFactory_1.createApiOperation)({
|
|
68
|
+
paramsSchema: exports.GetUpdatesPageParamsSchema,
|
|
69
|
+
method: 'POST',
|
|
70
|
+
requestSemantics: 'read',
|
|
71
|
+
requestConfig: { contentType: 'application/json', includeBearerToken: true, responseType: 'text' },
|
|
72
|
+
buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
|
|
73
|
+
buildRequestData: buildPageRequest,
|
|
74
|
+
});
|
|
75
|
+
const OFFSET_KINDS = ['OffsetCheckpoint', 'Reassignment', 'TopologyTransaction', 'Transaction'];
|
|
76
|
+
function malformedPage(detail) {
|
|
77
|
+
return new errors_1.ApiError(`Malformed get-updates-page response: ${detail}`);
|
|
78
|
+
}
|
|
79
|
+
function readBound(page, key) {
|
|
80
|
+
const value = page[key];
|
|
81
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
|
|
82
|
+
throw malformedPage(`${key} is not a non-negative integer`);
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
function decodePageUpdate(item, text, index) {
|
|
87
|
+
const update = (0, type_guards_1.isRecord)(item) ? item['update'] : undefined;
|
|
88
|
+
const kinds = (0, type_guards_1.isRecord)(update) ? Object.keys(update) : [];
|
|
89
|
+
const [kind] = kinds;
|
|
90
|
+
if (!(0, type_guards_1.isRecord)(update) || kind === undefined || kinds.length !== 1) {
|
|
91
|
+
throw malformedPage(`updates[${index}] is not { "update": { "<kind>": ... } }`);
|
|
92
|
+
}
|
|
93
|
+
const variant = update[kind];
|
|
94
|
+
const rawOffset = (0, type_guards_1.isRecord)(variant) && (0, type_guards_1.isRecord)(variant['value']) ? variant['value']['offset'] : undefined;
|
|
95
|
+
const offset = typeof rawOffset === 'number' && Number.isSafeInteger(rawOffset) && rawOffset >= 0 ? rawOffset : undefined;
|
|
96
|
+
if (offset === undefined && OFFSET_KINDS.includes(kind)) {
|
|
97
|
+
throw malformedPage(`updates[${index}] (${kind}) has no offset`);
|
|
98
|
+
}
|
|
99
|
+
return { text, json: item, kind, offset };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Decodes a get-updates-page response body without normalizing it.
|
|
103
|
+
*
|
|
104
|
+
* @throws LossyJsonError if `JSON.parse` would change a number or drop a repeated key
|
|
105
|
+
* @throws ApiError if the body is not a page
|
|
106
|
+
*/
|
|
107
|
+
function decodeRawUpdatesPage(text) {
|
|
108
|
+
if (typeof text !== 'string')
|
|
109
|
+
throw malformedPage('the body is not text');
|
|
110
|
+
let json;
|
|
111
|
+
let updateTexts;
|
|
112
|
+
try {
|
|
113
|
+
({ value: json, elements: updateTexts } = (0, lossless_json_1.parseJsonLosslesslyWithElements)(text, 'updates'));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error instanceof SyntaxError)
|
|
117
|
+
throw malformedPage(`the body is not JSON (${error.message})`);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
if (!(0, type_guards_1.isRecord)(json))
|
|
121
|
+
throw malformedPage('the body is not a JSON object');
|
|
122
|
+
const lowestPageOffsetExclusive = readBound(json, 'lowestPageOffsetExclusive');
|
|
123
|
+
const highestPageOffsetInclusive = readBound(json, 'highestPageOffsetInclusive');
|
|
124
|
+
if (highestPageOffsetInclusive < lowestPageOffsetExclusive) {
|
|
125
|
+
throw malformedPage(`bounds (${lowestPageOffsetExclusive}, ${highestPageOffsetInclusive}] are reversed`);
|
|
126
|
+
}
|
|
127
|
+
const { nextPageToken, updates = [] } = json;
|
|
128
|
+
if (nextPageToken !== undefined && nextPageToken !== null && typeof nextPageToken !== 'string') {
|
|
129
|
+
throw malformedPage('nextPageToken is not a string');
|
|
130
|
+
}
|
|
131
|
+
if (!Array.isArray(updates))
|
|
132
|
+
throw malformedPage('updates is not an array');
|
|
133
|
+
const itemTexts = updateTexts ?? [];
|
|
134
|
+
if (itemTexts.length !== updates.length) {
|
|
135
|
+
throw malformedPage(`found the text of ${itemTexts.length} of its ${updates.length} updates`);
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
text,
|
|
139
|
+
json,
|
|
140
|
+
lowestPageOffsetExclusive,
|
|
141
|
+
highestPageOffsetInclusive,
|
|
142
|
+
nextPageToken: typeof nextPageToken === 'string' && nextPageToken.length > 0 ? nextPageToken : undefined,
|
|
143
|
+
updates: updates.map((item, index) => decodePageUpdate(item, itemTexts[index] ?? '', index)),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Reads one page of updates (`POST /v2/updates/get-updates-page`) exactly as the participant sent it: the response
|
|
148
|
+
* text, its `JSON.parse` value (checked to keep every number and key, with no schema normalization), the page bounds
|
|
149
|
+
* and token, and each update with its exact text, its parsed value, its kind and its offset.
|
|
150
|
+
*
|
|
151
|
+
* It takes the parameters, retries and cancellation of `getUpdatesPage`. A Canton error response is still parsed, so
|
|
152
|
+
* the thrown `ApiError` carries its code (e.g. `PARTICIPANT_PRUNED_DATA_ACCESSED`).
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const updateFormat = buildUpdateFormat({ anyParty: true, includeCreatedEventBlob: true, includeTopologyEvents: true });
|
|
157
|
+
* let pageToken: string | undefined;
|
|
158
|
+
* do {
|
|
159
|
+
* const page = await client.getRawUpdatesPage({
|
|
160
|
+
* updateFormat,
|
|
161
|
+
* beginOffsetExclusive: begin,
|
|
162
|
+
* endOffsetInclusive: end,
|
|
163
|
+
* maxPageSize: 200,
|
|
164
|
+
* ...(pageToken !== undefined && { pageToken }),
|
|
165
|
+
* });
|
|
166
|
+
* await store(page.updates, page.highestPageOffsetInclusive);
|
|
167
|
+
* pageToken = page.nextPageToken;
|
|
168
|
+
* } while (pageToken !== undefined);
|
|
169
|
+
* ```;
|
|
170
|
+
*/
|
|
171
|
+
class GetRawUpdatesPage extends ApiOperation_1.ApiOperation {
|
|
172
|
+
async execute(params, options) {
|
|
173
|
+
const text = await new GetUpdatesPageText(this.client).execute(params, options);
|
|
174
|
+
return decodeRawUpdatesPage(text);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.GetRawUpdatesPage = GetRawUpdatesPage;
|
|
178
|
+
//# sourceMappingURL=get-updates-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-updates-page.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/get-updates-page.ts"],"names":[],"mappings":";;;;AAAA,6BAAwB;AACxB,uDAAsD;AACtD,8EAA2E;AAC3E,4FAAwF;AAExF,2EAA0F;AAC1F,uEAAiE;AAEjE,iEAAyE;AAIzE,MAAM,QAAQ,GAAG,8BAAuC,CAAC;AAEzD,wGAAwG;AAC3F,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,qGAAqG;IACrG,YAAY,EAAE,4BAAkB;IAChC;;;OAGG;IACH,oBAAoB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxD,gGAAgG;IAChG,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtD,mFAAmF;IACnF,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACnD,iDAAiD;IACjD,eAAe,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,sGAAsG;IACtG,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAMH,6EAA6E;AAC7E,SAAS,gBAAgB,CAAC,MAA4B;IACpD,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,GAAG,CAAC,MAAM,CAAC,oBAAoB,KAAK,SAAS,I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AAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChF,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type WebSocketOptions } from '../../../../../core/ws/WebSocketClient';
|
|
2
|
+
import type { LedgerJsonApiClient } from '../../../LedgerJsonApiClient.generated';
|
|
3
|
+
import { type UpdateFormat } from '../../../schemas/operations/updates';
|
|
4
|
+
import { type RawFrame, type RawStreamSubscription } from '../utils/raw-frame-stream';
|
|
5
|
+
/** The update kinds the Ledger API sends on `/v2/updates`. */
|
|
6
|
+
export type RawUpdateKind = 'OffsetCheckpoint' | 'Reassignment' | 'TopologyTransaction' | 'Transaction';
|
|
7
|
+
/** One `/v2/updates` frame exactly as the participant sent it: `{ "update": { "<kind>": { "value": { ... } } } }`. */
|
|
8
|
+
export type RawUpdateFrame = RawFrame<RawUpdateKind>;
|
|
9
|
+
export interface SubscribeToRawUpdatesParams {
|
|
10
|
+
/**
|
|
11
|
+
* What to read. Build it with `buildUpdateFormat`: `buildUpdateFormat({ anyParty: true, includeCreatedEventBlob:
|
|
12
|
+
* true, includeTopologyEvents: true })` reads every party's transactions, reassignments and topology events. It is
|
|
13
|
+
* validated, then sent exactly as given, so a caller can store the format it read with.
|
|
14
|
+
*/
|
|
15
|
+
readonly updateFormat: UpdateFormat;
|
|
16
|
+
/** Read updates after this offset. Pass the subscription's `lastOffset` to resume. */
|
|
17
|
+
readonly beginExclusive: number;
|
|
18
|
+
/**
|
|
19
|
+
* Read up to and including this offset, then end with reason `completed`. Omit it to tail the ledger: the stream then
|
|
20
|
+
* stays open and the participant also sends `OffsetCheckpoint` frames (only tailing streams carry them).
|
|
21
|
+
*/
|
|
22
|
+
readonly endInclusive?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Called for each frame, one at a time, in the order received; the next frame waits until the returned promise
|
|
25
|
+
* resolves. Throwing ends the stream: `done` rejects with that error and `lastOffset` stays at the frame before.
|
|
26
|
+
*/
|
|
27
|
+
readonly onFrame: (frame: RawUpdateFrame) => void | Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* End the stream with an error when no frame arrives for this many milliseconds (default `0`, never). A tailing
|
|
30
|
+
* stream receives an offset checkpoint after about a minute without updates, so a few minutes detects a hung socket.
|
|
31
|
+
*/
|
|
32
|
+
readonly idleTimeoutMs?: number;
|
|
33
|
+
/** Called when the access token is about to expire, before the stream ends with reason `token-refresh`. */
|
|
34
|
+
readonly onTokenExpiring?: WebSocketOptions['onTokenExpiring'];
|
|
35
|
+
/** Called just before the stream closes for a token refresh; it may return the close code and reason. */
|
|
36
|
+
readonly onTokenRefreshNeeded?: WebSocketOptions['onTokenRefreshNeeded'];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Streams `/v2/updates` frames exactly as the participant sends them, for a reader that must store what the ledger said
|
|
40
|
+
* rather than the SDK's reading of it.
|
|
41
|
+
*
|
|
42
|
+
* Unlike `subscribeToUpdates`, no Zod schema touches a frame (no null is turned into `undefined`, no `paidTrafficCost`
|
|
43
|
+
* is coerced), and every kind is delivered: transactions, reassignments, topology transactions and offset checkpoints.
|
|
44
|
+
* Each frame carries its text, its `JSON.parse` value (checked to keep every number and key), its kind and its offset.
|
|
45
|
+
*
|
|
46
|
+
* Frames reach `onFrame` one at a time and in order; while the consumer falls behind, the socket stops reading. The
|
|
47
|
+
* returned subscription's `lastOffset` is the offset of the last frame `onFrame` finished, and `done` settles once the
|
|
48
|
+
* stream has ended:
|
|
49
|
+
*
|
|
50
|
+
* - Resolves with reason `completed` when the participant closes a bounded stream normally, `token-refresh` shortly
|
|
51
|
+
* before the access token expires (the token is cleared, so the next subscription authenticates afresh), or `closed`
|
|
52
|
+
* after `close()`.
|
|
53
|
+
* - Rejects with a `RawStreamError` for an error frame (its `ledgerCode`, e.g. `PARTICIPANT_PRUNED_DATA_ACCESSED`), an
|
|
54
|
+
* unexpected or lossy frame, an offset out of order, or an abnormal close; with the error `onFrame` threw; or with a
|
|
55
|
+
* connection error. Frames received before a failure are still handled first.
|
|
56
|
+
*
|
|
57
|
+
* In every case a new subscription from `lastOffset` continues without a gap or a repeat.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* await assertCanReadAsAnyParty(client);
|
|
62
|
+
* const updateFormat = buildUpdateFormat({
|
|
63
|
+
* anyParty: true,
|
|
64
|
+
* includeCreatedEventBlob: true,
|
|
65
|
+
* includeTopologyEvents: true,
|
|
66
|
+
* });
|
|
67
|
+
* let beginExclusive = cursor;
|
|
68
|
+
* for (;;) {
|
|
69
|
+
* const stream = client.subscribeToRawUpdates({
|
|
70
|
+
* updateFormat,
|
|
71
|
+
* beginExclusive,
|
|
72
|
+
* onFrame: async (frame) => store(frame.kind, frame.offset, frame.json),
|
|
73
|
+
* });
|
|
74
|
+
* try {
|
|
75
|
+
* await stream.done; // 'token-refresh': loop and resume
|
|
76
|
+
* } finally {
|
|
77
|
+
* beginExclusive = stream.lastOffset;
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ```;
|
|
81
|
+
*/
|
|
82
|
+
export declare class SubscribeToRawUpdates {
|
|
83
|
+
private readonly client;
|
|
84
|
+
constructor(client: LedgerJsonApiClient);
|
|
85
|
+
connect(params: SubscribeToRawUpdatesParams): RawStreamSubscription;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=subscribe-to-raw-updates.d.ts.map
|
package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-to-raw-updates.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAA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ty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscribeToRawUpdates = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const errors_1 = require("../../../../../core/errors");
|
|
6
|
+
const updates_1 = require("../../../schemas/operations/updates");
|
|
7
|
+
const raw_frame_stream_1 = require("../utils/raw-frame-stream");
|
|
8
|
+
const path = '/v2/updates';
|
|
9
|
+
/** Every known update kind carries `value.offset`. */
|
|
10
|
+
const OFFSET_KINDS = [
|
|
11
|
+
'OffsetCheckpoint',
|
|
12
|
+
'Reassignment',
|
|
13
|
+
'TopologyTransaction',
|
|
14
|
+
'Transaction',
|
|
15
|
+
];
|
|
16
|
+
const SubscribeToRawUpdatesParamsSchema = zod_1.z.object({
|
|
17
|
+
updateFormat: updates_1.UpdateFormatSchema,
|
|
18
|
+
beginExclusive: zod_1.z.number().int().min(0),
|
|
19
|
+
endInclusive: zod_1.z.number().int().min(0).optional(),
|
|
20
|
+
idleTimeoutMs: zod_1.z.number().min(0).optional(),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Streams `/v2/updates` frames exactly as the participant sends them, for a reader that must store what the ledger said
|
|
24
|
+
* rather than the SDK's reading of it.
|
|
25
|
+
*
|
|
26
|
+
* Unlike `subscribeToUpdates`, no Zod schema touches a frame (no null is turned into `undefined`, no `paidTrafficCost`
|
|
27
|
+
* is coerced), and every kind is delivered: transactions, reassignments, topology transactions and offset checkpoints.
|
|
28
|
+
* Each frame carries its text, its `JSON.parse` value (checked to keep every number and key), its kind and its offset.
|
|
29
|
+
*
|
|
30
|
+
* Frames reach `onFrame` one at a time and in order; while the consumer falls behind, the socket stops reading. The
|
|
31
|
+
* returned subscription's `lastOffset` is the offset of the last frame `onFrame` finished, and `done` settles once the
|
|
32
|
+
* stream has ended:
|
|
33
|
+
*
|
|
34
|
+
* - Resolves with reason `completed` when the participant closes a bounded stream normally, `token-refresh` shortly
|
|
35
|
+
* before the access token expires (the token is cleared, so the next subscription authenticates afresh), or `closed`
|
|
36
|
+
* after `close()`.
|
|
37
|
+
* - Rejects with a `RawStreamError` for an error frame (its `ledgerCode`, e.g. `PARTICIPANT_PRUNED_DATA_ACCESSED`), an
|
|
38
|
+
* unexpected or lossy frame, an offset out of order, or an abnormal close; with the error `onFrame` threw; or with a
|
|
39
|
+
* connection error. Frames received before a failure are still handled first.
|
|
40
|
+
*
|
|
41
|
+
* In every case a new subscription from `lastOffset` continues without a gap or a repeat.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* await assertCanReadAsAnyParty(client);
|
|
46
|
+
* const updateFormat = buildUpdateFormat({
|
|
47
|
+
* anyParty: true,
|
|
48
|
+
* includeCreatedEventBlob: true,
|
|
49
|
+
* includeTopologyEvents: true,
|
|
50
|
+
* });
|
|
51
|
+
* let beginExclusive = cursor;
|
|
52
|
+
* for (;;) {
|
|
53
|
+
* const stream = client.subscribeToRawUpdates({
|
|
54
|
+
* updateFormat,
|
|
55
|
+
* beginExclusive,
|
|
56
|
+
* onFrame: async (frame) => store(frame.kind, frame.offset, frame.json),
|
|
57
|
+
* });
|
|
58
|
+
* try {
|
|
59
|
+
* await stream.done; // 'token-refresh': loop and resume
|
|
60
|
+
* } finally {
|
|
61
|
+
* beginExclusive = stream.lastOffset;
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```;
|
|
65
|
+
*/
|
|
66
|
+
class SubscribeToRawUpdates {
|
|
67
|
+
constructor(client) {
|
|
68
|
+
this.client = client;
|
|
69
|
+
}
|
|
70
|
+
connect(params) {
|
|
71
|
+
const validated = SubscribeToRawUpdatesParamsSchema.safeParse(params);
|
|
72
|
+
if (!validated.success) {
|
|
73
|
+
throw new errors_1.ValidationError(`Parameter validation failed: ${validated.error.issues.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`);
|
|
74
|
+
}
|
|
75
|
+
const { beginExclusive, endInclusive, idleTimeoutMs } = validated.data;
|
|
76
|
+
if (endInclusive !== undefined && endInclusive < beginExclusive) {
|
|
77
|
+
throw new errors_1.ValidationError(`endInclusive (${endInclusive}) must not be before beginExclusive (${beginExclusive})`);
|
|
78
|
+
}
|
|
79
|
+
return (0, raw_frame_stream_1.openRawFrameStream)({
|
|
80
|
+
client: this.client,
|
|
81
|
+
name: 'updates',
|
|
82
|
+
path,
|
|
83
|
+
request: {
|
|
84
|
+
beginExclusive,
|
|
85
|
+
...(endInclusive !== undefined && { endInclusive }),
|
|
86
|
+
updateFormat: params.updateFormat,
|
|
87
|
+
},
|
|
88
|
+
beginExclusive,
|
|
89
|
+
dataKey: 'update',
|
|
90
|
+
offsetKinds: OFFSET_KINDS,
|
|
91
|
+
onFrame: params.onFrame,
|
|
92
|
+
idleTimeoutMs,
|
|
93
|
+
onTokenExpiring: params.onTokenExpiring,
|
|
94
|
+
onTokenRefreshNeeded: params.onTokenRefreshNeeded,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.SubscribeToRawUpdates = SubscribeToRawUpdates;
|
|
99
|
+
//# sourceMappingURL=subscribe-to-raw-updates.js.map
|
package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-to-raw-updates.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-raw-updates.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uDAA6D;AAG7D,iEAA4F;AAC5F,gEAA0G;AAE1G,MAAM,IAAI,GAAG,aAAsB,CAAC;AAKpC,sDAAsD;AACtD,MAAM,YAAY,GAA6B;IAC7C,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,aAAa;CACd,CAAC;AAKF,MAAM,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,YAAY,EAAE,4BAAkB;IAChC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,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nD,YAAY,EAAE,MAAM,CAAC,YAAY;aAClC;YACD,cAAc;YACd,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,YAAY;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,aAAa;YACb,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -27,8 +27,23 @@ export declare enum TransactionShape {
|
|
|
27
27
|
TRANSACTION_SHAPE_ACS_DELTA = "TRANSACTION_SHAPE_ACS_DELTA",
|
|
28
28
|
TRANSACTION_SHAPE_LEDGER_EFFECTS = "TRANSACTION_SHAPE_LEDGER_EFFECTS"
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Either `parties` (optional; an empty or missing list falls back to the client's party list) or `anyParty: true`
|
|
32
|
+
* (every party the participant hosts, through `filtersForAnyParty`; needs `CanReadAsAnyParty`), never both.
|
|
33
|
+
*/
|
|
34
|
+
declare const SubscribeToUpdatesParamsSchema: z.ZodPipe<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
35
|
+
templateIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
interfaceIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
includeInterfaceView: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
includeCreatedEventBlob: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
beginExclusive: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
endInclusive: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
includeReassignments: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
includeTopologyEvents: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
transactionShape: z.ZodOptional<z.ZodEnum<typeof TransactionShape>>;
|
|
31
44
|
parties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
anyParty: z.ZodOptional<z.ZodUndefined>;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
47
|
templateIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
48
|
interfaceIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
49
|
includeInterfaceView: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -38,7 +53,9 @@ declare const SubscribeToUpdatesParamsSchema: z.ZodObject<{
|
|
|
38
53
|
includeReassignments: z.ZodOptional<z.ZodBoolean>;
|
|
39
54
|
includeTopologyEvents: z.ZodOptional<z.ZodBoolean>;
|
|
40
55
|
transactionShape: z.ZodOptional<z.ZodEnum<typeof TransactionShape>>;
|
|
41
|
-
|
|
56
|
+
anyParty: z.ZodLiteral<true>;
|
|
57
|
+
parties: z.ZodOptional<z.ZodUndefined>;
|
|
58
|
+
}, z.core.$strip>], "anyParty">>;
|
|
42
59
|
export type SubscribeToUpdatesParams = z.infer<typeof SubscribeToUpdatesParamsSchema> & {
|
|
43
60
|
/** Optional per-message callback to consume updates as they arrive. */
|
|
44
61
|
onMessage?: (message: UpdatesWsMessage) => void | Promise<void>;
|
|
@@ -669,6 +686,10 @@ export type UpdatesWsMessage = z.infer<typeof UpdatesWsMessageSchema>;
|
|
|
669
686
|
* that streams real-time updates indefinitely. The connection remains open until manually closed via the returned
|
|
670
687
|
* subscription object or an error occurs.
|
|
671
688
|
*
|
|
689
|
+
* Whose events: `parties` (an empty or missing list falls back to the client's party list), or `anyParty: true` for
|
|
690
|
+
* every party the participant hosts. Frames are delivered after Zod normalization; a raw archiver uses
|
|
691
|
+
* `subscribeToRawUpdates`, which delivers each frame exactly as received.
|
|
692
|
+
*
|
|
672
693
|
* @example
|
|
673
694
|
* ```typescript
|
|
674
695
|
* // Bounded subscription (historical data)
|
|
@@ -686,6 +707,14 @@ export type UpdatesWsMessage = z.infer<typeof UpdatesWsMessageSchema>;
|
|
|
686
707
|
* parties: ['party1'],
|
|
687
708
|
* onMessage: (msg) => console.log(msg)
|
|
688
709
|
* });
|
|
710
|
+
*
|
|
711
|
+
* // Every party the participant hosts (needs CanReadAsAnyParty)
|
|
712
|
+
* await client.subscribeToUpdates({
|
|
713
|
+
* beginExclusive: 2000,
|
|
714
|
+
* anyParty: true,
|
|
715
|
+
* includeTopologyEvents: true,
|
|
716
|
+
* onMessage: (msg) => console.log(msg)
|
|
717
|
+
* });
|
|
689
718
|
* ```;
|
|
690
719
|
*/
|
|
691
720
|
export declare class SubscribeToUpdates {
|
package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-to-updates.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"subscribe-to-updates.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAalF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,oBAAY,gBAAgB;IAC1B,2BAA2B,gCAAgC;IAC3D,gCAAgC,qCAAqC;CACtE;AAgCD;;;GAGG;AACH,QAAA,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;gCAanC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAA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;;;;;;GAyCG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,mBAAmB,EAAI;IAE/C,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqJpE;CACF"}
|
|
@@ -7,6 +7,7 @@ const WebSocketClient_1 = require("../../../../../core/ws/WebSocketClient");
|
|
|
7
7
|
const errors_2 = require("../../../schemas/api/errors");
|
|
8
8
|
const updates_1 = require("../../../schemas/api/updates");
|
|
9
9
|
const event_format_builder_1 = require("../utils/event-format-builder");
|
|
10
|
+
const party_scope_1 = require("../utils/party-scope");
|
|
10
11
|
const path = '/v2/updates';
|
|
11
12
|
/**
|
|
12
13
|
* The `TransactionShape` enum defines the event shape for `Transaction`s and can have two different flavors AcsDelta
|
|
@@ -35,9 +36,7 @@ var TransactionShape;
|
|
|
35
36
|
TransactionShape["TRANSACTION_SHAPE_ACS_DELTA"] = "TRANSACTION_SHAPE_ACS_DELTA";
|
|
36
37
|
TransactionShape["TRANSACTION_SHAPE_LEDGER_EFFECTS"] = "TRANSACTION_SHAPE_LEDGER_EFFECTS";
|
|
37
38
|
})(TransactionShape || (exports.TransactionShape = TransactionShape = {}));
|
|
38
|
-
const
|
|
39
|
-
/** Optional list of parties to scope the filter. */
|
|
40
|
-
parties: zod_1.z.array(zod_1.z.string()).optional(),
|
|
39
|
+
const SubscribeToUpdatesFilterSchema = zod_1.z.object({
|
|
41
40
|
/** Optional template filters applied server-side. */
|
|
42
41
|
templateIds: zod_1.z.array(zod_1.z.string()).optional(),
|
|
43
42
|
/** Optional interface filters applied server-side. */
|
|
@@ -61,11 +60,27 @@ const SubscribeToUpdatesParamsSchema = zod_1.z.object({
|
|
|
61
60
|
endInclusive: zod_1.z.number().optional(),
|
|
62
61
|
/** Include reassignments in the stream (default true). */
|
|
63
62
|
includeReassignments: zod_1.z.boolean().optional(),
|
|
64
|
-
/** Include topology events in the stream (default false). */
|
|
63
|
+
/** Include topology events in the stream (default false); with `anyParty`, for every party. */
|
|
65
64
|
includeTopologyEvents: zod_1.z.boolean().optional(),
|
|
66
65
|
/** Transaction shape (default TRANSACTION_SHAPE_LEDGER_EFFECTS). */
|
|
67
66
|
transactionShape: zod_1.z.nativeEnum(TransactionShape).optional(),
|
|
68
67
|
});
|
|
68
|
+
/**
|
|
69
|
+
* Either `parties` (optional; an empty or missing list falls back to the client's party list) or `anyParty: true`
|
|
70
|
+
* (every party the participant hosts, through `filtersForAnyParty`; needs `CanReadAsAnyParty`), never both.
|
|
71
|
+
*/
|
|
72
|
+
const SubscribeToUpdatesParamsSchema = (0, party_scope_1.partyScopeGuard)('parties').pipe(zod_1.z.discriminatedUnion('anyParty', [
|
|
73
|
+
SubscribeToUpdatesFilterSchema.extend({
|
|
74
|
+
/** Optional list of parties to scope the filter. Defaults to the client's party list. */
|
|
75
|
+
parties: zod_1.z.array(zod_1.z.string()).optional(),
|
|
76
|
+
anyParty: zod_1.z.undefined().optional(),
|
|
77
|
+
}),
|
|
78
|
+
SubscribeToUpdatesFilterSchema.extend({
|
|
79
|
+
/** Read as every party the participant hosts. Needs the `CanReadAsAnyParty` right. */
|
|
80
|
+
anyParty: zod_1.z.literal(true),
|
|
81
|
+
parties: zod_1.z.undefined().optional(),
|
|
82
|
+
}),
|
|
83
|
+
]));
|
|
69
84
|
/**
|
|
70
85
|
* Runtime wire union for `/v2/updates` WebSocket frames.
|
|
71
86
|
*
|
|
@@ -98,6 +113,10 @@ function formatZodIssues(error) {
|
|
|
98
113
|
* that streams real-time updates indefinitely. The connection remains open until manually closed via the returned
|
|
99
114
|
* subscription object or an error occurs.
|
|
100
115
|
*
|
|
116
|
+
* Whose events: `parties` (an empty or missing list falls back to the client's party list), or `anyParty: true` for
|
|
117
|
+
* every party the participant hosts. Frames are delivered after Zod normalization; a raw archiver uses
|
|
118
|
+
* `subscribeToRawUpdates`, which delivers each frame exactly as received.
|
|
119
|
+
*
|
|
101
120
|
* @example
|
|
102
121
|
* ```typescript
|
|
103
122
|
* // Bounded subscription (historical data)
|
|
@@ -115,6 +134,14 @@ function formatZodIssues(error) {
|
|
|
115
134
|
* parties: ['party1'],
|
|
116
135
|
* onMessage: (msg) => console.log(msg)
|
|
117
136
|
* });
|
|
137
|
+
*
|
|
138
|
+
* // Every party the participant hosts (needs CanReadAsAnyParty)
|
|
139
|
+
* await client.subscribeToUpdates({
|
|
140
|
+
* beginExclusive: 2000,
|
|
141
|
+
* anyParty: true,
|
|
142
|
+
* includeTopologyEvents: true,
|
|
143
|
+
* onMessage: (msg) => console.log(msg)
|
|
144
|
+
* });
|
|
118
145
|
* ```;
|
|
119
146
|
*/
|
|
120
147
|
class SubscribeToUpdates {
|
|
@@ -129,11 +156,15 @@ class SubscribeToUpdates {
|
|
|
129
156
|
const ledgerEnd = await this.client.getLedgerEnd({});
|
|
130
157
|
beginExclusive = ledgerEnd.offset;
|
|
131
158
|
}
|
|
132
|
-
//
|
|
133
|
-
const
|
|
159
|
+
// Whose events to read: every party (anyParty), or the given parties, defaulting to the client's party list.
|
|
160
|
+
const scope = validated.anyParty === true
|
|
161
|
+
? { anyParty: true }
|
|
162
|
+
: {
|
|
163
|
+
parties: validated.parties && validated.parties.length > 0 ? validated.parties : this.client.buildPartyList(),
|
|
164
|
+
};
|
|
134
165
|
// Build update format: transactions, plus reassignments (default) and topology events (opt-in)
|
|
135
166
|
const updateFormat = (0, event_format_builder_1.buildUpdateFormat)({
|
|
136
|
-
|
|
167
|
+
...scope,
|
|
137
168
|
...(validated.templateIds !== undefined && { templateIds: validated.templateIds }),
|
|
138
169
|
...(validated.interfaceIds !== undefined && { interfaceIds: validated.interfaceIds }),
|
|
139
170
|
...(validated.includeInterfaceView !== undefined && { includeInterfaceView: validated.includeInterfaceView }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe-to-updates.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uDAAsD;AACtD,4EAIgD;AAEhD,wDAKqC;AACrC,0DAA8D;AAC9D,wEAAkE;
|
|
1
|
+
{"version":3,"file":"subscribe-to-updates.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uDAAsD;AACtD,4EAIgD;AAEhD,wDAKqC;AACrC,0DAA8D;AAC9D,wEAAkE;AAClE,sDAAwE;AAExE,MAAM,IAAI,GAAG,aAAsB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+EAA2D,CAAA;IAC3D,yFAAqE,CAAA;AACvE,CAAC,EAHW,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAG3B;AAED,MAAM,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,qDAAqD;IACrD,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,sDAAsD;IACtD,YAAY,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,yEAAyE;IACzE,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5C,4FAA4F;IAC5F,uBAAuB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/C,yFAAyF;IACzF,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC;;;;;;;;;OASG;IACH,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,0DAA0D;IAC1D,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5C,+F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