appwrite-cli 13.2.0 → 13.3.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.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/dist/bundle-win-arm64.mjs +285 -74
- package/dist/cli.cjs +285 -74
- package/dist/index.js +96 -13
- package/dist/lib/commands/config-validations.d.ts +1 -1
- package/dist/lib/commands/config.d.ts +24 -0
- package/dist/lib/commands/config.d.ts.map +1 -1
- package/dist/lib/commands/generic.d.ts +2 -4
- package/dist/lib/commands/generic.d.ts.map +1 -1
- package/dist/lib/commands/push.d.ts.map +1 -1
- package/dist/lib/commands/utils/attributes.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/questions.d.ts +1 -0
- package/dist/lib/questions.d.ts.map +1 -1
- package/dist/lib/shared/typescript-type-utils.d.ts.map +1 -1
- package/dist/lib/type-generation/attribute.d.ts +4 -0
- package/dist/lib/type-generation/attribute.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/commands/config-validations.ts +3 -3
- package/lib/commands/config.ts +10 -2
- package/lib/commands/generic.ts +211 -76
- package/lib/commands/push.ts +3 -2
- package/lib/commands/utils/attributes.ts +70 -0
- package/lib/config.ts +4 -4
- package/lib/constants.ts +1 -1
- package/lib/questions.ts +3 -1
- package/lib/shared/typescript-type-utils.ts +4 -0
- package/lib/type-generation/attribute.ts +4 -0
- package/lib/type-generation/languages/csharp.ts +6 -2
- package/lib/type-generation/languages/dart.ts +5 -1
- package/lib/type-generation/languages/java.ts +4 -0
- package/lib/type-generation/languages/javascript.ts +4 -0
- package/lib/type-generation/languages/kotlin.ts +4 -0
- package/lib/type-generation/languages/php.ts +4 -0
- package/lib/type-generation/languages/swift.ts +8 -4
- package/package.json +1 -1
- package/scoop/appwrite.config.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
- Support type generation for text/varchar/mediumtext/longtext attributes
|
|
6
|
+
- Improve CLI session switch and logout UX
|
|
7
|
+
|
|
8
|
+
## 13.2.1
|
|
9
|
+
|
|
10
|
+
- Fix site domain construction
|
|
11
|
+
|
|
3
12
|
## 13.2.0
|
|
4
13
|
|
|
5
14
|
- Feat: Add dedicated commands for text-based attribute management:
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
13.
|
|
32
|
+
13.3.0
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
|
|
|
60
60
|
Once the installation completes, you can verify your install using
|
|
61
61
|
```
|
|
62
62
|
$ appwrite -v
|
|
63
|
-
13.
|
|
63
|
+
13.3.0
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
|
@@ -21962,9 +21962,9 @@ var require_stream_duplex = __commonJS({
|
|
|
21962
21962
|
}
|
|
21963
21963
|
});
|
|
21964
21964
|
|
|
21965
|
-
// node_modules/safe-buffer/index.js
|
|
21965
|
+
// node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
21966
21966
|
var require_safe_buffer = __commonJS({
|
|
21967
|
-
"node_modules/safe-buffer/index.js"(exports, module) {
|
|
21967
|
+
"node_modules/string_decoder/node_modules/safe-buffer/index.js"(exports, module) {
|
|
21968
21968
|
var buffer = __require("buffer");
|
|
21969
21969
|
var Buffer2 = buffer.Buffer;
|
|
21970
21970
|
function copyProps(src, dst) {
|
|
@@ -93398,7 +93398,7 @@ var package_default = {
|
|
|
93398
93398
|
type: "module",
|
|
93399
93399
|
homepage: "https://appwrite.io/support",
|
|
93400
93400
|
description: "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
|
|
93401
|
-
version: "13.
|
|
93401
|
+
version: "13.3.0",
|
|
93402
93402
|
license: "BSD-3-Clause",
|
|
93403
93403
|
main: "dist/index.js",
|
|
93404
93404
|
types: "dist/index.d.ts",
|
|
@@ -107253,7 +107253,7 @@ var validateRequiredDefault = (data) => {
|
|
|
107253
107253
|
return true;
|
|
107254
107254
|
};
|
|
107255
107255
|
var validateStringSize = (data) => {
|
|
107256
|
-
if (data.type !== "string") {
|
|
107256
|
+
if (data.type !== "string" && data.type !== "varchar") {
|
|
107257
107257
|
return true;
|
|
107258
107258
|
}
|
|
107259
107259
|
if (data.format && data.format !== "") {
|
|
@@ -107485,6 +107485,10 @@ var AttributeSchema = external_exports.object({
|
|
|
107485
107485
|
key: external_exports.string(),
|
|
107486
107486
|
type: external_exports.enum([
|
|
107487
107487
|
"string",
|
|
107488
|
+
"text",
|
|
107489
|
+
"varchar",
|
|
107490
|
+
"mediumtext",
|
|
107491
|
+
"longtext",
|
|
107488
107492
|
"integer",
|
|
107489
107493
|
"double",
|
|
107490
107494
|
"boolean",
|
|
@@ -107519,7 +107523,7 @@ var AttributeSchema = external_exports.object({
|
|
|
107519
107523
|
message: "When 'required' is true, 'default' must be null",
|
|
107520
107524
|
path: ["default"]
|
|
107521
107525
|
}).refine(validateStringSize, {
|
|
107522
|
-
message: "When 'type' is 'string', 'size' must be defined",
|
|
107526
|
+
message: "When 'type' is 'string' or 'varchar', 'size' must be defined",
|
|
107523
107527
|
path: ["size"]
|
|
107524
107528
|
});
|
|
107525
107529
|
var IndexSchema = external_exports.object({
|
|
@@ -107543,6 +107547,10 @@ var ColumnSchema = external_exports.object({
|
|
|
107543
107547
|
key: external_exports.string(),
|
|
107544
107548
|
type: external_exports.enum([
|
|
107545
107549
|
"string",
|
|
107550
|
+
"text",
|
|
107551
|
+
"varchar",
|
|
107552
|
+
"mediumtext",
|
|
107553
|
+
"longtext",
|
|
107546
107554
|
"integer",
|
|
107547
107555
|
"double",
|
|
107548
107556
|
"boolean",
|
|
@@ -107578,7 +107586,7 @@ var ColumnSchema = external_exports.object({
|
|
|
107578
107586
|
message: "When 'required' is true, 'default' must be null",
|
|
107579
107587
|
path: ["default"]
|
|
107580
107588
|
}).refine(validateStringSize, {
|
|
107581
|
-
message: "When 'type' is 'string', 'size' must be defined",
|
|
107589
|
+
message: "When 'type' is 'string' or 'varchar', 'size' must be defined",
|
|
107582
107590
|
path: ["size"]
|
|
107583
107591
|
});
|
|
107584
107592
|
var IndexTableSchema = external_exports.object({
|
|
@@ -107654,7 +107662,7 @@ import childProcess from "child_process";
|
|
|
107654
107662
|
// lib/constants.ts
|
|
107655
107663
|
var SDK_TITLE = "Appwrite";
|
|
107656
107664
|
var SDK_TITLE_LOWER = "appwrite";
|
|
107657
|
-
var SDK_VERSION = "13.
|
|
107665
|
+
var SDK_VERSION = "13.3.0";
|
|
107658
107666
|
var SDK_NAME = "Command Line";
|
|
107659
107667
|
var SDK_PLATFORM = "console";
|
|
107660
107668
|
var SDK_LANGUAGE = "cli";
|
|
@@ -109727,14 +109735,14 @@ var Global = class _Global extends Config {
|
|
|
109727
109735
|
const sessionMap = /* @__PURE__ */ new Map();
|
|
109728
109736
|
sessions.forEach((sessionId) => {
|
|
109729
109737
|
const sessionData = this.data[sessionId];
|
|
109730
|
-
const email3 = sessionData[_Global.PREFERENCE_EMAIL];
|
|
109731
|
-
const endpoint = sessionData[_Global.PREFERENCE_ENDPOINT];
|
|
109738
|
+
const email3 = sessionData[_Global.PREFERENCE_EMAIL] ?? "";
|
|
109739
|
+
const endpoint = sessionData[_Global.PREFERENCE_ENDPOINT] ?? "";
|
|
109732
109740
|
const key = `${email3}|${endpoint}`;
|
|
109733
109741
|
if (sessionId === current || !sessionMap.has(key)) {
|
|
109734
109742
|
sessionMap.set(key, {
|
|
109735
109743
|
id: sessionId,
|
|
109736
|
-
endpoint
|
|
109737
|
-
email:
|
|
109744
|
+
endpoint,
|
|
109745
|
+
email: email3
|
|
109738
109746
|
});
|
|
109739
109747
|
}
|
|
109740
109748
|
});
|
|
@@ -135294,7 +135302,7 @@ var questionsLogin = [
|
|
|
135294
135302
|
when: (answers) => answers.method !== "select"
|
|
135295
135303
|
},
|
|
135296
135304
|
{
|
|
135297
|
-
type: "
|
|
135305
|
+
type: "list",
|
|
135298
135306
|
name: "accountId",
|
|
135299
135307
|
message: "Select an account to use",
|
|
135300
135308
|
choices() {
|
|
@@ -135309,6 +135317,7 @@ var questionsLogin = [
|
|
|
135309
135317
|
data.push({
|
|
135310
135318
|
current: current === session.id,
|
|
135311
135319
|
value: session.id,
|
|
135320
|
+
short: `${session.email} (${session.endpoint})`,
|
|
135312
135321
|
name: `${session.email.padEnd(longestEmail)} ${current === session.id ? import_chalk2.default.green.bold("current") : " ".repeat(6)} ${session.endpoint}`
|
|
135313
135322
|
});
|
|
135314
135323
|
}
|
|
@@ -135917,6 +135926,88 @@ var client_default = Client3;
|
|
|
135917
135926
|
|
|
135918
135927
|
// lib/commands/generic.ts
|
|
135919
135928
|
var DEFAULT_ENDPOINT2 = "https://cloud.appwrite.io/v1";
|
|
135929
|
+
var isMfaRequiredError = (err) => err?.type === "user_more_factors_required" || err?.response === "user_more_factors_required";
|
|
135930
|
+
var createLegacyConsoleClient = (endpoint) => {
|
|
135931
|
+
const legacyClient = new client_default();
|
|
135932
|
+
legacyClient.setEndpoint(endpoint);
|
|
135933
|
+
legacyClient.setProject("console");
|
|
135934
|
+
if (globalConfig2.getSelfSigned()) {
|
|
135935
|
+
legacyClient.setSelfSigned(true);
|
|
135936
|
+
}
|
|
135937
|
+
return legacyClient;
|
|
135938
|
+
};
|
|
135939
|
+
var completeMfaLogin = async ({
|
|
135940
|
+
client: client2,
|
|
135941
|
+
legacyClient,
|
|
135942
|
+
mfa,
|
|
135943
|
+
code
|
|
135944
|
+
}) => {
|
|
135945
|
+
let accountClient2 = new Account(client2);
|
|
135946
|
+
const savedCookie = globalConfig2.getCookie();
|
|
135947
|
+
if (savedCookie) {
|
|
135948
|
+
legacyClient.setCookie(savedCookie);
|
|
135949
|
+
client2.setCookie(savedCookie);
|
|
135950
|
+
}
|
|
135951
|
+
const { factor } = mfa ? { factor: mfa } : await import_inquirer.default.prompt(questionsListFactors);
|
|
135952
|
+
const challenge = await accountClient2.createMfaChallenge(factor);
|
|
135953
|
+
const { otp } = code ? { otp: code } : await import_inquirer.default.prompt(questionsMFAChallenge);
|
|
135954
|
+
await legacyClient.call(
|
|
135955
|
+
"PUT",
|
|
135956
|
+
"/account/mfa/challenges",
|
|
135957
|
+
{
|
|
135958
|
+
"content-type": "application/json"
|
|
135959
|
+
},
|
|
135960
|
+
{
|
|
135961
|
+
challengeId: challenge.$id,
|
|
135962
|
+
otp
|
|
135963
|
+
}
|
|
135964
|
+
);
|
|
135965
|
+
const updatedCookie = globalConfig2.getCookie();
|
|
135966
|
+
if (updatedCookie) {
|
|
135967
|
+
client2.setCookie(updatedCookie);
|
|
135968
|
+
}
|
|
135969
|
+
accountClient2 = new Account(client2);
|
|
135970
|
+
return accountClient2.get();
|
|
135971
|
+
};
|
|
135972
|
+
var deleteServerSession = async (sessionId) => {
|
|
135973
|
+
try {
|
|
135974
|
+
let client2 = await sdkForConsole();
|
|
135975
|
+
let accountClient2 = new Account(client2);
|
|
135976
|
+
await accountClient2.deleteSession(sessionId);
|
|
135977
|
+
return true;
|
|
135978
|
+
} catch (e) {
|
|
135979
|
+
return false;
|
|
135980
|
+
}
|
|
135981
|
+
};
|
|
135982
|
+
var deleteLocalSession = (accountId) => {
|
|
135983
|
+
globalConfig2.removeSession(accountId);
|
|
135984
|
+
};
|
|
135985
|
+
var getSessionAccountKey = (sessionId) => {
|
|
135986
|
+
const session = globalConfig2.get(sessionId);
|
|
135987
|
+
if (!session) return void 0;
|
|
135988
|
+
return `${session.email ?? ""}|${session.endpoint ?? ""}`;
|
|
135989
|
+
};
|
|
135990
|
+
var planSessionLogout = (selectedSessionIds) => {
|
|
135991
|
+
const sessionIdsByAccount = /* @__PURE__ */ new Map();
|
|
135992
|
+
for (const sessionId of globalConfig2.getSessionIds()) {
|
|
135993
|
+
const key = getSessionAccountKey(sessionId);
|
|
135994
|
+
if (!key) continue;
|
|
135995
|
+
const ids = sessionIdsByAccount.get(key) ?? [];
|
|
135996
|
+
ids.push(sessionId);
|
|
135997
|
+
sessionIdsByAccount.set(key, ids);
|
|
135998
|
+
}
|
|
135999
|
+
const selectedByAccount = /* @__PURE__ */ new Map();
|
|
136000
|
+
for (const selectedSessionId of selectedSessionIds) {
|
|
136001
|
+
const key = getSessionAccountKey(selectedSessionId);
|
|
136002
|
+
if (!key || selectedByAccount.has(key)) continue;
|
|
136003
|
+
selectedByAccount.set(key, selectedSessionId);
|
|
136004
|
+
}
|
|
136005
|
+
const serverTargets = Array.from(selectedByAccount.values());
|
|
136006
|
+
const localTargets = Array.from(selectedByAccount.keys()).flatMap(
|
|
136007
|
+
(accountKey) => sessionIdsByAccount.get(accountKey) ?? []
|
|
136008
|
+
);
|
|
136009
|
+
return { serverTargets, localTargets };
|
|
136010
|
+
};
|
|
135920
136011
|
var loginCommand = async ({
|
|
135921
136012
|
email: email3,
|
|
135922
136013
|
password,
|
|
@@ -135942,7 +136033,25 @@ var loginCommand = async ({
|
|
|
135942
136033
|
throw Error("Session ID not found");
|
|
135943
136034
|
}
|
|
135944
136035
|
globalConfig2.setCurrentSession(accountId);
|
|
135945
|
-
|
|
136036
|
+
const client3 = await sdkForConsole(false);
|
|
136037
|
+
const accountClient3 = new Account(client3);
|
|
136038
|
+
const legacyClient2 = createLegacyConsoleClient(
|
|
136039
|
+
globalConfig2.getEndpoint() || DEFAULT_ENDPOINT2
|
|
136040
|
+
);
|
|
136041
|
+
try {
|
|
136042
|
+
await accountClient3.get();
|
|
136043
|
+
} catch (err) {
|
|
136044
|
+
if (!isMfaRequiredError(err)) {
|
|
136045
|
+
throw err;
|
|
136046
|
+
}
|
|
136047
|
+
await completeMfaLogin({
|
|
136048
|
+
client: client3,
|
|
136049
|
+
legacyClient: legacyClient2,
|
|
136050
|
+
mfa,
|
|
136051
|
+
code
|
|
136052
|
+
});
|
|
136053
|
+
}
|
|
136054
|
+
success2(`Switched to ${globalConfig2.getEmail()}`);
|
|
135946
136055
|
return;
|
|
135947
136056
|
}
|
|
135948
136057
|
const id = id_default2.unique();
|
|
@@ -135950,12 +136059,7 @@ var loginCommand = async ({
|
|
|
135950
136059
|
globalConfig2.setCurrentSession(id);
|
|
135951
136060
|
globalConfig2.setEndpoint(configEndpoint);
|
|
135952
136061
|
globalConfig2.setEmail(answers.email);
|
|
135953
|
-
const legacyClient =
|
|
135954
|
-
legacyClient.setEndpoint(configEndpoint);
|
|
135955
|
-
legacyClient.setProject("console");
|
|
135956
|
-
if (globalConfig2.getSelfSigned()) {
|
|
135957
|
-
legacyClient.setSelfSigned(true);
|
|
135958
|
-
}
|
|
136062
|
+
const legacyClient = createLegacyConsoleClient(configEndpoint);
|
|
135959
136063
|
let client2 = await sdkForConsole(false);
|
|
135960
136064
|
let accountClient2 = new Account(client2);
|
|
135961
136065
|
let account2;
|
|
@@ -135979,27 +136083,13 @@ var loginCommand = async ({
|
|
|
135979
136083
|
accountClient2 = new Account(client2);
|
|
135980
136084
|
account2 = await accountClient2.get();
|
|
135981
136085
|
} catch (err) {
|
|
135982
|
-
if (err
|
|
135983
|
-
|
|
135984
|
-
|
|
135985
|
-
|
|
135986
|
-
|
|
135987
|
-
|
|
135988
|
-
|
|
135989
|
-
{
|
|
135990
|
-
"content-type": "application/json"
|
|
135991
|
-
},
|
|
135992
|
-
{
|
|
135993
|
-
challengeId: challenge.$id,
|
|
135994
|
-
otp
|
|
135995
|
-
}
|
|
135996
|
-
);
|
|
135997
|
-
const savedCookie = globalConfig2.getCookie();
|
|
135998
|
-
if (savedCookie) {
|
|
135999
|
-
client2.setCookie(savedCookie);
|
|
136000
|
-
}
|
|
136001
|
-
accountClient2 = new Account(client2);
|
|
136002
|
-
account2 = await accountClient2.get();
|
|
136086
|
+
if (isMfaRequiredError(err)) {
|
|
136087
|
+
account2 = await completeMfaLogin({
|
|
136088
|
+
client: client2,
|
|
136089
|
+
legacyClient,
|
|
136090
|
+
mfa,
|
|
136091
|
+
code
|
|
136092
|
+
});
|
|
136003
136093
|
} else {
|
|
136004
136094
|
globalConfig2.removeSession(id);
|
|
136005
136095
|
globalConfig2.setCurrentSession(oldCurrent);
|
|
@@ -136059,49 +136149,59 @@ var login = new Command("login").description(commandDescriptions["login"]).optio
|
|
|
136059
136149
|
).option(`--code [code]`, `Multi-factor code`).configureHelp({
|
|
136060
136150
|
helpWidth: process.stdout.columns || 80
|
|
136061
136151
|
}).action(actionRunner(loginCommand));
|
|
136062
|
-
var deleteSession = async (accountId) => {
|
|
136063
|
-
try {
|
|
136064
|
-
let client2 = await sdkForConsole();
|
|
136065
|
-
let accountClient2 = new Account(client2);
|
|
136066
|
-
await accountClient2.deleteSession("current");
|
|
136067
|
-
} catch (e) {
|
|
136068
|
-
error48("Unable to log out, removing locally saved session information");
|
|
136069
|
-
} finally {
|
|
136070
|
-
globalConfig2.removeSession(accountId);
|
|
136071
|
-
}
|
|
136072
|
-
};
|
|
136073
136152
|
var logout = new Command("logout").description(commandDescriptions["logout"]).configureHelp({
|
|
136074
136153
|
helpWidth: process.stdout.columns || 80
|
|
136075
136154
|
}).action(
|
|
136076
136155
|
actionRunner(async () => {
|
|
136077
136156
|
const sessions = globalConfig2.getSessions();
|
|
136078
136157
|
const current = globalConfig2.getCurrentSession();
|
|
136158
|
+
const originalCurrent = current;
|
|
136079
136159
|
if (current === "" || !sessions.length) {
|
|
136080
136160
|
log("No active sessions found.");
|
|
136081
136161
|
return;
|
|
136082
136162
|
}
|
|
136083
136163
|
if (sessions.length === 1) {
|
|
136084
|
-
await
|
|
136164
|
+
const serverDeleted = await deleteServerSession(current);
|
|
136165
|
+
const allSessionIds = globalConfig2.getSessionIds();
|
|
136166
|
+
for (const sessId of allSessionIds) {
|
|
136167
|
+
deleteLocalSession(sessId);
|
|
136168
|
+
}
|
|
136085
136169
|
globalConfig2.setCurrentSession("");
|
|
136086
|
-
|
|
136170
|
+
if (!serverDeleted) {
|
|
136171
|
+
hint("Could not reach server, removed local session data");
|
|
136172
|
+
}
|
|
136173
|
+
success2("Logged out successfully");
|
|
136087
136174
|
return;
|
|
136088
136175
|
}
|
|
136089
136176
|
const answers = await import_inquirer.default.prompt(questionsLogout);
|
|
136090
|
-
if (answers.accounts) {
|
|
136091
|
-
|
|
136092
|
-
|
|
136093
|
-
|
|
136177
|
+
if (answers.accounts?.length) {
|
|
136178
|
+
const { serverTargets, localTargets } = planSessionLogout(
|
|
136179
|
+
answers.accounts
|
|
136180
|
+
);
|
|
136181
|
+
for (const sessionId of serverTargets) {
|
|
136182
|
+
globalConfig2.setCurrentSession(sessionId);
|
|
136183
|
+
await deleteServerSession(sessionId);
|
|
136184
|
+
}
|
|
136185
|
+
for (const sessionId of localTargets) {
|
|
136186
|
+
deleteLocalSession(sessionId);
|
|
136094
136187
|
}
|
|
136095
136188
|
}
|
|
136096
136189
|
const remainingSessions = globalConfig2.getSessions();
|
|
136097
|
-
|
|
136098
|
-
|
|
136099
|
-
|
|
136100
|
-
|
|
136190
|
+
const hasCurrent = remainingSessions.some(
|
|
136191
|
+
(session) => session.id === originalCurrent
|
|
136192
|
+
);
|
|
136193
|
+
if (remainingSessions.length > 0 && hasCurrent) {
|
|
136194
|
+
globalConfig2.setCurrentSession(originalCurrent);
|
|
136195
|
+
} else if (remainingSessions.length > 0) {
|
|
136196
|
+
const nextSession = remainingSessions.find((session) => session.email) ?? remainingSessions[0];
|
|
136197
|
+
globalConfig2.setCurrentSession(nextSession.id);
|
|
136198
|
+
success2(
|
|
136199
|
+
nextSession.email ? `Switched to ${nextSession.email}` : `Switched to session at ${nextSession.endpoint}`
|
|
136200
|
+
);
|
|
136101
136201
|
} else if (remainingSessions.length === 0) {
|
|
136102
136202
|
globalConfig2.setCurrentSession("");
|
|
136103
136203
|
}
|
|
136104
|
-
success2("
|
|
136204
|
+
success2("Logged out successfully");
|
|
136105
136205
|
})
|
|
136106
136206
|
);
|
|
136107
136207
|
var client = new Command("client").description(commandDescriptions["client"]).configureHelp({
|
|
@@ -136194,10 +136294,14 @@ var client = new Command("client").description(commandDescriptions["client"]).co
|
|
|
136194
136294
|
}
|
|
136195
136295
|
if (reset !== void 0) {
|
|
136196
136296
|
const sessions = globalConfig2.getSessions();
|
|
136197
|
-
for (
|
|
136198
|
-
globalConfig2.setCurrentSession(
|
|
136199
|
-
await
|
|
136297
|
+
for (const sessionId of sessions.map((session) => session.id)) {
|
|
136298
|
+
globalConfig2.setCurrentSession(sessionId);
|
|
136299
|
+
await deleteServerSession(sessionId);
|
|
136200
136300
|
}
|
|
136301
|
+
for (const sessionId of globalConfig2.getSessionIds()) {
|
|
136302
|
+
deleteLocalSession(sessionId);
|
|
136303
|
+
}
|
|
136304
|
+
globalConfig2.setCurrentSession("");
|
|
136201
136305
|
}
|
|
136202
136306
|
if (!debug) {
|
|
136203
136307
|
success2("Setting client");
|
|
@@ -137834,6 +137938,10 @@ function detectLanguage() {
|
|
|
137834
137938
|
// lib/type-generation/attribute.ts
|
|
137835
137939
|
var AttributeType = {
|
|
137836
137940
|
STRING: "string",
|
|
137941
|
+
TEXT: "text",
|
|
137942
|
+
VARCHAR: "varchar",
|
|
137943
|
+
MEDIUMTEXT: "mediumtext",
|
|
137944
|
+
LONGTEXT: "longtext",
|
|
137837
137945
|
INTEGER: "integer",
|
|
137838
137946
|
FLOAT: "double",
|
|
137839
137947
|
BOOLEAN: "boolean",
|
|
@@ -137857,6 +137965,10 @@ var PHP = class extends LanguageMeta {
|
|
|
137857
137965
|
let type = "";
|
|
137858
137966
|
switch (attribute.type) {
|
|
137859
137967
|
case AttributeType.STRING:
|
|
137968
|
+
case AttributeType.TEXT:
|
|
137969
|
+
case AttributeType.VARCHAR:
|
|
137970
|
+
case AttributeType.MEDIUMTEXT:
|
|
137971
|
+
case AttributeType.LONGTEXT:
|
|
137860
137972
|
case AttributeType.DATETIME:
|
|
137861
137973
|
type = "string";
|
|
137862
137974
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -137964,6 +138076,10 @@ function getTypeScriptType(attribute, entities, entityName, forCreate = false) {
|
|
|
137964
138076
|
let type = "";
|
|
137965
138077
|
switch (attribute.type) {
|
|
137966
138078
|
case "string":
|
|
138079
|
+
case "text":
|
|
138080
|
+
case "varchar":
|
|
138081
|
+
case "mediumtext":
|
|
138082
|
+
case "longtext":
|
|
137967
138083
|
case "datetime":
|
|
137968
138084
|
type = "string";
|
|
137969
138085
|
if (attribute.format === "enum") {
|
|
@@ -138136,6 +138252,10 @@ var Kotlin = class extends LanguageMeta {
|
|
|
138136
138252
|
let type = "";
|
|
138137
138253
|
switch (attribute.type) {
|
|
138138
138254
|
case AttributeType.STRING:
|
|
138255
|
+
case AttributeType.TEXT:
|
|
138256
|
+
case AttributeType.VARCHAR:
|
|
138257
|
+
case AttributeType.MEDIUMTEXT:
|
|
138258
|
+
case AttributeType.LONGTEXT:
|
|
138139
138259
|
case AttributeType.DATETIME:
|
|
138140
138260
|
type = "String";
|
|
138141
138261
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138224,6 +138344,10 @@ var Swift = class extends LanguageMeta {
|
|
|
138224
138344
|
let type = "";
|
|
138225
138345
|
switch (attribute.type) {
|
|
138226
138346
|
case AttributeType.STRING:
|
|
138347
|
+
case AttributeType.TEXT:
|
|
138348
|
+
case AttributeType.VARCHAR:
|
|
138349
|
+
case AttributeType.MEDIUMTEXT:
|
|
138350
|
+
case AttributeType.LONGTEXT:
|
|
138227
138351
|
case AttributeType.DATETIME:
|
|
138228
138352
|
type = "String";
|
|
138229
138353
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138334,7 +138458,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138334
138458
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
138335
138459
|
<% if (attribute.type === 'relationship') { -%>
|
|
138336
138460
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138337
|
-
<% } else if (attribute.array &&
|
|
138461
|
+
<% } else if (attribute.array && !['string', 'text', 'varchar', 'mediumtext', 'longtext', 'integer', 'float', 'boolean'].includes(attribute.type)) { -%>
|
|
138338
138462
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %>?.map { $0.toMap() } as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138339
138463
|
<% } else { -%>
|
|
138340
138464
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138350,7 +138474,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138350
138474
|
<% const relationshipType = getType(attribute, collections, collection.name).replace('?', ''); -%>
|
|
138351
138475
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> <%- relationshipType %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138352
138476
|
<% } else if (attribute.array) { -%>
|
|
138353
|
-
<% if (
|
|
138477
|
+
<% if (['string', 'text', 'varchar', 'mediumtext', 'longtext'].includes(attribute.type)) { -%>
|
|
138354
138478
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [String]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138355
138479
|
<% } else if (attribute.type === 'integer') { -%>
|
|
138356
138480
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [Int]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138362,9 +138486,9 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138362
138486
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: (map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [[String: Any]])<% if (!attribute.required) { %>?<% } %>.map { <%- toPascalCase(attribute.type) %>.from(map: $0) }<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138363
138487
|
<% } -%>
|
|
138364
138488
|
<% } else { -%>
|
|
138365
|
-
<% if (
|
|
138489
|
+
<% if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'email', 'datetime'].includes(attribute.type) && attribute.format !== 'enum') { -%>
|
|
138366
138490
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> String<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138367
|
-
<% } else if (
|
|
138491
|
+
<% } else if (['string', 'text', 'varchar', 'mediumtext', 'longtext'].includes(attribute.type) && attribute.format === 'enum') { -%>
|
|
138368
138492
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138369
138493
|
<% } else if (attribute.type === 'integer') { -%>
|
|
138370
138494
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Int<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138392,6 +138516,10 @@ var Java = class extends LanguageMeta {
|
|
|
138392
138516
|
let type = "";
|
|
138393
138517
|
switch (attribute.type) {
|
|
138394
138518
|
case AttributeType.STRING:
|
|
138519
|
+
case AttributeType.TEXT:
|
|
138520
|
+
case AttributeType.VARCHAR:
|
|
138521
|
+
case AttributeType.MEDIUMTEXT:
|
|
138522
|
+
case AttributeType.LONGTEXT:
|
|
138395
138523
|
case AttributeType.DATETIME:
|
|
138396
138524
|
type = "String";
|
|
138397
138525
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138572,6 +138700,10 @@ var Dart = class extends LanguageMeta {
|
|
|
138572
138700
|
let type = "";
|
|
138573
138701
|
switch (attribute.type) {
|
|
138574
138702
|
case AttributeType.STRING:
|
|
138703
|
+
case AttributeType.TEXT:
|
|
138704
|
+
case AttributeType.VARCHAR:
|
|
138705
|
+
case AttributeType.MEDIUMTEXT:
|
|
138706
|
+
case AttributeType.LONGTEXT:
|
|
138575
138707
|
case AttributeType.DATETIME:
|
|
138576
138708
|
type = "String";
|
|
138577
138709
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138676,7 +138808,7 @@ class <%= toPascalCase(collection.name) %> {
|
|
|
138676
138808
|
factory <%= toPascalCase(collection.name) %>.fromMap(Map<String, dynamic> map) {
|
|
138677
138809
|
return <%= toPascalCase(collection.name) %>(<% if (__attrs.length > 0) { %>
|
|
138678
138810
|
<% for (const [index, attribute] of Object.entries(__attrs)) { -%>
|
|
138679
|
-
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (
|
|
138811
|
+
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (['${AttributeType.STRING}', '${AttributeType.TEXT}', '${AttributeType.VARCHAR}', '${AttributeType.MEDIUMTEXT}', '${AttributeType.LONGTEXT}', '${AttributeType.EMAIL}', '${AttributeType.DATETIME}'].includes(attribute.type)) { -%>
|
|
138680
138812
|
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
|
|
138681
138813
|
<% if (attribute.array) { -%>
|
|
138682
138814
|
(map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.value == e)).toList()<% } else { -%>
|
|
@@ -138747,6 +138879,10 @@ var JavaScript = class extends LanguageMeta {
|
|
|
138747
138879
|
let type = "";
|
|
138748
138880
|
switch (attribute.type) {
|
|
138749
138881
|
case AttributeType.STRING:
|
|
138882
|
+
case AttributeType.TEXT:
|
|
138883
|
+
case AttributeType.VARCHAR:
|
|
138884
|
+
case AttributeType.MEDIUMTEXT:
|
|
138885
|
+
case AttributeType.LONGTEXT:
|
|
138750
138886
|
case AttributeType.DATETIME:
|
|
138751
138887
|
type = "string";
|
|
138752
138888
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138845,6 +138981,10 @@ var CSharp = class extends LanguageMeta {
|
|
|
138845
138981
|
let type = "";
|
|
138846
138982
|
switch (attribute.type) {
|
|
138847
138983
|
case AttributeType.STRING:
|
|
138984
|
+
case AttributeType.TEXT:
|
|
138985
|
+
case AttributeType.VARCHAR:
|
|
138986
|
+
case AttributeType.MEDIUMTEXT:
|
|
138987
|
+
case AttributeType.LONGTEXT:
|
|
138848
138988
|
case AttributeType.DATETIME:
|
|
138849
138989
|
type = "string";
|
|
138850
138990
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138952,7 +139092,7 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
138952
139092
|
}
|
|
138953
139093
|
// ARRAY TYPES
|
|
138954
139094
|
} else if (attribute.array) {
|
|
138955
|
-
if (
|
|
139095
|
+
if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'datetime', 'email'].includes(attribute.type)) {
|
|
138956
139096
|
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(x => x?.ToString())<%- attribute.required ? '.Where(x => x != null)' : '' %>.ToList()!<%
|
|
138957
139097
|
} else if (attribute.type === 'integer') {
|
|
138958
139098
|
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(x => <%- !attribute.required ? 'x == null ? (long?)null : ' : '' %>Convert.ToInt64(x)).ToList()<%
|
|
@@ -138968,7 +139108,7 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
138968
139108
|
-%><%- !attribute.required ? 'map["' + attribute.key + '"] == null ? null : ' : '' %>Convert.ToDouble(map["<%- attribute.key %>"])<%
|
|
138969
139109
|
} else if (attribute.type === 'boolean') {
|
|
138970
139110
|
-%>(<%- getType(attribute, collections, collection.name) %>)map["<%- attribute.key %>"]<%
|
|
138971
|
-
} else if (
|
|
139111
|
+
} else if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'datetime', 'email'].includes(attribute.type)) {
|
|
138972
139112
|
-%>map["<%- attribute.key %>"]<%- !attribute.required ? '?' : '' %>.ToString()<%- attribute.required ? '!' : ''%><%
|
|
138973
139113
|
} else {
|
|
138974
139114
|
-%>default<%
|
|
@@ -140678,6 +140818,43 @@ var Attributes = class {
|
|
|
140678
140818
|
encrypt: attribute.encrypt
|
|
140679
140819
|
});
|
|
140680
140820
|
}
|
|
140821
|
+
case "varchar":
|
|
140822
|
+
return databasesService.createVarcharAttribute({
|
|
140823
|
+
databaseId,
|
|
140824
|
+
collectionId,
|
|
140825
|
+
key: attribute.key,
|
|
140826
|
+
size: attribute.size,
|
|
140827
|
+
required: attribute.required,
|
|
140828
|
+
xdefault: attribute.default,
|
|
140829
|
+
array: attribute.array
|
|
140830
|
+
});
|
|
140831
|
+
case "text":
|
|
140832
|
+
return databasesService.createTextAttribute({
|
|
140833
|
+
databaseId,
|
|
140834
|
+
collectionId,
|
|
140835
|
+
key: attribute.key,
|
|
140836
|
+
required: attribute.required,
|
|
140837
|
+
xdefault: attribute.default,
|
|
140838
|
+
array: attribute.array
|
|
140839
|
+
});
|
|
140840
|
+
case "mediumtext":
|
|
140841
|
+
return databasesService.createMediumtextAttribute({
|
|
140842
|
+
databaseId,
|
|
140843
|
+
collectionId,
|
|
140844
|
+
key: attribute.key,
|
|
140845
|
+
required: attribute.required,
|
|
140846
|
+
xdefault: attribute.default,
|
|
140847
|
+
array: attribute.array
|
|
140848
|
+
});
|
|
140849
|
+
case "longtext":
|
|
140850
|
+
return databasesService.createLongtextAttribute({
|
|
140851
|
+
databaseId,
|
|
140852
|
+
collectionId,
|
|
140853
|
+
key: attribute.key,
|
|
140854
|
+
required: attribute.required,
|
|
140855
|
+
xdefault: attribute.default,
|
|
140856
|
+
array: attribute.array
|
|
140857
|
+
});
|
|
140681
140858
|
case "integer":
|
|
140682
140859
|
return databasesService.createIntegerAttribute({
|
|
140683
140860
|
databaseId,
|
|
@@ -140804,6 +140981,39 @@ var Attributes = class {
|
|
|
140804
140981
|
xdefault: attribute.default
|
|
140805
140982
|
});
|
|
140806
140983
|
}
|
|
140984
|
+
case "varchar":
|
|
140985
|
+
return databasesService.updateVarcharAttribute({
|
|
140986
|
+
databaseId,
|
|
140987
|
+
collectionId,
|
|
140988
|
+
key: attribute.key,
|
|
140989
|
+
required: attribute.required,
|
|
140990
|
+
xdefault: attribute.default,
|
|
140991
|
+
size: attribute.size
|
|
140992
|
+
});
|
|
140993
|
+
case "text":
|
|
140994
|
+
return databasesService.updateTextAttribute({
|
|
140995
|
+
databaseId,
|
|
140996
|
+
collectionId,
|
|
140997
|
+
key: attribute.key,
|
|
140998
|
+
required: attribute.required,
|
|
140999
|
+
xdefault: attribute.default
|
|
141000
|
+
});
|
|
141001
|
+
case "mediumtext":
|
|
141002
|
+
return databasesService.updateMediumtextAttribute({
|
|
141003
|
+
databaseId,
|
|
141004
|
+
collectionId,
|
|
141005
|
+
key: attribute.key,
|
|
141006
|
+
required: attribute.required,
|
|
141007
|
+
xdefault: attribute.default
|
|
141008
|
+
});
|
|
141009
|
+
case "longtext":
|
|
141010
|
+
return databasesService.updateLongtextAttribute({
|
|
141011
|
+
databaseId,
|
|
141012
|
+
collectionId,
|
|
141013
|
+
key: attribute.key,
|
|
141014
|
+
required: attribute.required,
|
|
141015
|
+
xdefault: attribute.default
|
|
141016
|
+
});
|
|
140807
141017
|
case "integer":
|
|
140808
141018
|
return databasesService.updateIntegerAttribute({
|
|
140809
141019
|
databaseId,
|
|
@@ -142018,7 +142228,8 @@ var Push = class {
|
|
|
142018
142228
|
this.consoleClient
|
|
142019
142229
|
);
|
|
142020
142230
|
const variables = await consoleService.variables();
|
|
142021
|
-
|
|
142231
|
+
const domains = variables["_APP_DOMAIN_SITES"].split(",");
|
|
142232
|
+
domain2 = id_default2.unique() + "." + domains[0].trim();
|
|
142022
142233
|
} catch (err) {
|
|
142023
142234
|
this.error("Error fetching console variables.");
|
|
142024
142235
|
throw err;
|
|
@@ -143027,7 +143238,7 @@ var pushCollection = async () => {
|
|
|
143027
143238
|
const result = await pushInstance.pushCollections(collections);
|
|
143028
143239
|
const { successfullyPushed, errors } = result;
|
|
143029
143240
|
if (successfullyPushed === 0) {
|
|
143030
|
-
|
|
143241
|
+
warn("No collections were pushed.");
|
|
143031
143242
|
} else {
|
|
143032
143243
|
success2(`Successfully pushed ${successfullyPushed} collections.`);
|
|
143033
143244
|
}
|