simplex-chat 6.5.0-beta.4.4 → 6.5.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/README.md +40 -2
- package/dist/api.d.ts +64 -3
- package/dist/api.js +103 -6
- package/dist/api.js.map +1 -1
- package/dist/bot.d.ts +2 -4
- package/dist/bot.js +1 -1
- package/dist/bot.js.map +1 -1
- package/docs/Namespace.api.md +1 -0
- package/docs/Namespace.bot.md +4 -1
- package/docs/api.Class.ChatApi.md +250 -100
- package/docs/api.Class.ChatCommandError.md +1 -1
- package/docs/api.Interface.BotAddressSettings.md +3 -3
- package/docs/api.TypeAlias.DbConfig.md +64 -0
- package/docs/api.TypeAlias.EventSubscriberFunc.md +2 -2
- package/docs/bot.Function.run.md +1 -1
- package/docs/bot.Interface.BotConfig.md +13 -13
- package/docs/bot.Interface.BotOptions.md +19 -19
- package/docs/bot.TypeAlias.BotDbOpts.md +17 -0
- package/docs/core.Class.ChatAPIError.md +4 -4
- package/docs/core.Class.ChatInitError.md +1 -1
- package/docs/core.Interface.APIResult.md +2 -2
- package/examples/squaring-bot-readme.js +1 -1
- package/examples/squaring-bot.ts +1 -1
- package/package.json +2 -2
- package/src/api.ts +132 -8
- package/src/bot.ts +2 -4
- package/src/download-libs.js +22 -7
- package/docs/bot.Interface.BotDbOpts.md +0 -33
package/src/download-libs.js
CHANGED
|
@@ -4,7 +4,19 @@ const path = require('path');
|
|
|
4
4
|
const extract = require('extract-zip');
|
|
5
5
|
|
|
6
6
|
const GITHUB_REPO = 'simplex-chat/simplex-chat-libs';
|
|
7
|
-
const RELEASE_TAG = 'v6.5.
|
|
7
|
+
const RELEASE_TAG = 'v6.5.1';
|
|
8
|
+
const BACKEND = (process.env.SIMPLEX_BACKEND || process.env.npm_config_simplex_backend || 'sqlite').toLowerCase();
|
|
9
|
+
|
|
10
|
+
if (BACKEND !== 'sqlite' && BACKEND !== 'postgres') {
|
|
11
|
+
console.error(`✗ Invalid SIMPLEX_BACKEND: "${BACKEND}". Must be "sqlite" or "postgres".`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (BACKEND === 'postgres' && (process.platform !== 'linux' || process.arch !== 'x64')) {
|
|
16
|
+
console.error(`✗ SIMPLEX_BACKEND=postgres is only supported on Linux x86_64.`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
8
20
|
const ROOT_DIR = process.cwd(); // Root of the package being installed
|
|
9
21
|
const LIBS_DIR = path.join(ROOT_DIR, 'libs')
|
|
10
22
|
const INSTALLED_FILE = path.join(LIBS_DIR, 'installed.txt');
|
|
@@ -56,11 +68,12 @@ function isAlreadyInstalled() {
|
|
|
56
68
|
|
|
57
69
|
try {
|
|
58
70
|
const installedVersion = fs.readFileSync(INSTALLED_FILE, 'utf-8').trim();
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
const expectedVersion = `${RELEASE_TAG}:${BACKEND}`;
|
|
72
|
+
if (installedVersion === expectedVersion) {
|
|
73
|
+
console.log(`✓ Libraries version ${RELEASE_TAG}:${BACKEND} already installed`);
|
|
61
74
|
return true;
|
|
62
75
|
} else {
|
|
63
|
-
console.log(`Version mismatch: installed ${installedVersion}, need ${
|
|
76
|
+
console.log(`Version mismatch: installed ${installedVersion}, need ${expectedVersion}`);
|
|
64
77
|
cleanLibsDirectory();
|
|
65
78
|
return false;
|
|
66
79
|
}
|
|
@@ -79,12 +92,14 @@ async function install() {
|
|
|
79
92
|
|
|
80
93
|
const { platformName, archName } = getPlatformInfo();
|
|
81
94
|
const repoName = GITHUB_REPO.split('/')[1];
|
|
82
|
-
const
|
|
95
|
+
const backendSuffix = BACKEND === 'postgres' ? '-postgres' : '';
|
|
96
|
+
const zipFilename = `${repoName}-${platformName}-${archName}${backendSuffix}.zip`;
|
|
83
97
|
const ZIP_URL = `https://github.com/${GITHUB_REPO}/releases/download/${RELEASE_TAG}/${zipFilename}`;
|
|
84
98
|
const ZIP_PATH = path.join(ROOT_DIR, zipFilename);
|
|
85
99
|
const TEMP_EXTRACT_DIR = path.join(ROOT_DIR, '.temp-extract');
|
|
86
100
|
|
|
87
101
|
console.log(`Detected: ${platformName} ${archName}`);
|
|
102
|
+
console.log(`Backend: ${BACKEND}`);
|
|
88
103
|
console.log(`Downloading: ${zipFilename}`);
|
|
89
104
|
|
|
90
105
|
// Create libs directory
|
|
@@ -124,8 +139,8 @@ async function install() {
|
|
|
124
139
|
}
|
|
125
140
|
|
|
126
141
|
// Write installed.txt with version
|
|
127
|
-
fs.writeFileSync(INSTALLED_FILE, RELEASE_TAG
|
|
128
|
-
console.log(`✓ Wrote version ${RELEASE_TAG} to installed.txt`);
|
|
142
|
+
fs.writeFileSync(INSTALLED_FILE, `${RELEASE_TAG}:${BACKEND}`, 'utf-8');
|
|
143
|
+
console.log(`✓ Wrote version ${RELEASE_TAG}:${BACKEND} to installed.txt`);
|
|
129
144
|
|
|
130
145
|
// Cleanup
|
|
131
146
|
fs.rmSync(TEMP_EXTRACT_DIR, { recursive: true, force: true });
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
[**simplex-chat**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[simplex-chat](README.md) / [bot](Namespace.bot.md) / BotDbOpts
|
|
6
|
-
|
|
7
|
-
# Interface: BotDbOpts
|
|
8
|
-
|
|
9
|
-
Defined in: [src/bot.ts:7](../src/bot.ts#L7)
|
|
10
|
-
|
|
11
|
-
## Properties
|
|
12
|
-
|
|
13
|
-
### confirmMigrations?
|
|
14
|
-
|
|
15
|
-
> `optional` **confirmMigrations**: [`MigrationConfirmation`](core.Enumeration.MigrationConfirmation.md)
|
|
16
|
-
|
|
17
|
-
Defined in: [src/bot.ts:10](../src/bot.ts#L10)
|
|
18
|
-
|
|
19
|
-
***
|
|
20
|
-
|
|
21
|
-
### dbFilePrefix
|
|
22
|
-
|
|
23
|
-
> **dbFilePrefix**: `string`
|
|
24
|
-
|
|
25
|
-
Defined in: [src/bot.ts:8](../src/bot.ts#L8)
|
|
26
|
-
|
|
27
|
-
***
|
|
28
|
-
|
|
29
|
-
### dbKey?
|
|
30
|
-
|
|
31
|
-
> `optional` **dbKey**: `string`
|
|
32
|
-
|
|
33
|
-
Defined in: [src/bot.ts:9](../src/bot.ts#L9)
|