@lssm/lib.metering 0.0.0-canary-20251217062943 → 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.
Files changed (133) hide show
  1. package/dist/aggregation/index.js +271 -1
  2. package/dist/contracts/dist/capabilities/openbanking.js +88 -1
  3. package/dist/contracts/dist/client/index.js +5 -1
  4. package/dist/contracts/dist/client/react/feature-render.js +2 -1
  5. package/dist/contracts/dist/client/react/form-render.js +4 -1
  6. package/dist/contracts/dist/client/react/index.js +4 -1
  7. package/dist/contracts/dist/contract-registry/index.js +1 -1
  8. package/dist/contracts/dist/contract-registry/schemas.js +60 -1
  9. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  10. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  11. package/dist/contracts/dist/docs/index.js +29 -1
  12. package/dist/contracts/dist/docs/presentations.js +71 -1
  13. package/dist/contracts/dist/docs/registry.js +44 -1
  14. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  15. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  16. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  17. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  18. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  19. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  20. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  21. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  22. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  23. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  24. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  25. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  26. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  27. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  28. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  29. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  30. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  31. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  32. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  33. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  34. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  35. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  36. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  37. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  38. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  39. package/dist/contracts/dist/events.js +10 -1
  40. package/dist/contracts/dist/experiments/evaluator.js +1 -1
  41. package/dist/contracts/dist/index.js +71 -1
  42. package/dist/contracts/dist/install.js +2 -1
  43. package/dist/contracts/dist/integrations/contracts.js +377 -1
  44. package/dist/contracts/dist/integrations/index.js +18 -1
  45. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
  46. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
  47. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
  48. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
  49. package/dist/contracts/dist/integrations/openbanking/models.js +242 -1
  50. package/dist/contracts/dist/integrations/openbanking/telemetry.js +13 -1
  51. package/dist/contracts/dist/integrations/providers/elevenlabs.js +52 -1
  52. package/dist/contracts/dist/integrations/providers/gcs-storage.js +75 -1
  53. package/dist/contracts/dist/integrations/providers/gmail.js +87 -1
  54. package/dist/contracts/dist/integrations/providers/google-calendar.js +66 -1
  55. package/dist/contracts/dist/integrations/providers/index.js +11 -1
  56. package/dist/contracts/dist/integrations/providers/mistral.js +68 -1
  57. package/dist/contracts/dist/integrations/providers/postmark.js +68 -1
  58. package/dist/contracts/dist/integrations/providers/powens.js +116 -1
  59. package/dist/contracts/dist/integrations/providers/qdrant.js +73 -1
  60. package/dist/contracts/dist/integrations/providers/registry.js +10 -1
  61. package/dist/contracts/dist/integrations/providers/stripe.js +83 -1
  62. package/dist/contracts/dist/integrations/providers/twilio-sms.js +61 -1
  63. package/dist/contracts/dist/jsonschema.js +1 -1
  64. package/dist/contracts/dist/knowledge/contracts.js +306 -1
  65. package/dist/contracts/dist/knowledge/index.js +7 -1
  66. package/dist/contracts/dist/knowledge/spaces/email-threads.js +34 -1
  67. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
  68. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
  69. package/dist/contracts/dist/knowledge/spaces/index.js +6 -1
  70. package/dist/contracts/dist/knowledge/spaces/product-canon.js +34 -1
  71. package/dist/contracts/dist/knowledge/spaces/support-faq.js +37 -1
  72. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
  73. package/dist/contracts/dist/llm/exporters.js +19 -1
  74. package/dist/contracts/dist/llm/index.js +2 -1
  75. package/dist/contracts/dist/llm/prompts.js +1 -1
  76. package/dist/contracts/dist/onboarding-base.js +196 -1
  77. package/dist/contracts/dist/openapi.js +1 -1
  78. package/dist/contracts/dist/ownership.js +21 -1
  79. package/dist/contracts/dist/presentations.js +1 -1
  80. package/dist/contracts/dist/presentations.v2.js +11 -1
  81. package/dist/contracts/dist/prompt.js +1 -1
  82. package/dist/contracts/dist/promptRegistry.js +1 -1
  83. package/dist/contracts/dist/regenerator/index.js +1 -1
  84. package/dist/contracts/dist/regenerator/service.js +6 -1
  85. package/dist/contracts/dist/registry.js +2 -1
  86. package/dist/contracts/dist/resources.js +1 -1
  87. package/dist/contracts/dist/schema/dist/EnumType.js +2 -1
  88. package/dist/contracts/dist/schema/dist/FieldType.js +49 -1
  89. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
  90. package/dist/contracts/dist/schema/dist/SchemaModel.js +34 -1
  91. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
  92. package/dist/contracts/dist/schema/dist/entity/index.js +2 -1
  93. package/dist/contracts/dist/schema/dist/entity/types.js +1 -1
  94. package/dist/contracts/dist/schema/dist/index.js +6 -1
  95. package/dist/contracts/dist/server/graphql-pothos.js +6 -1
  96. package/dist/contracts/dist/server/index.js +8 -1
  97. package/dist/contracts/dist/server/mcp/createMcpServer.js +4 -1
  98. package/dist/contracts/dist/server/mcp/registerPresentations.js +2 -1
  99. package/dist/contracts/dist/server/mcp/registerPrompts.js +1 -1
  100. package/dist/contracts/dist/server/mcp/registerResources.js +2 -1
  101. package/dist/contracts/dist/server/mcp/registerTools.js +1 -1
  102. package/dist/contracts/dist/server/provider-mcp.js +1 -1
  103. package/dist/contracts/dist/server/rest-elysia.js +1 -1
  104. package/dist/contracts/dist/server/rest-express.js +1 -1
  105. package/dist/contracts/dist/server/rest-generic.js +1 -1
  106. package/dist/contracts/dist/server/rest-next-app.js +1 -1
  107. package/dist/contracts/dist/server/rest-next-pages.js +1 -1
  108. package/dist/contracts/dist/spec.js +34 -1
  109. package/dist/contracts/dist/telemetry/index.js +1 -1
  110. package/dist/contracts/dist/telemetry/tracker.js +1 -1
  111. package/dist/contracts/dist/tests/index.js +1 -1
  112. package/dist/contracts/dist/tests/runner.js +2 -1
  113. package/dist/contracts/dist/workflow/index.js +1 -1
  114. package/dist/contracts/dist/workflow/runner.js +1 -1
  115. package/dist/contracts/index.d.ts +290 -290
  116. package/dist/contracts/index.js +1034 -1
  117. package/dist/docs/index.js +1 -1
  118. package/dist/docs/metering.docblock.js +22 -2
  119. package/dist/entities/index.d.ts +185 -185
  120. package/dist/entities/index.js +418 -1
  121. package/dist/events.d.ts +135 -135
  122. package/dist/events.js +379 -1
  123. package/dist/index.js +8 -1
  124. package/dist/metering.feature.js +125 -1
  125. package/dist/schema/dist/EnumType.js +2 -1
  126. package/dist/schema/dist/FieldType.js +49 -1
  127. package/dist/schema/dist/ScalarTypeEnum.js +236 -1
  128. package/dist/schema/dist/SchemaModel.js +39 -1
  129. package/dist/schema/dist/entity/defineEntity.js +236 -1
  130. package/dist/schema/dist/entity/index.js +2 -1
  131. package/dist/schema/dist/entity/types.js +1 -1
  132. package/dist/schema/dist/index.js +6 -1
  133. package/package.json +5 -5
package/dist/events.js CHANGED
@@ -1 +1,379 @@
1
- import{l as e}from"./schema/dist/ScalarTypeEnum.js";import{n as t}from"./schema/dist/SchemaModel.js";import"./schema/dist/index.js";import{e as n}from"./contracts/dist/events.js";import"./contracts/dist/index.js";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};
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{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};
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 };
@@ -1 +1,125 @@
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};
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";import"graphql";
1
+ import "zod";
2
+ import "graphql";
@@ -1 +1,49 @@
1
- import"zod";import{GraphQLScalarType as e}from"graphql";var t=class extends e{zodSchema;jsonSchemaDef;constructor(e){super(e),this.zodSchema=e.zod,this.jsonSchemaDef=e.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==`function`?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let e=t=>{let n=typeof t==`function`?t():t;if(Array.isArray(n))return n.map(t=>e(t));if(n&&typeof n==`object`){let t={};for(let[r,i]of Object.entries(n))t[r]=e(i);return t}return n};return e(this.getJson())}};export{t};
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 };