@lssm/lib.metering 0.0.0-canary-20251222120211 → 0.0.0-canary-20251223012036
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/index.js +150 -151
- package/dist/contracts/index.js.map +1 -1
- package/dist/docs/metering.docblock.js +1 -2
- package/dist/docs/metering.docblock.js.map +1 -1
- package/dist/entities/index.js +112 -112
- package/dist/entities/index.js.map +1 -1
- package/dist/events.js +69 -70
- package/dist/events.js.map +1 -1
- package/package.json +6 -6
- package/dist/contracts/dist/_virtual/rolldown_runtime.js +0 -6
- package/dist/contracts/dist/_virtual/rolldown_runtime.js.map +0 -1
- package/dist/contracts/dist/capabilities/index.js +0 -1
- package/dist/contracts/dist/capabilities/openbanking.js +0 -89
- package/dist/contracts/dist/capabilities/openbanking.js.map +0 -1
- package/dist/contracts/dist/client/index.js +0 -5
- package/dist/contracts/dist/client/react/feature-render.js +0 -3
- package/dist/contracts/dist/client/react/form-render.js +0 -5
- package/dist/contracts/dist/client/react/index.js +0 -4
- package/dist/contracts/dist/contract-registry/index.js +0 -1
- package/dist/contracts/dist/contract-registry/schemas.js +0 -61
- package/dist/contracts/dist/contract-registry/schemas.js.map +0 -1
- package/dist/contracts/dist/data-views/data-views.js +0 -7
- package/dist/contracts/dist/data-views/data-views.js.map +0 -1
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -17
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/index.js +0 -25
- package/dist/contracts/dist/docs/meta.docs.js +0 -30
- package/dist/contracts/dist/docs/meta.docs.js.map +0 -1
- package/dist/contracts/dist/docs/presentations.js +0 -72
- package/dist/contracts/dist/docs/presentations.js.map +0 -1
- package/dist/contracts/dist/docs/registry.js +0 -45
- package/dist/contracts/dist/docs/registry.js.map +0 -1
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -81
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -58
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -17
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -358
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -38
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -17
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -21
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -49
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -80
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -85
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -46
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -68
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -41
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -70
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -48
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -63
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -156
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -21
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -102
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -21
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js.map +0 -1
- package/dist/contracts/dist/docs/tech-contracts.docs.js +0 -97
- package/dist/contracts/dist/docs/tech-contracts.docs.js.map +0 -1
- package/dist/contracts/dist/events.js +0 -11
- package/dist/contracts/dist/events.js.map +0 -1
- package/dist/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/contracts/dist/features.js +0 -7
- package/dist/contracts/dist/features.js.map +0 -1
- package/dist/contracts/dist/forms/forms.js +0 -1
- package/dist/contracts/dist/index.js +0 -88
- package/dist/contracts/dist/index.js.map +0 -1
- package/dist/contracts/dist/install.js +0 -2
- package/dist/contracts/dist/integrations/index.js +0 -18
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js.map +0 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js.map +0 -1
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js.map +0 -1
- package/dist/contracts/dist/integrations/openbanking/models.js +0 -241
- package/dist/contracts/dist/integrations/openbanking/models.js.map +0 -1
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -14
- package/dist/contracts/dist/integrations/openbanking/telemetry.js.map +0 -1
- package/dist/contracts/dist/integrations/operations.js +0 -377
- package/dist/contracts/dist/integrations/operations.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -53
- package/dist/contracts/dist/integrations/providers/elevenlabs.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -76
- package/dist/contracts/dist/integrations/providers/gcs-storage.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/gmail.js +0 -88
- package/dist/contracts/dist/integrations/providers/gmail.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -67
- package/dist/contracts/dist/integrations/providers/google-calendar.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/contracts/dist/integrations/providers/mistral.js +0 -69
- package/dist/contracts/dist/integrations/providers/mistral.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/postmark.js +0 -69
- package/dist/contracts/dist/integrations/providers/postmark.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/powens.js +0 -117
- package/dist/contracts/dist/integrations/providers/powens.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/qdrant.js +0 -74
- package/dist/contracts/dist/integrations/providers/qdrant.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/contracts/dist/integrations/providers/stripe.js +0 -84
- package/dist/contracts/dist/integrations/providers/stripe.js.map +0 -1
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -62
- package/dist/contracts/dist/integrations/providers/twilio-sms.js.map +0 -1
- package/dist/contracts/dist/jsonschema.js +0 -1
- package/dist/contracts/dist/knowledge/index.js +0 -7
- package/dist/contracts/dist/knowledge/operations.js +0 -306
- package/dist/contracts/dist/knowledge/operations.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -35
- package/dist/contracts/dist/knowledge/spaces/email-threads.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -35
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -39
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -35
- package/dist/contracts/dist/knowledge/spaces/product-canon.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -38
- package/dist/contracts/dist/knowledge/spaces/support-faq.js.map +0 -1
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -35
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js.map +0 -1
- package/dist/contracts/dist/llm/exporters.js +0 -21
- package/dist/contracts/dist/llm/exporters.js.map +0 -1
- package/dist/contracts/dist/llm/index.js +0 -2
- package/dist/contracts/dist/llm/prompts.js +0 -1
- package/dist/contracts/dist/onboarding-base.js +0 -196
- package/dist/contracts/dist/onboarding-base.js.map +0 -1
- package/dist/contracts/dist/openapi.js +0 -1
- package/dist/contracts/dist/operations/index.js +0 -2
- package/dist/contracts/dist/operations/operation.js +0 -35
- package/dist/contracts/dist/operations/operation.js.map +0 -1
- package/dist/contracts/dist/operations/registry.js +0 -8
- package/dist/contracts/dist/operations/registry.js.map +0 -1
- package/dist/contracts/dist/ownership.js +0 -24
- package/dist/contracts/dist/ownership.js.map +0 -1
- package/dist/contracts/dist/presentations/index.js +0 -2
- package/dist/contracts/dist/presentations/presentations.js +0 -8
- package/dist/contracts/dist/presentations/presentations.js.map +0 -1
- package/dist/contracts/dist/presentations/transform-engine.js +0 -12
- package/dist/contracts/dist/presentations/transform-engine.js.map +0 -1
- package/dist/contracts/dist/prompt.js +0 -1
- package/dist/contracts/dist/promptRegistry.js +0 -1
- package/dist/contracts/dist/regenerator/index.js +0 -1
- package/dist/contracts/dist/regenerator/service.js +0 -7
- package/dist/contracts/dist/regenerator/service.js.map +0 -1
- package/dist/contracts/dist/registry-utils.js +0 -24
- package/dist/contracts/dist/registry-utils.js.map +0 -1
- package/dist/contracts/dist/resources.js +0 -1
- package/dist/contracts/dist/schema/dist/index.js +0 -3873
- package/dist/contracts/dist/schema/dist/index.js.map +0 -1
- package/dist/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/contracts/dist/server/index.js +0 -8
- package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -3
- package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/contracts/dist/server/rest-express.js +0 -1
- package/dist/contracts/dist/server/rest-generic.js +0 -1
- package/dist/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/contracts/dist/telemetry/index.js +0 -1
- package/dist/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/contracts/dist/tests/index.js +0 -1
- package/dist/contracts/dist/tests/runner.js +0 -2
- package/dist/contracts/dist/workflow/index.js +0 -2
- package/dist/contracts/dist/workflow/runner.js +0 -1
- package/dist/contracts/dist/workflow/spec.js +0 -7
- package/dist/contracts/dist/workflow/spec.js.map +0 -1
- package/dist/contracts/dist/workspace-config/contractsrc-schema.js +0 -164
- package/dist/contracts/dist/workspace-config/contractsrc-schema.js.map +0 -1
- package/dist/contracts/dist/workspace-config/index.js +0 -1
- package/dist/schema/dist/index.js +0 -4889
- package/dist/schema/dist/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineSchemaModel","ScalarTypeEnum"],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@lssm/lib.schema';\nimport { defineCommand, defineQuery } from '@lssm/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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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,wBAAwBA,GAAkB;CACrD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAMC,GAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,KAAK;GAAE,MAAMA,GAAe,iBAAiB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAMA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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,0BAA0B,cAAc;CACnD,MAAM;EACJ,MAAM;EACN,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,MAAM;EACN,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 '@lssm/lib.schema';\nimport { defineCommand, defineQuery } from '@lssm/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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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 name: '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,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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ACT,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metering.docblock.js","names":[],"sources":["../../src/docs/metering.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@lssm/lib.contracts/docs';\nimport { registerDocBlocks } from '@lssm/lib.contracts/docs';\n\nconst meteringDocBlocks: DocBlock[] = [\n {\n id: 'docs.metering.usage',\n title: 'Usage Metering & Billing Core',\n summary:\n 'Reusable usage/metering layer with metric definitions, usage ingestion, aggregation, thresholds, and alerts for billing or quotas.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/metering/usage',\n tags: ['metering', 'usage', 'billing', 'quotas'],\n body: `## Capabilities\n\n- **Entities**: MetricDefinition, UsageRecord, UsageSummary, UsageThreshold, UsageAlert.\n- **Contracts**: define/list metrics; record usage (batch + idempotent); retrieve usage by subject; manage thresholds and alerts.\n- **Aggregation**: hourly/daily/weekly/monthly rollups with SUM/COUNT/AVG/MIN/MAX/LAST strategies.\n- **Events**: usage.recorded, usage.aggregated, threshold.exceeded (see events export).\n\n## Usage\n\n1) Compose schema\n- Add \\`meteringSchemaContribution\\` to your schema composition.\n\n2) Register contracts/events\n- Import from \\`@lssm/lib.metering\\` into your spec registry.\n\n3) Ingest usage\n- Use \\`recordUsage\\` contract (see contracts export) from application services whenever a billable/important action happens (e.g., agent run, API call).\n\n4) Aggregate + thresholds\n- Run scheduled jobs using \\`aggregateUsage\\` helper to roll up summaries.\n- Configure \\`UsageThreshold\\` to emit alerts or blocking actions; pipe alerts into Notifications/Audit.\n\n## Example\n\n${'```'}ts\nimport { meteringSchemaContribution } from '@lssm/lib.metering';\nimport { aggregateUsage } from '@lssm/lib.metering/aggregation';\n\n// schema composition\nconst schema = {\n modules: [meteringSchemaContribution],\n};\n\n// aggregation job\nawait aggregateUsage({\n metrics: metricRepository,\n usage: usageRepository,\n period: 'DAILY',\n});\n${'```'},\n\n## Guardrails\n\n- Keep metric keys stable; store quantities as decimals for currency/units.\n- Use idempotency keys for external ingestion; avoid PII in metric metadata.\n- Scope by org/user for multi-tenant isolation; emit audit + analytics events on changes.\n`,\n },\n];\n\nregisterDocBlocks(meteringDocBlocks);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"metering.docblock.js","names":[],"sources":["../../src/docs/metering.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@lssm/lib.contracts/docs';\nimport { registerDocBlocks } from '@lssm/lib.contracts/docs';\n\nconst meteringDocBlocks: DocBlock[] = [\n {\n id: 'docs.metering.usage',\n title: 'Usage Metering & Billing Core',\n summary:\n 'Reusable usage/metering layer with metric definitions, usage ingestion, aggregation, thresholds, and alerts for billing or quotas.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/metering/usage',\n tags: ['metering', 'usage', 'billing', 'quotas'],\n body: `## Capabilities\n\n- **Entities**: MetricDefinition, UsageRecord, UsageSummary, UsageThreshold, UsageAlert.\n- **Contracts**: define/list metrics; record usage (batch + idempotent); retrieve usage by subject; manage thresholds and alerts.\n- **Aggregation**: hourly/daily/weekly/monthly rollups with SUM/COUNT/AVG/MIN/MAX/LAST strategies.\n- **Events**: usage.recorded, usage.aggregated, threshold.exceeded (see events export).\n\n## Usage\n\n1) Compose schema\n- Add \\`meteringSchemaContribution\\` to your schema composition.\n\n2) Register contracts/events\n- Import from \\`@lssm/lib.metering\\` into your spec registry.\n\n3) Ingest usage\n- Use \\`recordUsage\\` contract (see contracts export) from application services whenever a billable/important action happens (e.g., agent run, API call).\n\n4) Aggregate + thresholds\n- Run scheduled jobs using \\`aggregateUsage\\` helper to roll up summaries.\n- Configure \\`UsageThreshold\\` to emit alerts or blocking actions; pipe alerts into Notifications/Audit.\n\n## Example\n\n${'```'}ts\nimport { meteringSchemaContribution } from '@lssm/lib.metering';\nimport { aggregateUsage } from '@lssm/lib.metering/aggregation';\n\n// schema composition\nconst schema = {\n modules: [meteringSchemaContribution],\n};\n\n// aggregation job\nawait aggregateUsage({\n metrics: metricRepository,\n usage: usageRepository,\n period: 'DAILY',\n});\n${'```'},\n\n## Guardrails\n\n- Keep metric keys stable; store quantities as decimals for currency/units.\n- Use idempotency keys for external ingestion; avoid PII in metric metadata.\n- Scope by org/user for multi-tenant isolation; emit audit + analytics events on changes.\n`,\n },\n];\n\nregisterDocBlocks(meteringDocBlocks);\n"],"mappings":";;;AA+DA,kBA5DsC,CACpC;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAY;EAAS;EAAW;EAAS;CAChD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CP,CACF,CAEmC"}
|