@lssm/lib.metering 0.0.0-canary-20251217080011 → 1.41.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.js +1 -271
- package/dist/contracts/index.js +1 -1034
- package/dist/docs/index.js +1 -1
- package/dist/docs/metering.docblock.js +2 -22
- package/dist/entities/index.js +1 -418
- package/dist/events.js +1 -379
- package/dist/index.js +1 -8
- package/dist/metering.feature.js +1 -125
- package/package.json +13 -14
- package/dist/aggregation/index.d.ts +0 -155
- package/dist/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/contracts/dist/client/index.js +0 -5
- package/dist/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/contracts/dist/client/react/form-render.js +0 -4
- package/dist/contracts/dist/client/react/index.js +0 -4
- package/dist/contracts/dist/contract-registry/index.js +0 -1
- package/dist/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/contracts/dist/docs/index.js +0 -29
- package/dist/contracts/dist/docs/presentations.js +0 -71
- package/dist/contracts/dist/docs/registry.js +0 -44
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/contracts/dist/events.js +0 -10
- package/dist/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/contracts/dist/index.js +0 -71
- package/dist/contracts/dist/install.js +0 -2
- package/dist/contracts/dist/integrations/contracts.js +0 -377
- package/dist/contracts/dist/integrations/index.js +0 -18
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/contracts/dist/jsonschema.js +0 -1
- package/dist/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/contracts/dist/knowledge/index.js +0 -7
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/contracts/dist/llm/exporters.js +0 -19
- package/dist/contracts/dist/llm/index.js +0 -2
- package/dist/contracts/dist/llm/prompts.js +0 -1
- package/dist/contracts/dist/onboarding-base.js +0 -196
- package/dist/contracts/dist/openapi.js +0 -1
- package/dist/contracts/dist/ownership.js +0 -21
- package/dist/contracts/dist/presentations.js +0 -1
- package/dist/contracts/dist/presentations.v2.js +0 -11
- package/dist/contracts/dist/prompt.js +0 -1
- package/dist/contracts/dist/promptRegistry.js +0 -1
- package/dist/contracts/dist/regenerator/index.js +0 -1
- package/dist/contracts/dist/regenerator/service.js +0 -6
- package/dist/contracts/dist/registry.js +0 -2
- package/dist/contracts/dist/resources.js +0 -1
- package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/contracts/dist/schema/dist/index.js +0 -6
- package/dist/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/contracts/dist/server/index.js +0 -8
- package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/contracts/dist/server/rest-express.js +0 -1
- package/dist/contracts/dist/server/rest-generic.js +0 -1
- package/dist/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/contracts/dist/spec.js +0 -34
- package/dist/contracts/dist/telemetry/index.js +0 -1
- package/dist/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/contracts/dist/tests/index.js +0 -1
- package/dist/contracts/dist/tests/runner.js +0 -2
- package/dist/contracts/dist/workflow/index.js +0 -1
- package/dist/contracts/dist/workflow/runner.js +0 -1
- package/dist/contracts/index.d.ts +0 -1138
- package/dist/docs/index.d.ts +0 -1
- package/dist/docs/metering.docblock.d.ts +0 -1
- package/dist/entities/index.d.ts +0 -230
- package/dist/events.d.ts +0 -539
- package/dist/index.d.ts +0 -6
- package/dist/metering.feature.d.ts +0 -11
- package/dist/schema/dist/EnumType.js +0 -2
- package/dist/schema/dist/FieldType.js +0 -49
- package/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/schema/dist/SchemaModel.js +0 -39
- package/dist/schema/dist/entity/defineEntity.js +0 -236
- package/dist/schema/dist/entity/index.js +0 -2
- package/dist/schema/dist/entity/types.js +0 -1
- package/dist/schema/dist/index.js +0 -6
package/dist/events.js
CHANGED
|
@@ -1,379 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { defineSchemaModel } from "./schema/dist/SchemaModel.js";
|
|
3
|
-
import "./schema/dist/index.js";
|
|
4
|
-
import { defineEvent } from "./contracts/dist/events.js";
|
|
5
|
-
import "./contracts/dist/index.js";
|
|
6
|
-
|
|
7
|
-
//#region src/events.ts
|
|
8
|
-
const MetricDefinedPayload = defineSchemaModel({
|
|
9
|
-
name: "MetricDefinedEventPayload",
|
|
10
|
-
description: "Payload when a metric is defined",
|
|
11
|
-
fields: {
|
|
12
|
-
metricId: {
|
|
13
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
-
isOptional: false
|
|
15
|
-
},
|
|
16
|
-
key: {
|
|
17
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
-
isOptional: false
|
|
19
|
-
},
|
|
20
|
-
name: {
|
|
21
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
-
isOptional: false
|
|
23
|
-
},
|
|
24
|
-
unit: {
|
|
25
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
-
isOptional: false
|
|
27
|
-
},
|
|
28
|
-
aggregationType: {
|
|
29
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
30
|
-
isOptional: false
|
|
31
|
-
},
|
|
32
|
-
orgId: {
|
|
33
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
-
isOptional: true
|
|
35
|
-
},
|
|
36
|
-
createdBy: {
|
|
37
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
-
isOptional: true
|
|
39
|
-
},
|
|
40
|
-
createdAt: {
|
|
41
|
-
type: ScalarTypeEnum.DateTime(),
|
|
42
|
-
isOptional: false
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const MetricUpdatedPayload = defineSchemaModel({
|
|
47
|
-
name: "MetricUpdatedEventPayload",
|
|
48
|
-
description: "Payload when a metric is updated",
|
|
49
|
-
fields: {
|
|
50
|
-
metricId: {
|
|
51
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
52
|
-
isOptional: false
|
|
53
|
-
},
|
|
54
|
-
key: {
|
|
55
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
56
|
-
isOptional: false
|
|
57
|
-
},
|
|
58
|
-
changes: {
|
|
59
|
-
type: ScalarTypeEnum.JSON(),
|
|
60
|
-
isOptional: false
|
|
61
|
-
},
|
|
62
|
-
updatedBy: {
|
|
63
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
64
|
-
isOptional: true
|
|
65
|
-
},
|
|
66
|
-
updatedAt: {
|
|
67
|
-
type: ScalarTypeEnum.DateTime(),
|
|
68
|
-
isOptional: false
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const UsageRecordedPayload = defineSchemaModel({
|
|
73
|
-
name: "UsageRecordedEventPayload",
|
|
74
|
-
description: "Payload when usage is recorded",
|
|
75
|
-
fields: {
|
|
76
|
-
recordId: {
|
|
77
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
78
|
-
isOptional: false
|
|
79
|
-
},
|
|
80
|
-
metricKey: {
|
|
81
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
-
isOptional: false
|
|
83
|
-
},
|
|
84
|
-
subjectType: {
|
|
85
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
-
isOptional: false
|
|
87
|
-
},
|
|
88
|
-
subjectId: {
|
|
89
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
90
|
-
isOptional: false
|
|
91
|
-
},
|
|
92
|
-
quantity: {
|
|
93
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
94
|
-
isOptional: false
|
|
95
|
-
},
|
|
96
|
-
source: {
|
|
97
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
-
isOptional: true
|
|
99
|
-
},
|
|
100
|
-
timestamp: {
|
|
101
|
-
type: ScalarTypeEnum.DateTime(),
|
|
102
|
-
isOptional: false
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const UsageBatchRecordedPayload = defineSchemaModel({
|
|
107
|
-
name: "UsageBatchRecordedEventPayload",
|
|
108
|
-
description: "Payload when a batch of usage is recorded",
|
|
109
|
-
fields: {
|
|
110
|
-
recordCount: {
|
|
111
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
112
|
-
isOptional: false
|
|
113
|
-
},
|
|
114
|
-
metricKeys: {
|
|
115
|
-
type: ScalarTypeEnum.JSON(),
|
|
116
|
-
isOptional: false
|
|
117
|
-
},
|
|
118
|
-
totalQuantity: {
|
|
119
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
120
|
-
isOptional: false
|
|
121
|
-
},
|
|
122
|
-
timestamp: {
|
|
123
|
-
type: ScalarTypeEnum.DateTime(),
|
|
124
|
-
isOptional: false
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const UsageAggregatedPayload = defineSchemaModel({
|
|
129
|
-
name: "UsageAggregatedEventPayload",
|
|
130
|
-
description: "Payload when usage is aggregated",
|
|
131
|
-
fields: {
|
|
132
|
-
summaryId: {
|
|
133
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
134
|
-
isOptional: false
|
|
135
|
-
},
|
|
136
|
-
metricKey: {
|
|
137
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
138
|
-
isOptional: false
|
|
139
|
-
},
|
|
140
|
-
subjectType: {
|
|
141
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
142
|
-
isOptional: false
|
|
143
|
-
},
|
|
144
|
-
subjectId: {
|
|
145
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
146
|
-
isOptional: false
|
|
147
|
-
},
|
|
148
|
-
periodType: {
|
|
149
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
150
|
-
isOptional: false
|
|
151
|
-
},
|
|
152
|
-
periodStart: {
|
|
153
|
-
type: ScalarTypeEnum.DateTime(),
|
|
154
|
-
isOptional: false
|
|
155
|
-
},
|
|
156
|
-
periodEnd: {
|
|
157
|
-
type: ScalarTypeEnum.DateTime(),
|
|
158
|
-
isOptional: false
|
|
159
|
-
},
|
|
160
|
-
totalQuantity: {
|
|
161
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
162
|
-
isOptional: false
|
|
163
|
-
},
|
|
164
|
-
recordCount: {
|
|
165
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
166
|
-
isOptional: false
|
|
167
|
-
},
|
|
168
|
-
aggregatedAt: {
|
|
169
|
-
type: ScalarTypeEnum.DateTime(),
|
|
170
|
-
isOptional: false
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const ThresholdCreatedPayload = defineSchemaModel({
|
|
175
|
-
name: "ThresholdCreatedEventPayload",
|
|
176
|
-
description: "Payload when a threshold is created",
|
|
177
|
-
fields: {
|
|
178
|
-
thresholdId: {
|
|
179
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
180
|
-
isOptional: false
|
|
181
|
-
},
|
|
182
|
-
metricKey: {
|
|
183
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
184
|
-
isOptional: false
|
|
185
|
-
},
|
|
186
|
-
subjectType: {
|
|
187
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
188
|
-
isOptional: true
|
|
189
|
-
},
|
|
190
|
-
subjectId: {
|
|
191
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
192
|
-
isOptional: true
|
|
193
|
-
},
|
|
194
|
-
threshold: {
|
|
195
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
196
|
-
isOptional: false
|
|
197
|
-
},
|
|
198
|
-
action: {
|
|
199
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
200
|
-
isOptional: false
|
|
201
|
-
},
|
|
202
|
-
createdAt: {
|
|
203
|
-
type: ScalarTypeEnum.DateTime(),
|
|
204
|
-
isOptional: false
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
const ThresholdExceededPayload = defineSchemaModel({
|
|
209
|
-
name: "ThresholdExceededEventPayload",
|
|
210
|
-
description: "Payload when a threshold is exceeded",
|
|
211
|
-
fields: {
|
|
212
|
-
alertId: {
|
|
213
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
214
|
-
isOptional: false
|
|
215
|
-
},
|
|
216
|
-
thresholdId: {
|
|
217
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
218
|
-
isOptional: false
|
|
219
|
-
},
|
|
220
|
-
metricKey: {
|
|
221
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
222
|
-
isOptional: false
|
|
223
|
-
},
|
|
224
|
-
subjectType: {
|
|
225
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
226
|
-
isOptional: true
|
|
227
|
-
},
|
|
228
|
-
subjectId: {
|
|
229
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
230
|
-
isOptional: true
|
|
231
|
-
},
|
|
232
|
-
threshold: {
|
|
233
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
234
|
-
isOptional: false
|
|
235
|
-
},
|
|
236
|
-
actualValue: {
|
|
237
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
238
|
-
isOptional: false
|
|
239
|
-
},
|
|
240
|
-
percentageUsed: {
|
|
241
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
242
|
-
isOptional: false
|
|
243
|
-
},
|
|
244
|
-
action: {
|
|
245
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
246
|
-
isOptional: false
|
|
247
|
-
},
|
|
248
|
-
triggeredAt: {
|
|
249
|
-
type: ScalarTypeEnum.DateTime(),
|
|
250
|
-
isOptional: false
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
const ThresholdApproachingPayload = defineSchemaModel({
|
|
255
|
-
name: "ThresholdApproachingEventPayload",
|
|
256
|
-
description: "Payload when usage is approaching a threshold",
|
|
257
|
-
fields: {
|
|
258
|
-
thresholdId: {
|
|
259
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
260
|
-
isOptional: false
|
|
261
|
-
},
|
|
262
|
-
metricKey: {
|
|
263
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
264
|
-
isOptional: false
|
|
265
|
-
},
|
|
266
|
-
subjectType: {
|
|
267
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
268
|
-
isOptional: true
|
|
269
|
-
},
|
|
270
|
-
subjectId: {
|
|
271
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
272
|
-
isOptional: true
|
|
273
|
-
},
|
|
274
|
-
threshold: {
|
|
275
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
276
|
-
isOptional: false
|
|
277
|
-
},
|
|
278
|
-
currentValue: {
|
|
279
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
280
|
-
isOptional: false
|
|
281
|
-
},
|
|
282
|
-
percentageUsed: {
|
|
283
|
-
type: ScalarTypeEnum.Float_unsecure(),
|
|
284
|
-
isOptional: false
|
|
285
|
-
},
|
|
286
|
-
triggeredAt: {
|
|
287
|
-
type: ScalarTypeEnum.DateTime(),
|
|
288
|
-
isOptional: false
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
/**
|
|
293
|
-
* Emitted when a metric is defined.
|
|
294
|
-
*/
|
|
295
|
-
const MetricDefinedEvent = defineEvent({
|
|
296
|
-
name: "metric.defined",
|
|
297
|
-
version: 1,
|
|
298
|
-
description: "A metric has been defined.",
|
|
299
|
-
payload: MetricDefinedPayload
|
|
300
|
-
});
|
|
301
|
-
/**
|
|
302
|
-
* Emitted when a metric is updated.
|
|
303
|
-
*/
|
|
304
|
-
const MetricUpdatedEvent = defineEvent({
|
|
305
|
-
name: "metric.updated",
|
|
306
|
-
version: 1,
|
|
307
|
-
description: "A metric has been updated.",
|
|
308
|
-
payload: MetricUpdatedPayload
|
|
309
|
-
});
|
|
310
|
-
/**
|
|
311
|
-
* Emitted when usage is recorded.
|
|
312
|
-
*/
|
|
313
|
-
const UsageRecordedEvent = defineEvent({
|
|
314
|
-
name: "usage.recorded",
|
|
315
|
-
version: 1,
|
|
316
|
-
description: "Usage has been recorded.",
|
|
317
|
-
payload: UsageRecordedPayload
|
|
318
|
-
});
|
|
319
|
-
/**
|
|
320
|
-
* Emitted when a batch of usage is recorded.
|
|
321
|
-
*/
|
|
322
|
-
const UsageBatchRecordedEvent = defineEvent({
|
|
323
|
-
name: "usage.batch_recorded",
|
|
324
|
-
version: 1,
|
|
325
|
-
description: "A batch of usage has been recorded.",
|
|
326
|
-
payload: UsageBatchRecordedPayload
|
|
327
|
-
});
|
|
328
|
-
/**
|
|
329
|
-
* Emitted when usage is aggregated.
|
|
330
|
-
*/
|
|
331
|
-
const UsageAggregatedEvent = defineEvent({
|
|
332
|
-
name: "usage.aggregated",
|
|
333
|
-
version: 1,
|
|
334
|
-
description: "Usage has been aggregated into a summary.",
|
|
335
|
-
payload: UsageAggregatedPayload
|
|
336
|
-
});
|
|
337
|
-
/**
|
|
338
|
-
* Emitted when a threshold is created.
|
|
339
|
-
*/
|
|
340
|
-
const ThresholdCreatedEvent = defineEvent({
|
|
341
|
-
name: "threshold.created",
|
|
342
|
-
version: 1,
|
|
343
|
-
description: "A usage threshold has been created.",
|
|
344
|
-
payload: ThresholdCreatedPayload
|
|
345
|
-
});
|
|
346
|
-
/**
|
|
347
|
-
* Emitted when a threshold is exceeded.
|
|
348
|
-
*/
|
|
349
|
-
const ThresholdExceededEvent = defineEvent({
|
|
350
|
-
name: "threshold.exceeded",
|
|
351
|
-
version: 1,
|
|
352
|
-
description: "Usage has exceeded a threshold.",
|
|
353
|
-
payload: ThresholdExceededPayload
|
|
354
|
-
});
|
|
355
|
-
/**
|
|
356
|
-
* Emitted when usage is approaching a threshold.
|
|
357
|
-
*/
|
|
358
|
-
const ThresholdApproachingEvent = defineEvent({
|
|
359
|
-
name: "threshold.approaching",
|
|
360
|
-
version: 1,
|
|
361
|
-
description: "Usage is approaching a threshold.",
|
|
362
|
-
payload: ThresholdApproachingPayload
|
|
363
|
-
});
|
|
364
|
-
/**
|
|
365
|
-
* All metering events.
|
|
366
|
-
*/
|
|
367
|
-
const MeteringEvents = {
|
|
368
|
-
MetricDefinedEvent,
|
|
369
|
-
MetricUpdatedEvent,
|
|
370
|
-
UsageRecordedEvent,
|
|
371
|
-
UsageBatchRecordedEvent,
|
|
372
|
-
UsageAggregatedEvent,
|
|
373
|
-
ThresholdCreatedEvent,
|
|
374
|
-
ThresholdExceededEvent,
|
|
375
|
-
ThresholdApproachingEvent
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
//#endregion
|
|
379
|
-
export { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent };
|
|
1
|
+
import{ScalarTypeEnum as e,defineSchemaModel as t}from"@lssm/lib.schema";import{defineEvent as n}from"@lssm/lib.contracts";const r=t({name:`MetricDefinedEventPayload`,description:`Payload when a metric is defined`,fields:{metricId:{type:e.String_unsecure(),isOptional:!1},key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},unit:{type:e.String_unsecure(),isOptional:!1},aggregationType:{type:e.String_unsecure(),isOptional:!1},orgId:{type:e.String_unsecure(),isOptional:!0},createdBy:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),i=t({name:`MetricUpdatedEventPayload`,description:`Payload when a metric is updated`,fields:{metricId:{type:e.String_unsecure(),isOptional:!1},key:{type:e.String_unsecure(),isOptional:!1},changes:{type:e.JSON(),isOptional:!1},updatedBy:{type:e.String_unsecure(),isOptional:!0},updatedAt:{type:e.DateTime(),isOptional:!1}}}),a=t({name:`UsageRecordedEventPayload`,description:`Payload when usage is recorded`,fields:{recordId:{type:e.String_unsecure(),isOptional:!1},metricKey:{type:e.String_unsecure(),isOptional:!1},subjectType:{type:e.String_unsecure(),isOptional:!1},subjectId:{type:e.String_unsecure(),isOptional:!1},quantity:{type:e.Float_unsecure(),isOptional:!1},source:{type:e.String_unsecure(),isOptional:!0},timestamp:{type:e.DateTime(),isOptional:!1}}}),o=t({name:`UsageBatchRecordedEventPayload`,description:`Payload when a batch of usage is recorded`,fields:{recordCount:{type:e.Int_unsecure(),isOptional:!1},metricKeys:{type:e.JSON(),isOptional:!1},totalQuantity:{type:e.Float_unsecure(),isOptional:!1},timestamp:{type:e.DateTime(),isOptional:!1}}}),s=t({name:`UsageAggregatedEventPayload`,description:`Payload when usage is aggregated`,fields:{summaryId:{type:e.String_unsecure(),isOptional:!1},metricKey:{type:e.String_unsecure(),isOptional:!1},subjectType:{type:e.String_unsecure(),isOptional:!1},subjectId:{type:e.String_unsecure(),isOptional:!1},periodType:{type:e.String_unsecure(),isOptional:!1},periodStart:{type:e.DateTime(),isOptional:!1},periodEnd:{type:e.DateTime(),isOptional:!1},totalQuantity:{type:e.Float_unsecure(),isOptional:!1},recordCount:{type:e.Int_unsecure(),isOptional:!1},aggregatedAt:{type:e.DateTime(),isOptional:!1}}}),c=t({name:`ThresholdCreatedEventPayload`,description:`Payload when a threshold is created`,fields:{thresholdId:{type:e.String_unsecure(),isOptional:!1},metricKey:{type:e.String_unsecure(),isOptional:!1},subjectType:{type:e.String_unsecure(),isOptional:!0},subjectId:{type:e.String_unsecure(),isOptional:!0},threshold:{type:e.Float_unsecure(),isOptional:!1},action:{type:e.String_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),l=t({name:`ThresholdExceededEventPayload`,description:`Payload when a threshold is exceeded`,fields:{alertId:{type:e.String_unsecure(),isOptional:!1},thresholdId:{type:e.String_unsecure(),isOptional:!1},metricKey:{type:e.String_unsecure(),isOptional:!1},subjectType:{type:e.String_unsecure(),isOptional:!0},subjectId:{type:e.String_unsecure(),isOptional:!0},threshold:{type:e.Float_unsecure(),isOptional:!1},actualValue:{type:e.Float_unsecure(),isOptional:!1},percentageUsed:{type:e.Float_unsecure(),isOptional:!1},action:{type:e.String_unsecure(),isOptional:!1},triggeredAt:{type:e.DateTime(),isOptional:!1}}}),u=t({name:`ThresholdApproachingEventPayload`,description:`Payload when usage is approaching a threshold`,fields:{thresholdId:{type:e.String_unsecure(),isOptional:!1},metricKey:{type:e.String_unsecure(),isOptional:!1},subjectType:{type:e.String_unsecure(),isOptional:!0},subjectId:{type:e.String_unsecure(),isOptional:!0},threshold:{type:e.Float_unsecure(),isOptional:!1},currentValue:{type:e.Float_unsecure(),isOptional:!1},percentageUsed:{type:e.Float_unsecure(),isOptional:!1},triggeredAt:{type:e.DateTime(),isOptional:!1}}}),d=n({name:`metric.defined`,version:1,description:`A metric has been defined.`,payload:r}),f=n({name:`metric.updated`,version:1,description:`A metric has been updated.`,payload:i}),p=n({name:`usage.recorded`,version:1,description:`Usage has been recorded.`,payload:a}),m=n({name:`usage.batch_recorded`,version:1,description:`A batch of usage has been recorded.`,payload:o}),h=n({name:`usage.aggregated`,version:1,description:`Usage has been aggregated into a summary.`,payload:s}),g=n({name:`threshold.created`,version:1,description:`A usage threshold has been created.`,payload:c}),_=n({name:`threshold.exceeded`,version:1,description:`Usage has exceeded a threshold.`,payload:l}),v=n({name:`threshold.approaching`,version:1,description:`Usage is approaching a threshold.`,payload:u}),y={MetricDefinedEvent:d,MetricUpdatedEvent:f,UsageRecordedEvent:p,UsageBatchRecordedEvent:m,UsageAggregatedEvent:h,ThresholdCreatedEvent:g,ThresholdExceededEvent:_,ThresholdApproachingEvent:v};export{y as MeteringEvents,d as MetricDefinedEvent,f as MetricUpdatedEvent,v as ThresholdApproachingEvent,g as ThresholdCreatedEvent,_ as ThresholdExceededEvent,h as UsageAggregatedEvent,m as UsageBatchRecordedEvent,p as UsageRecordedEvent};
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent
|
|
2
|
-
import { AggregationTypeEnum, MetricDefinitionEntity, PeriodTypeEnum, ResetPeriodEnum, ThresholdActionEnum, UsageAlertEntity, UsageRecordEntity, UsageSummaryEntity, UsageThresholdEntity, meteringEntities, meteringSchemaContribution } from "./entities/index.js";
|
|
3
|
-
import { CreateThresholdContract, DefineMetricContract, DeleteMetricContract, DeleteThresholdContract, GetMetricContract, GetUsageContract, GetUsageSummaryContract, ListMetricsContract, ListThresholdsContract, MetricDefinitionModel, RecordBatchUsageContract, RecordUsageContract, UpdateMetricContract, UpdateThresholdContract, UsageRecordModel, UsageSummaryModel, UsageThresholdModel } from "./contracts/index.js";
|
|
4
|
-
import { InMemoryUsageStorage, UsageAggregator, formatPeriodKey, getPeriodEnd, getPeriodStart } from "./aggregation/index.js";
|
|
5
|
-
import { MeteringFeature } from "./metering.feature.js";
|
|
6
|
-
import "./docs/index.js";
|
|
7
|
-
|
|
8
|
-
export { AggregationTypeEnum, CreateThresholdContract, DefineMetricContract, DeleteMetricContract, DeleteThresholdContract, GetMetricContract, GetUsageContract, GetUsageSummaryContract, InMemoryUsageStorage, ListMetricsContract, ListThresholdsContract, MeteringEvents, MeteringFeature, MetricDefinedEvent, MetricDefinitionEntity, MetricDefinitionModel, MetricUpdatedEvent, PeriodTypeEnum, RecordBatchUsageContract, RecordUsageContract, ResetPeriodEnum, ThresholdActionEnum, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UpdateMetricContract, UpdateThresholdContract, UsageAggregatedEvent, UsageAggregator, UsageAlertEntity, UsageBatchRecordedEvent, UsageRecordEntity, UsageRecordModel, UsageRecordedEvent, UsageSummaryEntity, UsageSummaryModel, UsageThresholdEntity, UsageThresholdModel, formatPeriodKey, getPeriodEnd, getPeriodStart, meteringEntities, meteringSchemaContribution };
|
|
1
|
+
import{MeteringEvents as e,MetricDefinedEvent as t,MetricUpdatedEvent as n,ThresholdApproachingEvent as r,ThresholdCreatedEvent as i,ThresholdExceededEvent as a,UsageAggregatedEvent as o,UsageBatchRecordedEvent as s,UsageRecordedEvent as c}from"./events.js";import{AggregationTypeEnum as l,MetricDefinitionEntity as u,PeriodTypeEnum as d,ResetPeriodEnum as f,ThresholdActionEnum as p,UsageAlertEntity as m,UsageRecordEntity as h,UsageSummaryEntity as g,UsageThresholdEntity as _,meteringEntities as v,meteringSchemaContribution as y}from"./entities/index.js";import{CreateThresholdContract as b,DefineMetricContract as x,DeleteMetricContract as S,DeleteThresholdContract as C,GetMetricContract as w,GetUsageContract as T,GetUsageSummaryContract as E,ListMetricsContract as D,ListThresholdsContract as O,MetricDefinitionModel as k,RecordBatchUsageContract as A,RecordUsageContract as j,UpdateMetricContract as M,UpdateThresholdContract as N,UsageRecordModel as P,UsageSummaryModel as F,UsageThresholdModel as I}from"./contracts/index.js";import{InMemoryUsageStorage as L,UsageAggregator as R,formatPeriodKey as z,getPeriodEnd as B,getPeriodStart as V}from"./aggregation/index.js";import{MeteringFeature as H}from"./metering.feature.js";import"./docs/index.js";export{l as AggregationTypeEnum,b as CreateThresholdContract,x as DefineMetricContract,S as DeleteMetricContract,C as DeleteThresholdContract,w as GetMetricContract,T as GetUsageContract,E as GetUsageSummaryContract,L as InMemoryUsageStorage,D as ListMetricsContract,O as ListThresholdsContract,e as MeteringEvents,H as MeteringFeature,t as MetricDefinedEvent,u as MetricDefinitionEntity,k as MetricDefinitionModel,n as MetricUpdatedEvent,d as PeriodTypeEnum,A as RecordBatchUsageContract,j as RecordUsageContract,f as ResetPeriodEnum,p as ThresholdActionEnum,r as ThresholdApproachingEvent,i as ThresholdCreatedEvent,a as ThresholdExceededEvent,M as UpdateMetricContract,N as UpdateThresholdContract,o as UsageAggregatedEvent,R as UsageAggregator,m as UsageAlertEntity,s as UsageBatchRecordedEvent,h as UsageRecordEntity,P as UsageRecordModel,c as UsageRecordedEvent,g as UsageSummaryEntity,F as UsageSummaryModel,_ as UsageThresholdEntity,I as UsageThresholdModel,z as formatPeriodKey,B as getPeriodEnd,V as getPeriodStart,v as meteringEntities,y as meteringSchemaContribution};
|
package/dist/metering.feature.js
CHANGED
|
@@ -1,125 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Metering feature module that bundles metric definitions,
|
|
4
|
-
* usage tracking, and threshold alerting capabilities.
|
|
5
|
-
*/
|
|
6
|
-
const MeteringFeature = {
|
|
7
|
-
meta: {
|
|
8
|
-
key: "metering",
|
|
9
|
-
title: "Usage Metering",
|
|
10
|
-
description: "Usage metering, metric definitions, and threshold alerting",
|
|
11
|
-
domain: "platform",
|
|
12
|
-
owners: ["@platform.metering"],
|
|
13
|
-
tags: [
|
|
14
|
-
"metering",
|
|
15
|
-
"usage",
|
|
16
|
-
"billing",
|
|
17
|
-
"thresholds"
|
|
18
|
-
],
|
|
19
|
-
stability: "stable"
|
|
20
|
-
},
|
|
21
|
-
operations: [
|
|
22
|
-
{
|
|
23
|
-
name: "metric.define",
|
|
24
|
-
version: 1
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "metric.update",
|
|
28
|
-
version: 1
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "metric.delete",
|
|
32
|
-
version: 1
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: "metric.get",
|
|
36
|
-
version: 1
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: "metric.list",
|
|
40
|
-
version: 1
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "usage.record",
|
|
44
|
-
version: 1
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "usage.recordBatch",
|
|
48
|
-
version: 1
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "usage.get",
|
|
52
|
-
version: 1
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "usage.getSummary",
|
|
56
|
-
version: 1
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: "threshold.create",
|
|
60
|
-
version: 1
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "threshold.update",
|
|
64
|
-
version: 1
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: "threshold.delete",
|
|
68
|
-
version: 1
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "threshold.list",
|
|
72
|
-
version: 1
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
events: [
|
|
76
|
-
{
|
|
77
|
-
name: "metric.defined",
|
|
78
|
-
version: 1
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: "metric.updated",
|
|
82
|
-
version: 1
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "usage.recorded",
|
|
86
|
-
version: 1
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "usage.batch_recorded",
|
|
90
|
-
version: 1
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "usage.aggregated",
|
|
94
|
-
version: 1
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "threshold.created",
|
|
98
|
-
version: 1
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "threshold.exceeded",
|
|
102
|
-
version: 1
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "threshold.approaching",
|
|
106
|
-
version: 1
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
presentations: [],
|
|
110
|
-
opToPresentation: [],
|
|
111
|
-
presentationsTargets: [],
|
|
112
|
-
capabilities: {
|
|
113
|
-
provides: [{
|
|
114
|
-
key: "metering",
|
|
115
|
-
version: 1
|
|
116
|
-
}, {
|
|
117
|
-
key: "thresholds",
|
|
118
|
-
version: 1
|
|
119
|
-
}],
|
|
120
|
-
requires: []
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
//#endregion
|
|
125
|
-
export { MeteringFeature };
|
|
1
|
+
const e={meta:{key:`metering`,title:`Usage Metering`,description:`Usage metering, metric definitions, and threshold alerting`,domain:`platform`,owners:[`@platform.metering`],tags:[`metering`,`usage`,`billing`,`thresholds`],stability:`stable`},operations:[{name:`metric.define`,version:1},{name:`metric.update`,version:1},{name:`metric.delete`,version:1},{name:`metric.get`,version:1},{name:`metric.list`,version:1},{name:`usage.record`,version:1},{name:`usage.recordBatch`,version:1},{name:`usage.get`,version:1},{name:`usage.getSummary`,version:1},{name:`threshold.create`,version:1},{name:`threshold.update`,version:1},{name:`threshold.delete`,version:1},{name:`threshold.list`,version:1}],events:[{name:`metric.defined`,version:1},{name:`metric.updated`,version:1},{name:`usage.recorded`,version:1},{name:`usage.batch_recorded`,version:1},{name:`usage.aggregated`,version:1},{name:`threshold.created`,version:1},{name:`threshold.exceeded`,version:1},{name:`threshold.approaching`,version:1}],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:`metering`,version:1},{key:`thresholds`,version:1}],requires:[]}};export{e as MeteringFeature};
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.metering",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "Usage metering and billing core module for ContractSpec applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
10
|
-
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
11
10
|
"build": "bun build:bundle && bun build:types",
|
|
12
11
|
"build:bundle": "tsdown",
|
|
13
12
|
"build:types": "tsc --noEmit",
|
|
@@ -18,24 +17,24 @@
|
|
|
18
17
|
"lint:check": "eslint src"
|
|
19
18
|
},
|
|
20
19
|
"dependencies": {
|
|
21
|
-
"@lssm/lib.schema": "
|
|
22
|
-
"@lssm/lib.contracts": "
|
|
20
|
+
"@lssm/lib.schema": "workspace:*",
|
|
21
|
+
"@lssm/lib.contracts": "workspace:*",
|
|
23
22
|
"zod": "^4.1.13"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@lssm/tool.typescript": "
|
|
27
|
-
"@lssm/tool.tsdown": "
|
|
25
|
+
"@lssm/tool.typescript": "workspace:*",
|
|
26
|
+
"@lssm/tool.tsdown": "workspace:*",
|
|
28
27
|
"typescript": "^5.9.3"
|
|
29
28
|
},
|
|
30
29
|
"exports": {
|
|
31
|
-
".": "./
|
|
32
|
-
"./aggregation": "./
|
|
33
|
-
"./contracts": "./
|
|
34
|
-
"./docs": "./
|
|
35
|
-
"./docs/metering.docblock": "./
|
|
36
|
-
"./entities": "./
|
|
37
|
-
"./events": "./
|
|
38
|
-
"./metering.feature": "./
|
|
30
|
+
".": "./src/index.ts",
|
|
31
|
+
"./aggregation": "./src/aggregation/index.ts",
|
|
32
|
+
"./contracts": "./src/contracts/index.ts",
|
|
33
|
+
"./docs": "./src/docs/index.ts",
|
|
34
|
+
"./docs/metering.docblock": "./src/docs/metering.docblock.ts",
|
|
35
|
+
"./entities": "./src/entities/index.ts",
|
|
36
|
+
"./events": "./src/events.ts",
|
|
37
|
+
"./metering.feature": "./src/metering.feature.ts",
|
|
39
38
|
"./*": "./*"
|
|
40
39
|
},
|
|
41
40
|
"module": "./dist/index.js",
|