@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.
@@ -664,7 +664,7 @@ const SuccessOutput = defineSchemaModel({
664
664
  const DefineMetricContract = defineCommand({
665
665
  meta: {
666
666
  key: "metric.define",
667
- version: 1,
667
+ version: "1.0.0",
668
668
  stability: "stable",
669
669
  owners: [...OWNERS],
670
670
  tags: [
@@ -694,7 +694,7 @@ const DefineMetricContract = defineCommand({
694
694
  const UpdateMetricContract = defineCommand({
695
695
  meta: {
696
696
  key: "metric.update",
697
- version: 1,
697
+ version: "1.0.0",
698
698
  stability: "stable",
699
699
  owners: [...OWNERS],
700
700
  tags: [
@@ -724,7 +724,7 @@ const UpdateMetricContract = defineCommand({
724
724
  const DeleteMetricContract = defineCommand({
725
725
  meta: {
726
726
  key: "metric.delete",
727
- version: 1,
727
+ version: "1.0.0",
728
728
  stability: "stable",
729
729
  owners: [...OWNERS],
730
730
  tags: [
@@ -754,7 +754,7 @@ const DeleteMetricContract = defineCommand({
754
754
  const GetMetricContract = defineQuery({
755
755
  meta: {
756
756
  key: "metric.get",
757
- version: 1,
757
+ version: "1.0.0",
758
758
  stability: "stable",
759
759
  owners: [...OWNERS],
760
760
  tags: [
@@ -784,7 +784,7 @@ const GetMetricContract = defineQuery({
784
784
  const ListMetricsContract = defineQuery({
785
785
  meta: {
786
786
  key: "metric.list",
787
- version: 1,
787
+ version: "1.0.0",
788
788
  stability: "stable",
789
789
  owners: [...OWNERS],
790
790
  tags: [
@@ -808,7 +808,7 @@ const ListMetricsContract = defineQuery({
808
808
  const RecordUsageContract = defineCommand({
809
809
  meta: {
810
810
  key: "usage.record",
811
- version: 1,
811
+ version: "1.0.0",
812
812
  stability: "stable",
813
813
  owners: [...OWNERS],
814
814
  tags: [
@@ -846,7 +846,7 @@ const RecordUsageContract = defineCommand({
846
846
  const RecordBatchUsageContract = defineCommand({
847
847
  meta: {
848
848
  key: "usage.recordBatch",
849
- version: 1,
849
+ version: "1.0.0",
850
850
  stability: "stable",
851
851
  owners: [...OWNERS],
852
852
  tags: [
@@ -870,7 +870,7 @@ const RecordBatchUsageContract = defineCommand({
870
870
  const GetUsageContract = defineQuery({
871
871
  meta: {
872
872
  key: "usage.get",
873
- version: 1,
873
+ version: "1.0.0",
874
874
  stability: "stable",
875
875
  owners: [...OWNERS],
876
876
  tags: [
@@ -894,7 +894,7 @@ const GetUsageContract = defineQuery({
894
894
  const GetUsageSummaryContract = defineQuery({
895
895
  meta: {
896
896
  key: "usage.getSummary",
897
- version: 1,
897
+ version: "1.0.0",
898
898
  stability: "stable",
899
899
  owners: [...OWNERS],
900
900
  tags: [
@@ -918,7 +918,7 @@ const GetUsageSummaryContract = defineQuery({
918
918
  const CreateThresholdContract = defineCommand({
919
919
  meta: {
920
920
  key: "threshold.create",
921
- version: 1,
921
+ version: "1.0.0",
922
922
  stability: "stable",
923
923
  owners: [...OWNERS],
924
924
  tags: [
@@ -948,7 +948,7 @@ const CreateThresholdContract = defineCommand({
948
948
  const UpdateThresholdContract = defineCommand({
949
949
  meta: {
950
950
  key: "threshold.update",
951
- version: 1,
951
+ version: "1.0.0",
952
952
  stability: "stable",
953
953
  owners: [...OWNERS],
954
954
  tags: [
@@ -978,7 +978,7 @@ const UpdateThresholdContract = defineCommand({
978
978
  const DeleteThresholdContract = defineCommand({
979
979
  meta: {
980
980
  key: "threshold.delete",
981
- version: 1,
981
+ version: "1.0.0",
982
982
  stability: "stable",
983
983
  owners: [...OWNERS],
984
984
  tags: [
@@ -1008,7 +1008,7 @@ const DeleteThresholdContract = defineCommand({
1008
1008
  const ListThresholdsContract = defineQuery({
1009
1009
  meta: {
1010
1010
  key: "threshold.list",
1011
- version: 1,
1011
+ version: "1.0.0",
1012
1012
  stability: "stable",
1013
1013
  owners: [...OWNERS],
1014
1014
  tags: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.metering'] as const;\n\n// ============ Schema Models ============\n\nexport const MetricDefinitionModel = defineSchemaModel({\n name: 'MetricDefinition',\n description: 'Represents a metric definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n resetPeriod: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const UsageRecordModel = defineSchemaModel({\n name: 'UsageRecord',\n description: 'Represents a usage record',\n fields: {\n id: { 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 resourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const UsageSummaryModel = defineSchemaModel({\n name: 'UsageSummary',\n description: 'Represents aggregated usage',\n fields: {\n id: { 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 minQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n maxQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n avgQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n },\n});\n\nexport const UsageThresholdModel = defineSchemaModel({\n name: 'UsageThreshold',\n description: 'Represents a usage threshold',\n fields: {\n id: { 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 name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n currentValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst DefineMetricInput = defineSchemaModel({\n name: 'DefineMetricInput',\n description: 'Input for defining a metric',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n resetPeriod: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst UpdateMetricInput = defineSchemaModel({\n name: 'UpdateMetricInput',\n description: 'Input for updating a metric',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst DeleteMetricInput = defineSchemaModel({\n name: 'DeleteMetricInput',\n description: 'Input for deleting a metric',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst GetMetricInput = defineSchemaModel({\n name: 'GetMetricInput',\n description: 'Input for getting a metric',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst ListMetricsInput = defineSchemaModel({\n name: 'ListMetricsInput',\n description: 'Input for listing metrics',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst ListMetricsOutput = defineSchemaModel({\n name: 'ListMetricsOutput',\n description: 'Output for listing metrics',\n fields: {\n metrics: { type: MetricDefinitionModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst RecordUsageInput = defineSchemaModel({\n name: 'RecordUsageInput',\n description: 'Input for recording usage',\n fields: {\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 timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n idempotencyKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n },\n});\n\nconst RecordBatchUsageInput = defineSchemaModel({\n name: 'RecordBatchUsageInput',\n description: 'Input for recording batch usage',\n fields: {\n records: { type: RecordUsageInput, isArray: true, isOptional: false },\n },\n});\n\nconst RecordBatchUsageOutput = defineSchemaModel({\n name: 'RecordBatchUsageOutput',\n description: 'Output for recording batch usage',\n fields: {\n recordedCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n skippedCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n recordIds: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nconst GetUsageInput = defineSchemaModel({\n name: 'GetUsageInput',\n description: 'Input for getting usage',\n fields: {\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 startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst GetUsageOutput = defineSchemaModel({\n name: 'GetUsageOutput',\n description: 'Output for getting usage',\n fields: {\n records: { type: UsageRecordModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n\nconst GetUsageSummaryInput = defineSchemaModel({\n name: 'GetUsageSummaryInput',\n description: 'Input for getting usage summary',\n fields: {\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 startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nconst GetUsageSummaryOutput = defineSchemaModel({\n name: 'GetUsageSummaryOutput',\n description: 'Output for getting usage summary',\n fields: {\n summaries: { type: UsageSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst CreateThresholdInput = defineSchemaModel({\n name: 'CreateThresholdInput',\n description: 'Input for creating a threshold',\n fields: {\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 name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n notifyEmails: { type: ScalarTypeEnum.JSON(), isOptional: true },\n notifyWebhook: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst UpdateThresholdInput = defineSchemaModel({\n name: 'UpdateThresholdInput',\n description: 'Input for updating a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n notifyEmails: { type: ScalarTypeEnum.JSON(), isOptional: true },\n notifyWebhook: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst DeleteThresholdInput = defineSchemaModel({\n name: 'DeleteThresholdInput',\n description: 'Input for deleting a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst ListThresholdsInput = defineSchemaModel({\n name: 'ListThresholdsInput',\n description: 'Input for listing thresholds',\n fields: {\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst ListThresholdsOutput = defineSchemaModel({\n name: 'ListThresholdsOutput',\n description: 'Output for listing thresholds',\n fields: {\n thresholds: { type: UsageThresholdModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst SuccessOutput = defineSchemaModel({\n name: 'SuccessOutput',\n description: 'Generic success output',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Define a metric.\n */\nexport const DefineMetricContract = defineCommand({\n meta: {\n key: 'metric.define',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'define'],\n description: 'Define a new usage metric.',\n goal: 'Create a new metric for tracking usage.',\n context: 'Called when setting up metering.',\n },\n io: {\n input: DefineMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_KEY_EXISTS: {\n description: 'Metric key already exists',\n http: 409,\n gqlCode: 'METRIC_KEY_EXISTS',\n when: 'A metric with this key already exists',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a metric.\n */\nexport const UpdateMetricContract = defineCommand({\n meta: {\n key: 'metric.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'update'],\n description: 'Update a metric definition.',\n goal: 'Modify metric configuration.',\n context: 'Called when updating metric settings.',\n },\n io: {\n input: UpdateMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a metric.\n */\nexport const DeleteMetricContract = defineCommand({\n meta: {\n key: 'metric.delete',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'delete'],\n description: 'Delete a metric definition.',\n goal: 'Remove a metric and its data.',\n context: 'Called when removing a metric.',\n },\n io: {\n input: DeleteMetricInput,\n output: SuccessOutput,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get a metric by key.\n */\nexport const GetMetricContract = defineQuery({\n meta: {\n key: 'metric.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'get'],\n description: 'Get a metric by key.',\n goal: 'Retrieve metric definition.',\n context: 'Called to inspect metric details.',\n },\n io: {\n input: GetMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * List metrics.\n */\nexport const ListMetricsContract = defineQuery({\n meta: {\n key: 'metric.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'list'],\n description: 'List all metrics.',\n goal: 'View configured metrics.',\n context: 'Called to browse metrics.',\n },\n io: {\n input: ListMetricsInput,\n output: ListMetricsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Record usage.\n */\nexport const RecordUsageContract = defineCommand({\n meta: {\n key: 'usage.record',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'record'],\n description: 'Record a usage event.',\n goal: 'Track usage for billing and monitoring.',\n context: 'Called when usage occurs.',\n },\n io: {\n input: RecordUsageInput,\n output: UsageRecordModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n DUPLICATE_RECORD: {\n description: 'Record already exists',\n http: 409,\n gqlCode: 'DUPLICATE_RECORD',\n when: 'Idempotency key already used',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Record batch usage.\n */\nexport const RecordBatchUsageContract = defineCommand({\n meta: {\n key: 'usage.recordBatch',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'batch'],\n description: 'Record multiple usage events.',\n goal: 'Efficiently track bulk usage.',\n context: 'Called for batch processing.',\n },\n io: {\n input: RecordBatchUsageInput,\n output: RecordBatchUsageOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get usage records.\n */\nexport const GetUsageContract = defineQuery({\n meta: {\n key: 'usage.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'get'],\n description: 'Get usage records for a subject.',\n goal: 'View detailed usage history.',\n context: 'Called to analyze usage.',\n },\n io: {\n input: GetUsageInput,\n output: GetUsageOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get usage summary.\n */\nexport const GetUsageSummaryContract = defineQuery({\n meta: {\n key: 'usage.getSummary',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'summary'],\n description: 'Get aggregated usage summary.',\n goal: 'View usage totals for billing.',\n context: 'Called for billing and reporting.',\n },\n io: {\n input: GetUsageSummaryInput,\n output: GetUsageSummaryOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Create a threshold.\n */\nexport const CreateThresholdContract = defineCommand({\n meta: {\n key: 'threshold.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'create'],\n description: 'Create a usage threshold.',\n goal: 'Set up usage limits and alerts.',\n context: 'Called when configuring limits.',\n },\n io: {\n input: CreateThresholdInput,\n output: UsageThresholdModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a threshold.\n */\nexport const UpdateThresholdContract = defineCommand({\n meta: {\n key: 'threshold.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'update'],\n description: 'Update a threshold.',\n goal: 'Modify threshold configuration.',\n context: 'Called when adjusting limits.',\n },\n io: {\n input: UpdateThresholdInput,\n output: UsageThresholdModel,\n errors: {\n THRESHOLD_NOT_FOUND: {\n description: 'Threshold does not exist',\n http: 404,\n gqlCode: 'THRESHOLD_NOT_FOUND',\n when: 'Threshold ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a threshold.\n */\nexport const DeleteThresholdContract = defineCommand({\n meta: {\n key: 'threshold.delete',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'delete'],\n description: 'Delete a threshold.',\n goal: 'Remove a usage threshold.',\n context: 'Called when removing limits.',\n },\n io: {\n input: DeleteThresholdInput,\n output: SuccessOutput,\n errors: {\n THRESHOLD_NOT_FOUND: {\n description: 'Threshold does not exist',\n http: 404,\n gqlCode: 'THRESHOLD_NOT_FOUND',\n when: 'Threshold ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * List thresholds.\n */\nexport const ListThresholdsContract = defineQuery({\n meta: {\n key: 'threshold.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'list'],\n description: 'List usage thresholds.',\n goal: 'View configured limits.',\n context: 'Called to browse thresholds.',\n },\n io: {\n input: ListThresholdsInput,\n output: ListThresholdsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,oBAAoB;AAIpC,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAA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EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAY;GAAa;GAAS;EACzC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ,EACN,qBAAqB;GACnB,aAAa;GACb,MAAM;GACN,SAAS;GACT,MAAM;GACP,EACF;EACF;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAY;GAAa;GAAO;EACvC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nconst OWNERS = ['platform.metering'] as const;\n\n// ============ Schema Models ============\n\nexport const MetricDefinitionModel = defineSchemaModel({\n name: 'MetricDefinition',\n description: 'Represents a metric definition',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n resetPeriod: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const UsageRecordModel = defineSchemaModel({\n name: 'UsageRecord',\n description: 'Represents a usage record',\n fields: {\n id: { 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 resourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const UsageSummaryModel = defineSchemaModel({\n name: 'UsageSummary',\n description: 'Represents aggregated usage',\n fields: {\n id: { 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 minQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n maxQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n avgQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n },\n});\n\nexport const UsageThresholdModel = defineSchemaModel({\n name: 'UsageThreshold',\n description: 'Represents a usage threshold',\n fields: {\n id: { 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 name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n currentValue: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Input/Output Models ============\n\nconst DefineMetricInput = defineSchemaModel({\n name: 'DefineMetricInput',\n description: 'Input for defining a metric',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n unit: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n aggregationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n resetPeriod: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst UpdateMetricInput = defineSchemaModel({\n name: 'UpdateMetricInput',\n description: 'Input for updating a metric',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nconst DeleteMetricInput = defineSchemaModel({\n name: 'DeleteMetricInput',\n description: 'Input for deleting a metric',\n fields: {\n metricId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst GetMetricInput = defineSchemaModel({\n name: 'GetMetricInput',\n description: 'Input for getting a metric',\n fields: {\n key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst ListMetricsInput = defineSchemaModel({\n name: 'ListMetricsInput',\n description: 'Input for listing metrics',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst ListMetricsOutput = defineSchemaModel({\n name: 'ListMetricsOutput',\n description: 'Output for listing metrics',\n fields: {\n metrics: { type: MetricDefinitionModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst RecordUsageInput = defineSchemaModel({\n name: 'RecordUsageInput',\n description: 'Input for recording usage',\n fields: {\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 timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n source: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n resourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n idempotencyKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n },\n});\n\nconst RecordBatchUsageInput = defineSchemaModel({\n name: 'RecordBatchUsageInput',\n description: 'Input for recording batch usage',\n fields: {\n records: { type: RecordUsageInput, isArray: true, isOptional: false },\n },\n});\n\nconst RecordBatchUsageOutput = defineSchemaModel({\n name: 'RecordBatchUsageOutput',\n description: 'Output for recording batch usage',\n fields: {\n recordedCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n skippedCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n recordIds: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nconst GetUsageInput = defineSchemaModel({\n name: 'GetUsageInput',\n description: 'Input for getting usage',\n fields: {\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 startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n offset: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n});\n\nconst GetUsageOutput = defineSchemaModel({\n name: 'GetUsageOutput',\n description: 'Output for getting usage',\n fields: {\n records: { type: UsageRecordModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalQuantity: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n\nconst GetUsageSummaryInput = defineSchemaModel({\n name: 'GetUsageSummaryInput',\n description: 'Input for getting usage summary',\n fields: {\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 startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nconst GetUsageSummaryOutput = defineSchemaModel({\n name: 'GetUsageSummaryOutput',\n description: 'Output for getting usage summary',\n fields: {\n summaries: { type: UsageSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst CreateThresholdInput = defineSchemaModel({\n name: 'CreateThresholdInput',\n description: 'Input for creating a threshold',\n fields: {\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 name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n periodType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n notifyEmails: { type: ScalarTypeEnum.JSON(), isOptional: true },\n notifyWebhook: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst UpdateThresholdInput = defineSchemaModel({\n name: 'UpdateThresholdInput',\n description: 'Input for updating a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n threshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n warnThreshold: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n action: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n notifyEmails: { type: ScalarTypeEnum.JSON(), isOptional: true },\n notifyWebhook: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst DeleteThresholdInput = defineSchemaModel({\n name: 'DeleteThresholdInput',\n description: 'Input for deleting a threshold',\n fields: {\n thresholdId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst ListThresholdsInput = defineSchemaModel({\n name: 'ListThresholdsInput',\n description: 'Input for listing thresholds',\n fields: {\n metricKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n subjectId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n});\n\nconst ListThresholdsOutput = defineSchemaModel({\n name: 'ListThresholdsOutput',\n description: 'Output for listing thresholds',\n fields: {\n thresholds: { type: UsageThresholdModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nconst SuccessOutput = defineSchemaModel({\n name: 'SuccessOutput',\n description: 'Generic success output',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Define a metric.\n */\nexport const DefineMetricContract = defineCommand({\n meta: {\n key: 'metric.define',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'define'],\n description: 'Define a new usage metric.',\n goal: 'Create a new metric for tracking usage.',\n context: 'Called when setting up metering.',\n },\n io: {\n input: DefineMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_KEY_EXISTS: {\n description: 'Metric key already exists',\n http: 409,\n gqlCode: 'METRIC_KEY_EXISTS',\n when: 'A metric with this key already exists',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a metric.\n */\nexport const UpdateMetricContract = defineCommand({\n meta: {\n key: 'metric.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'update'],\n description: 'Update a metric definition.',\n goal: 'Modify metric configuration.',\n context: 'Called when updating metric settings.',\n },\n io: {\n input: UpdateMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a metric.\n */\nexport const DeleteMetricContract = defineCommand({\n meta: {\n key: 'metric.delete',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'delete'],\n description: 'Delete a metric definition.',\n goal: 'Remove a metric and its data.',\n context: 'Called when removing a metric.',\n },\n io: {\n input: DeleteMetricInput,\n output: SuccessOutput,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get a metric by key.\n */\nexport const GetMetricContract = defineQuery({\n meta: {\n key: 'metric.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'get'],\n description: 'Get a metric by key.',\n goal: 'Retrieve metric definition.',\n context: 'Called to inspect metric details.',\n },\n io: {\n input: GetMetricInput,\n output: MetricDefinitionModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * List metrics.\n */\nexport const ListMetricsContract = defineQuery({\n meta: {\n key: 'metric.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'metric', 'list'],\n description: 'List all metrics.',\n goal: 'View configured metrics.',\n context: 'Called to browse metrics.',\n },\n io: {\n input: ListMetricsInput,\n output: ListMetricsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Record usage.\n */\nexport const RecordUsageContract = defineCommand({\n meta: {\n key: 'usage.record',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'record'],\n description: 'Record a usage event.',\n goal: 'Track usage for billing and monitoring.',\n context: 'Called when usage occurs.',\n },\n io: {\n input: RecordUsageInput,\n output: UsageRecordModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n DUPLICATE_RECORD: {\n description: 'Record already exists',\n http: 409,\n gqlCode: 'DUPLICATE_RECORD',\n when: 'Idempotency key already used',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Record batch usage.\n */\nexport const RecordBatchUsageContract = defineCommand({\n meta: {\n key: 'usage.recordBatch',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'batch'],\n description: 'Record multiple usage events.',\n goal: 'Efficiently track bulk usage.',\n context: 'Called for batch processing.',\n },\n io: {\n input: RecordBatchUsageInput,\n output: RecordBatchUsageOutput,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get usage records.\n */\nexport const GetUsageContract = defineQuery({\n meta: {\n key: 'usage.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'get'],\n description: 'Get usage records for a subject.',\n goal: 'View detailed usage history.',\n context: 'Called to analyze usage.',\n },\n io: {\n input: GetUsageInput,\n output: GetUsageOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get usage summary.\n */\nexport const GetUsageSummaryContract = defineQuery({\n meta: {\n key: 'usage.getSummary',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'usage', 'summary'],\n description: 'Get aggregated usage summary.',\n goal: 'View usage totals for billing.',\n context: 'Called for billing and reporting.',\n },\n io: {\n input: GetUsageSummaryInput,\n output: GetUsageSummaryOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Create a threshold.\n */\nexport const CreateThresholdContract = defineCommand({\n meta: {\n key: 'threshold.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'create'],\n description: 'Create a usage threshold.',\n goal: 'Set up usage limits and alerts.',\n context: 'Called when configuring limits.',\n },\n io: {\n input: CreateThresholdInput,\n output: UsageThresholdModel,\n errors: {\n METRIC_NOT_FOUND: {\n description: 'Metric does not exist',\n http: 404,\n gqlCode: 'METRIC_NOT_FOUND',\n when: 'Metric key is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Update a threshold.\n */\nexport const UpdateThresholdContract = defineCommand({\n meta: {\n key: 'threshold.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'update'],\n description: 'Update a threshold.',\n goal: 'Modify threshold configuration.',\n context: 'Called when adjusting limits.',\n },\n io: {\n input: UpdateThresholdInput,\n output: UsageThresholdModel,\n errors: {\n THRESHOLD_NOT_FOUND: {\n description: 'Threshold does not exist',\n http: 404,\n gqlCode: 'THRESHOLD_NOT_FOUND',\n when: 'Threshold ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Delete a threshold.\n */\nexport const DeleteThresholdContract = defineCommand({\n meta: {\n key: 'threshold.delete',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'delete'],\n description: 'Delete a threshold.',\n goal: 'Remove a usage threshold.',\n context: 'Called when removing limits.',\n },\n io: {\n input: DeleteThresholdInput,\n output: SuccessOutput,\n errors: {\n THRESHOLD_NOT_FOUND: {\n description: 'Threshold does not exist',\n http: 404,\n gqlCode: 'THRESHOLD_NOT_FOUND',\n when: 'Threshold ID is invalid',\n },\n },\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * List thresholds.\n */\nexport const ListThresholdsContract = defineQuery({\n meta: {\n key: 'threshold.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['metering', 'threshold', 'list'],\n description: 'List usage thresholds.',\n goal: 'View configured limits.',\n context: 'Called to browse thresholds.',\n },\n io: {\n input: ListThresholdsInput,\n output: ListThresholdsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,oBAAoB;AAIpC,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,iBAAiB;GACf,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,UAAU;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EAC/D,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,mBAAmB,kBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAA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