@crowdin/app-project-module 0.81.1 → 0.82.1

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.
@@ -36,7 +36,7 @@ export interface Storage {
36
36
  getAllMetadata(): Promise<any[] | undefined>;
37
37
  deleteMetadata(id: string): Promise<void>;
38
38
  getSyncSettingsByProvider(integrationId: string, provider: Provider): Promise<IntegrationSyncSettings | undefined>;
39
- getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
39
+ getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
40
40
  saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<void>;
41
41
  updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<void>;
42
42
  getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<IntegrationSyncSettings | undefined>;
@@ -52,7 +52,7 @@ export declare class MySQLStorage implements Storage {
52
52
  getAllMetadata(): Promise<any[]>;
53
53
  deleteMetadata(id: string): Promise<void>;
54
54
  getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
55
- getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
55
+ getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
56
56
  saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
57
57
  updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
58
58
  getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
@@ -356,11 +356,20 @@ class MySQLStorage {
356
356
  }));
357
357
  });
358
358
  }
359
- getAllSyncSettingsByType(type) {
359
+ getSyncSettingsBySchedule(type, schedule) {
360
360
  return __awaiter(this, void 0, void 0, function* () {
361
361
  yield this.dbPromise;
362
362
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
363
- const [rows] = yield connection.execute('SELECT id, files, integration_id as "integrationId", crowdin_id as "crowdinId", type, provider FROM sync_settings WHERE type = ?', [type]);
363
+ const [rows] = yield connection.execute(`
364
+ SELECT s.id, s.files, s.integration_id as "integrationId", s.crowdin_id as "crowdinId", s.type, s.provider
365
+ FROM sync_settings s
366
+ INNER JOIN integration_settings i ON s.integration_id = i.integration_id
367
+ WHERE s.type = ?
368
+ AND CASE
369
+ WHEN i.config IS NULL THEN false
370
+ ELSE JSON_EXTRACT(i.config, '$.schedule') = ?
371
+ END
372
+ `, [type, schedule]);
364
373
  return rows || [];
365
374
  }));
366
375
  });
@@ -66,7 +66,7 @@ export declare class PostgreStorage implements Storage {
66
66
  getAllMetadata(): Promise<any[]>;
67
67
  deleteMetadata(id: string): Promise<void>;
68
68
  getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
69
- getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
69
+ getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
70
70
  saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
71
71
  updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
72
72
  getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
@@ -439,11 +439,20 @@ class PostgreStorage {
439
439
  }));
440
440
  });
441
441
  }
442
- getAllSyncSettingsByType(type) {
442
+ getSyncSettingsBySchedule(type, schedule) {
443
443
  return __awaiter(this, void 0, void 0, function* () {
444
444
  yield this.dbPromise;
445
445
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
446
- const res = yield client.query('SELECT id, files, integration_id as "integrationId", crowdin_id as "crowdinId", type, provider FROM sync_settings WHERE type = $1', [type]);
446
+ const res = yield client.query(`
447
+ SELECT s.id, s.files, s.integration_id as "integrationId", s.crowdin_id as "crowdinId", s.type, s.provider
448
+ FROM sync_settings s
449
+ INNER JOIN integration_settings i ON s.integration_id = i.integration_id
450
+ WHERE s.type = $1
451
+ AND CASE
452
+ WHEN i.config IS NULL THEN false
453
+ ELSE (i.config::json->>'schedule') = $2
454
+ END
455
+ `, [type, schedule]);
447
456
  return (res === null || res === void 0 ? void 0 : res.rows) || [];
448
457
  }));
449
458
  });
@@ -55,7 +55,7 @@ export declare class SQLiteStorage implements Storage {
55
55
  getAllMetadata(): Promise<any[]>;
56
56
  deleteMetadata(id: string): Promise<void>;
57
57
  getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
58
- getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
58
+ getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
59
59
  saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
60
60
  updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
61
61
  getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
@@ -432,8 +432,17 @@ class SQLiteStorage {
432
432
  }
433
433
  });
434
434
  }
