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/dist/cli.cjs
CHANGED
|
@@ -21956,9 +21956,9 @@ var require_stream_duplex = __commonJS({
|
|
|
21956
21956
|
}
|
|
21957
21957
|
});
|
|
21958
21958
|
|
|
21959
|
-
// node_modules/safe-buffer/index.js
|
|
21959
|
+
// node_modules/string_decoder/node_modules/safe-buffer/index.js
|
|
21960
21960
|
var require_safe_buffer = __commonJS({
|
|
21961
|
-
"node_modules/safe-buffer/index.js"(exports2, module2) {
|
|
21961
|
+
"node_modules/string_decoder/node_modules/safe-buffer/index.js"(exports2, module2) {
|
|
21962
21962
|
var buffer = require("buffer");
|
|
21963
21963
|
var Buffer2 = buffer.Buffer;
|
|
21964
21964
|
function copyProps(src, dst) {
|
|
@@ -93392,7 +93392,7 @@ var package_default = {
|
|
|
93392
93392
|
type: "module",
|
|
93393
93393
|
homepage: "https://appwrite.io/support",
|
|
93394
93394
|
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",
|
|
93395
|
-
version: "13.
|
|
93395
|
+
version: "13.3.0",
|
|
93396
93396
|
license: "BSD-3-Clause",
|
|
93397
93397
|
main: "dist/index.js",
|
|
93398
93398
|
types: "dist/index.d.ts",
|
|
@@ -107247,7 +107247,7 @@ var validateRequiredDefault = (data) => {
|
|
|
107247
107247
|
return true;
|
|
107248
107248
|
};
|
|
107249
107249
|
var validateStringSize = (data) => {
|
|
107250
|
-
if (data.type !== "string") {
|
|
107250
|
+
if (data.type !== "string" && data.type !== "varchar") {
|
|
107251
107251
|
return true;
|
|
107252
107252
|
}
|
|
107253
107253
|
if (data.format && data.format !== "") {
|
|
@@ -107479,6 +107479,10 @@ var AttributeSchema = external_exports.object({
|
|
|
107479
107479
|
key: external_exports.string(),
|
|
107480
107480
|
type: external_exports.enum([
|
|
107481
107481
|
"string",
|
|
107482
|
+
"text",
|
|
107483
|
+
"varchar",
|
|
107484
|
+
"mediumtext",
|
|
107485
|
+
"longtext",
|
|
107482
107486
|
"integer",
|
|
107483
107487
|
"double",
|
|
107484
107488
|
"boolean",
|
|
@@ -107513,7 +107517,7 @@ var AttributeSchema = external_exports.object({
|
|
|
107513
107517
|
message: "When 'required' is true, 'default' must be null",
|
|
107514
107518
|
path: ["default"]
|
|
107515
107519
|
}).refine(validateStringSize, {
|
|
107516
|
-
message: "When 'type' is 'string', 'size' must be defined",
|
|
107520
|
+
message: "When 'type' is 'string' or 'varchar', 'size' must be defined",
|
|
107517
107521
|
path: ["size"]
|
|
107518
107522
|
});
|
|
107519
107523
|
var IndexSchema = external_exports.object({
|
|
@@ -107537,6 +107541,10 @@ var ColumnSchema = external_exports.object({
|
|
|
107537
107541
|
key: external_exports.string(),
|
|
107538
107542
|
type: external_exports.enum([
|
|
107539
107543
|
"string",
|
|
107544
|
+
"text",
|
|
107545
|
+
"varchar",
|
|
107546
|
+
"mediumtext",
|
|
107547
|
+
"longtext",
|
|
107540
107548
|
"integer",
|
|
107541
107549
|
"double",
|
|
107542
107550
|
"boolean",
|
|
@@ -107572,7 +107580,7 @@ var ColumnSchema = external_exports.object({
|
|
|
107572
107580
|
message: "When 'required' is true, 'default' must be null",
|
|
107573
107581
|
path: ["default"]
|
|
107574
107582
|
}).refine(validateStringSize, {
|
|
107575
|
-
message: "When 'type' is 'string', 'size' must be defined",
|
|
107583
|
+
message: "When 'type' is 'string' or 'varchar', 'size' must be defined",
|
|
107576
107584
|
path: ["size"]
|
|
107577
107585
|
});
|
|
107578
107586
|
var IndexTableSchema = external_exports.object({
|
|
@@ -107648,7 +107656,7 @@ var import_undici = __toESM(require_undici(), 1);
|
|
|
107648
107656
|
// lib/constants.ts
|
|
107649
107657
|
var SDK_TITLE = "Appwrite";
|
|
107650
107658
|
var SDK_TITLE_LOWER = "appwrite";
|
|
107651
|
-
var SDK_VERSION = "13.
|
|
107659
|
+
var SDK_VERSION = "13.3.0";
|
|
107652
107660
|
var SDK_NAME = "Command Line";
|
|
107653
107661
|
var SDK_PLATFORM = "console";
|
|
107654
107662
|
var SDK_LANGUAGE = "cli";
|
|
@@ -109721,14 +109729,14 @@ var Global = class _Global extends Config {
|
|
|
109721
109729
|
const sessionMap = /* @__PURE__ */ new Map();
|
|
109722
109730
|
sessions.forEach((sessionId) => {
|
|
109723
109731
|
const sessionData = this.data[sessionId];
|
|
109724
|
-
const email3 = sessionData[_Global.PREFERENCE_EMAIL];
|
|
109725
|
-
const endpoint = sessionData[_Global.PREFERENCE_ENDPOINT];
|
|
109732
|
+
const email3 = sessionData[_Global.PREFERENCE_EMAIL] ?? "";
|
|
109733
|
+
const endpoint = sessionData[_Global.PREFERENCE_ENDPOINT] ?? "";
|
|
109726
109734
|
const key = `${email3}|${endpoint}`;
|
|
109727
109735
|
if (sessionId === current || !sessionMap.has(key)) {
|
|
109728
109736
|
sessionMap.set(key, {
|
|
109729
109737
|
id: sessionId,
|
|
109730
|
-
endpoint
|
|
109731
|
-
email:
|
|
109738
|
+
endpoint,
|
|
109739
|
+
email: email3
|
|
109732
109740
|
});
|
|
109733
109741
|
}
|
|
109734
109742
|
});
|
|
@@ -135288,7 +135296,7 @@ var questionsLogin = [
|
|
|
135288
135296
|
when: (answers) => answers.method !== "select"
|
|
135289
135297
|
},
|
|
135290
135298
|
{
|
|
135291
|
-
type: "
|
|
135299
|
+
type: "list",
|
|
135292
135300
|
name: "accountId",
|
|
135293
135301
|
message: "Select an account to use",
|
|
135294
135302
|
choices() {
|
|
@@ -135303,6 +135311,7 @@ var questionsLogin = [
|
|
|
135303
135311
|
data.push({
|
|
135304
135312
|
current: current === session.id,
|
|
135305
135313
|
value: session.id,
|
|
135314
|
+
short: `${session.email} (${session.endpoint})`,
|
|
135306
135315
|
name: `${session.email.padEnd(longestEmail)} ${current === session.id ? import_chalk2.default.green.bold("current") : " ".repeat(6)} ${session.endpoint}`
|
|
135307
135316
|
});
|
|
135308
135317
|
}
|
|
@@ -135911,6 +135920,88 @@ var client_default = Client3;
|
|
|
135911
135920
|
|
|
135912
135921
|
// lib/commands/generic.ts
|
|
135913
135922
|
var DEFAULT_ENDPOINT2 = "https://cloud.appwrite.io/v1";
|
|
135923
|
+
var isMfaRequiredError = (err) => err?.type === "user_more_factors_required" || err?.response === "user_more_factors_required";
|
|
135924
|
+
var createLegacyConsoleClient = (endpoint) => {
|
|
135925
|
+
const legacyClient = new client_default();
|
|
135926
|
+
legacyClient.setEndpoint(endpoint);
|
|
135927
|
+
legacyClient.setProject("console");
|
|
135928
|
+
if (globalConfig2.getSelfSigned()) {
|
|
135929
|
+
legacyClient.setSelfSigned(true);
|
|
135930
|
+
}
|
|
135931
|
+
return legacyClient;
|
|
135932
|
+
};
|
|
135933
|
+
var completeMfaLogin = async ({
|
|
135934
|
+
client: client2,
|
|
135935
|
+
legacyClient,
|
|
135936
|
+
mfa,
|
|
135937
|
+
code
|
|
135938
|
+
}) => {
|
|
135939
|
+
let accountClient2 = new Account(client2);
|
|
135940
|
+
const savedCookie = globalConfig2.getCookie();
|
|
135941
|
+
if (savedCookie) {
|
|
135942
|
+
legacyClient.setCookie(savedCookie);
|
|
135943
|
+
client2.setCookie(savedCookie);
|
|
135944
|
+
}
|
|
135945
|
+
const { factor } = mfa ? { factor: mfa } : await import_inquirer.default.prompt(questionsListFactors);
|
|
135946
|
+
const challenge = await accountClient2.createMfaChallenge(factor);
|
|
135947
|
+
const { otp } = code ? { otp: code } : await import_inquirer.default.prompt(questionsMFAChallenge);
|
|
135948
|
+
await legacyClient.call(
|
|
135949
|
+
"PUT",
|
|
135950
|
+
"/account/mfa/challenges",
|
|
135951
|
+
{
|
|
135952
|
+
"content-type": "application/json"
|
|
135953
|
+
},
|
|
135954
|
+
{
|
|
135955
|
+
challengeId: challenge.$id,
|
|
135956
|
+
otp
|
|
135957
|
+
}
|
|
135958
|
+
);
|
|
135959
|
+
const updatedCookie = globalConfig2.getCookie();
|
|
135960
|
+
if (updatedCookie) {
|
|
135961
|
+
client2.setCookie(updatedCookie);
|
|
135962
|
+
}
|
|
135963
|
+
accountClient2 = new Account(client2);
|
|
135964
|
+
return accountClient2.get();
|
|
135965
|
+
};
|
|
135966
|
+
var deleteServerSession = async (sessionId) => {
|
|
135967
|
+
try {
|
|
135968
|
+
let client2 = await sdkForConsole();
|
|
135969
|
+
let accountClient2 = new Account(client2);
|
|
135970
|
+
await accountClient2.deleteSession(sessionId);
|
|
135971
|
+
return true;
|
|
135972
|
+
} catch (e) {
|
|
135973
|
+
return false;
|
|
135974
|
+
}
|
|
135975
|
+
};
|
|
135976
|
+
var deleteLocalSession = (accountId) => {
|
|
135977
|
+
globalConfig2.removeSession(accountId);
|
|
135978
|
+
};
|
|
135979
|
+
var getSessionAccountKey = (sessionId) => {
|
|
135980
|
+
const session = globalConfig2.get(sessionId);
|
|
135981
|
+
if (!session) return void 0;
|
|
135982
|
+
return `${session.email ?? ""}|${session.endpoint ?? ""}`;
|
|
135983
|
+
};
|
|
135984
|
+
var planSessionLogout = (selectedSessionIds) => {
|
|
135985
|
+
const sessionIdsByAccount = /* @__PURE__ */ new Map();
|
|
135986
|
+
for (const sessionId of globalConfig2.getSessionIds()) {
|
|
135987
|
+
const key = getSessionAccountKey(sessionId);
|
|
135988
|
+
if (!key) continue;
|
|
135989
|
+
const ids = sessionIdsByAccount.get(key) ?? [];
|
|
135990
|
+
ids.push(sessionId);
|
|
135991
|
+
sessionIdsByAccount.set(key, ids);
|
|
135992
|
+
}
|
|
135993
|
+
const selectedByAccount = /* @__PURE__ */ new Map();
|
|
135994
|
+
for (const selectedSessionId of selectedSessionIds) {
|
|
135995
|
+
const key = getSessionAccountKey(selectedSessionId);
|
|
135996
|
+
if (!key || selectedByAccount.has(key)) continue;
|
|
135997
|
+
selectedByAccount.set(key, selectedSessionId);
|
|
135998
|
+
}
|
|
135999
|
+
const serverTargets = Array.from(selectedByAccount.values());
|
|
136000
|
+
const localTargets = Array.from(selectedByAccount.keys()).flatMap(
|
|
136001
|
+
(accountKey) => sessionIdsByAccount.get(accountKey) ?? []
|
|
136002
|
+
);
|
|
136003
|
+
return { serverTargets, localTargets };
|
|
136004
|
+
};
|
|
135914
136005
|
var loginCommand = async ({
|
|
135915
136006
|
email: email3,
|
|
135916
136007
|
password,
|
|
@@ -135936,7 +136027,25 @@ var loginCommand = async ({
|
|
|
135936
136027
|
throw Error("Session ID not found");
|
|
135937
136028
|
}
|
|
135938
136029
|
globalConfig2.setCurrentSession(accountId);
|
|
135939
|
-
|
|
136030
|
+
const client3 = await sdkForConsole(false);
|
|
136031
|
+
const accountClient3 = new Account(client3);
|
|
136032
|
+
const legacyClient2 = createLegacyConsoleClient(
|
|
136033
|
+
globalConfig2.getEndpoint() || DEFAULT_ENDPOINT2
|
|
136034
|
+
);
|
|
136035
|
+
try {
|
|
136036
|
+
await accountClient3.get();
|
|
136037
|
+
} catch (err) {
|
|
136038
|
+
if (!isMfaRequiredError(err)) {
|
|
136039
|
+
throw err;
|
|
136040
|
+
}
|
|
136041
|
+
await completeMfaLogin({
|
|
136042
|
+
client: client3,
|
|
136043
|
+
legacyClient: legacyClient2,
|
|
136044
|
+
mfa,
|
|
136045
|
+
code
|
|
136046
|
+
});
|
|
136047
|
+
}
|
|
136048
|
+
success2(`Switched to ${globalConfig2.getEmail()}`);
|
|
135940
136049
|
return;
|
|
135941
136050
|
}
|
|
135942
136051
|
const id = id_default2.unique();
|
|
@@ -135944,12 +136053,7 @@ var loginCommand = async ({
|
|
|
135944
136053
|
globalConfig2.setCurrentSession(id);
|
|
135945
136054
|
globalConfig2.setEndpoint(configEndpoint);
|
|
135946
136055
|
globalConfig2.setEmail(answers.email);
|
|
135947
|
-
const legacyClient =
|
|
135948
|
-
legacyClient.setEndpoint(configEndpoint);
|
|
135949
|
-
legacyClient.setProject("console");
|
|
135950
|
-
if (globalConfig2.getSelfSigned()) {
|
|
135951
|
-
legacyClient.setSelfSigned(true);
|
|
135952
|
-
}
|
|
136056
|
+
const legacyClient = createLegacyConsoleClient(configEndpoint);
|
|
135953
136057
|
let client2 = await sdkForConsole(false);
|
|
135954
136058
|
let accountClient2 = new Account(client2);
|
|
135955
136059
|
let account2;
|
|
@@ -135973,27 +136077,13 @@ var loginCommand = async ({
|
|
|
135973
136077
|
accountClient2 = new Account(client2);
|
|
135974
136078
|
account2 = await accountClient2.get();
|
|
135975
136079
|
} catch (err) {
|
|
135976
|
-
if (err
|
|
135977
|
-
|
|
135978
|
-
|
|
135979
|
-
|
|
135980
|
-
|
|
135981
|
-
|
|
135982
|
-
|
|
135983
|
-
{
|
|
135984
|
-
"content-type": "application/json"
|
|
135985
|
-
},
|
|
135986
|
-
{
|
|
135987
|
-
challengeId: challenge.$id,
|
|
135988
|
-
otp
|
|
135989
|
-
}
|
|
135990
|
-
);
|
|
135991
|
-
const savedCookie = globalConfig2.getCookie();
|
|
135992
|
-
if (savedCookie) {
|
|
135993
|
-
client2.setCookie(savedCookie);
|
|
135994
|
-
}
|
|
135995
|
-
accountClient2 = new Account(client2);
|
|
135996
|
-
account2 = await accountClient2.get();
|
|
136080
|
+
if (isMfaRequiredError(err)) {
|
|
136081
|
+
account2 = await completeMfaLogin({
|
|
136082
|
+
client: client2,
|
|
136083
|
+
legacyClient,
|
|
136084
|
+
mfa,
|
|
136085
|
+
code
|
|
136086
|
+
});
|
|
135997
136087
|
} else {
|
|
135998
136088
|
globalConfig2.removeSession(id);
|
|
135999
136089
|
globalConfig2.setCurrentSession(oldCurrent);
|
|
@@ -136053,49 +136143,59 @@ var login = new Command("login").description(commandDescriptions["login"]).optio
|
|
|
136053
136143
|
).option(`--code [code]`, `Multi-factor code`).configureHelp({
|
|
136054
136144
|
helpWidth: process.stdout.columns || 80
|
|
136055
136145
|
}).action(actionRunner(loginCommand));
|
|
136056
|
-
var deleteSession = async (accountId) => {
|
|
136057
|
-
try {
|
|
136058
|
-
let client2 = await sdkForConsole();
|
|
136059
|
-
let accountClient2 = new Account(client2);
|
|
136060
|
-
await accountClient2.deleteSession("current");
|
|
136061
|
-
} catch (e) {
|
|
136062
|
-
error48("Unable to log out, removing locally saved session information");
|
|
136063
|
-
} finally {
|
|
136064
|
-
globalConfig2.removeSession(accountId);
|
|
136065
|
-
}
|
|
136066
|
-
};
|
|
136067
136146
|
var logout = new Command("logout").description(commandDescriptions["logout"]).configureHelp({
|
|
136068
136147
|
helpWidth: process.stdout.columns || 80
|
|
136069
136148
|
}).action(
|
|
136070
136149
|
actionRunner(async () => {
|
|
136071
136150
|
const sessions = globalConfig2.getSessions();
|
|
136072
136151
|
const current = globalConfig2.getCurrentSession();
|
|
136152
|
+
const originalCurrent = current;
|
|
136073
136153
|
if (current === "" || !sessions.length) {
|
|
136074
136154
|
log("No active sessions found.");
|
|
136075
136155
|
return;
|
|
136076
136156
|
}
|
|
136077
136157
|
if (sessions.length === 1) {
|
|
136078
|
-
await
|
|
136158
|
+
const serverDeleted = await deleteServerSession(current);
|
|
136159
|
+
const allSessionIds = globalConfig2.getSessionIds();
|
|
136160
|
+
for (const sessId of allSessionIds) {
|
|
136161
|
+
deleteLocalSession(sessId);
|
|
136162
|
+
}
|
|
136079
136163
|
globalConfig2.setCurrentSession("");
|
|
136080
|
-
|
|
136164
|
+
if (!serverDeleted) {
|
|
136165
|
+
hint("Could not reach server, removed local session data");
|
|
136166
|
+
}
|
|
136167
|
+
success2("Logged out successfully");
|
|
136081
136168
|
return;
|
|
136082
136169
|
}
|
|
136083
136170
|
const answers = await import_inquirer.default.prompt(questionsLogout);
|
|
136084
|
-
if (answers.accounts) {
|
|
136085
|
-
|
|
136086
|
-
|
|
136087
|
-
|
|
136171
|
+
if (answers.accounts?.length) {
|
|
136172
|
+
const { serverTargets, localTargets } = planSessionLogout(
|
|
136173
|
+
answers.accounts
|
|
136174
|
+
);
|
|
136175
|
+
for (const sessionId of serverTargets) {
|
|
136176
|
+
globalConfig2.setCurrentSession(sessionId);
|
|
136177
|
+
await deleteServerSession(sessionId);
|
|
136178
|
+
}
|
|
136179
|
+
for (const sessionId of localTargets) {
|
|
136180
|
+
deleteLocalSession(sessionId);
|
|
136088
136181
|
}
|
|
136089
136182
|
}
|
|
136090
136183
|
const remainingSessions = globalConfig2.getSessions();
|
|
136091
|
-
|
|
136092
|
-
|
|
136093
|
-
|
|
136094
|
-
|
|
136184
|
+
const hasCurrent = remainingSessions.some(
|
|
136185
|
+
(session) => session.id === originalCurrent
|
|
136186
|
+
);
|
|
136187
|
+
if (remainingSessions.length > 0 && hasCurrent) {
|
|
136188
|
+
globalConfig2.setCurrentSession(originalCurrent);
|
|
136189
|
+
} else if (remainingSessions.length > 0) {
|
|
136190
|
+
const nextSession = remainingSessions.find((session) => session.email) ?? remainingSessions[0];
|
|
136191
|
+
globalConfig2.setCurrentSession(nextSession.id);
|
|
136192
|
+
success2(
|
|
136193
|
+
nextSession.email ? `Switched to ${nextSession.email}` : `Switched to session at ${nextSession.endpoint}`
|
|
136194
|
+
);
|
|
136095
136195
|
} else if (remainingSessions.length === 0) {
|
|
136096
136196
|
globalConfig2.setCurrentSession("");
|
|
136097
136197
|
}
|
|
136098
|
-
success2("
|
|
136198
|
+
success2("Logged out successfully");
|
|
136099
136199
|
})
|
|
136100
136200
|
);
|
|
136101
136201
|
var client = new Command("client").description(commandDescriptions["client"]).configureHelp({
|
|
@@ -136188,10 +136288,14 @@ var client = new Command("client").description(commandDescriptions["client"]).co
|
|
|
136188
136288
|
}
|
|
136189
136289
|
if (reset !== void 0) {
|
|
136190
136290
|
const sessions = globalConfig2.getSessions();
|
|
136191
|
-
for (
|
|
136192
|
-
globalConfig2.setCurrentSession(
|
|
136193
|
-
await
|
|
136291
|
+
for (const sessionId of sessions.map((session) => session.id)) {
|
|
136292
|
+
globalConfig2.setCurrentSession(sessionId);
|
|
136293
|
+
await deleteServerSession(sessionId);
|
|
136194
136294
|
}
|
|
136295
|
+
for (const sessionId of globalConfig2.getSessionIds()) {
|
|
136296
|
+
deleteLocalSession(sessionId);
|
|
136297
|
+
}
|
|
136298
|
+
globalConfig2.setCurrentSession("");
|
|
136195
136299
|
}
|
|
136196
136300
|
if (!debug) {
|
|
136197
136301
|
success2("Setting client");
|
|
@@ -137828,6 +137932,10 @@ function detectLanguage() {
|
|
|
137828
137932
|
// lib/type-generation/attribute.ts
|
|
137829
137933
|
var AttributeType = {
|
|
137830
137934
|
STRING: "string",
|
|
137935
|
+
TEXT: "text",
|
|
137936
|
+
VARCHAR: "varchar",
|
|
137937
|
+
MEDIUMTEXT: "mediumtext",
|
|
137938
|
+
LONGTEXT: "longtext",
|
|
137831
137939
|
INTEGER: "integer",
|
|
137832
137940
|
FLOAT: "double",
|
|
137833
137941
|
BOOLEAN: "boolean",
|
|
@@ -137851,6 +137959,10 @@ var PHP = class extends LanguageMeta {
|
|
|
137851
137959
|
let type = "";
|
|
137852
137960
|
switch (attribute.type) {
|
|
137853
137961
|
case AttributeType.STRING:
|
|
137962
|
+
case AttributeType.TEXT:
|
|
137963
|
+
case AttributeType.VARCHAR:
|
|
137964
|
+
case AttributeType.MEDIUMTEXT:
|
|
137965
|
+
case AttributeType.LONGTEXT:
|
|
137854
137966
|
case AttributeType.DATETIME:
|
|
137855
137967
|
type = "string";
|
|
137856
137968
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -137958,6 +138070,10 @@ function getTypeScriptType(attribute, entities, entityName, forCreate = false) {
|
|
|
137958
138070
|
let type = "";
|
|
137959
138071
|
switch (attribute.type) {
|
|
137960
138072
|
case "string":
|
|
138073
|
+
case "text":
|
|
138074
|
+
case "varchar":
|
|
138075
|
+
case "mediumtext":
|
|
138076
|
+
case "longtext":
|
|
137961
138077
|
case "datetime":
|
|
137962
138078
|
type = "string";
|
|
137963
138079
|
if (attribute.format === "enum") {
|
|
@@ -138130,6 +138246,10 @@ var Kotlin = class extends LanguageMeta {
|
|
|
138130
138246
|
let type = "";
|
|
138131
138247
|
switch (attribute.type) {
|
|
138132
138248
|
case AttributeType.STRING:
|
|
138249
|
+
case AttributeType.TEXT:
|
|
138250
|
+
case AttributeType.VARCHAR:
|
|
138251
|
+
case AttributeType.MEDIUMTEXT:
|
|
138252
|
+
case AttributeType.LONGTEXT:
|
|
138133
138253
|
case AttributeType.DATETIME:
|
|
138134
138254
|
type = "String";
|
|
138135
138255
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138218,6 +138338,10 @@ var Swift = class extends LanguageMeta {
|
|
|
138218
138338
|
let type = "";
|
|
138219
138339
|
switch (attribute.type) {
|
|
138220
138340
|
case AttributeType.STRING:
|
|
138341
|
+
case AttributeType.TEXT:
|
|
138342
|
+
case AttributeType.VARCHAR:
|
|
138343
|
+
case AttributeType.MEDIUMTEXT:
|
|
138344
|
+
case AttributeType.LONGTEXT:
|
|
138221
138345
|
case AttributeType.DATETIME:
|
|
138222
138346
|
type = "String";
|
|
138223
138347
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138328,7 +138452,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138328
138452
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
138329
138453
|
<% if (attribute.type === 'relationship') { -%>
|
|
138330
138454
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138331
|
-
<% } else if (attribute.array &&
|
|
138455
|
+
<% } else if (attribute.array && !['string', 'text', 'varchar', 'mediumtext', 'longtext', 'integer', 'float', 'boolean'].includes(attribute.type)) { -%>
|
|
138332
138456
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %>?.map { $0.toMap() } as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138333
138457
|
<% } else { -%>
|
|
138334
138458
|
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138344,7 +138468,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138344
138468
|
<% const relationshipType = getType(attribute, collections, collection.name).replace('?', ''); -%>
|
|
138345
138469
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> <%- relationshipType %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138346
138470
|
<% } else if (attribute.array) { -%>
|
|
138347
|
-
<% if (
|
|
138471
|
+
<% if (['string', 'text', 'varchar', 'mediumtext', 'longtext'].includes(attribute.type)) { -%>
|
|
138348
138472
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [String]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138349
138473
|
<% } else if (attribute.type === 'integer') { -%>
|
|
138350
138474
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [Int]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138356,9 +138480,9 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
138356
138480
|
<%- 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) { %>,<% } %>
|
|
138357
138481
|
<% } -%>
|
|
138358
138482
|
<% } else { -%>
|
|
138359
|
-
<% if (
|
|
138483
|
+
<% if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'email', 'datetime'].includes(attribute.type) && attribute.format !== 'enum') { -%>
|
|
138360
138484
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> String<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138361
|
-
<% } else if (
|
|
138485
|
+
<% } else if (['string', 'text', 'varchar', 'mediumtext', 'longtext'].includes(attribute.type) && attribute.format === 'enum') { -%>
|
|
138362
138486
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
138363
138487
|
<% } else if (attribute.type === 'integer') { -%>
|
|
138364
138488
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Int<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
@@ -138386,6 +138510,10 @@ var Java = class extends LanguageMeta {
|
|
|
138386
138510
|
let type = "";
|
|
138387
138511
|
switch (attribute.type) {
|
|
138388
138512
|
case AttributeType.STRING:
|
|
138513
|
+
case AttributeType.TEXT:
|
|
138514
|
+
case AttributeType.VARCHAR:
|
|
138515
|
+
case AttributeType.MEDIUMTEXT:
|
|
138516
|
+
case AttributeType.LONGTEXT:
|
|
138389
138517
|
case AttributeType.DATETIME:
|
|
138390
138518
|
type = "String";
|
|
138391
138519
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138566,6 +138694,10 @@ var Dart = class extends LanguageMeta {
|
|
|
138566
138694
|
let type = "";
|
|
138567
138695
|
switch (attribute.type) {
|
|
138568
138696
|
case AttributeType.STRING:
|
|
138697
|
+
case AttributeType.TEXT:
|
|
138698
|
+
case AttributeType.VARCHAR:
|
|
138699
|
+
case AttributeType.MEDIUMTEXT:
|
|
138700
|
+
case AttributeType.LONGTEXT:
|
|
138569
138701
|
case AttributeType.DATETIME:
|
|
138570
138702
|
type = "String";
|
|
138571
138703
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138670,7 +138802,7 @@ class <%= toPascalCase(collection.name) %> {
|
|
|
138670
138802
|
factory <%= toPascalCase(collection.name) %>.fromMap(Map<String, dynamic> map) {
|
|
138671
138803
|
return <%= toPascalCase(collection.name) %>(<% if (__attrs.length > 0) { %>
|
|
138672
138804
|
<% for (const [index, attribute] of Object.entries(__attrs)) { -%>
|
|
138673
|
-
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (
|
|
138805
|
+
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (['${AttributeType.STRING}', '${AttributeType.TEXT}', '${AttributeType.VARCHAR}', '${AttributeType.MEDIUMTEXT}', '${AttributeType.LONGTEXT}', '${AttributeType.EMAIL}', '${AttributeType.DATETIME}'].includes(attribute.type)) { -%>
|
|
138674
138806
|
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
|
|
138675
138807
|
<% if (attribute.array) { -%>
|
|
138676
138808
|
(map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.value == e)).toList()<% } else { -%>
|
|
@@ -138741,6 +138873,10 @@ var JavaScript = class extends LanguageMeta {
|
|
|
138741
138873
|
let type = "";
|
|
138742
138874
|
switch (attribute.type) {
|
|
138743
138875
|
case AttributeType.STRING:
|
|
138876
|
+
case AttributeType.TEXT:
|
|
138877
|
+
case AttributeType.VARCHAR:
|
|
138878
|
+
case AttributeType.MEDIUMTEXT:
|
|
138879
|
+
case AttributeType.LONGTEXT:
|
|
138744
138880
|
case AttributeType.DATETIME:
|
|
138745
138881
|
type = "string";
|
|
138746
138882
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138839,6 +138975,10 @@ var CSharp = class extends LanguageMeta {
|
|
|
138839
138975
|
let type = "";
|
|
138840
138976
|
switch (attribute.type) {
|
|
138841
138977
|
case AttributeType.STRING:
|
|
138978
|
+
case AttributeType.TEXT:
|
|
138979
|
+
case AttributeType.VARCHAR:
|
|
138980
|
+
case AttributeType.MEDIUMTEXT:
|
|
138981
|
+
case AttributeType.LONGTEXT:
|
|
138842
138982
|
case AttributeType.DATETIME:
|
|
138843
138983
|
type = "string";
|
|
138844
138984
|
if (attribute.format === AttributeType.ENUM) {
|
|
@@ -138946,7 +139086,7 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
138946
139086
|
}
|
|
138947
139087
|
// ARRAY TYPES
|
|
138948
139088
|
} else if (attribute.array) {
|
|
138949
|
-
if (
|
|
139089
|
+
if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'datetime', 'email'].includes(attribute.type)) {
|
|
138950
139090
|
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(x => x?.ToString())<%- attribute.required ? '.Where(x => x != null)' : '' %>.ToList()!<%
|
|
138951
139091
|
} else if (attribute.type === 'integer') {
|
|
138952
139092
|
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(x => <%- !attribute.required ? 'x == null ? (long?)null : ' : '' %>Convert.ToInt64(x)).ToList()<%
|
|
@@ -138962,7 +139102,7 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
138962
139102
|
-%><%- !attribute.required ? 'map["' + attribute.key + '"] == null ? null : ' : '' %>Convert.ToDouble(map["<%- attribute.key %>"])<%
|
|
138963
139103
|
} else if (attribute.type === 'boolean') {
|
|
138964
139104
|
-%>(<%- getType(attribute, collections, collection.name) %>)map["<%- attribute.key %>"]<%
|
|
138965
|
-
} else if (
|
|
139105
|
+
} else if (['string', 'text', 'varchar', 'mediumtext', 'longtext', 'datetime', 'email'].includes(attribute.type)) {
|
|
138966
139106
|
-%>map["<%- attribute.key %>"]<%- !attribute.required ? '?' : '' %>.ToString()<%- attribute.required ? '!' : ''%><%
|
|
138967
139107
|
} else {
|
|
138968
139108
|
-%>default<%
|
|
@@ -140672,6 +140812,43 @@ var Attributes = class {
|
|
|
140672
140812
|
encrypt: attribute.encrypt
|
|
140673
140813
|
});
|
|
140674
140814
|
}
|
|
140815
|
+
case "varchar":
|
|
140816
|
+
return databasesService.createVarcharAttribute({
|
|
140817
|
+
databaseId,
|
|
140818
|
+
collectionId,
|
|
140819
|
+
key: attribute.key,
|
|
140820
|
+
size: attribute.size,
|
|
140821
|
+
required: attribute.required,
|
|
140822
|
+
xdefault: attribute.default,
|
|
140823
|
+
array: attribute.array
|
|
140824
|
+
});
|
|
140825
|
+
case "text":
|
|
140826
|
+
return databasesService.createTextAttribute({
|
|
140827
|
+
databaseId,
|
|
140828
|
+
collectionId,
|
|
140829
|
+
key: attribute.key,
|
|
140830
|
+
required: attribute.required,
|
|
140831
|
+
xdefault: attribute.default,
|
|
140832
|
+
array: attribute.array
|
|
140833
|
+
});
|
|
140834
|
+
case "mediumtext":
|
|
140835
|
+
return databasesService.createMediumtextAttribute({
|
|
140836
|
+
databaseId,
|
|
140837
|
+
collectionId,
|
|
140838
|
+
key: attribute.key,
|
|
140839
|
+
required: attribute.required,
|
|
140840
|
+
xdefault: attribute.default,
|
|
140841
|
+
array: attribute.array
|
|
140842
|
+
});
|
|
140843
|
+
case "longtext":
|
|
140844
|
+
return databasesService.createLongtextAttribute({
|
|
140845
|
+
databaseId,
|
|
140846
|
+
collectionId,
|
|
140847
|
+
key: attribute.key,
|
|
140848
|
+
required: attribute.required,
|
|
140849
|
+
xdefault: attribute.default,
|
|
140850
|
+
array: attribute.array
|
|
140851
|
+
});
|
|
140675
140852
|
case "integer":
|
|
140676
140853
|
return databasesService.createIntegerAttribute({
|
|
140677
140854
|
databaseId,
|
|
@@ -140798,6 +140975,39 @@ var Attributes = class {
|
|
|
140798
140975
|
xdefault: attribute.default
|
|
140799
140976
|
});
|
|
140800
140977
|
}
|
|
140978
|
+
case "varchar":
|
|
140979
|
+
return databasesService.updateVarcharAttribute({
|
|
140980
|
+
databaseId,
|
|
140981
|
+
collectionId,
|
|
140982
|
+
key: attribute.key,
|
|
140983
|
+
required: attribute.required,
|
|
140984
|
+
xdefault: attribute.default,
|
|
140985
|
+
size: attribute.size
|
|
140986
|
+
});
|
|
140987
|
+
case "text":
|
|
140988
|
+
return databasesService.updateTextAttribute({
|
|
140989
|
+
databaseId,
|
|
140990
|
+
collectionId,
|
|
140991
|
+
key: attribute.key,
|
|
140992
|
+
required: attribute.required,
|
|
140993
|
+
xdefault: attribute.default
|
|
140994
|
+
});
|
|
140995
|
+
case "mediumtext":
|
|
140996
|
+
return databasesService.updateMediumtextAttribute({
|
|
140997
|
+
databaseId,
|
|
140998
|
+
collectionId,
|
|
140999
|
+
key: attribute.key,
|
|
141000
|
+
required: attribute.required,
|
|
141001
|
+
xdefault: attribute.default
|
|
141002
|
+
});
|
|
141003
|
+
case "longtext":
|
|
141004
|
+
return databasesService.updateLongtextAttribute({
|
|
141005
|
+
databaseId,
|
|
141006
|
+
collectionId,
|
|
141007
|
+
key: attribute.key,
|
|
141008
|
+
required: attribute.required,
|
|
141009
|
+
xdefault: attribute.default
|
|
141010
|
+
});
|
|
140801
141011
|
case "integer":
|
|
140802
141012
|
return databasesService.updateIntegerAttribute({
|
|
140803
141013
|
databaseId,
|
|
@@ -142012,7 +142222,8 @@ var Push = class {
|
|
|
142012
142222
|
this.consoleClient
|
|
142013
142223
|
);
|
|
142014
142224
|
const variables = await consoleService.variables();
|
|
142015
|
-
|
|
142225
|
+
const domains = variables["_APP_DOMAIN_SITES"].split(",");
|
|
142226
|
+
domain2 = id_default2.unique() + "." + domains[0].trim();
|
|
142016
142227
|
} catch (err) {
|
|
142017
142228
|
this.error("Error fetching console variables.");
|
|
142018
142229
|
throw err;
|
|
@@ -143021,7 +143232,7 @@ var pushCollection = async () => {
|
|
|
143021
143232
|
const result = await pushInstance.pushCollections(collections);
|
|
143022
143233
|
const { successfullyPushed, errors } = result;
|
|
143023
143234
|
if (successfullyPushed === 0) {
|
|
143024
|
-
|
|
143235
|
+
warn("No collections were pushed.");
|
|
143025
143236
|
} else {
|
|
143026
143237
|
success2(`Successfully pushed ${successfullyPushed} collections.`);
|
|
143027
143238
|
}
|