glassnode-api 0.1.3 → 0.7.1

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/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './glassnode-api';
2
+ export * from './errors';
2
3
  export * from './types/config';
3
4
  export * from './types/metadata';
package/dist/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./glassnode-api"), exports);
18
+ __exportStar(require("./errors"), exports);
18
19
  __exportStar(require("./types/config"), exports);
19
20
  __exportStar(require("./types/metadata"), exports);
@@ -1,24 +1,23 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * Logger function type for API call logging
4
+ */
5
+ export type Logger = (message: string, ...args: unknown[]) => void;
6
+ /**
7
+ * Fetch function type matching the standard fetch API
8
+ */
9
+ export type FetchFn = typeof fetch;
2
10
  /**
3
11
  * Zod schema for Glassnode API configuration
4
12
  */
5
13
  export declare const GlassnodeConfigSchema: z.ZodObject<{
6
- /**
7
- * API key for authentication
8
- */
9
14
  apiKey: z.ZodString;
10
- /**
11
- * Base URL for the Glassnode API
12
- * @default "https://api.glassnode.com"
13
- */
14
15
  apiUrl: z.ZodDefault<z.ZodString>;
15
- }, "strip", z.ZodTypeAny, {
16
- apiKey: string;
17
- apiUrl: string;
18
- }, {
19
- apiKey: string;
20
- apiUrl?: string | undefined;
21
- }>;
16
+ logger: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
17
+ fetch: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
18
+ maxRetries: z.ZodDefault<z.ZodNumber>;
19
+ retryDelay: z.ZodDefault<z.ZodNumber>;
20
+ }, z.core.$strip>;
22
21
  /**
23
22
  * Configuration for the Glassnode API client
24
23
  */
@@ -15,4 +15,24 @@ exports.GlassnodeConfigSchema = zod_1.z.object({
15
15
  * @default "https://api.glassnode.com"
16
16
  */
17
17
  apiUrl: zod_1.z.string().url().default('https://api.glassnode.com'),
18
+ /**
19
+ * Optional logger for API call debugging
20
+ * @example { logger: console.log }
21
+ */
22
+ logger: zod_1.z.function().optional(),
23
+ /**
24
+ * Optional custom fetch function (e.g. for custom headers, retries, or testing)
25
+ * @default globalThis.fetch
26
+ */
27
+ fetch: zod_1.z.function().optional(),
28
+ /**
29
+ * Maximum number of retries for retryable errors (429 and 5xx)
30
+ * @default 0 (no retries)
31
+ */
32
+ maxRetries: zod_1.z.number().int().nonnegative().default(0),
33
+ /**
34
+ * Base delay in milliseconds between retries (doubles each attempt)
35
+ * @default 1000
36
+ */
37
+ retryDelay: zod_1.z.number().int().positive().default(1000),
18
38
  });
@@ -5,7 +5,11 @@ import { z } from 'zod';
5
5
  /**
6
6
  * External identifier sources schema
7
7
  */
8
- export declare const ExternalIdSourceSchema: z.ZodEnum<["ccdata", "coinmarketcap", "coingecko"]>;
8
+ export declare const ExternalIdSourceSchema: z.ZodEnum<{
9
+ ccdata: "ccdata";
10
+ coinmarketcap: "coinmarketcap";
11
+ coingecko: "coingecko";
12
+ }>;
9
13
  /**
10
14
  * External identifier sources type
11
15
  */
@@ -13,7 +17,11 @@ export type ExternalIdSource = z.infer<typeof ExternalIdSourceSchema>;
13
17
  /**
14
18
  * External identifiers for an asset schema
15
19
  */
16
- export declare const ExternalIdsSchema: z.ZodRecord<z.ZodEnum<["ccdata", "coinmarketcap", "coingecko"]>, z.ZodOptional<z.ZodString>>;
20
+ export declare const ExternalIdsSchema: z.ZodRecord<z.ZodEnum<{
21
+ ccdata: "ccdata";
22
+ coinmarketcap: "coinmarketcap";
23
+ coingecko: "coingecko";
24
+ }>, z.ZodOptional<z.ZodString>>;
17
25
  /**
18
26
  * External identifiers for an asset type
19
27
  */
@@ -22,33 +30,11 @@ export type ExternalIds = z.infer<typeof ExternalIdsSchema>;
22
30
  * Blockchain information for an asset schema
23
31
  */
