index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/index.ts | const { version } = require('../package.json');
import { version as platformVersion } from 'zapier-platform-core';
import createPerson from './creates/create_person';
import createCompany from './creates/create_company';
import company from './triggers/company';
import authentication from './authentication';
import 'do... | 2,900 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/creates/create_company.ts | import { Bundle, ZObject } from 'zapier-platform-core';
import handleQueryParams from '../utils/handleQueryParams';
import requestDb from '../utils/requestDb';
const perform = async (z: ZObject, bundle: Bundle) => {
const query = `
mutation CreateCompany {
createOneCompany(
data:{${handleQueryParams(bund... | 2,901 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/creates/create_person.ts | import { Bundle, ZObject } from 'zapier-platform-core';
import handleQueryParams from '../utils/handleQueryParams';
import requestDb from '../utils/requestDb';
const perform = async (z: ZObject, bundle: Bundle) => {
const query = `
mutation CreatePerson {
createOnePerson(
data:{${handleQueryParams(bundle... | 2,902 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test/authentication.test.ts | import App from '../index';
import {
Bundle,
HttpRequestOptions,
createAppTester,
tools,
ZObject,
} from 'zapier-platform-core';
import getBundle from '../utils/getBundle';
import handleQueryParams from '../utils/handleQueryParams';
import requestDb from '../utils/requestDb';
const appTester = createAppTester... | 2,903 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test/creates/create_company.test.ts | import App from '../../index';
import { Bundle, createAppTester, tools, ZObject } from 'zapier-platform-core';
import getBundle from '../../utils/getBundle';
import requestDb from '../../utils/requestDb';
const appTester = createAppTester(App);
tools.env.inject;
describe('creates.create_company', () => {
test('shoul... | 2,904 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test/creates/create_person.test.ts | import App from '../../index';
import { Bundle, createAppTester, tools, ZObject } from 'zapier-platform-core';
import getBundle from '../../utils/getBundle';
import requestDb from '../../utils/requestDb';
const appTester = createAppTester(App);
tools.env.inject();
describe('creates.create_person', () => {
test('shou... | 2,905 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test/triggers/company.test.ts | import { Bundle, createAppTester, ZObject } from 'zapier-platform-core';
import App from '../../index';
import getBundle from '../../utils/getBundle';
import requestDb from '../../utils/requestDb';
const appTester = createAppTester(App);
describe('triggers.company', () => {
test('should succeed to subscribe', async ... | 2,906 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/test/utils/handleQueryParams.test.ts | import handleQueryParams from '../../utils/handleQueryParams';
describe('utils.handleQueryParams', () => {
test('should handle empty values', () => {
const inputData = {};
const result = handleQueryParams(inputData);
const expectedResult = '';
expect(result).toEqual(expectedResult);
});
test('sho... | 2,907 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/triggers/company.ts | import { Bundle, ZObject } from 'zapier-platform-core';
import requestDb from '../utils/requestDb';
import handleQueryParams from '../utils/handleQueryParams';
const performSubscribe = async (z: ZObject, bundle: Bundle) => {
const data = { targetUrl: bundle.targetUrl, operation: 'createOneCompany' };
const result ... | 2,908 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/utils/getBundle.ts | import { Bundle } from 'zapier-platform-core';
const getBundle = (inputData?: { [x: string]: any }): Bundle => {
return {
authData: { apiKey: String(process.env.API_KEY) },
inputData: inputData || {},
cleanedRequest: {},
inputDataRaw: {},
meta: {
isBulkRead: false,
isFillingDynamicDro... | 2,909 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/utils/handleQueryParams.ts | const handleQueryParams = (inputData: { [x: string]: any }): string => {
let result = '';
Object.keys(inputData).forEach((key) => {
let quote = '';
if (typeof inputData[key] === 'string') quote = '"';
result = result.concat(`${key}: ${quote}${inputData[key]}${quote}, `);
});
if (result.length) resul... | 2,910 |
0 | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src | petrpan-code/twentyhq/twenty/packages/twenty-zapier/src/utils/requestDb.ts | import { Bundle, HttpRequestOptions, ZObject } from 'zapier-platform-core';
const requestDb = async (z: ZObject, bundle: Bundle, query: string) => {
const options = {
url: `${process.env.SERVER_BASE_URL}/graphql`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'applica... | 2,911 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.env.example | # Use this for local setup
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/default
# Use this for docker setup
# PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default?connection_limit=1
FRONT_BASE_URL=http://localhost:3001
ACCESS_TOKEN_SECRET=replace_me_with_a_random_string_access
LOGIN_TOKEN_SECRET=r... | 2,912 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.env.test | DEBUG_MODE=true
PG_DATABASE_URL=postgres://twenty:twenty@localhost:5432/test?connection_limit=1
# Use this for docker setup
# PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default?connection_limit=1
# the URL of the front-end app
FRONT_BASE_URL=http://localhost:3001
# random keys used to generate JWT tokens
A... | 2,913 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.eslintrc.js | module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir : __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', 'import', 'unused-imports'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:p... | 2,914 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.nvmrc | 18.16.0
| 2,915 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.prettierignore | **/generated/* | 2,916 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/.prettierrc | {
"singleQuote": true,
"trailingComma": "all"
} | 2,917 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/jest.config.ts | module.exports = {
clearMocks: true,
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: ['js', 'json', 'ts'],
moduleNameMapper: {
'^src/(.*)': '<rootDir>/src/$1',
},
rootDir: './',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom... | 2,918 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/nest-cli.json | {
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src"
}
| 2,919 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/package.json | {
"name": "server",
"version": "0.1.5",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"postinstall": "patch-package",
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "set... | 2,920 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/tsconfig.build.json | {
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
| 2,921 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/tsconfig.json | {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"esModuleInterop": true,
"target": "es2017",
"sourceMap"... | 2,922 |
0 | petrpan-code/twentyhq/twenty | petrpan-code/twentyhq/twenty/server/yarn.lock | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz"
integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zh... | 2,923 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/.vscode/settings.json | {
"javascript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifier": "non-relative"
} | 2,924 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/@types/common.d.ts | type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;
| 2,925 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/patches/@graphql-yoga+nestjs+2.1.0.patch | diff --git a/node_modules/@graphql-yoga/nestjs/dist/cjs/index.js b/node_modules/@graphql-yoga/nestjs/dist/cjs/index.js
index 1684394..8a92c3c 100644
--- a/node_modules/@graphql-yoga/nestjs/dist/cjs/index.js
+++ b/node_modules/@graphql-yoga/nestjs/dist/cjs/index.js
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
cons... | 2,926 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/patches/@nestjs+graphql+12.0.8.patch | diff --git a/node_modules/@nestjs/graphql/dist/schema-builder/graphql-schema.factory.js b/node_modules/@nestjs/graphql/dist/schema-builder/graphql-schema.factory.js
index 787bcbc..1c825bd 100644
--- a/node_modules/@nestjs/graphql/dist/schema-builder/graphql-schema.factory.js
+++ b/node_modules/@nestjs/graphql/dist/sche... | 2,927 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/patches/@ptc-org+nestjs-query-graphql+4.2.0.patch | diff --git a/node_modules/@ptc-org/nestjs-query-graphql/src/types/connection/cursor/page-info.type.js b/node_modules/@ptc-org/nestjs-query-graphql/src/types/connection/cursor/page-info.type.js
index 00d836d..8eef442 100644
--- a/node_modules/@ptc-org/nestjs-query-graphql/src/types/connection/cursor/page-info.type.js
++... | 2,928 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/render-run.sh | #!/bin/sh
export PG_DATABASE_URL=postgres://twenty:twenty@$PG_DATABASE_HOST:$PG_DATABASE_PORT/default
yarn database:setup
node dist/src/main | 2,929 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/run-integration.sh | #!/usr/bin/env bash
# scripts/run-integration.sh
DIR="$(cd "$(dirname "$0")" && pwd)"
source $DIR/set-env-test.sh
yarn database:init
yarn jest --config ./test/jest-e2e.json
| 2,930 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/set-env-test.sh | #!/usr/bin/env bash
# scripts/set-env-test.sh
# Get script's directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Construct the absolute path of .env file in the project root directory
ENV_PATH="${SCRIPT_DIR}/../.env.test"
# Check if the file exists
if [ -f "${ENV_PATH}" ]; then
echo "🔵 - Loadin... | 2,931 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/setup-db.ts | import console from 'console';
import { connectionSource, performQuery } from './utils';
connectionSource
.initialize()
.then(async () => {
await performQuery(
'CREATE SCHEMA IF NOT EXISTS "public"',
'create schema "public"',
);
await performQuery(
'CREATE SCHEMA IF NOT EXISTS "metad... | 2,932 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/truncate-db.ts | import console from 'console';
import { connectionSource, performQuery } from './utils';
connectionSource
.initialize()
.then(async () => {
await performQuery(
`
CREATE OR REPLACE FUNCTION drop_all() RETURNS VOID AS $$
DECLARE schema_item RECORD;
BEGIN
FOR schema... | 2,933 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/scripts/utils.ts | import { ConfigService } from '@nestjs/config';
import console from 'console';
import { config } from 'dotenv';
import { DataSource } from 'typeorm';
config();
const configService = new ConfigService();
export const connectionSource = new DataSource({
type: 'postgres',
logging: false,
url: configService.get<st... | 2,934 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/src/app.module.ts | import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ConfigModule } from '@nestjs/config';
import { APP_FILTER, ContextIdFactory, ModuleRef } from '@nestjs/core';
import { YogaDriver, YogaDriverConfig } from '@graphql-yoga/nestjs';
import GraphQLJSON from 'graphql-type-jso... | 2,935 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/src/app.service.ts | import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
health(): string {
return 'Healthy!';
}
}
| 2,936 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/src/command.module.ts | import { Module } from '@nestjs/common';
import { DatabaseCommandModule } from 'src/database/commands/database-command.module';
import { AppModule } from './app.module';
import { WorkspaceManagerCommandsModule } from './workspace/workspace-manager/commands/workspace-manager-commands.module';
import { WorkspaceMigrat... | 2,937 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/src/command.ts | import { CommandFactory } from 'nest-commander';
import { CommandModule } from './command.module';
async function bootstrap() {
// TODO: inject our own logger service to handle the output (Sentry, etc.)
await CommandFactory.run(CommandModule, ['warn', 'error']);
}
bootstrap();
| 2,938 |
0 | petrpan-code/twentyhq/twenty/server | petrpan-code/twentyhq/twenty/server/src/main.ts | import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import * as bodyParser from 'body-parser';
import { graphqlUploadExpress } from 'graphql-upload';
import bytes from 'bytes';
import { AppModule } from './app.module';
import { settings } from './constants/settings';
import {... | 2,939 |
0 | petrpan-code/twentyhq/twenty/server/src/constants | petrpan-code/twentyhq/twenty/server/src/constants/settings/index.ts | import { Settings } from './interfaces/settings.interface';
export const settings: Settings = {
storage: {
imageCropSizes: {
'profile-picture': ['original'],
'workspace-logo': ['original'],
'person-picture': ['original'],
},
maxFileSize: '10MB',
},
};
| 2,940 |
0 | petrpan-code/twentyhq/twenty/server/src/constants/settings | petrpan-code/twentyhq/twenty/server/src/constants/settings/interfaces/settings.interface.ts | import { FileFolder } from 'src/core/file/interfaces/file-folder.interface';
import { ShortCropSize } from 'src/utils/image';
type ValueOfFileFolder = `${FileFolder}`;
export interface Settings {
storage: {
imageCropSizes: {
[key in ValueOfFileFolder]?: ShortCropSize[];
};
maxFileSize: `${number}... | 2,941 |
0 | petrpan-code/twentyhq/twenty/server/src | petrpan-code/twentyhq/twenty/server/src/core/core.module.ts | import { Module } from '@nestjs/common';
import { WorkspaceModule } from 'src/core/workspace/workspace.module';
import { UserModule } from 'src/core/user/user.module';
import { RefreshTokenModule } from 'src/core/refresh-token/refresh-token.module';
import { AuthModule } from 'src/core/auth/auth.module';
import { Ana... | 2,942 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.entity.ts | import { ObjectType, Field } from '@nestjs/graphql';
@ObjectType()
export class Analytics {
@Field(() => Boolean, {
description: 'Boolean that confirms query was dispatched',
})
success: boolean;
}
| 2,943 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.module.ts | import { Module } from '@nestjs/common';
import { AnalyticsService } from './analytics.service';
import { AnalyticsResolver } from './analytics.resolver';
@Module({
providers: [AnalyticsResolver, AnalyticsService],
})
export class AnalyticsModule {}
| 2,944 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.resolver.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { AnalyticsResolver } from './analytics.resolver';
import { AnalyticsService } from './analytics.service';
describe('AnalyticsResolver', () => {
let resolver: Analyti... | 2,945 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.resolver.ts | import { Resolver, Mutation, Args } from '@nestjs/graphql';
import { UseGuards } from '@nestjs/common';
import { OptionalJwtAuthGuard } from 'src/guards/optional-jwt.auth.guard';
import { AuthWorkspace } from 'src/decorators/auth-workspace.decorator';
import { AuthUser } from 'src/decorators/auth-user.decorator';
impo... | 2,946 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { AnalyticsService } from './analytics.service';
describe('AnalyticsService', () => {
let service: AnalyticsService;
beforeEach(async () => {
const module: Tes... | 2,947 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/analytics/analytics.service.ts | import { Injectable } from '@nestjs/common';
import axios, { AxiosInstance } from 'axios';
import { anonymize } from 'src/utils/anonymize';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { User } from 'src/core/user/user.entity';
import { Workspace } from 'src/core/works... | 2,948 |
0 | petrpan-code/twentyhq/twenty/server/src/core/analytics | petrpan-code/twentyhq/twenty/server/src/core/analytics/dto/create-analytics.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import graphqlTypeJson from 'graphql-type-json';
import { IsNotEmpty, IsString, IsObject } from 'class-validator';
@ArgsType()
export class CreateAnalyticsInput {
@Field({ description: 'Type of the event' })
@IsNotEmpty()
@IsString()
type: string;
@Field((... | 2,949 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/auth/auth.module.ts | /* eslint-disable no-restricted-imports */
import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { TypeOrmModule } from '@nestjs/typeorm';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { FileModule } from 'src/core/file/file.module';
im... | 2,950 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/auth/auth.resolver.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { Workspace } from 'src/core/workspace/workspace.entity';
import { AuthResolver } from './auth.resolver';
import { TokenService } from './services/token.service';
import { AuthService } from './service... | 2,951 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/auth/auth.resolver.ts | import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import {
BadRequestException,
ForbiddenException,
UseGuards,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
import { Au... | 2,952 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/auth/auth.util.ts | import * as bcrypt from 'bcrypt';
export const PASSWORD_REGEX = /^.{8,}$/;
const saltRounds = 10;
export const hashPassword = async (password: string) => {
const hash = await bcrypt.hash(password, saltRounds);
return hash;
};
export const compareHash = async (password: string, passwordHash: string) => {
retu... | 2,953 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/controllers/google-auth.controller.ts | import { Controller, Get, Req, Res, UseGuards } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Response } from 'express';
import { Repository } from 'typeorm';
import { GoogleRequest } from 'src/core/auth/strategies/google.auth.strategy';
import { TokenService } from 'src/core/aut... | 2,954 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/controllers/verify-auth.controller.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { AuthService } from 'src/core/auth/services/auth.service';
import { TokenService } from 'src/core/auth/services/token.service';
import { VerifyAuthController } from './verify-auth.controller';
describe('VerifyAuthController', () => {
let controller: Ve... | 2,955 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/controllers/verify-auth.controller.ts | import { Body, Controller, Post } from '@nestjs/common';
import { AuthService } from 'src/core/auth/services/auth.service';
import { VerifyInput } from 'src/core/auth/dto/verify.input';
import { Verify } from 'src/core/auth/dto/verify.entity';
import { TokenService } from 'src/core/auth/services/token.service';
@Cont... | 2,956 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/api-key-token.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class ApiKeyTokenInput {
@Field(() => String)
@IsNotEmpty()
@IsString()
apiKeyId: string;
@Field(() => String)
@IsNotEmpty()
expiresAt: string;
}
| 2,957 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/challenge.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class ChallengeInput {
@Field(() => String)
@IsNotEmpty()
@IsEmail()
email: string;
@Field(() => String)
@IsNotEmpty()
@IsString()
password: string;
}
| 2,958 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/impersonate.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class ImpersonateInput {
@Field(() => String)
@IsNotEmpty()
@IsString()
userId: string;
}
| 2,959 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/login-token.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
import { AuthToken } from './token.entity';
@ObjectType()
export class LoginToken {
@Field(() => AuthToken)
loginToken: AuthToken;
}
| 2,960 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/refresh-token.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class RefreshTokenInput {
@Field(() => String)
@IsNotEmpty()
@IsString()
refreshToken: string;
}
| 2,961 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/sign-up.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
@ArgsType()
export class SignUpInput {
@Field(() => String)
@IsNotEmpty()
@IsEmail()
email: string;
@Field(() => String)
@IsNotEmpty()
@IsString()
password: string;
@Fiel... | 2,962 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/token.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class AuthToken {
@Field(() => String)
token: string;
@Field(() => Date)
expiresAt: Date;
}
@ObjectType()
export class ApiKeyToken {
@Field(() => String)
token: string;
}
@ObjectType()
export class AuthTokenPair {
@Field(() => A... | 2,963 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/user-exists.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class UserExists {
@Field(() => Boolean)
exists: boolean;
}
| 2,964 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/user-exists.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class CheckUserExistsInput {
@Field(() => String)
@IsString()
@IsNotEmpty()
email: string;
}
| 2,965 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/verify.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
import { User } from 'src/core/user/user.entity';
import { AuthTokens } from './token.entity';
@ObjectType()
export class Verify extends AuthTokens {
@Field(() => User)
user: DeepPartial<User>;
}
| 2,966 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/verify.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString } from 'class-validator';
@ArgsType()
export class VerifyInput {
@Field(() => String)
@IsNotEmpty()
@IsString()
loginToken: string;
}
| 2,967 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/workspace-invite-hash-valid.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
export class WorkspaceInviteHashValid {
@Field(() => Boolean)
isValid: boolean;
}
| 2,968 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/dto/workspace-invite-hash.input.ts | import { ArgsType, Field } from '@nestjs/graphql';
import { IsNotEmpty, IsString, MinLength } from 'class-validator';
@ArgsType()
export class WorkspaceInviteHashValidInput {
@Field(() => String)
@IsString()
@IsNotEmpty()
@MinLength(10)
inviteHash: string;
}
| 2,969 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/guards/google-oauth.guard.ts | import { ExecutionContext, Injectable } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
@Injectable()
export class GoogleOauthGuard extends AuthGuard('google') {
constructor() {
super({
prompt: 'select_account',
});
}
async canActivate(context: ExecutionContext) {
try {
... | 2,970 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/guards/google-provider-enabled.guard.ts | import { Injectable, CanActivate, NotFoundException } from '@nestjs/common';
import { Observable } from 'rxjs';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { GoogleStrategy } from 'src/core/auth/strategies/google.auth.strategy';
@Injectable()
export class GoogleProvi... | 2,971 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/services/auth.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { UserService } from 'src/core/user/services/user.service';
import { WorkspaceManagerService } from 'src/workspace/workspace-manager/workspace-manager.service';
import { FileUploadService } from 'src/cor... | 2,972 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/services/auth.service.ts | import {
BadRequestException,
ForbiddenException,
Injectable,
NotFoundException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import FileType from 'file-type';
import { Repository } from 'typeorm';
import { v4 } from 'uuid';
import { FileFolder } from 'src/core/file/interfaces/... | 2,973 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/services/token.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { JwtService } from '@nestjs/jwt';
import { getRepositoryToken } from '@nestjs/typeorm';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { RefreshToken } from 'src/core/refresh-token/refresh-token.entity';
impor... | 2,974 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/services/token.service.ts | import {
ForbiddenException,
Injectable,
InternalServerErrorException,
NotFoundException,
UnauthorizedException,
UnprocessableEntityException,
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { InjectRepository } from '@nestjs/typeorm';
import { addMilliseconds } from 'date-fns';
i... | 2,975 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/strategies/google.auth.strategy.ts | import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { Strategy, VerifyCallback } from 'passport-google-oauth20';
import { Request } from 'express';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
export type GoogleRequest = R... | 2,976 |
0 | petrpan-code/twentyhq/twenty/server/src/core/auth | petrpan-code/twentyhq/twenty/server/src/core/auth/strategies/jwt.auth.strategy.ts | import { PassportStrategy } from '@nestjs/passport';
import {
ForbiddenException,
Injectable,
UnauthorizedException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Strategy, ExtractJwt } from 'passport-jwt';
import { Repository } from 'typeorm';
import { assert } from 'src... | 2,977 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/client-config/client-config.entity.ts | import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType()
class AuthProviders {
@Field(() => Boolean)
google: boolean;
@Field(() => Boolean)
magicLink: boolean;
@Field(() => Boolean)
password: boolean;
}
@ObjectType()
class Telemetry {
@Field(() => Boolean)
enabled: boolean;
@Field(() =>... | 2,978 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/client-config/client-config.module.ts | import { Module } from '@nestjs/common';
import { ClientConfigResolver } from './client-config.resolver';
@Module({
providers: [ClientConfigResolver],
})
export class ClientConfigModule {}
| 2,979 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/client-config/client-config.resolver.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { ClientConfigResolver } from './client-config.resolver';
describe('ClientConfigResolver', () => {
let resolver: ClientConfigResolver;
beforeEach(async () => {
... | 2,980 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/client-config/client-config.resolver.ts | import { Resolver, Query } from '@nestjs/graphql';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { ClientConfig } from './client-config.entity';
@Resolver()
export class ClientConfigResolver {
constructor(private environmentService: EnvironmentService) {}
@Query((... | 2,981 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/file/file.module.ts | import { Module } from '@nestjs/common';
import { FileService } from './services/file.service';
import { FileUploadService } from './services/file-upload.service';
import { FileUploadResolver } from './resolvers/file-upload.resolver';
import { FileController } from './controllers/file.controller';
@Module({
provide... | 2,982 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/file/file.utils.ts | import { BadRequestException } from '@nestjs/common';
import { basename } from 'path';
import { KebabCase } from 'type-fest';
import { kebabCase } from 'src/utils/kebab-case';
import { settings } from 'src/constants/settings';
import { FileFolder } from './interfaces/file-folder.interface';
type AllowedFolders = K... | 2,983 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/controllers/file.controller.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { FileService } from 'src/core/file/services/file.service';
import { FileController } from './file.controller';
describe('FileController', () => {
let controller: FileController;
beforeEach(async () => {
const module: TestingModule = await Test.c... | 2,984 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/controllers/file.controller.ts | import { Controller, Get, Param, Res } from '@nestjs/common';
import { Response } from 'express';
import { checkFilePath, checkFilename } from 'src/core/file/file.utils';
import { FileService } from 'src/core/file/services/file.service';
// TODO: Add cookie authentication
@Controller('files')
export class FileContro... | 2,985 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/interfaces/file-folder.interface.ts | import { registerEnumType } from '@nestjs/graphql';
export enum FileFolder {
ProfilePicture = 'profile-picture',
WorkspaceLogo = 'workspace-logo',
Attachment = 'attachment',
PersonPicture = 'person-picture',
}
registerEnumType(FileFolder, {
name: 'FileFolder',
});
| 2,986 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/resolvers/file-upload.resolver.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { FileUploadService } from 'src/core/file/services/file-upload.service';
import { FileUploadResolver } from './file-upload.resolver';
describe('FileUploadResolver', () => {
let resolver: FileUploadResolver;
beforeEach(async () => {
const module: ... | 2,987 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/resolvers/file-upload.resolver.ts | import { Args, Mutation, Resolver } from '@nestjs/graphql';
import { UseGuards } from '@nestjs/common';
import { GraphQLUpload, FileUpload } from 'graphql-upload';
import { FileFolder } from 'src/core/file/interfaces/file-folder.interface';
import { FileUploadService } from 'src/core/file/services/file-upload.servic... | 2,988 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/services/file-upload.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
import { FileUploadService } from './file-upload.service';
describe('FileUploadService... | 2,989 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/services/file-upload.service.ts | import { Injectable } from '@nestjs/common';
import sharp from 'sharp';
import { v4 as uuidV4 } from 'uuid';
import { FileFolder } from 'src/core/file/interfaces/file-folder.interface';
import { getCropSize } from 'src/utils/image';
import { settings } from 'src/constants/settings';
import { FileStorageService } fro... | 2,990 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/services/file.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
import { FileService } from './file.service';
describe('FileService', () => {
let se... | 2,991 |
0 | petrpan-code/twentyhq/twenty/server/src/core/file | petrpan-code/twentyhq/twenty/server/src/core/file/services/file.service.ts | import { Injectable } from '@nestjs/common';
import { FileStorageService } from 'src/integrations/file-storage/file-storage.service';
@Injectable()
export class FileService {
constructor(private readonly fileStorageService: FileStorageService) {}
async getFileStream(folderPath: string, filename: string) {
re... | 2,992 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/refresh-token.auto-resolver-opts.ts | import {
AutoResolverOpts,
PagingStrategies,
ReadResolverOpts,
} from '@ptc-org/nestjs-query-graphql';
import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
import { RefreshToken } from './refresh-token.entity';
import { CreateRefreshTokenInput } from './dtos/create-refresh-token.input';
export const refr... | 2,993 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/refresh-token.entity.ts | import { Field, ID, ObjectType } from '@nestjs/graphql';
import {
Entity,
Column,
PrimaryGeneratedColumn,
ManyToOne,
JoinColumn,
CreateDateColumn,
UpdateDateColumn,
} from 'typeorm';
import { BeforeCreateOne, IDField } from '@ptc-org/nestjs-query-graphql';
import { User } from 'src/core/user/user.entity... | 2,994 |
0 | petrpan-code/twentyhq/twenty/server/src/core | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/refresh-token.module.ts | import { Module } from '@nestjs/common';
import { NestjsQueryGraphQLModule } from '@ptc-org/nestjs-query-graphql';
import { NestjsQueryTypeOrmModule } from '@ptc-org/nestjs-query-typeorm';
import { RefreshToken } from './refresh-token.entity';
import { refreshTokenAutoResolverOpts } from './refresh-token.auto-resolve... | 2,995 |
0 | petrpan-code/twentyhq/twenty/server/src/core/refresh-token | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/dtos/create-refresh-token.input.ts | import { Field, InputType } from '@nestjs/graphql';
import { IsDate, IsNotEmpty } from 'class-validator';
@InputType()
export class CreateRefreshTokenInput {
@IsDate()
@IsNotEmpty()
@Field()
expiresAt: Date;
}
| 2,996 |
0 | petrpan-code/twentyhq/twenty/server/src/core/refresh-token | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/hooks/before-create-one-refresh-token.hook.ts | import {
BeforeCreateOneHook,
CreateOneInputType,
} from '@ptc-org/nestjs-query-graphql';
import { v4 as uuidv4 } from 'uuid';
import { RefreshToken } from 'src/core/refresh-token/refresh-token.entity';
export class BeforeCreateOneRefreshToken<T extends RefreshToken>
implements BeforeCreateOneHook<T, any>
{
a... | 2,997 |
0 | petrpan-code/twentyhq/twenty/server/src/core/refresh-token | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/services/refresh-token.service.spec.ts | import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import { RefreshToken } from 'src/core/refresh-token/refresh-token.entity';
import { RefreshTokenService } from './refresh-token.service';
describe('RefreshTokenService', () => {
let service: RefreshTokenSe... | 2,998 |
0 | petrpan-code/twentyhq/twenty/server/src/core/refresh-token | petrpan-code/twentyhq/twenty/server/src/core/refresh-token/services/refresh-token.service.ts | import { TypeOrmQueryService } from '@ptc-org/nestjs-query-typeorm';
import { RefreshToken } from 'src/core/refresh-token/refresh-token.entity';
export class RefreshTokenService extends TypeOrmQueryService<RefreshToken> {}
| 2,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.