@timeback/caliper 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"event-factories.d.ts","sourceRoot":"","sources":["../../src/lib/event-factories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB,CAoBzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAoB1E"}
1
+ {"version":3,"file":"event-factories.d.ts","sourceRoot":"","sources":["../../src/lib/event-factories.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB,CAsBzF;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAoB1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/lib/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAI5E,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,iCAAiC,CAAA;AACpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjD;;;;;;OAMG;IACH,YAAY,SAAS,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAe,EAWjF;CACD"}
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/lib/pagination.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACN,SAAS,IAAI,aAAa,EAE1B,MAAM,iCAAiC,CAAA;AAIxC,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,iCAAiC,CAAA;AACpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjD;;;;;;OAMG;IACH,YAAY,SAAS,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAe,EAYjF;CACD"}
@@ -4,7 +4,8 @@
4
4
  * Manage Caliper events - send, list, and retrieve.
5
5
  */
6
6
  import { Paginator } from '../lib/pagination';
7
- import type { ActivityCompletedInput, CaliperEnvelope, CaliperEvent, CaliperTransportLike, ListEventsParams, ListEventsResult, SendEventsResult, StoredEvent, TimeSpentInput, ValidationResult } from '../types';
7
+ import type { ActivityCompletedInput, CaliperListEventsParams as CaliperListEventsParamsType, TimeSpentInput } from '@timeback/types/zod';
8
+ import type { CaliperEnvelope, CaliperEvent, CaliperTransportLike, ListEventsResult, SendEventsResult, StoredEvent, ValidationResult } from '../types';
8
9
  /**
9
10
  * Caliper Events resource.
10
11
  *
@@ -112,7 +113,7 @@ export declare class EventsResource {
112
113
  * console.log(`Total: ${pagination.total}`)
113
114
  * ```
114
115
  */
115
- list(params?: ListEventsParams): Promise<ListEventsResult>;
116
+ list(params?: CaliperListEventsParamsType): Promise<ListEventsResult>;
116
117
  /**
117
118
  * Stream Caliper events with automatic pagination.
118
119
  *
@@ -143,7 +144,7 @@ export declare class EventsResource {
143
144
  * .toArray()
144
145
  * ```
145
146
  */
146
- stream(params?: ListEventsParams & {
147
+ stream(params?: CaliperListEventsParamsType & {
147
148
  max?: number;
148
149
  }): Paginator<StoredEvent>;
149
150
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/resources/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAG7C,OAAO,KAAK,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,oBAAoB,EAEpB,gBAAgB,EAEhB,gBAAgB,EAEhB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,MAAM,UAAU,CAAA;AAEjB;;;;GAIG;AACH,qBAAa,cAAc;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,oBAAoB,EAAI;IAEhE;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAStE;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAcvE;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoBnE;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,IAAI,CAAC,MAAM,GAAE,gBAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2BnE;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,CAAC,MAAM,GAAE,gBAAgB,GAA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;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6B,GACpC,OAAO,CAAC,SAAS,CAAC,CAyBpB;CACD"}
1
+ {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../src/resources/jobs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EACX,oBAAoB,EACpB,SAAS,EAET,wBAAwB,EACxB,MAAM,UAAU,CAAA;AAGjB;;;;;GAKG;AACH,qBAAa,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,oBAAoB,EAAI;IAEhE;;;;;;;;;;;;;;OAcG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAcjD;IAED;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,wBAA6B,GACpC,OAAO,CAAC,SAAS,CAAC,CA2BpB;CACD"}
@@ -1,11 +1,5 @@
1
- /**
2
- * Caliper Types
3
- *
4
- * Type definitions for the Caliper client.
5
- */
6
- export * from './api';
1
+ export * from '@timeback/types/protocols/caliper';
7
2
  export * from './client';
8
- export * from './events';
9
- export * from './timeback';
10
3
  export { CALIPER_DATA_VERSION } from '../constants';
4
+ export type { ActivityCompletedInput, TimeSpentInput, CaliperListEventsParams as ListEventsParams, } from '@timeback/types/zod';
11
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,UAAU,CAAA;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEnD,YAAY,EACX,sBAAsB,EACtB,cAAc,EACd,uBAAuB,IAAI,gBAAgB,GAC3C,MAAM,qBAAqB,CAAA"}
package/dist/types.js CHANGED
@@ -15,6 +15,15 @@ var __toESM = (mod, isNodeMode, target) => {
15
15
  });
16
16
  return to;
17
17
  };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, {
21
+ get: all[name],
22
+ enumerable: true,
23
+ configurable: true,
24
+ set: (newValue) => all[name] = () => newValue
25
+ });
26
+ };
18
27
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
19
28
  // ../../internal/constants/src/endpoints.ts
