@settlemint/dalp-cli 3.0.6-main.28330760874 → 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 +227 -4
  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"
@@ -134879,6 +134983,43 @@ var PlatformStatusV2DataFreshnessOutputSchema = PanelSchema.extend({
134879
134983
  generatedAt: timestamp(),
134880
134984
  stats: DataFreshnessStatsSchema
134881
134985
  });
134986
+ var DebugBundleCategoryIdSchema = exports_external.enum([
134987
+ "build-deploy",
134988
+ "service-health",
134989
+ "restate-state",
134990
+ "blockchain-rpc",
134991
+ "indexer-didx",
134992
+ "database",
134993
+ "recent-errors",
134994
+ "org-config"
134995
+ ]);
134996
+ var DebugBundleCategoryStatusSchema = exports_external.enum(["ok", "partial", "unavailable", "redacted"]);
134997
+ var DebugBundleCategoryEntrySchema = exports_external.object({
134998
+ id: DebugBundleCategoryIdSchema,
134999
+ title: exports_external.string(),
135000
+ source: exports_external.string(),
135001
+ capturedAt: timestamp(),
135002
+ status: DebugBundleCategoryStatusSchema,
135003
+ file: exports_external.string().optional(),
135004
+ note: exports_external.string().optional()
135005
+ });
135006
+ var DebugBundlePlatformSchema = exports_external.object({
135007
+ version: exports_external.string(),
135008
+ commit: exports_external.string(),
135009
+ deploy: exports_external.string()
135010
+ });
135011
+ var DebugBundleManifestSchema = exports_external.object({
135012
+ schemaVersion: exports_external.literal(1),
135013
+ generatedAt: timestamp(),
135014
+ generatedByRole: exports_external.string(),
135015
+ platform: DebugBundlePlatformSchema,
135016
+ categories: exports_external.array(DebugBundleCategoryEntrySchema)
135017
+ });
135018
+ var PlatformStatusV2DebugBundleInputSchema = exports_external.object({}).strict();
135019
+ var PlatformStatusV2DebugBundleOutputSchema = exports_external.object({
135020
+ manifest: DebugBundleManifestSchema,
135021
+ categories: exports_external.record(exports_external.string(), exports_external.unknown())
135022
+ });
134882
135023
  var PlatformStatusV2PlatformApiInputSchema = exports_external.object({}).strict();
