@openmeter/sdk 1.0.0-alpha.4 → 1.0.0-beta.100
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 +126 -46
- package/dist/cjs/clients/client.cjs +117 -0
- package/dist/cjs/clients/client.d.cts +40 -0
- package/dist/cjs/clients/client.js.map +1 -0
- package/dist/cjs/clients/event.cjs +71 -0
- package/dist/cjs/clients/event.d.cts +79 -0
- package/dist/cjs/clients/event.js.map +1 -0
- package/dist/cjs/clients/meter.cjs +69 -0
- package/dist/cjs/clients/meter.d.cts +75 -0
- package/dist/cjs/clients/meter.js.map +1 -0
- package/dist/cjs/clients/portal.cjs +41 -0
- package/dist/cjs/clients/portal.d.cts +22 -0
- package/dist/cjs/clients/portal.js.map +1 -0
- package/dist/cjs/clients/subject.cjs +60 -0
- package/dist/cjs/clients/subject.d.cts +27 -0
- package/dist/cjs/clients/subject.js.map +1 -0
- package/dist/cjs/index.cjs +24 -0
- package/dist/cjs/index.d.cts +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/schemas/openapi.cjs +7 -0
- package/dist/cjs/schemas/openapi.d.cts +2078 -0
- package/dist/cjs/schemas/openapi.js.map +1 -0
- package/dist/cjs/test/agent.cjs +266 -0
- package/dist/cjs/test/agent.d.cts +2 -0
- package/dist/cjs/test/agent.js.map +1 -0
- package/dist/cjs/test/mocks.cjs +44 -0
- package/dist/cjs/test/mocks.d.cts +14 -0
- package/dist/cjs/test/mocks.js.map +1 -0
- package/dist/cjs/tsconfig.43c3843a.tsbuildinfo +1 -0
- package/dist/cjs/tsconfig.d98fa456.tsbuildinfo +1 -0
- package/dist/clients/client.d.ts +40 -0
- package/dist/clients/client.js +112 -0
- package/dist/clients/client.js.map +1 -0
- package/dist/clients/event.d.ts +79 -0
- package/dist/clients/event.js +64 -0
- package/dist/clients/event.js.map +1 -0
- package/dist/clients/meter.d.ts +75 -0
- package/dist/clients/meter.js +65 -0
- package/dist/clients/meter.js.map +1 -0
- package/dist/clients/portal.d.ts +22 -0
- package/dist/clients/portal.js +37 -0
- package/dist/clients/portal.js.map +1 -0
- package/dist/clients/subject.d.ts +27 -0
- package/dist/clients/subject.js +56 -0
- package/dist/clients/subject.js.map +1 -0
- package/dist/index.d.ts +14 -22
- package/dist/index.js +14 -25
- package/dist/index.js.map +1 -0
- package/dist/schemas/openapi.d.ts +2078 -0
- package/dist/schemas/openapi.js +6 -0
- package/dist/schemas/openapi.js.map +1 -0
- package/dist/test/agent.d.ts +2 -0
- package/dist/test/agent.js +263 -0
- package/dist/test/agent.js.map +1 -0
- package/dist/test/mocks.d.ts +14 -0
- package/dist/test/mocks.js +41 -0
- package/dist/test/mocks.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -56
- package/dist/generated/HttpService.d.ts +0 -14
- package/dist/generated/HttpService.js +0 -27
- package/dist/generated/core/ApiError.d.ts +0 -10
- package/dist/generated/core/ApiError.js +0 -17
- package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
- package/dist/generated/core/ApiRequestOptions.js +0 -2
- package/dist/generated/core/ApiResult.d.ts +0 -7
- package/dist/generated/core/ApiResult.js +0 -2
- package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
- package/dist/generated/core/BaseHttpRequest.js +0 -7
- package/dist/generated/core/CancelablePromise.d.ts +0 -20
- package/dist/generated/core/CancelablePromise.js +0 -93
- package/dist/generated/core/NodeHttpRequest.d.ts +0 -14
- package/dist/generated/core/NodeHttpRequest.js +0 -17
- package/dist/generated/core/OpenAPI.d.ts +0 -16
- package/dist/generated/core/OpenAPI.js +0 -12
- package/dist/generated/core/request.d.ts +0 -34
- package/dist/generated/core/request.js +0 -268
- package/dist/generated/index.d.ts +0 -29
- package/dist/generated/index.js +0 -22
- package/dist/generated/models/Event.d.ts +0 -49
- package/dist/generated/models/Event.js +0 -11
- package/dist/generated/models/IdOrSlug.d.ts +0 -1
- package/dist/generated/models/IdOrSlug.js +0 -2
- package/dist/generated/models/Meter.d.ts +0 -30
- package/dist/generated/models/Meter.js +0 -2
- package/dist/generated/models/MeterAggregation.d.ts +0 -10
- package/dist/generated/models/MeterAggregation.js +0 -12
- package/dist/generated/models/MeterValue.d.ts +0 -10
- package/dist/generated/models/MeterValue.js +0 -2
- package/dist/generated/models/Namespace.d.ts +0 -6
- package/dist/generated/models/Namespace.js +0 -2
- package/dist/generated/models/Problem.d.ts +0 -4
- package/dist/generated/models/Problem.js +0 -2
- package/dist/generated/models/WindowSize.d.ts +0 -5
- package/dist/generated/models/WindowSize.js +0 -7
- package/dist/generated/models/meterIdOrSlug.d.ts +0 -5
- package/dist/generated/models/meterIdOrSlug.js +0 -2
- package/dist/generated/models/namespaceParam.d.ts +0 -4
- package/dist/generated/models/namespaceParam.js +0 -2
- package/dist/generated/schemas/$Event.d.ts +0 -59
- package/dist/generated/schemas/$Event.js +0 -60
- package/dist/generated/schemas/$IdOrSlug.d.ts +0 -13
- package/dist/generated/schemas/$IdOrSlug.js +0 -14
- package/dist/generated/schemas/$Meter.d.ts +0 -44
- package/dist/generated/schemas/$Meter.js +0 -45
- package/dist/generated/schemas/$MeterAggregation.d.ts +0 -3
- package/dist/generated/schemas/$MeterAggregation.js +0 -4
- package/dist/generated/schemas/$MeterValue.d.ts +0 -26
- package/dist/generated/schemas/$MeterValue.js +0 -27
- package/dist/generated/schemas/$Namespace.d.ts +0 -9
- package/dist/generated/schemas/$Namespace.js +0 -10
- package/dist/generated/schemas/$Problem.d.ts +0 -6
- package/dist/generated/schemas/$Problem.js +0 -7
- package/dist/generated/schemas/$WindowSize.d.ts +0 -3
- package/dist/generated/schemas/$WindowSize.js +0 -4
- package/dist/generated/schemas/$meterIdOrSlug.d.ts +0 -4
- package/dist/generated/schemas/$meterIdOrSlug.js +0 -5
- package/dist/generated/schemas/$namespaceParam.d.ts +0 -5
- package/dist/generated/schemas/$namespaceParam.js +0 -6
- package/dist/generated/services/DefaultService.d.ts +0 -16
- package/dist/generated/services/DefaultService.js +0 -22
- package/dist/generated/services/EventsService.d.ts +0 -17
- package/dist/generated/services/EventsService.js +0 -29
- package/dist/generated/services/MetersService.d.ts +0 -75
- package/dist/generated/services/MetersService.js +0 -140
- package/index.ts +0 -53
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
import FormData from 'form-data';
|
|
3
|
-
import fetch, { Headers } from 'node-fetch';
|
|
4
|
-
import { ApiError } from './ApiError.js';
|
|
5
|
-
import { CancelablePromise } from './CancelablePromise.js';
|
|
6
|
-
export const isDefined = (value) => {
|
|
7
|
-
return value !== undefined && value !== null;
|
|
8
|
-
};
|
|
9
|
-
export const isString = (value) => {
|
|
10
|
-
return typeof value === 'string';
|
|
11
|
-
};
|
|
12
|
-
export const isStringWithValue = (value) => {
|
|
13
|
-
return isString(value) && value !== '';
|
|
14
|
-
};
|
|
15
|
-
export const isBlob = (value) => {
|
|
16
|
-
return (typeof value === 'object' &&
|
|
17
|
-
typeof value.type === 'string' &&
|
|
18
|
-
typeof value.stream === 'function' &&
|
|
19
|
-
typeof value.arrayBuffer === 'function' &&
|
|
20
|
-
typeof value.constructor === 'function' &&
|
|
21
|
-
typeof value.constructor.name === 'string' &&
|
|
22
|
-
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
23
|
-
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
24
|
-
};
|
|
25
|
-
export const isFormData = (value) => {
|
|
26
|
-
return value instanceof FormData;
|
|
27
|
-
};
|
|
28
|
-
export const base64 = (str) => {
|
|
29
|
-
try {
|
|
30
|
-
return btoa(str);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
return Buffer.from(str).toString('base64');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export const getQueryString = (params) => {
|
|
37
|
-
const qs = [];
|
|
38
|
-
const append = (key, value) => {
|
|
39
|
-
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
40
|
-
};
|
|
41
|
-
const process = (key, value) => {
|
|
42
|
-
if (isDefined(value)) {
|
|
43
|
-
if (Array.isArray(value)) {
|
|
44
|
-
value.forEach(v => {
|
|
45
|
-
process(key, v);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
else if (typeof value === 'object') {
|
|
49
|
-
Object.entries(value).forEach(([k, v]) => {
|
|
50
|
-
process(`${key}[${k}]`, v);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
append(key, value);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
59
|
-
process(key, value);
|
|
60
|
-
});
|
|
61
|
-
if (qs.length > 0) {
|
|
62
|
-
return `?${qs.join('&')}`;
|
|
63
|
-
}
|
|
64
|
-
return '';
|
|
65
|
-
};
|
|
66
|
-
const getUrl = (config, options) => {
|
|
67
|
-
const encoder = config.ENCODE_PATH || encodeURI;
|
|
68
|
-
const path = options.url
|
|
69
|
-
.replace('{api-version}', config.VERSION)
|
|
70
|
-
.replace(/{(.*?)}/g, (substring, group) => {
|
|
71
|
-
if (options.path?.hasOwnProperty(group)) {
|
|
72
|
-
return encoder(String(options.path[group]));
|
|
73
|
-
}
|
|
74
|
-
return substring;
|
|
75
|
-
});
|
|
76
|
-
const url = `${config.BASE}${path}`;
|
|
77
|
-
if (options.query) {
|
|
78
|
-
return `${url}${getQueryString(options.query)}`;
|
|
79
|
-
}
|
|
80
|
-
return url;
|
|
81
|
-
};
|
|
82
|
-
export const getFormData = (options) => {
|
|
83
|
-
if (options.formData) {
|
|
84
|
-
const formData = new FormData();
|
|
85
|
-
const process = (key, value) => {
|
|
86
|
-
if (isString(value) || isBlob(value)) {
|
|
87
|
-
formData.append(key, value);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
formData.append(key, JSON.stringify(value));
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
Object.entries(options.formData)
|
|
94
|
-
.filter(([_, value]) => isDefined(value))
|
|
95
|
-
.forEach(([key, value]) => {
|
|
96
|
-
if (Array.isArray(value)) {
|
|
97
|
-
value.forEach(v => process(key, v));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
process(key, value);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return formData;
|
|
104
|
-
}
|
|
105
|
-
return undefined;
|
|
106
|
-
};
|
|
107
|
-
export const resolve = async (options, resolver) => {
|
|
108
|
-
if (typeof resolver === 'function') {
|
|
109
|
-
return resolver(options);
|
|
110
|
-
}
|
|
111
|
-
return resolver;
|
|
112
|
-
};
|
|
113
|
-
export const getHeaders = async (config, options) => {
|
|
114
|
-
const token = await resolve(options, config.TOKEN);
|
|
115
|
-
const username = await resolve(options, config.USERNAME);
|
|
116
|
-
const password = await resolve(options, config.PASSWORD);
|
|
117
|
-
const additionalHeaders = await resolve(options, config.HEADERS);
|
|
118
|
-
const headers = Object.entries({
|
|
119
|
-
Accept: 'application/json',
|
|
120
|
-
...additionalHeaders,
|
|
121
|
-
...options.headers,
|
|
122
|
-
})
|
|
123
|
-
.filter(([_, value]) => isDefined(value))
|
|
124
|
-
.reduce((headers, [key, value]) => ({
|
|
125
|
-
...headers,
|
|
126
|
-
[key]: String(value),
|
|
127
|
-
}), {});
|
|
128
|
-
if (isStringWithValue(token)) {
|
|
129
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
130
|
-
}
|
|
131
|
-
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
132
|
-
const credentials = base64(`${username}:${password}`);
|
|
133
|
-
headers['Authorization'] = `Basic ${credentials}`;
|
|
134
|
-
}
|
|
135
|
-
if (options.body) {
|
|
136
|
-
if (options.mediaType) {
|
|
137
|
-
headers['Content-Type'] = options.mediaType;
|
|
138
|
-
}
|
|
139
|
-
else if (isBlob(options.body)) {
|
|
140
|
-
headers['Content-Type'] = 'application/octet-stream';
|
|
141
|
-
}
|
|
142
|
-
else if (isString(options.body)) {
|
|
143
|
-
headers['Content-Type'] = 'text/plain';
|
|
144
|
-
}
|
|
145
|
-
else if (!isFormData(options.body)) {
|
|
146
|
-
headers['Content-Type'] = 'application/json';
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return new Headers(headers);
|
|
150
|
-
};
|
|
151
|
-
export const getRequestBody = (options) => {
|
|
152
|
-
if (options.body !== undefined) {
|
|
153
|
-
if (options.mediaType?.includes('/json')) {
|
|
154
|
-
return JSON.stringify(options.body);
|
|
155
|
-
}
|
|
156
|
-
else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
157
|
-
return options.body;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
return JSON.stringify(options.body);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return undefined;
|
|
164
|
-
};
|
|
165
|
-
export const sendRequest = async (options, url, body, formData, headers, onCancel) => {
|
|
166
|
-
const controller = new AbortController();
|
|
167
|
-
const request = {
|
|
168
|
-
headers,
|
|
169
|
-
method: options.method,
|
|
170
|
-
body: body ?? formData,
|
|
171
|
-
signal: controller.signal,
|
|
172
|
-
};
|
|
173
|
-
onCancel(() => controller.abort());
|
|
174
|
-
return await fetch(url, request);
|
|
175
|
-
};
|
|
176
|
-
export const getResponseHeader = (response, responseHeader) => {
|
|
177
|
-
if (responseHeader) {
|
|
178
|
-
const content = response.headers.get(responseHeader);
|
|
179
|
-
if (isString(content)) {
|
|
180
|
-
return content;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return undefined;
|
|
184
|
-
};
|
|
185
|
-
export const getResponseBody = async (response) => {
|
|
186
|
-
if (response.status !== 204) {
|
|
187
|
-
try {
|
|
188
|
-
const contentType = response.headers.get('Content-Type');
|
|
189
|
-
if (contentType) {
|
|
190
|
-
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
191
|
-
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
192
|
-
if (isJSON) {
|
|
193
|
-
return await response.json();
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
return await response.text();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
catch (error) {
|
|
201
|
-
console.error(error);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return undefined;
|
|
205
|
-
};
|
|
206
|
-
export const catchErrorCodes = (options, result) => {
|
|
207
|
-
const errors = {
|
|
208
|
-
400: 'Bad Request',
|
|
209
|
-
401: 'Unauthorized',
|
|
210
|
-
403: 'Forbidden',
|
|
211
|
-
404: 'Not Found',
|
|
212
|
-
500: 'Internal Server Error',
|
|
213
|
-
502: 'Bad Gateway',
|
|
214
|
-
503: 'Service Unavailable',
|
|
215
|
-
...options.errors,
|
|
216
|
-
};
|
|
217
|
-
const error = errors[result.status];
|
|
218
|
-
if (error) {
|
|
219
|
-
throw new ApiError(options, result, error);
|
|
220
|
-
}
|
|
221
|
-
if (!result.ok) {
|
|
222
|
-
const errorStatus = result.status ?? 'unknown';
|
|
223
|
-
const errorStatusText = result.statusText ?? 'unknown';
|
|
224
|
-
const errorBody = (() => {
|
|
225
|
-
try {
|
|
226
|
-
return JSON.stringify(result.body, null, 2);
|
|
227
|
-
}
|
|
228
|
-
catch (e) {
|
|
229
|
-
return undefined;
|
|
230
|
-
}
|
|
231
|
-
})();
|
|
232
|
-
throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Request method
|
|
237
|
-
* @param config The OpenAPI configuration object
|
|
238
|
-
* @param options The request options from the service
|
|
239
|
-
* @returns CancelablePromise<T>
|
|
240
|
-
* @throws ApiError
|
|
241
|
-
*/
|
|
242
|
-
export const request = (config, options) => {
|
|
243
|
-
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
244
|
-
try {
|
|
245
|
-
const url = getUrl(config, options);
|
|
246
|
-
const formData = getFormData(options);
|
|
247
|
-
const body = getRequestBody(options);
|
|
248
|
-
const headers = await getHeaders(config, options);
|
|
249
|
-
if (!onCancel.isCancelled) {
|
|
250
|
-
const response = await sendRequest(options, url, body, formData, headers, onCancel);
|
|
251
|
-
const responseBody = await getResponseBody(response);
|
|
252
|
-
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
253
|
-
const result = {
|
|
254
|
-
url,
|
|
255
|
-
ok: response.ok,
|
|
256
|
-
status: response.status,
|
|
257
|
-
statusText: response.statusText,
|
|
258
|
-
body: responseHeader ?? responseBody,
|
|
259
|
-
};
|
|
260
|
-
catchErrorCodes(options, result);
|
|
261
|
-
resolve(result.body);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
catch (error) {
|
|
265
|
-
reject(error);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export { HttpService } from './HttpService.js';
|
|
2
|
-
export { ApiError } from './core/ApiError.js';
|
|
3
|
-
export { BaseHttpRequest } from './core/BaseHttpRequest.js';
|
|
4
|
-
export { CancelablePromise, CancelError } from './core/CancelablePromise.js';
|
|
5
|
-
export { OpenAPI } from './core/OpenAPI.js';
|
|
6
|
-
export type { OpenAPIConfig } from './core/OpenAPI.js';
|
|
7
|
-
export { Event } from './models/Event.js';
|
|
8
|
-
export type { IdOrSlug } from './models/IdOrSlug.js';
|
|
9
|
-
export type { Meter } from './models/Meter.js';
|
|
10
|
-
export { MeterAggregation } from './models/MeterAggregation.js';
|
|
11
|
-
export type { meterIdOrSlug } from './models/meterIdOrSlug.js';
|
|
12
|
-
export type { MeterValue } from './models/MeterValue.js';
|
|
13
|
-
export type { Namespace } from './models/Namespace.js';
|
|
14
|
-
export type { namespaceParam } from './models/namespaceParam.js';
|
|
15
|
-
export type { Problem } from './models/Problem.js';
|
|
16
|
-
export { WindowSize } from './models/WindowSize.js';
|
|
17
|
-
export { $Event } from './schemas/$Event.js';
|
|
18
|
-
export { $IdOrSlug } from './schemas/$IdOrSlug.js';
|
|
19
|
-
export { $Meter } from './schemas/$Meter.js';
|
|
20
|
-
export { $MeterAggregation } from './schemas/$MeterAggregation.js';
|
|
21
|
-
export { $meterIdOrSlug } from './schemas/$meterIdOrSlug.js';
|
|
22
|
-
export { $MeterValue } from './schemas/$MeterValue.js';
|
|
23
|
-
export { $Namespace } from './schemas/$Namespace.js';
|
|
24
|
-
export { $namespaceParam } from './schemas/$namespaceParam.js';
|
|
25
|
-
export { $Problem } from './schemas/$Problem.js';
|
|
26
|
-
export { $WindowSize } from './schemas/$WindowSize.js';
|
|
27
|
-
export { DefaultService } from './services/DefaultService.js';
|
|
28
|
-
export { EventsService } from './services/EventsService.js';
|
|
29
|
-
export { MetersService } from './services/MetersService.js';
|
package/dist/generated/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export { HttpService } from './HttpService.js';
|
|
3
|
-
export { ApiError } from './core/ApiError.js';
|
|
4
|
-
export { BaseHttpRequest } from './core/BaseHttpRequest.js';
|
|
5
|
-
export { CancelablePromise, CancelError } from './core/CancelablePromise.js';
|
|
6
|
-
export { OpenAPI } from './core/OpenAPI.js';
|
|
7
|
-
export { Event } from './models/Event.js';
|
|
8
|
-
export { MeterAggregation } from './models/MeterAggregation.js';
|
|
9
|
-
export { WindowSize } from './models/WindowSize.js';
|
|
10
|
-
export { $Event } from './schemas/$Event.js';
|
|
11
|
-
export { $IdOrSlug } from './schemas/$IdOrSlug.js';
|
|
12
|
-
export { $Meter } from './schemas/$Meter.js';
|
|
13
|
-
export { $MeterAggregation } from './schemas/$MeterAggregation.js';
|
|
14
|
-
export { $meterIdOrSlug } from './schemas/$meterIdOrSlug.js';
|
|
15
|
-
export { $MeterValue } from './schemas/$MeterValue.js';
|
|
16
|
-
export { $Namespace } from './schemas/$Namespace.js';
|
|
17
|
-
export { $namespaceParam } from './schemas/$namespaceParam.js';
|
|
18
|
-
export { $Problem } from './schemas/$Problem.js';
|
|
19
|
-
export { $WindowSize } from './schemas/$WindowSize.js';
|
|
20
|
-
export { DefaultService } from './services/DefaultService.js';
|
|
21
|
-
export { EventsService } from './services/EventsService.js';
|
|
22
|
-
export { MetersService } from './services/MetersService.js';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CloudEvents Specification JSON Schema
|
|
3
|
-
*/
|
|
4
|
-
export type Event = {
|
|
5
|
-
/**
|
|
6
|
-
* Identifies the event.
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* Identifies the context in which an event happened.
|
|
11
|
-
*/
|
|
12
|
-
source: string;
|
|
13
|
-
/**
|
|
14
|
-
* The version of the CloudEvents specification which the event uses.
|
|
15
|
-
*/
|
|
16
|
-
specversion: string;
|
|
17
|
-
/**
|
|
18
|
-
* Describes the type of event related to the originating occurrence.
|
|
19
|
-
*/
|
|
20
|
-
type: string;
|
|
21
|
-
/**
|
|
22
|
-
* Content type of the data value. Must adhere to RFC 2046 format.
|
|
23
|
-
*/
|
|
24
|
-
datacontenttype?: Event.datacontenttype | null;
|
|
25
|
-
/**
|
|
26
|
-
* Identifies the schema that data adheres to.
|
|
27
|
-
*/
|
|
28
|
-
dataschema?: string | null;
|
|
29
|
-
/**
|
|
30
|
-
* Describes the subject of the event in the context of the event producer (identified by source).
|
|
31
|
-
*/
|
|
32
|
-
subject: string;
|
|
33
|
-
/**
|
|
34
|
-
* Timestamp of when the occurrence happened. Must adhere to RFC 3339.
|
|
35
|
-
*/
|
|
36
|
-
time?: string | null;
|
|
37
|
-
/**
|
|
38
|
-
* The event payload.
|
|
39
|
-
*/
|
|
40
|
-
data?: Record<string, any>;
|
|
41
|
-
};
|
|
42
|
-
export declare namespace Event {
|
|
43
|
-
/**
|
|
44
|
-
* Content type of the data value. Must adhere to RFC 2046 format.
|
|
45
|
-
*/
|
|
46
|
-
enum datacontenttype {
|
|
47
|
-
APPLICATION_JSON = "application/json"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export var Event;
|
|
3
|
-
(function (Event) {
|
|
4
|
-
/**
|
|
5
|
-
* Content type of the data value. Must adhere to RFC 2046 format.
|
|
6
|
-
*/
|
|
7
|
-
let datacontenttype;
|
|
8
|
-
(function (datacontenttype) {
|
|
9
|
-
datacontenttype["APPLICATION_JSON"] = "application/json";
|
|
10
|
-
})(datacontenttype = Event.datacontenttype || (Event.datacontenttype = {}));
|
|
11
|
-
})(Event || (Event = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type IdOrSlug = string;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { MeterAggregation } from './MeterAggregation.js';
|
|
2
|
-
import type { WindowSize } from './WindowSize.js';
|
|
3
|
-
export type Meter = {
|
|
4
|
-
/**
|
|
5
|
-
* A unique identifier for the meter.
|
|
6
|
-
*/
|
|
7
|
-
readonly id?: string;
|
|
8
|
-
/**
|
|
9
|
-
* A unique identifier for the meter.
|
|
10
|
-
*/
|
|
11
|
-
slug: string;
|
|
12
|
-
/**
|
|
13
|
-
* A description of the meter.
|
|
14
|
-
*/
|
|
15
|
-
description?: string | null;
|
|
16
|
-
aggregation: MeterAggregation;
|
|
17
|
-
/**
|
|
18
|
-
* The event type to aggregate.
|
|
19
|
-
*/
|
|
20
|
-
eventType: string;
|
|
21
|
-
/**
|
|
22
|
-
* JSONPath expression to extract the value from the event data.
|
|
23
|
-
*/
|
|
24
|
-
valueProperty: string;
|
|
25
|
-
/**
|
|
26
|
-
* Named JSONPath expressions to extract the group by values from the event data.
|
|
27
|
-
*/
|
|
28
|
-
groupBy?: Record<string, string>;
|
|
29
|
-
windowSize: WindowSize;
|
|
30
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
/**
|
|
3
|
-
* The aggregation type to use for the meter.
|
|
4
|
-
*/
|
|
5
|
-
export var MeterAggregation;
|
|
6
|
-
(function (MeterAggregation) {
|
|
7
|
-
MeterAggregation["SUM"] = "SUM";
|
|
8
|
-
MeterAggregation["COUNT"] = "COUNT";
|
|
9
|
-
MeterAggregation["AVG"] = "AVG";
|
|
10
|
-
MeterAggregation["MIN"] = "MIN";
|
|
11
|
-
MeterAggregation["MAX"] = "MAX";
|
|
12
|
-
})(MeterAggregation || (MeterAggregation = {}));
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export declare const $Event: {
|
|
2
|
-
readonly description: "CloudEvents Specification JSON Schema";
|
|
3
|
-
readonly properties: {
|
|
4
|
-
readonly id: {
|
|
5
|
-
readonly type: "string";
|
|
6
|
-
readonly description: "Identifies the event.";
|
|
7
|
-
readonly isRequired: true;
|
|
8
|
-
readonly minLength: 1;
|
|
9
|
-
};
|
|
10
|
-
readonly source: {
|
|
11
|
-
readonly type: "string";
|
|
12
|
-
readonly description: "Identifies the context in which an event happened.";
|
|
13
|
-
readonly isRequired: true;
|
|
14
|
-
readonly format: "uri-reference";
|
|
15
|
-
readonly minLength: 1;
|
|
16
|
-
};
|
|
17
|
-
readonly specversion: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly description: "The version of the CloudEvents specification which the event uses.";
|
|
20
|
-
readonly isRequired: true;
|
|
21
|
-
readonly minLength: 1;
|
|
22
|
-
};
|
|
23
|
-
readonly type: {
|
|
24
|
-
readonly type: "string";
|
|
25
|
-
readonly description: "Describes the type of event related to the originating occurrence.";
|
|
26
|
-
readonly isRequired: true;
|
|
27
|
-
};
|
|
28
|
-
readonly datacontenttype: {
|
|
29
|
-
readonly type: "Enum";
|
|
30
|
-
readonly isNullable: true;
|
|
31
|
-
};
|
|
32
|
-
readonly dataschema: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly description: "Identifies the schema that data adheres to.";
|
|
35
|
-
readonly isNullable: true;
|
|
36
|
-
readonly format: "uri";
|
|
37
|
-
readonly minLength: 1;
|
|
38
|
-
};
|
|
39
|
-
readonly subject: {
|
|
40
|
-
readonly type: "string";
|
|
41
|
-
readonly description: "Describes the subject of the event in the context of the event producer (identified by source).";
|
|
42
|
-
readonly isRequired: true;
|
|
43
|
-
readonly minLength: 1;
|
|
44
|
-
};
|
|
45
|
-
readonly time: {
|
|
46
|
-
readonly type: "string";
|
|
47
|
-
readonly description: "Timestamp of when the occurrence happened. Must adhere to RFC 3339.";
|
|
48
|
-
readonly isNullable: true;
|
|
49
|
-
readonly format: "date-time";
|
|
50
|
-
readonly minLength: 1;
|
|
51
|
-
};
|
|
52
|
-
readonly data: {
|
|
53
|
-
readonly type: "dictionary";
|
|
54
|
-
readonly contains: {
|
|
55
|
-
readonly properties: {};
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export const $Event = {
|
|
3
|
-
description: `CloudEvents Specification JSON Schema`,
|
|
4
|
-
properties: {
|
|
5
|
-
id: {
|
|
6
|
-
type: 'string',
|
|
7
|
-
description: `Identifies the event.`,
|
|
8
|
-
isRequired: true,
|
|
9
|
-
minLength: 1,
|
|
10
|
-
},
|
|
11
|
-
source: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
description: `Identifies the context in which an event happened.`,
|
|
14
|
-
isRequired: true,
|
|
15
|
-
format: 'uri-reference',
|
|
16
|
-
minLength: 1,
|
|
17
|
-
},
|
|
18
|
-
specversion: {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: `The version of the CloudEvents specification which the event uses.`,
|
|
21
|
-
isRequired: true,
|
|
22
|
-
minLength: 1,
|
|
23
|
-
},
|
|
24
|
-
type: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
description: `Describes the type of event related to the originating occurrence.`,
|
|
27
|
-
isRequired: true,
|
|
28
|
-
},
|
|
29
|
-
datacontenttype: {
|
|
30
|
-
type: 'Enum',
|
|
31
|
-
isNullable: true,
|
|
32
|
-
},
|
|
33
|
-
dataschema: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: `Identifies the schema that data adheres to.`,
|
|
36
|
-
isNullable: true,
|
|
37
|
-
format: 'uri',
|
|
38
|
-
minLength: 1,
|
|
39
|
-
},
|
|
40
|
-
subject: {
|
|
41
|
-
type: 'string',
|
|
42
|
-
description: `Describes the subject of the event in the context of the event producer (identified by source).`,
|
|
43
|
-
isRequired: true,
|
|
44
|
-
minLength: 1,
|
|
45
|
-
},
|
|
46
|
-
time: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
description: `Timestamp of when the occurrence happened. Must adhere to RFC 3339.`,
|
|
49
|
-
isNullable: true,
|
|
50
|
-
format: 'date-time',
|
|
51
|
-
minLength: 1,
|
|
52
|
-
},
|
|
53
|
-
data: {
|
|
54
|
-
type: 'dictionary',
|
|
55
|
-
contains: {
|
|
56
|
-
properties: {},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const $IdOrSlug: {
|
|
2
|
-
readonly type: "one-of";
|
|
3
|
-
readonly contains: readonly [{
|
|
4
|
-
readonly type: "string";
|
|
5
|
-
readonly maxLength: 26;
|
|
6
|
-
readonly minLength: 26;
|
|
7
|
-
}, {
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
readonly maxLength: 63;
|
|
10
|
-
readonly minLength: 1;
|
|
11
|
-
readonly pattern: "^[a-z0-9]+(?:_[a-z0-9]+)*$";
|
|
12
|
-
}];
|
|
13
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/* generated using openapi-typescript-codegen -- do no edit */
|
|
2
|
-
export const $IdOrSlug = {
|
|
3
|
-
type: 'one-of',
|
|
4
|
-
contains: [{
|
|
5
|
-
type: 'string',
|
|
6
|
-
maxLength: 26,
|
|
7
|
-
minLength: 26,
|
|
8
|
-
}, {
|
|
9
|
-
type: 'string',
|
|
10
|
-
maxLength: 63,
|
|
11
|
-
minLength: 1,
|
|
12
|
-
pattern: '^[a-z0-9]+(?:_[a-z0-9]+)*$',
|
|
13
|
-
}],
|
|
14
|
-
};
|