435
- getAllSyncSettingsByType(type) {
436
- return this.each('SELECT id, files, integration_id as integrationId, crowdin_id as crowdinId, type, provider FROM sync_settings WHERE type = ?', [type]);
435
+ getSyncSettingsBySchedule(type, schedule) {
436
+ return this.each(`
437
+ SELECT s.id, s.files, s.integration_id as integrationId, s.crowdin_id as crowdinId, s.type, s.provider
438
+ FROM sync_settings s
439
+ INNER JOIN integration_settings i ON s.integration_id = i.integration_id
440
+ WHERE s.type = ?
441
+ AND CASE
442
+ WHEN i.config IS NULL THEN 0
443
+ ELSE json_extract(i.config, '$.schedule') = ?
444
+ END
445
+ `, [type, schedule]);
437
446
  }
438
447
  saveSyncSettings(files, integrationId, crowdinId, type, provider) {
439
448
  return this.run('INSERT INTO sync_settings(files, integration_id, crowdin_id, type, provider) VALUES (?, ?, ?, ?, ?)', [files, integrationId, crowdinId, type, provider]);
package/out/types.d.ts CHANGED
@@ -18,6 +18,7 @@ import { AiTool, AiToolWidget } from './modules/ai-tools/types';
18
18
  import { ExternalQaCheckModule } from './modules/external-qa-check/types';
19
19
  import { Webhook } from './modules/webhooks/types';
20
20
  import { WorkflowStepTypeModule } from './modules/workflow-step-type/types';
21
+ import { AiRequestProcessorModule, AiStreamProcessorModule } from './modules/ai-request-processors/types';
21
22
  export interface ClientConfig extends ImagePath {
22
23
  /**
23
24
  * Authentication Crowdin App type: "authorization_code", "crowdin_app", "crowdin_agent". Default: "crowdin_app"
@@ -209,6 +210,22 @@ export interface ClientConfig extends ImagePath {
209
210
  * ai prompt provider module
210
211
  */
211
212
  aiPromptProvider?: AiPromptProviderModule & ImagePath;
213
+ /**
214
+ * ai request pre-compile processor module
215
+ */
216
+ aiRequestPreCompile?: AiRequestProcessorModule;
217
+ /**
218
+ * ai request post-compile processor module
219
+ */
220
+ aiRequestPostCompile?: AiRequestProcessorModule;
221
+ /**
222
+ * ai request pre-parse processor module
223
+ */
224
+ aiRequestPreParse?: AiStreamProcessorModule;
225
+ /**
226
+ * ai request post-parse processor module
227
+ */
228
+ aiRequestPostParse?: AiRequestProcessorModule;
212
229
  /**
213
230
  * AI tool_calls modules
214
231
  */
@@ -1281,11 +1281,13 @@
1281
1281
 
1282
1282
  if (type === 'crowdin') {
1283
1283
  appComponent.setCrowdinScheduleSync(syncData, newFile, selectedFiles);
1284
+ appComponent.setCrowdinFilesHasSyncOption(true);
1284
1285
  const syncedFiles = await appComponent.getCrowdinScheduleSync(true);
1285
1286
  appComponent.setAttribute('is-crowdin-sync-settings-in-progress', true);
1286
1287
  updateSyncSettings(syncedFiles, 'schedule', 'crowdin');
1287
1288
  } else if (type === 'integration') {
1288
1289
  appComponent.setIntegrationScheduleSync(syncData, newFile, selectedFiles);
1290
+ appComponent.setIntegrationFilesHasSyncOption(true);
1289
1291
  const syncedFiles = await appComponent.getIntegrationScheduleSync(true);
1290
1292
  appComponent.setAttribute('is-integration-sync-settings-in-progress', true);
1291
1293
  {{#if integrationOneLevelFetching}}
@@ -1395,6 +1397,7 @@
1395
1397
  }
1396
1398
 
1397
1399
  appComponent.setIntegrationScheduleSync(e.detail);
1400
+ appComponent.setIntegrationFilesHasSyncOption(true);
1398
1401
  const syncedFiles = await appComponent.getIntegrationScheduleSync(true);
1399
1402
  {{else}}
1400
1403
  const syncedFiles = await appComponent.getIntegrationScheduleSync();
@@ -1423,6 +1426,7 @@
1423
1426
  }
1424
1427
 
1425
1428
  appComponent.setCrowdinScheduleSync(e.detail);
1429
+ appComponent.setCrowdinFilesHasSyncOption(true);
1426
1430
  const syncedFiles = await appComponent.getCrowdinScheduleSync(true);
1427
1431
  {{else}}
1428
1432
  const syncedFiles = await appComponent.getCrowdinScheduleSync();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.81.1",
3
+ "version": "0.82.1",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@aws-sdk/client-s3": "^3.758.0",
23
23
  "@aws-sdk/s3-request-presigner": "^3.758.0",
24
- "@crowdin/crowdin-apps-functions": "^0.11.0",
24
+ "@crowdin/crowdin-apps-functions": "^0.12.0",
25
25
  "@crowdin/logs-formatter": "^2.1.7",
26
26
  "@godaddy/terminus": "^4.12.1",
27
27
  "@monaco-editor/react": "^4.7.0",
@@ -102,5 +102,5 @@
102
102
  "bugs": {
103
103
  "url": "https://github.com/crowdin/app-project-module/issues"
104
104
  },
105
- "homepage": "https://github.com/crowdin/app-project-module#readme"
105
+ "homepage": "https://crowdin.github.io/app-project-module"
106
106
  }