🔄 Rename all "twake" instances to "tdrive"
🔄 Rename all "twake" instances to "tdrive"
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { CommandModule } from "yargs";
|
||||
|
||||
const command: CommandModule = {
|
||||
describe: "Manage Twake Applications",
|
||||
describe: "Manage Tdrive Applications",
|
||||
command: "applications <command>",
|
||||
builder: yargs =>
|
||||
yargs.commandDir("applications_cmds", {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CommandModule } from "yargs";
|
||||
|
||||
const command: CommandModule = {
|
||||
describe: "Export Twake data",
|
||||
describe: "Export Tdrive data",
|
||||
command: "export <command>",
|
||||
builder: yargs =>
|
||||
yargs.commandDir("export_cmds", {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import yargs from "yargs";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import { mkdirSync, writeFileSync } from "fs";
|
||||
import { Pagination } from "../../../core/platform/framework/api/crud-service";
|
||||
import WorkspaceUser from "../../../services/workspaces/entities/workspace_user";
|
||||
@@ -52,7 +52,7 @@ const command: yargs.CommandModule<unknown, CLIArgs> = {
|
||||
},
|
||||
},
|
||||
handler: async argv => {
|
||||
const platform = await twake.run(services);
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
|
||||
const company = await gr.services.companies.getCompany({ id: argv.id });
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CommandModule } from "yargs";
|
||||
|
||||
const command: CommandModule = {
|
||||
describe: "Generate Twake data",
|
||||
describe: "Generate Tdrive data",
|
||||
command: "generate <command>",
|
||||
builder: yargs =>
|
||||
yargs.commandDir("generate_cmds", {
|
||||
|
||||
@@ -8,7 +8,7 @@ import Company, {
|
||||
getInstance as getCompanyInstance,
|
||||
} from "../../../services/user/entities/company";
|
||||
import CompanyUser from "../../../services/user/entities/company_user";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import User, { getInstance as getUserInstance } from "../../../services/user/entities/user";
|
||||
import gr from "../../../services/global-resolver";
|
||||
|
||||
@@ -63,7 +63,7 @@ const command: yargs.CommandModule<{}, CLIArgs> = {
|
||||
const concurrentTasks = argv.concurrent;
|
||||
const nbUsersPerCompany = argv.user;
|
||||
const nbCompanies = argv.company;
|
||||
const platform = await twake.run(services);
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
const companies = getCompanies(nbCompanies);
|
||||
const createUser = async (userInCompany: {
|
||||
@@ -114,8 +114,8 @@ const getCompanies = (size: number = 10): Company[] => {
|
||||
return [...Array(size).keys()].map(i =>
|
||||
getCompanyInstance({
|
||||
id: uuid(),
|
||||
name: `twake${i}.app`,
|
||||
displayName: `My Twake Company #${i}`,
|
||||
name: `tdrive${i}.app`,
|
||||
displayName: `My Tdrive Company #${i}`,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import yargs from "yargs";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import ora from "ora";
|
||||
import { TwakePlatform } from "../../../core/platform/platform";
|
||||
import { TdrivePlatform } from "../../../core/platform/platform";
|
||||
import { DatabaseServiceAPI } from "../../../core/platform/services/database/api";
|
||||
import { Pagination } from "../../../core/platform/framework/api/crud-service";
|
||||
|
||||
@@ -21,7 +21,7 @@ class SearchIndexAll {
|
||||
database: DatabaseServiceAPI;
|
||||
search: SearchServiceAPI;
|
||||
|
||||
constructor(readonly platform: TwakePlatform) {
|
||||
constructor(readonly platform: TdrivePlatform) {
|
||||
this.database = this.platform.getProvider<DatabaseServiceAPI>("database");
|
||||
this.search = this.platform.getProvider<SearchServiceAPI>("search");
|
||||
}
|
||||
@@ -122,7 +122,7 @@ const command: yargs.CommandModule<unknown, unknown> = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
handler: async argv => {
|
||||
const spinner = ora({ text: "Reindex repository - " }).start();
|
||||
const platform = await twake.run(services);
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
const migrator = new SearchIndexAll(platform);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CommandModule } from "yargs";
|
||||
|
||||
const command: CommandModule = {
|
||||
describe: "Manage Twake Users",
|
||||
describe: "Manage Tdrive Users",
|
||||
command: "users <command>",
|
||||
builder: yargs =>
|
||||
yargs.commandDir("users_cmds", {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import yargs from "yargs";
|
||||
import ora from "ora";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import Table from "cli-table";
|
||||
import { exit } from "process";
|
||||
import gr from "../../../services/global-resolver";
|
||||
@@ -49,7 +49,7 @@ const command: yargs.CommandModule<unknown, CLIArgs> = {
|
||||
});
|
||||
const spinner = ora({ text: "Retrieving user" }).start();
|
||||
|
||||
const platform = await twake.run(services);
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
|
||||
const user = await gr.services.users.get({ id: argv.id });
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CommandModule } from "yargs";
|
||||
|
||||
const command: CommandModule = {
|
||||
describe: "Manage Twake Workspaces",
|
||||
describe: "Manage Tdrive Workspaces",
|
||||
command: "workspace <command>",
|
||||
builder: yargs =>
|
||||
yargs.commandDir("workspace_cmds", {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import yargs from "yargs";
|
||||
import ora from "ora";
|
||||
import Table from "cli-table";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import gr from "../../../services/global-resolver";
|
||||
/**
|
||||
* Merge command parameters. Check the builder definition below for more details.
|
||||
@@ -23,7 +23,7 @@ const services = [
|
||||
|
||||
const command: yargs.CommandModule<ListParams, ListParams> = {
|
||||
command: "list",
|
||||
describe: "List Twake workspaces",
|
||||
describe: "List Tdrive workspaces",
|
||||
builder: {
|
||||
size: {
|
||||
default: "50",
|
||||
@@ -33,8 +33,8 @@ const command: yargs.CommandModule<ListParams, ListParams> = {
|
||||
},
|
||||
handler: async argv => {
|
||||
const table = new Table({ head: ["ID", "Name"], colWidths: [40, 50] });
|
||||
const spinner = ora({ text: "List Twake workspaces" }).start();
|
||||
const platform = await twake.run(services);
|
||||
const spinner = ora({ text: "List Tdrive workspaces" }).start();
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
const workspaces = await gr.services.workspaces.list({ limitStr: argv.size });
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import yargs from "yargs";
|
||||
import ora from "ora";
|
||||
import Table from "cli-table";
|
||||
import twake from "../../../twake";
|
||||
import tdrive from "../../../tdrive";
|
||||
import gr from "../../../services/global-resolver";
|
||||
/**
|
||||
* Merge command parameters. Check the builder definition below for more details.
|
||||
@@ -34,7 +34,7 @@ const command: yargs.CommandModule<ListParams, ListParams> = {
|
||||
handler: async argv => {
|
||||
const table = new Table({ head: ["user ID", "Date Added"], colWidths: [40, 40] });
|
||||
const spinner = ora({ text: "Retrieving workspace users" }).start();
|
||||
const platform = await twake.run(services);
|
||||
const platform = await tdrive.run(services);
|
||||
await gr.doInit(platform);
|
||||
const users = await gr.services.workspaces.getUsers({ workspaceId: argv.id });
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ yargs
|
||||
.alias("help", "h")
|
||||
.help("help")
|
||||
.version()
|
||||
.epilogue("for more information, go to https://twake.app")
|
||||
.epilogue("for more information, go to https://tdrive.app")
|
||||
.example("$0 <command> --help", "show help of the issue command").argv;
|
||||
|
||||
@@ -3,18 +3,18 @@ var cassandra = require("cassandra-driver");
|
||||
|
||||
var fromAuthProvider = new cassandra.auth.PlainTextAuthProvider("", "");
|
||||
var fromContactPoints = [""];
|
||||
var fromKeyspace = "twake";
|
||||
var fromKeyspace = "tdrive";
|
||||
|
||||
var toAuthProvider = new cassandra.auth.PlainTextAuthProvider("", "");
|
||||
var toContactPoints = [""];
|
||||
var toKeyspace = "twake";
|
||||
var toKeyspace = "tdrive";
|
||||
|
||||
var forceUpdateAll = false;
|
||||
var ignoreTables = ["notification"];
|
||||
var countersTables = ["statistics", "stats_counter", "channel_counters", "scheduled_queue_counter"];
|
||||
|
||||
var specialConversions = {
|
||||
"twake.group_user.date_added": value => {
|
||||
"tdrive.group_user.date_added": value => {
|
||||
return new Date(value).getTime();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,14 +13,14 @@ var fromClient = new cassandra.Client({
|
||||
localDataCenter: "datacenter1",
|
||||
contactPoints: fromContactPoints,
|
||||
authProvider: fromAuthProvider,
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
});
|
||||
|
||||
var toClient = new cassandra.Client({
|
||||
localDataCenter: "datacenter1",
|
||||
contactPoints: toContactPoints,
|
||||
authProvider: toAuthProvider,
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
queryOptions: {
|
||||
consistency: cassandra.types.consistencies.quorum,
|
||||
},
|
||||
@@ -48,7 +48,7 @@ let copiedThreads = 0;
|
||||
(async () => {
|
||||
await new Promise(r => {
|
||||
fromClient.eachRow(
|
||||
"SELECT id from twake.threads",
|
||||
"SELECT id from tdrive.threads",
|
||||
[],
|
||||
{ prepare: true, fetchSize: 50 },
|
||||
async function (n, row) {
|
||||
@@ -60,7 +60,7 @@ let copiedThreads = 0;
|
||||
|
||||
await new Promise(r2 => {
|
||||
fromClient.eachRow(
|
||||
"SELECT JSON * from twake.messages where thread_id = ? order by id desc",
|
||||
"SELECT JSON * from tdrive.messages where thread_id = ? order by id desc",
|
||||
[threadId],
|
||||
{ prepare: true, fetchSize: 1000 },
|
||||
async function (n, row) {
|
||||
@@ -69,7 +69,7 @@ let copiedThreads = 0;
|
||||
copiedMessages++;
|
||||
|
||||
await toClient.execute(
|
||||
"INSERT INTO twake.messages JSON '" + message.replace(/'/g, "'$&") + "'",
|
||||
"INSERT INTO tdrive.messages JSON '" + message.replace(/'/g, "'$&") + "'",
|
||||
[],
|
||||
{ prepare: true },
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ var client = new cassandra.Client({
|
||||
localDataCenter: "datacenter1",
|
||||
contactPoints: contactPoints,
|
||||
authProvider: authProvider,
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
});
|
||||
|
||||
//Copy object to other table
|
||||
|
||||
@@ -8,7 +8,7 @@ var client = new cassandra.Client({
|
||||
localDataCenter: "datacenter1",
|
||||
contactPoints: contactPoints,
|
||||
authProvider: authProvider,
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
});
|
||||
|
||||
var threadsTable = "threads";
|
||||
|
||||
@@ -2,7 +2,6 @@ import { createDecipheriv } from "crypto";
|
||||
import { CryptoResult } from ".";
|
||||
|
||||
const PREFIX = "encrypted_";
|
||||
// const DEFAULT_IV = Buffer.from("twake_constantiv", "utf-8");
|
||||
|
||||
export default {
|
||||
decrypt,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwakeServiceOptions } from "./service-options";
|
||||
import { TwakeServiceConfiguration } from "./service-configuration";
|
||||
import { TdriveServiceOptions } from "./service-options";
|
||||
import { TdriveServiceConfiguration } from "./service-configuration";
|
||||
|
||||
export class TwakeAppConfiguration extends TwakeServiceOptions<TwakeServiceConfiguration> {
|
||||
export class TdriveAppConfiguration extends TdriveServiceOptions<TdriveServiceConfiguration> {
|
||||
services: Array<string>;
|
||||
servicesPath: string;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { TwakeService } from "./service";
|
||||
import { TwakeServiceProvider } from "./service-provider";
|
||||
import { TdriveService } from "./service";
|
||||
import { TdriveServiceProvider } from "./service-provider";
|
||||
import { ServiceDefinition } from "./service-definition";
|
||||
import { TwakeServiceState } from "./service-state";
|
||||
import { TdriveServiceState } from "./service-state";
|
||||
import { logger } from "../logger";
|
||||
|
||||
export class TwakeComponent {
|
||||
instance: TwakeService<TwakeServiceProvider>;
|
||||
components: Array<TwakeComponent> = new Array<TwakeComponent>();
|
||||
export class TdriveComponent {
|
||||
instance: TdriveService<TdriveServiceProvider>;
|
||||
components: Array<TdriveComponent> = new Array<TdriveComponent>();
|
||||
|
||||
constructor(public name: string, private serviceDefinition: ServiceDefinition) {}
|
||||
|
||||
@@ -15,15 +15,15 @@ export class TwakeComponent {
|
||||
return this.serviceDefinition;
|
||||
}
|
||||
|
||||
setServiceInstance(instance: TwakeService<TwakeServiceProvider>): void {
|
||||
setServiceInstance(instance: TdriveService<TdriveServiceProvider>): void {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
getServiceInstance(): TwakeService<TwakeServiceProvider> {
|
||||
getServiceInstance(): TdriveService<TdriveServiceProvider> {
|
||||
return this.instance;
|
||||
}
|
||||
|
||||
addDependency(component: TwakeComponent): void {
|
||||
addDependency(component: TdriveComponent): void {
|
||||
this.components.push(component);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export class TwakeComponent {
|
||||
}
|
||||
|
||||
async switchToState(
|
||||
state: TwakeServiceState.Initialized | TwakeServiceState.Started | TwakeServiceState.Stopped,
|
||||
state: TdriveServiceState.Initialized | TdriveServiceState.Started | TdriveServiceState.Stopped,
|
||||
recursionDepth?: number,
|
||||
): Promise<void> {
|
||||
if (recursionDepth > 10) {
|
||||
@@ -42,7 +42,7 @@ export class TwakeComponent {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const states: BehaviorSubject<TwakeServiceState>[] = this.components.map(
|
||||
const states: BehaviorSubject<TdriveServiceState>[] = this.components.map(
|
||||
component => component.instance.state,
|
||||
);
|
||||
|
||||
@@ -57,10 +57,10 @@ export class TwakeComponent {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async function _switchServiceToState(service: TwakeService<any>) {
|
||||
state === TwakeServiceState.Initialized && (await service.init());
|
||||
state === TwakeServiceState.Started && (await service.start());
|
||||
state === TwakeServiceState.Stopped && (await service.stop());
|
||||
async function _switchServiceToState(service: TdriveService<any>) {
|
||||
state === TdriveServiceState.Initialized && (await service.init());
|
||||
state === TdriveServiceState.Started && (await service.start());
|
||||
state === TdriveServiceState.Stopped && (await service.stop());
|
||||
}
|
||||
await _switchServiceToState(this.instance);
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import { TwakeAppConfiguration } from "./application-configuration";
|
||||
import { TwakeComponent } from "./component";
|
||||
import { TwakeContext } from "./context";
|
||||
import { TwakeServiceProvider } from "./service-provider";
|
||||
import { TwakeService } from "./service";
|
||||
import { TwakeServiceState } from "./service-state";
|
||||
import { TdriveAppConfiguration } from "./application-configuration";
|
||||
import { TdriveComponent } from "./component";
|
||||
import { TdriveContext } from "./context";
|
||||
import { TdriveServiceProvider } from "./service-provider";
|
||||
import { TdriveService } from "./service";
|
||||
import { TdriveServiceState } from "./service-state";
|
||||
import * as ComponentUtils from "../utils/component-utils";
|
||||
|
||||
/**
|
||||
* A container contains components. It provides methods to manage and to retrieve them.
|
||||
*/
|
||||
export abstract class TwakeContainer
|
||||
extends TwakeService<TwakeServiceProvider>
|
||||
implements TwakeContext
|
||||
export abstract class TdriveContainer
|
||||
extends TdriveService<TdriveServiceProvider>
|
||||
implements TdriveContext
|
||||
{
|
||||
private components: Map<string, TwakeComponent>;
|
||||
name = "TwakeContainer";
|
||||
private components: Map<string, TdriveComponent>;
|
||||
name = "TdriveContainer";
|
||||
|
||||
constructor(protected options?: TwakeAppConfiguration) {
|
||||
constructor(protected options?: TdriveAppConfiguration) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
abstract loadComponents(): Promise<Map<string, TwakeComponent>>;
|
||||
abstract loadComponents(): Promise<Map<string, TdriveComponent>>;
|
||||
|
||||
abstract loadComponent(name: string): Promise<TwakeComponent>;
|
||||
abstract loadComponent(name: string): Promise<TdriveComponent>;
|
||||
|
||||
getProvider<T extends TwakeServiceProvider>(name: string): T {
|
||||
getProvider<T extends TdriveServiceProvider>(name: string): T {
|
||||
const service = this.components.get(name)?.getServiceInstance();
|
||||
|
||||
if (!service) {
|
||||
@@ -48,25 +48,25 @@ export abstract class TwakeContainer
|
||||
}
|
||||
|
||||
protected async launchInit(): Promise<this> {
|
||||
await this.switchToState(TwakeServiceState.Initialized);
|
||||
await this.switchToState(TdriveServiceState.Initialized);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async doStart(): Promise<this> {
|
||||
await this.switchToState(TwakeServiceState.Started);
|
||||
await this.switchToState(TdriveServiceState.Started);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async doStop(): Promise<this> {
|
||||
await this.switchToState(TwakeServiceState.Stopped);
|
||||
await this.switchToState(TdriveServiceState.Stopped);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected async switchToState(
|
||||
state: TwakeServiceState.Started | TwakeServiceState.Initialized | TwakeServiceState.Stopped,
|
||||
state: TdriveServiceState.Started | TdriveServiceState.Initialized | TdriveServiceState.Stopped,
|
||||
): Promise<void> {
|
||||
await ComponentUtils.switchComponentsToState(this.components, state);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TwakeServiceProvider } from "./service-provider";
|
||||
import { TdriveServiceProvider } from "./service-provider";
|
||||
|
||||
export interface TwakeContext {
|
||||
getProvider<T extends TwakeServiceProvider>(name: string): T;
|
||||
export interface TdriveContext {
|
||||
getProvider<T extends TdriveServiceProvider>(name: string): T;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TwakeContext } from "./context";
|
||||
import { TdriveContext } from "./context";
|
||||
|
||||
export interface Initializable {
|
||||
// TODO: Flag to tell if a service which fails to initialize must break all
|
||||
init?(context?: TwakeContext): Promise<this>;
|
||||
init?(context?: TdriveContext): Promise<this>;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export interface TwakeServiceConfiguration {
|
||||
export interface TdriveServiceConfiguration {
|
||||
get<T>(name?: string, defaultValue?: T): T;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TwakeServiceProvider } from "./service-provider";
|
||||
import { TdriveServiceProvider } from "./service-provider";
|
||||
|
||||
export interface TwakeServiceInterface<T extends TwakeServiceProvider> {
|
||||
export interface TdriveServiceInterface<T extends TdriveServiceProvider> {
|
||||
doInit(): Promise<this>;
|
||||
doStart(): Promise<this>;
|
||||
doStop(): Promise<this>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export class TwakeServiceOptions<TwakeServiceConfiguration> {
|
||||
export class TdriveServiceOptions<TdriveServiceConfiguration> {
|
||||
name?: string;
|
||||
// TODO: configuration is abstract and comes from all others
|
||||
configuration?: TwakeServiceConfiguration;
|
||||
configuration?: TdriveServiceConfiguration;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export interface TwakeServiceProvider {
|
||||
export interface TdriveServiceProvider {
|
||||
version: string;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export enum TwakeServiceState {
|
||||
export enum TdriveServiceState {
|
||||
Ready = "READY",
|
||||
Initializing = "INITIALIZING",
|
||||
Initialized = "INITIALIZED",
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { TwakeServiceInterface } from "./service-interface";
|
||||
import { TwakeServiceProvider } from "./service-provider";
|
||||
import { TwakeServiceState } from "./service-state";
|
||||
import { TwakeServiceConfiguration } from "./service-configuration";
|
||||
import { TwakeContext } from "./context";
|
||||
import { TwakeServiceOptions } from "./service-options";
|
||||
import { TdriveServiceInterface } from "./service-interface";
|
||||
import { TdriveServiceProvider } from "./service-provider";
|
||||
import { TdriveServiceState } from "./service-state";
|
||||
import { TdriveServiceConfiguration } from "./service-configuration";
|
||||
import { TdriveContext } from "./context";
|
||||
import { TdriveServiceOptions } from "./service-options";
|
||||
import { CONSUMES_METADATA, PREFIX_METADATA } from "./constants";
|
||||
import { getLogger, logger } from "../logger";
|
||||
import { TwakeLogger } from "..";
|
||||
import { TdriveLogger } from "..";
|
||||
|
||||
const pendingServices: any = {};
|
||||
|
||||
export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
implements TwakeServiceInterface<TwakeServiceProvider>
|
||||
export abstract class TdriveService<T extends TdriveServiceProvider>
|
||||
implements TdriveServiceInterface<TdriveServiceProvider>
|
||||
{
|
||||
state: BehaviorSubject<TwakeServiceState>;
|
||||
state: BehaviorSubject<TdriveServiceState>;
|
||||
readonly name: string;
|
||||
protected readonly configuration: TwakeServiceConfiguration;
|
||||
context: TwakeContext;
|
||||
logger: TwakeLogger;
|
||||
protected readonly configuration: TdriveServiceConfiguration;
|
||||
context: TdriveContext;
|
||||
logger: TdriveLogger;
|
||||
|
||||
constructor(protected options?: TwakeServiceOptions<TwakeServiceConfiguration>) {
|
||||
this.state = new BehaviorSubject<TwakeServiceState>(TwakeServiceState.Ready);
|
||||
constructor(protected options?: TdriveServiceOptions<TdriveServiceConfiguration>) {
|
||||
this.state = new BehaviorSubject<TdriveServiceState>(TdriveServiceState.Ready);
|
||||
// REMOVE ME, we should import config from framework folder instead
|
||||
this.configuration = options?.configuration;
|
||||
this.logger = getLogger(`core.platform.services.${this.name}Service`);
|
||||
@@ -38,7 +38,7 @@ export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
}
|
||||
|
||||
async init(): Promise<this> {
|
||||
if (this.state.value !== TwakeServiceState.Ready) {
|
||||
if (this.state.value !== TdriveServiceState.Ready) {
|
||||
logger.info("Service %s is already initialized", this.name);
|
||||
return this;
|
||||
}
|
||||
@@ -46,9 +46,9 @@ export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
try {
|
||||
logger.info("Initializing service %s", this.name);
|
||||
pendingServices[this.name] = true;
|
||||
this.state.next(TwakeServiceState.Initializing);
|
||||
this.state.next(TdriveServiceState.Initializing);
|
||||
await this.doInit();
|
||||
this.state.next(TwakeServiceState.Initialized);
|
||||
this.state.next(TdriveServiceState.Initialized);
|
||||
logger.info("Service %s is initialized", this.name);
|
||||
delete pendingServices[this.name];
|
||||
logger.info("Pending services: %s", JSON.stringify(Object.keys(pendingServices)));
|
||||
@@ -72,8 +72,8 @@ export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
|
||||
async start(): Promise<this> {
|
||||
if (
|
||||
this.state.value === TwakeServiceState.Starting ||
|
||||
this.state.value === TwakeServiceState.Started
|
||||
this.state.value === TdriveServiceState.Starting ||
|
||||
this.state.value === TdriveServiceState.Started
|
||||
) {
|
||||
logger.info("Service %s is already started", this.name);
|
||||
return this;
|
||||
@@ -81,9 +81,9 @@ export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
|
||||
try {
|
||||
logger.info("Starting service %s", this.name);
|
||||
this.state.next(TwakeServiceState.Starting);
|
||||
this.state.next(TdriveServiceState.Starting);
|
||||
await this.doStart();
|
||||
this.state.next(TwakeServiceState.Started);
|
||||
this.state.next(TdriveServiceState.Started);
|
||||
logger.info("Service %s is started", this.name);
|
||||
|
||||
return this;
|
||||
@@ -98,23 +98,23 @@ export abstract class TwakeService<T extends TwakeServiceProvider>
|
||||
|
||||
async stop(): Promise<this> {
|
||||
if (
|
||||
this.state.value === TwakeServiceState.Stopping ||
|
||||
this.state.value === TwakeServiceState.Stopped
|
||||
this.state.value === TdriveServiceState.Stopping ||
|
||||
this.state.value === TdriveServiceState.Stopped
|
||||
) {
|
||||
logger.info("Service %s is already stopped", this.name);
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.state.value !== TwakeServiceState.Started) {
|
||||
if (this.state.value !== TdriveServiceState.Started) {
|
||||
logger.info("Service %s can not be stopped until started", this.name);
|
||||
return this;
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info("Stopping service %s", this.name);
|
||||
this.state.next(TwakeServiceState.Stopping);
|
||||
this.state.next(TdriveServiceState.Stopping);
|
||||
await this.doStop();
|
||||
this.state.next(TwakeServiceState.Stopped);
|
||||
this.state.next(TdriveServiceState.Stopped);
|
||||
logger.info("Service %s is stopped", this.name);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IConfig } from "config";
|
||||
import configuration from "../../config";
|
||||
import { TwakeServiceConfiguration } from "./api";
|
||||
export class Configuration implements TwakeServiceConfiguration {
|
||||
import { TdriveServiceConfiguration } from "./api";
|
||||
export class Configuration implements TdriveServiceConfiguration {
|
||||
configuration: IConfig;
|
||||
serviceConfiguration: IConfig;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { logger as rootLogger } from "./logger";
|
||||
import { ExecutionContext } from "./api/crud-service";
|
||||
|
||||
const logger = rootLogger.child({
|
||||
component: "twake.core.platform.framework.event-bus",
|
||||
component: "tdrive.core.platform.framework.event-bus",
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import {
|
||||
TwakeContext,
|
||||
TwakeService,
|
||||
TwakeServiceConfiguration,
|
||||
TwakeServiceOptions,
|
||||
TwakeServiceProvider,
|
||||
TdriveContext,
|
||||
TdriveService,
|
||||
TdriveServiceConfiguration,
|
||||
TdriveServiceOptions,
|
||||
TdriveServiceProvider,
|
||||
} from "./api";
|
||||
import { Configuration } from "./configuration";
|
||||
|
||||
class StaticTwakeServiceFactory {
|
||||
class StaticTdriveServiceFactory {
|
||||
public async create<
|
||||
T extends TwakeService<TwakeServiceProvider> = TwakeService<TwakeServiceProvider>,
|
||||
T extends TdriveService<TdriveServiceProvider> = TdriveService<TdriveServiceProvider>,
|
||||
>(
|
||||
module: { new (options?: TwakeServiceOptions<TwakeServiceConfiguration>): T },
|
||||
context: TwakeContext,
|
||||
module: { new (options?: TdriveServiceOptions<TdriveServiceConfiguration>): T },
|
||||
context: TdriveContext,
|
||||
configuration?: string,
|
||||
): Promise<T> {
|
||||
let config;
|
||||
@@ -29,4 +29,4 @@ class StaticTwakeServiceFactory {
|
||||
}
|
||||
}
|
||||
|
||||
export const TwakeServiceFactory = new StaticTwakeServiceFactory();
|
||||
export const TdriveServiceFactory = new StaticTdriveServiceFactory();
|
||||
|
||||
@@ -3,13 +3,13 @@ import { Configuration } from "./configuration";
|
||||
|
||||
const config = new Configuration("logger");
|
||||
|
||||
export type TwakeLogger = pino.Logger;
|
||||
export type TdriveLogger = pino.Logger;
|
||||
|
||||
export const logger = pino({
|
||||
name: "TwakeApp",
|
||||
name: "TdriveApp",
|
||||
level: config.get("level", "info") || "info",
|
||||
prettyPrint: false,
|
||||
});
|
||||
|
||||
export const getLogger = (name?: string): TwakeLogger =>
|
||||
logger.child({ name: `twake${name ? "." + name : ""}` });
|
||||
export const getLogger = (name?: string): TdriveLogger =>
|
||||
logger.child({ name: `tdrive${name ? "." + name : ""}` });
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
||||
import {
|
||||
logger,
|
||||
TwakeComponent,
|
||||
TwakeContext,
|
||||
TwakeServiceFactory,
|
||||
TwakeServiceState,
|
||||
TdriveComponent,
|
||||
TdriveContext,
|
||||
TdriveServiceFactory,
|
||||
TdriveServiceState,
|
||||
} from "../index";
|
||||
import { Loader } from "./loader";
|
||||
|
||||
export async function buildDependenciesTree(
|
||||
components: Map<string, TwakeComponent>,
|
||||
components: Map<string, TdriveComponent>,
|
||||
loadComponent: (name: string) => any,
|
||||
): Promise<void> {
|
||||
for (const [name, component] of components) {
|
||||
@@ -62,15 +62,15 @@ export async function buildDependenciesTree(
|
||||
export async function loadComponents(
|
||||
paths: string[],
|
||||
names: string[] = [],
|
||||
context: TwakeContext,
|
||||
): Promise<Map<string, TwakeComponent>> {
|
||||
const result = new Map<string, TwakeComponent>();
|
||||
context: TdriveContext,
|
||||
): Promise<Map<string, TdriveComponent>> {
|
||||
const result = new Map<string, TdriveComponent>();
|
||||
const loader = new Loader(paths);
|
||||
|
||||
const components: TwakeComponent[] = await Promise.all(
|
||||
const components: TdriveComponent[] = await Promise.all(
|
||||
names.map(async name => {
|
||||
const clazz = await loader.load(name);
|
||||
const component = new TwakeComponent(name, { clazz, name });
|
||||
const component = new TdriveComponent(name, { clazz, name });
|
||||
result.set(name, component);
|
||||
|
||||
return component;
|
||||
@@ -79,7 +79,7 @@ export async function loadComponents(
|
||||
|
||||
await Promise.all(
|
||||
components.map(async component => {
|
||||
const service = await TwakeServiceFactory.create(
|
||||
const service = await TdriveServiceFactory.create(
|
||||
component.getServiceDefinition().clazz,
|
||||
context,
|
||||
component.getServiceDefinition().name,
|
||||
@@ -93,8 +93,8 @@ export async function loadComponents(
|
||||
}
|
||||
|
||||
export async function switchComponentsToState(
|
||||
components: Map<string, TwakeComponent>,
|
||||
state: TwakeServiceState.Initialized | TwakeServiceState.Started | TwakeServiceState.Stopped,
|
||||
components: Map<string, TdriveComponent>,
|
||||
state: TdriveServiceState.Initialized | TdriveServiceState.Started | TdriveServiceState.Stopped,
|
||||
): Promise<void> {
|
||||
const states = [];
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { TwakeContainer, TwakeServiceProvider, TwakeComponent } from "./framework";
|
||||
import { TdriveContainer, TdriveServiceProvider, TdriveComponent } from "./framework";
|
||||
import * as ComponentUtils from "./framework/utils/component-utils";
|
||||
import path from "path";
|
||||
|
||||
export class TwakePlatform extends TwakeContainer {
|
||||
constructor(protected options: TwakePlatformConfiguration) {
|
||||
export class TdrivePlatform extends TdriveContainer {
|
||||
constructor(protected options: TdrivePlatformConfiguration) {
|
||||
super();
|
||||
}
|
||||
|
||||
api(): TwakeServiceProvider {
|
||||
api(): TdriveServiceProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
async loadComponents(): Promise<Map<string, TwakeComponent>> {
|
||||
async loadComponents(): Promise<Map<string, TdriveComponent>> {
|
||||
return await ComponentUtils.loadComponents(
|
||||
[this.options.servicesPath, path.resolve(__dirname, "./services/")],
|
||||
this.options.services,
|
||||
@@ -21,7 +21,7 @@ export class TwakePlatform extends TwakeContainer {
|
||||
);
|
||||
}
|
||||
|
||||
async loadComponent(name: string): Promise<TwakeComponent> {
|
||||
async loadComponent(name: string): Promise<TdriveComponent> {
|
||||
return (
|
||||
await ComponentUtils.loadComponents(
|
||||
[this.options.servicesPath, path.resolve(__dirname, "./services/")],
|
||||
@@ -34,7 +34,7 @@ export class TwakePlatform extends TwakeContainer {
|
||||
}
|
||||
}
|
||||
|
||||
export class TwakePlatformConfiguration {
|
||||
export class TdrivePlatformConfiguration {
|
||||
/**
|
||||
* The services to load in the container
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TwakeService, Consumes, Prefix, ServiceName } from "../../framework";
|
||||
import { TdriveService, Consumes, Prefix, ServiceName } from "../../framework";
|
||||
import web from "./web/index";
|
||||
import AuthServiceAPI, { JwtConfiguration } from "./provider";
|
||||
import { AuthService as AuthServiceImpl } from "./service";
|
||||
@@ -7,7 +7,7 @@ import WebServerAPI from "../webserver/provider";
|
||||
@Prefix("/api/auth")
|
||||
@Consumes(["webserver"])
|
||||
@ServiceName("auth")
|
||||
export default class AuthService extends TwakeService<AuthServiceAPI> {
|
||||
export default class AuthService extends TdriveService<AuthServiceAPI> {
|
||||
name = "auth";
|
||||
service: AuthServiceAPI;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwakeServiceProvider } from "../../framework/api";
|
||||
import { TdriveServiceProvider } from "../../framework/api";
|
||||
import { AccessToken, JWTObject, uuid } from "../../../../utils/types";
|
||||
|
||||
export default interface AuthServiceAPI extends TwakeServiceProvider {
|
||||
export default interface AuthServiceAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Get the authentication types
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TwakeService } from "../../framework";
|
||||
import { TdriveService } from "../../framework";
|
||||
import { CounterProvider } from "./provider";
|
||||
import { CounterAPI } from "./types";
|
||||
import Repository from "../database/services/orm/repository/repository";
|
||||
|
||||
export default class CounterService extends TwakeService<CounterAPI> implements CounterAPI {
|
||||
export default class CounterService extends TdriveService<CounterAPI> implements CounterAPI {
|
||||
name = "counter";
|
||||
version = "1";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import Repository from "../database/services/orm/repository/repository";
|
||||
import { CounterProvider } from "./provider";
|
||||
|
||||
export interface CounterAPI extends TwakeServiceProvider {
|
||||
export interface CounterAPI extends TdriveServiceProvider {
|
||||
getCounter<T>(repository: Repository<T>): CounterProvider<T>;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ScheduledTask } from "node-cron";
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
|
||||
export type CronJob = () => void;
|
||||
|
||||
@@ -18,7 +18,7 @@ export type CronTask = {
|
||||
stop: () => void;
|
||||
};
|
||||
|
||||
export interface CronAPI extends TwakeServiceProvider {
|
||||
export interface CronAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Schedule a Job
|
||||
*
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as cron from "node-cron";
|
||||
import uuid from "node-uuid";
|
||||
|
||||
import { TwakeService } from "../../framework";
|
||||
import { TdriveService } from "../../framework";
|
||||
import { CronAPI, CronJob, CronExpression, CronTask } from "./api";
|
||||
|
||||
export default class CronService extends TwakeService<CronAPI> implements CronAPI {
|
||||
export default class CronService extends TdriveService<CronAPI> implements CronAPI {
|
||||
name = "cron";
|
||||
version = "1";
|
||||
private tasks = new Array<CronTask>();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { Connector } from "./services/orm/connectors";
|
||||
import Manager from "./services/orm/manager";
|
||||
import Repository from "./services/orm/repository/repository";
|
||||
import { EntityTarget } from "./services/orm/types";
|
||||
|
||||
export interface DatabaseServiceAPI extends TwakeServiceProvider {
|
||||
export interface DatabaseServiceAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Get the database connector
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { TwakeService, logger, ServiceName } from "../../framework";
|
||||
import { TdriveService, logger, ServiceName } from "../../framework";
|
||||
import { DatabaseServiceAPI } from "./api";
|
||||
import DatabaseService from "./services";
|
||||
import { DatabaseType } from "./services";
|
||||
import { ConnectionOptions } from "./services/orm/connectors";
|
||||
|
||||
@ServiceName("database")
|
||||
export default class Database extends TwakeService<DatabaseServiceAPI> {
|
||||
export default class Database extends TdriveService<DatabaseServiceAPI> {
|
||||
version = "1";
|
||||
name = "database";
|
||||
service: DatabaseService;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ export function buildSelectQuery<Entity>(
|
||||
keyspace: string;
|
||||
} = {
|
||||
secret: "",
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
},
|
||||
): string {
|
||||
const instance = new (entityType as any)();
|
||||
|
||||
+8
-8
@@ -19,9 +19,9 @@ export const cassandraType = {
|
||||
boolean: "BOOLEAN",
|
||||
|
||||
// backward compatibility
|
||||
twake_boolean: "TINYINT",
|
||||
twake_int: "INT", //Depreciated
|
||||
twake_datetime: "TIMESTAMP", //Depreciated
|
||||
tdrive_boolean: "TINYINT",
|
||||
tdrive_int: "INT", //Depreciated
|
||||
tdrive_datetime: "TIMESTAMP", //Depreciated
|
||||
};
|
||||
|
||||
type TransformOptions = {
|
||||
@@ -36,14 +36,14 @@ export const transformValueToDbString = (
|
||||
type: ColumnType,
|
||||
options: TransformOptions = {},
|
||||
): string => {
|
||||
if (type === "twake_datetime") {
|
||||
if (type === "tdrive_datetime") {
|
||||
if (isNaN(v) || isNull(v)) {
|
||||
return "null";
|
||||
}
|
||||
return `${v}`;
|
||||
}
|
||||
|
||||
if (type === "number" || type === "twake_int") {
|
||||
if (type === "number" || type === "tdrive_int") {
|
||||
if (isNull(v)) {
|
||||
return "null";
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export const transformValueToDbString = (
|
||||
}
|
||||
return `${!!v}`;
|
||||
}
|
||||
if (type === "twake_boolean") {
|
||||
if (type === "tdrive_boolean") {
|
||||
if (!isBoolean(v)) {
|
||||
throw new Error(`'${v}' is not a ${type}`);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ export const transformValueFromDbString = (
|
||||
): any => {
|
||||
logger.trace(`Transform value %o of type ${type}`, v);
|
||||
|
||||
if (type === "twake_datetime") {
|
||||
if (type === "tdrive_datetime") {
|
||||
return new Date(`${v}`).getTime();
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export const transformValueFromDbString = (
|
||||
return decryptedValue;
|
||||
}
|
||||
|
||||
if (type === "twake_boolean" || type === "boolean") {
|
||||
if (type === "tdrive_boolean" || type === "boolean") {
|
||||
return Boolean(v).valueOf();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ export function buildSelectQuery<Entity>(
|
||||
keyspace: string;
|
||||
} = {
|
||||
secret: "",
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
},
|
||||
): any {
|
||||
const instance = new (entityType as any)();
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ export const transformValueToDbString = (
|
||||
return v;
|
||||
}
|
||||
|
||||
if (type === "twake_boolean") {
|
||||
if (type === "tdrive_boolean") {
|
||||
return Boolean(v);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export const transformValueFromDbString = (v: any, type: string, options: any =
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (type === "twake_boolean" || type === "boolean") {
|
||||
if (type === "tdrive_boolean" || type === "boolean") {
|
||||
return Boolean(v).valueOf();
|
||||
}
|
||||
if (type === "number") {
|
||||
|
||||
@@ -39,9 +39,9 @@ export type ColumnType =
|
||||
| "blob"
|
||||
| "boolean"
|
||||
// backward compatibility
|
||||
| "twake_boolean"
|
||||
| "twake_int"
|
||||
| "twake_datetime";
|
||||
| "tdrive_boolean"
|
||||
| "tdrive_int"
|
||||
| "tdrive_datetime";
|
||||
|
||||
export type EntityTarget<Entity> = ObjectType<Entity>;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export function secureOperators<Entity>(
|
||||
keyspace: string;
|
||||
} = {
|
||||
secret: "",
|
||||
keyspace: "twake",
|
||||
keyspace: "tdrive",
|
||||
},
|
||||
): FindOptions {
|
||||
const instance = new (entityType as any)();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getLogger, TwakeLogger, TwakeService } from "../../framework";
|
||||
import { getLogger, TdriveLogger, TdriveService } from "../../framework";
|
||||
import EmailPusherAPI from "./provider";
|
||||
import {
|
||||
EmailBuilderDataPayload,
|
||||
@@ -15,12 +15,12 @@ import { existsSync } from "fs";
|
||||
import axios from "axios";
|
||||
|
||||
export default class EmailPusherClass
|
||||
extends TwakeService<EmailPusherAPI>
|
||||
extends TdriveService<EmailPusherAPI>
|
||||
implements EmailPusherAPI
|
||||
{
|
||||
readonly name = "email-pusher";
|
||||
readonly version: "1.0.0";
|
||||
logger: TwakeLogger = getLogger("email-pusher-service");
|
||||
logger: TdriveLogger = getLogger("email-pusher-service");
|
||||
apiKey: string;
|
||||
apiUrl: string;
|
||||
sender: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import {
|
||||
EmailBuilderDataPayload,
|
||||
EmailBuilderRenderedResult,
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
EmailPusherPayload,
|
||||
} from "./types";
|
||||
|
||||
export default interface EmailPusherAPI extends TwakeServiceProvider {
|
||||
export default interface EmailPusherAPI extends TdriveServiceProvider {
|
||||
build(
|
||||
template: EmailBuilderTemplateName,
|
||||
language: string,
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ role="presentation" style="vertical-align:top;" width="100%"
|
||||
>
|
||||
<div
|
||||
style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;"
|
||||
><span>romaric.mollard@gmail.com has invited you to use Twake
|
||||
><span>romaric.mollard@gmail.com has invited you to use Tdrive
|
||||
on</span>
|
||||
<span style="color: #007AFF">Crayon Company</span>.
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@
|
||||
privacy: "Privacy Policy",
|
||||
terms: "Terms of Service",
|
||||
links: {
|
||||
help: "https://twake.app/",
|
||||
privacy: "https://twake.app/en/privacy-policy/",
|
||||
terms: "https://twake.app/en/terms-of-service/"
|
||||
help: "https://tdrive.app/",
|
||||
privacy: "https://tdrive.app/en/privacy-policy/",
|
||||
terms: "https://tdrive.app/en/terms-of-service/"
|
||||
}
|
||||
})) %>
|
||||
+2
-2
@@ -34,8 +34,8 @@
|
||||
),
|
||||
`
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">
|
||||
<a class="main-button" href="https://web.twake.app/">
|
||||
${it.notifications.length>1 ? `See all ${it.notifications.length} messages` : `See on Twake`}
|
||||
<a class="main-button" href="https://web.tdrive.app/">
|
||||
${it.notifications.length>1 ? `See all ${it.notifications.length} messages` : `See on Tdrive`}
|
||||
</a>
|
||||
</div>
|
||||
`
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div style="margin-bottom:16px;display:flex;flex-direction:row;">
|
||||
<div style="width:60px;align-items:end;padding:0;display:flex">
|
||||
<img style="width:48px;height:48px;border-radius:24px;" src="<%= it.message.user.picture || 'https://staging-web.twake.app/public/identicon/47.png' %>" alt="<%= it.message.user.first_name %>" />
|
||||
<img style="width:48px;height:48px;border-radius:24px;" src="<%= it.message.user.picture || 'https://staging-web.tdrive.app/public/identicon/47.png' %>" alt="<%= it.message.user.first_name %>" />
|
||||
</div>
|
||||
<div style="flex:1;position:realtive;border-radius:18px;padding:0 12px;background:#F6F6F6;">
|
||||
<div style="padding:12px 0">
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@
|
||||
privacy: "Confidentialité",
|
||||
terms: "CGU",
|
||||
links: {
|
||||
help: "https://twake.app/",
|
||||
privacy: "https://twake.app/fr/privacy-policy/",
|
||||
terms: "https://twake.app/fr/terms-of-service/"
|
||||
help: "https://tdrive.app/",
|
||||
privacy: "https://tdrive.app/fr/privacy-policy/",
|
||||
terms: "https://tdrive.app/fr/terms-of-service/"
|
||||
}
|
||||
})) %>
|
||||
+2
-2
@@ -36,8 +36,8 @@
|
||||
,
|
||||
`
|
||||
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">
|
||||
<a class="main-button" href="https://web.twake.app/">
|
||||
${it.notifications.length>1 ? `Voir les ${it.notifications.length} messages` : `Voir sur Twake`}
|
||||
<a class="main-button" href="https://web.tdrive.app/">
|
||||
${it.notifications.length>1 ? `Voir les ${it.notifications.length} messages` : `Voir sur Tdrive`}
|
||||
</a>
|
||||
</div>
|
||||
`
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div style="margin-bottom:16px;display:flex;flex-direction:row;">
|
||||
<div style="width:60px;align-items:end;padding:0;display:flex">
|
||||
<img style="width:48px;height:48px;border-radius:24px;" src="<%= it.message.user.picture || 'https://staging-web.twake.app/public/identicon/47.png' %>" alt="<%= it.message.user.first_name %>" />
|
||||
<img style="width:48px;height:48px;border-radius:24px;" src="<%= it.message.user.picture || 'https://staging-web.tdrive.app/public/identicon/47.png' %>" alt="<%= it.message.user.first_name %>" />
|
||||
</div>
|
||||
<div style="flex:1;position:realtive;border-radius:18px;padding:0 12px;background:#F6F6F6;">
|
||||
<div style="padding:12px 0">
|
||||
|
||||
@@ -8,13 +8,13 @@ import gr from "../../../../services/global-resolver";
|
||||
import Company from "../../../../services/user/entities/company";
|
||||
import User from "../../../../services/user/entities/user";
|
||||
import Workspace from "../../../../services/workspaces/entities/workspace";
|
||||
import { getLogger, TwakeLogger } from "../../framework";
|
||||
import { getLogger, TdriveLogger } from "../../framework";
|
||||
|
||||
export default class KnowledgeGraphAPIClient {
|
||||
protected readonly version = "1.0.0";
|
||||
protected readonly axiosInstance: AxiosInstance = axios.create();
|
||||
readonly apiUrl: string;
|
||||
readonly logger: TwakeLogger = getLogger("knowledge-graph-api-client");
|
||||
readonly logger: TdriveLogger = getLogger("knowledge-graph-api-client");
|
||||
|
||||
constructor(apiUrl: string) {
|
||||
this.apiUrl = apiUrl;
|
||||
@@ -141,7 +141,7 @@ export default class KnowledgeGraphAPIClient {
|
||||
private async send(data: any) {
|
||||
return await this.axiosInstance.post<
|
||||
KnowledgeGraphCreateBodyRequest<KnowledgeGraphCreateMessageObjectData[]>
|
||||
>(`${this.apiUrl}/topics/twake`, data, {
|
||||
>(`${this.apiUrl}/topics/tdrive`, data, {
|
||||
headers: {
|
||||
"Content-Type": "application/vnd.kafka.json.v2+json",
|
||||
Accept: "application/vnd.kafka.v2+json",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Configuration, Consumes, getLogger, TwakeLogger, TwakeService } from "../../framework";
|
||||
import { Configuration, Consumes, getLogger, TdriveLogger, TdriveService } from "../../framework";
|
||||
import { localEventBus } from "../../framework/event-bus";
|
||||
import KnowledgeGraphAPI from "./provider";
|
||||
import Workspace from "../../../../services/workspaces/entities/workspace";
|
||||
@@ -15,13 +15,13 @@ import gr from "../../../../services/global-resolver";
|
||||
|
||||
@Consumes([])
|
||||
export default class KnowledgeGraphService
|
||||
extends TwakeService<KnowledgeGraphAPI>
|
||||
extends TdriveService<KnowledgeGraphAPI>
|
||||
implements KnowledgeGraphAPI
|
||||
{
|
||||
readonly name = "knowledge-graph";
|
||||
readonly version = "1.0.0";
|
||||
protected kgAPIClient: KnowledgeGraphAPIClient = this.getKnowledgeGraphApiClient();
|
||||
logger: TwakeLogger = getLogger("knowledge-graph-service");
|
||||
logger: TdriveLogger = getLogger("knowledge-graph-service");
|
||||
|
||||
async doInit(): Promise<this> {
|
||||
const use = this.getConfigurationEntry<boolean>("use");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Company from "../../../../services/user/entities/company";
|
||||
import { Channel } from "../../../../services/channels/entities";
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { KnowledgeGraphGenericEventPayload } from "./types";
|
||||
import Workspace from "../../../../services/workspaces/entities/workspace";
|
||||
import User from "../../../../services/user/entities/user";
|
||||
|
||||
export default interface KnowledgeGraphAPI extends TwakeServiceProvider {
|
||||
export default interface KnowledgeGraphAPI extends TdriveServiceProvider {
|
||||
onCompanyCreated(data: KnowledgeGraphGenericEventPayload<Company>): void;
|
||||
onWorkspaceCreated(data: KnowledgeGraphGenericEventPayload<Workspace>): void;
|
||||
onChannelCreated(data: KnowledgeGraphGenericEventPayload<Channel>): void;
|
||||
|
||||
@@ -12,7 +12,7 @@ import { AMQPMessageQueueManager } from "./manager";
|
||||
import { SkipCLI } from "../../../framework/decorators/skip";
|
||||
|
||||
const logger = rootLogger.child({
|
||||
component: "twake.core.platform.services.message-queue.amqp",
|
||||
component: "tdrive.core.platform.services.message-queue.amqp",
|
||||
});
|
||||
|
||||
export class AMQPMessageQueueService implements MessageQueueAdapter {
|
||||
|
||||
@@ -56,7 +56,7 @@ export class AMQPMessageQueueManager implements MessageQueueClientManager {
|
||||
|
||||
private create(connection: AmqpConnectionManager): Promise<AmqpMessageQueueClient> {
|
||||
logger.info(`${LOG_PREFIX} Creating AMQP Channel`);
|
||||
const channel = connection.createChannel({ name: "Twake" });
|
||||
const channel = connection.createChannel({ name: "Tdrive" });
|
||||
|
||||
channel.on("close", () => {
|
||||
logger.info(`${LOG_PREFIX} Channel is closed`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Subject } from "rxjs";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { Initializable, logger, TwakeServiceProvider } from "../../framework";
|
||||
import { Initializable, logger, TdriveServiceProvider } from "../../framework";
|
||||
import { Processor } from "./processor";
|
||||
import { ExecutionContext } from "../../framework/api/crud-service";
|
||||
|
||||
@@ -60,7 +60,7 @@ export type MessageQueueSubscriptionOptions = {
|
||||
|
||||
export type MessageQueueListener<T> = (message: IncomingMessageQueueMessage<T>) => void;
|
||||
|
||||
export interface MessageQueueServiceAPI extends TwakeServiceProvider {
|
||||
export interface MessageQueueServiceAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Publish a message to a given topic
|
||||
* @param topic The topic to publish the message to
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { MessageQueueAdapter, MessageQueueType } from "./api";
|
||||
import { AMQPMessageQueueService } from "./amqp";
|
||||
import { LocalMessageQueueService } from "./local";
|
||||
import { TwakeServiceConfiguration, logger as rootLogger } from "../../framework";
|
||||
import { TdriveServiceConfiguration, logger as rootLogger } from "../../framework";
|
||||
|
||||
const logger = rootLogger.child({
|
||||
component: "twake.core.platform.services.message-queue.factory",
|
||||
component: "tdrive.core.platform.services.message-queue.factory",
|
||||
});
|
||||
|
||||
const DEFAULT_AMQP_URL = "amqp://guest:guest@localhost:5672";
|
||||
const DEFAULT_ADAPTER = "amqp";
|
||||
|
||||
export class MessageQueueAdapterFactory {
|
||||
public create(configuration: TwakeServiceConfiguration): MessageQueueAdapter {
|
||||
public create(configuration: TdriveServiceConfiguration): MessageQueueAdapter {
|
||||
const type: MessageQueueType = configuration.get<MessageQueueType>("type", DEFAULT_ADAPTER);
|
||||
|
||||
logger.info("Building Adapter %o", type);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TwakeService, ServiceName, logger as rootLogger } from "../../framework";
|
||||
import { TdriveService, ServiceName, logger as rootLogger } from "../../framework";
|
||||
import {
|
||||
MessageQueueAdapter,
|
||||
MessageQueueListener,
|
||||
@@ -13,10 +13,10 @@ import { SkipCLI } from "../../framework/decorators/skip";
|
||||
import config from "../../../../core/config";
|
||||
|
||||
const logger = rootLogger.child({
|
||||
component: "twake.core.platform.services.message-queue",
|
||||
component: "tdrive.core.platform.services.message-queue",
|
||||
});
|
||||
@ServiceName("message-queue")
|
||||
export default class MessageQueue extends TwakeService<MessageQueueServiceAPI> {
|
||||
export default class MessageQueue extends TdriveService<MessageQueueServiceAPI> {
|
||||
version = "1";
|
||||
name = "message-queue";
|
||||
service: MessageQueueService;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import MessageQueueProxy from "../proxy";
|
||||
|
||||
const logger = rootLogger.child({
|
||||
component: "twake.core.platform.services.message-queue.local",
|
||||
component: "tdrive.core.platform.services.message-queue.local",
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ChannelParameters,
|
||||
CreateChannelBody,
|
||||
} from "../../../../services/channels/web/types";
|
||||
import { Consumes, TwakeService } from "../../framework";
|
||||
import { Consumes, TdriveService } from "../../framework";
|
||||
import WebServerAPI from "../webserver/provider";
|
||||
import WebSocketAPI from "../websocket/provider";
|
||||
import PhpNodeAPI from "./provider";
|
||||
@@ -18,7 +18,7 @@ import { RealtimeServiceAPI } from "../realtime/api";
|
||||
import gr from "../../../../services/global-resolver";
|
||||
|
||||
@Consumes(["webserver", "websocket", "user", "channels"])
|
||||
export default class PhpNodeService extends TwakeService<PhpNodeAPI> implements PhpNodeAPI {
|
||||
export default class PhpNodeService extends TdriveService<PhpNodeAPI> implements PhpNodeAPI {
|
||||
name = "phpnode";
|
||||
version = "1";
|
||||
private server: FastifyInstance<Server, IncomingMessage, ServerResponse>;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { FastifyInstance, FastifyRequest, RouteHandlerMethod } from "fastify";
|
||||
import { IncomingMessage, ServerResponse, Server } from "http";
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
|
||||
export default interface PhpNodeAPI extends TwakeServiceProvider {
|
||||
export default interface PhpNodeAPI extends TdriveServiceProvider {
|
||||
accessControl(
|
||||
request: FastifyRequest,
|
||||
server: FastifyInstance<Server, IncomingMessage, ServerResponse>,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { PushMessageNotification, PushMessageOptions } from "./types";
|
||||
|
||||
export interface PushServiceAPI extends TwakeServiceProvider {
|
||||
export interface PushServiceAPI extends TdriveServiceProvider {
|
||||
push(
|
||||
devices: string[],
|
||||
notification: PushMessageNotification,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { TwakeService, logger, ServiceName } from "../../framework";
|
||||
import { TdriveService, logger, ServiceName } from "../../framework";
|
||||
import { PushServiceAPI } from "./api";
|
||||
import { PushConnector } from "./connectors/connector";
|
||||
import FcmPushConnector from "./connectors/fcm/service";
|
||||
import { PushConfiguration, PushMessageNotification, PushMessageOptions } from "./types";
|
||||
|
||||
@ServiceName("push")
|
||||
export default class Push extends TwakeService<PushServiceAPI> {
|
||||
export default class Push extends TdriveService<PushServiceAPI> {
|
||||
version = "1";
|
||||
name = "push";
|
||||
service: PushConnector;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { WebSocketUser, WebSocket } from "../../services/websocket/types";
|
||||
import RealtimeEntityManager from "./services/entity-manager";
|
||||
import { RealtimeEntityEvent } from "./types";
|
||||
|
||||
export interface RealtimeServiceAPI extends TwakeServiceProvider {
|
||||
export interface RealtimeServiceAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Get the realtime event bus instance
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Consumes, ServiceName, TwakeService } from "../../framework";
|
||||
import { Consumes, ServiceName, TdriveService } from "../../framework";
|
||||
import { SkipCLI } from "../../framework/decorators/skip";
|
||||
import { localEventBus } from "../../framework/event-bus";
|
||||
import WebSocketAPI from "../../services/websocket/provider";
|
||||
@@ -12,7 +12,7 @@ import { RealtimeBaseBusEvent, RealtimeLocalBusEvent } from "./types";
|
||||
@Consumes(["websocket", "auth"])
|
||||
@ServiceName("realtime")
|
||||
export default class RealtimeService
|
||||
extends TwakeService<RealtimeServiceAPI>
|
||||
extends TdriveService<RealtimeServiceAPI>
|
||||
implements RealtimeServiceAPI
|
||||
{
|
||||
private roomManager: RoomManagerImpl;
|
||||
|
||||
@@ -88,7 +88,7 @@ export default class RoomManager implements RealtimeRoomManager {
|
||||
}
|
||||
|
||||
//Retro-compatibility for mobile up to february 2021 (to remove after this date)
|
||||
if (joinEvent.token === "twake") return true;
|
||||
if (joinEvent.token === "tdrive") return true;
|
||||
|
||||
const signature = this.auth.verifyTokenObject<WebsocketRoomSignature>(joinEvent.token);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { ListResult } from "../../framework/api/crud-service";
|
||||
import {
|
||||
FindFilter as OrmFindFilter,
|
||||
@@ -57,7 +57,7 @@ export interface SearchAdapterInterface {
|
||||
): Promise<ListResult<IndexedEntity>>;
|
||||
}
|
||||
|
||||
export interface SearchServiceAPI extends TwakeServiceProvider {
|
||||
export interface SearchServiceAPI extends TdriveServiceProvider {
|
||||
getRepository<Entity>(table: string, entityType: EntityTarget<Entity>): SearchRepository<Entity>;
|
||||
upsert(entities: any[]): Promise<void>;
|
||||
remove(entities: any[]): Promise<void>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TwakeService, logger, ServiceName, Consumes } from "../../framework";
|
||||
import { TdriveService, logger, ServiceName, Consumes } from "../../framework";
|
||||
import {
|
||||
DatabaseEntitiesRemovedEvent,
|
||||
DatabaseEntitiesSavedEvent,
|
||||
@@ -15,7 +15,7 @@ import SearchRepository from "./repository";
|
||||
|
||||
@ServiceName("search")
|
||||
@Consumes(["database"])
|
||||
export default class Search extends TwakeService<SearchServiceAPI> {
|
||||
export default class Search extends TdriveService<SearchServiceAPI> {
|
||||
version = "1";
|
||||
name = "search";
|
||||
service: SearchAdapterInterface;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createCipheriv, createDecipheriv, Decipher } from "crypto";
|
||||
import { Stream, Readable } from "stream";
|
||||
import Multistream from "multistream";
|
||||
import { Consumes, logger, TwakeService } from "../../framework";
|
||||
import { Consumes, logger, TdriveService } from "../../framework";
|
||||
import LocalConnectorService, { LocalConfiguration } from "./connectors/local/service";
|
||||
import S3ConnectorService, { S3Configuration } from "./connectors/S3/service";
|
||||
import StorageAPI, {
|
||||
@@ -17,7 +17,7 @@ type EncryptionConfiguration = {
|
||||
iv: string | null;
|
||||
};
|
||||
@Consumes([])
|
||||
export default class StorageService extends TwakeService<StorageAPI> implements StorageAPI {
|
||||
export default class StorageService extends TdriveService<StorageAPI> implements StorageAPI {
|
||||
name = "storage";
|
||||
version = "1";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Stream, Readable } from "stream";
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { ExecutionContext } from "../../framework/api/crud-service";
|
||||
|
||||
export type WriteMetadata = {
|
||||
@@ -51,7 +51,7 @@ export interface StorageConnectorAPI {
|
||||
remove(path: string, options?: DeleteOptions, context?: ExecutionContext): Promise<boolean>;
|
||||
}
|
||||
|
||||
export default interface StorageAPI extends TwakeServiceProvider, StorageConnectorAPI {
|
||||
export default interface StorageAPI extends TdriveServiceProvider, StorageConnectorAPI {
|
||||
getConnector(): StorageConnectorAPI;
|
||||
getConnectorType(): string;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Segment from "./adapters/segment";
|
||||
import { Analytics } from "./adapters/types";
|
||||
import { Consumes, TwakeService, logger } from "../../framework";
|
||||
import { Consumes, TdriveService, logger } from "../../framework";
|
||||
import TrackerAPI from "./provider";
|
||||
import { localEventBus } from "../../framework/event-bus";
|
||||
import { IdentifyObjectType, TrackedEventType, TrackerConfiguration } from "./types";
|
||||
@@ -8,7 +8,7 @@ import { ResourceEventsPayload } from "../../../../utils/types";
|
||||
import { md5 } from "../../../../core/crypto";
|
||||
|
||||
@Consumes([])
|
||||
export default class Tracker extends TwakeService<TrackerAPI> implements TrackerAPI {
|
||||
export default class Tracker extends TdriveService<TrackerAPI> implements TrackerAPI {
|
||||
name = "tracker";
|
||||
version = "1";
|
||||
analytics: Analytics;
|
||||
@@ -121,14 +121,14 @@ export default class Tracker extends TwakeService<TrackerAPI> implements Tracker
|
||||
|
||||
// Fixme: For now we have zero users allowing to track (value false by default and not asked during sign up)
|
||||
// As soon as we clearly define a way for users to choose this option we will enable this code again.
|
||||
// Right now we need stats to move forward with Twake.
|
||||
// Right now we need stats to move forward with Tdrive.
|
||||
// Note that the user that create the event will be anonymised here
|
||||
// if (!event.user?.allow_tracking) return;
|
||||
|
||||
const analytics = await this.getAnalytics();
|
||||
|
||||
if (analytics && event) {
|
||||
event.event = `twake:${event.event}`;
|
||||
event.event = `tdrive:${event.event}`;
|
||||
analytics.track(
|
||||
{
|
||||
userId: event.user?.allow_tracking
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { IdentifyObjectType, TrackedEventType } from "./types";
|
||||
|
||||
export default interface TrackerAPI extends TwakeServiceProvider {
|
||||
export default interface TrackerAPI extends TdriveServiceProvider {
|
||||
identify(identity: IdentifyObjectType, callback?: (err: Error) => void): Promise<void>;
|
||||
remove(identity: IdentifyObjectType, callback?: (err: Error) => void): Promise<void>;
|
||||
track(tracker: TrackedEventType, callback?: (err: Error) => void): Promise<void>;
|
||||
|
||||
@@ -9,7 +9,7 @@ export type IdentifyObjectType = IdentityType & {
|
||||
};
|
||||
|
||||
export type TrackedEventType = IdentityType & {
|
||||
// event starts with prefix `twake:`
|
||||
// event starts with prefix `tdrive:`
|
||||
event: string;
|
||||
properties?: { [key: string]: unknown };
|
||||
timestamp?: Date;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { logger, TwakeService } from "../../framework";
|
||||
import { logger, TdriveService } from "../../framework";
|
||||
import { Server, IncomingMessage, ServerResponse } from "http";
|
||||
import { FastifyInstance, fastify } from "fastify";
|
||||
import sensible from "fastify-sensible";
|
||||
@@ -14,7 +14,7 @@ import swaggerPlugin from "fastify-swagger";
|
||||
import { SkipCLI } from "../../framework/decorators/skip";
|
||||
import fs from "fs";
|
||||
// import { throws } from "assert";
|
||||
export default class WebServerService extends TwakeService<WebServerAPI> implements WebServerAPI {
|
||||
export default class WebServerService extends TdriveService<WebServerAPI> implements WebServerAPI {
|
||||
name = "webserver";
|
||||
version = "1";
|
||||
private server: FastifyInstance<Server, IncomingMessage, ServerResponse>;
|
||||
@@ -73,12 +73,12 @@ export default class WebServerService extends TwakeService<WebServerAPI> impleme
|
||||
routePrefix: "/internal/docs",
|
||||
swagger: {
|
||||
info: {
|
||||
title: "Twake Swagger",
|
||||
description: "Automatically generate Twake Swagger API",
|
||||
title: "Tdrive Swagger",
|
||||
description: "Automatically generate Tdrive Swagger API",
|
||||
version: "0.1.0",
|
||||
},
|
||||
externalDocs: {
|
||||
url: "http://linagora.github.io/Twake",
|
||||
url: "http://linagora.github.io/Tdrive",
|
||||
description: "Find more info here",
|
||||
},
|
||||
host: "localhost",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Server, IncomingMessage, ServerResponse } from "http";
|
||||
import { FastifyInstance } from "fastify";
|
||||
import { TwakeServiceProvider } from "../../framework/api";
|
||||
import { TdriveServiceProvider } from "../../framework/api";
|
||||
|
||||
export default interface WebServerAPI extends TwakeServiceProvider {
|
||||
export default interface WebServerAPI extends TdriveServiceProvider {
|
||||
/**
|
||||
* Get the fastify webserver instance
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Consumes, ServiceName, TwakeService } from "../../framework";
|
||||
import { Consumes, ServiceName, TdriveService } from "../../framework";
|
||||
import WebServerAPI from "../webserver/provider";
|
||||
import WebSocketAPI from "./provider";
|
||||
import { WebSocketService } from "./services";
|
||||
@@ -7,7 +7,7 @@ import FastifyIO from "fastify-socket.io";
|
||||
|
||||
@Consumes(["webserver"])
|
||||
@ServiceName("websocket")
|
||||
export default class WebSocket extends TwakeService<WebSocketAPI> {
|
||||
export default class WebSocket extends TdriveService<WebSocketAPI> {
|
||||
private service: WebSocketService;
|
||||
name = "websocket";
|
||||
version = "1";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { EventEmitter } from "events";
|
||||
import socketIO from "socket.io";
|
||||
import { TwakeServiceProvider } from "../../framework";
|
||||
import { TdriveServiceProvider } from "../../framework";
|
||||
import { User } from "../../../../utils/types";
|
||||
import { WebsocketUserEvent, WebSocket, WebSocketUser } from "./types";
|
||||
|
||||
export default interface WebSocketAPI extends TwakeServiceProvider, EventEmitter {
|
||||
export default interface WebSocketAPI extends TdriveServiceProvider, EventEmitter {
|
||||
getIo(): socketIO.Server;
|
||||
|
||||
isConnected(user: User): boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as Sentry from "@sentry/node";
|
||||
import { TwakePlatform } from "./core/platform/platform";
|
||||
import { TdrivePlatform } from "./core/platform/platform";
|
||||
import config from "./core/config";
|
||||
import twake from "./twake";
|
||||
import tdrive from "./tdrive";
|
||||
|
||||
if (config.get("sentry.dsn")) {
|
||||
Sentry.init({
|
||||
@@ -10,7 +10,7 @@ if (config.get("sentry.dsn")) {
|
||||
});
|
||||
}
|
||||
|
||||
const launch = async (): Promise<TwakePlatform> => twake.run(config.get("services"));
|
||||
const launch = async (): Promise<TdrivePlatform> => tdrive.run(config.get("services"));
|
||||
|
||||
// noinspection JSIgnoredPromiseFromCall
|
||||
launch();
|
||||
|
||||
@@ -108,7 +108,7 @@ export type ApplicationIdentity = {
|
||||
description: string;
|
||||
website: string;
|
||||
categories: string[];
|
||||
compatibility: "twake"[];
|
||||
compatibility: "tdrive"[];
|
||||
repository?: string;
|
||||
};
|
||||
|
||||
@@ -145,7 +145,7 @@ export type ApplicationAccess = {
|
||||
};
|
||||
|
||||
export type ApplicationDisplay = {
|
||||
twake: {
|
||||
tdrive: {
|
||||
files?: {
|
||||
editor?: {
|
||||
preview_url: string; //Open a preview inline (iframe)
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class CompanyApplication {
|
||||
|
||||
@Type(() => String)
|
||||
@Column("created_by", "string")
|
||||
created_by: string; //Will be the default delegated user when doing actions on Twake
|
||||
created_by: string; //Will be the default delegated user when doing actions on Tdrive
|
||||
}
|
||||
|
||||
export type CompanyApplicationPrimaryKey = Pick<
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Prefix, TwakeService } from "../../core/platform/framework";
|
||||
import { Prefix, TdriveService } from "../../core/platform/framework";
|
||||
import WebServerAPI from "../../core/platform/services/webserver/provider";
|
||||
import web from "./web";
|
||||
|
||||
@Prefix("/internal/services/applications/v1")
|
||||
export default class ApplicationsService extends TwakeService<undefined> {
|
||||
export default class ApplicationsService extends TdriveService<undefined> {
|
||||
version = "1";
|
||||
name = "applications";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import Application, {
|
||||
TYPE,
|
||||
} from "../entities/application";
|
||||
import Repository from "../../../core/platform/services/database/services/orm/repository/repository";
|
||||
import { Initializable, logger, TwakeServiceProvider } from "../../../core/platform/framework";
|
||||
import { Initializable, logger, TdriveServiceProvider } from "../../../core/platform/framework";
|
||||
import {
|
||||
DeleteResult,
|
||||
ExecutionContext,
|
||||
@@ -19,7 +19,7 @@ import assert from "assert";
|
||||
|
||||
import gr from "../../global-resolver";
|
||||
|
||||
export class ApplicationServiceImpl implements TwakeServiceProvider, Initializable {
|
||||
export class ApplicationServiceImpl implements TdriveServiceProvider, Initializable {
|
||||
version: "1";
|
||||
repository: Repository<Application>;
|
||||
searchRepository: SearchRepository<Application>;
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
logger,
|
||||
RealtimeDeleted,
|
||||
RealtimeSaved,
|
||||
TwakeServiceProvider,
|
||||
TdriveServiceProvider,
|
||||
} from "../../../core/platform/framework";
|
||||
import {
|
||||
DeleteResult,
|
||||
@@ -23,7 +23,7 @@ import { CompanyExecutionContext } from "../web/types";
|
||||
import { getCompanyApplicationRoom } from "../realtime";
|
||||
import gr from "../../global-resolver";
|
||||
|
||||
export class CompanyApplicationServiceImpl implements TwakeServiceProvider, Initializable {
|
||||
export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Initializable {
|
||||
version: "1";
|
||||
repository: Repository<CompanyApplication>;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import Repository from "../../../core/platform/services/database/services/orm/re
|
||||
import {
|
||||
Initializable,
|
||||
logger as log,
|
||||
TwakeServiceProvider,
|
||||
TdriveServiceProvider,
|
||||
} from "../../../core/platform/framework";
|
||||
import { CrudException, ExecutionContext } from "../../../core/platform/framework/api/crud-service";
|
||||
import SearchRepository from "../../../core/platform/services/search/repository";
|
||||
@@ -12,7 +12,7 @@ import * as crypto from "crypto";
|
||||
import { isObject } from "lodash";
|
||||
import gr from "../../global-resolver";
|
||||
|
||||
export class ApplicationHooksService implements TwakeServiceProvider, Initializable {
|
||||
export class ApplicationHooksService implements TdriveServiceProvider, Initializable {
|
||||
version: "1";
|
||||
repository: Repository<Application>;
|
||||
searchRepository: SearchRepository<Application>;
|
||||
@@ -60,7 +60,7 @@ export class ApplicationHooksService implements TwakeServiceProvider, Initializa
|
||||
.post(app.api.hooks_url, payload, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Twake-Signature": signature,
|
||||
"X-Tdrive-Signature": signature,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Prefix, TwakeService } from "../../core/platform/framework";
|
||||
import { Prefix, TdriveService } from "../../core/platform/framework";
|
||||
import WebServerAPI from "../../core/platform/services/webserver/provider";
|
||||
import web from "./web";
|
||||
|
||||
@Prefix("/internal/services/channels/v1")
|
||||
export default class ChannelService extends TwakeService<undefined> {
|
||||
export default class ChannelService extends TdriveService<undefined> {
|
||||
version = "1";
|
||||
name = "channels";
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ export interface ConsoleServiceClient {
|
||||
addUserToCompany(company: ConsoleCompany, user: CreateConsoleUser): Promise<CreatedConsoleUser>;
|
||||
|
||||
/**
|
||||
* Add user to twake in general (for non-console version)
|
||||
* Add user to tdrive in general (for non-console version)
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
addUserToTwake(user: CreateInternalUser): Promise<User>;
|
||||
addUserToTdrive(user: CreateInternalUser): Promise<User>;
|
||||
|
||||
/**
|
||||
* Update user role
|
||||
|
||||
@@ -49,8 +49,8 @@ export class ConsoleInternalClient implements ConsoleServiceClient {
|
||||
throw Error("ConsoleInternalClient.createCompany is not implemented");
|
||||
}
|
||||
|
||||
async addUserToTwake(user: CreateConsoleUser): Promise<User> {
|
||||
logger.info("Internal: addUserToTwake");
|
||||
async addUserToTdrive(user: CreateConsoleUser): Promise<User> {
|
||||
logger.info("Internal: addUserToTdrive");
|
||||
const userToCreate = getUserInstance({
|
||||
id: uuidv1(),
|
||||
email_canonical: user.email,
|
||||
|
||||
@@ -78,9 +78,8 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
addUserToTwake(user: CreateConsoleUser): Promise<User> {
|
||||
logger.info("Remote: addUserToTwake");
|
||||
logger.info(`Method not implemented, ${user}.`);
|
||||
addUserToTdrive(user: CreateConsoleUser): Promise<User> {
|
||||
logger.info("Remote: addUserToTdrive");
|
||||
//should do noting for real console
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -98,7 +97,7 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
}
|
||||
|
||||
const roles = userDTO.roles.filter(
|
||||
role => role.applications === undefined || role.applications.find(a => a.code === "twake"),
|
||||
role => role.applications === undefined || role.applications.find(a => a.code === "tdrive"),
|
||||
);
|
||||
|
||||
//REMOVE LATER
|
||||
@@ -162,7 +161,7 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
company = await gr.services.companies.createCompany(
|
||||
getCompanyInstance({
|
||||
id: "00000000-0000-4000-0000-000000000000",
|
||||
name: "Twake",
|
||||
name: "Tdrive",
|
||||
plan: { name: "Local", limits: undefined, features: undefined },
|
||||
}),
|
||||
);
|
||||
@@ -191,7 +190,7 @@ export class ConsoleRemoteClient implements ConsoleServiceClient {
|
||||
const user = await gr.services.users.getByConsoleId(consoleUserId);
|
||||
|
||||
if (!user) {
|
||||
throw new Error("User does not exists on Twake.");
|
||||
throw new Error("User does not exists on Tdrive.");
|
||||
}
|
||||
|
||||
await gr.services.users.anonymizeAndDelete(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Prefix, TwakeService } from "../../core/platform/framework";
|
||||
import { Prefix, TdriveService } from "../../core/platform/framework";
|
||||
import WebServerAPI from "../../core/platform/services/webserver/provider";
|
||||
import web from "./web";
|
||||
|
||||
@Prefix("/internal/services/console/v1")
|
||||
export default class ConsoleService extends TwakeService<undefined> {
|
||||
export default class ConsoleService extends TdriveService<undefined> {
|
||||
version = "1";
|
||||
name = "console";
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import { ConsoleServiceClient } from "./client-interface";
|
||||
import { ConsoleClientFactory } from "./client-factory";
|
||||
import User from "../user/entities/user";
|
||||
import gr from "../global-resolver";
|
||||
import { Configuration, TwakeServiceProvider } from "../../core/platform/framework";
|
||||
import { Configuration, TdriveServiceProvider } from "../../core/platform/framework";
|
||||
import assert from "assert";
|
||||
import { ExecutionContext } from "../../core/platform/framework/api/crud-service";
|
||||
|
||||
export class ConsoleServiceImpl implements TwakeServiceProvider {
|
||||
export class ConsoleServiceImpl implements TdriveServiceProvider {
|
||||
version: "1";
|
||||
|
||||
consoleType: ConsoleType;
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface CreateConsoleCompany {
|
||||
limits?: {
|
||||
members?: number; //Old console version
|
||||
guests?: number; //Old console version
|
||||
twake: {
|
||||
tdrive: {
|
||||
members: number;
|
||||
guests: number;
|
||||
storage: number;
|
||||
@@ -141,7 +141,7 @@ export type ConsoleHookCompany = {
|
||||
limits: {
|
||||
members?: number; //Old console version
|
||||
guests?: number; //Old console version
|
||||
twake: {
|
||||
tdrive: {
|
||||
members: number;
|
||||
guests: number;
|
||||
storage: number;
|
||||
@@ -169,7 +169,7 @@ export type ConsoleHookUser = {
|
||||
roleCode: CompanyUserRole;
|
||||
status: "active" | "deactivated";
|
||||
applications: {
|
||||
code: "twake";
|
||||
code: "tdrive";
|
||||
}[];
|
||||
},
|
||||
];
|
||||
|
||||
@@ -80,7 +80,7 @@ export class ConsoleController {
|
||||
let company = companies.getEntities()?.[0];
|
||||
if (!company) {
|
||||
const newCompany = getCompanyInstance({
|
||||
name: "Twake",
|
||||
name: "Tdrive",
|
||||
plan: { name: "Local", limits: undefined, features: undefined },
|
||||
});
|
||||
company = await gr.services.companies.createCompany(newCompany);
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
import { Type } from "class-transformer";
|
||||
import { Column, Entity } from "../../../core/platform/services/database/services/orm/decorators";
|
||||
|
||||
export const TYPE = "drive_twake_tab";
|
||||
export const TYPE = "drive_tdrive_tab";
|
||||
|
||||
@Entity(TYPE, {
|
||||
primaryKey: [["company_id"], "tab_id"],
|
||||
type: TYPE,
|
||||
})
|
||||
export class DriveTwakeTab {
|
||||
export class DriveTdriveTab {
|
||||
@Type(() => String)
|
||||
@Column("company_id", "string")
|
||||
company_id: string;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user