24
32
  export declare const AssetBlockchainSchema: z.ZodObject<{
25
- /**
26
- * Blockchain name
27
- */
28
33
  blockchain: z.ZodString;
29
- /**
30
- * Token address on the blockchain
31
- */
32
34
  address: z.ZodString;
33
- /**
34
- * Number of decimal places
35
- */
36
35
  decimals: z.ZodNumber;
37
- /**
38
- * Whether on-chain metrics are supported
39
- */
40
36
  on_chain_support: z.ZodBoolean;
41
- }, "strip", z.ZodTypeAny, {
42
- address: string;
43
- blockchain: string;
44
- decimals: number;
45
- on_chain_support: boolean;
46
- }, {
47
- address: string;
48
- blockchain: string;
49
- decimals: number;
50
- on_chain_support: boolean;
51
- }>;
37
+ }, z.core.$strip>;
52
38
  /**
53
39
  * Blockchain information for an asset type
54
40
  */
@@ -57,82 +43,22 @@ export type AssetBlockchain = z.infer<typeof AssetBlockchainSchema>;
57
43
  * Asset metadata schema
58
44
  */
59
45
  export declare const AssetMetadataSchema: z.ZodObject<{
60
- /**
61
- * Asset identifier
62
- */
63
46
  id: z.ZodString;
64
- /**
65
- * Asset symbol (e.g., "BTC", "ETH")
66
- */
67
47
  symbol: z.ZodString;
68
- /**
69
- * Asset name (e.g., "Bitcoin", "Ethereum")
70
- */
71
48
  name: z.ZodString;
72
- /**
73
- * Type of asset (e.g., "coin", "token")
74
- */
75
49
  asset_type: z.ZodString;
76
- /**
77
- * External identifiers for this asset
78
- */
79
- external_ids: z.ZodRecord<z.ZodEnum<["ccdata", "coinmarketcap", "coingecko"]>, z.ZodOptional<z.ZodString>>;
80
- /**
81
- * Blockchain information for this asset
82
- */
50
+ external_ids: z.ZodRecord<z.ZodEnum<{
51
+ ccdata: "ccdata";
52
+ coinmarketcap: "coinmarketcap";
53
+ coingecko: "coingecko";
54
+ }>, z.ZodOptional<z.ZodString>>;
83
55
  blockchains: z.ZodArray<z.ZodObject<{
84
- /**
85
- * Blockchain name
86
- */
87
56
  blockchain: z.ZodString;
88
- /**
89
- * Token address on the blockchain
90
- */
91
57
  address: z.ZodString;
92
- /**
93
- * Number of decimal places
94
- */
95
58
  decimals: z.ZodNumber;
96
- /**
97
- * Whether on-chain metrics are supported
98
- */
99
59
  on_chain_support: z.ZodBoolean;
100
- }, "strip", z.ZodTypeAny, {
101
- address: string;
102
- blockchain: string;
103
- decimals: number;
104
- on_chain_support: boolean;
105
- }, {
106
- address: string;
107
- blockchain: string;
108
- decimals: number;
109
- on_chain_support: boolean;
110
- }>, "many">;
111
- }, "strip", z.ZodTypeAny, {
112
- symbol: string;
113
- name: string;
114
- id: string;
115
- asset_type: string;
116
- external_ids: Partial<Record<"ccdata" | "coinmarketcap" | "coingecko", string | undefined>>;
117
- blockchains: {
118
- address: string;
119
- blockchain: string;
120
- decimals: number;
121
- on_chain_support: boolean;
122
- }[];
123
- }, {
124
- symbol: string;
125
- name: string;
126
- id: string;
127
- asset_type: string;
128
- external_ids: Partial<Record<"ccdata" | "coinmarketcap" | "coingecko", string | undefined>>;
129
- blockchains: {
130
- address: string;
131
- blockchain: string;
132
- decimals: number;
133
- on_chain_support: boolean;
134
- }[];
135
- }>;
60
+ }, z.core.$strip>>;
61
+ }, z.core.$strip>;
136
62
  /**
137
63
  * Asset metadata type
138
64
  */
@@ -141,82 +67,22 @@ export type AssetMetadata = z.infer<typeof AssetMetadataSchema>;
141
67
  * Asset metadata response schema
142
68
  */
