@rimori/client 2.4.0 → 2.5.0-next.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.
- package/dist/cli/scripts/init/dev-registration.js +4 -2
- package/dist/cli/scripts/init/main.js +1 -0
- package/dist/cli/scripts/release/release.js +0 -0
- package/dist/controller/SettingsController.d.ts +1 -1
- package/dist/controller/SharedContentController.d.ts +1 -1
- package/dist/fromRimori/EventBus.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/plugin/CommunicationHandler.d.ts +13 -8
- package/dist/plugin/CommunicationHandler.js +44 -59
- package/dist/plugin/RimoriClient.d.ts +11 -195
- package/dist/plugin/RimoriClient.js +16 -298
- package/dist/plugin/StandaloneClient.d.ts +1 -1
- package/dist/plugin/StandaloneClient.js +3 -2
- package/dist/plugin/module/AIModule.d.ts +49 -0
- package/dist/plugin/module/AIModule.js +81 -0
- package/dist/plugin/module/DbModule.d.ts +30 -0
- package/dist/plugin/module/DbModule.js +51 -0
- package/dist/plugin/module/EventModule.d.ts +99 -0
- package/dist/plugin/module/EventModule.js +162 -0
- package/dist/{controller/ExerciseController.d.ts → plugin/module/ExerciseModule.d.ts} +20 -16
- package/dist/{controller/ExerciseController.js → plugin/module/ExerciseModule.js} +27 -20
- package/dist/plugin/module/PluginModule.d.ts +76 -0
- package/dist/plugin/module/PluginModule.js +88 -0
- package/package.json +8 -3
- package/.github/workflows/pre-release.yml +0 -126
- package/.prettierignore +0 -35
- package/eslint.config.js +0 -53
- package/example/docs/devdocs.md +0 -241
- package/example/docs/overview.md +0 -29
- package/example/docs/userdocs.md +0 -126
- package/example/rimori.config.ts +0 -91
- package/example/worker/vite.config.ts +0 -26
- package/example/worker/worker.ts +0 -11
- package/prettier.config.js +0 -8
- package/src/cli/scripts/init/dev-registration.ts +0 -189
- package/src/cli/scripts/init/env-setup.ts +0 -44
- package/src/cli/scripts/init/file-operations.ts +0 -58
- package/src/cli/scripts/init/html-cleaner.ts +0 -45
- package/src/cli/scripts/init/main.ts +0 -175
- package/src/cli/scripts/init/package-setup.ts +0 -113
- package/src/cli/scripts/init/router-transformer.ts +0 -332
- package/src/cli/scripts/init/tailwind-config.ts +0 -66
- package/src/cli/scripts/init/vite-config.ts +0 -73
- package/src/cli/scripts/release/detect-translation-languages.ts +0 -37
- package/src/cli/scripts/release/release-config-upload.ts +0 -119
- package/src/cli/scripts/release/release-db-update.ts +0 -97
- package/src/cli/scripts/release/release-file-upload.ts +0 -138
- package/src/cli/scripts/release/release.ts +0 -85
- package/src/cli/types/DatabaseTypes.ts +0 -125
- package/src/controller/AIController.ts +0 -295
- package/src/controller/AccomplishmentController.ts +0 -188
- package/src/controller/AudioController.ts +0 -64
- package/src/controller/ExerciseController.ts +0 -117
- package/src/controller/ObjectController.ts +0 -120
- package/src/controller/SettingsController.ts +0 -186
- package/src/controller/SharedContentController.ts +0 -365
- package/src/controller/TranslationController.ts +0 -136
- package/src/controller/VoiceController.ts +0 -33
- package/src/fromRimori/EventBus.ts +0 -382
- package/src/fromRimori/PluginTypes.ts +0 -214
- package/src/fromRimori/readme.md +0 -2
- package/src/index.ts +0 -19
- package/src/plugin/CommunicationHandler.ts +0 -310
- package/src/plugin/Logger.ts +0 -394
- package/src/plugin/RimoriClient.ts +0 -530
- package/src/plugin/StandaloneClient.ts +0 -125
- package/src/utils/difficultyConverter.ts +0 -15
- package/src/utils/endpoint.ts +0 -3
- package/src/worker/WorkerSetup.ts +0 -35
- package/tsconfig.json +0 -17
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import ts from 'typescript';
|
|
4
|
-
import { Config } from './release.js';
|
|
5
|
-
import { detectTranslationLanguages } from './detect-translation-languages.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Read and send the rimori configuration to the release endpoint
|
|
9
|
-
* @param config - Configuration object
|
|
10
|
-
*/
|
|
11
|
-
export async function sendConfiguration(config: Config): Promise<string> {
|
|
12
|
-
const configPath = path.resolve('./rimori/rimori.config.ts');
|
|
13
|
-
|
|
14
|
-
// Check if config file exists
|
|
15
|
-
try {
|
|
16
|
-
await fs.promises.access(configPath);
|
|
17
|
-
} catch (e) {
|
|
18
|
-
throw new Error('Could not find rimori.config.ts in ./rimori/ directory');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
let configObject;
|
|
23
|
-
|
|
24
|
-
// Use TypeScript compiler to transpile and load
|
|
25
|
-
const configContent = await fs.promises.readFile(configPath, 'utf8');
|
|
26
|
-
|
|
27
|
-
// Transpile TypeScript to JavaScript
|
|
28
|
-
const result = ts.transpile(configContent, {
|
|
29
|
-
target: ts.ScriptTarget.ES2020,
|
|
30
|
-
module: ts.ModuleKind.ES2020,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Create a temporary file to import the transpiled code
|
|
34
|
-
const tempFile = path.join(process.cwd(), 'temp_config.js');
|
|
35
|
-
await fs.promises.writeFile(tempFile, result);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
// Use dynamic import to load the config
|
|
39
|
-
const config = await import(`file://${tempFile}`);
|
|
40
|
-
configObject = config.default || config;
|
|
41
|
-
|
|
42
|
-
// Clean up temp file
|
|
43
|
-
await fs.promises.unlink(tempFile);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
// Clean up temp file even on error
|
|
46
|
-
try {
|
|
47
|
-
await fs.promises.unlink(tempFile);
|
|
48
|
-
} catch (e) {}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!configObject) {
|
|
53
|
-
throw new Error('Configuration object is empty or undefined');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Detect available translation languages
|
|
57
|
-
const availableLanguages = await detectTranslationLanguages();
|
|
58
|
-
|
|
59
|
-
console.log(`🚀 Sending configuration...`);
|
|
60
|
-
|
|
61
|
-
const requestBody = {
|
|
62
|
-
config: configObject,
|
|
63
|
-
version: config.version,
|
|
64
|
-
plugin_id: config.plugin_id,
|
|
65
|
-
release_channel: config.release_channel,
|
|
66
|
-
rimori_client_version: config.rimori_client_version,
|
|
67
|
-
provided_languages: availableLanguages.join(','),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const response = await fetch(`${config.domain}/release`, {
|
|
72
|
-
method: 'POST',
|
|
73
|
-
headers: {
|
|
74
|
-
'Content-Type': 'application/json',
|
|
75
|
-
Authorization: `Bearer ${config.token}`,
|
|
76
|
-
},
|
|
77
|
-
body: JSON.stringify(requestBody),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const responseText = await response.text();
|
|
81
|
-
console.log('Configuration response status:', response.status);
|
|
82
|
-
console.log('Configuration response text:', responseText);
|
|
83
|
-
|
|
84
|
-
const responseData = JSON.parse(responseText);
|
|
85
|
-
if (response.ok) {
|
|
86
|
-
console.log('✅ Configuration deployed successfully!');
|
|
87
|
-
return responseData.release_id;
|
|
88
|
-
} else {
|
|
89
|
-
console.log('❌ Configuration failed!');
|
|
90
|
-
console.log('Error:', responseData.error || 'Unknown error');
|
|
91
|
-
console.log('Response data:', JSON.stringify(responseData, null, 2));
|
|
92
|
-
throw new Error('Configuration upload failed');
|
|
93
|
-
}
|
|
94
|
-
} catch (e) {
|
|
95
|
-
console.log('error', e);
|
|
96
|
-
throw new Error('Error sending configuration');
|
|
97
|
-
}
|
|
98
|
-
} catch (error: any) {
|
|
99
|
-
console.error('❌ Error sending configuration:', error.message);
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export async function releasePlugin(config: Config, release_id: string): Promise<void> {
|
|
105
|
-
const response = await fetch(`${config.domain}/release/${release_id}/release`, {
|
|
106
|
-
method: 'POST',
|
|
107
|
-
headers: {
|
|
108
|
-
'Content-Type': 'application/json',
|
|
109
|
-
Authorization: `Bearer ${config.token}`,
|
|
110
|
-
},
|
|
111
|
-
body: JSON.stringify({ plugin_id: config.plugin_id }),
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
if (!response.ok) {
|
|
115
|
-
console.log('Response:', await response.text());
|
|
116
|
-
throw new Error('Failed to release plugin');
|
|
117
|
-
}
|
|
118
|
-
console.log('✅ Plugin released successfully');
|
|
119
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import ts from 'typescript';
|
|
4
|
-
import { Config } from './release';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Read and send the database configuration to the release endpoint
|
|
8
|
-
* @param config - Configuration object
|
|
9
|
-
*/
|
|
10
|
-
export default async function dbUpdate(config: Config, release_id: string): Promise<void> {
|
|
11
|
-
const dbConfigPath = path.resolve('./rimori/db.config.ts');
|
|
12
|
-
|
|
13
|
-
// Check if db config file exists
|
|
14
|
-
try {
|
|
15
|
-
await fs.promises.access(dbConfigPath);
|
|
16
|
-
} catch (e) {
|
|
17
|
-
console.warn('Could not find db.config.ts in ./rimori/ directory. Skipping database configuration upload.');
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
let dbConfigObject;
|
|
23
|
-
|
|
24
|
-
// Use TypeScript compiler to transpile and load
|
|
25
|
-
const dbConfigContent = await fs.promises.readFile(dbConfigPath, 'utf8');
|
|
26
|
-
|
|
27
|
-
// Transpile TypeScript to JavaScript
|
|
28
|
-
const result = ts.transpile(dbConfigContent, {
|
|
29
|
-
target: ts.ScriptTarget.ES2020,
|
|
30
|
-
module: ts.ModuleKind.ES2020,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Create a temporary file to import the transpiled code
|
|
34
|
-
const tempFile = path.join(process.cwd(), 'temp_db_config.js');
|
|
35
|
-
await fs.promises.writeFile(tempFile, result);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
// Use dynamic import to load the db config
|
|
39
|
-
const dbConfig = await import(`file://${tempFile}`);
|
|
40
|
-
dbConfigObject = Object.values(dbConfig);
|
|
41
|
-
|
|
42
|
-
// Clean up temp file
|
|
43
|
-
await fs.promises.unlink(tempFile);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
// Clean up temp file even on error
|
|
46
|
-
try {
|
|
47
|
-
await fs.promises.unlink(tempFile);
|
|
48
|
-
} catch (e) {}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!dbConfigObject) {
|
|
53
|
-
throw new Error('Database configuration object is empty or undefined');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log(`🗄️ Sending database configuration...`);
|
|
57
|
-
|
|
58
|
-
const requestBody = {
|
|
59
|
-
db_config: dbConfigObject,
|
|
60
|
-
version: config.version,
|
|
61
|
-
release_channel: config.release_channel,
|
|
62
|
-
plugin_id: config.plugin_id,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const response = await fetch(`${config.domain}/release/${release_id}/db`, {
|
|
66
|
-
method: 'POST',
|
|
67
|
-
headers: {
|
|
68
|
-
'Content-Type': 'application/json',
|
|
69
|
-
Authorization: `Bearer ${config.token}`,
|
|
70
|
-
},
|
|
71
|
-
body: JSON.stringify(requestBody),
|
|
72
|
-
}).catch((e) => {
|
|
73
|
-
console.log('error', e);
|
|
74
|
-
throw new Error('Error sending database configuration');
|
|
75
|
-
});
|
|
76
|
-
try {
|
|
77
|
-
const responseText = await response.text().catch((e) => {
|
|
78
|
-
console.log('error', e);
|
|
79
|
-
throw new Error('Error sending database configuration');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const responseData = JSON.parse(responseText);
|
|
83
|
-
if (response.ok) {
|
|
84
|
-
console.log('✅ Database configuration deployed successfully!');
|
|
85
|
-
} else {
|
|
86
|
-
console.log('responseData', responseData);
|
|
87
|
-
throw new Error(responseData.message);
|
|
88
|
-
}
|
|
89
|
-
} catch (e) {
|
|
90
|
-
console.log('error', e);
|
|
91
|
-
throw new Error('Error sending database configuration');
|
|
92
|
-
}
|
|
93
|
-
} catch (error: any) {
|
|
94
|
-
console.error('❌ Error sending database configuration:', error.message);
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { Config } from './release.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Upload all files from a directory and its subdirectories to the release function
|
|
7
|
-
* @param config - Configuration object
|
|
8
|
-
*/
|
|
9
|
-
export async function uploadDirectory(config: Config, release_id: string): Promise<void> {
|
|
10
|
-
const relativePath = './dist';
|
|
11
|
-
|
|
12
|
-
console.log(`📁 Preparing to upload files from ${relativePath}...`);
|
|
13
|
-
|
|
14
|
-
// Check if dist directory exists
|
|
15
|
-
try {
|
|
16
|
-
await fs.promises.access(relativePath);
|
|
17
|
-
} catch (e) {
|
|
18
|
-
throw new Error(`Directory ${relativePath} does not exist. Make sure to build your plugin first.`);
|
|
19
|
-
}
|
|
20
|
-
// Get all files recursively
|
|
21
|
-
const files = await getAllFiles(relativePath);
|
|
22
|
-
|
|
23
|
-
if (files.length === 0) {
|
|
24
|
-
console.log('⚠️ No files found to upload');
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.log(`🚀 Uploading ${files.length} files...`);
|
|
29
|
-
|
|
30
|
-
// Create FormData
|
|
31
|
-
const formData = new FormData();
|
|
32
|
-
|
|
33
|
-
// Add version and release channel data
|
|
34
|
-
formData.append('version', config.version);
|
|
35
|
-
formData.append('release_channel', config.release_channel);
|
|
36
|
-
formData.append('plugin_id', config.plugin_id);
|
|
37
|
-
|
|
38
|
-
// Create path mapping with IDs as keys
|
|
39
|
-
const pathMapping: Record<string, string> = {};
|
|
40
|
-
|
|
41
|
-
for (let i = 0; i < files.length; i++) {
|
|
42
|
-
const filePath = files[i];
|
|
43
|
-
try {
|
|
44
|
-
const fileContent = await fs.promises.readFile(filePath);
|
|
45
|
-
const relativePath = path.relative('./dist', filePath);
|
|
46
|
-
const contentType = getContentType(filePath);
|
|
47
|
-
|
|
48
|
-
// Generate unique ID for this file
|
|
49
|
-
const fileId = `file_${i}`;
|
|
50
|
-
|
|
51
|
-
// Add to path mapping using ID as key
|
|
52
|
-
pathMapping[fileId] = relativePath;
|
|
53
|
-
|
|
54
|
-
// Create a Blob with the file content and content type
|
|
55
|
-
const blob = new Blob([new Uint8Array(fileContent)], { type: contentType });
|
|
56
|
-
|
|
57
|
-
// Add file to FormData with ID_filename format
|
|
58
|
-
const fileName = `${fileId}_${path.basename(filePath)}`;
|
|
59
|
-
formData.append('files', blob, fileName);
|
|
60
|
-
} catch (error: any) {
|
|
61
|
-
console.error(`❌ Error reading file ${filePath}:`, error.message);
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Add path mapping to FormData
|
|
67
|
-
formData.append('path_mapping', JSON.stringify(pathMapping));
|
|
68
|
-
|
|
69
|
-
// Upload to the release endpoint
|
|
70
|
-
const response = await fetch(`${config.domain}/release/${release_id}/files`, {
|
|
71
|
-
method: 'POST',
|
|
72
|
-
headers: { Authorization: `Bearer ${config.token}` },
|
|
73
|
-
body: formData,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
if (response.ok) {
|
|
77
|
-
console.log('✅ Files uploaded successfully!');
|
|
78
|
-
} else {
|
|
79
|
-
const errorText = await response.text();
|
|
80
|
-
console.log('❌ File upload failed!');
|
|
81
|
-
console.log('Response:', errorText);
|
|
82
|
-
throw new Error(`File upload failed with status ${response.status}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Recursively get all files from a directory
|
|
88
|
-
*/
|
|
89
|
-
async function getAllFiles(dirPath: string): Promise<string[]> {
|
|
90
|
-
const files: string[] = [];
|
|
91
|
-
|
|
92
|
-
async function traverse(currentPath: string) {
|
|
93
|
-
const entries = await fs.promises.readdir(currentPath, { withFileTypes: true });
|
|
94
|
-
|
|
95
|
-
for (const entry of entries) {
|
|
96
|
-
const fullPath = path.join(currentPath, entry.name);
|
|
97
|
-
|
|
98
|
-
if (entry.isDirectory()) {
|
|
99
|
-
await traverse(fullPath);
|
|
100
|
-
} else if (entry.isFile()) {
|
|
101
|
-
files.push(fullPath);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
await traverse(dirPath);
|
|
107
|
-
return files;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Get content type based on file extension
|
|
112
|
-
*/
|
|
113
|
-
function getContentType(filePath: string): string {
|
|
114
|
-
const ext = filePath.split('.').pop()?.toLowerCase();
|
|
115
|
-
const contentTypes: Record<string, string> = {
|
|
116
|
-
html: 'text/html',
|
|
117
|
-
css: 'text/css',
|
|
118
|
-
js: 'application/javascript',
|
|
119
|
-
json: 'application/json',
|
|
120
|
-
md: 'text/markdown',
|
|
121
|
-
txt: 'text/plain',
|
|
122
|
-
png: 'image/png',
|
|
123
|
-
jpg: 'image/jpeg',
|
|
124
|
-
jpeg: 'image/jpeg',
|
|
125
|
-
gif: 'image/gif',
|
|
126
|
-
svg: 'image/svg+xml',
|
|
127
|
-
pdf: 'application/pdf',
|
|
128
|
-
ico: 'image/x-icon',
|
|
129
|
-
mp3: 'audio/mpeg',
|
|
130
|
-
wav: 'audio/wav',
|
|
131
|
-
ogg: 'audio/ogg',
|
|
132
|
-
m4a: 'audio/mp4',
|
|
133
|
-
webp: 'image/webp',
|
|
134
|
-
};
|
|
135
|
-
const contentType = contentTypes[ext || ''];
|
|
136
|
-
if (!contentType) throw new Error(`Unsupported file type: ${ext}`);
|
|
137
|
-
return contentType;
|
|
138
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Usage:
|
|
5
|
-
* rimori-release <release_channel>
|
|
6
|
-
*
|
|
7
|
-
* Environment variables required:
|
|
8
|
-
* RIMORI_TOKEN - Your Rimori token
|
|
9
|
-
* RIMORI_PLUGIN - Your plugin ID
|
|
10
|
-
*
|
|
11
|
-
* Make sure to install dependencies:
|
|
12
|
-
* npm install node-fetch form-data ts-node typescript
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import 'dotenv/config';
|
|
16
|
-
import fs from 'fs';
|
|
17
|
-
import path from 'path';
|
|
18
|
-
import dbUpdate from './release-db-update.js';
|
|
19
|
-
import { uploadDirectory } from './release-file-upload.js';
|
|
20
|
-
import { releasePlugin, sendConfiguration } from './release-config-upload.js';
|
|
21
|
-
|
|
22
|
-
// Read version from package.json
|
|
23
|
-
const packageJson = JSON.parse(fs.readFileSync(path.resolve('./package.json'), 'utf8'));
|
|
24
|
-
const { version, r_id: pluginId } = packageJson;
|
|
25
|
-
const RIMORI_TOKEN = process.env.RIMORI_TOKEN;
|
|
26
|
-
|
|
27
|
-
if (!RIMORI_TOKEN) {
|
|
28
|
-
console.error('Error: RIMORI_TOKEN is not set');
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
if (!pluginId) {
|
|
32
|
-
console.error('Error: The plugin id (r_id) is not set in package.json');
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const [releaseChannel] = process.argv.slice(2);
|
|
37
|
-
if (!releaseChannel) {
|
|
38
|
-
console.error('Usage: rimori-release <release_channel>');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (process.env.RIMORI_BACKEND_URL) {
|
|
43
|
-
console.info('Using backend url:', process.env.RIMORI_BACKEND_URL);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const config = {
|
|
47
|
-
version,
|
|
48
|
-
release_channel: releaseChannel,
|
|
49
|
-
plugin_id: pluginId,
|
|
50
|
-
token: RIMORI_TOKEN,
|
|
51
|
-
domain: process.env.RIMORI_BACKEND_URL || 'https://api.rimori.se',
|
|
52
|
-
rimori_client_version: packageJson.dependencies['@rimori/client'].replace('^', ''),
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type Config = typeof config;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Main release process
|
|
59
|
-
*/
|
|
60
|
-
async function releaseProcess(): Promise<void> {
|
|
61
|
-
try {
|
|
62
|
-
console.log(`🚀 Releasing ${config.plugin_id} to ${config.release_channel}...`);
|
|
63
|
-
|
|
64
|
-
// First send the configuration
|
|
65
|
-
const release_id = await sendConfiguration(config);
|
|
66
|
-
|
|
67
|
-
await dbUpdate(config, release_id);
|
|
68
|
-
|
|
69
|
-
// Then upload the files
|
|
70
|
-
await uploadDirectory(config, release_id);
|
|
71
|
-
|
|
72
|
-
// Then release the plugin
|
|
73
|
-
await releasePlugin(config, release_id);
|
|
74
|
-
|
|
75
|
-
// Inform user about translation processing
|
|
76
|
-
console.log(
|
|
77
|
-
'🌐 Hint: The plugin is released but it might take some time until all translations are being processed.',
|
|
78
|
-
);
|
|
79
|
-
} catch (error: any) {
|
|
80
|
-
console.log('❌ Error:', error.message);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
releaseProcess();
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// Database table structure definitions
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Supported database column data types for table schema definitions.
|
|
5
|
-
*/
|
|
6
|
-
type DbColumnType = 'decimal' | 'integer' | 'text' | 'boolean' | 'json' | 'timestamp' | 'uuid';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Foreign key relationship configuration with cascade delete support.
|
|
10
|
-
* Defines a relationship where the source record is deleted when the destination record is deleted.
|
|
11
|
-
*/
|
|
12
|
-
interface ForeignKeyRelation {
|
|
13
|
-
/** The target table that this column references */
|
|
14
|
-
references_table: string;
|
|
15
|
-
/** The target column in the referenced table (defaults to 'id') */
|
|
16
|
-
references_column?: string;
|
|
17
|
-
/** Whether to cascade delete when the referenced record is deleted */
|
|
18
|
-
on_delete_cascade: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Database column definition with support for types, constraints, and relationships.
|
|
23
|
-
*/
|
|
24
|
-
export interface DbColumnDefinition {
|
|
25
|
-
/** The data type of the column */
|
|
26
|
-
type: DbColumnType;
|
|
27
|
-
/** Human-readable description of the column's purpose */
|
|
28
|
-
description: string;
|
|
29
|
-
/** Whether the column can contain null values */
|
|
30
|
-
nullable?: boolean;
|
|
31
|
-
/** Whether the column has a unique constraint */
|
|
32
|
-
unique?: boolean;
|
|
33
|
-
/** Default value for the column. can also use sql functions like now(), auth.uid() or gen_random_uuid() */
|
|
34
|
-
default_value?: string | number | boolean;
|
|
35
|
-
/** Array of allowed values for enumerated columns */
|
|
36
|
-
// enum?: string[];
|
|
37
|
-
/** Foreign key relationship configuration */
|
|
38
|
-
foreign_key?: ForeignKeyRelation;
|
|
39
|
-
/** The name of the column before it was renamed. */
|
|
40
|
-
old_name?: string;
|
|
41
|
-
/** Whether the column is deprecated. The column gets renamed to column_name_old. To fully remove the column, first set deprecated to true and then after a release, remove the column from the table definition. */
|
|
42
|
-
deprecated?: boolean;
|
|
43
|
-
/** Whether the column is a primary key */
|
|
44
|
-
// primary_key?: boolean;
|
|
45
|
-
/** Restrictions for the column. If the column is restricted, the permission is further restricted. E.g. if the column is restricted to user, then the user can only read the column if they have the right permission.
|
|
46
|
-
* Example: Denying users to update the column, but allowing the moderator to update the column.
|
|
47
|
-
*/
|
|
48
|
-
restrict?: {
|
|
49
|
-
/** Restrictions for the user */
|
|
50
|
-
user: Partial<Omit<DbPermissionDefinition, 'delete'>>;
|
|
51
|
-
/** Restrictions for the guild moderator */
|
|
52
|
-
guild_moderator?: Partial<Omit<DbPermissionDefinition, 'delete'>>;
|
|
53
|
-
/** Restrictions for the language moderator */
|
|
54
|
-
lang_moderator?: Partial<Omit<DbPermissionDefinition, 'delete'>>;
|
|
55
|
-
/** Restrictions for the maintainer */
|
|
56
|
-
// maintainer?: Partial<Omit<DbPermissionDefinition, 'delete'>>;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Base table structure that all database tables inherit.
|
|
62
|
-
* Includes standard audit fields for tracking creation and ownership.
|
|
63
|
-
*/
|
|
64
|
-
interface BaseTableStructure {
|
|
65
|
-
/** Unique identifier for the record */
|
|
66
|
-
id: DbColumnDefinition;
|
|
67
|
-
/** Timestamp when the record was created */
|
|
68
|
-
created_at: DbColumnDefinition;
|
|
69
|
-
/** ID of the user who created the record */
|
|
70
|
-
created_by: DbColumnDefinition;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Complete database table schema definition.
|
|
75
|
-
* Defines the structure, constraints, and relationships for a database table.
|
|
76
|
-
*/
|
|
77
|
-
export interface DbTableDefinition {
|
|
78
|
-
/** Name of the database table */
|
|
79
|
-
table_name: string;
|
|
80
|
-
/** Description of the table's purpose and usage */
|
|
81
|
-
description: string;
|
|
82
|
-
/** Permissions for the table */
|
|
83
|
-
permissions: {
|
|
84
|
-
/** Permissions for the user */
|
|
85
|
-
user: DbPermissionDefinition;
|
|
86
|
-
/** Permissions for the guild moderator */
|
|
87
|
-
guild_moderator?: DbPermissionDefinition;
|
|
88
|
-
/** Permissions for the language moderator */
|
|
89
|
-
lang_moderator?: DbPermissionDefinition;
|
|
90
|
-
/** Permissions for the maintainer */
|
|
91
|
-
// maintainer?: DbPermissionDefinition;
|
|
92
|
-
};
|
|
93
|
-
/** Column definitions for the table */
|
|
94
|
-
columns: {
|
|
95
|
-
[column_name: string]: DbColumnDefinition;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Permission definition for a database table.
|
|
101
|
-
* NONE means the action is not allowed.
|
|
102
|
-
* OWN means only do the action on your own records.
|
|
103
|
-
* GUILD means do the action on all records in the guild.
|
|
104
|
-
* LANG means do the action on all records in the language.
|
|
105
|
-
* ALL means do the action on all records.
|
|
106
|
-
*
|
|
107
|
-
* Defines the permissions for a database table.
|
|
108
|
-
*/
|
|
109
|
-
export type DbPermission = 'NONE' | 'OWN' | 'GUILD' | 'LANG' | 'ALL';
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Permission definition for a database table.
|
|
113
|
-
* Defines the permissions for a database table.
|
|
114
|
-
*/
|
|
115
|
-
export interface DbPermissionDefinition {
|
|
116
|
-
read: DbPermission;
|
|
117
|
-
insert: DbPermission;
|
|
118
|
-
update: DbPermission;
|
|
119
|
-
delete: DbPermission;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Full table definition that includes automatically generated fields.
|
|
124
|
-
*/
|
|
125
|
-
export type FullTable<T extends Record<string, DbColumnDefinition>> = T & BaseTableStructure;
|