@uniformdev/context 14.2.1-alpha.145 → 14.2.1-alpha.249
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/api/api.d.ts +4 -4
- package/dist/cli/cli.d.ts +2 -2
- package/dist/cli/cli.js +28 -28
- package/dist/cli/cli.mjs +20 -20
- package/dist/{contextTypes-7f24fc7c.d.ts → contextTypes-572b0d33.d.ts} +1 -1
- package/dist/index.d.ts +23 -18
- package/dist/index.esm.js +3 -3
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{types-d77228a6.d.ts → types-5f88cc63.d.ts} +137 -97
- package/dist/{v2-manifest.swagger-d0899723.d.ts → v2-manifest.swagger-ff2af13e.d.ts} +9 -0
- package/package.json +6 -5
- package/dist/chunk-A5FZYSIL.mjs +0 -76
- package/dist/chunk-FJWWKKCL.mjs +0 -307
- package/dist/chunk-YGARAHYJ.mjs +0 -11
- package/dist/types-c81df08a.d.ts +0 -727
package/dist/chunk-FJWWKKCL.mjs
DELETED
@@ -1,307 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
__privateAdd,
|
3
|
-
__privateGet,
|
4
|
-
__publicField,
|
5
|
-
init_esm_shims
|
6
|
-
} from "./chunk-A5FZYSIL.mjs";
|
7
|
-
|
8
|
-
// src/api/apiClientUtils.ts
|
9
|
-
init_esm_shims();
|
10
|
-
var nullLimitPolicy = async (func) => await func();
|
11
|
-
var ApiClientError = class extends Error {
|
12
|
-
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText) {
|
13
|
-
super(`${errorMessage}
|
14
|
-
${statusCode}${statusText ? " " + statusText : ""} (${fetchMethod} ${fetchUri})`);
|
15
|
-
this.errorMessage = errorMessage;
|
16
|
-
this.fetchMethod = fetchMethod;
|
17
|
-
this.fetchUri = fetchUri;
|
18
|
-
this.statusCode = statusCode;
|
19
|
-
this.statusText = statusText;
|
20
|
-
Object.setPrototypeOf(this, ApiClientError.prototype);
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
// src/api/AggregateClient.ts
|
25
|
-
init_esm_shims();
|
26
|
-
|
27
|
-
// src/api/ApiClient.ts
|
28
|
-
init_esm_shims();
|
29
|
-
var ApiClient = class {
|
30
|
-
constructor(options) {
|
31
|
-
__publicField(this, "options");
|
32
|
-
var _a, _b, _c, _d, _e, _f;
|
33
|
-
if (!options.apiKey && !options.bearerToken) {
|
34
|
-
throw new Error("You must provide an API key or a bearer token");
|
35
|
-
}
|
36
|
-
this.options = {
|
37
|
-
...options,
|
38
|
-
fetch: (_a = options.fetch) != null ? _a : fetch,
|
39
|
-
apiHost: (_b = options.apiHost) != null ? _b : "https://uniform.app",
|
40
|
-
apiKey: (_c = options.apiKey) != null ? _c : null,
|
41
|
-
projectId: (_d = options.projectId) != null ? _d : null,
|
42
|
-
bearerToken: (_e = options.bearerToken) != null ? _e : null,
|
43
|
-
limitPolicy: (_f = options.limitPolicy) != null ? _f : nullLimitPolicy
|
44
|
-
};
|
45
|
-
}
|
46
|
-
async apiClient(fetchUri, options) {
|
47
|
-
return this.options.limitPolicy(async () => {
|
48
|
-
var _a;
|
49
|
-
const authHeaders = this.options.apiKey ? {
|
50
|
-
"x-api-key": this.options.apiKey
|
51
|
-
} : {
|
52
|
-
Authorization: `Bearer ${this.options.bearerToken}`
|
53
|
-
};
|
54
|
-
const apiResponse = await fetch(fetchUri.toString(), {
|
55
|
-
...options,
|
56
|
-
headers: {
|
57
|
-
...options == null ? void 0 : options.headers,
|
58
|
-
...authHeaders
|
59
|
-
}
|
60
|
-
});
|
61
|
-
if (!apiResponse.ok) {
|
62
|
-
let message = "";
|
63
|
-
try {
|
64
|
-
const responseText = await apiResponse.text();
|
65
|
-
try {
|
66
|
-
const parsed = JSON.parse(responseText);
|
67
|
-
if (parsed.errorMessage) {
|
68
|
-
message = Array.isArray(parsed.errorMessage) ? parsed.errorMessage.join(", ") : parsed.errorMessage;
|
69
|
-
} else {
|
70
|
-
message = responseText;
|
71
|
-
}
|
72
|
-
} catch (e) {
|
73
|
-
message = responseText;
|
74
|
-
}
|
75
|
-
} catch (e) {
|
76
|
-
message = `General error`;
|
77
|
-
}
|
78
|
-
throw new ApiClientError(message, (_a = options == null ? void 0 : options.method) != null ? _a : "GET", fetchUri.toString(), apiResponse.status);
|
79
|
-
}
|
80
|
-
if (options == null ? void 0 : options.expectNoContent) {
|
81
|
-
return null;
|
82
|
-
}
|
83
|
-
return await apiResponse.json();
|
84
|
-
});
|
85
|
-
}
|
86
|
-
createUrl(path, queryParams) {
|
87
|
-
const url = new URL(`${this.options.apiHost}${path}`);
|
88
|
-
Object.entries(queryParams != null ? queryParams : {}).forEach(([key, value]) => {
|
89
|
-
var _a;
|
90
|
-
if (typeof value !== "undefined" && value !== null) {
|
91
|
-
url.searchParams.append(key, (_a = value == null ? void 0 : value.toString()) != null ? _a : "");
|
92
|
-
}
|
93
|
-
});
|
94
|
-
return url;
|
95
|
-
}
|
96
|
-
};
|
97
|
-
|
98
|
-
// src/api/AggregateClient.ts
|
99
|
-
var _url;
|
100
|
-
var _AggregateClient = class extends ApiClient {
|
101
|
-
constructor(options) {
|
102
|
-
super(options);
|
103
|
-
}
|
104
|
-
async get(options) {
|
105
|
-
const { projectId } = this.options;
|
106
|
-
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url), { ...options, projectId });
|
107
|
-
return await this.apiClient(fetchUri);
|
108
|
-
}
|
109
|
-
async upsert(body) {
|
110
|
-
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
|
111
|
-
await this.apiClient(fetchUri, {
|
112
|
-
method: "PUT",
|
113
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
114
|
-
expectNoContent: true
|
115
|
-
});
|
116
|
-
}
|
117
|
-
async remove(body) {
|
118
|
-
const fetchUri = this.createUrl(__privateGet(_AggregateClient, _url));
|
119
|
-
await this.apiClient(fetchUri, {
|
120
|
-
method: "DELETE",
|
121
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
122
|
-
expectNoContent: true
|
123
|
-
});
|
124
|
-
}
|
125
|
-
};
|
126
|
-
var AggregateClient = _AggregateClient;
|
127
|
-
_url = new WeakMap();
|
128
|
-
__privateAdd(AggregateClient, _url, "/api/v2/aggregate");
|
129
|
-
|
130
|
-
// src/api/EnrichmentClient.ts
|
131
|
-
init_esm_shims();
|
132
|
-
var _url2, _valueUrl;
|
133
|
-
var _EnrichmentClient = class extends ApiClient {
|
134
|
-
constructor(options) {
|
135
|
-
super(options);
|
136
|
-
}
|
137
|
-
async get(options) {
|
138
|
-
const { projectId } = this.options;
|
139
|
-
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2), { ...options, projectId });
|
140
|
-
return await this.apiClient(fetchUri);
|
141
|
-
}
|
142
|
-
async upsertCategory(body) {
|
143
|
-
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2));
|
144
|
-
await this.apiClient(fetchUri, {
|
145
|
-
method: "PUT",
|
146
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
147
|
-
expectNoContent: true
|
148
|
-
});
|
149
|
-
}
|
150
|
-
async removeCategory(body) {
|
151
|
-
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _url2));
|
152
|
-
await this.apiClient(fetchUri, {
|
153
|
-
method: "DELETE",
|
154
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
155
|
-
expectNoContent: true
|
156
|
-
});
|
157
|
-
}
|
158
|
-
async upsertValue(body) {
|
159
|
-
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
|
160
|
-
await this.apiClient(fetchUri, {
|
161
|
-
method: "PUT",
|
162
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
163
|
-
expectNoContent: true
|
164
|
-
});
|
165
|
-
}
|
166
|
-
async removeValue(body) {
|
167
|
-
const fetchUri = this.createUrl(__privateGet(_EnrichmentClient, _valueUrl));
|
168
|
-
await this.apiClient(fetchUri, {
|
169
|
-
method: "DELETE",
|
170
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
171
|
-
expectNoContent: true
|
172
|
-
});
|
173
|
-
}
|
174
|
-
};
|
175
|
-
var EnrichmentClient = _EnrichmentClient;
|
176
|
-
_url2 = new WeakMap();
|
177
|
-
_valueUrl = new WeakMap();
|
178
|
-
__privateAdd(EnrichmentClient, _url2, "/api/v1/enrichments");
|
179
|
-
__privateAdd(EnrichmentClient, _valueUrl, "/api/v1/enrichment-values");
|
180
|
-
|
181
|
-
// src/api/ManifestClient.ts
|
182
|
-
init_esm_shims();
|
183
|
-
var _url3;
|
184
|
-
var _ManifestClient = class extends ApiClient {
|
185
|
-
constructor(options) {
|
186
|
-
super(options);
|
187
|
-
}
|
188
|
-
async get(options) {
|
189
|
-
const { projectId } = this.options;
|
190
|
-
const fetchUri = this.createUrl(__privateGet(_ManifestClient, _url3), { ...options, projectId });
|
191
|
-
return await this.apiClient(fetchUri);
|
192
|
-
}
|
193
|
-
};
|
194
|
-
var ManifestClient = _ManifestClient;
|
195
|
-
_url3 = new WeakMap();
|
196
|
-
__privateAdd(ManifestClient, _url3, "/api/v2/manifest");
|
197
|
-
|
198
|
-
// src/api/QuirkClient.ts
|
199
|
-
init_esm_shims();
|
200
|
-
var _url4;
|
201
|
-
var _QuirkClient = class extends ApiClient {
|
202
|
-
constructor(options) {
|
203
|
-
super(options);
|
204
|
-
}
|
205
|
-
async get(options) {
|
206
|
-
const { projectId } = this.options;
|
207
|
-
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4), { ...options, projectId });
|
208
|
-
return await this.apiClient(fetchUri);
|
209
|
-
}
|
210
|
-
async upsert(body) {
|
211
|
-
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4));
|
212
|
-
await this.apiClient(fetchUri, {
|
213
|
-
method: "PUT",
|
214
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
215
|
-
expectNoContent: true
|
216
|
-
});
|
217
|
-
}
|
218
|
-
async remove(body) {
|
219
|
-
const fetchUri = this.createUrl(__privateGet(_QuirkClient, _url4));
|
220
|
-
await this.apiClient(fetchUri, {
|
221
|
-
method: "DELETE",
|
222
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
223
|
-
expectNoContent: true
|
224
|
-
});
|
225
|
-
}
|
226
|
-
};
|
227
|
-
var QuirkClient = _QuirkClient;
|
228
|
-
_url4 = new WeakMap();
|
229
|
-
__privateAdd(QuirkClient, _url4, "/api/v2/quirk");
|
230
|
-
|
231
|
-
// src/api/SignalClient.ts
|
232
|
-
init_esm_shims();
|
233
|
-
var _url5;
|
234
|
-
var _SignalClient = class extends ApiClient {
|
235
|
-
constructor(options) {
|
236
|
-
super(options);
|
237
|
-
}
|
238
|
-
async get(options) {
|
239
|
-
const { projectId } = this.options;
|
240
|
-
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5), { ...options, projectId });
|
241
|
-
return await this.apiClient(fetchUri);
|
242
|
-
}
|
243
|
-
async upsert(body) {
|
244
|
-
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5));
|
245
|
-
await this.apiClient(fetchUri, {
|
246
|
-
method: "PUT",
|
247
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
248
|
-
expectNoContent: true
|
249
|
-
});
|
250
|
-
}
|
251
|
-
async remove(body) {
|
252
|
-
const fetchUri = this.createUrl(__privateGet(_SignalClient, _url5));
|
253
|
-
await this.apiClient(fetchUri, {
|
254
|
-
method: "DELETE",
|
255
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
256
|
-
expectNoContent: true
|
257
|
-
});
|
258
|
-
}
|
259
|
-
};
|
260
|
-
var SignalClient = _SignalClient;
|
261
|
-
_url5 = new WeakMap();
|
262
|
-
__privateAdd(SignalClient, _url5, "/api/v2/signal");
|
263
|
-
|
264
|
-
// src/api/TestClient.ts
|
265
|
-
init_esm_shims();
|
266
|
-
var _url6;
|
267
|
-
var _TestClient = class extends ApiClient {
|
268
|
-
constructor(options) {
|
269
|
-
super(options);
|
270
|
-
}
|
271
|
-
async get(options) {
|
272
|
-
const { projectId } = this.options;
|
273
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient, _url6), { ...options, projectId });
|
274
|
-
return await this.apiClient(fetchUri);
|
275
|
-
}
|
276
|
-
async upsert(body) {
|
277
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient, _url6));
|
278
|
-
await this.apiClient(fetchUri, {
|
279
|
-
method: "PUT",
|
280
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
281
|
-
expectNoContent: true
|
282
|
-
});
|
283
|
-
}
|
284
|
-
async remove(body) {
|
285
|
-
const fetchUri = this.createUrl(__privateGet(_TestClient, _url6));
|
286
|
-
await this.apiClient(fetchUri, {
|
287
|
-
method: "DELETE",
|
288
|
-
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
289
|
-
expectNoContent: true
|
290
|
-
});
|
291
|
-
}
|
292
|
-
};
|
293
|
-
var TestClient = _TestClient;
|
294
|
-
_url6 = new WeakMap();
|
295
|
-
__privateAdd(TestClient, _url6, "/api/v2/test");
|
296
|
-
|
297
|
-
export {
|
298
|
-
nullLimitPolicy,
|
299
|
-
ApiClientError,
|
300
|
-
ApiClient,
|
301
|
-
AggregateClient,
|
302
|
-
EnrichmentClient,
|
303
|
-
ManifestClient,
|
304
|
-
QuirkClient,
|
305
|
-
SignalClient,
|
306
|
-
TestClient
|
307
|
-
};
|