@settlemint/dalp-cli 3.0.6-main.28331023435 → 3.0.6-main.28332706331

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.
Files changed (2) hide show
  1. package/dist/dalp.js +161 -3
  2. package/package.json +1 -1
package/dist/dalp.js CHANGED
@@ -51872,6 +51872,76 @@ async function fetchWithAttemptHeader(request, init, innerFetch) {
51872
51872
  }
51873
51873
  return fetchWithTrackedAttempt();
51874
51874
  }
51875
+ var CONSISTENCY_TOKEN_HEADER = "X-Consistency-Token";
51876
+ function serializeConsistencyToken(token) {
51877
+ const parts = [];
51878
+ if (typeof token.reachedBlock === "number") {
51879
+ parts.push(`reached=${token.reachedBlock}`);
51880
+ }
51881
+ if (typeof token.drainedBlock === "number") {
51882
+ parts.push(`drained=${token.drainedBlock}`);
51883
+ }
51884
+ return parts.length > 0 ? parts.join(";") : undefined;
51885
+ }
51886
+ function parseConsistencyToken(headerValue) {
51887
+ const token = {};
51888
+ if (!headerValue) {
51889
+ return token;
51890
+ }
51891
+ for (const part of headerValue.split(";")) {
51892
+ const [rawAxis, rawBlock] = part.split("=");
51893
+ const axis = (rawAxis ?? "").trim();
51894
+ const trimmedBlock = (rawBlock ?? "").trim();
51895
+ if (trimmedBlock === "") {
51896
+ continue;
51897
+ }
51898
+ const block = Number(trimmedBlock);
51899
+ if (!Number.isFinite(block)) {
51900
+ continue;
51901
+ }
51902
+ if (axis === "reached") {
51903
+ token.reachedBlock = block;
51904
+ } else if (axis === "drained") {
51905
+ token.drainedBlock = block;
51906
+ }
51907
+ }
51908
+ return token;
51909
+ }
51910
+ function mergeConsistencyToken(base, incoming) {
51911
+ const merged = { ...base };
51912
+ if (typeof incoming.reachedBlock === "number") {
51913
+ merged.reachedBlock = Math.max(base.reachedBlock ?? 0, incoming.reachedBlock);
51914
+ }
51915
+ if (typeof incoming.drainedBlock === "number") {
51916
+ merged.drainedBlock = Math.max(base.drainedBlock ?? 0, incoming.drainedBlock);
51917
+ }
51918
+ return merged;
51919
+ }
51920
+ var CHAIN_ID_HEADER = "X-Chain-Id";
51921
+ var ORGANIZATION_HEADER = "x-organization-id";
51922
+ var DEFAULT_CHAIN_KEY = "default";
51923
+ function chainKey(requestHeaders) {
51924
+ const chain = requestHeaders.get(CHAIN_ID_HEADER)?.trim() || DEFAULT_CHAIN_KEY;
51925
+ const org = requestHeaders.get(ORGANIZATION_HEADER)?.trim();
51926
+ return org ? `${org}\x00${chain}` : chain;
51927
+ }
51928
+ function createConsistencyStore() {
51929
+ const byChain = new Map;
51930
+ return {
51931
+ capture(requestHeaders, responseHeaders) {
51932
+ const incoming = parseConsistencyToken(responseHeaders.get(CONSISTENCY_TOKEN_HEADER) ?? undefined);
51933
+ if (incoming.reachedBlock === undefined && incoming.drainedBlock === undefined) {
51934
+ return;
51935
+ }
51936
+ const key = chainKey(requestHeaders);
51937
+ byChain.set(key, mergeConsistencyToken(byChain.get(key) ?? {}, incoming));
51938
+ },
51939
+ tokenFor(requestHeaders) {
51940
+ const token = byChain.get(chainKey(requestHeaders));
51941
+ return token ? serializeConsistencyToken(token) : undefined;
51942
+ }
51943
+ };
51944
+ }
51875
51945
  function isPlainObject6(value2) {
51876
51946
  return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
51877
51947
  }
@@ -67622,6 +67692,34 @@ var ENTRIES_INDEX = {
67622
67692
  },
67623
67693
  owner: "dapi"
67624
67694
  },