20
29
  var DEFAULT_PLATFORM = "BEYOND_AI";
@@ -67,9 +76,12 @@ var PLATFORM_ENDPOINTS = {
67
76
  // ../../internal/constants/src/typescript.ts
68
77
  var TypeScriptPackages = {
69
78
  tsc: "tsc",
70
- nativePreview: "@typescript/native-preview@7.0.0-dev.20251217.1"
79
+ nativePreview: "@typescript/native-preview"
80
+ };
81
+ var TYPESCRIPT_RUNNER = {
82
+ package: TypeScriptPackages.nativePreview,
83
+ bin: "tsgo"
71
84
  };
72
- var TYPESCRIPT_PACKAGE = TypeScriptPackages.nativePreview;
73
85
  // src/constants.ts
74
86
  var CALIPER_ENV_VARS = {
75
87
  baseUrl: "CALIPER_BASE_URL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timeback/caliper",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Caliper Analytics client SDK for Timeback",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,12 +22,16 @@
22
22
  "build": "bun build.ts",
23
23
  "test": "bun test --no-env-file unit.test.ts"
24
24
  },
25
+ "dependencies": {
26
+ "zod": "^4.2.1"
27
+ },
25
28
  "devDependencies": {
26
29
  "@timeback/internal-client-infra": "0.0.0",
27
30
  "@timeback/internal-constants": "0.0.0",
28
31
  "@timeback/internal-logger": "0.0.0",
29
32
  "@timeback/internal-test": "0.0.0",
30
33
  "@timeback/internal-utils": "0.0.0",
34
+ "@timeback/types": "0.0.0",
31
35
  "@types/bun": "latest"
32
36
  },
33
37
  "peerDependencies": {
@@ -1,101 +0,0 @@
1
- /**
2
- * API Response Types
3
- *
4
- * Types for Caliper API responses.
5
- *
6
- * @remarks
7
- * **IMPORTANT - API Docs Drift**: The official API documentation (caliper/response.yaml
8
- * and caliper-api.yaml) does NOT accurately reflect actual API responses. The types
9
- * in this file were derived from testing actual API responses. See individual type
10
- * comments for specific discrepancies.
11
- */
12
- import type { JobStatus, StoredEvent } from './events';
13
- /**
14
- * Generic API response wrapper.
15
- */
16
- export interface ApiResponse<T> {
17
- status: 'success' | 'error';
18
- message?: string;
19
- data?: T;
20
- }
21
- /**
22
- * Pagination metadata returned by list endpoints.
23
- */
24
- export interface PaginationMeta {
25
- /** Total number of items across all pages */
26
- total: number;
27
- /** Total number of pages */
28
- totalPages: number;
29
- /** Current page number (1-indexed) */
30
- currentPage: number;
31
- /** Number of items per page */
32
- limit: number;
33
- }
34
- /**
35
- * Response from GET /caliper/events (list events).
36
- *
37
- * @remarks
38
- * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show
39
- * `{ status, message, errors? }`. Actual response is `{ events, pagination }`.
40
- */
41
- export interface ListEventsResponse {
42
- /** Array of stored events */
43
- events: StoredEvent[];
44
- /** Pagination metadata */
45
- pagination: PaginationMeta;
46
- }
47
- /**
48
- * Response from GET /caliper/events/:externalId (get single event).
49
- *
50
- * @remarks
51
- * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show
52
- * `{ status, message, errors? }`. Actual response is `{ status, event }`.
53
- */
54
- export interface GetEventResponse {
55
- /** Status indicator */
56
- status: 'success' | 'error';
57
- /** The requested event */
58
- event: StoredEvent;
59
- }
60
- /**
61
- * Response from POST /caliper/event (send events).
62
- *
63
- * @remarks
64
- * **API Docs Drift**: Official docs (caliper/response.yaml) incorrectly show
65
- * `{ status, message, errors? }`. Actual response is `{ jobId }`.
66
- * Use the jobId with `jobs.getStatus()` to track processing.
67
- */
68
- export interface SendEventsResponse {
69
- /** Job ID for tracking async processing */
70
- jobId: string;
71
- }
72
- /**
73
- * Job status response payload (GET /jobs/{jobId}/status).
74
- *
75
- * @remarks
76
- * This endpoint is correctly documented in caliper/response.yaml.
77
- */
78
- export interface JobStatusResponse {
79
- job: JobStatus;
80
- }
81
- /**
82
- * Options for waitForCompletion polling.
83
- */
84
- export interface WaitForCompletionOptions {
85
- /** Maximum time to wait in milliseconds (default: 30000) */
86
- timeoutMs?: number;
87
- /** Interval between status checks in milliseconds (default: 1000) */
88
- pollIntervalMs?: number;
89
- }
90
- /**
91
- * Validation result from the validate endpoint.
92
- */
93
- export interface ValidationResult {
94
- /** Whether validation succeeded */
95
- status: 'success' | 'error';
96
- /** Human-readable message */
97
- message?: string;
98
- /** Validation errors (if any) */
99
- errors?: unknown;
100
- }
101
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,CAAC,CAAA;CACR;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC,6BAA6B;IAC7B,MAAM,EAAE,WAAW,EAAE,CAAA;IACrB,0BAA0B;IAC1B,UAAU,EAAE,cAAc,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,uBAAuB;IACvB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,0BAA0B;IAC1B,KAAK,EAAE,WAAW,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAClC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,SAAS,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,mCAAmC;IACnC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAA;IAC3B,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAA;CAChB"}
@@ -1,203 +0,0 @@
1
- /**
2
- * Caliper Event Types
3
- *
4
- * Types for Caliper Analytics events and envelopes.
5
- */
6
- import type { CALIPER_DATA_VERSION } from '../constants';
7
- import type { PaginationMeta } from './api';
8
- import type { TimebackUser } from './timeback';
9
- /**
10
- * Supported Caliper profiles.
11
- */
12
- export type CaliperProfile = 'AnnotationProfile' | 'AssessmentProfile' | 'ToolUseProfile' | 'GeneralProfile' | 'FeedbackProfile' | 'MediaProfile' | 'SurveyProfile' | 'ResourceManagementProfile' | 'ForumProfile' | 'AssignableProfile' | 'GradingProfile' | 'ReadingProfile' | 'SessionProfile' | 'SearchProfile' | 'ToolLaunchProfile' | 'TimebackProfile';
13
- /**
14
- * Base Caliper entity - can be a URI string or an object with properties.
15
- */
16
- export type CaliperEntity = string | {
17
- [key: string]: unknown;
18
- };
19
- /**
20
- * Caliper actor entity (for sending events).
21
- *
22
- * Timeback API requires actors to have extensions.email.
23
- */
24
- export interface CaliperActor {
25
- /** Unique identifier (IRI format) */
26
- id: string;
27
- /** Entity type (e.g., 'Person', 'TimebackUser') */
28
- type: string;
29
- /** Extensions - email is required by Timeback API */
30
- extensions: {
31
- /** Actor's email address (required by Timeback) */
32
- email: string;
33
- /** Additional extension properties */
34
- [key: string]: unknown;
35
- };
36
- }
37
- /**
38
- * Caliper Event.
39
- *
40
- * Represents a learning activity event conforming to IMS Caliper v1.2.
41
- */
42
- export interface CaliperEvent {
43
- /** JSON-LD context */
44
- '@context'?: string;
45
- /** Unique identifier (URN UUID format) */
46
- id: string;
47
- /** Event type */
48
- type: string;
49
- /** The agent who initiated the event (string URL, CaliperActor, or TimebackUser) */
50
- actor: string | CaliperActor | TimebackUser;
51
- /** The action or predicate */
52
- action: string;
53
- /** The object of the interaction */
54
- object: CaliperEntity;
55
- /** ISO 8601 datetime when event occurred */
56
- eventTime: string;
57
- /** Profile governing interpretation */
58
- profile: CaliperProfile;
59
- /** Application context */
60
- edApp?: CaliperEntity;
61
- /** Entity generated as result */
62
- generated?: CaliperEntity;
63
- /** Target segment within object */
64
- target?: CaliperEntity;
65
- /** Referring context */
66
- referrer?: CaliperEntity;
67
- /** Organization/group context */
68
- group?: CaliperEntity;
69
- /** User's membership/role */
70
- membership?: CaliperEntity;
71
- /** Current user session */
72
- session?: CaliperEntity;
73
- /** LTI session context */
74
- federatedSession?: CaliperEntity;
75
- /** Additional custom attributes */
76
- extensions?: Record<string, unknown>;
77
- }
78
- /**
79
- * Caliper Envelope.
80
- *
81
- * Container for transmitting Caliper events to the API.
82
- */
83
- export interface CaliperEnvelope {
84
- /** Sensor identifier (IRI format) */
85
- sensor: string;
86
- /** ISO 8601 datetime when data was sent */
87
- sendTime: string;
88
- /** Caliper data version */
89
- dataVersion: typeof CALIPER_DATA_VERSION;
90
- /** Array of events or entities */
91
- data: CaliperEvent[];
92
- }
93
- /**
94
- * Result of sending events.
95
- */
96
- export interface SendEventsResult {
97
- /** Job ID for tracking async processing */
98
- jobId: string;
99
- }
100
- /**
101
- * Individual event result from job completion.
102
- */
103
- export interface EventResult {
104
- /** Allocated internal ID */
105
- allocatedId: string;
106
- /** External event ID */
107
- externalId: string;
108
- }
109
- /**
110
- * Job status response.
111
- */
112
- export interface JobStatus {
113
- id: string;
114
- state: 'waiting' | 'active' | 'completed' | 'failed';
115
- returnValue?: {
116
- status: 'success' | 'error';
117
- results: EventResult[];
118
- };
119
- processedOn?: string | null;
120
- }
121
- /**
122
- * Stored Caliper event (from list/get).
123
- *
124
- * This represents an event as returned by the API, which differs from the
125
- * input CaliperEvent format. The API adds internal fields and transforms
126
- * the original event ID to `externalId`.
127
- *
128
- * @remarks
129
- * **API Docs Drift**: The official OpenAPI spec (caliper-api.yaml) does not
130
- * accurately document this response structure. This type was derived from
131
- * actual API responses. Key differences:
132
- * - `id` is a number (internal DB ID), not a string
133
- * - `externalId` contains the original URN UUID (use this for `get()` calls)
134
- * - Response is wrapped in `{ events: StoredEvent[] }` for list, `{ event: StoredEvent }` for get
135
- */
136
- export interface StoredEvent {
137
- /** Internal numeric ID (allocated by the database) */
138
- id: number;
139
- /** Original event ID (URN UUID format) - use this for get() calls */
140
- externalId: string;
141
- /** Sensor that sent the event */
142
- sensor: string;
143
- /** Event type (e.g., 'ActivityEvent', 'Event') */
144
- type: string;
145
- /** Caliper profile (e.g., 'TimebackProfile') */
146
- profile?: string;
147
- /** The action or predicate */
148
- action: string;
149
- /** When the event occurred */
150
- eventTime: string;
151
- /** When the event was sent */
152
- sendTime: string;
153
- /** When the record was last updated */
154
- updated_at: string | null;
155
- /** When the record was created */
156
- created_at: string;
157
- /** When the record was deleted (soft delete) */
158
- deleted_at: string | null;
159
- /** The agent who initiated the event */
160
- actor: CaliperEntity;
161
- /** The object of the event */
162
- object: CaliperEntity;
163
- /** Generated entity (e.g., result, score) */
164
- generated?: CaliperEntity | null;
165
- /** Target entity */
166
- target?: CaliperEntity | null;
167
- /** Referrer entity */
168
- referrer?: CaliperEntity | null;
169
- /** EdApp entity */
170
- edApp?: CaliperEntity | null;
171
- /** Group/organization entity */
172
- group?: CaliperEntity | null;
173
- /** Membership entity */
174
- membership?: CaliperEntity | null;
175
- /** Session entity */
176
- session?: CaliperEntity | null;
177
- /** Federated session entity */
178
- federatedSession?: CaliperEntity | null;
179
- /** Extension data */
180
- extensions?: Record<string, unknown> | null;
181
- /** Client application ID */
182
- clientAppId?: string | null;
183
- }
184
- /**
185
- * Parameters for listing events.
186
- */
187
- export interface ListEventsParams {
188
- limit?: number;
189
- offset?: number;
190
- sensor?: string;
191
- startDate?: string;
192
- endDate?: string;
193
- actorId?: string;
194
- actorEmail?: string;
195
- }
196
- /**
197
- * Result from listing events.
198
- */
199
- export interface ListEventsResult {
200
- events: StoredEvent[];
201
- pagination: PaginationMeta;
202
- }
203
- //# sourceMappingURL=events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,cAAc,GACvB,mBAAmB,GACnB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,2BAA2B,GAC3B,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf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