134883
135024
  var PlatformStatusV2PlatformApiOutputSchema = PanelSchema.extend({
134884
135025
  generatedAt: timestamp(),
@@ -135142,6 +135283,13 @@ var history4 = v2Contract.route({
135142
135283
  successDescription: "History retrieved successfully",
135143
135284
  tags: [V2_TAG.platformStatus]
135144
135285
  }).input(v2Input.query(PlatformStatusV2HistoryInputSchema)).output(PlatformStatusV2HistoryOutputSchema);
135286
+ var debugBundle = v2Contract.route({
135287
+ method: "GET",
135288
+ path: "/platform-status/debug-bundle",
135289
+ description: "Whole-environment debug snapshot (manifest + per-category payloads) for offline support triage",
135290
+ successDescription: "Debug bundle collected successfully",
135291
+ tags: [V2_TAG.platformStatus]
135292
+ }).input(v2Input.query(PlatformStatusV2DebugBundleInputSchema)).output(PlatformStatusV2DebugBundleOutputSchema);
135145
135293
  var platformStatusV2Contract = {
135146
135294
  dataFreshness,
135147
135295
  transactions,
@@ -135151,7 +135299,8 @@ var platformStatusV2Contract = {
135151
135299
  transactionsList,
135152
135300
  statCards,
135153
135301
  snapshot,
135154
- history: history4
135302
+ history: history4,
135303
+ debugBundle
135155
135304
  };
135156
135305
  var RestateV2CleanupStaleDeploymentsInputSchema = exports_external.object({
135157
135306
  serviceUrl: exports_external.string().url().meta({
@@ -144061,7 +144210,7 @@ function normalizeDalpBaseUrl(url2) {
144061
144210
  }
144062
144211
  var package_default = {
144063
144212
  name: "@settlemint/dalp-sdk",
144064
- version: "3.0.6-main.28330760874",
144213
+ version: "3.0.6-main.28332706331",
144065
144214
  private: false,
144066
144215
  description: "Fully typed SDK for the DALP tokenization platform API",
144067
144216
  homepage: "https://settlemint.com",
@@ -144180,7 +144329,30 @@ function createDalpClient(config3) {
144180
144329
  plugins.push(new ResponseValidationPlugin(rpcContract));
144181
144330
  }
144182
144331
  const innerFetch = customFetch ?? globalThis.fetch.bind(globalThis);
144183
- 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
+ };
144184
144356
  const link = new OpenAPILink(rpcContract, {
144185
144357
  url: `${baseUrl}/api/v2`,
144186
144358
  headers: async (options, path4) => {
@@ -145184,6 +145356,7 @@ var DAPI_ROUTE_ERROR_IDS = {
145184
145356
  "DALP-0638": "DALP-0638",
145185
145357
  "DALP-0639": "DALP-0639",
145186
145358
  "DALP-0640": "DALP-0640",
145359
+ "DALP-0641": "DALP-0641",
145187
145360
  "DALP-0645": "DALP-0645",
145188
145361
  "DALP-0646": "DALP-0646",
145189
145362
  "DALP-0647": "DALP-0647",
@@ -145281,7 +145454,7 @@ var failedStateSet = new Set(FAILED_TRANSACTION_STATES);
145281
145454
  // package.json
145282
145455
  var package_default2 = {
145283
145456
  name: "@settlemint/dalp-cli",
145284
- version: "3.0.6-main.28330760874",
145457
+ version: "3.0.6-main.28332706331",
145285
145458
  private: false,
145286
145459
  description: "CLI for the Digital Asset Lifecycle Platform — manage tokens, identities, compliance, and more from the command line.",
145287
145460
  homepage: "https://settlemint.com",
@@ -162303,6 +162476,34 @@ var ENTRIES_INDEX2 = {
162303
162476
  },
162304
162477
  owner: "dapi"
162305
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
+ },
162306
162507
  "DALP-0645": {
162307
162508
  id: "DALP-0645",
162308
162509
  kind: "route",
@@ -188823,6 +189024,7 @@ var DALP_ERROR_TYPED_FIELD_NAMES2 = {
188823
189024
  "DALP-0638": [],
188824
189025
  "DALP-0639": [],
188825
189026
  "DALP-0640": [],
189027
+ "DALP-0641": [],
188826
189028
  "DALP-0645": [
188827
189029
  "availableKeys",
188828
189030
  "key"
@@ -198898,6 +199100,7 @@ var DALP_ERROR_DATA_SCHEMA_BY_ID2 = {
198898
199100
  "DALP-0638": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198899
199101
  "DALP-0639": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198900
199102
  "DALP-0640": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
199103
+ "DALP-0641": DALP_ORPC_ERROR_DATA_WIRE_SCHEMA2,
198901
199104
  "DALP-0645": DALP_ORPC_ERROR_DATA_BASE_SCHEMA2.extend({
198902
199105
  availableKeys: exports_external.array(exports_external.string()),
198903
199106
  key: exports_external.string()
@@ -209644,6 +209847,26 @@ platformStatusCommand.command("transactions-list", {
209644
209847
  });
209645
209848
  }
209646
209849
  });
209850
+ platformStatusCommand.command("debug-bundle", {
209851
+ description: "Whole-environment debug export (manifest + per-category payloads) for offline support triage",
209852
+ options: exports_external.object({
209853
+ out: exports_external.string().optional().describe("Directory to write the bundle into (manifest.json + <category>.json); prints JSON when omitted")
209854
+ }),
209855
+ async run(c) {
209856
+ const bundle = await c.var.orpc.platformStatus.debugBundle({ query: {} });
209857
+ if (c.options.out === undefined) {
209858
+ return bundle;
209859
+ }
209860
+ const dir = c.options.out;
209861
+ await Promise.all([
209862
+ Bun.write(`${dir}/manifest.json`, `${JSON.stringify(bundle.manifest, null, 2)}
209863
+ `),
209864
+ ...Object.entries(bundle.categories).map(([id, payload]) => Bun.write(`${dir}/${id}.json`, `${JSON.stringify(payload, null, 2)}
209865
+ `))
209866
+ ]);
209867
+ return { out: dir, manifest: `${dir}/manifest.json`, categories: Object.keys(bundle.categories) };
209868
+ }
209869
+ });
209647
209870
 
209648
209871
  // src/commands/restate.ts
209649
209872
  var restateCommand = exports_Cli.create("restate", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@settlemint/dalp-cli",
3
- "version": "3.0.6-main.28330760874",
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",