Skip to content

Commit

Permalink
chore: re-order folder structure for types
Browse files Browse the repository at this point in the history
  • Loading branch information
utsabc committed Feb 18, 2025
1 parent c272267 commit 8111aa1
Show file tree
Hide file tree
Showing 7 changed files with 445 additions and 423 deletions.
65 changes: 65 additions & 0 deletions src/types/controlPlaneConfigSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import type { FixMe } from '../util/types';
import type { UserTransformationInput } from './userTransformationContracts';

export type DestinationDefinition = {
ID: string;
Name: string;
DisplayName: string;
Config: FixMe;
};

export type Destination<DestinationConfig = FixMe> = {
ID: string;
Name: string;
DestinationDefinition: DestinationDefinition;
Config: DestinationConfig;
Enabled: boolean;
WorkspaceID: string;
Transformations: UserTransformationInput[];
RevisionID?: string;
IsProcessorEnabled?: boolean;
IsConnectionEnabled?: boolean;
};

export type Connection = {
sourceId: string;
destinationId: string;
enabled: boolean;
config: Record<string, unknown>;
processorEnabled?: boolean;
};

export type SourceDefinition = {
ID: string;
Name: string;
Category: string;
Type: string;
};

export type Source = {
ID: string;
OriginalID: string;
Name: string;
SourceDefinition: SourceDefinition;
Config: object;
Enabled: boolean;
WorkspaceID: string;
WriteKey: string;
Transformations?: UserTransformationInput[];
RevisionID?: string;
Destinations?: Destination[];
Transient: boolean;
EventSchemasEnabled: boolean;
DgSourceTrackingPlanConfig: object;
};

export type UserTransformationLibrary = {
VersionID: string;
};

export type Credential = {
id: string;
key: string;
value: string;
isSecret: boolean;
};
72 changes: 72 additions & 0 deletions src/types/eventSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Supported message types in the event specification
*/
export enum MessageType {
IDENTIFY = 'identify',
TRACK = 'track',
PAGE = 'page',
SCREEN = 'screen',
GROUP = 'group',
ALIAS = 'alias',
AUDIENCE_LIST = 'audiencelist',
}

/**
* Core event message structure following Rudder event spec
*/
export type RudderMessage = {
userId?: string;
anonymousId: string;
type: MessageType;
channel: string;
context: object;
originalTimestamp: Date;
sentAt: Date;
timestamp: Date;
event?: string;
integrations?: object;
messageId: string;
properties?: object;
traits?: object;
};

/**
* Metadata structure for messages
*/
export type Metadata = {
sourceId: string;
workspaceId: string;
namespace: string;
instanceId: string;
sourceType: string;
sourceCategory: string;
trackingPlanId: string;
trackingPlanVersion: number;
sourceTpConfig: object;
mergedTpConfig: object;
destinationId: string;
jobRunId: string;
jobId: number;
sourceBatchId: string;
sourceJobId: string;
sourceJobRunId: string;
sourceTaskId: string;
sourceTaskRunId: string;
recordId: object;
destinationType: string;
messageId: string;
oauthAccessToken: string;
messageIds: string[];
rudderId: string;
receivedAt: string;
eventName: string;
eventType: string;
sourceDefinitionId: string;
destinationDefinitionId: string;
transformationId: string;
dontBatch?: boolean;
};

export type MessageIdMetadataMap = {
[key: string]: Metadata;
};
Loading

0 comments on commit 8111aa1

Please sign in to comment.