@contractspec/module.audit-trail 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.
@@ -9,7 +9,7 @@ const AuditTrailFeature = {
9
9
  title: "Audit Trail",
10
10
  description: "Audit logging, querying, export, and compliance reporting",
11
11
  domain: "platform",
12
- version: 1,
12
+ version: "1.0.0",
13
13
  owners: ["@platform.audit-trail"],
14
14
  tags: [
15
15
  "audit",
@@ -22,23 +22,23 @@ const AuditTrailFeature = {
22
22
  operations: [
23
23
  {
24
24
  key: "audit.logs.export",
25
- version: 1
25
+ version: "1.0.0"
26
26
  },
27
27
  {
28
28
  key: "audit.logs.query",
29
- version: 1
29
+ version: "1.0.0"
30
30
  },
31
31
  {
32
32
  key: "audit.logs.get",
33
- version: 1
33
+ version: "1.0.0"
34
34
  },
35
35
  {
36
36
  key: "audit.trace.get",
37
- version: 1
37
+ version: "1.0.0"
38
38
  },
39
39
  {
40
40
  key: "audit.stats",
41
- version: 1
41
+ version: "1.0.0"
42
42
  }
43
43
  ],
44
44
  events: [],
@@ -48,7 +48,7 @@ const AuditTrailFeature = {
48
48
  capabilities: {
49
49
  provides: [{
50
50
  key: "audit-trail",
51
- version: 1
51
+ version: "1.0.0"
52
52
  }],
53
53
  requires: []
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"audit-trail.feature.js","names":["AuditTrailFeature: FeatureModuleSpec"],"sources":["../src/audit-trail.feature.ts"],"sourcesContent":["/**\n * Audit Trail Feature Module Specification\n *\n * Defines the feature module for audit logging and compliance.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Audit Trail feature module that bundles audit log querying,\n * export, and statistics capabilities.\n */\nexport const AuditTrailFeature: FeatureModuleSpec = {\n meta: {\n key: 'audit-trail',\n title: 'Audit Trail',\n description: 'Audit logging, querying, export, and compliance reporting',\n domain: 'platform',\n version: 1,\n owners: ['@platform.audit-trail'],\n tags: ['audit', 'compliance', 'logging', 'security'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n { key: 'audit.logs.export', version: 1 },\n { key: 'audit.logs.query', version: 1 },\n { key: 'audit.logs.get', version: 1 },\n { key: 'audit.trace.get', version: 1 },\n { key: 'audit.stats', version: 1 },\n ],\n\n // No events for this feature - it consumes events, doesn't emit them\n events: [],\n\n // No presentations for this module feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [{ key: 'audit-trail', version: 1 }],\n requires: [],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,oBAAuC;CAClD,MAAM;EACJ,KAAK;EACL,OAAO;EACP,aAAa;EACb,QAAQ;EACR,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,MAAM;GAAC;GAAS;GAAc;GAAW;GAAW;EACpD,WAAW;EACZ;CAGD,YAAY;EACV;GAAE,KAAK;GAAqB,SAAS;GAAG;EACxC;GAAE,KAAK;GAAoB,SAAS;GAAG;EACvC;GAAE,KAAK;GAAkB,SAAS;GAAG;EACrC;GAAE,KAAK;GAAmB,SAAS;GAAG;EACtC;GAAE,KAAK;GAAe,SAAS;GAAG;EACnC;CAGD,QAAQ,EAAE;CAGV,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CAAC;GAAE,KAAK;GAAe,SAAS;GAAG,CAAC;EAC9C,UAAU,EAAE;EACb;CACF"}
1
+ {"version":3,"file":"audit-trail.feature.js","names":["AuditTrailFeature: FeatureModuleSpec"],"sources":["../src/audit-trail.feature.ts"],"sourcesContent":["/**\n * Audit Trail Feature Module Specification\n *\n * Defines the feature module for audit logging and compliance.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\n/**\n * Audit Trail feature module that bundles audit log querying,\n * export, and statistics capabilities.\n */\nexport const AuditTrailFeature: FeatureModuleSpec = {\n meta: {\n key: 'audit-trail',\n title: 'Audit Trail',\n description: 'Audit logging, querying, export, and compliance reporting',\n domain: 'platform',\n version: '1.0.0',\n owners: ['@platform.audit-trail'],\n tags: ['audit', 'compliance', 'logging', 'security'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n { key: 'audit.logs.export', version: '1.0.0' },\n { key: 'audit.logs.query', version: '1.0.0' },\n { key: 'audit.logs.get', version: '1.0.0' },\n { key: 'audit.trace.get', version: '1.0.0' },\n { key: 'audit.stats', version: '1.0.0' },\n ],\n\n // No events for this feature - it consumes events, doesn't emit them\n events: [],\n\n // No presentations for this module feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [{ key: 'audit-trail', version: '1.0.0' }],\n requires: [],\n },\n};\n"],"mappings":";;;;;AAWA,MAAaA,oBAAuC;CAClD,MAAM;EACJ,KAAK;EACL,OAAO;EACP,aAAa;EACb,QAAQ;EACR,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,MAAM;GAAC;GAAS;GAAc;GAAW;GAAW;EACpD,WAAW;EACZ;CAGD,YAAY;EACV;GAAE,KAAK;GAAqB,SAAS;GAAS;EAC9C;GAAE,KAAK;GAAoB,SAAS;GAAS;EAC7C;GAAE,KAAK;GAAkB,SAAS;GAAS;EAC3C;GAAE,KAAK;GAAmB,SAAS;GAAS;EAC5C;GAAE,KAAK;GAAe,SAAS;GAAS;EACzC;CAGD,QAAQ,EAAE;CAGV,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CAAC;GAAE,KAAK;GAAe,SAAS;GAAS,CAAC;EACpD,UAAU,EAAE;EACb;CACF"}
@@ -12,7 +12,7 @@ declare const AuditLogModel: _contractspec_lib_schema0.SchemaModel<{
12
12
  isOptional: false;
13
13
  };
14
14
  eventVersion: {
15
- type: _contractspec_lib_schema0.FieldType<number, number>;
15
+ type: _contractspec_lib_schema0.FieldType<string, string>;
16
16
  isOptional: false;
17
17
  };
18
18
  payload: {
@@ -116,7 +116,7 @@ declare const AuditQueryOutputModel: _contractspec_lib_schema0.SchemaModel<{
116
116
  isOptional: false;
117
117
  };
118
118
  eventVersion: {
119
- type: _contractspec_lib_schema0.FieldType<number, number>;
119
+ type: _contractspec_lib_schema0.FieldType<string, string>;
120
120
  isOptional: false;
121
121
  };
122
122
  payload: {
@@ -306,7 +306,7 @@ declare const QueryAuditLogsContract: _contractspec_lib_contracts0.OperationSpec
306
306
  isOptional: false;
307
307
  };
308
308
  eventVersion: {
309
- type: _contractspec_lib_schema0.FieldType<number, number>;
309
+ type: _contractspec_lib_schema0.FieldType<string, string>;
310
310
  isOptional: false;
311
311
  };
312
312
  payload: {
@@ -384,7 +384,7 @@ declare const GetAuditLogContract: _contractspec_lib_contracts0.OperationSpec<_c
384
384
  isOptional: false;
385
385
  };
386
386
  eventVersion: {
387
- type: _contractspec_lib_schema0.FieldType<number, number>;
387
+ type: _contractspec_lib_schema0.FieldType<string, string>;
388
388
  isOptional: false;
389
389
  };
390
390
  payload: {
@@ -452,7 +452,7 @@ declare const GetAuditTraceContract: _contractspec_lib_contracts0.OperationSpec<
452
452
  isOptional: false;
453
453
  };
454
454
  eventVersion: {
455
- type: _contractspec_lib_schema0.FieldType<number, number>;
455
+ type: _contractspec_lib_schema0.FieldType<string, string>;
456
456
  isOptional: false;
457
457
  };
458
458
  payload: {
@@ -16,7 +16,7 @@ const AuditLogModel = defineSchemaModel({
16
16
  isOptional: false
17
17
  },
18
18
  eventVersion: {
19
- type: ScalarTypeEnum.Int_unsecure(),
19
+ type: ScalarTypeEnum.String_unsecure(),
20
20
  isOptional: false
21
21
  },
22
22
  payload: {
@@ -235,7 +235,7 @@ const AuditStatsOutputModel = defineSchemaModel({
235
235
  const QueryAuditLogsContract = defineQuery({
236
236
  meta: {
237
237
  key: "audit.logs.query",
238
- version: 1,
238
+ version: "1.0.0",
239
239
  stability: "stable",
240
240
  owners: [...OWNERS],
241
241
  tags: [
@@ -259,7 +259,7 @@ const QueryAuditLogsContract = defineQuery({
259
259
  const GetAuditLogContract = defineQuery({
260
260
  meta: {
261
261
  key: "audit.logs.get",
262
- version: 1,
262
+ version: "1.0.0",
263
263
  stability: "stable",
264
264
  owners: [...OWNERS],
265
265
  tags: [
@@ -289,7 +289,7 @@ const GetAuditLogContract = defineQuery({
289
289
  const GetAuditTraceContract = defineQuery({
290
290
  meta: {
291
291
  key: "audit.trace.get",
292
- version: 1,
292
+ version: "1.0.0",
293
293
  stability: "stable",
294
294
  owners: [...OWNERS],
295
295
  tags: [
@@ -326,7 +326,7 @@ const GetAuditTraceContract = defineQuery({
326
326
  const ExportAuditLogsContract = defineCommand({
327
327
  meta: {
328
328
  key: "audit.logs.export",
329
- version: 1,
329
+ version: "1.0.0",
330
330
  stability: "stable",
331
331
  owners: [...OWNERS],
332
332
  tags: [
@@ -350,7 +350,7 @@ const ExportAuditLogsContract = defineCommand({
350
350
  const GetAuditStatsContract = defineQuery({
351
351
  meta: {
352
352
  key: "audit.stats",
353
- version: 1,
353
+ version: "1.0.0",
354
354
  stability: "stable",
355
355
  owners: [...OWNERS],
356
356
  tags: ["audit", "stats"],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n defineSchemaModel,\n} from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['platform.audit-trail'] as const;\n\n// ============ Schemas ============\n\nexport const AuditLogModel = defineSchemaModel({\n name: 'AuditLog',\n description: 'Detailed audit log entry',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n actorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorEmail: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n clientIp: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n recordedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const AuditQueryInputModel = defineSchemaModel({\n name: 'AuditQueryInput',\n description: 'Input for querying audit logs',\n fields: {\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 100,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\nexport const AuditQueryOutputModel = defineSchemaModel({\n name: 'AuditQueryOutput',\n description: 'Output from querying audit logs',\n fields: {\n logs: { type: AuditLogModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nexport const ExportFormatEnum = defineEnum('ExportFormat', [\n 'json',\n 'csv',\n 'parquet',\n]);\n\nexport const AuditExportInputModel = defineSchemaModel({\n name: 'AuditExportInput',\n description: 'Input for exporting audit logs',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n format: { type: ExportFormatEnum, isOptional: true, defaultValue: 'json' },\n eventNames: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nexport const ExportStatusEnum = defineEnum('ExportStatus', [\n 'pending',\n 'processing',\n 'completed',\n 'failed',\n]);\n\nexport const AuditExportOutputModel = defineSchemaModel({\n name: 'AuditExportOutput',\n description: 'Output from initiating an audit export',\n fields: {\n exportId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ExportStatusEnum, isOptional: false },\n downloadUrl: { type: ScalarTypeEnum.URL(), isOptional: true },\n },\n});\n\nexport const AuditStatsInputModel = defineSchemaModel({\n name: 'AuditStatsInput',\n description: 'Input for getting audit statistics',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const AuditStatsOutputModel = defineSchemaModel({\n name: 'AuditStatsOutput',\n description: 'Audit log statistics',\n fields: {\n totalLogs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n uniqueActors: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n uniqueTargets: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n eventCounts: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Query audit logs.\n */\nexport const QueryAuditLogsContract = defineQuery({\n meta: {\n key: 'audit.logs.query',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'query'],\n description: 'Query audit logs with filters.',\n goal: 'Enable searching and filtering of audit history.',\n context: 'Admin dashboard, compliance reporting, debugging.',\n },\n io: {\n input: AuditQueryInputModel,\n output: AuditQueryOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit log by ID.\n */\nexport const GetAuditLogContract = defineQuery({\n meta: {\n key: 'audit.logs.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'get'],\n description: 'Get a specific audit log by ID.',\n goal: 'View detailed audit log entry.',\n context: 'Log detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetAuditLogInput',\n fields: {\n logId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: AuditLogModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit logs by trace ID.\n */\nexport const GetAuditTraceContract = defineQuery({\n meta: {\n key: 'audit.trace.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'trace', 'get'],\n description: 'Get all audit logs for a trace.',\n goal: 'View complete request trace for debugging.',\n context: 'Request tracing, debugging.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetAuditTraceInput',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'GetAuditTraceOutput',\n fields: {\n logs: { type: AuditLogModel, isArray: true, isOptional: false },\n },\n }),\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Export audit logs.\n */\nexport const ExportAuditLogsContract = defineCommand({\n meta: {\n key: 'audit.logs.export',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'export'],\n description: 'Export audit logs for compliance reporting.',\n goal: 'Generate audit reports for compliance.',\n context: 'Compliance reporting, external audits.',\n },\n io: {\n input: AuditExportInputModel,\n output: AuditExportOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit statistics.\n */\nexport const GetAuditStatsContract = defineQuery({\n meta: {\n key: 'audit.stats',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'stats'],\n description: 'Get audit log statistics.',\n goal: 'Monitor audit activity levels.',\n context: 'Admin dashboard, monitoring.',\n },\n io: {\n input: AuditStatsInputModel,\n output: AuditStatsOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,uBAAuB;AAIvC,MAAa,gBAAgB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,cAAc;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACxE,SAAS;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAO;EACjE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,YAAY;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE,YAAY;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACnE;CACF,CAAC;AAEF,MAAa,uBAAuB,kBAAkB;CACpD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GA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AAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ,EACN,OAAO;IAAE,MAAM,eAAe,iBAAiB;IAAE,YAAY;IAAO,EACrE;GACF,CAAC;EACF,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAS;GAAS;GAAM;EAC/B,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ,EACN,SAAS;IAAE,MAAM,eAAe,iBAAiB;IAAE,YAAY;IAAO,EACvE;GACF,CAAC;EACF,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ,EACN,MAAM;IAAE,MAAM;IAAe,SAAS;IAAM,YAAY;IAAO,EAChE;GACF,CAAC;EACH;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,0BAA0B,cAAc;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAS;GAAQ;GAAS;EACjC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,SAAS,QAAQ;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n defineSchemaModel,\n} from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['platform.audit-trail'] as const;\n\n// ============ Schemas ============\n\nexport const AuditLogModel = defineSchemaModel({\n name: 'AuditLog',\n description: 'Detailed audit log entry',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payload: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n actorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorEmail: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n clientIp: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n recordedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const AuditQueryInputModel = defineSchemaModel({\n name: 'AuditQueryInput',\n description: 'Input for querying audit logs',\n fields: {\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 100,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\nexport const AuditQueryOutputModel = defineSchemaModel({\n name: 'AuditQueryOutput',\n description: 'Output from querying audit logs',\n fields: {\n logs: { type: AuditLogModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nexport const ExportFormatEnum = defineEnum('ExportFormat', [\n 'json',\n 'csv',\n 'parquet',\n]);\n\nexport const AuditExportInputModel = defineSchemaModel({\n name: 'AuditExportInput',\n description: 'Input for exporting audit logs',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n format: { type: ExportFormatEnum, isOptional: true, defaultValue: 'json' },\n eventNames: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nexport const ExportStatusEnum = defineEnum('ExportStatus', [\n 'pending',\n 'processing',\n 'completed',\n 'failed',\n]);\n\nexport const AuditExportOutputModel = defineSchemaModel({\n name: 'AuditExportOutput',\n description: 'Output from initiating an audit export',\n fields: {\n exportId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ExportStatusEnum, isOptional: false },\n downloadUrl: { type: ScalarTypeEnum.URL(), isOptional: true },\n },\n});\n\nexport const AuditStatsInputModel = defineSchemaModel({\n name: 'AuditStatsInput',\n description: 'Input for getting audit statistics',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n from: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n to: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const AuditStatsOutputModel = defineSchemaModel({\n name: 'AuditStatsOutput',\n description: 'Audit log statistics',\n fields: {\n totalLogs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n uniqueActors: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n uniqueTargets: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n eventCounts: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n});\n\n// ============ Contracts ============\n\n/**\n * Query audit logs.\n */\nexport const QueryAuditLogsContract = defineQuery({\n meta: {\n key: 'audit.logs.query',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'query'],\n description: 'Query audit logs with filters.',\n goal: 'Enable searching and filtering of audit history.',\n context: 'Admin dashboard, compliance reporting, debugging.',\n },\n io: {\n input: AuditQueryInputModel,\n output: AuditQueryOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit log by ID.\n */\nexport const GetAuditLogContract = defineQuery({\n meta: {\n key: 'audit.logs.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'get'],\n description: 'Get a specific audit log by ID.',\n goal: 'View detailed audit log entry.',\n context: 'Log detail view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetAuditLogInput',\n fields: {\n logId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: AuditLogModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit logs by trace ID.\n */\nexport const GetAuditTraceContract = defineQuery({\n meta: {\n key: 'audit.trace.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'trace', 'get'],\n description: 'Get all audit logs for a trace.',\n goal: 'View complete request trace for debugging.',\n context: 'Request tracing, debugging.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetAuditTraceInput',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'GetAuditTraceOutput',\n fields: {\n logs: { type: AuditLogModel, isArray: true, isOptional: false },\n },\n }),\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Export audit logs.\n */\nexport const ExportAuditLogsContract = defineCommand({\n meta: {\n key: 'audit.logs.export',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'logs', 'export'],\n description: 'Export audit logs for compliance reporting.',\n goal: 'Generate audit reports for compliance.',\n context: 'Compliance reporting, external audits.',\n },\n io: {\n input: AuditExportInputModel,\n output: AuditExportOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n\n/**\n * Get audit statistics.\n */\nexport const GetAuditStatsContract = defineQuery({\n meta: {\n key: 'audit.stats',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['audit', 'stats'],\n description: 'Get audit log statistics.',\n goal: 'Monitor audit activity levels.',\n context: 'Admin dashboard, monitoring.',\n },\n io: {\n input: AuditStatsInputModel,\n output: AuditStatsOutputModel,\n },\n policy: {\n auth: 'admin',\n },\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,uBAAuB;AAIvC,MAAa,gBAAgB,kBAAkB;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,SAAS;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAO;EACjE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;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;GAAS;EACjC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,SAAS,QAAQ;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,SACP;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/module.audit-trail",
3
- "version": "1.44.1",
3
+ "version": "1.45.0",
4
4
  "description": "Audit trail module for tracking and querying system events",
5
5
  "keywords": [
6
6
  "contractspec",
@@ -26,14 +26,14 @@
26
26
  "lint:check": "eslint src"
27
27
  },
28
28
  "dependencies": {
29
- "@contractspec/lib.schema": "1.44.1",
30
- "@contractspec/lib.contracts": "1.44.1",
31
- "@contractspec/lib.bus": "1.44.1",
29
+ "@contractspec/lib.schema": "1.45.0",
30
+ "@contractspec/lib.contracts": "1.45.0",
31
+ "@contractspec/lib.bus": "1.45.0",
32
32
  "zod": "^4.1.13"
33
33
  },
34
34
  "devDependencies": {
35
- "@contractspec/tool.typescript": "1.44.1",
36
- "@contractspec/tool.tsdown": "1.44.1",
35
+ "@contractspec/tool.typescript": "1.45.0",
36
+ "@contractspec/tool.tsdown": "1.45.0",
37
37
  "typescript": "^5.9.3"
38
38
  },
39
39
  "exports": {