@crowdin/app-project-module
Version:
Module that generates for you all common endpoints for serving standalone Crowdin App
108 lines (107 loc) • 6.22 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.syncedData = exports.unsyncedFiles = exports.translationFileCache = exports.job = exports.integrationSettings = exports.userErrors = exports.webhooks = exports.filesSnapshot = exports.appMetadata = exports.syncSettings = exports.integrationCredentials = exports.crowdinCredentials = void 0;
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
const types_1 = require("../../../modules/integration/util/types");
exports.crowdinCredentials = (0, sqlite_core_1.sqliteTable)('crowdin_credentials', {
id: (0, sqlite_core_1.text)('id').primaryKey(),
app_secret: (0, sqlite_core_1.text)('app_secret'),
domain: (0, sqlite_core_1.text)('domain'),
user_id: (0, sqlite_core_1.text)('user_id'),
agent_id: (0, sqlite_core_1.text)('agent_id'),
organization_id: (0, sqlite_core_1.text)('organization_id'),
base_url: (0, sqlite_core_1.text)('base_url'),
access_token: (0, sqlite_core_1.text)('access_token').notNull(),
refresh_token: (0, sqlite_core_1.text)('refresh_token').notNull(),
expire: (0, sqlite_core_1.text)('expire').notNull(),
type: (0, sqlite_core_1.text)('type').notNull(),
});
exports.integrationCredentials = (0, sqlite_core_1.sqliteTable)('integration_credentials', {
id: (0, sqlite_core_1.text)('id').primaryKey(),
credentials: (0, sqlite_core_1.text)('credentials').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
managers: (0, sqlite_core_1.text)('managers'),
});
exports.syncSettings = (0, sqlite_core_1.sqliteTable)('sync_settings', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
files: (0, sqlite_core_1.text)('files'),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
type: (0, sqlite_core_1.text)('type').notNull(),
provider: (0, sqlite_core_1.text)('provider').notNull(),
});
exports.appMetadata = (0, sqlite_core_1.sqliteTable)('app_metadata', {
id: (0, sqlite_core_1.text)('id').primaryKey(),
data: (0, sqlite_core_1.text)('data'),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id'),
});
exports.filesSnapshot = (0, sqlite_core_1.sqliteTable)('files_snapshot', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
files: (0, sqlite_core_1.text)('files'),
provider: (0, sqlite_core_1.text)('provider').notNull(),
});
exports.webhooks = (0, sqlite_core_1.sqliteTable)('webhooks', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
file_id: (0, sqlite_core_1.text)('file_id').notNull(),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
provider: (0, sqlite_core_1.text)('provider').notNull(),
});
exports.userErrors = (0, sqlite_core_1.sqliteTable)('user_errors', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
action: (0, sqlite_core_1.text)('action').notNull(),
message: (0, sqlite_core_1.text)('message').notNull(),
data: (0, sqlite_core_1.text)('data'),
created_at: (0, sqlite_core_1.text)('created_at').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
integration_id: (0, sqlite_core_1.text)('integration_id'),
});
exports.integrationSettings = (0, sqlite_core_1.sqliteTable)('integration_settings', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
config: (0, sqlite_core_1.text)('config'),
});
exports.job = (0, sqlite_core_1.sqliteTable)('job', {
id: (0, sqlite_core_1.text)('id').primaryKey(),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
type: (0, sqlite_core_1.text)('type').notNull(),
title: (0, sqlite_core_1.text)('title'),
progress: (0, sqlite_core_1.integer)('progress').notNull().default(0),
status: (0, sqlite_core_1.text)('status').notNull().default(types_1.JobStatus.CREATED),
payload: (0, sqlite_core_1.text)('payload'),
info: (0, sqlite_core_1.text)('info'),
data: (0, sqlite_core_1.text)('data'),
attempt: (0, sqlite_core_1.integer)('attempt').notNull().default(0),
errors: (0, sqlite_core_1.text)('errors'),
processed_entities: (0, sqlite_core_1.text)('processed_entities'),
initiated_by: (0, sqlite_core_1.text)('initiated_by'),
created_at: (0, sqlite_core_1.text)('created_at').notNull(),
updated_at: (0, sqlite_core_1.text)('updated_at'),
finished_at: (0, sqlite_core_1.text)('finished_at'),
});
exports.translationFileCache = (0, sqlite_core_1.sqliteTable)('translation_file_cache', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
file_id: (0, sqlite_core_1.integer)('file_id').notNull(),
language_id: (0, sqlite_core_1.text)('language_id').notNull(),
etag: (0, sqlite_core_1.text)('etag'),
});
exports.unsyncedFiles = (0, sqlite_core_1.sqliteTable)('unsynced_files', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
files: (0, sqlite_core_1.text)('files'),
});
exports.syncedData = (0, sqlite_core_1.sqliteTable)('synced_data', {
id: (0, sqlite_core_1.integer)('id').primaryKey({ autoIncrement: true }),
files: (0, sqlite_core_1.text)('files'),
integration_id: (0, sqlite_core_1.text)('integration_id').notNull(),
crowdin_id: (0, sqlite_core_1.text)('crowdin_id').notNull(),
type: (0, sqlite_core_1.text)('type').notNull(),
updated_at: (0, sqlite_core_1.text)('updated_at'),
});