143
69
  export declare const AssetMetadataResponseSchema: z.ZodArray<z.ZodObject<{
144
- /**
145
- * Asset identifier
146
- */
147
70
  id: z.ZodString;
148
- /**
149
- * Asset symbol (e.g., "BTC", "ETH")
150
- */
151
71
  symbol: z.ZodString;
152
- /**
153
- * Asset name (e.g., "Bitcoin", "Ethereum")
154
- */
155
72
  name: z.ZodString;
156
- /**
157
- * Type of asset (e.g., "coin", "token")
158
- */
159
73
  asset_type: z.ZodString;
160
- /**
161
- * External identifiers for this asset
162
- */
163
- external_ids: z.ZodRecord<z.ZodEnum<["ccdata", "coinmarketcap", "coingecko"]>, z.ZodOptional<z.ZodString>>;
164
- /**
165
- * Blockchain information for this asset
166
- */
74
+ external_ids: z.ZodRecord<z.ZodEnum<{
75
+ ccdata: "ccdata";
76
+ coinmarketcap: "coinmarketcap";
77
+ coingecko: "coingecko";
78
+ }>, z.ZodOptional<z.ZodString>>;
167
79
  blockchains: z.ZodArray<z.ZodObject<{
168
- /**
169
- * Blockchain name
170
- */
171
80
  blockchain: z.ZodString;
172
- /**
173
- * Token address on the blockchain
174
- */
175
81
  address: z.ZodString;
176
- /**
177
- * Number of decimal places
178
- */
179
82
  decimals: z.ZodNumber;
180
- /**
181
- * Whether on-chain metrics are supported
182
- */
183
83
  on_chain_support: z.ZodBoolean;
184
- }, "strip", z.ZodTypeAny, {
185
- address: string;
186
- blockchain: string;
187
- decimals: number;
188
- on_chain_support: boolean;
189
- }, {
190
- address: string;
191
- blockchain: string;
192
- decimals: number;
193
- on_chain_support: boolean;
194
- }>, "many">;
195
- }, "strip", z.ZodTypeAny, {
196
- symbol: string;
197
- name: string;
198
- id: string;
199
- asset_type: string;
200
- external_ids: Partial<Record<"ccdata" | "coinmarketcap" | "coingecko", string | undefined>>;
201
- blockchains: {
202
- address: string;
203
- blockchain: string;
204
- decimals: number;
205
- on_chain_support: boolean;
206
- }[];
207
- }, {
208
- symbol: string;
209
- name: string;
210
- id: string;
211
- asset_type: string;
212
- external_ids: Partial<Record<"ccdata" | "coinmarketcap" | "coingecko", string | undefined>>;
213
- blockchains: {
214
- address: string;
215
- blockchain: string;
216
- decimals: number;
217
- on_chain_support: boolean;
218
- }[];
219
- }>, "many">;
84
+ }, z.core.$strip>>;
85
+ }, z.core.$strip>>;
220
86
  /**
221
87
  * Asset metadata response type
222
88
  */
@@ -224,7 +90,14 @@ export type AssetMetadataResponse = z.infer<typeof AssetMetadataResponseSchema>;
224
90
  /**
225
91
  * Metric tier schema
226
92
  */
227
- export declare const MetricTierSchema: z.ZodEnum<["free", "tier1", "tier2", "tier3", "tier4", "tier5"]>;
93
+ export declare const MetricTierSchema: z.ZodEnum<{
94
+ free: "free";
95
+ tier1: "tier1";
96
+ tier2: "tier2";
97
+ tier3: "tier3";
98
+ tier4: "tier4";
99
+ tier5: "tier5";
100
+ }>;
228
101
  /**
229
102
  * Metric tier type
230
103
  */
@@ -232,75 +105,65 @@ export type MetricTier = z.infer<typeof MetricTierSchema>;
232
105
  /**
233
106
  * Metric data type schema
234
107
  */
235
- export declare const MetricDataTypeSchema: z.ZodEnum<["average", "sum", "count", "percentage", "ratio"]>;
108
+ export declare const MetricDataTypeSchema: z.ZodEnum<{
109
+ ratio: "ratio";
110
+ sum: "sum";
111
+ average: "average";
112
+ count: "count";
113
+ percentage: "percentage";
114
+ }>;
236
115
  /**
237
116
  * Metric data type
238
117
  */
239
118
  export type MetricDataType = z.infer<typeof MetricDataTypeSchema>;
