@contractspec/lib.metering 1.44.1 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":";;;;;;;cAsIa,oBAAkB,4BAAA,CAAA,oCAAA;EAAlB,QAAA,EAAA;IAUX,IAAA,EAAA,yBAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;;;;;;EAV6B,CAAA;EAAA,IAAA,EAAA;IAelB,IAAA,qCAUX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;IAV6B,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EAelB,CAAA;EAUX,SAAA,EAAA;;;;;;;;;;;AAKF;AAUE,cAxCW,kBAwCX,EAxC6B,4BAAA,CAAA,SAwC7B,2BAxC6B,WAwC7B,CAAA;;UA9BA,yBAAA,CAAA;;;;IAoBkC,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAevB,CAAA;EAUX,OAAA,EAAA;;;;;;;;;;;;;;;;AAKW,cA7CA,kBAuDX,EAvD6B,4BAAA,CAAA,SAuD7B,2BAvD6B,WAuD7B,CAAA;EAAA,QAAA,EAAA;UA7CA,yBAAA,CAAA;;;;;;;;IAmCgC,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAerB,CAAA;EAUX,SAAA,EAAA;;;;;;;;;;;;EAViC,SAAA,EAAA;IAAA,IAAA,qCAAA,KAAA,EAAA,MAAA,CAAA;IAetB,UAAA,EAAA,KAAA;EAUX,CAAA;;;;;cAtEW,yBAAuB,4BAAA,CAAA,oCAAA;;UAUlC,yBAAA,CAAA;;;EAkDoC,UAAA,EAAA;IAAA,IAAA,q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AuD7B,6BAvD6B,WAuD7B,CAAA;EAAA,QAAA,EAAA;UA7CA,2BAAA,CAAA;;;;;;;;IAmCgC,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAerB,CAAA;EAUX,SAAA,EAAA;;;;;;;;;;;;EAViC,SAAA,EAAA;IAAA,IAAA,uCAAA,KAAA,EAAA,MAAA,CAAA;IAetB,UAAA,EAAA,KAAA;EAUX,CAAA;;;;;cAtEW,yBAAuB,4BAAA,CAAA,sCAAA;;UAUlC,2BAAA,CAAA;;;EAkDoC,UAAA,EAAA;IAAA,IAAA,uCAAA,CAAA,OAAA,EAAA,OAAA,CAAA;IAezB,UAAA,EAAA,KASZ;EAAA,CAAA;;;;;;;;;;;;;cArEY,sBAAoB,4BAAA,CAAA,sCAAA;;UAU/B,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,uBAAqB,4BAAA,CAAA,sCAAA;;UAUhC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,wBAAsB,4BAAA,CAAA,sCAAA;;UAUjC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW,2BAAyB,4BAAA,CAAA,sCAAA;;UAUpC,2BAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAKW;;;YASZ,2BAAA,CAAA"}
package/dist/events.js CHANGED
@@ -292,7 +292,7 @@ const ThresholdApproachingPayload = defineSchemaModel({
292
292
  const MetricDefinedEvent = defineEvent({
293
293
  meta: {
294
294
  key: "metric.defined",
295
- version: 1,
295
+ version: "1.0.0",
296
296
  description: "A metric has been defined.",
297
297
  stability: "stable",
298
298
  owners: ["@platform.metering"],
@@ -306,7 +306,7 @@ const MetricDefinedEvent = defineEvent({
306
306
  const MetricUpdatedEvent = defineEvent({
307
307
  meta: {
308
308
  key: "metric.updated",
309
- version: 1,
309
+ version: "1.0.0",
310
310
  description: "A metric has been updated.",
311
311
  stability: "stable",
312
312
  owners: ["@platform.metering"],
@@ -320,7 +320,7 @@ const MetricUpdatedEvent = defineEvent({
320
320
  const UsageRecordedEvent = defineEvent({
321
321
  meta: {
322
322
  key: "usage.recorded",
323
- version: 1,
323
+ version: "1.0.0",
324
324
  description: "Usage has been recorded.",
325
325
  stability: "stable",
326
326
  owners: ["@platform.metering"],
@@ -334,7 +334,7 @@ const UsageRecordedEvent = defineEvent({
334
334
  const UsageBatchRecordedEvent = defineEvent({
335
335
  meta: {
336
336
  key: "usage.batch_recorded",
337
- version: 1,
337
+ version: "1.0.0",
338
338
  description: "A batch of usage has been recorded.",
339
339
  stability: "stable",
340
340
  owners: ["@platform.metering"],
@@ -348,7 +348,7 @@ const UsageBatchRecordedEvent = defineEvent({
348
348
  const UsageAggregatedEvent = defineEvent({
349
349
  meta: {
350
350
  key: "usage.aggregated",
351
- version: 1,
351
+ version: "1.0.0",
352
352
  description: "Usage has been aggregated into a summary.",
353
353
  stability: "stable",
354
354
  owners: ["@platform.metering"],
@@ -362,7 +362,7 @@ const UsageAggregatedEvent = defineEvent({
362
362
  const ThresholdCreatedEvent = defineEvent({
363
363
  meta: {
364
364
  key: "threshold.created",
365
- version: 1,
365
+ version: "1.0.0",
366
366
  description: "A usage threshold has been created.",
367
367
  stability: "stable",
368
368
  owners: ["@platform.metering"],
@@ -376,7 +376,7 @@ const ThresholdCreatedEvent = defineEvent({
376
376
  const ThresholdExceededEvent = defineEvent({
377
377
  meta: {
378
378
  key: "threshold.exceeded",
379
- version: 1,
379
+ version: "1.0.0",
380
380
  description: "Usage has exceeded a threshold.",
381
381
  stability: "stable",
382
382
  owners: ["@platform.metering"],
@@ -390,7 +390,7 @@ const ThresholdExceededEvent = defineEvent({
390
390
  const ThresholdApproachingEvent = defineEvent({
391
391
  meta: {
392
392
  key: "threshold.approaching",
393
- version: 1,
393
+ version: "1.0.0",
394
394
  description: "Usage is approaching a threshold.",
395
395
  stability: "stable",
396
396
  owners: ["@platform.metering"],
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst MetricDefinedPayload = defineSchemaModel({\n name: 'MetricDefinedEventPayload',\n description: 'Payload when a metric is defined',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst MetricUpdatedPayload = defineSchemaModel({\n name: 'MetricUpdatedEventPayload',\n description: 'Payload when a metric is updated',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changes: { type: ScalarTypeEnum.JSON(), isOptional: false },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageRecordedPayload = defineSchemaModel({\n name: 'UsageRecordedEventPayload',\n description: 'Payload when usage is recorded',\n fields: {\n recordId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageBatchRecordedPayload = defineSchemaModel({\n name: 'UsageBatchRecordedEventPayload',\n description: 'Payload when a batch of usage is recorded',\n fields: {\n recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n metricKeys: { type: ScalarTypeEnum.JSON(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageAggregatedPayload = defineSchemaModel({\n name: 'UsageAggregatedEventPayload',\n description: 'Payload when usage is aggregated',\n fields: {\n summaryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n aggregatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdCreatedPayload = defineSchemaModel({\n name: 'ThresholdCreatedEventPayload',\n description: 'Payload when a threshold is created',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdExceededPayload = defineSchemaModel({\n name: 'ThresholdExceededEventPayload',\n description: 'Payload when a threshold is exceeded',\n fields: {\n alertId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n actualValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n percentageUsed: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdApproachingPayload = defineSchemaModel({\n name: 'ThresholdApproachingEventPayload',\n description: 'Payload when usage is approaching a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currentValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n percentageUsed: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a metric is defined.\n */\nexport const MetricDefinedEvent = defineEvent({\n meta: {\n key: 'metric.defined',\n version: 1,\n description: 'A metric has been defined.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'metric'],\n },\n payload: MetricDefinedPayload,\n});\n\n/**\n * Emitted when a metric is updated.\n */\nexport const MetricUpdatedEvent = defineEvent({\n meta: {\n key: 'metric.updated',\n version: 1,\n description: 'A metric has been updated.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'metric'],\n },\n payload: MetricUpdatedPayload,\n});\n\n/**\n * Emitted when usage is recorded.\n */\nexport const UsageRecordedEvent = defineEvent({\n meta: {\n key: 'usage.recorded',\n version: 1,\n description: 'Usage has been recorded.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageRecordedPayload,\n});\n\n/**\n * Emitted when a batch of usage is recorded.\n */\nexport const UsageBatchRecordedEvent = defineEvent({\n meta: {\n key: 'usage.batch_recorded',\n version: 1,\n description: 'A batch of usage has been recorded.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageBatchRecordedPayload,\n});\n\n/**\n * Emitted when usage is aggregated.\n */\nexport const UsageAggregatedEvent = defineEvent({\n meta: {\n key: 'usage.aggregated',\n version: 1,\n description: 'Usage has been aggregated into a summary.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageAggregatedPayload,\n});\n\n/**\n * Emitted when a threshold is created.\n */\nexport const ThresholdCreatedEvent = defineEvent({\n meta: {\n key: 'threshold.created',\n version: 1,\n description: 'A usage threshold has been created.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdCreatedPayload,\n});\n\n/**\n * Emitted when a threshold is exceeded.\n */\nexport const ThresholdExceededEvent = defineEvent({\n meta: {\n key: 'threshold.exceeded',\n version: 1,\n description: 'Usage has exceeded a threshold.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdExceededPayload,\n});\n\n/**\n * Emitted when usage is approaching a threshold.\n */\nexport const ThresholdApproachingEvent = defineEvent({\n meta: {\n key: 'threshold.approaching',\n version: 1,\n description: 'Usage is approaching a threshold.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdApproachingPayload,\n});\n\n/**\n * All metering events.\n */\nexport const MeteringEvents = {\n MetricDefinedEvent,\n MetricUpdatedEvent,\n UsageRecordedEvent,\n UsageBatchRecordedEvent,\n UsageAggregatedEvent,\n ThresholdCreatedEvent,\n ThresholdExceededEvent,\n ThresholdApproachingEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,iBAAiB;GACf,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,SAAS;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAO;EAC3D,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,uBAAuB,kBAAkB;CAC7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AAQ;EAC5B;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,QAAQ;EAC5B;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,YAAY;EAChC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,YAAY;EAChC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,4BAA4B,YAAY;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,YAAY;EAChC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ Event Payloads ============\n\nconst MetricDefinedPayload = defineSchemaModel({\n name: 'MetricDefinedEventPayload',\n description: 'Payload when a metric is defined',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst MetricUpdatedPayload = defineSchemaModel({\n name: 'MetricUpdatedEventPayload',\n description: 'Payload when a metric is updated',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changes: { type: ScalarTypeEnum.JSON(), isOptional: false },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageRecordedPayload = defineSchemaModel({\n name: 'UsageRecordedEventPayload',\n description: 'Payload when usage is recorded',\n fields: {\n recordId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageBatchRecordedPayload = defineSchemaModel({\n name: 'UsageBatchRecordedEventPayload',\n description: 'Payload when a batch of usage is recorded',\n fields: {\n recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n metricKeys: { type: ScalarTypeEnum.JSON(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UsageAggregatedPayload = defineSchemaModel({\n name: 'UsageAggregatedEventPayload',\n description: 'Payload when usage is aggregated',\n fields: {\n summaryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n recordCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n aggregatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdCreatedPayload = defineSchemaModel({\n name: 'ThresholdCreatedEventPayload',\n description: 'Payload when a threshold is created',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdExceededPayload = defineSchemaModel({\n name: 'ThresholdExceededEventPayload',\n description: 'Payload when a threshold is exceeded',\n fields: {\n alertId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n actualValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n percentageUsed: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ThresholdApproachingPayload = defineSchemaModel({\n name: 'ThresholdApproachingEventPayload',\n description: 'Payload when usage is approaching a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currentValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n percentageUsed: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n triggeredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Events ============\n\n/**\n * Emitted when a metric is defined.\n */\nexport const MetricDefinedEvent = defineEvent({\n meta: {\n key: 'metric.defined',\n version: '1.0.0',\n description: 'A metric has been defined.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'metric'],\n },\n payload: MetricDefinedPayload,\n});\n\n/**\n * Emitted when a metric is updated.\n */\nexport const MetricUpdatedEvent = defineEvent({\n meta: {\n key: 'metric.updated',\n version: '1.0.0',\n description: 'A metric has been updated.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'metric'],\n },\n payload: MetricUpdatedPayload,\n});\n\n/**\n * Emitted when usage is recorded.\n */\nexport const UsageRecordedEvent = defineEvent({\n meta: {\n key: 'usage.recorded',\n version: '1.0.0',\n description: 'Usage has been recorded.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageRecordedPayload,\n});\n\n/**\n * Emitted when a batch of usage is recorded.\n */\nexport const UsageBatchRecordedEvent = defineEvent({\n meta: {\n key: 'usage.batch_recorded',\n version: '1.0.0',\n description: 'A batch of usage has been recorded.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageBatchRecordedPayload,\n});\n\n/**\n * Emitted when usage is aggregated.\n */\nexport const UsageAggregatedEvent = defineEvent({\n meta: {\n key: 'usage.aggregated',\n version: '1.0.0',\n description: 'Usage has been aggregated into a summary.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage'],\n },\n payload: UsageAggregatedPayload,\n});\n\n/**\n * Emitted when a threshold is created.\n */\nexport const ThresholdCreatedEvent = defineEvent({\n meta: {\n key: 'threshold.created',\n version: '1.0.0',\n description: 'A usage threshold has been created.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdCreatedPayload,\n});\n\n/**\n * Emitted when a threshold is exceeded.\n */\nexport const ThresholdExceededEvent = defineEvent({\n meta: {\n key: 'threshold.exceeded',\n version: '1.0.0',\n description: 'Usage has exceeded a threshold.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdExceededPayload,\n});\n\n/**\n * Emitted when usage is approaching a threshold.\n */\nexport const ThresholdApproachingEvent = defineEvent({\n meta: {\n key: 'threshold.approaching',\n version: '1.0.0',\n description: 'Usage is approaching a threshold.',\n stability: 'stable',\n owners: ['@platform.metering'],\n tags: ['metering', 'threshold'],\n },\n payload: ThresholdApproachingPayload,\n});\n\n/**\n * All metering events.\n */\nexport const MeteringEvents = {\n MetricDefinedEvent,\n MetricUpdatedEvent,\n UsageRecordedEvent,\n UsageBatchRecordedEvent,\n UsageAggregatedEvent,\n ThresholdCreatedEvent,\n ThresholdExceededEvent,\n ThresholdApproachingEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,KAAK;GAAE,MAAM,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aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,YAAY;EAChC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,4BAA4B,YAAY;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,YAAY,YAAY;EAChC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -6,7 +6,7 @@
6
6
  const MeteringFeature = {
7
7
  meta: {
8
8
  key: "metering",
9
- version: 1,
9
+ version: "1.0.0",
10
10
  title: "Usage Metering",
11
11
  description: "Usage metering, metric definitions, and threshold alerting",
12
12
  domain: "platform",
@@ -22,89 +22,89 @@ const MeteringFeature = {
22
22
  operations: [
23
23
  {
24
24
  key: "metric.define",
25
- version: 1
25
+ version: "1.0.0"
26
26
  },
27
27
  {
28
28
  key: "metric.update",
29
- version: 1
29
+ version: "1.0.0"
30
30
  },
31
31
  {
32
32
  key: "metric.delete",
33
- version: 1
33
+ version: "1.0.0"
34
34
  },
35
35
  {
36
36
  key: "metric.get",
37
- version: 1
37
+ version: "1.0.0"
38
38
  },
39
39
  {
40
40
  key: "metric.list",
41
- version: 1
41
+ version: "1.0.0"
42
42
  },
43
43
  {
44
44
  key: "usage.record",
45
- version: 1
45
+ version: "1.0.0"
46
46
  },
47
47
  {
48
48
  key: "usage.recordBatch",
49
- version: 1
49
+ version: "1.0.0"
50
50
  },
51
51
  {
52
52
  key: "usage.get",
53
- version: 1
53
+ version: "1.0.0"
54
54
  },
55
55
  {
56
56
  key: "usage.getSummary",
57
- version: 1
57
+ version: "1.0.0"
58
58
  },
59
59
  {
60
60
  key: "threshold.create",
61
- version: 1
61
+ version: "1.0.0"
62
62
  },
63
63
  {
64
64
  key: "threshold.update",
65
- version: 1
65
+ version: "1.0.0"
66
66
  },
67
67
  {
68
68
  key: "threshold.delete",
69
- version: 1
69
+ version: "1.0.0"
70
70
  },
71
71
  {
72
72
  key: "threshold.list",
73
- version: 1
73
+ version: "1.0.0"
74
74
  }
75
75
  ],
76
76
  events: [
77
77
  {
78
78
  key: "metric.defined",
79
- version: 1
79
+ version: "1.0.0"
80
80
  },
81
81
  {
82
82
  key: "metric.updated",
83
- version: 1
83
+ version: "1.0.0"
84
84
  },
85
85
  {
86
86
  key: "usage.recorded",
87
- version: 1
87
+ version: "1.0.0"
88
88
  },
89
89
  {
90
90
  key: "usage.batch_recorded",
91
- version: 1
91
+ version: "1.0.0"
92
92
  },
93
93
  {
94
94
  key: "usage.aggregated",
95
- version: 1
95
+ version: "1.0.0"
96
96
  },
97
97
  {
98
98
  key: "threshold.created",
99
- version: 1
99
+ version: "1.0.0"
100
100
  },
101
101
  {
102
102
  key: "threshold.exceeded",
103
- version: 1
103
+ version: "1.0.0"
104
104
  },
105
105
  {
106
106
  key: "threshold.approaching",
107
- version: 1
107
+ version: "1.0.0"
108
108
  }
109
109
  ],
110
110
  presentations: [],
@@ -113,10 +113,10 @@ const MeteringFeature = {
113
113
  capabilities: {
114
114
  provides: [{
115
115
  key: "metering",
116
- version: 1
116
+ version: "1.0.0"
117
117
  }, {
118
118
  key: "thresholds",
119
- version: 1
119
+ version: "1.0.0"
120
120
  }],
121
121
  requires: []
122
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"metering.feature.js","names":["MeteringFeature: FeatureModuleSpec"],"sources":["../src/metering.feature.ts"],"sourcesContent":["/**\n * Metering Feature Module Specification\n *\n * Defines the feature module for usage metering and threshold management.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Metering feature module that bundles metric definitions,\n * usage tracking, and threshold alerting capabilities.\n */\nexport const MeteringFeature: FeatureModuleSpec = {\n meta: {\n key: 'metering',\n version: 1,\n title: 'Usage Metering',\n description: 'Usage metering, metric definitions, and threshold alerting',\n domain: 'platform',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage', 'billing', 'thresholds'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Metric operations\n { key: 'metric.define', version: 1 },\n { key: 'metric.update', version: 1 },\n { key: 'metric.delete', version: 1 },\n { key: 'metric.get', version: 1 },\n { key: 'metric.list', version: 1 },\n\n // Usage operations\n { key: 'usage.record', version: 1 },\n { key: 'usage.recordBatch', version: 1 },\n { key: 'usage.get', version: 1 },\n { key: 'usage.getSummary', version: 1 },\n\n // Threshold operations\n { key: 'threshold.create', version: 1 },\n { key: 'threshold.update', version: 1 },\n { key: 'threshold.delete', version: 1 },\n { key: 'threshold.list', version: 1 },\n ],\n\n // Events emitted by this feature\n events: [\n // Metric events\n { key: 'metric.defined', version: 1 },\n { key: 'metric.updated', version: 1 },\n\n // Usage events\n { key: 'usage.recorded', version: 1 },\n { key: 'usage.batch_recorded', version: 1 },\n { key: 'usage.aggregated', version: 1 },\n\n // Threshold events\n { key: 'threshold.created', version: 1 },\n { key: 'threshold.exceeded', version: 1 },\n { key: 'threshold.approaching', version: 1 },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'metering', version: 1 },\n { key: 'thresholds', version: 1 },\n ],\n requires: [],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,kBAAqC;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,qBAAqB;EAC9B,MAAM;GAAC;GAAY;GAAS;GAAW;GAAa;EACpD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,KAAK;GAAiB,SAAS;GAAG;EACpC;GAAE,KAAK;GAAiB,SAAS;GAAG;EACpC;GAAE,KAAK;GAAiB,SAAS;GAAG;EACpC;GAAE,KAAK;GAAc,SAAS;GAAG;EACjC;GAAE,KAAK;GAAe,SAAS;GAAG;EAGlC;GAAE,KAAK;GAAgB,SAAS;GAAG;EACnC;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAa,SAAS;GAAG;EAChC;GAAE,KAAK;GAAoB,SAAS;GAAG;EAGvC;GAAE,KAAK;GAAoB,SAAS;GAAG;EACvC;GAAE,KAAK;GAAoB,SAAS;GAAG;EACvC;GAAE,KAAK;GAAoB,SAAS;GAAG;EACvC;GAAE,KAAK;GAAkB,SAAS;GAAG;EACtC;CAGD,QAAQ;EAEN;GAAE,KAAK;GAAkB,SAAS;GAAG;EACrC;GAAE,KAAK;GAAkB,SAAS;GAAG;EAGrC;GAAE,KAAK;GAAkB,SAAS;GAAG;EACrC;GAAE,KAAK;GAAwB,SAAS;GAAG;EAC3C;GAAE,KAAK;GAAoB,SAAS;GAAG;EAGvC;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAsB,SAAS;GAAG;EACzC;GAAE,KAAK;GAAyB,SAAS;GAAG;EAC7C;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAY,SAAS;GAAG,EAC/B;GAAE,KAAK;GAAc,SAAS;GAAG,CAClC;EACD,UAAU,EAAE;EACb;CACF"}
1
+ {"version":3,"file":"metering.feature.js","names":["MeteringFeature: FeatureModuleSpec"],"sources":["../src/metering.feature.ts"],"sourcesContent":["/**\n * Metering Feature Module Specification\n *\n * Defines the feature module for usage metering and threshold management.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Metering feature module that bundles metric definitions,\n * usage tracking, and threshold alerting capabilities.\n */\nexport const MeteringFeature: FeatureModuleSpec = {\n meta: {\n key: 'metering',\n version: '1.0.0',\n title: 'Usage Metering',\n description: 'Usage metering, metric definitions, and threshold alerting',\n domain: 'platform',\n owners: ['@platform.metering'],\n tags: ['metering', 'usage', 'billing', 'thresholds'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Metric operations\n { key: 'metric.define', version: '1.0.0' },\n { key: 'metric.update', version: '1.0.0' },\n { key: 'metric.delete', version: '1.0.0' },\n { key: 'metric.get', version: '1.0.0' },\n { key: 'metric.list', version: '1.0.0' },\n\n // Usage operations\n { key: 'usage.record', version: '1.0.0' },\n { key: 'usage.recordBatch', version: '1.0.0' },\n { key: 'usage.get', version: '1.0.0' },\n { key: 'usage.getSummary', version: '1.0.0' },\n\n // Threshold operations\n { key: 'threshold.create', version: '1.0.0' },\n { key: 'threshold.update', version: '1.0.0' },\n { key: 'threshold.delete', version: '1.0.0' },\n { key: 'threshold.list', version: '1.0.0' },\n ],\n\n // Events emitted by this feature\n events: [\n // Metric events\n { key: 'metric.defined', version: '1.0.0' },\n { key: 'metric.updated', version: '1.0.0' },\n\n // Usage events\n { key: 'usage.recorded', version: '1.0.0' },\n { key: 'usage.batch_recorded', version: '1.0.0' },\n { key: 'usage.aggregated', version: '1.0.0' },\n\n // Threshold events\n { key: 'threshold.created', version: '1.0.0' },\n { key: 'threshold.exceeded', version: '1.0.0' },\n { key: 'threshold.approaching', version: '1.0.0' },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'metering', version: '1.0.0' },\n { key: 'thresholds', version: '1.0.0' },\n ],\n requires: [],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,kBAAqC;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,qBAAqB;EAC9B,MAAM;GAAC;GAAY;GAAS;GAAW;GAAa;EACpD,WAAW;EACZ;CAGD,YAAY;EAEV;GAAE,KAAK;GAAiB,SAAS;GAAS;EAC1C;GAAE,KAAK;GAAiB,SAAS;GAAS;EAC1C;GAAE,KAAK;GAAiB,SAAS;GAAS;EAC1C;GAAE,KAAK;GAAc,SAAS;GAAS;EACvC;GAAE,KAAK;GAAe,SAAS;GAAS;EAGxC;GAAE,KAAK;GAAgB,SAAS;GAAS;EACzC;GAAE,KAAK;GAAqB,SAAS;GAAS;EAC9C;GAAE,KAAK;GAAa,SAAS;GAAS;EACtC;GAAE,KAAK;GAAoB,SAAS;GAAS;EAG7C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAkB,SAAS;GAAS;EAC5C;CAGD,QAAQ;EAEN;GAAE,KAAK;GAAkB,SAAS;GAAS;EAC3C;GAAE,KAAK;GAAkB,SAAS;GAAS;EAG3C;GAAE,KAAK;GAAkB,SAAS;GAAS;EAC3C;GAAE,KAAK;GAAwB,SAAS;GAAS;EACjD;GAAE,KAAK;GAAoB,SAAS;GAAS;EAG7C;GAAE,KAAK;GAAqB,SAAS;GAAS;EAC9C;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAAyB,SAAS;GAAS;EACnD;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAY,SAAS;GAAS,EACrC;GAAE,KAAK;GAAc,SAAS;GAAS,CACxC;EACD,UAAU,EAAE;EACb;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/lib.metering",
3
- "version": "1.44.1",
3
+ "version": "1.45.0",
4
4
  "description": "Usage metering and billing core module for ContractSpec applications",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -26,13 +26,13 @@
26
26
  "lint:check": "eslint src"
27
27
  },
28
28
  "dependencies": {
29
- "@contractspec/lib.schema": "1.44.1",
30
- "@contractspec/lib.contracts": "1.44.1",
29
+ "@contractspec/lib.schema": "1.45.0",
30
+ "@contractspec/lib.contracts": "1.45.0",
31
31
  "zod": "^4.1.13"
32
32
  },
33
33
  "devDependencies": {
34
- "@contractspec/tool.typescript": "1.44.1",
35
- "@contractspec/tool.tsdown": "1.44.1",
34
+ "@contractspec/tool.typescript": "1.45.0",
35
+ "@contractspec/tool.tsdown": "1.45.0",
36
36
  "typescript": "^5.9.3"
37
37
  },
38
38
  "exports": {