@lssm/lib.metering 0.0.0-canary-20251206160926
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -0
- package/dist/aggregation/index.d.ts +155 -0
- package/dist/aggregation/index.js +1 -0
- package/dist/contracts/dist/capabilities/openbanking.js +1 -0
- package/dist/contracts/dist/client/index.js +1 -0
- package/dist/contracts/dist/client/react/feature-render.js +1 -0
- package/dist/contracts/dist/client/react/form-render.js +1 -0
- package/dist/contracts/dist/client/react/index.js +1 -0
- package/dist/contracts/dist/events.js +1 -0
- package/dist/contracts/dist/experiments/evaluator.js +1 -0
- package/dist/contracts/dist/graphql-federation/dist/index.js +1 -0
- package/dist/contracts/dist/index.js +1 -0
- package/dist/contracts/dist/install.js +1 -0
- package/dist/contracts/dist/integrations/contracts.js +1 -0
- package/dist/contracts/dist/integrations/index.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/models.js +1 -0
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +1 -0
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +1 -0
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +1 -0
- package/dist/contracts/dist/integrations/providers/gmail.js +1 -0
- package/dist/contracts/dist/integrations/providers/google-calendar.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/elevenlabs-voice.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/gcs-storage.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/gmail-inbound.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/gmail-outbound.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/google-calendar.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/index.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/mistral-embedding.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/mistral-llm.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/postmark-email.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/powens-client.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/powens-openbanking.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/provider-factory.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/qdrant-vector.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/stripe-payments.js +1 -0
- package/dist/contracts/dist/integrations/providers/impls/twilio-sms.js +1 -0
- package/dist/contracts/dist/integrations/providers/index.js +1 -0
- package/dist/contracts/dist/integrations/providers/mistral.js +1 -0
- package/dist/contracts/dist/integrations/providers/postmark.js +1 -0
- package/dist/contracts/dist/integrations/providers/powens.js +1 -0
- package/dist/contracts/dist/integrations/providers/qdrant.js +1 -0
- package/dist/contracts/dist/integrations/providers/stripe.js +1 -0
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +1 -0
- package/dist/contracts/dist/integrations/runtime.js +1 -0
- package/dist/contracts/dist/integrations/secrets/env-secret-provider.js +1 -0
- package/dist/contracts/dist/integrations/secrets/gcp-secret-manager.js +1 -0
- package/dist/contracts/dist/integrations/secrets/index.js +1 -0
- package/dist/contracts/dist/integrations/secrets/manager.js +1 -0
- package/dist/contracts/dist/integrations/secrets/provider.js +1 -0
- package/dist/contracts/dist/jsonschema.js +1 -0
- package/dist/contracts/dist/knowledge/contracts.js +1 -0
- package/dist/contracts/dist/knowledge/index.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/index.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +1 -0
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +1 -0
- package/dist/contracts/dist/onboarding-base.js +1 -0
- package/dist/contracts/dist/ownership.js +1 -0
- package/dist/contracts/dist/presentations.js +1 -0
- package/dist/contracts/dist/presentations.v2.js +1 -0
- package/dist/contracts/dist/prompt.js +1 -0
- package/dist/contracts/dist/promptRegistry.js +1 -0
- package/dist/contracts/dist/regenerator/index.js +1 -0
- package/dist/contracts/dist/regenerator/service.js +1 -0
- package/dist/contracts/dist/registry.js +1 -0
- package/dist/contracts/dist/resources.js +1 -0
- package/dist/contracts/dist/schema/dist/EnumType.js +1 -0
- package/dist/contracts/dist/schema/dist/FieldType.js +1 -0
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +1 -0
- package/dist/contracts/dist/schema/dist/SchemaModel.js +1 -0
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +1 -0
- package/dist/contracts/dist/schema/dist/entity/index.js +1 -0
- package/dist/contracts/dist/schema/dist/entity/types.js +1 -0
- package/dist/contracts/dist/schema/dist/index.js +1 -0
- package/dist/contracts/dist/server/graphql-pothos.js +1 -0
- package/dist/contracts/dist/server/graphql-schema-export.js +1 -0
- package/dist/contracts/dist/server/index.js +1 -0
- package/dist/contracts/dist/server/provider-mcp.js +1 -0
- package/dist/contracts/dist/server/rest-elysia.js +1 -0
- package/dist/contracts/dist/server/rest-express.js +1 -0
- package/dist/contracts/dist/server/rest-generic.js +1 -0
- package/dist/contracts/dist/server/rest-next-app.js +1 -0
- package/dist/contracts/dist/server/rest-next-pages.js +1 -0
- package/dist/contracts/dist/spec.js +1 -0
- package/dist/contracts/dist/telemetry/index.js +1 -0
- package/dist/contracts/dist/telemetry/tracker.js +1 -0
- package/dist/contracts/dist/tests/index.js +1 -0
- package/dist/contracts/dist/tests/runner.js +1 -0
- package/dist/contracts/dist/workflow/index.js +1 -0
- package/dist/contracts/dist/workflow/runner.js +1 -0
- package/dist/contracts/index.d.ts +1138 -0
- package/dist/contracts/index.js +1 -0
- package/dist/entities/index.d.ts +230 -0
- package/dist/entities/index.js +1 -0
- package/dist/events.d.ts +539 -0
- package/dist/events.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -0
- package/dist/schema/dist/EnumType.js +1 -0
- package/dist/schema/dist/FieldType.js +1 -0
- package/dist/schema/dist/ScalarTypeEnum.js +1 -0
- package/dist/schema/dist/SchemaModel.js +1 -0
- package/dist/schema/dist/entity/defineEntity.js +1 -0
- package/dist/schema/dist/entity/index.js +1 -0
- package/dist/schema/dist/entity/types.js +1 -0
- package/dist/schema/dist/index.js +1 -0
- package/package.json +45 -0
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import * as _lssm_lib_schema0 from "@lssm/lib.schema";
|
|
2
|
+
import * as _lssm_lib_contracts0 from "@lssm/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/events.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Emitted when a metric is defined.
|
|
7
|
+
*/
|
|
8
|
+
declare const MetricDefinedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
9
|
+
metricId: {
|
|
10
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
key: {
|
|
14
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
15
|
+
isOptional: false;
|
|
16
|
+
};
|
|
17
|
+
name: {
|
|
18
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
19
|
+
isOptional: false;
|
|
20
|
+
};
|
|
21
|
+
unit: {
|
|
22
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
23
|
+
isOptional: false;
|
|
24
|
+
};
|
|
25
|
+
aggregationType: {
|
|
26
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
27
|
+
isOptional: false;
|
|
28
|
+
};
|
|
29
|
+
orgId: {
|
|
30
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
31
|
+
isOptional: true;
|
|
32
|
+
};
|
|
33
|
+
createdBy: {
|
|
34
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
35
|
+
isOptional: true;
|
|
36
|
+
};
|
|
37
|
+
createdAt: {
|
|
38
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
39
|
+
isOptional: false;
|
|
40
|
+
};
|
|
41
|
+
}>>;
|
|
42
|
+
/**
|
|
43
|
+
* Emitted when a metric is updated.
|
|
44
|
+
*/
|
|
45
|
+
declare const MetricUpdatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
46
|
+
metricId: {
|
|
47
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
48
|
+
isOptional: false;
|
|
49
|
+
};
|
|
50
|
+
key: {
|
|
51
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
52
|
+
isOptional: false;
|
|
53
|
+
};
|
|
54
|
+
changes: {
|
|
55
|
+
type: _lssm_lib_schema0.FieldType<unknown, unknown>;
|
|
56
|
+
isOptional: false;
|
|
57
|
+
};
|
|
58
|
+
updatedBy: {
|
|
59
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
60
|
+
isOptional: true;
|
|
61
|
+
};
|
|
62
|
+
updatedAt: {
|
|
63
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
64
|
+
isOptional: false;
|
|
65
|
+
};
|
|
66
|
+
}>>;
|
|
67
|
+
/**
|
|
68
|
+
* Emitted when usage is recorded.
|
|
69
|
+
*/
|
|
70
|
+
declare const UsageRecordedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
71
|
+
recordId: {
|
|
72
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
73
|
+
isOptional: false;
|
|
74
|
+
};
|
|
75
|
+
metricKey: {
|
|
76
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
77
|
+
isOptional: false;
|
|
78
|
+
};
|
|
79
|
+
subjectType: {
|
|
80
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
81
|
+
isOptional: false;
|
|
82
|
+
};
|
|
83
|
+
subjectId: {
|
|
84
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
85
|
+
isOptional: false;
|
|
86
|
+
};
|
|
87
|
+
quantity: {
|
|
88
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
89
|
+
isOptional: false;
|
|
90
|
+
};
|
|
91
|
+
source: {
|
|
92
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
93
|
+
isOptional: true;
|
|
94
|
+
};
|
|
95
|
+
timestamp: {
|
|
96
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
97
|
+
isOptional: false;
|
|
98
|
+
};
|
|
99
|
+
}>>;
|
|
100
|
+
/**
|
|
101
|
+
* Emitted when a batch of usage is recorded.
|
|
102
|
+
*/
|
|
103
|
+
declare const UsageBatchRecordedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
104
|
+
recordCount: {
|
|
105
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
106
|
+
isOptional: false;
|
|
107
|
+
};
|
|
108
|
+
metricKeys: {
|
|
109
|
+
type: _lssm_lib_schema0.FieldType<unknown, unknown>;
|
|
110
|
+
isOptional: false;
|
|
111
|
+
};
|
|
112
|
+
totalQuantity: {
|
|
113
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
114
|
+
isOptional: false;
|
|
115
|
+
};
|
|
116
|
+
timestamp: {
|
|
117
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
118
|
+
isOptional: false;
|
|
119
|
+
};
|
|
120
|
+
}>>;
|
|
121
|
+
/**
|
|
122
|
+
* Emitted when usage is aggregated.
|
|
123
|
+
*/
|
|
124
|
+
declare const UsageAggregatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
125
|
+
summaryId: {
|
|
126
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
127
|
+
isOptional: false;
|
|
128
|
+
};
|
|
129
|
+
metricKey: {
|
|
130
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
131
|
+
isOptional: false;
|
|
132
|
+
};
|
|
133
|
+
subjectType: {
|
|
134
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
135
|
+
isOptional: false;
|
|
136
|
+
};
|
|
137
|
+
subjectId: {
|
|
138
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
139
|
+
isOptional: false;
|
|
140
|
+
};
|
|
141
|
+
periodType: {
|
|
142
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
143
|
+
isOptional: false;
|
|
144
|
+
};
|
|
145
|
+
periodStart: {
|
|
146
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
147
|
+
isOptional: false;
|
|
148
|
+
};
|
|
149
|
+
periodEnd: {
|
|
150
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
151
|
+
isOptional: false;
|
|
152
|
+
};
|
|
153
|
+
totalQuantity: {
|
|
154
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
155
|
+
isOptional: false;
|
|
156
|
+
};
|
|
157
|
+
recordCount: {
|
|
158
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
159
|
+
isOptional: false;
|
|
160
|
+
};
|
|
161
|
+
aggregatedAt: {
|
|
162
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
163
|
+
isOptional: false;
|
|
164
|
+
};
|
|
165
|
+
}>>;
|
|
166
|
+
/**
|
|
167
|
+
* Emitted when a threshold is created.
|
|
168
|
+
*/
|
|
169
|
+
declare const ThresholdCreatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
170
|
+
thresholdId: {
|
|
171
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
172
|
+
isOptional: false;
|
|
173
|
+
};
|
|
174
|
+
metricKey: {
|
|
175
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
176
|
+
isOptional: false;
|
|
177
|
+
};
|
|
178
|
+
subjectType: {
|
|
179
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
180
|
+
isOptional: true;
|
|
181
|
+
};
|
|
182
|
+
subjectId: {
|
|
183
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
184
|
+
isOptional: true;
|
|
185
|
+
};
|
|
186
|
+
threshold: {
|
|
187
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
188
|
+
isOptional: false;
|
|
189
|
+
};
|
|
190
|
+
action: {
|
|
191
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
192
|
+
isOptional: false;
|
|
193
|
+
};
|
|
194
|
+
createdAt: {
|
|
195
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
196
|
+
isOptional: false;
|
|
197
|
+
};
|
|
198
|
+
}>>;
|
|
199
|
+
/**
|
|
200
|
+
* Emitted when a threshold is exceeded.
|
|
201
|
+
*/
|
|
202
|
+
declare const ThresholdExceededEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
203
|
+
alertId: {
|
|
204
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
205
|
+
isOptional: false;
|
|
206
|
+
};
|
|
207
|
+
thresholdId: {
|
|
208
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
209
|
+
isOptional: false;
|
|
210
|
+
};
|
|
211
|
+
metricKey: {
|
|
212
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
213
|
+
isOptional: false;
|
|
214
|
+
};
|
|
215
|
+
subjectType: {
|
|
216
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
217
|
+
isOptional: true;
|
|
218
|
+
};
|
|
219
|
+
subjectId: {
|
|
220
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
221
|
+
isOptional: true;
|
|
222
|
+
};
|
|
223
|
+
threshold: {
|
|
224
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
225
|
+
isOptional: false;
|
|
226
|
+
};
|
|
227
|
+
actualValue: {
|
|
228
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
229
|
+
isOptional: false;
|
|
230
|
+
};
|
|
231
|
+
percentageUsed: {
|
|
232
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
233
|
+
isOptional: false;
|
|
234
|
+
};
|
|
235
|
+
action: {
|
|
236
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
237
|
+
isOptional: false;
|
|
238
|
+
};
|
|
239
|
+
triggeredAt: {
|
|
240
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
241
|
+
isOptional: false;
|
|
242
|
+
};
|
|
243
|
+
}>>;
|
|
244
|
+
/**
|
|
245
|
+
* Emitted when usage is approaching a threshold.
|
|
246
|
+
*/
|
|
247
|
+
declare const ThresholdApproachingEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
248
|
+
thresholdId: {
|
|
249
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
250
|
+
isOptional: false;
|
|
251
|
+
};
|
|
252
|
+
metricKey: {
|
|
253
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
254
|
+
isOptional: false;
|
|
255
|
+
};
|
|
256
|
+
subjectType: {
|
|
257
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
258
|
+
isOptional: true;
|
|
259
|
+
};
|
|
260
|
+
subjectId: {
|
|
261
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
262
|
+
isOptional: true;
|
|
263
|
+
};
|
|
264
|
+
threshold: {
|
|
265
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
266
|
+
isOptional: false;
|
|
267
|
+
};
|
|
268
|
+
currentValue: {
|
|
269
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
270
|
+
isOptional: false;
|
|
271
|
+
};
|
|
272
|
+
percentageUsed: {
|
|
273
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
274
|
+
isOptional: false;
|
|
275
|
+
};
|
|
276
|
+
triggeredAt: {
|
|
277
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
278
|
+
isOptional: false;
|
|
279
|
+
};
|
|
280
|
+
}>>;
|
|
281
|
+
/**
|
|
282
|
+
* All metering events.
|
|
283
|
+
*/
|
|
284
|
+
declare const MeteringEvents: {
|
|
285
|
+
MetricDefinedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
286
|
+
metricId: {
|
|
287
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
288
|
+
isOptional: false;
|
|
289
|
+
};
|
|
290
|
+
key: {
|
|
291
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
292
|
+
isOptional: false;
|
|
293
|
+
};
|
|
294
|
+
name: {
|
|
295
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
296
|
+
isOptional: false;
|
|
297
|
+
};
|
|
298
|
+
unit: {
|
|
299
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
300
|
+
isOptional: false;
|
|
301
|
+
};
|
|
302
|
+
aggregationType: {
|
|
303
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
304
|
+
isOptional: false;
|
|
305
|
+
};
|
|
306
|
+
orgId: {
|
|
307
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
308
|
+
isOptional: true;
|
|
309
|
+
};
|
|
310
|
+
createdBy: {
|
|
311
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
312
|
+
isOptional: true;
|
|
313
|
+
};
|
|
314
|
+
createdAt: {
|
|
315
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
316
|
+
isOptional: false;
|
|
317
|
+
};
|
|
318
|
+
}>>;
|
|
319
|
+
MetricUpdatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
320
|
+
metricId: {
|
|
321
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
322
|
+
isOptional: false;
|
|
323
|
+
};
|
|
324
|
+
key: {
|
|
325
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
326
|
+
isOptional: false;
|
|
327
|
+
};
|
|
328
|
+
changes: {
|
|
329
|
+
type: _lssm_lib_schema0.FieldType<unknown, unknown>;
|
|
330
|
+
isOptional: false;
|
|
331
|
+
};
|
|
332
|
+
updatedBy: {
|
|
333
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
334
|
+
isOptional: true;
|
|
335
|
+
};
|
|
336
|
+
updatedAt: {
|
|
337
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
338
|
+
isOptional: false;
|
|
339
|
+
};
|
|
340
|
+
}>>;
|
|
341
|
+
UsageRecordedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
342
|
+
recordId: {
|
|
343
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
344
|
+
isOptional: false;
|
|
345
|
+
};
|
|
346
|
+
metricKey: {
|
|
347
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
348
|
+
isOptional: false;
|
|
349
|
+
};
|
|
350
|
+
subjectType: {
|
|
351
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
352
|
+
isOptional: false;
|
|
353
|
+
};
|
|
354
|
+
subjectId: {
|
|
355
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
356
|
+
isOptional: false;
|
|
357
|
+
};
|
|
358
|
+
quantity: {
|
|
359
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
360
|
+
isOptional: false;
|
|
361
|
+
};
|
|
362
|
+
source: {
|
|
363
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
364
|
+
isOptional: true;
|
|
365
|
+
};
|
|
366
|
+
timestamp: {
|
|
367
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
368
|
+
isOptional: false;
|
|
369
|
+
};
|
|
370
|
+
}>>;
|
|
371
|
+
UsageBatchRecordedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
372
|
+
recordCount: {
|
|
373
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
374
|
+
isOptional: false;
|
|
375
|
+
};
|
|
376
|
+
metricKeys: {
|
|
377
|
+
type: _lssm_lib_schema0.FieldType<unknown, unknown>;
|
|
378
|
+
isOptional: false;
|
|
379
|
+
};
|
|
380
|
+
totalQuantity: {
|
|
381
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
382
|
+
isOptional: false;
|
|
383
|
+
};
|
|
384
|
+
timestamp: {
|
|
385
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
386
|
+
isOptional: false;
|
|
387
|
+
};
|
|
388
|
+
}>>;
|
|
389
|
+
UsageAggregatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
390
|
+
summaryId: {
|
|
391
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
392
|
+
isOptional: false;
|
|
393
|
+
};
|
|
394
|
+
metricKey: {
|
|
395
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
396
|
+
isOptional: false;
|
|
397
|
+
};
|
|
398
|
+
subjectType: {
|
|
399
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
400
|
+
isOptional: false;
|
|
401
|
+
};
|
|
402
|
+
subjectId: {
|
|
403
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
404
|
+
isOptional: false;
|
|
405
|
+
};
|
|
406
|
+
periodType: {
|
|
407
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
408
|
+
isOptional: false;
|
|
409
|
+
};
|
|
410
|
+
periodStart: {
|
|
411
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
412
|
+
isOptional: false;
|
|
413
|
+
};
|
|
414
|
+
periodEnd: {
|
|
415
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
416
|
+
isOptional: false;
|
|
417
|
+
};
|
|
418
|
+
totalQuantity: {
|
|
419
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
420
|
+
isOptional: false;
|
|
421
|
+
};
|
|
422
|
+
recordCount: {
|
|
423
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
424
|
+
isOptional: false;
|
|
425
|
+
};
|
|
426
|
+
aggregatedAt: {
|
|
427
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
428
|
+
isOptional: false;
|
|
429
|
+
};
|
|
430
|
+
}>>;
|
|
431
|
+
ThresholdCreatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
432
|
+
thresholdId: {
|
|
433
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
434
|
+
isOptional: false;
|
|
435
|
+
};
|
|
436
|
+
metricKey: {
|
|
437
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
438
|
+
isOptional: false;
|
|
439
|
+
};
|
|
440
|
+
subjectType: {
|
|
441
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
442
|
+
isOptional: true;
|
|
443
|
+
};
|
|
444
|
+
subjectId: {
|
|
445
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
446
|
+
isOptional: true;
|
|
447
|
+
};
|
|
448
|
+
threshold: {
|
|
449
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
450
|
+
isOptional: false;
|
|
451
|
+
};
|
|
452
|
+
action: {
|
|
453
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
454
|
+
isOptional: false;
|
|
455
|
+
};
|
|
456
|
+
createdAt: {
|
|
457
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
458
|
+
isOptional: false;
|
|
459
|
+
};
|
|
460
|
+
}>>;
|
|
461
|
+
ThresholdExceededEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
462
|
+
alertId: {
|
|
463
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
464
|
+
isOptional: false;
|
|
465
|
+
};
|
|
466
|
+
thresholdId: {
|
|
467
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
468
|
+
isOptional: false;
|
|
469
|
+
};
|
|
470
|
+
metricKey: {
|
|
471
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
472
|
+
isOptional: false;
|
|
473
|
+
};
|
|
474
|
+
subjectType: {
|
|
475
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
476
|
+
isOptional: true;
|
|
477
|
+
};
|
|
478
|
+
subjectId: {
|
|
479
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
480
|
+
isOptional: true;
|
|
481
|
+
};
|
|
482
|
+
threshold: {
|
|
483
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
484
|
+
isOptional: false;
|
|
485
|
+
};
|
|
486
|
+
actualValue: {
|
|
487
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
488
|
+
isOptional: false;
|
|
489
|
+
};
|
|
490
|
+
percentageUsed: {
|
|
491
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
492
|
+
isOptional: false;
|
|
493
|
+
};
|
|
494
|
+
action: {
|
|
495
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
496
|
+
isOptional: false;
|
|
497
|
+
};
|
|
498
|
+
triggeredAt: {
|
|
499
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
500
|
+
isOptional: false;
|
|
501
|
+
};
|
|
502
|
+
}>>;
|
|
503
|
+
ThresholdApproachingEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
504
|
+
thresholdId: {
|
|
505
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
506
|
+
isOptional: false;
|
|
507
|
+
};
|
|
508
|
+
metricKey: {
|
|
509
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
510
|
+
isOptional: false;
|
|
511
|
+
};
|
|
512
|
+
subjectType: {
|
|
513
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
514
|
+
isOptional: true;
|
|
515
|
+
};
|
|
516
|
+
subjectId: {
|
|
517
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
518
|
+
isOptional: true;
|
|
519
|
+
};
|
|
520
|
+
threshold: {
|
|
521
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
522
|
+
isOptional: false;
|
|
523
|
+
};
|
|
524
|
+
currentValue: {
|
|
525
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
526
|
+
isOptional: false;
|
|
527
|
+
};
|
|
528
|
+
percentageUsed: {
|
|
529
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
530
|
+
isOptional: false;
|
|
531
|
+
};
|
|
532
|
+
triggeredAt: {
|
|
533
|
+
type: _lssm_lib_schema0.FieldType<Date, string>;
|
|
534
|
+
isOptional: false;
|
|
535
|
+
};
|
|
536
|
+
}>>;
|
|
537
|
+
};
|
|
538
|
+
//#endregion
|
|
539
|
+
export { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent };
|
package/dist/events.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AggregateParams, AggregationError, AggregationOptions, AggregationResult, AggregationType, InMemoryUsageStorage, MetricDefinition, PeriodType, UsageAggregator, UsageRecord, UsageStorage, UsageSummary, formatPeriodKey, getPeriodEnd, getPeriodStart } from "./aggregation/index.js";
|
|
2
|
+
import { CreateThresholdContract, DefineMetricContract, DeleteMetricContract, DeleteThresholdContract, GetMetricContract, GetUsageContract, GetUsageSummaryContract, ListMetricsContract, ListThresholdsContract, MetricDefinitionModel, RecordBatchUsageContract, RecordUsageContract, UpdateMetricContract, UpdateThresholdContract, UsageRecordModel, UsageSummaryModel, UsageThresholdModel } from "./contracts/index.js";
|
|
3
|
+
import { AggregationTypeEnum, MetricDefinitionEntity, PeriodTypeEnum, ResetPeriodEnum, ThresholdActionEnum, UsageAlertEntity, UsageRecordEntity, UsageSummaryEntity, UsageThresholdEntity, meteringEntities, meteringSchemaContribution } from "./entities/index.js";
|
|
4
|
+
import { MeteringEvents, MetricDefinedEvent, MetricUpdatedEvent, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UsageAggregatedEvent, UsageBatchRecordedEvent, UsageRecordedEvent } from "./events.js";
|
|
5
|
+
export { AggregateParams, AggregationError, AggregationOptions, AggregationResult, AggregationType, AggregationTypeEnum, CreateThresholdContract, DefineMetricContract, DeleteMetricContract, DeleteThresholdContract, GetMetricContract, GetUsageContract, GetUsageSummaryContract, InMemoryUsageStorage, ListMetricsContract, ListThresholdsContract, MeteringEvents, MetricDefinedEvent, MetricDefinition, MetricDefinitionEntity, MetricDefinitionModel, MetricUpdatedEvent, PeriodType, PeriodTypeEnum, RecordBatchUsageContract, RecordUsageContract, ResetPeriodEnum, ThresholdActionEnum, ThresholdApproachingEvent, ThresholdCreatedEvent, ThresholdExceededEvent, UpdateMetricContract, UpdateThresholdContract, UsageAggregatedEvent, UsageAggregator, UsageAlertEntity, UsageBatchRecordedEvent, UsageRecord, UsageRecordEntity, UsageRecordModel, UsageRecordedEvent, UsageStorage, UsageSummary, UsageSummaryEntity, UsageSummaryModel, UsageThresholdEntity, UsageThresholdModel, formatPeriodKey, getPeriodEnd, getPeriodStart, meteringEntities, meteringSchemaContribution };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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";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,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import"graphql";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";import{GraphQLScalarType as t}from"graphql";var n=class extends t{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{n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./FieldType.js";import{z as t}from"zod";import{Kind as n}from"graphql";const r=/^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/,i=/^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/,a=/^[+]?\d[\d\s().-]{3,}$/,o=/^[A-Z]{3}$/,s=/^[A-Z]{2}$/,c=-180,l={String_unsecure:()=>new e({name:`String_unsecure`,description:`Unvalidated string scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),Int_unsecure:()=>new e({name:`Int_unsecure`,description:`Unvalidated integer scalar`,zod:t.number().int(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().int().parse(n)},serialize:e=>Math.trunc(typeof e==`number`?e:Number(e)),parseLiteral:e=>{if(e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`integer`}}),Float_unsecure:()=>new e({name:`Float_unsecure`,description:`Unvalidated float scalar`,zod:t.number(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().parse(n)},serialize:e=>Number(e),parseLiteral:e=>{if(e.kind!==n.FLOAT&&e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`number`}}),Boolean:()=>new e({name:`Boolean`,description:`Unvalidated boolean scalar`,zod:t.boolean(),parseValue:e=>t.coerce.boolean().parse(e),serialize:e=>!!e,parseLiteral:e=>{if(e.kind!==n.BOOLEAN)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`boolean`}}),ID:()=>new e({name:`ID`,description:`Unvalidated id scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),JSON:()=>new e({name:`JSON`,zod:t.any(),parseValue:e=>e,serialize:e=>e,jsonSchema:{}}),JSONObject:()=>new e({name:`JSONObject`,zod:t.record(t.string(),t.any()),parseValue:e=>t.record(t.string(),t.any()).parse(e),serialize:e=>e??{},jsonSchema:{type:`object`}}),Date:()=>new e({name:`Date`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString().split(`T`)[0]:String(e),jsonSchema:{type:`string`,format:`date`}}),DateTime:()=>new e({name:`DateTime`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString():String(e),jsonSchema:{type:`string`,format:`date-time`}}),Time:()=>new e({name:`Time`,zod:t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),parseValue:e=>t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:`^\\d{2}:\\d{2}(:\\d{2})?$`}}),EmailAddress:()=>new e({name:`EmailAddress`,zod:t.string().email(),parseValue:e=>t.string().email().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`email`}}),URL:()=>new e({name:`URL`,zod:t.string().url(),parseValue:e=>t.string().url().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`uri`}}),PhoneNumber:()=>new e({name:`PhoneNumber`,zod:t.string().regex(a),parseValue:e=>t.string().regex(a).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:a.source}}),NonEmptyString:()=>new e({name:`NonEmptyString`,zod:t.string().min(1),parseValue:e=>t.string().min(1).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,minLength:1}}),Locale:()=>new e({name:`Locale`,zod:t.string().regex(r),parseValue:e=>t.string().regex(r).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:r.source}}),TimeZone:()=>new e({name:`TimeZone`,zod:t.string().regex(i),parseValue:e=>t.string().regex(i).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:i.source}}),Latitude:()=>new e({name:`Latitude`,zod:t.number().min(-90).max(90),parseValue:e=>t.coerce.number().min(-90).max(90).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:-90,maximum:90}}),Longitude:()=>new e({name:`Longitude`,zod:t.number().min(c).max(180),parseValue:e=>t.coerce.number().min(c).max(180).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:c,maximum:180}}),Currency:()=>new e({name:`Currency`,zod:t.string().regex(o),parseValue:e=>t.string().regex(o).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:o.source}}),CountryCode:()=>new e({name:`CountryCode`,zod:t.string().regex(s),parseValue:e=>t.string().regex(s).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:s.source}})};export{l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./EnumType.js";import"./FieldType.js";import{z as e}from"zod";var t=class{constructor(e){this.config=e}getZod(){let t=Object.entries(this.config.fields).reduce((t,[n,r])=>{let i=r.type.getZod(),a=r.isArray?e.array(i):i;return t[n]=r.isOptional?a.optional():a,t},{});return e.object(t)}getPothosInput(){return this.config.name}};const n=e=>new t(e);export{n,t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";function t(e){return e}function n(e){return e}const r={string(e){return{kind:`scalar`,type:`String`,...e}},int(e){return{kind:`scalar`,type:`Int`,...e}},float(e){return{kind:`scalar`,type:`Float`,...e}},boolean(e){return{kind:`scalar`,type:`Boolean`,...e}},dateTime(e){return{kind:`scalar`,type:`DateTime`,...e}},json(e){return{kind:`scalar`,type:`Json`,...e}},bigInt(e){return{kind:`scalar`,type:`BigInt`,...e}},decimal(e){return{kind:`scalar`,type:`Decimal`,...e}},bytes(e){return{kind:`scalar`,type:`Bytes`,...e}},id(e){return{kind:`scalar`,type:`String`,isId:!0,default:`cuid()`,...e}},uuid(e){return{kind:`scalar`,type:`String`,isId:!0,default:`uuid()`,...e}},autoIncrement(e){return{kind:`scalar`,type:`Int`,isId:!0,default:`autoincrement()`,...e}},createdAt(e){return{kind:`scalar`,type:`DateTime`,default:`now()`,...e}},updatedAt(e){return{kind:`scalar`,type:`DateTime`,updatedAt:!0,...e}},email(t){return{kind:`scalar`,type:`String`,zod:e.email(),...t}},url(t){return{kind:`scalar`,type:`String`,zod:e.url(),...t}},enum(e,t){return{kind:`enum`,enumName:e,...t}},inlineEnum(e,t,n){return{kind:`enum`,enumName:e,values:t,...n}},hasOne(e,t){return{kind:`relation`,type:`hasOne`,target:e,...t}},hasMany(e,t){return{kind:`relation`,type:`hasMany`,target:e,...t}},belongsTo(e,t,n,r){return{kind:`relation`,type:`belongsTo`,target:e,fields:t,references:n,...r}},foreignKey(e){return{kind:`scalar`,type:`String`,...e}}},i={on(e,t){return{fields:e,...t}},unique(e,t){return{fields:e,unique:!0,...t}},compound(e,t,n){return{fields:e,sort:t,...n}}};export{i,n,r,t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,r as n,t as r}from"./defineEntity.js";import"./types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./EnumType.js";import{n as e}from"./FieldType.js";import{l as t}from"./ScalarTypeEnum.js";import{n,t as r}from"./SchemaModel.js";import{i,n as a,r as o,t as s}from"./entity/defineEntity.js";import"./entity/index.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lssm/lib.metering",
|
|
3
|
+
"version": "0.0.0-canary-20251206160926",
|
|
4
|
+
"description": "Usage metering and billing core module for ContractSpec applications",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
10
|
+
"build": "bun build:bundle && bun build:types",
|
|
11
|
+
"build:bundle": "tsdown",
|
|
12
|
+
"build:types": "tsc --noEmit",
|
|
13
|
+
"dev": "bun build:bundle --watch",
|
|
14
|
+
"clean": "rimraf dist .turbo",
|
|
15
|
+
"lint": "bun lint:fix",
|
|
16
|
+
"lint:fix": "eslint src --fix",
|
|
17
|
+
"lint:check": "eslint src"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@lssm/lib.schema": "workspace:*",
|
|
21
|
+
"@lssm/lib.contracts": "workspace:*",
|
|
22
|
+
"zod": "^4.1.13"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@lssm/tool.typescript": "workspace:*",
|
|
26
|
+
"@lssm/tool.tsdown": "workspace:*",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./dist/index.js",
|
|
31
|
+
"./aggregation": "./dist/aggregation/index.js",
|
|
32
|
+
"./contracts": "./dist/contracts/index.js",
|
|
33
|
+
"./entities": "./dist/entities/index.js",
|
|
34
|
+
"./events": "./dist/events.js",
|
|
35
|
+
"./*": "./*"
|
|
36
|
+
},
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md"
|
|
41
|
+
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
}
|
|
45
|
+
}
|