notaryos 2.0.0 → 2.1.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/README.md +52 -97
- package/dist/index.d.mts +67 -152
- package/dist/index.d.ts +67 -152
- package/dist/index.js +54 -297
- package/dist/index.mjs +54 -295
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -21,10 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AuthenticationError: () => AuthenticationError,
|
|
24
|
-
CounterfactualClient: () => CounterfactualClient,
|
|
25
24
|
NotaryClient: () => NotaryClient,
|
|
26
25
|
NotaryError: () => NotaryError,
|
|
27
|
-
NotaryErrorCode: () => NotaryErrorCode,
|
|
28
26
|
RateLimitError: () => RateLimitError,
|
|
29
27
|
SDK_VERSION: () => SDK_VERSION,
|
|
30
28
|
ValidationError: () => ValidationError,
|
|
@@ -32,27 +30,7 @@ __export(index_exports, {
|
|
|
32
30
|
verifyReceipt: () => verifyReceipt
|
|
33
31
|
});
|
|
34
32
|
module.exports = __toCommonJS(index_exports);
|
|
35
|
-
var SDK_VERSION = "2.
|
|
36
|
-
var NotaryErrorCode = {
|
|
37
|
-
// 4xx Client Errors
|
|
38
|
-
ERR_RECEIPT_NOT_FOUND: "ERR_RECEIPT_NOT_FOUND",
|
|
39
|
-
ERR_INVALID_SIGNATURE: "ERR_INVALID_SIGNATURE",
|
|
40
|
-
ERR_INVALID_STRUCTURE: "ERR_INVALID_STRUCTURE",
|
|
41
|
-
ERR_INVALID_TIMESTAMP: "ERR_INVALID_TIMESTAMP",
|
|
42
|
-
ERR_UNKNOWN_SIGNER: "ERR_UNKNOWN_SIGNER",
|
|
43
|
-
ERR_UNSUPPORTED_ALGORITHM: "ERR_UNSUPPORTED_ALGORITHM",
|
|
44
|
-
ERR_CHAIN_BROKEN: "ERR_CHAIN_BROKEN",
|
|
45
|
-
ERR_CHAIN_MISSING: "ERR_CHAIN_MISSING",
|
|
46
|
-
ERR_PAYLOAD_TOO_LARGE: "ERR_PAYLOAD_TOO_LARGE",
|
|
47
|
-
ERR_RATE_LIMIT_EXCEEDED: "ERR_RATE_LIMIT_EXCEEDED",
|
|
48
|
-
ERR_INVALID_API_KEY: "ERR_INVALID_API_KEY",
|
|
49
|
-
ERR_INSUFFICIENT_SCOPE: "ERR_INSUFFICIENT_SCOPE",
|
|
50
|
-
ERR_VALIDATION_FAILED: "ERR_VALIDATION_FAILED",
|
|
51
|
-
// 5xx Server Errors
|
|
52
|
-
ERR_INTERNAL_ERROR: "ERR_INTERNAL_ERROR",
|
|
53
|
-
ERR_DATABASE_ERROR: "ERR_DATABASE_ERROR",
|
|
54
|
-
ERR_SIGNING_ERROR: "ERR_SIGNING_ERROR"
|
|
55
|
-
};
|
|
33
|
+
var SDK_VERSION = "2.1.0";
|
|
56
34
|
var NotaryError = class extends Error {
|
|
57
35
|
constructor(message, code = "", status = 0, details = {}) {
|
|
58
36
|
super(message);
|
|
@@ -81,81 +59,10 @@ var ValidationError = class extends NotaryError {
|
|
|
81
59
|
this.name = "ValidationError";
|
|
82
60
|
}
|
|
83
61
|
};
|
|
84
|
-
var CounterfactualClient = class {
|
|
85
|
-
constructor(client) {
|
|
86
|
-
this.client = client;
|
|
87
|
-
}
|
|
88
|
-
/** Issue a v1 counterfactual receipt (proof of non-action). */
|
|
89
|
-
async issue(options) {
|
|
90
|
-
return this.client["request"]("POST", "/counterfactual/issue", {
|
|
91
|
-
action_not_taken: options.actionNotTaken,
|
|
92
|
-
capability_proof: options.capabilityProof,
|
|
93
|
-
opportunity_context: options.opportunityContext,
|
|
94
|
-
decision_reason: options.decisionReason,
|
|
95
|
-
declination_reason: options.declinationReason || "unknown",
|
|
96
|
-
provenance_refs: options.provenanceRefs,
|
|
97
|
-
validity_window_minutes: options.validityWindowMinutes || 60
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/** Retrieve/verify a counterfactual receipt by hash (public). */
|
|
101
|
-
async get(receiptHash) {
|
|
102
|
-
return this.client["publicGet"](`/v1/notary/counterfactual/r/${receiptHash}`);
|
|
103
|
-
}
|
|
104
|
-
/** List counterfactual receipts for a specific agent (public). */
|
|
105
|
-
async listByAgent(agentId, limit = 50, offset = 0) {
|
|
106
|
-
return this.client["publicGet"](
|
|
107
|
-
`/v1/notary/counterfactual/agent/${agentId}?limit=${limit}&offset=${offset}`
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
/** Commit a v2 counterfactual receipt (Phase 1 of commit-reveal). */
|
|
111
|
-
async commit(options) {
|
|
112
|
-
return this.client["request"]("POST", "/counterfactual/commit", {
|
|
113
|
-
action_not_taken: options.actionNotTaken,
|
|
114
|
-
capability_proof: options.capabilityProof,
|
|
115
|
-
opportunity_context: options.opportunityContext,
|
|
116
|
-
decision_reason: options.decisionReason,
|
|
117
|
-
declination_reason: options.declinationReason || "unknown",
|
|
118
|
-
provenance_refs: options.provenanceRefs,
|
|
119
|
-
validity_window_minutes: options.validityWindowMinutes || 60,
|
|
120
|
-
min_reveal_delay_seconds: options.minRevealDelaySeconds || 300,
|
|
121
|
-
max_reveal_window_seconds: options.maxRevealWindowSeconds || 86400
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/** Reveal a committed counterfactual receipt (Phase 2). */
|
|
125
|
-
async reveal(receiptHash, decisionReasonPlaintext) {
|
|
126
|
-
return this.client["request"]("POST", "/counterfactual/reveal", {
|
|
127
|
-
receipt_hash: receiptHash,
|
|
128
|
-
decision_reason_plaintext: decisionReasonPlaintext
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/** Check commit-reveal lifecycle status (public). */
|
|
132
|
-
async commitStatus(receiptHash) {
|
|
133
|
-
return this.client["publicGet"](
|
|
134
|
-
`/v1/notary/counterfactual/commit-status/${receiptHash}`
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
/** Counter-sign a counterfactual receipt (corroboration). */
|
|
138
|
-
async corroborate(receiptHash, signals) {
|
|
139
|
-
return this.client["request"]("POST", "/counterfactual/corroborate", {
|
|
140
|
-
receipt_hash: receiptHash,
|
|
141
|
-
corroboration_signals: signals
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
/** Generate a compliance certificate for a counterfactual receipt (public). */
|
|
145
|
-
async certificate(receiptHash, format = "markdown") {
|
|
146
|
-
return this.client["publicGet"](
|
|
147
|
-
`/v1/notary/counterfactual/r/${receiptHash}/certificate?format=${format}`
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
/** Verify counterfactual chain continuity for an agent (public). */
|
|
151
|
-
async verifyChain(agentId) {
|
|
152
|
-
return this.client["publicGet"](
|
|
153
|
-
`/v1/notary/counterfactual/chain/${agentId}/verify`
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
62
|
var _NotaryClient = class _NotaryClient {
|
|
158
63
|
constructor(config) {
|
|
64
|
+
/** Alias: seal() → issue() for the 3-line integration pattern. */
|
|
65
|
+
this.seal = this.issue.bind(this);
|
|
159
66
|
const { apiKey, baseUrl, timeout, maxRetries } = config;
|
|
160
67
|
if (!apiKey || !(apiKey.startsWith("notary_live_") || apiKey.startsWith("notary_test_"))) {
|
|
161
68
|
throw new AuthenticationError(
|
|
@@ -167,13 +74,6 @@ var _NotaryClient = class _NotaryClient {
|
|
|
167
74
|
this.timeout = timeout || _NotaryClient.DEFAULT_TIMEOUT;
|
|
168
75
|
this.maxRetries = maxRetries ?? 2;
|
|
169
76
|
}
|
|
170
|
-
/** Access counterfactual receipt operations (enterprise premium). */
|
|
171
|
-
get counterfactual() {
|
|
172
|
-
if (!this._counterfactual) {
|
|
173
|
-
this._counterfactual = new CounterfactualClient(this);
|
|
174
|
-
}
|
|
175
|
-
return this._counterfactual;
|
|
176
|
-
}
|
|
177
77
|
async request(method, path, body) {
|
|
178
78
|
const url = `${this.baseUrl}/v1/notary${path}`;
|
|
179
79
|
const headers = {
|
|
@@ -241,52 +141,43 @@ var _NotaryClient = class _NotaryClient {
|
|
|
241
141
|
}
|
|
242
142
|
throw lastError || new NotaryError("Request failed", "ERR_UNKNOWN");
|
|
243
143
|
}
|
|
244
|
-
/** Public GET helper (no API key in headers). */
|
|
245
|
-
async publicGet(path) {
|
|
246
|
-
const url = `${this.baseUrl}${path}`;
|
|
247
|
-
const controller = new AbortController();
|
|
248
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
249
|
-
try {
|
|
250
|
-
const response = await fetch(url, {
|
|
251
|
-
method: "GET",
|
|
252
|
-
headers: {
|
|
253
|
-
"Content-Type": "application/json",
|
|
254
|
-
"User-Agent": `notary-typescript-sdk/${SDK_VERSION}`
|
|
255
|
-
},
|
|
256
|
-
signal: controller.signal
|
|
257
|
-
});
|
|
258
|
-
clearTimeout(timeoutId);
|
|
259
|
-
if (response.status === 404) {
|
|
260
|
-
return { found: false };
|
|
261
|
-
}
|
|
262
|
-
if (!response.ok) {
|
|
263
|
-
throw new NotaryError(response.statusText, "ERR_REQUEST", response.status);
|
|
264
|
-
}
|
|
265
|
-
return await response.json();
|
|
266
|
-
} catch (err) {
|
|
267
|
-
clearTimeout(timeoutId);
|
|
268
|
-
if (err instanceof NotaryError) throw err;
|
|
269
|
-
throw new NotaryError(`Connection failed: ${err.message}`, "ERR_CONNECTION");
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
144
|
sleep(ms) {
|
|
273
145
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
274
146
|
}
|
|
275
|
-
// =========================================================================
|
|
276
|
-
// Core API
|
|
277
|
-
// =========================================================================
|
|
278
147
|
/**
|
|
279
148
|
* Issue a signed receipt for an action.
|
|
280
149
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
150
|
+
* Supports two calling conventions:
|
|
151
|
+
* - `issue('action_type', { key: 'value' })` — positional args
|
|
152
|
+
* - `issue({ actionType: 'action_type', payload: { key: 'value' } })` — object form
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // Positional (recommended)
|
|
157
|
+
* const receipt = await notary.issue('transfer', { amount: 100 });
|
|
158
|
+
*
|
|
159
|
+
* // Object form
|
|
160
|
+
* const receipt = await notary.issue({ actionType: 'transfer', payload: { amount: 100 } });
|
|
161
|
+
* ```
|
|
285
162
|
*/
|
|
286
|
-
async issue(
|
|
163
|
+
async issue(actionTypeOrRequest, payload, options = {}) {
|
|
164
|
+
let actionType;
|
|
165
|
+
let actionPayload;
|
|
166
|
+
if (typeof actionTypeOrRequest === "object" && actionTypeOrRequest !== null) {
|
|
167
|
+
actionType = actionTypeOrRequest.actionType;
|
|
168
|
+
actionPayload = actionTypeOrRequest.payload || {};
|
|
169
|
+
options = {
|
|
170
|
+
previousReceiptHash: actionTypeOrRequest.previousReceiptHash,
|
|
171
|
+
metadata: actionTypeOrRequest.metadata,
|
|
172
|
+
...options
|
|
173
|
+
};
|
|
174
|
+
} else {
|
|
175
|
+
actionType = actionTypeOrRequest;
|
|
176
|
+
actionPayload = payload || {};
|
|
177
|
+
}
|
|
287
178
|
const body = {
|
|
288
179
|
action_type: actionType,
|
|
289
|
-
payload
|
|
180
|
+
payload: actionPayload
|
|
290
181
|
};
|
|
291
182
|
if (options.previousReceiptHash) {
|
|
292
183
|
body.previous_receipt_hash = options.previousReceiptHash;
|
|
@@ -302,7 +193,20 @@ var _NotaryClient = class _NotaryClient {
|
|
|
302
193
|
chain_sequence: response.chain_position
|
|
303
194
|
};
|
|
304
195
|
}
|
|
305
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* Verify a receipt's signature and integrity.
|
|
198
|
+
*
|
|
199
|
+
* @param receipt - Receipt object or raw receipt dict
|
|
200
|
+
* @returns VerificationResult with validity details
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const result = await notary.verify(receipt);
|
|
205
|
+
* if (result.valid) {
|
|
206
|
+
* console.log('Receipt is authentic');
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
306
210
|
async verify(receipt) {
|
|
307
211
|
return this.request("POST", "/verify", { receipt });
|
|
308
212
|
}
|
|
@@ -310,7 +214,15 @@ var _NotaryClient = class _NotaryClient {
|
|
|
310
214
|
async verifyById(receiptId) {
|
|
311
215
|
return this.request("POST", "/verify", { receipt_id: receiptId });
|
|
312
216
|
}
|
|
313
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Get Notary service status.
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* const status = await notary.status();
|
|
223
|
+
* console.log(status.status); // "active"
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
314
226
|
async status() {
|
|
315
227
|
return this.request("GET", "/status");
|
|
316
228
|
}
|
|
@@ -322,150 +234,6 @@ var _NotaryClient = class _NotaryClient {
|
|
|
322
234
|
async me() {
|
|
323
235
|
return this.request("GET", "/agents/me");
|
|
324
236
|
}
|
|
325
|
-
/** Look up a receipt by hash (public endpoint). */
|
|
326
|
-
async lookup(receiptHash) {
|
|
327
|
-
return this.publicGet(`/v1/notary/r/${receiptHash}`);
|
|
328
|
-
}
|
|
329
|
-
// =========================================================================
|
|
330
|
-
// History & Provenance
|
|
331
|
-
// =========================================================================
|
|
332
|
-
/**
|
|
333
|
-
* Get paginated receipt history (requires Clerk JWT).
|
|
334
|
-
*
|
|
335
|
-
* @param options - Pagination, filters, and Clerk token
|
|
336
|
-
* @returns Paginated history with items, total, totalPages
|
|
337
|
-
*/
|
|
338
|
-
async history(options = {}) {
|
|
339
|
-
const params = new URLSearchParams();
|
|
340
|
-
params.set("page", String(options.page || 1));
|
|
341
|
-
params.set("page_size", String(options.pageSize || 10));
|
|
342
|
-
if (options.status) params.set("status", options.status);
|
|
343
|
-
if (options.search) params.set("search", options.search);
|
|
344
|
-
if (options.startDate) params.set("start_date", options.startDate);
|
|
345
|
-
if (options.endDate) params.set("end_date", options.endDate);
|
|
346
|
-
const url = `${this.baseUrl}/v1/notary/history?${params.toString()}`;
|
|
347
|
-
const headers = {
|
|
348
|
-
"Content-Type": "application/json",
|
|
349
|
-
"User-Agent": `notary-typescript-sdk/${SDK_VERSION}`
|
|
350
|
-
};
|
|
351
|
-
if (options.clerkToken) {
|
|
352
|
-
headers["Authorization"] = `Bearer ${options.clerkToken}`;
|
|
353
|
-
} else {
|
|
354
|
-
headers["X-API-Key"] = this.apiKey;
|
|
355
|
-
}
|
|
356
|
-
const controller = new AbortController();
|
|
357
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
358
|
-
try {
|
|
359
|
-
const response = await fetch(url, {
|
|
360
|
-
method: "GET",
|
|
361
|
-
headers,
|
|
362
|
-
signal: controller.signal
|
|
363
|
-
});
|
|
364
|
-
clearTimeout(timeoutId);
|
|
365
|
-
if (!response.ok) {
|
|
366
|
-
throw new NotaryError(response.statusText, "ERR_HISTORY", response.status);
|
|
367
|
-
}
|
|
368
|
-
return await response.json();
|
|
369
|
-
} catch (err) {
|
|
370
|
-
clearTimeout(timeoutId);
|
|
371
|
-
if (err instanceof NotaryError) throw err;
|
|
372
|
-
throw new NotaryError(`Connection failed: ${err.message}`, "ERR_CONNECTION");
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Get the provenance DAG report for a receipt (public).
|
|
377
|
-
*
|
|
378
|
-
* @param receiptHash - The receipt hash to check
|
|
379
|
-
* @returns Provenance report with grounding status, ancestors, paths
|
|
380
|
-
*/
|
|
381
|
-
async provenance(receiptHash) {
|
|
382
|
-
return this.publicGet(`/v1/notary/r/${receiptHash}/provenance`);
|
|
383
|
-
}
|
|
384
|
-
// =========================================================================
|
|
385
|
-
// Auto-receipting (wrap)
|
|
386
|
-
// =========================================================================
|
|
387
|
-
/**
|
|
388
|
-
* Wrap an object so method calls are automatically receipted.
|
|
389
|
-
*
|
|
390
|
-
* Uses ES6 Proxy to intercept method calls. Receipts are issued
|
|
391
|
-
* in the background via fire-and-forget (won't slow down your agent).
|
|
392
|
-
*
|
|
393
|
-
* @param obj - The agent or object to wrap
|
|
394
|
-
* @param config - Optional auto-receipt configuration
|
|
395
|
-
* @returns A proxied version of the object
|
|
396
|
-
*
|
|
397
|
-
* @example
|
|
398
|
-
* ```typescript
|
|
399
|
-
* const agent = notary.wrap(myAgent, { mode: 'all', fireAndForget: true });
|
|
400
|
-
* await agent.processData(input); // auto-receipted!
|
|
401
|
-
* ```
|
|
402
|
-
*/
|
|
403
|
-
wrap(obj, config = {}) {
|
|
404
|
-
const client = this;
|
|
405
|
-
const cfg = {
|
|
406
|
-
mode: config.mode || "all",
|
|
407
|
-
sampleRate: config.sampleRate ?? 1,
|
|
408
|
-
fireAndForget: config.fireAndForget ?? true,
|
|
409
|
-
maxPayloadBytes: config.maxPayloadBytes ?? 4096,
|
|
410
|
-
dryRun: config.dryRun ?? false
|
|
411
|
-
};
|
|
412
|
-
const className = obj.constructor?.name || "UnknownAgent";
|
|
413
|
-
let lastHash;
|
|
414
|
-
return new Proxy(obj, {
|
|
415
|
-
get(target, prop, receiver) {
|
|
416
|
-
const value = Reflect.get(target, prop, receiver);
|
|
417
|
-
if (typeof value !== "function" || typeof prop !== "string" || prop.startsWith("_")) {
|
|
418
|
-
return value;
|
|
419
|
-
}
|
|
420
|
-
return async function(...args) {
|
|
421
|
-
const start = performance.now();
|
|
422
|
-
let status = "success";
|
|
423
|
-
let errorType;
|
|
424
|
-
let result;
|
|
425
|
-
try {
|
|
426
|
-
result = await value.apply(target, args);
|
|
427
|
-
return result;
|
|
428
|
-
} catch (err) {
|
|
429
|
-
status = "error";
|
|
430
|
-
errorType = err.constructor?.name || "Error";
|
|
431
|
-
throw err;
|
|
432
|
-
} finally {
|
|
433
|
-
const shouldReceipt = cfg.mode === "all" || cfg.mode === "errors_only" && status === "error" || cfg.mode === "sample" && Math.random() < cfg.sampleRate;
|
|
434
|
-
if (shouldReceipt) {
|
|
435
|
-
const durationMs = Math.round((performance.now() - start) * 100) / 100;
|
|
436
|
-
const payload = {
|
|
437
|
-
agent: className,
|
|
438
|
-
auto_receipt: true,
|
|
439
|
-
function: prop,
|
|
440
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
441
|
-
duration_ms: durationMs,
|
|
442
|
-
status,
|
|
443
|
-
error_type: errorType,
|
|
444
|
-
arguments: _safeRepr(args),
|
|
445
|
-
result_summary: _safeRepr(result)
|
|
446
|
-
};
|
|
447
|
-
if (cfg.dryRun) {
|
|
448
|
-
console.error(`[NotaryOS DRY RUN] ${String(prop)}: ${JSON.stringify(payload)}`);
|
|
449
|
-
} else if (cfg.fireAndForget) {
|
|
450
|
-
client.issue(String(prop), payload, { previousReceiptHash: lastHash }).then((r) => {
|
|
451
|
-
if (r.receipt_hash) lastHash = r.receipt_hash;
|
|
452
|
-
}).catch(() => {
|
|
453
|
-
});
|
|
454
|
-
} else {
|
|
455
|
-
try {
|
|
456
|
-
const r = await client.issue(String(prop), payload, {
|
|
457
|
-
previousReceiptHash: lastHash
|
|
458
|
-
});
|
|
459
|
-
if (r.receipt_hash) lastHash = r.receipt_hash;
|
|
460
|
-
} catch {
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
237
|
};
|
|
470
238
|
_NotaryClient.DEFAULT_BASE_URL = "https://api.agenttownsquare.com";
|
|
471
239
|
_NotaryClient.DEFAULT_TIMEOUT = 3e4;
|
|
@@ -495,22 +263,11 @@ async function computeHash(payload) {
|
|
|
495
263
|
}
|
|
496
264
|
return hex;
|
|
497
265
|
}
|
|
498
|
-
function _safeRepr(value, depth = 3) {
|
|
499
|
-
if (depth <= 0) return value != null ? "..." : null;
|
|
500
|
-
if (value === null || value === void 0) return value;
|
|
501
|
-
if (typeof value === "boolean" || typeof value === "number") return value;
|
|
502
|
-
if (typeof value === "string") return value.length > 500 ? value.slice(0, 500) : value;
|
|
503
|
-
if (Array.isArray(value)) return `<array len=${value.length}>`;
|
|
504
|
-
if (typeof value === "object") return `<object keys=${Object.keys(value).length}>`;
|
|
505
|
-
return `<${typeof value}>`;
|
|
506
|
-
}
|
|
507
266
|
// Annotate the CommonJS export names for ESM import in node:
|
|
508
267
|
0 && (module.exports = {
|
|
509
268
|
AuthenticationError,
|
|
510
|
-
CounterfactualClient,
|
|
511
269
|
NotaryClient,
|
|
512
270
|
NotaryError,
|
|
513
|
-
NotaryErrorCode,
|
|
514
271
|
RateLimitError,
|
|
515
272
|
SDK_VERSION,
|
|
516
273
|
ValidationError,
|