@crowdin/app-project-module 1.16.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/out/index.js +8 -15
  2. package/out/middlewares/auto-credentials-masker.js +5 -2
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/crowdin-client.js +1 -1
  5. package/out/middlewares/export.d.ts +2 -2
  6. package/out/middlewares/export.js +4 -35
  7. package/out/middlewares/json-response.d.ts +1 -1
  8. package/out/middlewares/json-response.js +1 -1
  9. package/out/modules/ai-prompt-provider/index.js +6 -6
  10. package/out/modules/ai-provider/index.js +7 -7
  11. package/out/modules/ai-provider/types.d.ts +10 -0
  12. package/out/modules/ai-provider/types.js +12 -0
  13. package/out/modules/ai-provider/util/index.d.ts +0 -10
  14. package/out/modules/ai-provider/util/index.js +2 -13
  15. package/out/modules/ai-request-processors/index.js +4 -4
  16. package/out/modules/api/api.js +18 -18
  17. package/out/modules/auth-guard/index.js +4 -5
  18. package/out/modules/automation-action/index.js +4 -6
  19. package/out/modules/context-menu/index.js +4 -13
  20. package/out/modules/custom-mt/index.js +4 -4
  21. package/out/modules/custom-spell-check/index.js +11 -11
  22. package/out/modules/editor-right-panel/index.js +1 -1
  23. package/out/modules/external-qa-check/index.js +7 -7
  24. package/out/modules/file-processing/index.js +14 -14
  25. package/out/modules/integration/index.js +26 -26
  26. package/out/modules/integration/types.d.ts +4 -4
  27. package/out/modules/integration/util/files.js +1 -1
  28. package/out/modules/integration/util/types.d.ts +1 -1
  29. package/out/modules/manifest.js +70 -281
  30. package/out/modules/modal/index.js +4 -13
  31. package/out/modules/organization-menu/index.js +1 -1
  32. package/out/modules/organization-settings-menu/index.js +1 -1
  33. package/out/modules/profile-resources-menu/index.js +1 -1
  34. package/out/modules/profile-settings-menu/index.js +1 -1
  35. package/out/modules/project-menu/index.js +1 -1
  36. package/out/modules/project-menu-crowdsource/index.js +1 -1
  37. package/out/modules/project-reports/index.js +1 -1
  38. package/out/modules/project-tools/index.js +1 -1
  39. package/out/modules/webhooks/index.js +3 -6
  40. package/out/modules/workflow-step-type/index.js +6 -6
  41. package/out/storage/drizzle/d1/index.d.ts +7 -0
  42. package/out/storage/drizzle/d1/index.js +48 -0
  43. package/out/storage/drizzle/d1/migrations/init.d.ts +2 -0
  44. package/out/storage/drizzle/d1/migrations/init.js +122 -0
  45. package/out/storage/drizzle/d1/types.d.ts +13 -0
  46. package/out/storage/drizzle/d1/types.js +38 -0
  47. package/out/storage/{sqlite.d.ts → drizzle/index.d.ts} +37 -58
  48. package/out/storage/drizzle/index.js +939 -0
  49. package/out/storage/drizzle/postgresql/config.d.ts +5 -0
  50. package/out/storage/drizzle/postgresql/config.js +11 -0
  51. package/out/storage/drizzle/postgresql/index.d.ts +14 -0
  52. package/out/storage/drizzle/postgresql/index.js +144 -0
  53. package/out/storage/drizzle/postgresql/migrations/0000_init.sql +113 -0
  54. package/out/storage/drizzle/postgresql/migrations/0001_init_indexes.sql +28 -0
  55. package/out/storage/drizzle/postgresql/migrations/meta/0000_snapshot.json +646 -0
  56. package/out/storage/drizzle/postgresql/migrations/meta/0001_snapshot.json +646 -0
  57. package/out/storage/drizzle/postgresql/migrations/meta/_journal.json +20 -0
  58. package/out/storage/drizzle/postgresql/schema.d.ts +1410 -0
  59. package/out/storage/drizzle/postgresql/schema.js +106 -0
  60. package/out/storage/drizzle/sqlite/config.d.ts +5 -0
  61. package/out/storage/drizzle/sqlite/config.js +11 -0
  62. package/out/storage/drizzle/sqlite/index.d.ts +8 -0
  63. package/out/storage/drizzle/sqlite/index.js +63 -0
  64. package/out/storage/drizzle/sqlite/migrations/0000_init.sql +113 -0
  65. package/out/storage/drizzle/sqlite/migrations/meta/0000_snapshot.json +687 -0
  66. package/out/storage/drizzle/sqlite/migrations/meta/_journal.json +13 -0
  67. package/out/storage/drizzle/sqlite/schema.d.ts +1544 -0
  68. package/out/storage/drizzle/sqlite/schema.js +106 -0
  69. package/out/storage/index.d.ts +2 -88
  70. package/out/storage/index.js +12 -128
  71. package/out/storage/internal/backup.d.ts +3 -0
  72. package/out/storage/internal/backup.js +94 -0
  73. package/out/storage/types.d.ts +66 -0
  74. package/out/types.d.ts +43 -47
  75. package/out/util/credentials-masker.js +2 -2
  76. package/out/util/export.d.ts +1 -0
  77. package/out/util/export.js +2 -1
  78. package/out/util/index.d.ts +2 -1
  79. package/out/util/index.js +12 -9
  80. package/out/util/normalize-module.d.ts +0 -1
  81. package/out/util/normalize-module.js +0 -4
  82. package/package.json +18 -22
  83. package/out/modules/ai-tools/handlers/tool-calls.d.ts +0 -4
  84. package/out/modules/ai-tools/handlers/tool-calls.js +0 -52
  85. package/out/modules/ai-tools/index.d.ts +0 -10
  86. package/out/modules/ai-tools/index.js +0 -46
  87. package/out/modules/ai-tools/types.d.ts +0 -63
  88. package/out/modules/ai-tools/types.js +0 -2
  89. package/out/modules/ai-tools/util/index.d.ts +0 -5
  90. package/out/modules/ai-tools/util/index.js +0 -24
  91. package/out/storage/d1.d.ts +0 -107
  92. package/out/storage/d1.js +0 -837
  93. package/out/storage/export.d.ts +0 -1
  94. package/out/storage/export.js +0 -2
  95. package/out/storage/mysql.d.ts +0 -109
  96. package/out/storage/mysql.js +0 -984
  97. package/out/storage/postgre.d.ts +0 -124
  98. package/out/storage/postgre.js +0 -1027
  99. package/out/storage/sqlite.js +0 -786
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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;
4
+ const pg_core_1 = require("drizzle-orm/pg-core");
5
+ exports.crowdinCredentials = (0, pg_core_1.pgTable)('crowdin_credentials', {
6
+ id: (0, pg_core_1.text)('id').primaryKey(),
7
+ app_secret: (0, pg_core_1.text)('app_secret'),
8
+ domain: (0, pg_core_1.text)('domain'),
9
+ user_id: (0, pg_core_1.text)('user_id'),
10
+ agent_id: (0, pg_core_1.text)('agent_id'),
11
+ organization_id: (0, pg_core_1.text)('organization_id'),
12
+ base_url: (0, pg_core_1.text)('base_url'),
13
+ access_token: (0, pg_core_1.text)('access_token').notNull(),
14
+ refresh_token: (0, pg_core_1.text)('refresh_token').notNull(),
15
+ expire: (0, pg_core_1.text)('expire').notNull(),
16
+ type: (0, pg_core_1.text)('type').notNull(),
17
+ });
18
+ exports.integrationCredentials = (0, pg_core_1.pgTable)('integration_credentials', {
19
+ id: (0, pg_core_1.text)('id').primaryKey(),
20
+ credentials: (0, pg_core_1.text)('credentials').notNull(),
21
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
22
+ managers: (0, pg_core_1.text)('managers'),
23
+ });
24
+ exports.syncSettings = (0, pg_core_1.pgTable)('sync_settings', {
25
+ id: (0, pg_core_1.serial)('id').primaryKey(),
26
+ files: (0, pg_core_1.text)('files'),
27
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
28
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
29
+ type: (0, pg_core_1.text)('type').notNull(),
30
+ provider: (0, pg_core_1.text)('provider').notNull(),
31
+ });
32
+ exports.appMetadata = (0, pg_core_1.pgTable)('app_metadata', {
33
+ id: (0, pg_core_1.text)('id').primaryKey(),
34
+ data: (0, pg_core_1.text)('data'),
35
+ crowdin_id: (0, pg_core_1.text)('crowdin_id'),
36
+ });
37
+ exports.filesSnapshot = (0, pg_core_1.pgTable)('files_snapshot', {
38
+ id: (0, pg_core_1.serial)('id').primaryKey(),
39
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
40
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
41
+ files: (0, pg_core_1.text)('files'),
42
+ provider: (0, pg_core_1.text)('provider').notNull(),
43
+ });
44
+ exports.webhooks = (0, pg_core_1.pgTable)('webhooks', {
45
+ id: (0, pg_core_1.serial)('id').primaryKey(),
46
+ file_id: (0, pg_core_1.text)('file_id').notNull(),
47
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
48
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
49
+ provider: (0, pg_core_1.text)('provider').notNull(),
50
+ });
51
+ exports.userErrors = (0, pg_core_1.pgTable)('user_errors', {
52
+ id: (0, pg_core_1.serial)('id').primaryKey(),
53
+ action: (0, pg_core_1.text)('action').notNull(),
54
+ message: (0, pg_core_1.text)('message').notNull(),
55
+ data: (0, pg_core_1.text)('data'),
56
+ created_at: (0, pg_core_1.text)('created_at').notNull(),
57
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
58
+ integration_id: (0, pg_core_1.text)('integration_id'),
59
+ });
60
+ exports.integrationSettings = (0, pg_core_1.pgTable)('integration_settings', {
61
+ id: (0, pg_core_1.serial)('id').primaryKey(),
62
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
63
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
64
+ config: (0, pg_core_1.text)('config'),
65
+ });
66
+ exports.job = (0, pg_core_1.pgTable)('job', {
67
+ id: (0, pg_core_1.text)('id').primaryKey(),
68
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
69
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
70
+ type: (0, pg_core_1.text)('type').notNull(),
71
+ title: (0, pg_core_1.text)('title'),
72
+ progress: (0, pg_core_1.integer)('progress').notNull().default(0),
73
+ status: (0, pg_core_1.text)('status').notNull().default('CREATED'),
74
+ payload: (0, pg_core_1.text)('payload'),
75
+ info: (0, pg_core_1.text)('info'),
76
+ data: (0, pg_core_1.text)('data'),
77
+ attempt: (0, pg_core_1.integer)('attempt').notNull().default(0),
78
+ errors: (0, pg_core_1.text)('errors'),
79
+ processed_entities: (0, pg_core_1.text)('processed_entities'),
80
+ initiated_by: (0, pg_core_1.text)('initiated_by'),
81
+ created_at: (0, pg_core_1.text)('created_at').notNull(),
82
+ updated_at: (0, pg_core_1.text)('updated_at'),
83
+ finished_at: (0, pg_core_1.text)('finished_at'),
84
+ });
85
+ exports.translationFileCache = (0, pg_core_1.pgTable)('translation_file_cache', {
86
+ id: (0, pg_core_1.serial)('id').primaryKey(),
87
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
88
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
89
+ file_id: (0, pg_core_1.integer)('file_id').notNull(),
90
+ language_id: (0, pg_core_1.text)('language_id').notNull(),
91
+ etag: (0, pg_core_1.text)('etag'),
92
+ });
93
+ exports.unsyncedFiles = (0, pg_core_1.pgTable)('unsynced_files', {
94
+ id: (0, pg_core_1.serial)('id').primaryKey(),
95
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
96
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
97
+ files: (0, pg_core_1.text)('files'),
98
+ });
99
+ exports.syncedData = (0, pg_core_1.pgTable)('synced_data', {
100
+ id: (0, pg_core_1.serial)('id').primaryKey(),
101
+ files: (0, pg_core_1.text)('files'),
102
+ integration_id: (0, pg_core_1.text)('integration_id').notNull(),
103
+ crowdin_id: (0, pg_core_1.text)('crowdin_id').notNull(),
104
+ type: (0, pg_core_1.text)('type').notNull(),
105
+ updated_at: (0, pg_core_1.text)('updated_at'),
106
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * npm run drizzle:sqlite:generate -- --name "<migration_name>"
3
+ */
4
+ declare const _default: import("drizzle-kit").Config;
5
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const drizzle_kit_1 = require("drizzle-kit");
4
+ /**
5
+ * npm run drizzle:sqlite:generate -- --name "<migration_name>"
6
+ */
7
+ exports.default = (0, drizzle_kit_1.defineConfig)({
8
+ schema: 'src/storage/drizzle/sqlite/schema.ts',
9
+ out: 'src/storage/drizzle/sqlite/migrations',
10
+ dialect: 'sqlite',
11
+ });
@@ -0,0 +1,8 @@
1
+ import { Database } from 'better-sqlite3';
2
+ import * as schema from './schema';
3
+ export type SQLITE_DB = import('drizzle-orm/better-sqlite3').BetterSQLite3Database<typeof schema> & {
4
+ $client: Database;
5
+ };
6
+ export declare function initSqlite(dbFolder: string, additionalSchema?: Record<string, unknown>): SQLITE_DB;
7
+ export declare const SQLITE_SCHEMA: typeof schema;
8
+ export declare const migrateSqlite: (db: SQLITE_DB, additionalMigrationFolder?: string) => Promise<void>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.migrateSqlite = exports.SQLITE_SCHEMA = void 0;
46
+ exports.initSqlite = initSqlite;
47
+ const path_1 = require("path");
48
+ const types_1 = require("../../../types");
49
+ const schema = __importStar(require("./schema"));
50
+ function initSqlite(dbFolder, additionalSchema = {}) {
51
+ const file = (0, path_1.join)(dbFolder, types_1.storageFiles.SQLITE);
52
+ const client = require('better-sqlite3')(file);
53
+ return require('drizzle-orm/better-sqlite3').drizzle(client, { schema: Object.assign(Object.assign({}, schema), additionalSchema) });
54
+ }
55
+ exports.SQLITE_SCHEMA = schema;
56
+ const migrateSqlite = (db, additionalMigrationFolder) => __awaiter(void 0, void 0, void 0, function* () {
57
+ const migrator = require('drizzle-orm/better-sqlite3/migrator');
58
+ migrator.migrate(db, { migrationsFolder: (0, path_1.join)(__dirname, 'migrations') });
59
+ if (additionalMigrationFolder) {
60
+ migrator.migrate(db, { migrationsFolder: additionalMigrationFolder });
61
+ }
62
+ });
63
+ exports.migrateSqlite = migrateSqlite;
@@ -0,0 +1,113 @@
1
+ CREATE TABLE IF NOT EXISTS `app_metadata` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `data` text,
4
+ `crowdin_id` text
5
+ );
6
+ --> statement-breakpoint
7
+ CREATE TABLE IF NOT EXISTS `crowdin_credentials` (
8
+ `id` text PRIMARY KEY NOT NULL,
9
+ `app_secret` text,
10
+ `domain` text,
11
+ `user_id` text,
12
+ `agent_id` text,
13
+ `organization_id` text,
14
+ `base_url` text,
15
+ `access_token` text NOT NULL,
16
+ `refresh_token` text NOT NULL,
17
+ `expire` text NOT NULL,
18
+ `type` text NOT NULL
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE TABLE IF NOT EXISTS `files_snapshot` (
22
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
23
+ `integration_id` text NOT NULL,
24
+ `crowdin_id` text NOT NULL,
25
+ `files` text,
26
+ `provider` text NOT NULL
27
+ );
28
+ --> statement-breakpoint
29
+ CREATE TABLE IF NOT EXISTS `integration_credentials` (
30
+ `id` text PRIMARY KEY NOT NULL,
31
+ `credentials` text NOT NULL,
32
+ `crowdin_id` text NOT NULL,
33
+ `managers` text
34
+ );
35
+ --> statement-breakpoint
36
+ CREATE TABLE IF NOT EXISTS `integration_settings` (
37
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
38
+ `integration_id` text NOT NULL,
39
+ `crowdin_id` text NOT NULL,
40
+ `config` text
41
+ );
42
+ --> statement-breakpoint
43
+ CREATE TABLE IF NOT EXISTS `job` (
44
+ `id` text PRIMARY KEY NOT NULL,
45
+ `integration_id` text NOT NULL,
46
+ `crowdin_id` text NOT NULL,
47
+ `type` text NOT NULL,
48
+ `title` text,
49
+ `progress` integer DEFAULT 0 NOT NULL,
50
+ `status` text DEFAULT 'CREATED' NOT NULL,
51
+ `payload` text,
52
+ `info` text,
53
+ `data` text,
54
+ `attempt` integer DEFAULT 0 NOT NULL,
55
+ `errors` text,
56
+ `processed_entities` text,
57
+ `initiated_by` text,
58
+ `created_at` text NOT NULL,
59
+ `updated_at` text,
60
+ `finished_at` text
61
+ );
62
+ --> statement-breakpoint
63
+ CREATE TABLE IF NOT EXISTS `sync_settings` (
64
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
65
+ `files` text,
66
+ `integration_id` text NOT NULL,
67
+ `crowdin_id` text NOT NULL,
68
+ `type` text NOT NULL,
69
+ `provider` text NOT NULL
70
+ );
71
+ --> statement-breakpoint
72
+ CREATE TABLE IF NOT EXISTS `synced_data` (
73
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
74
+ `files` text,
75
+ `integration_id` text NOT NULL,
76
+ `crowdin_id` text NOT NULL,
77
+ `type` text NOT NULL,
78
+ `updated_at` text
79
+ );
80
+ --> statement-breakpoint
81
+ CREATE TABLE IF NOT EXISTS `translation_file_cache` (
82
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
83
+ `integration_id` text NOT NULL,
84
+ `crowdin_id` text NOT NULL,
85
+ `file_id` integer NOT NULL,
86
+ `language_id` text NOT NULL,
87
+ `etag` text
88
+ );
89
+ --> statement-breakpoint
90
+ CREATE TABLE IF NOT EXISTS `unsynced_files` (
91
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
92
+ `integration_id` text NOT NULL,
93
+ `crowdin_id` text NOT NULL,
94
+ `files` text
95
+ );
96
+ --> statement-breakpoint
97
+ CREATE TABLE IF NOT EXISTS `user_errors` (
98
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
99
+ `action` text NOT NULL,
100
+ `message` text NOT NULL,
101
+ `data` text,
102
+ `created_at` text NOT NULL,
103
+ `crowdin_id` text NOT NULL,
104
+ `integration_id` text
105
+ );
106
+ --> statement-breakpoint
107
+ CREATE TABLE IF NOT EXISTS `webhooks` (
108
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
109
+ `file_id` text NOT NULL,
110
+ `integration_id` text NOT NULL,
111
+ `crowdin_id` text NOT NULL,
112
+ `provider` text NOT NULL
113
+ );