119
+ /**
120
+ * Metric descriptors schema (human-readable names, tags, descriptions)
121
+ */
122
+ export declare const MetricDescriptorsSchema: z.ZodObject<{
123
+ name: z.ZodOptional<z.ZodString>;
124
+ short_name: z.ZodOptional<z.ZodString>;
125
+ group: z.ZodOptional<z.ZodString>;
126
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ description: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
128
+ data_sharing_group: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>;
130
+ /**
131
+ * Metric descriptors type
132
+ */
133
+ export type MetricDescriptors = z.infer<typeof MetricDescriptorsSchema>;
240
134
  /**
241
135
  * Metric metadata schema
242
136
  */
243
137
  export declare const MetricMetadataSchema: z.ZodObject<{
244
- /**
245
- * Metric name
246
- */
247
138
  path: z.ZodString;
248
- /**
249
- * Access tier required for this metric
250
- */
251
139
  tier: z.ZodNumber;
252
- /**
253
- * The last date that the metadata was updated
254
- */
255
- modified: z.ZodEffects<z.ZodNumber, Date, number>;
256
- /**
257
- * Next parameter for the metric
258
- */
259
- next_param: z.ZodOptional<z.ZodString>;
260
- /**
261
- * Available assets for this metric
262
- */
140
+ modified: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<Date | undefined, number | undefined>>;
141
+ is_pit: z.ZodOptional<z.ZodBoolean>;
142
+ bulk_supported: z.ZodOptional<z.ZodBoolean>;
143
+ timerange: z.ZodOptional<z.ZodObject<{
144
+ min: z.ZodNumber;
145
+ max: z.ZodNumber;
146
+ }, z.core.$strip>>;
263
147
  refs: z.ZodObject<{
264
148
  docs: z.ZodOptional<z.ZodString>;
265
149
  studio: z.ZodOptional<z.ZodString>;
266
- }, "strip", z.ZodTypeAny, {
267
- docs?: string | undefined;
268
- studio?: string | undefined;
269
- }, {
270
- docs?: string | undefined;
271
- studio?: string | undefined;
272
- }>;
273
- /**
274
- * Queried parameters for the metric
275
- */
150
+ metric_variant: z.ZodOptional<z.ZodObject<{
151
+ base: z.ZodOptional<z.ZodString>;
152
+ bulk: z.ZodOptional<z.ZodString>;
153
+ pit: z.ZodOptional<z.ZodString>;
154
+ }, z.core.$strip>>;
155
+ }, z.core.$strip>;
276
156
  queried: z.ZodRecord<z.ZodString, z.ZodAny>;
277
- /**
278
- * List of all allowed parameters and their values for the metric
279
- */
280
- parameters: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
281
- }, "strip", z.ZodTypeAny, {
282
- path: string;
283
- tier: number;
284
- modified: Date;
285
- refs: {
286
- docs?: string | undefined;
287
- studio?: string | undefined;
288
- };
289
- queried: Record<string, any>;
290
- parameters: Record<string, string[]>;
291
- next_param?: string | undefined;
292
- }, {
293
- path: string;
294
- tier: number;
295
- modified: number;
296
- refs: {
297
- docs?: string | undefined;
298
- studio?: string | undefined;
299
- };
300
- queried: Record<string, any>;
301
- parameters: Record<string, string[]>;
302
- next_param?: string | undefined;
303
- }>;
157
+ parameters: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
158
+ descriptors: z.ZodOptional<z.ZodObject<{
159
+ name: z.ZodOptional<z.ZodString>;
160
+ short_name: z.ZodOptional<z.ZodString>;
161
+ group: z.ZodOptional<z.ZodString>;
162
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
163
+ description: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
164
+ data_sharing_group: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>;
166
+ }, z.core.$strip>;
304
167
  /**
305
168
  * Metric metadata type
306
169
  */
@@ -309,70 +172,39 @@ export type MetricMetadata = z.infer<typeof MetricMetadataSchema>;
309
172
  * Metric metadata response schema
310
173
  */
