@lssm/lib.metering 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406
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 +271 -1
- package/dist/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/contracts/dist/client/index.js +5 -1
- package/dist/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/contracts/dist/client/react/form-render.js +4 -1
- package/dist/contracts/dist/client/react/index.js +4 -1
- package/dist/contracts/dist/contract-registry/index.js +1 -1
- package/dist/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/contracts/dist/docs/index.js +29 -1
- package/dist/contracts/dist/docs/presentations.js +71 -1
- package/dist/contracts/dist/docs/registry.js +44 -1
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/contracts/dist/events.js +10 -1
- package/dist/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/contracts/dist/index.js +71 -1
- package/dist/contracts/dist/install.js +2 -1
- package/dist/contracts/dist/integrations/contracts.js +377 -1
- package/dist/contracts/dist/integrations/index.js +18 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/contracts/dist/jsonschema.js +1 -1
- package/dist/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/contracts/dist/knowledge/index.js +7 -1
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/contracts/dist/llm/exporters.js +19 -1
- package/dist/contracts/dist/llm/index.js +2 -1
- package/dist/contracts/dist/llm/prompts.js +1 -1
- package/dist/contracts/dist/onboarding-base.js +196 -1
- package/dist/contracts/dist/openapi.js +1 -1
- package/dist/contracts/dist/ownership.js +21 -1
- package/dist/contracts/dist/presentations.js +1 -1
- package/dist/contracts/dist/presentations.v2.js +11 -1
- package/dist/contracts/dist/prompt.js +1 -1
- package/dist/contracts/dist/promptRegistry.js +1 -1
- package/dist/contracts/dist/regenerator/index.js +1 -1
- package/dist/contracts/dist/regenerator/service.js +6 -1
- package/dist/contracts/dist/registry.js +2 -1
- package/dist/contracts/dist/resources.js +1 -1
- package/dist/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/contracts/dist/schema/dist/SchemaModel.js +34 -1
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/contracts/dist/schema/dist/index.js +6 -1
- package/dist/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/contracts/dist/server/index.js +8 -1
- package/dist/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/contracts/dist/server/rest-express.js +1 -1
- package/dist/contracts/dist/server/rest-generic.js +1 -1
- package/dist/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/contracts/dist/spec.js +34 -1
- package/dist/contracts/dist/telemetry/index.js +1 -1
- package/dist/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/contracts/dist/tests/index.js +1 -1
- package/dist/contracts/dist/tests/runner.js +2 -1
- package/dist/contracts/dist/workflow/index.js +1 -1
- package/dist/contracts/dist/workflow/runner.js +1 -1
- package/dist/contracts/index.d.ts +291 -291
- package/dist/contracts/index.js +1034 -1
- package/dist/docs/index.js +1 -1
- package/dist/docs/metering.docblock.js +22 -2
- package/dist/entities/index.js +418 -1
- package/dist/events.d.ts +136 -136
- package/dist/events.js +379 -1
- package/dist/index.js +8 -1
- package/dist/metering.feature.js +125 -1
- package/dist/schema/dist/EnumType.js +2 -1
- package/dist/schema/dist/FieldType.js +49 -1
- package/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/schema/dist/SchemaModel.js +39 -1
- package/dist/schema/dist/entity/defineEntity.js +236 -1
- package/dist/schema/dist/entity/index.js +2 -1
- package/dist/schema/dist/entity/types.js +1 -1
- package/dist/schema/dist/index.js +6 -1
- package/package.json +5 -5
package/dist/events.js
CHANGED
|
@@ -1 +1,379 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { ScalarTypeEnum } from "./schema/dist/ScalarTypeEnum.js";
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent } from "./events.js";
|
|
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 };
|
package/dist/metering.feature.js
CHANGED
|
@@ -1 +1,125 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/metering.feature.ts
|
|
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 +1,2 @@
|
|
|
1
|
-
import"zod";
|
|
1
|
+
import "zod";
|
|
2
|
+
import "graphql";
|
|
@@ -1 +1,49 @@
|
|
|
1
|
-
import"zod";
|
|
1
|
+
import "zod";
|
|
2
|
+
import { GraphQLScalarType } from "graphql";
|
|
3
|
+
|
|
4
|
+
//#region ../schema/dist/FieldType.js
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL scalar wrapper that carries zod and JSON Schema metadata.
|
|
7
|
+
*
|
|
8
|
+
* TInternal is the runtime representation; TExternal is the GraphQL output.
|
|
9
|
+
*/
|
|
10
|
+
var FieldType = class extends GraphQLScalarType {
|
|
11
|
+
zodSchema;
|
|
12
|
+
jsonSchemaDef;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.zodSchema = config.zod;
|
|
16
|
+
this.jsonSchemaDef = config.jsonSchema;
|
|
17
|
+
}
|
|
18
|
+
/** Return the attached zod schema for validation. */
|
|
19
|
+
getZod() {
|
|
20
|
+
return this.zodSchema;
|
|
21
|
+
}
|
|
22
|
+
/** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */
|
|
23
|
+
getPothos() {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
/** Return the JSON Schema (evaluates factory if provided). */
|
|
27
|
+
getJson() {
|
|
28
|
+
return typeof this.jsonSchemaDef === "function" ? this.jsonSchemaDef() : this.jsonSchemaDef;
|
|
29
|
+
}
|
|
30
|
+
getJsonSchemaDef() {
|
|
31
|
+
return this.jsonSchemaDef;
|
|
32
|
+
}
|
|
33
|
+
getJsonSchema() {
|
|
34
|
+
const deepResolve = (v) => {
|
|
35
|
+
const value = typeof v === "function" ? v() : v;
|
|
36
|
+
if (Array.isArray(value)) return value.map((item) => deepResolve(item));
|
|
37
|
+
if (value && typeof value === "object") {
|
|
38
|
+
const obj = {};
|
|
39
|
+
for (const [k, val] of Object.entries(value)) obj[k] = deepResolve(val);
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
return deepResolve(this.getJson());
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { FieldType };
|