@contractspec/lib.metering 1.57.0 → 1.59.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/dist/aggregation/index.d.ts +119 -122
- package/dist/aggregation/index.d.ts.map +1 -1
- package/dist/aggregation/index.js +257 -265
- package/dist/analytics/posthog-metering-reader.d.ts +32 -36
- package/dist/analytics/posthog-metering-reader.d.ts.map +1 -1
- package/dist/analytics/posthog-metering-reader.js +239 -179
- package/dist/analytics/posthog-metering.d.ts +30 -34
- package/dist/analytics/posthog-metering.d.ts.map +1 -1
- package/dist/analytics/posthog-metering.js +45 -45
- package/dist/browser/aggregation/index.js +265 -0
- package/dist/browser/analytics/posthog-metering-reader.js +266 -0
- package/dist/browser/analytics/posthog-metering.js +45 -0
- package/dist/browser/contracts/index.js +617 -0
- package/dist/browser/docs/index.js +62 -0
- package/dist/browser/docs/metering.docblock.js +62 -0
- package/dist/browser/entities/index.js +350 -0
- package/dist/browser/events.js +228 -0
- package/dist/browser/index.js +1879 -0
- package/dist/browser/metering.capability.js +28 -0
- package/dist/browser/metering.feature.js +52 -0
- package/dist/contracts/index.d.ts +1076 -1082
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +616 -1030
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +63 -1
- package/dist/docs/metering.docblock.d.ts +2 -1
- package/dist/docs/metering.docblock.d.ts.map +1 -0
- package/dist/docs/metering.docblock.js +17 -22
- package/dist/entities/index.d.ts +186 -191
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +340 -407
- package/dist/events.d.ts +411 -417
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +226 -414
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1880 -10
- package/dist/metering.capability.d.ts +2 -7
- package/dist/metering.capability.d.ts.map +1 -1
- package/dist/metering.capability.js +29 -33
- package/dist/metering.feature.d.ts +1 -6
- package/dist/metering.feature.d.ts.map +1 -1
- package/dist/metering.feature.js +51 -132
- package/dist/node/aggregation/index.js +265 -0
- package/dist/node/analytics/posthog-metering-reader.js +266 -0
- package/dist/node/analytics/posthog-metering.js +45 -0
- package/dist/node/contracts/index.js +617 -0
- package/dist/node/docs/index.js +62 -0
- package/dist/node/docs/metering.docblock.js +62 -0
- package/dist/node/entities/index.js +350 -0
- package/dist/node/events.js +228 -0
- package/dist/node/index.js +1879 -0
- package/dist/node/metering.capability.js +28 -0
- package/dist/node/metering.feature.js +52 -0
- package/package.json +133 -34
- package/dist/aggregation/index.js.map +0 -1
- package/dist/analytics/posthog-metering-reader.js.map +0 -1
- package/dist/analytics/posthog-metering.js.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/docs/metering.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/metering.capability.js.map +0 -1
- package/dist/metering.feature.js.map +0 -1
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAmIA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;GAU7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;GAUlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUjC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS1B,CAAC"}
|
package/dist/events.js
CHANGED
|
@@ -1,417 +1,229 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/events.ts
|
|
1
3
|
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
2
4
|
import { defineEvent } from "@contractspec/lib.contracts";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
isOptional: true
|
|
228
|
-
},
|
|
229
|
-
threshold: {
|
|
230
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
231
|
-
isOptional: false
|
|
232
|
-
},
|
|
233
|
-
actualValue: {
|
|
234
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
235
|
-
isOptional: false
|
|
236
|
-
},
|
|
237
|
-
percentageUsed: {
|
|
238
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
239
|
-
isOptional: false
|
|
240
|
-
},
|
|
241
|
-
action: {
|
|
242
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
243
|
-
isOptional: false
|
|
244
|
-
},
|
|
245
|
-
triggeredAt: {
|
|
246
|
-
type: ScalarTypeEnum.DateTime(),
|
|
247
|
-
isOptional: false
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
const ThresholdApproachingPayload = defineSchemaModel({
|
|
252
|
-
name: "ThresholdApproachingEventPayload",
|
|
253
|
-
description: "Payload when usage is approaching a threshold",
|
|
254
|
-
fields: {
|
|
255
|
-
thresholdId: {
|
|
256
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
257
|
-
isOptional: false
|
|
258
|
-
},
|
|
259
|
-
metricKey: {
|
|
260
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
261
|
-
isOptional: false
|
|
262
|
-
},
|
|
263
|
-
subjectType: {
|
|
264
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
265
|
-
isOptional: true
|
|
266
|
-
},
|
|
267
|
-
subjectId: {
|
|
268
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
269
|
-
isOptional: true
|
|
270
|
-
},
|
|
271
|
-
threshold: {
|
|
272
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
273
|
-
isOptional: false
|
|
274
|
-
},
|
|
275
|
-
currentValue: {
|
|
276
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
277
|
-
isOptional: false
|
|
278
|
-
},
|
|
279
|
-
percentageUsed: {
|
|
280
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
281
|
-
isOptional: false
|
|
282
|
-
},
|
|
283
|
-
triggeredAt: {
|
|
284
|
-
type: ScalarTypeEnum.DateTime(),
|
|
285
|
-
isOptional: false
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
/**
|
|
290
|
-
* Emitted when a metric is defined.
|
|
291
|
-
*/
|
|
292
|
-
const MetricDefinedEvent = defineEvent({
|
|
293
|
-
meta: {
|
|
294
|
-
key: "metric.defined",
|
|
295
|
-
version: "1.0.0",
|
|
296
|
-
description: "A metric has been defined.",
|
|
297
|
-
stability: "stable",
|
|
298
|
-
owners: ["@platform.metering"],
|
|
299
|
-
tags: ["metering", "metric"]
|
|
300
|
-
},
|
|
301
|
-
payload: MetricDefinedPayload
|
|
302
|
-
});
|
|
303
|
-
/**
|
|
304
|
-
* Emitted when a metric is updated.
|
|
305
|
-
*/
|
|
306
|
-
const MetricUpdatedEvent = defineEvent({
|
|
307
|
-
meta: {
|
|
308
|
-
key: "metric.updated",
|
|
309
|
-
version: "1.0.0",
|
|
310
|
-
description: "A metric has been updated.",
|
|
311
|
-
stability: "stable",
|
|
312
|
-
owners: ["@platform.metering"],
|
|
313
|
-
tags: ["metering", "metric"]
|
|
314
|
-
},
|
|
315
|
-
payload: MetricUpdatedPayload
|
|
316
|
-
});
|
|
317
|
-
/**
|
|
318
|
-
* Emitted when usage is recorded.
|
|
319
|
-
*/
|
|
320
|
-
const UsageRecordedEvent = defineEvent({
|
|
321
|
-
meta: {
|
|
322
|
-
key: "usage.recorded",
|
|
323
|
-
version: "1.0.0",
|
|
324
|
-
description: "Usage has been recorded.",
|
|
325
|
-
stability: "stable",
|
|
326
|
-
owners: ["@platform.metering"],
|
|
327
|
-
tags: ["metering", "usage"]
|
|
328
|
-
},
|
|
329
|
-
payload: UsageRecordedPayload
|
|
330
|
-
});
|
|
331
|
-
/**
|
|
332
|
-
* Emitted when a batch of usage is recorded.
|
|
333
|
-
*/
|
|
334
|
-
const UsageBatchRecordedEvent = defineEvent({
|
|
335
|
-
meta: {
|
|
336
|
-
key: "usage.batch_recorded",
|
|
337
|
-
version: "1.0.0",
|
|
338
|
-
description: "A batch of usage has been recorded.",
|
|
339
|
-
stability: "stable",
|
|
340
|
-
owners: ["@platform.metering"],
|
|
341
|
-
tags: ["metering", "usage"]
|
|
342
|
-
},
|
|
343
|
-
payload: UsageBatchRecordedPayload
|
|
344
|
-
});
|
|
345
|
-
/**
|
|
346
|
-
* Emitted when usage is aggregated.
|
|
347
|
-
*/
|
|
348
|
-
const UsageAggregatedEvent = defineEvent({
|
|
349
|
-
meta: {
|
|
350
|
-
key: "usage.aggregated",
|
|
351
|
-
version: "1.0.0",
|
|
352
|
-
description: "Usage has been aggregated into a summary.",
|
|
353
|
-
stability: "stable",
|
|
354
|
-
owners: ["@platform.metering"],
|
|
355
|
-
tags: ["metering", "usage"]
|
|
356
|
-
},
|
|
357
|
-
payload: UsageAggregatedPayload
|
|
358
|
-
});
|
|
359
|
-
/**
|
|
360
|
-
* Emitted when a threshold is created.
|
|
361
|
-
*/
|
|
362
|
-
const ThresholdCreatedEvent = defineEvent({
|
|
363
|
-
meta: {
|
|
364
|
-
key: "threshold.created",
|
|
365
|
-
version: "1.0.0",
|
|
366
|
-
description: "A usage threshold has been created.",
|
|
367
|
-
stability: "stable",
|
|
368
|
-
owners: ["@platform.metering"],
|
|
369
|
-
tags: ["metering", "threshold"]
|
|
370
|
-
},
|
|
371
|
-
payload: ThresholdCreatedPayload
|
|
372
|
-
});
|
|
373
|
-
/**
|
|
374
|
-
* Emitted when a threshold is exceeded.
|
|
375
|
-
*/
|
|
376
|
-
const ThresholdExceededEvent = defineEvent({
|
|
377
|
-
meta: {
|
|
378
|
-
key: "threshold.exceeded",
|
|
379
|
-
version: "1.0.0",
|
|
380
|
-
description: "Usage has exceeded a threshold.",
|
|
381
|
-
stability: "stable",
|
|
382
|
-
owners: ["@platform.metering"],
|
|
383
|
-
tags: ["metering", "threshold"]
|
|
384
|
-
},
|
|
385
|
-
payload: ThresholdExceededPayload
|
|
386
|
-
});
|
|
387
|
-
/**
|
|
388
|
-
* Emitted when usage is approaching a threshold.
|
|
389
|
-
*/
|
|
390
|
-
const ThresholdApproachingEvent = defineEvent({
|
|
391
|
-
meta: {
|
|
392
|
-
key: "threshold.approaching",
|
|
393
|
-
version: "1.0.0",
|
|
394
|
-
description: "Usage is approaching a threshold.",
|
|
395
|
-
stability: "stable",
|
|
396
|
-
owners: ["@platform.metering"],
|
|
397
|
-
tags: ["metering", "threshold"]
|
|
398
|
-
},
|
|
399
|
-
payload: ThresholdApproachingPayload
|
|
400
|
-
});
|
|
401
|
-
/**
|
|
402
|
-
* All metering events.
|
|
403
|
-
*/
|
|
404
|
-
const MeteringEvents = {
|
|
405
|
-
MetricDefinedEvent,
|
|
406
|
-
MetricUpdatedEvent,
|
|
407
|
-
UsageRecordedEvent,
|
|
408
|
-
UsageBatchRecordedEvent,
|
|
409
|
-
UsageAggregatedEvent,
|
|
410
|
-
ThresholdCreatedEvent,
|
|
411
|
-
ThresholdExceededEvent,
|
|
412
|
-
ThresholdApproachingEvent
|
|
5
|
+
var MetricDefinedPayload = defineSchemaModel({
|
|
6
|
+
name: "MetricDefinedEventPayload",
|
|
7
|
+
description: "Payload when a metric is defined",
|
|
8
|
+
fields: {
|
|
9
|
+
metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
+
key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
+
unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
aggregationType: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
18
|
+
createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
19
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var MetricUpdatedPayload = defineSchemaModel({
|
|
23
|
+
name: "MetricUpdatedEventPayload",
|
|
24
|
+
description: "Payload when a metric is updated",
|
|
25
|
+
fields: {
|
|
26
|
+
metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
27
|
+
key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
28
|
+
changes: { type: ScalarTypeEnum.JSON(), isOptional: false },
|
|
29
|
+
updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
30
|
+
updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var UsageRecordedPayload = defineSchemaModel({
|
|
34
|
+
name: "UsageRecordedEventPayload",
|
|
35
|
+
description: "Payload when usage is recorded",
|
|
36
|
+
fields: {
|
|
37
|
+
recordId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
38
|
+
metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
39
|
+
subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
40
|
+
subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
41
|
+
quantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
42
|
+
source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
43
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
var UsageBatchRecordedPayload = defineSchemaModel({
|
|
47
|
+
name: "UsageBatchRecordedEventPayload",
|
|
48
|
+
description: "Payload when a batch of usage is recorded",
|
|
49
|
+
fields: {
|
|
50
|
+
recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
51
|
+
metricKeys: { type: ScalarTypeEnum.JSON(), isOptional: false },
|
|
52
|
+
totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
53
|
+
timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var UsageAggregatedPayload = defineSchemaModel({
|
|
57
|
+
name: "UsageAggregatedEventPayload",
|
|
58
|
+
description: "Payload when usage is aggregated",
|
|
59
|
+
fields: {
|
|
60
|
+
summaryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
61
|
+
metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
62
|
+
subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
63
|
+
subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
66
|
+
periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
67
|
+
totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
68
|
+
recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
69
|
+
aggregatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var ThresholdCreatedPayload = defineSchemaModel({
|
|
73
|
+
name: "ThresholdCreatedEventPayload",
|
|
74
|
+
description: "Payload when a threshold is created",
|
|
75
|
+
fields: {
|
|
76
|
+
thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
77
|
+
metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
78
|
+
subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
79
|
+
subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
80
|
+
threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
81
|
+
action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var ThresholdExceededPayload = defineSchemaModel({
|
|
86
|
+
name: "ThresholdExceededEventPayload",
|
|
87
|
+
description: "Payload when a threshold is exceeded",
|
|
88
|
+
fields: {
|
|
89
|
+
alertId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
90
|
+
thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
91
|
+
metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
92
|
+
subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
93
|
+
subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
94
|
+
threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
95
|
+
actualValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
96
|
+
percentageUsed: {
|
|
97
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
98
|
+
isOptional: false
|
|
99
|
+
},
|
|
100
|
+
action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
101
|
+
triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
var ThresholdApproachingPayload = defineSchemaModel({
|
|
105
|
+
name: "ThresholdApproachingEventPayload",
|
|
106
|
+
description: "Payload when usage is approaching a threshold",
|
|
107
|
+
fields: {
|
|
108
|
+
thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
109
|
+
metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
110
|
+
subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
111
|
+
subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
112
|
+
threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
113
|
+
currentValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
|
|
114
|
+
percentageUsed: {
|
|
115
|
+
type: ScalarTypeEnum.Float_unsecure(),
|
|
116
|
+
isOptional: false
|
|
117
|
+
},
|
|
118
|
+
triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
var MetricDefinedEvent = defineEvent({
|
|
122
|
+
meta: {
|
|
123
|
+
key: "metric.defined",
|
|
124
|
+
version: "1.0.0",
|
|
125
|
+
description: "A metric has been defined.",
|
|
126
|
+
stability: "stable",
|
|
127
|
+
owners: ["@platform.metering"],
|
|
128
|
+
tags: ["metering", "metric"]
|
|
129
|
+
},
|
|
130
|
+
payload: MetricDefinedPayload
|
|
131
|
+
});
|
|
132
|
+
var MetricUpdatedEvent = defineEvent({
|
|
133
|
+
meta: {
|
|
134
|
+
key: "metric.updated",
|
|
135
|
+
version: "1.0.0",
|
|
136
|
+
description: "A metric has been updated.",
|
|
137
|
+
stability: "stable",
|
|
138
|
+
owners: ["@platform.metering"],
|
|
139
|
+
tags: ["metering", "metric"]
|
|
140
|
+
},
|
|
141
|
+
payload: MetricUpdatedPayload
|
|
142
|
+
});
|
|
143
|
+
var UsageRecordedEvent = defineEvent({
|
|
144
|
+
meta: {
|
|
145
|
+
key: "usage.recorded",
|
|
146
|
+
version: "1.0.0",
|
|
147
|
+
description: "Usage has been recorded.",
|
|
148
|
+
stability: "stable",
|
|
149
|
+
owners: ["@platform.metering"],
|
|
150
|
+
tags: ["metering", "usage"]
|
|
151
|
+
},
|
|
152
|
+
payload: UsageRecordedPayload
|
|
153
|
+
});
|
|
154
|
+
var UsageBatchRecordedEvent = defineEvent({
|
|
155
|
+
meta: {
|
|
156
|
+
key: "usage.batch_recorded",
|
|
157
|
+
version: "1.0.0",
|
|
158
|
+
description: "A batch of usage has been recorded.",
|
|
159
|
+
stability: "stable",
|
|
160
|
+
owners: ["@platform.metering"],
|
|
161
|
+
tags: ["metering", "usage"]
|
|
162
|
+
},
|
|
163
|
+
payload: UsageBatchRecordedPayload
|
|
164
|
+
});
|
|
165
|
+
var UsageAggregatedEvent = defineEvent({
|
|
166
|
+
meta: {
|
|
167
|
+
key: "usage.aggregated",
|
|
168
|
+
version: "1.0.0",
|
|
169
|
+
description: "Usage has been aggregated into a summary.",
|
|
170
|
+
stability: "stable",
|
|
171
|
+
owners: ["@platform.metering"],
|
|
172
|
+
tags: ["metering", "usage"]
|
|
173
|
+
},
|
|
174
|
+
payload: UsageAggregatedPayload
|
|
175
|
+
});
|
|
176
|
+
var ThresholdCreatedEvent = defineEvent({
|
|
177
|
+
meta: {
|
|
178
|
+
key: "threshold.created",
|
|
179
|
+
version: "1.0.0",
|
|
180
|
+
description: "A usage threshold has been created.",
|
|
181
|
+
stability: "stable",
|
|
182
|
+
owners: ["@platform.metering"],
|
|
183
|
+
tags: ["metering", "threshold"]
|
|
184
|
+
},
|
|
185
|
+
payload: ThresholdCreatedPayload
|
|
186
|
+
});
|
|
187
|
+
var ThresholdExceededEvent = defineEvent({
|
|
188
|
+
meta: {
|
|
189
|
+
key: "threshold.exceeded",
|
|
190
|
+
version: "1.0.0",
|
|
191
|
+
description: "Usage has exceeded a threshold.",
|
|
192
|
+
stability: "stable",
|
|
193
|
+
owners: ["@platform.metering"],
|
|
194
|
+
tags: ["metering", "threshold"]
|
|
195
|
+
},
|
|
196
|
+
payload: ThresholdExceededPayload
|
|
197
|
+
});
|
|
198
|
+
var ThresholdApproachingEvent = defineEvent({
|
|
199
|
+
meta: {
|
|
200
|
+
key: "threshold.approaching",
|
|
201
|
+
version: "1.0.0",
|
|
202
|
+
description: "Usage is approaching a threshold.",
|
|
203
|
+
stability: "stable",
|
|
204
|
+
owners: ["@platform.metering"],
|
|
205
|
+
tags: ["metering", "threshold"]
|
|
206
|
+
},
|
|
207
|
+
payload: ThresholdApproachingPayload
|
|
208
|
+
});
|
|
209
|
+
var MeteringEvents = {
|
|
210
|
+
MetricDefinedEvent,
|
|
211
|
+
MetricUpdatedEvent,
|
|
212
|
+
UsageRecordedEvent,
|
|
213
|
+
UsageBatchRecordedEvent,
|
|
214
|
+
UsageAggregatedEvent,
|
|
215
|
+
ThresholdCreatedEvent,
|
|
216
|
+
ThresholdExceededEvent,
|
|
217
|
+
ThresholdApproachingEvent
|
|
218
|
+
};
|
|
219
|
+
export {
|
|
220
|
+
UsageRecordedEvent,
|
|
221
|
+
UsageBatchRecordedEvent,
|
|
222
|
+
UsageAggregatedEvent,
|
|
223
|
+
ThresholdExceededEvent,
|
|
224
|
+
ThresholdCreatedEvent,
|
|
225
|
+
ThresholdApproachingEvent,
|
|
226
|
+
MetricUpdatedEvent,
|
|
227
|
+
MetricDefinedEvent,
|
|
228
|
+
MeteringEvents
|
|
413
229
|
};
|
|
414
|
-
|
|
415
|
-
//#endregion
|
|
416
|
-
export { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent };
|
|
417
|
-
//# sourceMappingURL=events.js.map
|