67695
+ "DALP-0641": {
67696
+ id: "DALP-0641",
67697
+ kind: "route",
67698
+ category: "dependency",
67699
+ status: 503,
67700
+ retryable: true,
67701
+ expectedClientError: false,
67702
+ public: {
67703
+ message: "The indexer has not yet caught up to the most recent write",
67704
+ why: "This read was held until the indexer drained past the most recent write for this organization, and that did not finish within the allowed wait.",
67705
+ fix: "Retry after a short backoff. If the problem continues, contact support with the request id."
67706
+ },
67707
+ observability: {
67708
+ severity: "error",
67709
+ otelEventName: "dapi.error",
67710
+ metricAttributeKey: "dapi.error.id",
67711
+ dimensions: [
67712
+ "error.id",
67713
+ "error.category",
67714
+ "surface",
67715
+ "route",
67716
+ "status_class",
67717
+ "retryable"
67718
+ ]
67719
+ },
67720
+ owner: "dapi",
67721
+ orpcCode: "SYSTEM_CONSISTENCY_TIMEOUT"
67722
+ },
67625
67723
  "DALP-0645": {
67626
67724
  id: "DALP-0645",
67627
67725
  kind: "route",
@@ -94125,6 +94223,7 @@ var DALP_ERROR_TYPED_FIELD_NAMES = {
94125
94223
  "DALP-0638": [],
94126
94224
  "DALP-0639": [],
94127
94225
  "DALP-0640": [],
94226
+ "DALP-0641": [],
94128
94227
  "DALP-0645": [
94129
94228
  "availableKeys",
94130
94229
  "key"
@@ -104198,6 +104297,7 @@ var DALP_ERROR_DATA_SCHEMA_BY_ID = {
104198
104297
  "DALP-0638": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA,
104199
104298
  "DALP-0639": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA,
104200
104299
  "DALP-0640": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA,
104300
+ "DALP-0641": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA,
104201
104301
  "DALP-0645": DALP_ORPC_ERROR_DATA_BASE_SCHEMA.extend({
104202
104302
  availableKeys: exports_external.array(exports_external.string()),
104203
104303
  key: exports_external.string()
@@ -117446,6 +117546,10 @@ var CUSTOM_ERRORS = {
117446
117546
  status: 500,
117447
117547
  message: "Compliance module uninstall failed"
117448
117548
  },
117549
+ SYSTEM_CONSISTENCY_TIMEOUT: {
117550
+ status: 503,
117551
+ message: "The indexer has not yet caught up to the most recent write"
117552
+ },
117449
117553
  SYSTEM_DEPLOYMENT_FAILED: {
117450
117554
  status: 503,
117451
117555
  message: "System deployment failed"
@@ -144106,7 +144210,7 @@ function normalizeDalpBaseUrl(url2) {
144106
144210
  }
144107
144211
  var package_default = {
144108
144212
  name: "@settlemint/dalp-sdk",
144109
- version: "3.0.6-main.28331023435",
144213
+ version: "3.0.6-main.28332706331",
144110
144214
  private: false,
144111
144215
  description: "Fully typed SDK for the DALP tokenization platform API",
144112
144216
  homepage: "https://settlemint.com",
@@ -144225,7 +144329,30 @@ function createDalpClient(config3) {
144225
144329
  plugins.push(new ResponseValidationPlugin(rpcContract));
144226
144330
  }
144227
144331
  const innerFetch = customFetch ?? globalThis.fetch.bind(globalThis);
144228
- const wrappedFetch = (request, init) => fetchWithAttemptHeader(request, init, innerFetch);
144332
+ const consistencyStore = createConsistencyStore();
144333
+ const wrappedFetch = async (request, init) => {
144334
+ const method = (request instanceof Request ? request.method : init?.method ?? "GET").toUpperCase();
144335
+ const requestHeaders = request instanceof Request ? new Headers(request.headers) : new Headers(init?.headers);
144336
+ if (request instanceof Request && init?.headers) {
144337
+ new Headers(init.headers).forEach((value3, key) => requestHeaders.set(key, value3));
144338
+ }
144339
+ let effectiveRequest = request;
144340
+ let effectiveInit = init;
144341
+ if (method === "GET" && !requestHeaders.has(CONSISTENCY_TOKEN_HEADER)) {
144342
+ const token = consistencyStore.tokenFor(requestHeaders);
144343
+ if (token) {
144344
+ requestHeaders.set(CONSISTENCY_TOKEN_HEADER, token);
144345
+ if (request instanceof Request) {
144346
+ effectiveRequest = new Request(request, { headers: requestHeaders });
144347
+ } else {
144348
+ effectiveInit = { ...init, headers: requestHeaders };
144349
+ }
144350
+ }
144351
+ }
144352
+ const response = await fetchWithAttemptHeader(effectiveRequest, effectiveInit, innerFetch);
144353
+ consistencyStore.capture(requestHeaders, response.headers);
144354
+ return response;
144355
+ };
144229
144356
  const link = new OpenAPILink(rpcContract, {
144230
144357
  url: `${baseUrl}/api/v2`,
144231
144358
  headers: async (options, path4) => {
@@ -145229,6 +145356,7 @@ var DAPI_ROUTE_ERROR_IDS = {
145229
145356
  "DALP-0638": "DALP-0638",
145230
145357
  "DALP-0639": "DALP-0639",
145231
145358
  "DALP-0640": "DALP-0640",
145359
+ "DALP-0641": "DALP-0641",
145232
145360
  "DALP-0645": "DALP-0645",
145233
145361
  "DALP-0646": "DALP-0646",
145234
145362
  "DALP-0647": "DALP-0647",
@@ -145326,7 +145454,7 @@ var failedStateSet = new Set(FAILED_TRANSACTION_STATES);
145326
145454
  // package.json
145327
145455
  var package_default2 = {
145328
145456
  name: "@settlemint/dalp-cli",
145329
- version: "3.0.6-main.28331023435",
145457
+ version: "3.0.6-main.28332706331",
145330
145458
  private: false,
145331
145459
  description: "CLI for the Digital Asset Lifecycle Platform — manage tokens, identities, compliance, and more from the command line.",
145332
145460
  homepage: "https://settlemint.com",
@@ -162348,6 +162476,34 @@ var ENTRIES_INDEX2 = {
162348
162476
  },
162349
162477
  owner: "dapi"
162350
162478
  },
162479
+ "DALP-0641": {
162480
+ id: "DALP-0641",
162481
+ kind: "route",
162482
+ category: "dependency",
162483
+ status: 503,
162484
+ retryable: true,
162485
+ expectedClientError: false,
162486
+ public: {
162487
+ message: "The indexer has not yet caught up to the most recent write",
162488
+ why: "This read was held until the indexer drained past the most recent write for this organization, and that did not finish within the allowed wait.",
162489
+ fix: "Retry after a short backoff. If the problem continues, contact support with the request id."
162490
+ },
162491
+ observability: {
162492
+ severity: "error",
162493
+ otelEventName: "dapi.error",
162494
+ metricAttributeKey: "dapi.error.id",
162495
+ dimensions: [
162496
+ "error.id",
162497
+ "error.category",
162498
+ "surface",
162499
+ "route",
162500
+ "status_class",
162501
+ "retryable"
162502
+ ]
162503
+ },
162504
+ owner: "dapi",
162505
+ orpcCode: "SYSTEM_CONSISTENCY_TIMEOUT"
162506
+ },
162351
162507
  "DALP-0645": {
162352
162508
  id: "DALP-0645",
162353
162509
  kind: "route",
@@ -188868,6 +189024,7 @@ var DALP_ERROR_TYPED_FIELD_NAMES2 = {
188868
189024
  "DALP-0638": [],
188869
189025
  "DALP-0639": [],
188870
189026
  "DALP-0640": [],
189027
+ "DALP-0641": [],
188871
189028
  "DALP-0645": [
188872
189029
  "availableKeys",
188873
189030
  "key"
@@ -198943,6 +199100,7 @@ var DALP_ERROR_DATA_SCHEMA_BY_ID2 = {
198943
199100
  "DALP-0638": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198944
199101
  "DALP-0639": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198945
199102
  "DALP-0640": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
199103
+ "DALP-0641": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198946
199104
  "DALP-0645": DALP_ORPC_ERROR_DATA_BASE_SCHEMA2.extend({
198947
199105
  availableKeys: exports_external.array(exports_external.string()),
198948
199106
  key: exports_external.string()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-cli",
3
- "version": "3.0.6-main.28331023435",
3
+ "version": "3.0.6-main.28332706331",
4
4
  "private": false,
5
5
  "description": "CLI for the Digital Asset Lifecycle Platform — manage tokens, identities, compliance, and more from the command line.",
6
6
  "homepage": "https://settlemint.com",