311
174
  export declare const MetricMetadataResponseSchema: z.ZodObject<{
312
- /**
313
- * Metric name
314
- */
315
175
  path: z.ZodString;
316
- /**
317
- * Access tier required for this metric
318
- */
319
176
  tier: z.ZodNumber;
320
- /**
321
- * The last date that the metadata was updated
322
- */
323
- modified: z.ZodEffects<z.ZodNumber, Date, number>;
324
- /**
325
- * Next parameter for the metric
326
- */
327
- next_param: z.ZodOptional<z.ZodString>;
328
- /**
329
- * Available assets for this metric
330
- */
177
+ modified: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<Date | undefined, number | undefined>>;
178
+ is_pit: z.ZodOptional<z.ZodBoolean>;
179
+ bulk_supported: z.ZodOptional<z.ZodBoolean>;
180
+ timerange: z.ZodOptional<z.ZodObject<{
181
+ min: z.ZodNumber;
182
+ max: z.ZodNumber;
183
+ }, z.core.$strip>>;
331
184
  refs: z.ZodObject<{
332
185
  docs: z.ZodOptional<z.ZodString>;
333
186
  studio: z.ZodOptional<z.ZodString>;
334
- }, "strip", z.ZodTypeAny, {
335
- docs?: string | undefined;
336
- studio?: string | undefined;
337
- }, {
338
- docs?: string | undefined;
339
- studio?: string | undefined;
340
- }>;
341
- /**
342
- * Queried parameters for the metric
343
- */
187
+ metric_variant: z.ZodOptional<z.ZodObject<{
188
+ base: z.ZodOptional<z.ZodString>;
189
+ bulk: z.ZodOptional<z.ZodString>;
190
+ pit: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strip>>;
192
+ }, z.core.$strip>;
344
193
  queried: z.ZodRecord<z.ZodString, z.ZodAny>;
345
- /**
346
- * List of all allowed parameters and their values for the metric
347
- */
348
- parameters: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>;
349
- }, "strip", z.ZodTypeAny, {
350
- path: string;
351
- tier: number;
352
- modified: Date;
353
- refs: {
354
- docs?: string | undefined;
355
- studio?: string | undefined;
356
- };
357
- queried: Record<string, any>;
358
- parameters: Record<string, string[]>;
359
- next_param?: string | undefined;
360
- }, {
361
- path: string;
362
- tier: number;
363
- modified: number;
364
- refs: {
365
- docs?: string | undefined;
366
- studio?: string | undefined;
367
- };
368
- queried: Record<string, any>;
369
- parameters: Record<string, string[]>;
370
- next_param?: string | undefined;
371
- }>;
194
+ parameters: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
195
+ descriptors: z.ZodOptional<z.ZodObject<{
196
+ name: z.ZodOptional<z.ZodString>;
197
+ short_name: z.ZodOptional<z.ZodString>;
198
+ group: z.ZodOptional<z.ZodString>;
199
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
200
+ description: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
201
+ data_sharing_group: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strip>>;
203
+ }, z.core.$strip>;
372
204
  /**
373
205
  * Metric list response schema
374
206
  */
375
- export declare const MetricListResponseSchema: z.ZodArray<z.ZodString, "many">;
207
+ export declare const MetricListResponseSchema: z.ZodArray<z.ZodString>;
376
208
  /**
377
209
  * Metric metadata response type
378
210
  */
@@ -381,3 +213,30 @@ export type MetricMetadataResponse = z.infer<typeof MetricMetadataResponseSchema
381
213
  * Metric list response type
382
214
  */
383
215
  export type MetricListResponse = z.infer<typeof MetricListResponseSchema>;
