Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 133c01923d |
@@ -0,0 +1,38 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn
|
||||
|
||||
# codegen
|
||||
generated
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# dev
|
||||
/dist/
|
||||
|
||||
.twenty/*
|
||||
!.twenty/output/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
@@ -0,0 +1 @@
|
||||
24.5.0
|
||||
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
@@ -0,0 +1,9 @@
|
||||
## Base documentation
|
||||
|
||||
- Documentation: https://docs.twenty.com/developers/extend/capabilities/apps
|
||||
- Rich app example: https://github.com/twentyhq/twenty/tree/main/packages/twenty-sdk/src/cli/__tests__/apps/rich-app
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
- Creating an object without an index view associated. Unless this is a technical object, user will need to visualize it.
|
||||
- Creating a view without a navigationMenuItem associated. This will make the view available on the left sidebar.
|
||||
@@ -0,0 +1,51 @@
|
||||
This is a [Twenty](https://twenty.com) application project bootstrapped with [`create-twenty-app`](https://www.npmjs.com/package/create-twenty-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, authenticate to your workspace:
|
||||
|
||||
```bash
|
||||
yarn twenty auth:login
|
||||
```
|
||||
|
||||
Then, start development mode to sync your app and watch for changes:
|
||||
|
||||
```bash
|
||||
yarn twenty app:dev
|
||||
```
|
||||
|
||||
Open your Twenty instance and go to `/settings/applications` section to see the result.
|
||||
|
||||
## Available Commands
|
||||
|
||||
Run `yarn twenty help` to list all available commands. Common commands:
|
||||
|
||||
```bash
|
||||
# Authentication
|
||||
yarn twenty auth:login # Authenticate with Twenty
|
||||
yarn twenty auth:logout # Remove credentials
|
||||
yarn twenty auth:status # Check auth status
|
||||
yarn twenty auth:switch # Switch default workspace
|
||||
yarn twenty auth:list # List all configured workspaces
|
||||
|
||||
# Application
|
||||
yarn twenty app:dev # Start dev mode (watch, build, sync, and auto-generate typed client)
|
||||
yarn twenty entity:add # Add a new entity (object, field, function, front-component, role, view, navigation-menu-item)
|
||||
yarn twenty function:logs # Stream function logs
|
||||
yarn twenty function:execute # Execute a function with JSON payload
|
||||
yarn twenty app:uninstall # Uninstall app from workspace
|
||||
```
|
||||
|
||||
## LLMs instructions
|
||||
|
||||
Main docs and pitfalls are available in LLMS.md file.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Twenty applications, take a look at the following resources:
|
||||
|
||||
- [twenty-sdk](https://www.npmjs.com/package/twenty-sdk) - learn about `twenty-sdk` tool.
|
||||
- [Twenty doc](https://docs.twenty.com/) - Twenty's documentation.
|
||||
- Join our [Discord](https://discord.gg/cx5n4Jzs57)
|
||||
|
||||
You can check out [the Twenty GitHub repository](https://github.com/twentyhq/twenty) - your feedback and contributions are welcome!
|
||||
@@ -0,0 +1,29 @@
|
||||
import js from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default [
|
||||
// Base JS recommended rules
|
||||
js.configs.recommended,
|
||||
|
||||
// TypeScript recommended rules
|
||||
...tseslint.configs.recommended,
|
||||
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// Common TypeScript-friendly tweaks
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{ argsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'no-unused-vars': 'off', // handled by TS rule
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "twentyfortwenty",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^24.5.0",
|
||||
"npm": "please-use-yarn",
|
||||
"yarn": ">=4.0.2"
|
||||
},
|
||||
"packageManager": "yarn@4.9.2",
|
||||
"scripts": {
|
||||
"twenty": "twenty",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"twenty-sdk": "latest",
|
||||
"zod": "^4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.7.2",
|
||||
"@types/react": "^18.2.0",
|
||||
"eslint": "^9.32.0",
|
||||
"react": "^18.2.0",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.50.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/roles/default-role';
|
||||
import { defineApplication } from 'twenty-sdk';
|
||||
|
||||
export default defineApplication({
|
||||
universalIdentifier: '0fac8de4-9d11-492b-9e6a-577e11e1c442',
|
||||
displayName: 'Twenty for Twenty',
|
||||
description: '',
|
||||
defaultRoleUniversalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
|
||||
applicationVariables: {
|
||||
CLICKHOUSE_URL: {
|
||||
universalIdentifier: 'b204304f-d3d3-4ae2-aafa-24b21c159181',
|
||||
description:
|
||||
'The URL of the ClickHouse server, including the protocol and port (e.g., http://localhost:8123)',
|
||||
isSecret: true,
|
||||
},
|
||||
CLICKHOUSE_USERNAME: {
|
||||
universalIdentifier: '711e8ea8-8b19-4cf0-82ab-ab44417312bd',
|
||||
description: 'The username for authenticating with the ClickHouse server',
|
||||
isSecret: true,
|
||||
},
|
||||
CLICKHOUSE_PASSWORD: {
|
||||
universalIdentifier: 'faba7ed7-9f94-4202-944b-c25c683e9504',
|
||||
description: 'The password for authenticating with the ClickHouse server',
|
||||
isSecret: true,
|
||||
},
|
||||
CLICKHOUSE_DATABASE: {
|
||||
universalIdentifier: '3e6698fa-0c00-49e5-9c4d-34d5b177bff3',
|
||||
description: 'The name of the ClickHouse database to connect to',
|
||||
isSecret: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
// Field metadata identifiers for cloudUser2 object
|
||||
// These constants are used by both the object definition and views
|
||||
|
||||
export const CLOUD_USER_2_ACTIVITY_STATUS_FIELD_ID =
|
||||
'56e3d6ce-d57e-4ded-830f-958eb18d4d36';
|
||||
export const CLOUD_USER_2_AVG_DAILY_PAGEVIEWS_LAST_30D_FIELD_ID =
|
||||
'1f7062c1-0e96-4599-a59c-6d7427794bb1';
|
||||
export const CLOUD_USER_2_DATA_LAST_UPDATED_AT_FIELD_ID =
|
||||
'e134ce6b-5ab0-4e9c-ba32-36d0851aca21';
|
||||
export const CLOUD_USER_2_DAYS_SINCE_LAST_ACTIVITY_FIELD_ID =
|
||||
'f305d341-7b12-4939-9299-e5e1b6d1591e';
|
||||
export const CLOUD_USER_2_EMAIL_FIELD_ID =
|
||||
'ee110a77-34d7-4c8b-bc10-8560b9e2333a';
|
||||
export const CLOUD_USER_2_FULL_NAME_FIELD_ID =
|
||||
'3c9540be-6e42-40f2-8598-973117bbe105';
|
||||
export const CLOUD_USER_2_IS_ACTIVE_L24H_FIELD_ID =
|
||||
'efaa6e54-8019-454c-a556-2e340f0b156d';
|
||||
export const CLOUD_USER_2_IS_ACTIVE_L30D_FIELD_ID =
|
||||
'86a07ca4-420e-4c82-82f8-8f8dfbfc2dc4';
|
||||
export const CLOUD_USER_2_IS_ACTIVE_L7D_FIELD_ID =
|
||||
'87bf8c09-1863-4c65-811f-6fb54a87238e';
|
||||
export const CLOUD_USER_2_IS_TWENTY_FIELD_ID =
|
||||
'f6dcd9f3-3f7e-4aea-84a5-41282a68910d';
|
||||
export const CLOUD_USER_2_LAST_ACTIVITY_DATE_FIELD_ID =
|
||||
'643ab4a2-b6f2-4d11-9173-6859884b8781';
|
||||
export const CLOUD_USER_2_PAGE_VIEWS_L24H_FIELD_ID =
|
||||
'294e95cb-13b3-4163-95f8-e4f31837cb47';
|
||||
export const CLOUD_USER_2_PAGE_VIEWS_L30D_FIELD_ID =
|
||||
'8dacb4f1-b4ef-42d6-a917-17c78d6273a7';
|
||||
export const CLOUD_USER_2_PAGE_VIEWS_L7D_FIELD_ID =
|
||||
'c7741332-d9b6-42ed-84e2-8afa184b58f3';
|
||||
export const CLOUD_USER_2_UPDATED_BY_FIELD_ID =
|
||||
'639c9a30-2926-44c3-ab44-100dbda91c64';
|
||||
export const CLOUD_USER_2_USER_TENURE_FIELD_ID =
|
||||
'0cc9ca63-c06f-4422-9325-5e99f98d05ed';
|
||||
export const CLOUD_USER_2_WORKSPACE_COUNT_FIELD_ID =
|
||||
'5af6ae62-b741-471b-90bb-7fb6678fc8c9';
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
defineField,
|
||||
FieldType,
|
||||
OnDeleteAction,
|
||||
RelationType,
|
||||
} from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_USER_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
CLOUD_USER_WORKSPACES_ON_CLOUD_USER_ID,
|
||||
} from 'src/fields/cloud-user-workspaces-on-cloud-user.field';
|
||||
import { CLOUD_USER_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-2';
|
||||
import { CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-workspace-2';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: CLOUD_USER_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
objectUniversalIdentifier: CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RELATION,
|
||||
name: 'cloudUser2',
|
||||
label: 'Cloud User 2',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
relationTargetFieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACES_ON_CLOUD_USER_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
onDelete: OnDeleteAction.CASCADE,
|
||||
joinColumnName: 'cloudUser2Id',
|
||||
},
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Field metadata identifiers for cloudUserWorkspace2 object
|
||||
// These constants are used by both the object definition and views
|
||||
|
||||
export const CLOUD_USER_WORKSPACE_2_TWENTY_USER_IDENTIFIER_FIELD_ID =
|
||||
'ad149693-0df5-4346-90ff-39e6d945b90f';
|
||||
export const CLOUD_USER_WORKSPACE_2_TWENTY_WORKSPACE_IDENTIFIER_FIELD_ID =
|
||||
'c5d02b59-ebaf-4604-809c-ce3f6e50dedc';
|
||||
export const CLOUD_USER_WORKSPACE_2_ID_OF_THE_USER_WORKSPACE_FIELD_ID =
|
||||
'6a0f8018-be3c-49b0-bb91-8d3e6b44adec';
|
||||
export const CLOUD_USER_WORKSPACE_2_UPDATED_BY_FIELD_ID =
|
||||
'29d47f11-1e45-4c67-b495-fcfa45bb67e2';
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { defineField, FieldType, RelationType } from 'twenty-sdk';
|
||||
|
||||
import { CLOUD_USER_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-2';
|
||||
import { CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-workspace-2';
|
||||
|
||||
export const CLOUD_USER_WORKSPACES_ON_CLOUD_USER_ID =
|
||||
'2290d722-d4b1-47ab-a895-4e2c3163a541';
|
||||
export const CLOUD_USER_ON_CLOUD_USER_WORKSPACE_ID =
|
||||
'49b08cf9-15e1-4583-826f-943fe3c6b0e8';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: CLOUD_USER_WORKSPACES_ON_CLOUD_USER_ID,
|
||||
objectUniversalIdentifier: CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RELATION,
|
||||
name: 'cloudUserWorkspaces2',
|
||||
label: 'Cloud User Workspaces 2',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
relationTargetFieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
},
|
||||
});
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { defineField, FieldType, RelationType } from 'twenty-sdk';
|
||||
|
||||
import { CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-workspace-2';
|
||||
import { CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-workspace-2';
|
||||
|
||||
export const CLOUD_USER_WORKSPACES_ON_CLOUD_WORKSPACE_ID =
|
||||
'90d9dfc7-7058-4d1c-aac2-1505bd7cb827';
|
||||
export const CLOUD_WORKSPACE_ON_CLOUD_USER_WORKSPACE_ID =
|
||||
'7bcd2dda-d1f8-4aa7-a83f-6cf240be80b2';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: CLOUD_USER_WORKSPACES_ON_CLOUD_WORKSPACE_ID,
|
||||
objectUniversalIdentifier: CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RELATION,
|
||||
name: 'cloudUserWorkspaces2',
|
||||
label: 'Cloud User Workspaces 2',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
relationTargetFieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
},
|
||||
});
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
defineField,
|
||||
FieldType,
|
||||
RelationType,
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
||||
} from 'twenty-sdk';
|
||||
|
||||
import { CLOUD_USER_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-2';
|
||||
|
||||
export const CLOUD_USERS_2_ON_PERSON_ID =
|
||||
'f238e91c-11d8-4a27-a39b-c9fa3515d4a0';
|
||||
export const PERSON_ON_CLOUD_USER_2_ID = '08d3aff0-7548-4a99-a097-20a0ad2c9ee7';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: CLOUD_USERS_2_ON_PERSON_ID,
|
||||
objectUniversalIdentifier:
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
||||
type: FieldType.RELATION,
|
||||
name: 'cloudUsers2',
|
||||
label: 'Cloud Users 2',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
relationTargetFieldMetadataUniversalIdentifier: PERSON_ON_CLOUD_USER_2_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.ONE_TO_MANY,
|
||||
},
|
||||
});
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
// Field metadata identifiers for cloudWorkspace2 object
|
||||
// These constants are used by both the object definition and views
|
||||
|
||||
export const CLOUD_WORKSPACE_2_CUSTOM_DOMAIN_FIELD_ID =
|
||||
'c30799d5-adc0-49be-82a1-6d41b5aa9e82';
|
||||
export const CLOUD_WORKSPACE_2_WORKSPACE_BUSINESS_DOMAIN_FIELD_ID =
|
||||
'bfa2f91d-1c6c-48de-bb11-ac2a1e2545a9';
|
||||
export const CLOUD_WORKSPACE_2_COMPANY_LINKEDIN_FIELD_ID =
|
||||
'f9f2ef3a-8235-4d21-9a45-d29cc2124456';
|
||||
export const CLOUD_WORKSPACE_2_DATA_LAST_UPDATED_AT_FIELD_ID =
|
||||
'fbeaab89-77e0-4e13-97ed-caeb757a38c7';
|
||||
export const CLOUD_WORKSPACE_2_LAST_PAGE_VIEW_DATE_FIELD_ID =
|
||||
'7d3d4ba3-5af2-4248-afc7-7f4ce7c82805';
|
||||
export const CLOUD_WORKSPACE_2_TOTAL_EVER_ACTIVE_WORKSPACE_USERS_FIELD_ID =
|
||||
'56e99339-dcc4-4950-ae64-1b6ae326af2c';
|
||||
export const CLOUD_WORKSPACE_2_ACTIVE_USERS_L30D_FIELD_ID =
|
||||
'e9c703e6-9ffc-497d-9755-018724ac8d66';
|
||||
export const CLOUD_WORKSPACE_2_ACTIVE_USERS_L7D_FIELD_ID =
|
||||
'81d8f622-2366-481f-b0e8-b14fb7efa4d5';
|
||||
export const CLOUD_WORKSPACE_2_ACTIVE_USERS_L24H_FIELD_ID =
|
||||
'3e53d606-1afa-4d49-be62-52f4bb1cb49e';
|
||||
export const CLOUD_WORKSPACE_2_WORKSPACE_TENURE_FIELD_ID =
|
||||
'3fdd272c-73dd-432e-99c7-782f237a7cd8';
|
||||
export const CLOUD_WORKSPACE_2_PAGE_VIEWS_L30D_FIELD_ID =
|
||||
'1931f3cd-a984-41e3-b8f5-510f67b508e6';
|
||||
export const CLOUD_WORKSPACE_2_PAGE_VIEWS_L7D_FIELD_ID =
|
||||
'1f6a0ef6-3faf-4157-88a7-f624b7655c6b';
|
||||
export const CLOUD_WORKSPACE_2_PAGE_VIEWS_L24H_FIELD_ID =
|
||||
'ab0f46aa-9fef-40c6-a229-6ed4e05867d4';
|
||||
export const CLOUD_WORKSPACE_2_TOTAL_WORKSPACE_USERS_FIELD_ID =
|
||||
'38095859-2efb-4f40-86a1-aa883fd88e3d';
|
||||
export const CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_L30D_FIELD_ID =
|
||||
'4ebd8329-a18c-4606-9ee0-f32fb1c4aa6f';
|
||||
export const CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_TOTAL_FIELD_ID =
|
||||
'754f137f-b759-47da-8b57-7de71ad34d37';
|
||||
export const CLOUD_WORKSPACE_2_ALEXA_RANK_FIELD_ID =
|
||||
'1627e6b8-e87a-4048-b954-8d2fe09b67c8';
|
||||
export const CLOUD_WORKSPACE_2_EMPLOYEES_FIELD_ID =
|
||||
'1d8bb210-b50d-4b38-a611-d78ba865cbae';
|
||||
export const CLOUD_WORKSPACE_2_IS_ACTIVE_L7D_FIELD_ID =
|
||||
'42879662-d4fc-4806-bcfb-fdb586827491';
|
||||
export const CLOUD_WORKSPACE_2_IS_ACTIVE_L24H_FIELD_ID =
|
||||
'44b2c12f-aedd-459a-848a-ade9fc4620b7';
|
||||
export const CLOUD_WORKSPACE_2_IS_ACTIVE_L30D_FIELD_ID =
|
||||
'cac2d3e0-c2ee-4e22-bd96-4fa051a36f73';
|
||||
export const CLOUD_WORKSPACE_2_IS_ENRICHED_FIELD_ID =
|
||||
'45cbddfa-54cc-4d94-88d2-db7a7a550414';
|
||||
export const CLOUD_WORKSPACE_2_INDUSTRY_FIELD_ID =
|
||||
'a6686308-dfcf-4abb-be0f-e8f48cc579d9';
|
||||
export const CLOUD_WORKSPACE_2_COMPANY_FOUNDED_YEAR_FIELD_ID =
|
||||
'0432af7e-7575-486e-a022-f4a625a8ac14';
|
||||
export const CLOUD_WORKSPACE_2_DESCRIPTION_FIELD_ID =
|
||||
'40854f41-4175-4b14-9567-c6bfb3f5d441';
|
||||
export const CLOUD_WORKSPACE_2_LATEST_FUNDING_STAGE_FIELD_ID =
|
||||
'44aba339-be2e-4364-a894-cf730081c8a6';
|
||||
export const CLOUD_WORKSPACE_2_COMPANY_NAME_FIELD_ID =
|
||||
'f11ddfc2-3356-453a-a6e1-494b6c6b12f6';
|
||||
export const CLOUD_WORKSPACE_2_SUB_DOMAIN_FIELD_ID =
|
||||
'8fb18f52-44e9-4288-87c1-9650222efb05';
|
||||
export const CLOUD_WORKSPACE_2_ANNUAL_REVENUE_FIELD_ID =
|
||||
'8f5dfc54-213b-43b2-a502-631f0f3240d1';
|
||||
export const CLOUD_WORKSPACE_2_MRR_FIELD_ID =
|
||||
'67125b6c-ff41-459f-8153-a338ed11c4f0';
|
||||
export const CLOUD_WORKSPACE_2_POTENTIAL_ARR_FIELD_ID =
|
||||
'0c38b297-0e9d-47cc-8f8f-a0e5402413ce';
|
||||
export const CLOUD_WORKSPACE_2_ARR_FIELD_ID =
|
||||
'f932f94b-c48b-4ef3-9eea-0c8dad370d89';
|
||||
export const CLOUD_WORKSPACE_2_TOTAL_FUNDING_FIELD_ID =
|
||||
'ae5da0c9-e9ac-401b-ad48-c37a31c6ecd1';
|
||||
export const CLOUD_WORKSPACE_2_ACTIVATION_STATUS_FIELD_ID =
|
||||
'ef44daa9-d272-4680-a19c-caf2bac32b70';
|
||||
export const CLOUD_WORKSPACE_2_SUBSCRIPTION_STATUS_FIELD_ID =
|
||||
'a88e8cab-333f-44a3-980e-f2cc22871aee';
|
||||
export const CLOUD_WORKSPACE_2_PAYMENT_FREQUENCY_FIELD_ID =
|
||||
'fccc73da-2b6e-434b-921b-e3bcbab1c56c';
|
||||
export const CLOUD_WORKSPACE_2_NEXT_RENEWAL_DATE_FIELD_ID =
|
||||
'488b38b4-971e-4c33-b60d-7e7934911579';
|
||||
export const CLOUD_WORKSPACE_2_CREATOR_EMAIL_FIELD_ID =
|
||||
'3815b992-a919-4c52-8629-b4b5f89a6060';
|
||||
export const CLOUD_WORKSPACE_2_TAGS_FIELD_ID =
|
||||
'0f41485f-4868-4bd6-8d76-709a6b7a54e3';
|
||||
export const CLOUD_WORKSPACE_2_UPDATED_BY_FIELD_ID =
|
||||
'252cdff1-facb-4f66-8608-6138a585d099';
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { defineField, FieldType, OnDeleteAction, RelationType } from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_USER_WORKSPACES_ON_CLOUD_WORKSPACE_ID,
|
||||
CLOUD_WORKSPACE_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
} from 'src/fields/cloud-user-workspaces-on-cloud-workspace.field';
|
||||
import { CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-workspace-2';
|
||||
import { CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-workspace-2';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: CLOUD_WORKSPACE_ON_CLOUD_USER_WORKSPACE_ID,
|
||||
objectUniversalIdentifier: CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RELATION,
|
||||
name: 'cloudWorkspace2',
|
||||
label: 'Cloud Workspace 2',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
relationTargetFieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACES_ON_CLOUD_WORKSPACE_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
onDelete: OnDeleteAction.CASCADE,
|
||||
joinColumnName: 'cloudWorkspace2Id',
|
||||
},
|
||||
});
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
defineField,
|
||||
FieldType,
|
||||
OnDeleteAction,
|
||||
RelationType,
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
|
||||
} from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_USERS_2_ON_PERSON_ID,
|
||||
PERSON_ON_CLOUD_USER_2_ID,
|
||||
} from 'src/fields/cloud-users-2-on-person.field';
|
||||
import { CLOUD_USER_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-2';
|
||||
|
||||
export default defineField({
|
||||
universalIdentifier: PERSON_ON_CLOUD_USER_2_ID,
|
||||
objectUniversalIdentifier: CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RELATION,
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
relationTargetObjectMetadataUniversalIdentifier:
|
||||
STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
|
||||
relationTargetFieldMetadataUniversalIdentifier: CLOUD_USERS_2_ON_PERSON_ID,
|
||||
universalSettings: {
|
||||
relationType: RelationType.MANY_TO_ONE,
|
||||
onDelete: OnDeleteAction.SET_NULL,
|
||||
joinColumnName: 'personId',
|
||||
},
|
||||
});
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import { defineLogicFunction } from 'twenty-sdk';
|
||||
|
||||
import { syncCloudUserWorkspaces } from 'src/logic-functions/sync-product-data/sync-cloud-user-workspaces';
|
||||
import { syncCloudUsers } from 'src/logic-functions/sync-product-data/sync-cloud-users';
|
||||
import { syncCloudWorkspaces } from 'src/logic-functions/sync-product-data/sync-cloud-workspaces';
|
||||
|
||||
const handler = async (): Promise<{ message: string }> => {
|
||||
try {
|
||||
console.log('Starting product data sync');
|
||||
|
||||
const cloudUsersResult = await syncCloudUsers();
|
||||
|
||||
console.log(
|
||||
`Cloud users sync complete: ${cloudUsersResult.syncedCount} users`,
|
||||
);
|
||||
|
||||
const cloudWorkspacesResult = await syncCloudWorkspaces();
|
||||
|
||||
console.log(
|
||||
`Cloud workspaces sync complete: ${cloudWorkspacesResult.syncedCount} workspaces`,
|
||||
);
|
||||
|
||||
const cloudUserWorkspacesResult = await syncCloudUserWorkspaces();
|
||||
|
||||
console.log(
|
||||
`Cloud user workspaces sync complete: ${cloudUserWorkspacesResult.syncedCount} user workspaces`,
|
||||
);
|
||||
|
||||
return {
|
||||
message: `Product data sync complete — ${cloudUsersResult.syncedCount} users, ${cloudWorkspacesResult.syncedCount} workspaces, ${cloudUserWorkspacesResult.syncedCount} user workspaces`,
|
||||
};
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export default defineLogicFunction({
|
||||
universalIdentifier: '3897e059-715e-4a4b-b165-c44f17d2e30a',
|
||||
name: 'sync-product-data',
|
||||
description:
|
||||
'Syncs cloud users, cloud workspaces, and cloud user workspaces from ClickHouse',
|
||||
timeoutSeconds: 120,
|
||||
handler,
|
||||
cronTriggerSettings: {
|
||||
pattern: '*/10 * * * *',
|
||||
},
|
||||
});
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getApplicationConfig } from 'src/shared/application-config';
|
||||
import { fetchFromClickHouse } from 'src/shared/clickhouse-client';
|
||||
import { twentyClient } from 'src/shared/twenty-client';
|
||||
|
||||
const clickHouseUserWorkspaceSchema = z.object({
|
||||
id: z.string(),
|
||||
workspaceId: z.string(),
|
||||
userId: z.string(),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
deletedAt: z.string(),
|
||||
is_active_membership: z.coerce.boolean(),
|
||||
});
|
||||
|
||||
type ClickHouseUserWorkspace = z.infer<typeof clickHouseUserWorkspaceSchema>;
|
||||
|
||||
const fetchUserWorkspacesFromClickHouse = async (): Promise<
|
||||
ClickHouseUserWorkspace[]
|
||||
> => {
|
||||
const { clickHouseDatabase } = getApplicationConfig();
|
||||
|
||||
// const nowDate = 'now()'
|
||||
const nowDate = "'2026-02-04 14:28:52.000'";
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
*
|
||||
FROM (
|
||||
SELECT
|
||||
*,
|
||||
row_number() OVER (PARTITION BY id ORDER BY updatedAt DESC) AS rn
|
||||
FROM
|
||||
${clickHouseDatabase}.user_workspace
|
||||
WHERE
|
||||
updatedAt >= ${nowDate} - INTERVAL 500 MINUTE
|
||||
AND
|
||||
updatedAt <= ${nowDate}
|
||||
)
|
||||
WHERE
|
||||
rn = 1
|
||||
FORMAT
|
||||
JSONEachRow;
|
||||
`;
|
||||
|
||||
return fetchFromClickHouse(query, clickHouseUserWorkspaceSchema);
|
||||
};
|
||||
|
||||
const buildCloudUserWorkspaceInput = (
|
||||
userWorkspace: ClickHouseUserWorkspace,
|
||||
) => ({
|
||||
id: userWorkspace.id,
|
||||
twentyUserIdentifier: userWorkspace.userId,
|
||||
twentyWorkspaceIdentifier: userWorkspace.workspaceId,
|
||||
idOfTheUserWorkspace: userWorkspace.id,
|
||||
cloudUser2Id: userWorkspace.userId,
|
||||
cloudWorkspace2Id: userWorkspace.workspaceId,
|
||||
});
|
||||
|
||||
export const syncCloudUserWorkspaces = async (): Promise<{
|
||||
syncedCount: number;
|
||||
}> => {
|
||||
const userWorkspaces = await fetchUserWorkspacesFromClickHouse();
|
||||
|
||||
console.log(
|
||||
`Fetched ${userWorkspaces.length} user workspaces from ClickHouse`,
|
||||
);
|
||||
|
||||
if (userWorkspaces.length === 0) {
|
||||
return { syncedCount: 0 };
|
||||
}
|
||||
|
||||
const cloudUserWorkspaceInputs = userWorkspaces.map(
|
||||
buildCloudUserWorkspaceInput,
|
||||
);
|
||||
|
||||
console.log(
|
||||
`Batch-upserting ${cloudUserWorkspaceInputs.length} cloud user workspaces`,
|
||||
);
|
||||
|
||||
await twentyClient.mutation({
|
||||
createCloudUserWorkspaces2: {
|
||||
__args: {
|
||||
data: cloudUserWorkspaceInputs,
|
||||
upsert: true,
|
||||
},
|
||||
__scalar: true,
|
||||
},
|
||||
});
|
||||
|
||||
return { syncedCount: userWorkspaces.length };
|
||||
};
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
import { enumCloudUser2ActivityStatusEnum } from 'twenty-sdk/generated';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getApplicationConfig } from 'src/shared/application-config';
|
||||
import { fetchFromClickHouse } from 'src/shared/clickhouse-client';
|
||||
import { clickHouseDateToIso } from 'src/shared/clickhouse-date-to-iso';
|
||||
import { twentyClient } from 'src/shared/twenty-client';
|
||||
|
||||
const clickHouseUserSchema = z.object({
|
||||
userId: z.uuid(),
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
email: z.email(),
|
||||
fullName: z.string(),
|
||||
isEmailVerified: z.boolean(),
|
||||
disabled: z.boolean(),
|
||||
canImpersonate: z.boolean(),
|
||||
canAccessFullAdminPanel: z.boolean(),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
deletedAt: z.string(),
|
||||
locale: z.string(),
|
||||
createdDate: z.string(),
|
||||
workspaceCount: z.coerce.number(),
|
||||
workspaceIds: z.string(),
|
||||
workspaceDomains: z.string(),
|
||||
firstActivityDate: z.string(),
|
||||
lastActivityDate: z.string(),
|
||||
lastWorkspaceId: z.string(),
|
||||
totalPageviews: z.coerce.number(),
|
||||
pageviewsLast30d: z.coerce.number(),
|
||||
pageviewsLast7d: z.coerce.number(),
|
||||
pageviewsLast24h: z.coerce.number(),
|
||||
userAgeDays: z.coerce.number(),
|
||||
daysSinceLastActivity: z.coerce.number(),
|
||||
isActiveLast30d: z.boolean(),
|
||||
isActiveLast7d: z.boolean(),
|
||||
isActiveLast24h: z.boolean(),
|
||||
activityStatus: z
|
||||
.string()
|
||||
.transform((val) => val.toUpperCase())
|
||||
.pipe(z.enum(enumCloudUser2ActivityStatusEnum)),
|
||||
avgDailyPageviewsLast30d: z.coerce.number(),
|
||||
isTwenty: z.coerce.boolean(),
|
||||
maxWorkspaceMembers: z.coerce.number(),
|
||||
inTrial: z.boolean(),
|
||||
});
|
||||
|
||||
type ClickHouseUser = z.infer<typeof clickHouseUserSchema>;
|
||||
|
||||
const fetchUsersFromClickHouse = async (): Promise<ClickHouseUser[]> => {
|
||||
const { clickHouseDatabase } = getApplicationConfig();
|
||||
|
||||
// const nowDate = 'now()'
|
||||
const nowDate = "'2026-02-04 14:28:52.000'";
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
${clickHouseDatabase}.user
|
||||
WHERE
|
||||
lastActivityDate >= ${nowDate} - INTERVAL 500 MINUTE
|
||||
AND
|
||||
lastActivityDate <= ${nowDate}
|
||||
FORMAT
|
||||
JSONEachRow;
|
||||
`;
|
||||
|
||||
return fetchFromClickHouse(query, clickHouseUserSchema);
|
||||
};
|
||||
|
||||
const fetchAllPeopleFromTwentyByEmail = async (emails: string[]) => {
|
||||
if (emails.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const allPeople = await twentyClient.query({
|
||||
people: {
|
||||
edges: {
|
||||
node: {
|
||||
id: true,
|
||||
emails: {
|
||||
primaryEmail: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
__args: {
|
||||
filter: {
|
||||
emails: {
|
||||
primaryEmail: {
|
||||
in: emails,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return allPeople.people?.edges.map((edge) => edge.node) ?? [];
|
||||
};
|
||||
|
||||
const buildCloudUserInput = ({
|
||||
user,
|
||||
personId,
|
||||
}: {
|
||||
user: ClickHouseUser;
|
||||
personId: string;
|
||||
}) => ({
|
||||
id: user.userId,
|
||||
name: user.fullName,
|
||||
email: {
|
||||
primaryEmail: user.email,
|
||||
},
|
||||
personId,
|
||||
fullName: {
|
||||
lastName: user.lastName,
|
||||
firstName: user.firstName,
|
||||
},
|
||||
isTwenty: user.isTwenty,
|
||||
userTenure: user.userAgeDays,
|
||||
isActiveL7d: user.isActiveLast7d,
|
||||
isActiveL24h: user.isActiveLast24h,
|
||||
isActiveL30d: user.isActiveLast30d,
|
||||
pageViewsL7d: user.pageviewsLast7d,
|
||||
pageViewsL24h: user.pageviewsLast24h,
|
||||
pageViewsL30d: user.pageviewsLast30d,
|
||||
activityStatus: user.activityStatus,
|
||||
workspaceCount: user.workspaceCount,
|
||||
lastActivityDate: clickHouseDateToIso(user.lastActivityDate),
|
||||
dataLastUpdatedAt: new Date().toISOString(),
|
||||
avgDailyPageviewsLast30d: user.avgDailyPageviewsLast30d,
|
||||
daysSinceLastActivity: user.daysSinceLastActivity,
|
||||
});
|
||||
|
||||
export const syncCloudUsers = async (): Promise<{
|
||||
syncedCount: number;
|
||||
}> => {
|
||||
const users = await fetchUsersFromClickHouse();
|
||||
|
||||
console.log('Fetched users from ClickHouse', users);
|
||||
|
||||
const emails = users.map((user) => user.email);
|
||||
|
||||
console.log('Fetching people from Twenty with emails', emails);
|
||||
|
||||
const people = await fetchAllPeopleFromTwentyByEmail(emails);
|
||||
|
||||
console.log('Fetched people from Twenty', people);
|
||||
|
||||
// Build a map of email -> personId from existing people
|
||||
const emailToPersonId = new Map<string, string>();
|
||||
|
||||
for (const person of people) {
|
||||
if (person.emails?.primaryEmail !== undefined) {
|
||||
emailToPersonId.set(person.emails.primaryEmail.toLowerCase(), person.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Partition users into those with/without an existing person
|
||||
const usersWithoutPerson = users.filter(
|
||||
(user) => !emailToPersonId.has(user.email.toLowerCase()),
|
||||
);
|
||||
|
||||
// Step 1: Batch-create missing people
|
||||
const newlyCreatedPersonIds: string[] = [];
|
||||
|
||||
if (usersWithoutPerson.length > 0) {
|
||||
console.log(`Batch-creating ${usersWithoutPerson.length} people records`);
|
||||
|
||||
const createPeopleResult = await twentyClient.mutation({
|
||||
createPeople: {
|
||||
__args: {
|
||||
data: usersWithoutPerson.map((user) => ({
|
||||
name: {
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
},
|
||||
emails: {
|
||||
primaryEmail: user.email,
|
||||
},
|
||||
})),
|
||||
},
|
||||
id: true,
|
||||
emails: {
|
||||
primaryEmail: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const createdPeople = createPeopleResult.createPeople ?? [];
|
||||
|
||||
for (const person of createdPeople) {
|
||||
if (
|
||||
person.emails?.primaryEmail === undefined ||
|
||||
person.id === undefined
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
newlyCreatedPersonIds.push(person.id);
|
||||
emailToPersonId.set(person.emails.primaryEmail.toLowerCase(), person.id);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Batch-upsert all cloud users, with rollback on failure
|
||||
const cloudUserInputs = users.map((user) => {
|
||||
const personId = emailToPersonId.get(user.email.toLowerCase());
|
||||
|
||||
if (personId === undefined) {
|
||||
throw new Error(
|
||||
`No personId found for user ${user.email} — this should not happen`,
|
||||
);
|
||||
}
|
||||
|
||||
return buildCloudUserInput({ user, personId });
|
||||
});
|
||||
|
||||
try {
|
||||
console.log(`Batch-upserting ${cloudUserInputs.length} cloud users`);
|
||||
|
||||
await twentyClient.mutation({
|
||||
createCloudUsers2: {
|
||||
__args: {
|
||||
data: cloudUserInputs,
|
||||
upsert: true,
|
||||
},
|
||||
__scalar: true,
|
||||
},
|
||||
});
|
||||
} catch (cloudUserError) {
|
||||
console.log(
|
||||
'Cloud user upsert failed, rolling back newly created people',
|
||||
cloudUserError,
|
||||
);
|
||||
|
||||
// Rollback: hard-delete people that were created in step 1
|
||||
if (newlyCreatedPersonIds.length > 0) {
|
||||
try {
|
||||
await twentyClient.mutation({
|
||||
destroyPeople: {
|
||||
__args: {
|
||||
filter: {
|
||||
id: {
|
||||
in: newlyCreatedPersonIds,
|
||||
},
|
||||
},
|
||||
},
|
||||
id: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(
|
||||
`Rolled back ${newlyCreatedPersonIds.length} newly created people`,
|
||||
);
|
||||
} catch (rollbackError) {
|
||||
console.log(
|
||||
'Rollback of newly created people also failed',
|
||||
rollbackError,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
throw cloudUserError;
|
||||
}
|
||||
|
||||
return { syncedCount: users.length };
|
||||
};
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
import {
|
||||
enumCloudWorkspace2ActivationStatusEnum,
|
||||
enumCloudWorkspace2PaymentFrequencyEnum,
|
||||
enumCloudWorkspace2SubscriptionStatusEnum,
|
||||
} from 'twenty-sdk/generated';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getApplicationConfig } from 'src/shared/application-config';
|
||||
import { fetchFromClickHouse } from 'src/shared/clickhouse-client';
|
||||
import { clickHouseDateToIso } from 'src/shared/clickhouse-date-to-iso';
|
||||
import { twentyClient } from 'src/shared/twenty-client';
|
||||
|
||||
const clickHouseWorkspaceSchema = z.object({
|
||||
workspaceId: z.string(),
|
||||
workspaceName: z.string(),
|
||||
subdomain: z.string(),
|
||||
customDomain: z.string(),
|
||||
createdAt: z.string(),
|
||||
updatedAt: z.string(),
|
||||
deletedAt: z.string(),
|
||||
activationStatus: z
|
||||
.string()
|
||||
.transform((val) => {
|
||||
const upper = val.toUpperCase();
|
||||
if (upper === '') return 'EMPTY';
|
||||
const valid: string[] = Object.values(
|
||||
enumCloudWorkspace2ActivationStatusEnum,
|
||||
);
|
||||
return valid.includes(upper) ? upper : 'EMPTY';
|
||||
})
|
||||
.pipe(z.enum(enumCloudWorkspace2ActivationStatusEnum)),
|
||||
createdDate: z.string(),
|
||||
lastPageviewDate: z.string(),
|
||||
pageviewsLast30d: z.coerce.number(),
|
||||
pageviewsLast7d: z.coerce.number(),
|
||||
pageviewsLast24h: z.coerce.number(),
|
||||
totalEverActiveUsers: z.coerce.number(),
|
||||
totalWorkspaceUsers: z.coerce.number(),
|
||||
activeUsersLast30d: z.coerce.number(),
|
||||
activeUsersLast7d: z.coerce.number(),
|
||||
activeUsersLast24h: z.coerce.number(),
|
||||
isActiveLast30d: z.coerce.boolean(),
|
||||
isActiveLast7d: z.coerce.boolean(),
|
||||
isActiveLast24h: z.coerce.boolean(),
|
||||
activeUserRatioLast30d: z.coerce.number(),
|
||||
activeUserRatioLast7d: z.coerce.number(),
|
||||
workspaceAgeDays: z.coerce.number(),
|
||||
totalEvents: z.coerce.number(),
|
||||
eventsLast30d: z.coerce.number(),
|
||||
eventsPerUser: z.coerce.number(),
|
||||
subscription_status: z
|
||||
.string()
|
||||
.transform((val) => {
|
||||
const upper = val.toUpperCase();
|
||||
if (upper === '') return 'EMPTY';
|
||||
const valid: string[] = Object.values(
|
||||
enumCloudWorkspace2SubscriptionStatusEnum,
|
||||
);
|
||||
return valid.includes(upper) ? upper : 'OTHER';
|
||||
})
|
||||
.pipe(z.enum(enumCloudWorkspace2SubscriptionStatusEnum)),
|
||||
payment_frequency: z
|
||||
.string()
|
||||
.transform((val) => {
|
||||
const upper = val.toUpperCase();
|
||||
if (upper === '') return 'EMPTY';
|
||||
const valid: string[] = Object.values(
|
||||
enumCloudWorkspace2PaymentFrequencyEnum,
|
||||
);
|
||||
return valid.includes(upper) ? upper : 'OTHER';
|
||||
})
|
||||
.pipe(z.enum(enumCloudWorkspace2PaymentFrequencyEnum)),
|
||||
trial_status: z.string(),
|
||||
mrr: z.coerce.number(),
|
||||
potential_arr: z.coerce.number(),
|
||||
arr: z.coerce.number().nullable(),
|
||||
next_renewal_date: z.string(),
|
||||
workspace_domain: z.string(),
|
||||
domain_source: z.string(),
|
||||
creatorUserId: z.string(),
|
||||
creatorEmail: z.string(),
|
||||
creator_domain_type: z.string(),
|
||||
primary_business_domain: z.string(),
|
||||
business_domain_user_count: z.coerce.number(),
|
||||
isTwenty: z.coerce.boolean(),
|
||||
});
|
||||
|
||||
type ClickHouseWorkspace = z.infer<typeof clickHouseWorkspaceSchema>;
|
||||
|
||||
const fetchWorkspacesFromClickHouse =
|
||||
async (): Promise<ClickHouseWorkspace[]> => {
|
||||
const { clickHouseDatabase } = getApplicationConfig();
|
||||
|
||||
// const nowDate = 'now()'
|
||||
const nowDate = "'2026-02-04 14:28:52.000'";
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
*
|
||||
FROM (
|
||||
SELECT
|
||||
*,
|
||||
row_number() OVER (PARTITION BY workspaceId ORDER BY updatedAt DESC) AS rn
|
||||
FROM
|
||||
${clickHouseDatabase}.workspace
|
||||
WHERE
|
||||
updatedAt >= ${nowDate} - INTERVAL 500 MINUTE
|
||||
AND
|
||||
updatedAt <= ${nowDate}
|
||||
)
|
||||
WHERE
|
||||
rn = 1
|
||||
FORMAT
|
||||
JSONEachRow;
|
||||
`;
|
||||
|
||||
return fetchFromClickHouse(query, clickHouseWorkspaceSchema);
|
||||
};
|
||||
|
||||
// Convert a dollar amount to micros (1 USD = 1_000_000 micros).
|
||||
const dollarsToAmountMicros = (dollars: number) =>
|
||||
Math.round(dollars * 1_000_000);
|
||||
|
||||
const buildCloudWorkspaceInput = (workspace: ClickHouseWorkspace) => ({
|
||||
id: workspace.workspaceId,
|
||||
name: workspace.workspaceName,
|
||||
subDomain: workspace.subdomain,
|
||||
customDomain: {
|
||||
primaryLinkUrl: workspace.customDomain,
|
||||
primaryLinkLabel: '',
|
||||
},
|
||||
activationStatus: workspace.activationStatus,
|
||||
subscriptionStatus: workspace.subscription_status,
|
||||
paymentFrequency: workspace.payment_frequency,
|
||||
lastPageViewDate: workspace.lastPageviewDate,
|
||||
pageViewsL30D: workspace.pageviewsLast30d,
|
||||
pageViewsL7D: workspace.pageviewsLast7d,
|
||||
pageViewsL24H: workspace.pageviewsLast24h,
|
||||
totalEverActiveWorkspaceUsers: workspace.totalEverActiveUsers,
|
||||
totalWorkspaceUsers: workspace.totalWorkspaceUsers,
|
||||
activeUsersL30D: workspace.activeUsersLast30d,
|
||||
activeUsersL7D: workspace.activeUsersLast7d,
|
||||
activeUsersL24H: workspace.activeUsersLast24h,
|
||||
isActiveL30D: workspace.isActiveLast30d,
|
||||
isActiveL7D: workspace.isActiveLast7d,
|
||||
isActiveL24H: workspace.isActiveLast24h,
|
||||
workspaceTenure: workspace.workspaceAgeDays,
|
||||
numberOfEventsTotal: workspace.totalEvents,
|
||||
numberOfEventsL30D: workspace.eventsLast30d,
|
||||
mrr: {
|
||||
amountMicros: dollarsToAmountMicros(workspace.mrr),
|
||||
currencyCode: 'USD',
|
||||
},
|
||||
potentialArr: {
|
||||
amountMicros: dollarsToAmountMicros(workspace.potential_arr),
|
||||
currencyCode: 'USD',
|
||||
},
|
||||
arr: {
|
||||
amountMicros: dollarsToAmountMicros(workspace.arr ?? 0),
|
||||
currencyCode: 'USD',
|
||||
},
|
||||
nextRenewalDate: clickHouseDateToIso(workspace.next_renewal_date),
|
||||
creatorEmail: {
|
||||
primaryEmail: workspace.creatorEmail,
|
||||
},
|
||||
workspaceBusinessDomain: {
|
||||
primaryLinkUrl: workspace.primary_business_domain,
|
||||
primaryLinkLabel: '',
|
||||
},
|
||||
dataLastUpdatedAt: new Date().toISOString(),
|
||||
});
|
||||
|
||||
export const syncCloudWorkspaces = async (): Promise<{
|
||||
syncedCount: number;
|
||||
}> => {
|
||||
const workspaces = await fetchWorkspacesFromClickHouse();
|
||||
|
||||
console.log(`Fetched ${workspaces.length} workspaces from ClickHouse`);
|
||||
|
||||
if (workspaces.length === 0) {
|
||||
return { syncedCount: 0 };
|
||||
}
|
||||
|
||||
const cloudWorkspaceInputs = workspaces.map(buildCloudWorkspaceInput);
|
||||
|
||||
console.log(
|
||||
`Batch-upserting ${cloudWorkspaceInputs.length} cloud workspaces`,
|
||||
);
|
||||
|
||||
await twentyClient.mutation({
|
||||
createCloudWorkspaces2: {
|
||||
__args: {
|
||||
data: cloudWorkspaceInputs,
|
||||
upsert: true,
|
||||
},
|
||||
__scalar: true,
|
||||
},
|
||||
});
|
||||
|
||||
return { syncedCount: workspaces.length };
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { defineNavigationMenuItem } from 'twenty-sdk';
|
||||
import { NavigationMenuItemType } from 'twenty-shared/types';
|
||||
|
||||
import { ALL_CLOUD_USER_2_VIEW_ID } from 'src/views/all-cloud-user-2';
|
||||
|
||||
export default defineNavigationMenuItem({
|
||||
universalIdentifier: 'ac6df084-0f0f-404a-b3d1-b084cb624d76',
|
||||
type: NavigationMenuItemType.VIEW,
|
||||
name: 'cloud-user-2',
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
viewUniversalIdentifier: ALL_CLOUD_USER_2_VIEW_ID,
|
||||
});
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { defineNavigationMenuItem } from 'twenty-sdk';
|
||||
import { NavigationMenuItemType } from 'twenty-shared/types';
|
||||
|
||||
import { ALL_CLOUD_USER_WORKSPACE_2_VIEW_ID } from 'src/views/all-cloud-user-workspace-2';
|
||||
|
||||
export default defineNavigationMenuItem({
|
||||
universalIdentifier: 'e29251f0-78ad-493f-8f99-ec54ab0b5378',
|
||||
type: NavigationMenuItemType.VIEW,
|
||||
name: 'cloud-user-workspace-2',
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
viewUniversalIdentifier: ALL_CLOUD_USER_WORKSPACE_2_VIEW_ID,
|
||||
});
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { defineNavigationMenuItem } from 'twenty-sdk';
|
||||
import { NavigationMenuItemType } from 'twenty-shared/types';
|
||||
|
||||
import { ALL_CLOUD_WORKSPACE_2_VIEW_ID } from 'src/views/all-cloud-workspace-2';
|
||||
|
||||
export default defineNavigationMenuItem({
|
||||
universalIdentifier: '0ba6315e-0d79-47a5-8c05-29dec621a647',
|
||||
type: NavigationMenuItemType.VIEW,
|
||||
name: 'cloud-workspace-2',
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
viewUniversalIdentifier: ALL_CLOUD_WORKSPACE_2_VIEW_ID,
|
||||
});
|
||||
@@ -0,0 +1,171 @@
|
||||
import { defineObject, FieldType } from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_USER_2_ACTIVITY_STATUS_FIELD_ID,
|
||||
CLOUD_USER_2_AVG_DAILY_PAGEVIEWS_LAST_30D_FIELD_ID,
|
||||
CLOUD_USER_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
CLOUD_USER_2_DAYS_SINCE_LAST_ACTIVITY_FIELD_ID,
|
||||
CLOUD_USER_2_EMAIL_FIELD_ID,
|
||||
CLOUD_USER_2_FULL_NAME_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
CLOUD_USER_2_IS_TWENTY_FIELD_ID,
|
||||
CLOUD_USER_2_LAST_ACTIVITY_DATE_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
CLOUD_USER_2_UPDATED_BY_FIELD_ID,
|
||||
CLOUD_USER_2_USER_TENURE_FIELD_ID,
|
||||
CLOUD_USER_2_WORKSPACE_COUNT_FIELD_ID,
|
||||
} from 'src/fields/cloud-user-2-field-ids';
|
||||
|
||||
export const CLOUD_USER_2_UNIVERSAL_IDENTIFIER =
|
||||
'da264c72-df22-49b3-98e3-21cf6013e671';
|
||||
|
||||
export default defineObject({
|
||||
universalIdentifier: CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
nameSingular: 'cloudUser2',
|
||||
namePlural: 'cloudUsers2',
|
||||
labelSingular: 'Cloud user 2',
|
||||
labelPlural: 'Cloud users 2',
|
||||
icon: 'IconBox',
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_ACTIVITY_STATUS_FIELD_ID,
|
||||
type: FieldType.SELECT,
|
||||
name: 'activityStatus',
|
||||
label: 'Activity Status',
|
||||
options: [
|
||||
{
|
||||
id: '141d21f3-71b0-4b37-a3d2-5d91d43d0493',
|
||||
value: 'ACTIVE',
|
||||
label: 'Active',
|
||||
position: 0,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
id: 'adb1d290-750f-468e-99ee-ed892bcb8974',
|
||||
value: 'RECENT',
|
||||
label: 'Recent',
|
||||
position: 1,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
id: '96f24b75-a671-4727-a78f-5a72419370ea',
|
||||
value: 'DORMANT',
|
||||
label: 'Dormant',
|
||||
position: 2,
|
||||
color: 'orange',
|
||||
},
|
||||
{
|
||||
id: '88ddbef9-16a8-4643-9726-5b271cd477fa',
|
||||
value: 'INACTIVE',
|
||||
label: 'Inactive',
|
||||
position: 3,
|
||||
color: 'blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_AVG_DAILY_PAGEVIEWS_LAST_30D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'avgDailyPageviewsLast30d',
|
||||
label: 'Avg Daily Page Views',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
type: FieldType.DATE_TIME,
|
||||
name: 'dataLastUpdatedAt',
|
||||
label: 'Data last updated at',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_DAYS_SINCE_LAST_ACTIVITY_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'daysSinceLastActivity',
|
||||
label: 'Days Since Last Activity',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_EMAIL_FIELD_ID,
|
||||
type: FieldType.EMAILS,
|
||||
name: 'email',
|
||||
label: 'Email',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_FULL_NAME_FIELD_ID,
|
||||
type: FieldType.FULL_NAME,
|
||||
name: 'fullName',
|
||||
label: 'Full Name',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL24h',
|
||||
label: 'Is Active L24H',
|
||||
defaultValue: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL30d',
|
||||
label: 'Is Active L30D',
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL7d',
|
||||
label: 'Is Active L7D',
|
||||
defaultValue: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_IS_TWENTY_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isTwenty',
|
||||
label: 'Is Twenty',
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_LAST_ACTIVITY_DATE_FIELD_ID,
|
||||
type: FieldType.DATE_TIME,
|
||||
name: 'lastActivityDate',
|
||||
label: 'Last Activity Date',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL24h',
|
||||
label: 'Page Views L24H',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL30d',
|
||||
label: 'Page Views L30D',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL7d',
|
||||
label: 'Page Views L7D',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_UPDATED_BY_FIELD_ID,
|
||||
type: FieldType.ACTOR,
|
||||
name: 'updatedBy',
|
||||
label: 'Updated by',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_USER_TENURE_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'userTenure',
|
||||
label: 'User tenure',
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_2_WORKSPACE_COUNT_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'workspaceCount',
|
||||
label: 'Workspace count',
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import { defineObject, FieldType } from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_USER_WORKSPACE_2_ID_OF_THE_USER_WORKSPACE_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_USER_IDENTIFIER_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_WORKSPACE_IDENTIFIER_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
} from 'src/fields/cloud-user-workspace-2-field-ids';
|
||||
|
||||
export const CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER =
|
||||
'14d6e1f4-c513-4766-9210-bc5dc8294e51';
|
||||
|
||||
export default defineObject({
|
||||
universalIdentifier: CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
nameSingular: 'cloudUserWorkspace2',
|
||||
namePlural: 'cloudUserWorkspaces2',
|
||||
labelSingular: 'Cloud user workspace 2',
|
||||
labelPlural: 'Cloud user workspaces 2',
|
||||
icon: 'IconBox',
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_USER_IDENTIFIER_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'twentyUserIdentifier',
|
||||
label: 'Twenty User Identifier',
|
||||
icon: 'IconMan',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
displayedMaxRows: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_WORKSPACE_IDENTIFIER_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'twentyWorkspaceIdentifier',
|
||||
label: 'Twenty Workspace Identifier',
|
||||
icon: 'IconScreenShare',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
displayedMaxRows: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_ID_OF_THE_USER_WORKSPACE_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'idOfTheUserWorkspace',
|
||||
label: 'Id of the user workspace',
|
||||
icon: 'IconTypography',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
displayedMaxRows: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_USER_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
type: FieldType.ACTOR,
|
||||
name: 'updatedBy',
|
||||
label: 'Updated by',
|
||||
description: 'The user who last updated the record',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,582 @@
|
||||
import { defineObject, FieldType } from 'twenty-sdk';
|
||||
|
||||
import {
|
||||
CLOUD_WORKSPACE_2_ACTIVATION_STATUS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ALEXA_RANK_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ANNUAL_REVENUE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ARR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_FOUNDED_YEAR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_LINKEDIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_NAME_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_CREATOR_EMAIL_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_CUSTOM_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_DESCRIPTION_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_EMPLOYEES_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_INDUSTRY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ENRICHED_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_LAST_PAGE_VIEW_DATE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_LATEST_FUNDING_STAGE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_MRR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NEXT_RENEWAL_DATE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_TOTAL_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAYMENT_FREQUENCY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_POTENTIAL_ARR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_SUB_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_SUBSCRIPTION_STATUS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TAGS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_EVER_ACTIVE_WORKSPACE_USERS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_FUNDING_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_WORKSPACE_USERS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_BUSINESS_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_TENURE_FIELD_ID,
|
||||
} from 'src/fields/cloud-workspace-2-field-ids';
|
||||
|
||||
export const CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER =
|
||||
'77376ed3-19c1-4859-bde5-90f19ad02113';
|
||||
|
||||
export default defineObject({
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
nameSingular: 'cloudWorkspace2',
|
||||
namePlural: 'cloudWorkspaces2',
|
||||
labelSingular: 'Cloud workspace 2',
|
||||
labelPlural: 'Cloud workspaces 2',
|
||||
icon: 'IconBox',
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_CUSTOM_DOMAIN_FIELD_ID,
|
||||
type: FieldType.LINKS,
|
||||
name: 'customDomain',
|
||||
label: 'Custom domain',
|
||||
description: 'Custom domain set up by the customer to use their own.',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_WORKSPACE_BUSINESS_DOMAIN_FIELD_ID,
|
||||
type: FieldType.LINKS,
|
||||
name: 'workspaceBusinessDomain',
|
||||
label: 'Workspace Business Domain',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_COMPANY_LINKEDIN_FIELD_ID,
|
||||
type: FieldType.LINKS,
|
||||
name: 'companyLinkedin',
|
||||
label: 'Company LinkedIn',
|
||||
icon: 'IconBrandLinkedin',
|
||||
isNullable: true,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
type: FieldType.DATE,
|
||||
name: 'dataLastUpdatedAt',
|
||||
label: 'Data last updated at',
|
||||
description: 'by workflow',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_LAST_PAGE_VIEW_DATE_FIELD_ID,
|
||||
type: FieldType.DATE,
|
||||
name: 'lastPageViewDate',
|
||||
label: 'Last Page View Date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier:
|
||||
CLOUD_WORKSPACE_2_TOTAL_EVER_ACTIVE_WORKSPACE_USERS_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'totalEverActiveWorkspaceUsers',
|
||||
label: 'Total ever active workspace users',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ACTIVE_USERS_L30D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'activeUsersL30D',
|
||||
label: 'Active Users L30D',
|
||||
icon: 'IconUsersGroup',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ACTIVE_USERS_L7D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'activeUsersL7D',
|
||||
label: 'Active Users L7D',
|
||||
icon: 'IconUsersGroup',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ACTIVE_USERS_L24H_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'activeUsersL24H',
|
||||
label: 'Active Users L24H',
|
||||
icon: 'IconUsersGroup',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_WORKSPACE_TENURE_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'workspaceTenure',
|
||||
label: 'Workspace tenure',
|
||||
description: 'in days',
|
||||
icon: 'IconCalendarHeart',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL30D',
|
||||
label: 'Page Views L30D',
|
||||
icon: 'IconClick',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL7D',
|
||||
label: 'Page Views L7D',
|
||||
icon: 'IconClick',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'pageViewsL24H',
|
||||
label: 'Page Views L24H',
|
||||
icon: 'IconClick',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_TOTAL_WORKSPACE_USERS_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'totalWorkspaceUsers',
|
||||
label: 'Total workspace users',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_L30D_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'numberOfEventsL30D',
|
||||
label: 'Number of events L30D',
|
||||
icon: 'IconHandClick',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_TOTAL_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'numberOfEventsTotal',
|
||||
label: 'Number of events total',
|
||||
icon: 'IconHandClick',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ALEXA_RANK_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'alexaRank',
|
||||
label: 'Alexa Rank',
|
||||
icon: 'IconNumber9',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_EMPLOYEES_FIELD_ID,
|
||||
type: FieldType.NUMBER,
|
||||
name: 'employees',
|
||||
label: 'Employees',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
universalSettings: {
|
||||
type: 'number',
|
||||
decimals: 0,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL7D',
|
||||
label: 'Is Active L7D',
|
||||
icon: 'IconActivity',
|
||||
isNullable: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL24H',
|
||||
label: 'Is Active L24H',
|
||||
icon: 'IconActivity',
|
||||
isNullable: true,
|
||||
defaultValue: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isActiveL30D',
|
||||
label: 'Is Active L30D',
|
||||
icon: 'IconActivity',
|
||||
isNullable: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_IS_ENRICHED_FIELD_ID,
|
||||
type: FieldType.BOOLEAN,
|
||||
name: 'isEnriched',
|
||||
label: 'Is Enriched',
|
||||
icon: 'IconToggleLeft',
|
||||
isNullable: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_INDUSTRY_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'industry',
|
||||
label: 'Industry',
|
||||
icon: 'IconWorldLongitude',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_COMPANY_FOUNDED_YEAR_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'companyFoundedYear',
|
||||
label: 'Company Founded Year',
|
||||
icon: 'IconCalendarPlus',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_DESCRIPTION_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'description',
|
||||
label: 'Description',
|
||||
icon: 'IconBaselineDensitySmall',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_LATEST_FUNDING_STAGE_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'latestFundingStage',
|
||||
label: 'Latest Funding Stage',
|
||||
icon: 'IconBellDollar',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_COMPANY_NAME_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'companyName',
|
||||
label: 'Company Name',
|
||||
icon: 'IconTypography',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_SUB_DOMAIN_FIELD_ID,
|
||||
type: FieldType.TEXT,
|
||||
name: 'subDomain',
|
||||
label: 'Sub domain',
|
||||
description:
|
||||
'This is the subdomain chosen by customers to access their workspace',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ANNUAL_REVENUE_FIELD_ID,
|
||||
type: FieldType.CURRENCY,
|
||||
name: 'annualRevenue',
|
||||
label: 'Annual Revenue',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_MRR_FIELD_ID,
|
||||
type: FieldType.CURRENCY,
|
||||
name: 'mrr',
|
||||
label: 'MRR',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_POTENTIAL_ARR_FIELD_ID,
|
||||
type: FieldType.CURRENCY,
|
||||
name: 'potentialArr',
|
||||
label: 'Potential ARR',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ARR_FIELD_ID,
|
||||
type: FieldType.CURRENCY,
|
||||
name: 'arr',
|
||||
label: 'ARR',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_TOTAL_FUNDING_FIELD_ID,
|
||||
type: FieldType.CURRENCY,
|
||||
name: 'totalFunding',
|
||||
label: 'Total Funding',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_ACTIVATION_STATUS_FIELD_ID,
|
||||
type: FieldType.SELECT,
|
||||
name: 'activationStatus',
|
||||
label: 'Activation Status',
|
||||
icon: 'IconTag',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
options: [
|
||||
{
|
||||
id: 'c41ee49c-e629-431e-8601-183726f93315',
|
||||
color: 'yellow',
|
||||
label: 'Pending creation',
|
||||
value: 'PENDING_CREATION',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
id: 'cb82ad14-5fcb-4ed0-af58-c92f84b45d2b',
|
||||
color: 'gray',
|
||||
label: 'Suspended',
|
||||
value: 'SUSPENDED',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
id: 'b1084bc8-0efd-44ce-974c-7fb44c310be5',
|
||||
color: 'green',
|
||||
label: 'Active',
|
||||
value: 'ACTIVE',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
id: 'b5b33c8e-eb3f-4758-99c9-d2f39c011b96',
|
||||
color: 'blue',
|
||||
label: 'Ongoing creation',
|
||||
value: 'ONGOING_CREATION',
|
||||
position: 3,
|
||||
},
|
||||
{
|
||||
id: '2ae41a69-c521-4545-9e0b-f1f941ceee83',
|
||||
color: 'purple',
|
||||
label: 'Empty',
|
||||
value: 'EMPTY',
|
||||
position: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_SUBSCRIPTION_STATUS_FIELD_ID,
|
||||
type: FieldType.SELECT,
|
||||
name: 'subscriptionStatus',
|
||||
label: 'Subscription Status',
|
||||
icon: 'IconTag',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
options: [
|
||||
{
|
||||
id: 'b5ee9a91-0a15-4cbe-a36e-198f5bae431d',
|
||||
color: 'green',
|
||||
label: 'Active',
|
||||
value: 'ACTIVE',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
id: '78837243-38d9-44d4-8b9c-a6c0ca082ba8',
|
||||
color: 'blue',
|
||||
label: 'Trialing',
|
||||
value: 'TRIALING',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
id: '6b27ee33-3c30-4694-a607-19264765b11c',
|
||||
color: 'gray',
|
||||
label: 'Canceled',
|
||||
value: 'CANCELED',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
id: '05118231-18b6-4589-be23-8f1368c0182f',
|
||||
color: 'yellow',
|
||||
label: 'Other',
|
||||
value: 'OTHER',
|
||||
position: 3,
|
||||
},
|
||||
{
|
||||
id: 'ea83a7ff-4fe0-4c56-88f8-cf0bdf76cb08',
|
||||
color: 'gray',
|
||||
label: 'Empty',
|
||||
value: 'EMPTY',
|
||||
position: 4,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_PAYMENT_FREQUENCY_FIELD_ID,
|
||||
type: FieldType.SELECT,
|
||||
name: 'paymentFrequency',
|
||||
label: 'Payment Frequency',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
options: [
|
||||
{
|
||||
id: 'fa97d4fb-12bf-4cf4-b252-14b1c657d3b6',
|
||||
color: 'sky',
|
||||
label: 'Month',
|
||||
value: 'MONTH',
|
||||
position: 0,
|
||||
},
|
||||
{
|
||||
id: 'c09c3f1d-31e7-4b29-969a-a4304f04abe0',
|
||||
color: 'purple',
|
||||
label: 'Year',
|
||||
value: 'YEAR',
|
||||
position: 1,
|
||||
},
|
||||
{
|
||||
id: 'a91d77ed-90ad-41fc-83ae-e688c981abb2',
|
||||
color: 'gray',
|
||||
label: 'Other',
|
||||
value: 'OTHER',
|
||||
position: 2,
|
||||
},
|
||||
{
|
||||
id: '5c595203-1b33-430b-abd8-8bc80aeedbd7',
|
||||
color: 'red',
|
||||
label: 'Empty',
|
||||
value: 'EMPTY',
|
||||
position: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_NEXT_RENEWAL_DATE_FIELD_ID,
|
||||
type: FieldType.DATE_TIME,
|
||||
name: 'nextRenewalDate',
|
||||
label: 'Next Renewal Date',
|
||||
icon: 'IconCalendarClock',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_CREATOR_EMAIL_FIELD_ID,
|
||||
type: FieldType.EMAILS,
|
||||
name: 'creatorEmail',
|
||||
label: 'Creator Email',
|
||||
icon: 'IconMail',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_TAGS_FIELD_ID,
|
||||
type: FieldType.ARRAY,
|
||||
name: 'tags',
|
||||
label: 'Tags',
|
||||
icon: 'IconBracketsContain',
|
||||
isNullable: true,
|
||||
defaultValue: null,
|
||||
},
|
||||
|
||||
{
|
||||
universalIdentifier: CLOUD_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
type: FieldType.ACTOR,
|
||||
name: 'updatedBy',
|
||||
label: 'Updated by',
|
||||
description: 'The user who last updated the record',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { defineRole } from 'twenty-sdk';
|
||||
|
||||
export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
|
||||
'4bd740cc-f6a1-40c5-b46b-e2a4dbf5af04';
|
||||
|
||||
export default defineRole({
|
||||
universalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
|
||||
label: 'Twenty for Twenty default function role',
|
||||
description: 'Twenty for Twenty default function role',
|
||||
canReadAllObjectRecords: true,
|
||||
canUpdateAllObjectRecords: true,
|
||||
canSoftDeleteAllObjectRecords: true,
|
||||
canDestroyAllObjectRecords: false,
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const applicationConfigSchema = z
|
||||
.object({
|
||||
CLICKHOUSE_DATABASE: z.string().nonempty(),
|
||||
CLICKHOUSE_URL: z.url(),
|
||||
CLICKHOUSE_USERNAME: z.string().nonempty(),
|
||||
CLICKHOUSE_PASSWORD: z.string().nonempty(),
|
||||
});
|
||||
|
||||
export const getApplicationConfig = () => {
|
||||
const env = applicationConfigSchema.parse({
|
||||
CLICKHOUSE_DATABASE: process.env.CLICKHOUSE_DATABASE,
|
||||
CLICKHOUSE_URL: process.env.CLICKHOUSE_URL,
|
||||
CLICKHOUSE_USERNAME: process.env.CLICKHOUSE_USERNAME,
|
||||
CLICKHOUSE_PASSWORD: process.env.CLICKHOUSE_PASSWORD,
|
||||
});
|
||||
|
||||
return {
|
||||
clickHouseDatabase: env.CLICKHOUSE_DATABASE,
|
||||
clickHouseUrl: env.CLICKHOUSE_URL,
|
||||
clickHouseUsername: env.CLICKHOUSE_USERNAME,
|
||||
clickHousePassword: env.CLICKHOUSE_PASSWORD,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { getApplicationConfig } from 'src/shared/application-config';
|
||||
|
||||
// Fetches rows from ClickHouse using a raw SQL query,
|
||||
// parses the JSONEachRow response, and validates each row against the provided Zod schema.
|
||||
export const fetchFromClickHouse = async <T>(
|
||||
query: string,
|
||||
schema: z.ZodType<T>,
|
||||
): Promise<T[]> => {
|
||||
const { clickHouseUrl, clickHouseUsername, clickHousePassword } =
|
||||
getApplicationConfig();
|
||||
|
||||
const response = await fetch(clickHouseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization:
|
||||
'Basic ' +
|
||||
Buffer.from(`${clickHouseUsername}:${clickHousePassword}`).toString(
|
||||
'base64',
|
||||
),
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: query,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
|
||||
throw new Error(`ClickHouse error: ${response.status} - ${errorText}`);
|
||||
}
|
||||
|
||||
// Format is a list of JSON objects, one per line (JSONEachRow format).
|
||||
const text = await response.text();
|
||||
|
||||
const rows = text
|
||||
.trim()
|
||||
.split('\n')
|
||||
.filter((line) => line.trim())
|
||||
.map((line) => JSON.parse(line));
|
||||
|
||||
return z.array(schema).parse(rows);
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
// ClickHouse returns DateTime64 values in the format 'YYYY-MM-DD HH:mm:ss.SSSSSS'
|
||||
// (space-separated, up to 6 fractional digits). Twenty's DATE_TIME fields expect
|
||||
// ISO 8601 format ('YYYY-MM-DDTHH:mm:ss.SSSZ', at most 3 fractional digits).
|
||||
//
|
||||
// Additionally, ClickHouse uses '1970-01-01 00:00:00.000000' as a sentinel for
|
||||
// null/empty dates. We map that to null.
|
||||
|
||||
const CLICKHOUSE_EPOCH_SENTINEL = '1970-01-01 00:00:00.000000';
|
||||
|
||||
export const clickHouseDateToIso = (value: string): string | null => {
|
||||
if (!value || value === CLICKHOUSE_EPOCH_SENTINEL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Date(value.replace(' ', 'T') + 'Z').toISOString();
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
import Twenty from 'twenty-sdk/generated';
|
||||
|
||||
export const twentyClient = new Twenty();
|
||||
@@ -0,0 +1,159 @@
|
||||
import { defineView } from 'twenty-sdk';
|
||||
import { ViewType } from 'twenty-shared/types';
|
||||
|
||||
import {
|
||||
CLOUD_USER_2_ACTIVITY_STATUS_FIELD_ID,
|
||||
CLOUD_USER_2_AVG_DAILY_PAGEVIEWS_LAST_30D_FIELD_ID,
|
||||
CLOUD_USER_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
CLOUD_USER_2_DAYS_SINCE_LAST_ACTIVITY_FIELD_ID,
|
||||
CLOUD_USER_2_EMAIL_FIELD_ID,
|
||||
CLOUD_USER_2_FULL_NAME_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
CLOUD_USER_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
CLOUD_USER_2_IS_TWENTY_FIELD_ID,
|
||||
CLOUD_USER_2_LAST_ACTIVITY_DATE_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
CLOUD_USER_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
CLOUD_USER_2_UPDATED_BY_FIELD_ID,
|
||||
CLOUD_USER_2_USER_TENURE_FIELD_ID,
|
||||
CLOUD_USER_2_WORKSPACE_COUNT_FIELD_ID,
|
||||
} from 'src/fields/cloud-user-2-field-ids';
|
||||
import { CLOUD_USER_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-2';
|
||||
|
||||
export const ALL_CLOUD_USER_2_VIEW_ID = 'd6137e11-dbcd-4824-85d3-42fe1ca48cb6';
|
||||
|
||||
export default defineView({
|
||||
universalIdentifier: ALL_CLOUD_USER_2_VIEW_ID,
|
||||
name: 'all-cloud-user-2',
|
||||
objectUniversalIdentifier: CLOUD_USER_2_UNIVERSAL_IDENTIFIER,
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
type: ViewType.TABLE,
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier: '9e82305e-9fd9-4bf7-8cc5-098eb35a748e',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_FULL_NAME_FIELD_ID,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'ea737839-bcb7-4da1-aaf6-79cda65e6263',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_EMAIL_FIELD_ID,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'ccd1eca7-c851-4e97-9f0e-48c7139f3ced',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_ACTIVITY_STATUS_FIELD_ID,
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'e99c82d3-d2fe-4758-9253-ab2ca2b50ef8',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_IS_TWENTY_FIELD_ID,
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c03da046-30b6-402e-8d4b-10799aa5102d',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_WORKSPACE_COUNT_FIELD_ID,
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'e3a787f2-77d1-4865-a5c2-c60976809d4d',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_USER_TENURE_FIELD_ID,
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '352d77f2-726b-4a75-8c9d-3117cfabedc1',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'cf06d6b0-e425-4daf-8a6d-9b66a058ae80',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '4ab63729-0b48-4b0b-ac9e-e72f5448998c',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '8c6a3315-fa47-4a12-b9fe-1775462c803d',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
position: 9,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '89011d63-e670-498e-bc8f-142f7ceafd04',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
position: 10,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '88816c57-aa5b-4efe-b53a-b288fad24ab4',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
position: 11,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '3b0ff937-1eaf-4589-80ec-23abb4f2e204',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_AVG_DAILY_PAGEVIEWS_LAST_30D_FIELD_ID,
|
||||
position: 12,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'dee5f679-9ad9-4bc4-94a9-af28d7210699',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_DAYS_SINCE_LAST_ACTIVITY_FIELD_ID,
|
||||
position: 13,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '25b4e175-be18-4b20-9c51-5db0a596d968',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_LAST_ACTIVITY_DATE_FIELD_ID,
|
||||
position: 14,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'f1706c21-d164-414c-9cf5-4cf376584bb9',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
position: 15,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '88d0f343-42c1-4d36-82df-cfdb74e785eb',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_USER_2_UPDATED_BY_FIELD_ID,
|
||||
position: 16,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import { defineView } from 'twenty-sdk';
|
||||
import { ViewType } from 'twenty-shared/types';
|
||||
|
||||
import {
|
||||
CLOUD_USER_WORKSPACE_2_ID_OF_THE_USER_WORKSPACE_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_USER_IDENTIFIER_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_WORKSPACE_IDENTIFIER_FIELD_ID,
|
||||
CLOUD_USER_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
} from 'src/fields/cloud-user-workspace-2-field-ids';
|
||||
import { CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-user-workspace-2';
|
||||
|
||||
export const ALL_CLOUD_USER_WORKSPACE_2_VIEW_ID =
|
||||
'f80e44ef-43fb-409e-a003-decadaa38b3e';
|
||||
|
||||
export default defineView({
|
||||
universalIdentifier: ALL_CLOUD_USER_WORKSPACE_2_VIEW_ID,
|
||||
name: 'all-cloud-user-workspace-2',
|
||||
objectUniversalIdentifier: CLOUD_USER_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
type: ViewType.TABLE,
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier: '4a0d9d93-d182-443d-8a70-3a4f25e51c50',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_USER_IDENTIFIER_FIELD_ID,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '14b78fc4-a6a5-471b-ba87-6aebc9a3da68',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_TWENTY_WORKSPACE_IDENTIFIER_FIELD_ID,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 220,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '8c9c8a1b-d511-4706-afe7-32b22cce2e7e',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_ID_OF_THE_USER_WORKSPACE_FIELD_ID,
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'ee35eded-4222-4a87-b31c-69e415e331db',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_USER_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,369 @@
|
||||
import { defineView } from 'twenty-sdk';
|
||||
import { ViewType } from 'twenty-shared/types';
|
||||
|
||||
import {
|
||||
CLOUD_WORKSPACE_2_ACTIVATION_STATUS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ALEXA_RANK_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ANNUAL_REVENUE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_ARR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_FOUNDED_YEAR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_LINKEDIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_COMPANY_NAME_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_CREATOR_EMAIL_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_CUSTOM_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_DESCRIPTION_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_EMPLOYEES_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_INDUSTRY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_IS_ENRICHED_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_LAST_PAGE_VIEW_DATE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_LATEST_FUNDING_STAGE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_MRR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NEXT_RENEWAL_DATE_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_TOTAL_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_PAYMENT_FREQUENCY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_POTENTIAL_ARR_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_SUB_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_SUBSCRIPTION_STATUS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TAGS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_EVER_ACTIVE_WORKSPACE_USERS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_FUNDING_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_TOTAL_WORKSPACE_USERS_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_BUSINESS_DOMAIN_FIELD_ID,
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_TENURE_FIELD_ID,
|
||||
} from 'src/fields/cloud-workspace-2-field-ids';
|
||||
import { CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER } from 'src/objects/cloud-workspace-2';
|
||||
|
||||
export const ALL_CLOUD_WORKSPACE_2_VIEW_ID =
|
||||
'3747a3a0-25a0-42f0-99d9-61a4b4a76009';
|
||||
|
||||
export default defineView({
|
||||
universalIdentifier: ALL_CLOUD_WORKSPACE_2_VIEW_ID,
|
||||
name: 'all-cloud-workspace-2',
|
||||
objectUniversalIdentifier: CLOUD_WORKSPACE_2_UNIVERSAL_IDENTIFIER,
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
type: ViewType.TABLE,
|
||||
fields: [
|
||||
{
|
||||
universalIdentifier: '146e3f00-8efc-46be-aafb-a6bafcefa5b0',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_COMPANY_NAME_FIELD_ID,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '10ce2149-d25b-4e21-8215-c628677bc4cb',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_SUB_DOMAIN_FIELD_ID,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c8735db0-9a89-4204-ad58-b68b71c10182',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_DESCRIPTION_FIELD_ID,
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 250,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'cf3f182b-1a69-4274-a200-ef191400a9e8',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_INDUSTRY_FIELD_ID,
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c932adb5-129b-4457-bbfa-75baaf27707f',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_EMPLOYEES_FIELD_ID,
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '5f0d33f0-60f0-442c-8c2d-19bfe1c9ea49',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_SUBSCRIPTION_STATUS_FIELD_ID,
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '904e4ecd-f997-42b6-933a-1174cf2bebdc',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_ACTIVATION_STATUS_FIELD_ID,
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'f2d919e7-f782-4edb-ad1a-b99649fbbaf9',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_MRR_FIELD_ID,
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '92afa154-72f2-4b01-8376-2f5311bb40f9',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_ARR_FIELD_ID,
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c63bcd0a-f8d3-4c86-b9c0-6d638d7e9195',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_POTENTIAL_ARR_FIELD_ID,
|
||||
position: 9,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '8659ca48-23b0-4fb8-b588-0919169cae4d',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_ANNUAL_REVENUE_FIELD_ID,
|
||||
position: 10,
|
||||
isVisible: true,
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '1524079b-0e7e-41a6-80bc-85bcdfcab537',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_TOTAL_FUNDING_FIELD_ID,
|
||||
position: 11,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '36a755ee-903c-4c61-b091-ebc0e687333d',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L24H_FIELD_ID,
|
||||
position: 12,
|
||||
isVisible: true,
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '5ac28b38-823f-421c-a177-1749b8283381',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L7D_FIELD_ID,
|
||||
position: 13,
|
||||
isVisible: true,
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '6fa0bfe5-ac55-4165-8830-5c084466c7f5',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_ACTIVE_USERS_L30D_FIELD_ID,
|
||||
position: 14,
|
||||
isVisible: true,
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'bee2ed03-23c2-4c99-86db-c0dd4599c669',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L24H_FIELD_ID,
|
||||
position: 15,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'e8f9775b-c984-4832-800a-3dd26060c0aa',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L7D_FIELD_ID,
|
||||
position: 16,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '95c4fdfc-8fe5-43ce-9885-3f0fc5b4756a',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_PAGE_VIEWS_L30D_FIELD_ID,
|
||||
position: 17,
|
||||
isVisible: true,
|
||||
size: 130,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '6448c0f1-1469-466e-99ed-c7aa015d9e38',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_TOTAL_WORKSPACE_USERS_FIELD_ID,
|
||||
position: 18,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '082ed200-9bba-444a-9b28-3a129b7ac9d8',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_TOTAL_EVER_ACTIVE_WORKSPACE_USERS_FIELD_ID,
|
||||
position: 19,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'd61bbf0c-48ad-428a-90a1-87b54a87bacf',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_TENURE_FIELD_ID,
|
||||
position: 20,
|
||||
isVisible: true,
|
||||
size: 140,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '26058a5b-edde-4caa-a034-32b8edb54ce6',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L24H_FIELD_ID,
|
||||
position: 21,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '36931d2b-f250-4325-a877-3285dd8a797e',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L7D_FIELD_ID,
|
||||
position: 22,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c120fc92-4796-4cf4-866f-c1d8c4555321',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_IS_ACTIVE_L30D_FIELD_ID,
|
||||
position: 23,
|
||||
isVisible: true,
|
||||
size: 120,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'a6674592-070b-41c1-baab-f360984328cc',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_IS_ENRICHED_FIELD_ID,
|
||||
position: 24,
|
||||
isVisible: true,
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'd3701295-ef41-46c4-8dd3-b31c27663516',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_CUSTOM_DOMAIN_FIELD_ID,
|
||||
position: 25,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'dd22ffe7-95ed-4c67-be33-c2d1592daa32',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_WORKSPACE_BUSINESS_DOMAIN_FIELD_ID,
|
||||
position: 26,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'c7a9bcf8-d41d-4ded-b680-868e470e3228',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_COMPANY_LINKEDIN_FIELD_ID,
|
||||
position: 27,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '398eb88f-0d12-446d-a486-d1fb262f82bb',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_CREATOR_EMAIL_FIELD_ID,
|
||||
position: 28,
|
||||
isVisible: true,
|
||||
size: 200,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '52d2a1b3-e2b2-4d6b-a5dd-ea8d63c7c369',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_TAGS_FIELD_ID,
|
||||
position: 29,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'f74fed2c-94dc-4954-ac27-79acd7e04103',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_PAYMENT_FREQUENCY_FIELD_ID,
|
||||
position: 30,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '666d0cea-e50b-4cc8-9ed5-5f5c0ec7fe7e',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_NEXT_RENEWAL_DATE_FIELD_ID,
|
||||
position: 31,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '60508519-5ac4-4f96-a30f-5c75d3ce9a93',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_L30D_FIELD_ID,
|
||||
position: 32,
|
||||
isVisible: true,
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '3b1ca2b6-31a1-4755-a9a4-07ee9a9b8a33',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_NUMBER_OF_EVENTS_TOTAL_FIELD_ID,
|
||||
position: 33,
|
||||
isVisible: true,
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '47ba21ab-a5c5-42b9-b1e2-7a988ece154d',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_ALEXA_RANK_FIELD_ID,
|
||||
position: 34,
|
||||
isVisible: true,
|
||||
size: 110,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'de5e2e42-2600-488c-81d0-f700e7dd0f67',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_COMPANY_FOUNDED_YEAR_FIELD_ID,
|
||||
position: 35,
|
||||
isVisible: true,
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'd6bec718-8b50-41e2-95d7-521151e2df82',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_LATEST_FUNDING_STAGE_FIELD_ID,
|
||||
position: 36,
|
||||
isVisible: true,
|
||||
size: 160,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '9aaff045-64fa-4857-a8df-7394cf43a120',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_LAST_PAGE_VIEW_DATE_FIELD_ID,
|
||||
position: 37,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: 'f2cb82b9-ebb4-4258-971b-061d709f28e5',
|
||||
fieldMetadataUniversalIdentifier:
|
||||
CLOUD_WORKSPACE_2_DATA_LAST_UPDATED_AT_FIELD_ID,
|
||||
position: 38,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
universalIdentifier: '7e631992-3ae6-478b-9874-67c3b211f05a',
|
||||
fieldMetadataUniversalIdentifier: CLOUD_WORKSPACE_2_UPDATED_BY_FIELD_ID,
|
||||
position: 39,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": ".",
|
||||
"jsx": "react-jsx",
|
||||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"allowUnreachableCode": false,
|
||||
"strict": true,
|
||||
"alwaysStrict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictBindCallApply": false,
|
||||
"target": "es2018",
|
||||
"module": "esnext",
|
||||
"lib": ["es2020", "dom"],
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"paths": {
|
||||
"src/*": ["./src/*"],
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user