@d-dash/datasource-rest 0.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 +26 -0
- package/dist/index.d.ts +107 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +209 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @d-dash/datasource-rest
|
|
2
|
+
|
|
3
|
+
JSON REST-backed `DatasourceAdapter` for d-dash.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createRestDatasourceAdapter } from "@d-dash/datasource-rest";
|
|
9
|
+
|
|
10
|
+
registry.registerDatasource(
|
|
11
|
+
createRestDatasourceAdapter({
|
|
12
|
+
id: "metrics",
|
|
13
|
+
baseUrl: "https://api.example.com/v1",
|
|
14
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The adapter POSTs to `${baseUrl}/query` with a query envelope containing metric, time range, filters, and trace context.
|
|
20
|
+
|
|
21
|
+
Response envelopes are normalized to d-dash `DataFrame[]` and structured query error results.
|
|
22
|
+
|
|
23
|
+
## Metric discovery
|
|
24
|
+
|
|
25
|
+
`getMetrics()` is implemented and performs `GET ${baseUrl}/metrics` by default.
|
|
26
|
+
You can override the path with `metricsPath` in adapter options.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { DatasourceAdapter } from "@d-dash/core";
|
|
2
|
+
/** Minimal subset of the Fetch API used by this adapter. */
|
|
3
|
+
export type FetchFn = (url: string, init?: FetchRequestInit) => Promise<FetchResponse>;
|
|
4
|
+
/** Minimal request init shape used by the adapter's injected fetch function. */
|
|
5
|
+
export type FetchRequestInit = {
|
|
6
|
+
method?: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
body?: string;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
};
|
|
11
|
+
/** Minimal fetch response shape consumed by the adapter. */
|
|
12
|
+
export type FetchResponse = {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
status: number;
|
|
15
|
+
statusText: string;
|
|
16
|
+
json(): Promise<unknown>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The JSON body sent to the REST endpoint for every widget query.
|
|
20
|
+
* Server implementations should accept this shape.
|
|
21
|
+
*/
|
|
22
|
+
export type RestQueryEnvelope = {
|
|
23
|
+
metric: string;
|
|
24
|
+
from: number;
|
|
25
|
+
to: number;
|
|
26
|
+
filters?: Record<string, unknown>;
|
|
27
|
+
context: {
|
|
28
|
+
traceId?: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Minimal wire format the REST endpoint must return.
|
|
33
|
+
* Each frame maps to a DataFrame; each key in `fields` maps to a DataField.
|
|
34
|
+
*/
|
|
35
|
+
export type RestResponseEnvelope = {
|
|
36
|
+
status: "success" | "partial" | "error";
|
|
37
|
+
frames: RestFrame[];
|
|
38
|
+
warnings?: string[];
|
|
39
|
+
error?: {
|
|
40
|
+
code: string;
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/** REST response frame wire contract. */
|
|
45
|
+
export type RestFrame = {
|
|
46
|
+
fields: RestField[];
|
|
47
|
+
};
|
|
48
|
+
/** REST response field wire contract. */
|
|
49
|
+
export type RestField = {
|
|
50
|
+
name: string;
|
|
51
|
+
type: "time" | "number" | "string" | "boolean";
|
|
52
|
+
values: (string | number | boolean | null)[];
|
|
53
|
+
labels?: Record<string, string>;
|
|
54
|
+
};
|
|
55
|
+
/** Configuration options for creating the REST datasource adapter. */
|
|
56
|
+
export type RestDatasourceAdapterOptions = {
|
|
57
|
+
/**
|
|
58
|
+
* Identifier used to register this adapter in the d-dash registry.
|
|
59
|
+
* Typically matches the datasource id stored in widget definitions.
|
|
60
|
+
*/
|
|
61
|
+
id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Base URL of the REST endpoint. The adapter POSTs to `${baseUrl}/query`.
|
|
64
|
+
* Example: "https://my-metrics-api.example.com/api/v1"
|
|
65
|
+
*/
|
|
66
|
+
baseUrl: string;
|
|
67
|
+
/**
|
|
68
|
+
* Static headers forwarded with every request (e.g. Authorization).
|
|
69
|
+
* Sensitive values should never appear in logs or errors.
|
|
70
|
+
*/
|
|
71
|
+
headers?: Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Timeout in milliseconds before the request is aborted.
|
|
74
|
+
* Defaults to 30 000 ms. Pass 0 to disable.
|
|
75
|
+
*/
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Inject a fetch implementation for testing.
|
|
79
|
+
* Defaults to the global `fetch` when not provided.
|
|
80
|
+
*/
|
|
81
|
+
fetch?: FetchFn;
|
|
82
|
+
/**
|
|
83
|
+
* Optional path used for metric discovery. Defaults to `${baseUrl}/metrics`.
|
|
84
|
+
*/
|
|
85
|
+
metricsPath?: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates a d-dash DatasourceAdapter that queries a JSON REST endpoint.
|
|
89
|
+
*
|
|
90
|
+
* The adapter POSTs a `RestQueryEnvelope` to `${baseUrl}/query` and expects
|
|
91
|
+
* a `RestResponseEnvelope` in return.
|
|
92
|
+
*
|
|
93
|
+
* Usage:
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { createRestDatasourceAdapter } from "@d-dash/datasource-rest";
|
|
96
|
+
*
|
|
97
|
+
* registry.registerDatasource(
|
|
98
|
+
* createRestDatasourceAdapter({
|
|
99
|
+
* id: "metrics",
|
|
100
|
+
* baseUrl: "https://my-api.example.com/api/v1",
|
|
101
|
+
* headers: { Authorization: `Bearer ${token}` },
|
|
102
|
+
* }),
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function createRestDatasourceAdapter(options: RestDatasourceAdapterOptions): DatasourceAdapter;
|
|
107
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAQlB,MAAM,cAAc,CAAC;AAOtB,4DAA4D;AAC5D,MAAM,MAAM,OAAO,GAAG,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,gBAAgB,KACpB,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B,CAAC;AAMF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACxC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC/C,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAMF,sEAAsE;AACtE,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAmGF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,iBAAiB,CAiJnB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// DataFrame normalization
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
function normalizeFrames(rawFrames) {
|
|
5
|
+
return rawFrames.map((frame) => ({
|
|
6
|
+
fields: frame.fields.map((f) => ({
|
|
7
|
+
name: f.name,
|
|
8
|
+
type: f.type,
|
|
9
|
+
values: f.values,
|
|
10
|
+
...(f.labels ? { labels: f.labels } : {}),
|
|
11
|
+
})),
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Adapter factory
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
const CAPABILITIES = {
|
|
18
|
+
supportsAdHocFilters: true,
|
|
19
|
+
supportsMetadataDiscovery: true,
|
|
20
|
+
};
|
|
21
|
+
const DEFAULT_VISUALIZATIONS = [
|
|
22
|
+
"timeseries",
|
|
23
|
+
"stat",
|
|
24
|
+
"table",
|
|
25
|
+
"text",
|
|
26
|
+
"html",
|
|
27
|
+
];
|
|
28
|
+
function toMetricDefinition(metric, datasourceId) {
|
|
29
|
+
if (typeof metric === "string") {
|
|
30
|
+
return {
|
|
31
|
+
id: metric,
|
|
32
|
+
name: metric,
|
|
33
|
+
unit: "",
|
|
34
|
+
datasource: datasourceId,
|
|
35
|
+
supportedVisualizations: DEFAULT_VISUALIZATIONS,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const id = metric.id ?? metric.name ?? "";
|
|
39
|
+
return {
|
|
40
|
+
id,
|
|
41
|
+
name: metric.name ?? id,
|
|
42
|
+
unit: metric.unit ?? "",
|
|
43
|
+
datasource: datasourceId,
|
|
44
|
+
supportedVisualizations: metric.supportedVisualizations ?? DEFAULT_VISUALIZATIONS,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function normalizeMetricsResponse(raw, datasourceId) {
|
|
48
|
+
const response = raw;
|
|
49
|
+
const source = Array.isArray(response)
|
|
50
|
+
? response
|
|
51
|
+
: Array.isArray(response.metrics)
|
|
52
|
+
? response.metrics
|
|
53
|
+
: [];
|
|
54
|
+
const metrics = [];
|
|
55
|
+
for (const entry of source) {
|
|
56
|
+
const metric = toMetricDefinition(entry, datasourceId);
|
|
57
|
+
if (metric.id.trim().length === 0) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
metrics.push(metric);
|
|
61
|
+
}
|
|
62
|
+
return metrics;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a d-dash DatasourceAdapter that queries a JSON REST endpoint.
|
|
66
|
+
*
|
|
67
|
+
* The adapter POSTs a `RestQueryEnvelope` to `${baseUrl}/query` and expects
|
|
68
|
+
* a `RestResponseEnvelope` in return.
|
|
69
|
+
*
|
|
70
|
+
* Usage:
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { createRestDatasourceAdapter } from "@d-dash/datasource-rest";
|
|
73
|
+
*
|
|
74
|
+
* registry.registerDatasource(
|
|
75
|
+
* createRestDatasourceAdapter({
|
|
76
|
+
* id: "metrics",
|
|
77
|
+
* baseUrl: "https://my-api.example.com/api/v1",
|
|
78
|
+
* headers: { Authorization: `Bearer ${token}` },
|
|
79
|
+
* }),
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function createRestDatasourceAdapter(options) {
|
|
84
|
+
const resolveFetch = options.fetch ?? ((url, init) => fetch(url, init));
|
|
85
|
+
const timeoutMs = options.timeoutMs ?? 30_000;
|
|
86
|
+
return {
|
|
87
|
+
id: options.id,
|
|
88
|
+
capabilities: CAPABILITIES,
|
|
89
|
+
async getMetrics() {
|
|
90
|
+
const path = options.metricsPath ?? "/metrics";
|
|
91
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
92
|
+
try {
|
|
93
|
+
const response = await resolveFetch(`${options.baseUrl}${normalizedPath}`, {
|
|
94
|
+
method: "GET",
|
|
95
|
+
headers: {
|
|
96
|
+
"Content-Type": "application/json",
|
|
97
|
+
...options.headers,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const raw = await response.json();
|
|
104
|
+
return normalizeMetricsResponse(raw, options.id);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
async query(request, context) {
|
|
111
|
+
const envelope = {
|
|
112
|
+
metric: request.metric,
|
|
113
|
+
from: request.timeRange.from,
|
|
114
|
+
to: request.timeRange.to,
|
|
115
|
+
...(request.filters
|
|
116
|
+
? { filters: request.filters }
|
|
117
|
+
: {}),
|
|
118
|
+
context: { traceId: context.traceId },
|
|
119
|
+
};
|
|
120
|
+
// Build abort controller for timeout, if configured.
|
|
121
|
+
let signal;
|
|
122
|
+
let timeoutId;
|
|
123
|
+
if (timeoutMs > 0) {
|
|
124
|
+
const controller = new AbortController();
|
|
125
|
+
signal = controller.signal;
|
|
126
|
+
timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
127
|
+
}
|
|
128
|
+
let raw;
|
|
129
|
+
try {
|
|
130
|
+
const response = await resolveFetch(`${options.baseUrl}/query`, {
|
|
131
|
+
method: "POST",
|
|
132
|
+
headers: {
|
|
133
|
+
"Content-Type": "application/json",
|
|
134
|
+
...options.headers,
|
|
135
|
+
},
|
|
136
|
+
body: JSON.stringify(envelope),
|
|
137
|
+
signal,
|
|
138
|
+
});
|
|
139
|
+
if (!response.ok) {
|
|
140
|
+
// Map HTTP error to a structured datasource error — avoid leaking
|
|
141
|
+
// response bodies which may contain sensitive server details.
|
|
142
|
+
return {
|
|
143
|
+
status: "error",
|
|
144
|
+
frames: [],
|
|
145
|
+
error: {
|
|
146
|
+
code: "DATASOURCE_HTTP_ERROR",
|
|
147
|
+
message: `HTTP ${response.status} from datasource '${options.id}'.`,
|
|
148
|
+
retriable: response.status >= 500,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
raw = await response.json();
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
const isAbort = err instanceof Error && err.name === "AbortError";
|
|
156
|
+
return {
|
|
157
|
+
status: "error",
|
|
158
|
+
frames: [],
|
|
159
|
+
error: {
|
|
160
|
+
code: "DATASOURCE_QUERY_FAILED",
|
|
161
|
+
message: isAbort
|
|
162
|
+
? `Request to datasource '${options.id}' timed out.`
|
|
163
|
+
: `Network error querying datasource '${options.id}'.`,
|
|
164
|
+
retriable: !isAbort,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
if (timeoutId !== undefined) {
|
|
170
|
+
clearTimeout(timeoutId);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const envelope2 = raw;
|
|
174
|
+
if (envelope2.status === "error") {
|
|
175
|
+
return {
|
|
176
|
+
status: "error",
|
|
177
|
+
frames: normalizeFrames(envelope2.frames ?? []),
|
|
178
|
+
warnings: envelope2.warnings,
|
|
179
|
+
error: {
|
|
180
|
+
code: (envelope2.error?.code ??
|
|
181
|
+
"DATASOURCE_QUERY_FAILED"),
|
|
182
|
+
message: envelope2.error?.message ?? "Datasource returned an error.",
|
|
183
|
+
retriable: false,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
if (envelope2.status === "partial") {
|
|
188
|
+
return {
|
|
189
|
+
status: "partial",
|
|
190
|
+
frames: normalizeFrames(envelope2.frames ?? []),
|
|
191
|
+
warnings: envelope2.warnings,
|
|
192
|
+
error: {
|
|
193
|
+
code: (envelope2.error?.code ??
|
|
194
|
+
"DATASOURCE_PARTIAL"),
|
|
195
|
+
message: envelope2.error?.message ??
|
|
196
|
+
"Datasource returned a partial result.",
|
|
197
|
+
retriable: false,
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
status: "success",
|
|
203
|
+
frames: normalizeFrames(envelope2.frames ?? []),
|
|
204
|
+
warnings: envelope2.warnings,
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL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,QAAQ,EAAE,SAAS,CAAC,QAAQ;aAC7B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@d-dash/datasource-rest",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "REST datasource adapter for d-dash",
|
|
5
|
+
"license": "LGPL-3.0-or-later",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/thienvu18/d-dash.git",
|
|
9
|
+
"directory": "packages/datasource-rest"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/thienvu18/d-dash/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/thienvu18/d-dash/tree/main/packages/datasource-rest#readme",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -p tsconfig.json",
|
|
26
|
+
"test": "npm run build && node --test $(find tests -name '*.spec.js')"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@d-dash/core": "^0.1.0"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"dashboard",
|
|
33
|
+
"datasource",
|
|
34
|
+
"rest",
|
|
35
|
+
"d-dash"
|
|
36
|
+
],
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@d-dash/core": "file:../core",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
50
|
+
}
|
|
51
|
+
}
|