Skip to content

Commit

Permalink
♻️ (models) Change to features-centric folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Nov 15, 2022
1 parent a9d0479 commit a5c8a8a
Show file tree
Hide file tree
Showing 55 changed files with 37 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatwootBlock, ChatwootOptions } from 'models/features/chatwoot'
import { ChatwootBlock, ChatwootOptions } from 'models'
import { sendEventToParent } from 'services/chat'
import { IntegrationContext } from 'services/integration'
import { isEmbedded } from 'services/utils'
Expand Down
1 change: 0 additions & 1 deletion packages/models/features/chatwoot/index.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/models/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/models/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "models",
"version": "1.0.0",
"main": "./index.ts",
"types": "./index.ts",
"main": "./src/index.ts",
"types": "./src/index.ts",
"license": "AGPL-3.0-or-later",
"private": true,
"dependencies": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import {
Item,
LogicBlockOptions,
} from '.'
import { BubbleBlock, bubbleBlockSchema } from './bubble'
import { InputBlock, inputBlockSchema } from './input'
import { IntegrationBlock, integrationBlockSchema } from './integration'
import { BubbleBlock, bubbleBlockSchema } from './bubbles'
import { InputBlock, inputBlockSchema } from './inputs'
import { IntegrationBlock, integrationBlockSchema } from './integrations'
import { ConditionBlock, LogicBlock, logicBlockSchema } from './logic'
import { z } from 'zod'
import {
BubbleBlockType,
InputBlockType,
IntegrationBlockType,
LogicBlockType,
blockBaseSchema,
IntegrationBlockType,
} from './shared'

export type DraggableBlock =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './bubble'
export * from './bubbleBlock'
export * from './text'
export * from './image'
export * from './video'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from './blocks'
export * from './bubble'
export * from './input'
export * from './bubbles'
export * from './inputs'
export * from './logic'
export * from './integration'
export * from './integrations'
export * from './item'
export * from './shared'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './input'
export * from './inputBlock'
export * from './text'
export * from './email'
export * from './number'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { z } from 'zod'
import {
blockBaseSchema,
IntegrationBlockType,
} from '../../typebot/blocks/shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'

export const chatwootOptionsSchema = z.object({
baseUrl: z.string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'

export const googleAnalyticsOptionsSchema = z.object({
trackingId: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'

export enum GoogleSheetsAction {
GET = 'Get data from sheet',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export * from './integration'
export * from './integrationBlock'
export * from './webhook'
export * from './googleAnalytics'
export * from './pabblyConnect'
export * from './makeCom'
export * from './zapier'
export * from './sendEmail'
export * from './googleSheets'
export * from './chatwoot'
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { z } from 'zod'
import {
chatwootBlockSchema,
chatwootOptionsSchema,
} from '../../../features/chatwoot'
import { chatwootBlockSchema, chatwootOptionsSchema } from './chatwoot'
import {
googleAnalyticsOptionsSchema,
googleAnalyticsBlockSchema,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'
import { webhookOptionsSchema } from './webhook'

export const makeComBlockSchema = blockBaseSchema.and(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'
import { webhookOptionsSchema } from './webhook'

export const pabblyConnectBlockSchema = blockBaseSchema.and(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'

export const sendEmailOptionsSchema = z.object({
credentialsId: z.string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'

const variableForTestSchema = z.object({
id: z.string(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod'
import { IntegrationBlockType, blockBaseSchema } from '../shared'
import { blockBaseSchema, IntegrationBlockType } from '../shared'
import { webhookOptionsSchema } from './webhook'

export const zapierBlockSchema = blockBaseSchema.and(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod'
import { itemBaseSchema } from './shared'
import { buttonItemSchema } from './input'
import { buttonItemSchema } from './inputs'
import { conditionItemSchema } from './logic'

export type ItemIndices = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './logic'
export * from './logicBlock'
export * from './code'
export * from './condition'
export * from './redirect'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Result as ResultFromPrisma } from 'db'
import { Answer, VariableWithValue } from '.'
import { InputBlockType } from './typebot/blocks/shared'
import { Answer } from './answer'
import { InputBlockType } from './blocks'
import { VariableWithValue } from './typebot/variable'

export type Result = Omit<ResultFromPrisma, 'createdAt' | 'variables'> & {
createdAt: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './typebot'
export * from './blocks'
export * from './theme'
export * from './settings'
export * from './variable'
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod'
import { settingsSchema } from './settings'
import { blockSchema } from './blocks'
import { blockSchema } from '../blocks'
import { themeSchema } from './theme'
import { variableSchema } from './variable'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/models/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './features/blocks'
export * from './features/typebot'
export * from './features/publicTypebot'
export * from './features/result'
export * from './features/answer'
export * from './features/utils'
export * from './features/credentials'
export * from './features/webhooks'

0 comments on commit a5c8a8a

Please sign in to comment.