216
+ /**
217
+ * Bulk entry schema (one asset's value in a bulk response)
218
+ */
219
+ export declare const BulkEntrySchema: z.ZodObject<{
220
+ a: z.ZodString;
221
+ v: z.ZodNumber;
222
+ network: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strip>;
224
+ /**
225
+ * Bulk entry type
226
+ */
227
+ export type BulkEntry = z.infer<typeof BulkEntrySchema>;
228
+ /**
229
+ * Bulk response schema (array of timestamped bulk entries)
230
+ */
231
+ export declare const BulkResponseSchema: z.ZodArray<z.ZodObject<{
232
+ t: z.ZodNumber;
233
+ bulk: z.ZodArray<z.ZodObject<{
234
+ a: z.ZodString;
235
+ v: z.ZodNumber;
236
+ network: z.ZodOptional<z.ZodString>;
237
+ }, z.core.$strip>>;
238
+ }, z.core.$strip>>;
239
+ /**
240
+ * Bulk response type
241
+ */
242
+ export type BulkResponse = z.infer<typeof BulkResponseSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetricListResponseSchema = exports.MetricMetadataResponseSchema = exports.MetricMetadataSchema = exports.MetricDataTypeSchema = exports.MetricTierSchema = exports.AssetMetadataResponseSchema = exports.AssetMetadataSchema = exports.AssetBlockchainSchema = exports.ExternalIdsSchema = exports.ExternalIdSourceSchema = void 0;
3
+ exports.BulkResponseSchema = exports.BulkEntrySchema = exports.MetricListResponseSchema = exports.MetricMetadataResponseSchema = exports.MetricMetadataSchema = exports.MetricDescriptorsSchema = exports.MetricDataTypeSchema = exports.MetricTierSchema = exports.AssetMetadataResponseSchema = exports.AssetMetadataSchema = exports.AssetBlockchainSchema = exports.ExternalIdsSchema = exports.ExternalIdSourceSchema = void 0;
4
4
  /**
5
5
  * Metadata response types
6
6
  */
@@ -75,12 +75,23 @@ exports.MetricTierSchema = zod_1.z.enum(['free', 'tier1', 'tier2', 'tier3', 'tie
75
75
  * Metric data type schema
76
76
  */
77
77
  exports.MetricDataTypeSchema = zod_1.z.enum(['average', 'sum', 'count', 'percentage', 'ratio']);
78
+ /**
79
+ * Metric descriptors schema (human-readable names, tags, descriptions)
80
+ */
81
+ exports.MetricDescriptorsSchema = zod_1.z.object({
82
+ name: zod_1.z.string().optional(),
83
+ short_name: zod_1.z.string().optional(),
84
+ group: zod_1.z.string().optional(),
85
+ tags: zod_1.z.array(zod_1.z.string()).optional(),
86
+ description: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
87
+ data_sharing_group: zod_1.z.string().optional(),
88
+ });
78
89
  /**
79
90
  * Metric metadata schema
80
91
  */
81
92
  exports.MetricMetadataSchema = zod_1.z.object({
82
93
  /**
83
- * Metric name
94
+ * Metric path
84
95
  */
85
96
  path: zod_1.z.string(),
86
97
  /**
@@ -90,17 +101,40 @@ exports.MetricMetadataSchema = zod_1.z.object({
90
101
  /**
91
102
  * The last date that the metadata was updated
92
103
  */
93
- modified: zod_1.z.number().transform((val) => new Date(val * 1000)),
104
+ modified: zod_1.z
105
+ .number()
106
+ .optional()
107
+ .transform((val) => (val ? new Date(val * 1000) : undefined)),
108
+ /**
109
+ * Whether this is a point-in-time metric
110
+ */
111
+ is_pit: zod_1.z.boolean().optional(),
112
+ /**
113
+ * Whether bulk queries are supported for this metric
114
+ */
115
+ bulk_supported: zod_1.z.boolean().optional(),
94
116
  /**
95
- * Next parameter for the metric
117
+ * Available time range for this metric (Unix timestamps)
96
118
  */
97
- next_param: zod_1.z.string().optional(),
119
+ timerange: zod_1.z
120
+ .object({
121
+ min: zod_1.z.number(),
122
+ max: zod_1.z.number(),
123
+ })
124
+ .optional(),
98
125
  /**
99
- * Available assets for this metric
126
+ * Reference links for this metric
100
127
  */
101
128
  refs: zod_1.z.object({
102
129
  docs: zod_1.z.string().optional(),
103
130
  studio: zod_1.z.string().optional(),
131
+ metric_variant: zod_1.z
132
+ .object({
133
+ base: zod_1.z.string().optional(),
134
+ bulk: zod_1.z.string().optional(),
135
+ pit: zod_1.z.string().optional(),
136
+ })
137
+ .optional(),
104
138
  }),
105
139
  /**
106
140
  * Queried parameters for the metric
@@ -110,6 +144,10 @@ exports.MetricMetadataSchema = zod_1.z.object({
110
144
  * List of all allowed parameters and their values for the metric
111
145
  */
112
146
  parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
147
+ /**
148
+ * Human-readable descriptors (name, tags, description)
149
+ */
150
+ descriptors: exports.MetricDescriptorsSchema.optional(),
113
151
  });
114
152
  /**
115
153
  * Metric metadata response schema
@@ -119,3 +157,18 @@ exports.MetricMetadataResponseSchema = exports.MetricMetadataSchema;
119
157
  * Metric list response schema
120
158
  */
121
159
  exports.MetricListResponseSchema = zod_1.z.array(zod_1.z.string().startsWith('/'));
160
+ /**
161
+ * Bulk entry schema (one asset's value in a bulk response)
162
+ */
163
+ exports.BulkEntrySchema = zod_1.z.object({
164
+ a: zod_1.z.string(),
165
+ v: zod_1.z.number(),
166
+ network: zod_1.z.string().optional(),
167
+ });
168
+ /**
169
+ * Bulk response schema (array of timestamped bulk entries)
170
+ */
171
+ exports.BulkResponseSchema = zod_1.z.array(zod_1.z.object({
172
+ t: zod_1.z.number(),
173
+ bulk: zod_1.z.array(exports.BulkEntrySchema),
174
+ }));