init
This commit is contained in:
15
packages/types/README.md
Normal file
15
packages/types/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# types
|
||||
|
||||
To install dependencies:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
|
||||
To run:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
This project was created using `bun init` in bun v1.0.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
74
packages/types/index.ts
Normal file
74
packages/types/index.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
export type MixanJson = Record<string, any>
|
||||
|
||||
export type EventPayload = {
|
||||
name: string
|
||||
time: string
|
||||
externalId: string | null
|
||||
properties: MixanJson
|
||||
}
|
||||
|
||||
export type ProfilePayload = {
|
||||
first_name?: string
|
||||
last_name?: string
|
||||
email?: string
|
||||
avatar?: string
|
||||
id: string
|
||||
properties: MixanJson
|
||||
}
|
||||
|
||||
export type ProfileIncrementPayload = {
|
||||
name: string
|
||||
value: number
|
||||
id: string
|
||||
}
|
||||
|
||||
export type ProfileDecrementPayload = {
|
||||
name: string
|
||||
value: number
|
||||
id: string
|
||||
}
|
||||
|
||||
// Batching
|
||||
export type BatchEvent = {
|
||||
type: 'event',
|
||||
payload: EventPayload
|
||||
}
|
||||
|
||||
export type BatchProfile = {
|
||||
type: 'profile',
|
||||
payload: ProfilePayload
|
||||
}
|
||||
|
||||
export type BatchProfileIncrement = {
|
||||
type: 'profile_increment',
|
||||
payload: ProfileIncrementPayload
|
||||
}
|
||||
|
||||
export type BatchProfileDecrement = {
|
||||
type: 'profile_decrement',
|
||||
payload: ProfileDecrementPayload
|
||||
}
|
||||
|
||||
export type BatchItem = BatchEvent | BatchProfile | BatchProfileIncrement | BatchProfileDecrement
|
||||
export type BatchPayload = Array<BatchItem>
|
||||
|
||||
|
||||
export type MixanIssue = {
|
||||
field: string
|
||||
message: string
|
||||
value: any
|
||||
}
|
||||
|
||||
export type MixanIssuesResponse = {
|
||||
issues: Array<MixanIssue>,
|
||||
}
|
||||
|
||||
export type MixanErrorResponse = {
|
||||
code: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export type MixanResponse<T> = {
|
||||
result: T
|
||||
status: 'ok'
|
||||
}
|
||||
12
packages/types/package.json
Normal file
12
packages/types/package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@mixan/types",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"module": "index.ts",
|
||||
"devDependencies": {
|
||||
"bun-types": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
}
|
||||
22
packages/types/tsconfig.json
Normal file
22
packages/types/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext"],
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"moduleDetection": "force",
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true,
|
||||
"composite": true,
|
||||
"strict": true,
|
||||
"downlevelIteration": true,
|
||||
"skipLibCheck": true,
|
||||
"jsx": "react-jsx",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowJs": true,
|
||||
"types": [
|
||||
"bun-types" // add Bun global
|
||||
]
|
||||
}
|
||||
}
|
||||
10
packages/types/tsup.config.ts
Normal file
10
packages/types/tsup.config.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["index.ts"],
|
||||
format: ["cjs", "esm"], // Build for commonJS and ESmodules
|
||||
dts: true, // Generate declaration file (.d.ts)
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
});
|
||||
Reference in New Issue
Block a user