remove sdk/types package and move it to main sdk package
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
"@mixan/sdk": "workspace:*",
|
||||||
"@types/ramda": "^0.29.6",
|
"@types/ramda": "^0.29.6",
|
||||||
"@types/ua-parser-js": "^0.7.39",
|
"@types/ua-parser-js": "^0.7.39",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type { IServiceCreateEventPayload } from '@mixan/db';
|
|||||||
import { createBotEvent, createEvent, getEvents, getSalts } from '@mixan/db';
|
import { createBotEvent, createEvent, getEvents, getSalts } from '@mixan/db';
|
||||||
import type { JobsOptions } from '@mixan/queue';
|
import type { JobsOptions } from '@mixan/queue';
|
||||||
import { eventsQueue, findJobByPrefix } from '@mixan/queue';
|
import { eventsQueue, findJobByPrefix } from '@mixan/queue';
|
||||||
import type { PostEventPayload } from '@mixan/types';
|
import type { PostEventPayload } from '@mixan/sdk';
|
||||||
|
|
||||||
const SESSION_TIMEOUT = 1000 * 60 * 30;
|
const SESSION_TIMEOUT = 1000 * 60 * 30;
|
||||||
const SESSION_END_TIMEOUT = SESSION_TIMEOUT + 1000;
|
const SESSION_END_TIMEOUT = SESSION_TIMEOUT + 1000;
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import type { FastifyReply, FastifyRequest } from 'fastify';
|
|||||||
import { assocPath, pathOr } from 'ramda';
|
import { assocPath, pathOr } from 'ramda';
|
||||||
|
|
||||||
import { getProfileById, upsertProfile } from '@mixan/db';
|
import { getProfileById, upsertProfile } from '@mixan/db';
|
||||||
import type {
|
import type { IncrementProfilePayload, UpdateProfilePayload } from '@mixan/sdk';
|
||||||
IncrementProfilePayload,
|
|
||||||
UpdateProfilePayload,
|
|
||||||
} from '@mixan/types';
|
|
||||||
|
|
||||||
export async function updateProfile(
|
export async function updateProfile(
|
||||||
request: FastifyRequest<{
|
request: FastifyRequest<{
|
||||||
|
|||||||
@@ -6,12 +6,7 @@
|
|||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
transpilePackages: [
|
transpilePackages: ['@mixan/sdk', '@mixan/web-sdk', '@mixan/next'],
|
||||||
'@mixan/types',
|
|
||||||
'@mixan/sdk',
|
|
||||||
'@mixan/web-sdk',
|
|
||||||
'@mixan/next',
|
|
||||||
],
|
|
||||||
eslint: { ignoreDuringBuilds: true },
|
eslint: { ignoreDuringBuilds: true },
|
||||||
typescript: { ignoreBuildErrors: true },
|
typescript: { ignoreBuildErrors: true },
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
"@mixan/constants": "workspace:^",
|
"@mixan/constants": "workspace:^",
|
||||||
"@mixan/db": "workspace:^",
|
"@mixan/db": "workspace:^",
|
||||||
"@mixan/queue": "workspace:^",
|
"@mixan/queue": "workspace:^",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@mixan/validation": "workspace:^",
|
"@mixan/validation": "workspace:^",
|
||||||
"@radix-ui/react-accordion": "^1.1.2",
|
"@radix-ui/react-accordion": "^1.1.2",
|
||||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
import type { NextApiResponse } from 'next';
|
|
||||||
|
|
||||||
import type { MixanErrorResponse, MixanIssue } from '@mixan/types';
|
|
||||||
|
|
||||||
export class HttpError extends Error {
|
|
||||||
public status: number;
|
|
||||||
public message: string;
|
|
||||||
public issues: MixanIssue[];
|
|
||||||
|
|
||||||
constructor(status: number, message: string | Error, issues?: MixanIssue[]) {
|
|
||||||
super(message instanceof Error ? message.message : message);
|
|
||||||
this.status = status;
|
|
||||||
this.message = message instanceof Error ? message.message : message;
|
|
||||||
this.issues = issues ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
toJson(): MixanErrorResponse {
|
|
||||||
return {
|
|
||||||
code: this.status,
|
|
||||||
status: 'error',
|
|
||||||
message: this.message,
|
|
||||||
issues: this.issues.length ? this.issues : undefined,
|
|
||||||
stack: process.env.NODE_ENV !== 'production' ? this.stack : undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createIssues(arr: MixanIssue[]) {
|
|
||||||
throw new HttpError(400, 'Issues', arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createError(status = 500, error: unknown) {
|
|
||||||
if (error instanceof Error || typeof error === 'string') {
|
|
||||||
return new HttpError(status, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new HttpError(500, 'Unexpected error occured');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function handleError(res: NextApiResponse, error: unknown) {
|
|
||||||
console.log('-----------------');
|
|
||||||
console.log('ERROR');
|
|
||||||
console.log(error);
|
|
||||||
console.log('-----------------');
|
|
||||||
|
|
||||||
if (error instanceof HttpError) {
|
|
||||||
return res.status(error.status).json(error.toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error instanceof Error) {
|
|
||||||
const httpError = createError(500, error);
|
|
||||||
return res.status(httpError.status).json(httpError.toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
const httpError = createError(500, error);
|
|
||||||
return res.status(httpError.status).json(httpError.toJson());
|
|
||||||
}
|
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/ramda": "^0.29.6",
|
"@types/ramda": "^0.29.6",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^18.16.0",
|
||||||
"@types/ramda": "^0.29.6",
|
"@types/ramda": "^0.29.6",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^18.16.0",
|
||||||
"@types/ramda": "^0.29.6",
|
"@types/ramda": "^0.29.6",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^18.16.0",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^18.16.0",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ import { AppState, Platform } from 'react-native';
|
|||||||
import * as Application from 'expo-application';
|
import * as Application from 'expo-application';
|
||||||
import Constants from 'expo-constants';
|
import Constants from 'expo-constants';
|
||||||
|
|
||||||
import type { MixanOptions } from '@mixan/sdk';
|
import type { MixanOptions, PostEventPayload } from '@mixan/sdk';
|
||||||
import { Mixan } from '@mixan/sdk';
|
import { Mixan } from '@mixan/sdk';
|
||||||
import type { PostEventPayload } from '@mixan/types';
|
|
||||||
|
|
||||||
type MixanNativeOptions = MixanOptions;
|
type MixanNativeOptions = MixanOptions;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import Script from 'next/script';
|
import Script from 'next/script';
|
||||||
|
|
||||||
import type { MixanWebOptions } from '@mixan/sdk-web';
|
|
||||||
import type {
|
import type {
|
||||||
MixanEventOptions,
|
MixanEventOptions,
|
||||||
|
MixanWebOptions,
|
||||||
PostEventPayload,
|
PostEventPayload,
|
||||||
UpdateProfilePayload,
|
UpdateProfilePayload,
|
||||||
} from '@mixan/types';
|
} from '@mixan/sdk-web';
|
||||||
|
|
||||||
const CDN_URL = 'http://localhost:3002/op.js';
|
const CDN_URL = 'http://localhost:3002/op.js';
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { MixanOptions } from '@mixan/sdk';
|
import type { MixanOptions, PostEventPayload } from '@mixan/sdk';
|
||||||
import { Mixan } from '@mixan/sdk';
|
import { Mixan } from '@mixan/sdk';
|
||||||
import type { PostEventPayload } from '@mixan/types';
|
|
||||||
|
export * from '@mixan/sdk';
|
||||||
|
|
||||||
export type MixanWebOptions = MixanOptions & {
|
export type MixanWebOptions = MixanOptions & {
|
||||||
trackOutgoingLinks?: boolean;
|
trackOutgoingLinks?: boolean;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
|
|||||||
@@ -1,10 +1,37 @@
|
|||||||
import type {
|
// NEW
|
||||||
DecrementProfilePayload,
|
|
||||||
IncrementProfilePayload,
|
export interface MixanEventOptions {
|
||||||
MixanEventOptions,
|
profileId?: string;
|
||||||
PostEventPayload,
|
}
|
||||||
UpdateProfilePayload,
|
|
||||||
} from '@mixan/types';
|
export interface PostEventPayload {
|
||||||
|
name: string;
|
||||||
|
timestamp: string;
|
||||||
|
deviceId?: string;
|
||||||
|
profileId?: string;
|
||||||
|
properties?: Record<string, unknown> & MixanEventOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateProfilePayload {
|
||||||
|
profileId: string;
|
||||||
|
firstName?: string;
|
||||||
|
lastName?: string;
|
||||||
|
email?: string;
|
||||||
|
avatar?: string;
|
||||||
|
properties?: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IncrementProfilePayload {
|
||||||
|
profileId: string;
|
||||||
|
property: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DecrementProfilePayload {
|
||||||
|
profileId?: string;
|
||||||
|
property: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface MixanOptions {
|
export interface MixanOptions {
|
||||||
url: string;
|
url: string;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"tsup": "^7.2.0",
|
"tsup": "^7.2.0",
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
# types
|
|
||||||
|
|
||||||
To install dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pnpm install
|
|
||||||
```
|
|
||||||
|
|
||||||
To run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pnpm run index.ts
|
|
||||||
```
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from './src/sdk.types';
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@mixan/types",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"module": "index.ts",
|
|
||||||
"scripts": {
|
|
||||||
"build": "rm -rf dist && tsup",
|
|
||||||
"lint": "eslint .",
|
|
||||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
|
||||||
"typecheck": "tsc --noEmit"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@mixan/eslint-config": "workspace:*",
|
|
||||||
"@mixan/prettier-config": "workspace:*",
|
|
||||||
"@mixan/tsconfig": "workspace:*",
|
|
||||||
"eslint": "^8.48.0",
|
|
||||||
"prettier": "^3.0.3",
|
|
||||||
"tsup": "^7.2.0",
|
|
||||||
"typescript": "^5.2.2"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"root": true,
|
|
||||||
"extends": [
|
|
||||||
"@mixan/eslint-config/base"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"prettier": "@mixan/prettier-config"
|
|
||||||
}
|
|
||||||
@@ -1,168 +0,0 @@
|
|||||||
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
||||||
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
||||||
|
|
||||||
export type MixanJson = Record<string, any>;
|
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
export interface EventPayload {
|
|
||||||
name: string;
|
|
||||||
time: string;
|
|
||||||
profileId: string | null;
|
|
||||||
properties: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
export interface ProfilePayload {
|
|
||||||
first_name?: string;
|
|
||||||
last_name?: string;
|
|
||||||
email?: string;
|
|
||||||
avatar?: string;
|
|
||||||
id?: string;
|
|
||||||
properties?: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BatchPayload =
|
|
||||||
| {
|
|
||||||
type: 'increment';
|
|
||||||
payload: BatchProfileIncrementPayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'decrement';
|
|
||||||
payload: BatchProfileDecrementPayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'event';
|
|
||||||
payload: BatchEventPayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'create_profile';
|
|
||||||
payload: BatchCreateProfilePayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'update_profile';
|
|
||||||
payload: BatchUpdateProfilePayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'update_session';
|
|
||||||
payload: BatchUpdateSessionPayload;
|
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'set_profile_property';
|
|
||||||
payload: BatchSetProfilePropertyPayload;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface BatchSetProfilePropertyPayload {
|
|
||||||
profileId: string;
|
|
||||||
name: string;
|
|
||||||
value: any;
|
|
||||||
update: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateProfileResponse {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchCreateProfilePayload {
|
|
||||||
profileId: string;
|
|
||||||
properties?: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchUpdateSessionPayload {
|
|
||||||
profileId: string;
|
|
||||||
properties?: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchEventPayload {
|
|
||||||
name: string;
|
|
||||||
time: string;
|
|
||||||
profileId: string;
|
|
||||||
properties: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchUpdateProfilePayload {
|
|
||||||
first_name?: string;
|
|
||||||
last_name?: string;
|
|
||||||
email?: string;
|
|
||||||
avatar?: string;
|
|
||||||
id?: string;
|
|
||||||
properties?: MixanJson;
|
|
||||||
profileId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProfileIncrementPayload {
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
profileId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProfileDecrementPayload {
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
profileId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchProfileIncrementPayload {
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
profileId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BatchProfileDecrementPayload {
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
profileId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MixanIssue {
|
|
||||||
field: string;
|
|
||||||
message: string;
|
|
||||||
value: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MixanErrorResponse {
|
|
||||||
status: 'error';
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
issues?: MixanIssue[] | undefined;
|
|
||||||
stack?: string | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MixanResponse<T> {
|
|
||||||
result: T;
|
|
||||||
status: 'ok';
|
|
||||||
}
|
|
||||||
|
|
||||||
// NEW
|
|
||||||
|
|
||||||
export interface MixanEventOptions {
|
|
||||||
profileId?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PostEventPayload {
|
|
||||||
name: string;
|
|
||||||
timestamp: string;
|
|
||||||
deviceId?: string;
|
|
||||||
profileId?: string;
|
|
||||||
properties?: Record<string, unknown> & MixanEventOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UpdateProfilePayload {
|
|
||||||
profileId: string;
|
|
||||||
firstName?: string;
|
|
||||||
lastName?: string;
|
|
||||||
email?: string;
|
|
||||||
avatar?: string;
|
|
||||||
properties?: MixanJson;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IncrementProfilePayload {
|
|
||||||
profileId: string;
|
|
||||||
property: string;
|
|
||||||
value: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DecrementProfilePayload {
|
|
||||||
profileId?: string;
|
|
||||||
property: string;
|
|
||||||
value: number;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "@mixan/tsconfig/sdk.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "dist"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { defineConfig } from 'tsup';
|
|
||||||
|
|
||||||
import config from '@mixan/tsconfig/tsup.config.json' assert { type: 'json' };
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
...(config as any),
|
|
||||||
entry: ['index.ts', 'cdn.ts'],
|
|
||||||
format: ['cjs', 'esm', 'iife'],
|
|
||||||
});
|
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
"@mixan/eslint-config": "workspace:*",
|
"@mixan/eslint-config": "workspace:*",
|
||||||
"@mixan/prettier-config": "workspace:*",
|
"@mixan/prettier-config": "workspace:*",
|
||||||
"@mixan/tsconfig": "workspace:*",
|
"@mixan/tsconfig": "workspace:*",
|
||||||
"@mixan/types": "workspace:*",
|
|
||||||
"@types/node": "^18.16.0",
|
"@types/node": "^18.16.0",
|
||||||
"eslint": "^8.48.0",
|
"eslint": "^8.48.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
|
|||||||
63
pnpm-lock.yaml
generated
63
pnpm-lock.yaml
generated
@@ -211,12 +211,12 @@ importers:
|
|||||||
'@mixan/prettier-config':
|
'@mixan/prettier-config':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/prettier
|
version: link:../../tooling/prettier
|
||||||
|
'@mixan/sdk':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../../packages/sdk
|
||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/types
|
|
||||||
'@types/ramda':
|
'@types/ramda':
|
||||||
specifier: ^0.29.6
|
specifier: ^0.29.6
|
||||||
version: 0.29.10
|
version: 0.29.10
|
||||||
@@ -332,9 +332,6 @@ importers:
|
|||||||
'@mixan/queue':
|
'@mixan/queue':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/queue
|
version: link:../../packages/queue
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/types
|
|
||||||
'@mixan/validation':
|
'@mixan/validation':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/validation
|
version: link:../../packages/validation
|
||||||
@@ -646,9 +643,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/types
|
|
||||||
'@types/express':
|
'@types/express':
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
@@ -686,9 +680,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.16.0
|
specifier: ^18.16.0
|
||||||
version: 18.19.17
|
version: 18.19.17
|
||||||
@@ -774,9 +765,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.16.0
|
specifier: ^18.16.0
|
||||||
version: 18.19.17
|
version: 18.19.17
|
||||||
@@ -817,9 +805,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.16.0
|
specifier: ^18.16.0
|
||||||
version: 18.19.17
|
version: 18.19.17
|
||||||
@@ -848,9 +833,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.16.0
|
specifier: ^18.16.0
|
||||||
version: 18.19.17
|
version: 18.19.17
|
||||||
@@ -878,9 +860,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^8.48.0
|
specifier: ^8.48.0
|
||||||
version: 8.56.0
|
version: 8.56.0
|
||||||
@@ -918,9 +897,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^8.48.0
|
specifier: ^8.48.0
|
||||||
version: 8.56.0
|
version: 8.56.0
|
||||||
@@ -955,9 +931,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^8.48.0
|
specifier: ^8.48.0
|
||||||
version: 8.56.0
|
version: 8.56.0
|
||||||
@@ -976,33 +949,6 @@ importers:
|
|||||||
'@mixan/sdk':
|
'@mixan/sdk':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../sdk
|
version: link:../sdk
|
||||||
devDependencies:
|
|
||||||
'@mixan/eslint-config':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../tooling/eslint
|
|
||||||
'@mixan/prettier-config':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../tooling/prettier
|
|
||||||
'@mixan/tsconfig':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../tooling/typescript
|
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
eslint:
|
|
||||||
specifier: ^8.48.0
|
|
||||||
version: 8.56.0
|
|
||||||
prettier:
|
|
||||||
specifier: ^3.0.3
|
|
||||||
version: 3.2.5
|
|
||||||
tsup:
|
|
||||||
specifier: ^7.2.0
|
|
||||||
version: 7.3.0(typescript@5.3.3)
|
|
||||||
typescript:
|
|
||||||
specifier: ^5.2.2
|
|
||||||
version: 5.3.3
|
|
||||||
|
|
||||||
packages/types:
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@mixan/eslint-config':
|
'@mixan/eslint-config':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
@@ -1044,9 +990,6 @@ importers:
|
|||||||
'@mixan/tsconfig':
|
'@mixan/tsconfig':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../tooling/typescript
|
version: link:../../tooling/typescript
|
||||||
'@mixan/types':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../types
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^18.16.0
|
specifier: ^18.16.0
|
||||||
version: 18.19.17
|
version: 18.19.17
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import fs from 'node:fs';
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
|
||||||
import typesPkg from '../../packages/types/package.json';
|
const sdkPackages = ['sdk', 'sdk-native', 'sdk-web', 'sdk-next'];
|
||||||
|
|
||||||
const sdkPackages = ['sdk', 'sdk-native', 'sdk-web'];
|
|
||||||
// const sdkPackages = ['sdk'];
|
// const sdkPackages = ['sdk'];
|
||||||
|
|
||||||
const workspacePath = (relativePath: string) =>
|
const workspacePath = (relativePath: string) =>
|
||||||
@@ -53,11 +51,6 @@ function main() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
savePackageJson(workspacePath('./packages/types/package.json'), {
|
|
||||||
...typesPkg,
|
|
||||||
...properties,
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const name of sdkPackages) {
|
for (const name of sdkPackages) {
|
||||||
const pkgJson = require(workspacePath(`./packages/${name}/package.json`));
|
const pkgJson = require(workspacePath(`./packages/${name}/package.json`));
|
||||||
savePackageJson(workspacePath(`./packages/${name}/package.json`), {
|
savePackageJson(workspacePath(`./packages/${name}/package.json`), {
|
||||||
@@ -79,10 +72,6 @@ function main() {
|
|||||||
console.log('✅ Update JSON files');
|
console.log('✅ Update JSON files');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
execSync('pnpm build', {
|
|
||||||
cwd: workspacePath(`./packages/types`),
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const name of sdkPackages) {
|
for (const name of sdkPackages) {
|
||||||
execSync('pnpm build', {
|
execSync('pnpm build', {
|
||||||
cwd: workspacePath(`./packages/${name}`),
|
cwd: workspacePath(`./packages/${name}`),
|
||||||
@@ -100,10 +89,6 @@ function main() {
|
|||||||
cwd: workspacePath(`./packages/${name}`),
|
cwd: workspacePath(`./packages/${name}`),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
execSync('npm publish --access=public', {
|
|
||||||
cwd: workspacePath('./packages/types'),
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
exit('Failed publish packages', error);
|
exit('Failed publish packages', error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user