appwrite-cli 18.1.0 → 18.2.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/README.md +2 -2
- package/dist/bundle-win-arm64.mjs +563 -283
- package/dist/cli.cjs +563 -283
- package/dist/index.cjs +27 -17
- package/dist/index.js +27 -17
- package/dist/lib/commands/init.d.ts.map +1 -1
- package/dist/lib/commands/run.d.ts.map +1 -1
- package/dist/lib/commands/update.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +2 -2
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/emulation/docker.d.ts +1 -0
- package/dist/lib/emulation/docker.d.ts.map +1 -1
- package/dist/lib/emulation/utils.d.ts +1 -1
- package/dist/lib/questions.d.ts.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -4079,14 +4079,14 @@ var require_templates = __commonJS({
|
|
|
4079
4079
|
}
|
|
4080
4080
|
return results;
|
|
4081
4081
|
}
|
|
4082
|
-
function buildStyle(
|
|
4082
|
+
function buildStyle(chalk17, styles) {
|
|
4083
4083
|
const enabled = {};
|
|
4084
4084
|
for (const layer of styles) {
|
|
4085
4085
|
for (const style of layer.styles) {
|
|
4086
4086
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
4087
4087
|
}
|
|
4088
4088
|
}
|
|
4089
|
-
let current =
|
|
4089
|
+
let current = chalk17;
|
|
4090
4090
|
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
4091
4091
|
if (!Array.isArray(styles2)) {
|
|
4092
4092
|
continue;
|
|
@@ -4098,7 +4098,7 @@ var require_templates = __commonJS({
|
|
|
4098
4098
|
}
|
|
4099
4099
|
return current;
|
|
4100
4100
|
}
|
|
4101
|
-
module2.exports = (
|
|
4101
|
+
module2.exports = (chalk17, temporary) => {
|
|
4102
4102
|
const styles = [];
|
|
4103
4103
|
const chunks = [];
|
|
4104
4104
|
let chunk = [];
|
|
@@ -4108,13 +4108,13 @@ var require_templates = __commonJS({
|
|
|
4108
4108
|
} else if (style) {
|
|
4109
4109
|
const string4 = chunk.join("");
|
|
4110
4110
|
chunk = [];
|
|
4111
|
-
chunks.push(styles.length === 0 ? string4 : buildStyle(
|
|
4111
|
+
chunks.push(styles.length === 0 ? string4 : buildStyle(chalk17, styles)(string4));
|
|
4112
4112
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
4113
4113
|
} else if (close) {
|
|
4114
4114
|
if (styles.length === 0) {
|
|
4115
4115
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
4116
4116
|
}
|
|
4117
|
-
chunks.push(buildStyle(
|
|
4117
|
+
chunks.push(buildStyle(chalk17, styles)(chunk.join("")));
|
|
4118
4118
|
chunk = [];
|
|
4119
4119
|
styles.pop();
|
|
4120
4120
|
} else {
|
|
@@ -4162,16 +4162,16 @@ var require_source = __commonJS({
|
|
|
4162
4162
|
}
|
|
4163
4163
|
};
|
|
4164
4164
|
var chalkFactory = (options) => {
|
|
4165
|
-
const
|
|
4166
|
-
applyOptions(
|
|
4167
|
-
|
|
4168
|
-
Object.setPrototypeOf(
|
|
4169
|
-
Object.setPrototypeOf(
|
|
4170
|
-
|
|
4165
|
+
const chalk18 = {};
|
|
4166
|
+
applyOptions(chalk18, options);
|
|
4167
|
+
chalk18.template = (...arguments_) => chalkTag(chalk18.template, ...arguments_);
|
|
4168
|
+
Object.setPrototypeOf(chalk18, Chalk.prototype);
|
|
4169
|
+
Object.setPrototypeOf(chalk18.template, chalk18);
|
|
4170
|
+
chalk18.template.constructor = () => {
|
|
4171
4171
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
4172
4172
|
};
|
|
4173
|
-
|
|
4174
|
-
return
|
|
4173
|
+
chalk18.template.Instance = ChalkClass;
|
|
4174
|
+
return chalk18.template;
|
|
4175
4175
|
};
|
|
4176
4176
|
function Chalk(options) {
|
|
4177
4177
|
return chalkFactory(options);
|
|
@@ -4282,7 +4282,7 @@ var require_source = __commonJS({
|
|
|
4282
4282
|
return openAll + string4 + closeAll;
|
|
4283
4283
|
};
|
|
4284
4284
|
var template;
|
|
4285
|
-
var chalkTag = (
|
|
4285
|
+
var chalkTag = (chalk18, ...strings) => {
|
|
4286
4286
|
const [firstString] = strings;
|
|
4287
4287
|
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
4288
4288
|
return strings.join(" ");
|
|
@@ -4298,14 +4298,14 @@ var require_source = __commonJS({
|
|
|
4298
4298
|
if (template === void 0) {
|
|
4299
4299
|
template = require_templates();
|
|
4300
4300
|
}
|
|
4301
|
-
return template(
|
|
4301
|
+
return template(chalk18, parts.join(""));
|
|
4302
4302
|
};
|
|
4303
4303
|
Object.defineProperties(Chalk.prototype, styles);
|
|
4304
|
-
var
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
module2.exports =
|
|
4304
|
+
var chalk17 = Chalk();
|
|
4305
|
+
chalk17.supportsColor = stdoutColor;
|
|
4306
|
+
chalk17.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
4307
|
+
chalk17.stderr.supportsColor = stderrColor;
|
|
4308
|
+
module2.exports = chalk17;
|
|
4309
4309
|
}
|
|
4310
4310
|
});
|
|
4311
4311
|
|
|
@@ -4473,12 +4473,12 @@ var require_figures = __commonJS({
|
|
|
4473
4473
|
var require_separator = __commonJS({
|
|
4474
4474
|
"node_modules/inquirer/lib/objects/separator.js"(exports2, module2) {
|
|
4475
4475
|
"use strict";
|
|
4476
|
-
var
|
|
4476
|
+
var chalk17 = require_source();
|
|
4477
4477
|
var figures = require_figures();
|
|
4478
4478
|
var Separator = class {
|
|
4479
4479
|
constructor(line) {
|
|
4480
4480
|
this.type = "separator";
|
|
4481
|
-
this.line =
|
|
4481
|
+
this.line = chalk17.dim(line || new Array(15).join(figures.line));
|
|
4482
4482
|
}
|
|
4483
4483
|
/**
|
|
4484
4484
|
* Stringify separator
|
|
@@ -20548,19 +20548,19 @@ var require_is_unicode_supported = __commonJS({
|
|
|
20548
20548
|
var require_log_symbols = __commonJS({
|
|
20549
20549
|
"node_modules/log-symbols/index.js"(exports2, module2) {
|
|
20550
20550
|
"use strict";
|
|
20551
|
-
var
|
|
20551
|
+
var chalk17 = require_source();
|
|
20552
20552
|
var isUnicodeSupported = require_is_unicode_supported();
|
|
20553
20553
|
var main = {
|
|
20554
|
-
info:
|
|
20555
|
-
success:
|
|
20556
|
-
warning:
|
|
20557
|
-
error:
|
|
20554
|
+
info: chalk17.blue("\u2139"),
|
|
20555
|
+
success: chalk17.green("\u2714"),
|
|
20556
|
+
warning: chalk17.yellow("\u26A0"),
|
|
20557
|
+
error: chalk17.red("\u2716")
|
|
20558
20558
|
};
|
|
20559
20559
|
var fallback = {
|
|
20560
|
-
info:
|
|
20561
|
-
success:
|
|
20562
|
-
warning:
|
|
20563
|
-
error:
|
|
20560
|
+
info: chalk17.blue("i"),
|
|
20561
|
+
success: chalk17.green("\u221A"),
|
|
20562
|
+
warning: chalk17.yellow("\u203C"),
|
|
20563
|
+
error: chalk17.red("\xD7")
|
|
20564
20564
|
};
|
|
20565
20565
|
module2.exports = isUnicodeSupported() ? main : fallback;
|
|
20566
20566
|
}
|
|
@@ -24028,7 +24028,7 @@ var require_ora = __commonJS({
|
|
|
24028
24028
|
"node_modules/ora/index.js"(exports2, module2) {
|
|
24029
24029
|
"use strict";
|
|
24030
24030
|
var readline2 = require("readline");
|
|
24031
|
-
var
|
|
24031
|
+
var chalk17 = require_source();
|
|
24032
24032
|
var cliCursor = require_cli_cursor();
|
|
24033
24033
|
var cliSpinners = require_cli_spinners();
|
|
24034
24034
|
var logSymbols = require_log_symbols();
|
|
@@ -24225,7 +24225,7 @@ var require_ora = __commonJS({
|
|
|
24225
24225
|
const { frames } = this.spinner;
|
|
24226
24226
|
let frame = frames[this.frameIndex];
|
|
24227
24227
|
if (this.color) {
|
|
24228
|
-
frame =
|
|
24228
|
+
frame = chalk17[this.color](frame);
|
|
24229
24229
|
}
|
|
24230
24230
|
this.frameIndex = ++this.frameIndex % frames.length;
|
|
24231
24231
|
const fullPrefixText = typeof this.prefixText === "string" && this.prefixText !== "" ? this.prefixText + " " : "";
|
|
@@ -24478,7 +24478,7 @@ var require_base = __commonJS({
|
|
|
24478
24478
|
defaults: require_defaults(),
|
|
24479
24479
|
clone: require_clone()
|
|
24480
24480
|
};
|
|
24481
|
-
var
|
|
24481
|
+
var chalk17 = require_source();
|
|
24482
24482
|
var runAsync = require_run_async();
|
|
24483
24483
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
24484
24484
|
var Choices = require_choices();
|
|
@@ -24496,7 +24496,7 @@ var require_base = __commonJS({
|
|
|
24496
24496
|
filteringText: "",
|
|
24497
24497
|
when: () => true,
|
|
24498
24498
|
suffix: "",
|
|
24499
|
-
prefix:
|
|
24499
|
+
prefix: chalk17.green("?")
|
|
24500
24500
|
});
|
|
24501
24501
|
if (!this.opt.name) {
|
|
24502
24502
|
this.throwParamError("name");
|
|
@@ -24597,12 +24597,12 @@ var require_base = __commonJS({
|
|
|
24597
24597
|
* @return {String} prompt question string
|
|
24598
24598
|
*/
|
|
24599
24599
|
getQuestion() {
|
|
24600
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
24600
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk17.bold(this.opt.message) + this.opt.suffix + chalk17.reset(" ");
|
|
24601
24601
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
24602
24602
|
if (this.opt.type === "password") {
|
|
24603
|
-
message +=
|
|
24603
|
+
message += chalk17.italic.dim("[hidden] ");
|
|
24604
24604
|
} else {
|
|
24605
|
-
message +=
|
|
24605
|
+
message += chalk17.dim("(" + this.opt.default + ") ");
|
|
24606
24606
|
}
|
|
24607
24607
|
}
|
|
24608
24608
|
return message;
|
|
@@ -24664,7 +24664,7 @@ var require_events = __commonJS({
|
|
|
24664
24664
|
var require_paginator = __commonJS({
|
|
24665
24665
|
"node_modules/inquirer/lib/utils/paginator.js"(exports2, module2) {
|
|
24666
24666
|
"use strict";
|
|
24667
|
-
var
|
|
24667
|
+
var chalk17 = require_source();
|
|
24668
24668
|
var Paginator = class {
|
|
24669
24669
|
/**
|
|
24670
24670
|
* @param {import("./screen-manager")} [screen]
|
|
@@ -24689,7 +24689,7 @@ var require_paginator = __commonJS({
|
|
|
24689
24689
|
}
|
|
24690
24690
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
24691
24691
|
this.lastIndex = active;
|
|
24692
|
-
return visibleLines.join("\n") + "\n" +
|
|
24692
|
+
return visibleLines.join("\n") + "\n" + chalk17.dim("(Move up and down to reveal more choices)");
|
|
24693
24693
|
}
|
|
24694
24694
|
getInfiniteLines(lines, active, pageSize) {
|
|
24695
24695
|
if (this.pointer === void 0) {
|
|
@@ -24745,7 +24745,7 @@ var require_incrementListIndex = __commonJS({
|
|
|
24745
24745
|
var require_list = __commonJS({
|
|
24746
24746
|
"node_modules/inquirer/lib/prompts/list.js"(exports2, module2) {
|
|
24747
24747
|
"use strict";
|
|
24748
|
-
var
|
|
24748
|
+
var chalk17 = require_source();
|
|
24749
24749
|
var figures = require_figures();
|
|
24750
24750
|
var cliCursor = require_cli_cursor();
|
|
24751
24751
|
var runAsync = require_run_async();
|
|
@@ -24803,10 +24803,10 @@ var require_list = __commonJS({
|
|
|
24803
24803
|
render() {
|
|
24804
24804
|
let message = this.getQuestion();
|
|
24805
24805
|
if (this.firstRender) {
|
|
24806
|
-
message +=
|
|
24806
|
+
message += chalk17.dim("(Use arrow keys)");
|
|
24807
24807
|
}
|
|
24808
24808
|
if (this.status === "answered") {
|
|
24809
|
-
message +=
|
|
24809
|
+
message += chalk17.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
24810
24810
|
} else {
|
|
24811
24811
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
24812
24812
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -24881,7 +24881,7 @@ var require_list = __commonJS({
|
|
|
24881
24881
|
const isSelected = i - separatorOffset === pointer;
|
|
24882
24882
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
24883
24883
|
if (isSelected) {
|
|
24884
|
-
line =
|
|
24884
|
+
line = chalk17.cyan(line);
|
|
24885
24885
|
}
|
|
24886
24886
|
output += line + " \n";
|
|
24887
24887
|
});
|
|
@@ -24895,7 +24895,7 @@ var require_list = __commonJS({
|
|
|
24895
24895
|
var require_input = __commonJS({
|
|
24896
24896
|
"node_modules/inquirer/lib/prompts/input.js"(exports2, module2) {
|
|
24897
24897
|
"use strict";
|
|
24898
|
-
var
|
|
24898
|
+
var chalk17 = require_source();
|
|
24899
24899
|
var { map: map2, takeUntil } = require_operators();
|
|
24900
24900
|
var Base = require_base();
|
|
24901
24901
|
var observe = require_events();
|
|
@@ -24934,10 +24934,10 @@ var require_input = __commonJS({
|
|
|
24934
24934
|
if (transformer) {
|
|
24935
24935
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
24936
24936
|
} else {
|
|
24937
|
-
message += isFinal ?
|
|
24937
|
+
message += isFinal ? chalk17.cyan(appendContent) : appendContent;
|
|
24938
24938
|
}
|
|
24939
24939
|
if (error49) {
|
|
24940
|
-
bottomContent =
|
|
24940
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
24941
24941
|
}
|
|
24942
24942
|
this.screen.render(message, bottomContent);
|
|
24943
24943
|
}
|
|
@@ -24999,7 +24999,7 @@ var require_number = __commonJS({
|
|
|
24999
24999
|
var require_confirm = __commonJS({
|
|
25000
25000
|
"node_modules/inquirer/lib/prompts/confirm.js"(exports2, module2) {
|
|
25001
25001
|
"use strict";
|
|
25002
|
-
var
|
|
25002
|
+
var chalk17 = require_source();
|
|
25003
25003
|
var { take, takeUntil } = require_operators();
|
|
25004
25004
|
var Base = require_base();
|
|
25005
25005
|
var observe = require_events();
|
|
@@ -25041,7 +25041,7 @@ var require_confirm = __commonJS({
|
|
|
25041
25041
|
render(answer) {
|
|
25042
25042
|
let message = this.getQuestion();
|
|
25043
25043
|
if (typeof answer === "boolean") {
|
|
25044
|
-
message +=
|
|
25044
|
+
message += chalk17.cyan(answer ? "Yes" : "No");
|
|
25045
25045
|
} else {
|
|
25046
25046
|
message += this.rl.line;
|
|
25047
25047
|
}
|
|
@@ -25073,7 +25073,7 @@ var require_confirm = __commonJS({
|
|
|
25073
25073
|
var require_rawlist = __commonJS({
|
|
25074
25074
|
"node_modules/inquirer/lib/prompts/rawlist.js"(exports2, module2) {
|
|
25075
25075
|
"use strict";
|
|
25076
|
-
var
|
|
25076
|
+
var chalk17 = require_source();
|
|
25077
25077
|
var { map: map2, takeUntil } = require_operators();
|
|
25078
25078
|
var Base = require_base();
|
|
25079
25079
|
var Separator = require_separator();
|
|
@@ -25136,7 +25136,7 @@ var require_rawlist = __commonJS({
|
|
|
25136
25136
|
let message = this.getQuestion();
|
|
25137
25137
|
let bottomContent = "";
|
|
25138
25138
|
if (this.status === "answered") {
|
|
25139
|
-
message +=
|
|
25139
|
+
message += chalk17.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
25140
25140
|
} else {
|
|
25141
25141
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
25142
25142
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -25144,7 +25144,7 @@ var require_rawlist = __commonJS({
|
|
|
25144
25144
|
}
|
|
25145
25145
|
message += this.rl.line;
|
|
25146
25146
|
if (error49) {
|
|
25147
|
-
bottomContent = "\n" +
|
|
25147
|
+
bottomContent = "\n" + chalk17.red(">> ") + error49;
|
|
25148
25148
|
}
|
|
25149
25149
|
this.screen.render(message, bottomContent);
|
|
25150
25150
|
}
|
|
@@ -25227,7 +25227,7 @@ var require_rawlist = __commonJS({
|
|
|
25227
25227
|
const index = i - separatorOffset;
|
|
25228
25228
|
let display = index + 1 + ") " + choice.name;
|
|
25229
25229
|
if (index === pointer) {
|
|
25230
|
-
display =
|
|
25230
|
+
display = chalk17.cyan(display);
|
|
25231
25231
|
}
|
|
25232
25232
|
output += display;
|
|
25233
25233
|
});
|
|
@@ -25241,7 +25241,7 @@ var require_rawlist = __commonJS({
|
|
|
25241
25241
|
var require_expand2 = __commonJS({
|
|
25242
25242
|
"node_modules/inquirer/lib/prompts/expand.js"(exports2, module2) {
|
|
25243
25243
|
"use strict";
|
|
25244
|
-
var
|
|
25244
|
+
var chalk17 = require_source();
|
|
25245
25245
|
var { map: map2, takeUntil } = require_operators();
|
|
25246
25246
|
var Base = require_base();
|
|
25247
25247
|
var Separator = require_separator();
|
|
@@ -25293,7 +25293,7 @@ var require_expand2 = __commonJS({
|
|
|
25293
25293
|
let message = this.getQuestion();
|
|
25294
25294
|
let bottomContent = "";
|
|
25295
25295
|
if (this.status === "answered") {
|
|
25296
|
-
message +=
|
|
25296
|
+
message += chalk17.cyan(this.answer);
|
|
25297
25297
|
} else if (this.status === "expanded") {
|
|
25298
25298
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
25299
25299
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -25301,10 +25301,10 @@ var require_expand2 = __commonJS({
|
|
|
25301
25301
|
}
|
|
25302
25302
|
message += this.rl.line;
|
|
25303
25303
|
if (error49) {
|
|
25304
|
-
bottomContent =
|
|
25304
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
25305
25305
|
}
|
|
25306
25306
|
if (hint2) {
|
|
25307
|
-
bottomContent =
|
|
25307
|
+
bottomContent = chalk17.cyan(">> ") + hint2;
|
|
25308
25308
|
}
|
|
25309
25309
|
this.screen.render(message, bottomContent);
|
|
25310
25310
|
}
|
|
@@ -25332,7 +25332,7 @@ var require_expand2 = __commonJS({
|
|
|
25332
25332
|
}
|
|
25333
25333
|
let choiceStr = choice.key + ") " + choice.name;
|
|
25334
25334
|
if (this.selectedKey === choice.key) {
|
|
25335
|
-
choiceStr =
|
|
25335
|
+
choiceStr = chalk17.cyan(choiceStr);
|
|
25336
25336
|
}
|
|
25337
25337
|
output += choiceStr;
|
|
25338
25338
|
});
|
|
@@ -25434,7 +25434,7 @@ var require_expand2 = __commonJS({
|
|
|
25434
25434
|
}
|
|
25435
25435
|
let choiceStr = choice.key + ") " + choice.name;
|
|
25436
25436
|
if (pointer === choice.key) {
|
|
25437
|
-
choiceStr =
|
|
25437
|
+
choiceStr = chalk17.cyan(choiceStr);
|
|
25438
25438
|
}
|
|
25439
25439
|
output += choiceStr;
|
|
25440
25440
|
});
|
|
@@ -25448,7 +25448,7 @@ var require_expand2 = __commonJS({
|
|
|
25448
25448
|
var require_checkbox = __commonJS({
|
|
25449
25449
|
"node_modules/inquirer/lib/prompts/checkbox.js"(exports2, module2) {
|
|
25450
25450
|
"use strict";
|
|
25451
|
-
var
|
|
25451
|
+
var chalk17 = require_source();
|
|
25452
25452
|
var cliCursor = require_cli_cursor();
|
|
25453
25453
|
var figures = require_figures();
|
|
25454
25454
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -25506,10 +25506,10 @@ var require_checkbox = __commonJS({
|
|
|
25506
25506
|
let message = this.getQuestion();
|
|
25507
25507
|
let bottomContent = "";
|
|
25508
25508
|
if (!this.dontShowHints) {
|
|
25509
|
-
message += "(Press " +
|
|
25509
|
+
message += "(Press " + chalk17.cyan.bold("<space>") + " to select, " + chalk17.cyan.bold("<a>") + " to toggle all, " + chalk17.cyan.bold("<i>") + " to invert selection, and " + chalk17.cyan.bold("<enter>") + " to proceed)";
|
|
25510
25510
|
}
|
|
25511
25511
|
if (this.status === "answered") {
|
|
25512
|
-
message +=
|
|
25512
|
+
message += chalk17.cyan(this.selection.join(", "));
|
|
25513
25513
|
} else {
|
|
25514
25514
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
25515
25515
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -25532,7 +25532,7 @@ var require_checkbox = __commonJS({
|
|
|
25532
25532
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
25533
25533
|
}
|
|
25534
25534
|
if (error49) {
|
|
25535
|
-
bottomContent =
|
|
25535
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
25536
25536
|
}
|
|
25537
25537
|
this.screen.render(message, bottomContent);
|
|
25538
25538
|
}
|
|
@@ -25618,7 +25618,7 @@ var require_checkbox = __commonJS({
|
|
|
25618
25618
|
} else {
|
|
25619
25619
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
25620
25620
|
if (i - separatorOffset === pointer) {
|
|
25621
|
-
output +=
|
|
25621
|
+
output += chalk17.cyan(figures.pointer + line);
|
|
25622
25622
|
} else {
|
|
25623
25623
|
output += " " + line;
|
|
25624
25624
|
}
|
|
@@ -25628,7 +25628,7 @@ var require_checkbox = __commonJS({
|
|
|
25628
25628
|
return output.replace(/\n$/, "");
|
|
25629
25629
|
}
|
|
25630
25630
|
function getCheckbox(checked) {
|
|
25631
|
-
return checked ?
|
|
25631
|
+
return checked ? chalk17.green(figures.radioOn) : figures.radioOff;
|
|
25632
25632
|
}
|
|
25633
25633
|
module2.exports = CheckboxPrompt;
|
|
25634
25634
|
}
|
|
@@ -25638,7 +25638,7 @@ var require_checkbox = __commonJS({
|
|
|
25638
25638
|
var require_password = __commonJS({
|
|
25639
25639
|
"node_modules/inquirer/lib/prompts/password.js"(exports2, module2) {
|
|
25640
25640
|
"use strict";
|
|
25641
|
-
var
|
|
25641
|
+
var chalk17 = require_source();
|
|
25642
25642
|
var { map: map2, takeUntil } = require_operators();
|
|
25643
25643
|
var Base = require_base();
|
|
25644
25644
|
var observe = require_events();
|
|
@@ -25680,15 +25680,15 @@ var require_password = __commonJS({
|
|
|
25680
25680
|
message += this.getMaskedValue(this.rl.line || "");
|
|
25681
25681
|
}
|
|
25682
25682
|
if (error49) {
|
|
25683
|
-
bottomContent = "\n" +
|
|
25683
|
+
bottomContent = "\n" + chalk17.red(">> ") + error49;
|
|
25684
25684
|
}
|
|
25685
25685
|
this.screen.render(message, bottomContent);
|
|
25686
25686
|
}
|
|
25687
25687
|
getMaskedValue(value) {
|
|
25688
25688
|
if (this.status === "answered") {
|
|
25689
|
-
return this.opt.mask ?
|
|
25689
|
+
return this.opt.mask ? chalk17.cyan(mask(value, this.opt.mask)) : chalk17.italic.dim("[hidden]");
|
|
25690
25690
|
}
|
|
25691
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
25691
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk17.italic.dim("[input is hidden] ");
|
|
25692
25692
|
}
|
|
25693
25693
|
/**
|
|
25694
25694
|
* Mask value during async filter/validation.
|
|
@@ -35410,7 +35410,7 @@ var require_commonjs = __commonJS({
|
|
|
35410
35410
|
var require_editor = __commonJS({
|
|
35411
35411
|
"node_modules/inquirer/lib/prompts/editor.js"(exports2, module2) {
|
|
35412
35412
|
"use strict";
|
|
35413
|
-
var
|
|
35413
|
+
var chalk17 = require_source();
|
|
35414
35414
|
var { editAsync } = require_commonjs();
|
|
35415
35415
|
var Base = require_base();
|
|
35416
35416
|
var observe = require_events();
|
|
@@ -35442,12 +35442,12 @@ var require_editor = __commonJS({
|
|
|
35442
35442
|
let bottomContent = "";
|
|
35443
35443
|
let message = this.getQuestion();
|
|
35444
35444
|
if (this.status === "answered") {
|
|
35445
|
-
message +=
|
|
35445
|
+
message += chalk17.dim("Received");
|
|
35446
35446
|
} else {
|
|
35447
|
-
message +=
|
|
35447
|
+
message += chalk17.dim("Press <enter> to launch your preferred editor.");
|
|
35448
35448
|
}
|
|
35449
35449
|
if (error49) {
|
|
35450
|
-
bottomContent =
|
|
35450
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
35451
35451
|
}
|
|
35452
35452
|
this.screen.render(message, bottomContent);
|
|
35453
35453
|
}
|
|
@@ -45872,14 +45872,14 @@ var require_templates2 = __commonJS({
|
|
|
45872
45872
|
}
|
|
45873
45873
|
return results;
|
|
45874
45874
|
}
|
|
45875
|
-
function buildStyle(
|
|
45875
|
+
function buildStyle(chalk17, styles) {
|
|
45876
45876
|
const enabled = {};
|
|
45877
45877
|
for (const layer of styles) {
|
|
45878
45878
|
for (const style of layer.styles) {
|
|
45879
45879
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
45880
45880
|
}
|
|
45881
45881
|
}
|
|
45882
|
-
let current =
|
|
45882
|
+
let current = chalk17;
|
|
45883
45883
|
for (const styleName of Object.keys(enabled)) {
|
|
45884
45884
|
if (Array.isArray(enabled[styleName])) {
|
|
45885
45885
|
if (!(styleName in current)) {
|
|
@@ -45894,7 +45894,7 @@ var require_templates2 = __commonJS({
|
|
|
45894
45894
|
}
|
|
45895
45895
|
return current;
|
|
45896
45896
|
}
|
|
45897
|
-
module2.exports = (
|
|
45897
|
+
module2.exports = (chalk17, tmp) => {
|
|
45898
45898
|
const styles = [];
|
|
45899
45899
|
const chunks = [];
|
|
45900
45900
|
let chunk = [];
|
|
@@ -45904,13 +45904,13 @@ var require_templates2 = __commonJS({
|
|
|
45904
45904
|
} else if (style) {
|
|
45905
45905
|
const str = chunk.join("");
|
|
45906
45906
|
chunk = [];
|
|
45907
|
-
chunks.push(styles.length === 0 ? str : buildStyle(
|
|
45907
|
+
chunks.push(styles.length === 0 ? str : buildStyle(chalk17, styles)(str));
|
|
45908
45908
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
45909
45909
|
} else if (close) {
|
|
45910
45910
|
if (styles.length === 0) {
|
|
45911
45911
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
45912
45912
|
}
|
|
45913
|
-
chunks.push(buildStyle(
|
|
45913
|
+
chunks.push(buildStyle(chalk17, styles)(chunk.join("")));
|
|
45914
45914
|
chunk = [];
|
|
45915
45915
|
styles.pop();
|
|
45916
45916
|
} else {
|
|
@@ -45947,16 +45947,16 @@ var require_chalk = __commonJS({
|
|
|
45947
45947
|
}
|
|
45948
45948
|
function Chalk(options) {
|
|
45949
45949
|
if (!this || !(this instanceof Chalk) || this.template) {
|
|
45950
|
-
const
|
|
45951
|
-
applyOptions(
|
|
45952
|
-
|
|
45950
|
+
const chalk17 = {};
|
|
45951
|
+
applyOptions(chalk17, options);
|
|
45952
|
+
chalk17.template = function() {
|
|
45953
45953
|
const args = [].slice.call(arguments);
|
|
45954
|
-
return chalkTag.apply(null, [
|
|
45954
|
+
return chalkTag.apply(null, [chalk17.template].concat(args));
|
|
45955
45955
|
};
|
|
45956
|
-
Object.setPrototypeOf(
|
|
45957
|
-
Object.setPrototypeOf(
|
|
45958
|
-
|
|
45959
|
-
return
|
|
45956
|
+
Object.setPrototypeOf(chalk17, Chalk.prototype);
|
|
45957
|
+
Object.setPrototypeOf(chalk17.template, chalk17);
|
|
45958
|
+
chalk17.template.constructor = Chalk;
|
|
45959
|
+
return chalk17.template;
|
|
45960
45960
|
}
|
|
45961
45961
|
applyOptions(this, options);
|
|
45962
45962
|
}
|
|
@@ -46075,7 +46075,7 @@ var require_chalk = __commonJS({
|
|
|
46075
46075
|
ansiStyles.dim.open = originalDim;
|
|
46076
46076
|
return str;
|
|
46077
46077
|
}
|
|
46078
|
-
function chalkTag(
|
|
46078
|
+
function chalkTag(chalk17, strings) {
|
|
46079
46079
|
if (!Array.isArray(strings)) {
|
|
46080
46080
|
return [].slice.call(arguments, 1).join(" ");
|
|
46081
46081
|
}
|
|
@@ -46085,7 +46085,7 @@ var require_chalk = __commonJS({
|
|
|
46085
46085
|
parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
|
46086
46086
|
parts.push(String(strings.raw[i]));
|
|
46087
46087
|
}
|
|
46088
|
-
return template(
|
|
46088
|
+
return template(chalk17, parts.join(""));
|
|
46089
46089
|
}
|
|
46090
46090
|
Object.defineProperties(Chalk.prototype, styles);
|
|
46091
46091
|
module2.exports = Chalk();
|
|
@@ -46254,11 +46254,11 @@ var require_figures2 = __commonJS({
|
|
|
46254
46254
|
var require_separator2 = __commonJS({
|
|
46255
46255
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/objects/separator.js"(exports2, module2) {
|
|
46256
46256
|
"use strict";
|
|
46257
|
-
var
|
|
46257
|
+
var chalk17 = require_chalk();
|
|
46258
46258
|
var figures = require_figures2();
|
|
46259
46259
|
var Separator = module2.exports = function(line) {
|
|
46260
46260
|
this.type = "separator";
|
|
46261
|
-
this.line =
|
|
46261
|
+
this.line = chalk17.dim(line || new Array(15).join(figures.line));
|
|
46262
46262
|
};
|
|
46263
46263
|
Separator.exclude = function(obj) {
|
|
46264
46264
|
return obj.type !== "separator";
|
|
@@ -46732,7 +46732,7 @@ var require_screen_manager2 = __commonJS({
|
|
|
46732
46732
|
var require_base2 = __commonJS({
|
|
46733
46733
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/prompts/base.js"(exports2, module2) {
|
|
46734
46734
|
var _2 = require_lodash();
|
|
46735
|
-
var
|
|
46735
|
+
var chalk17 = require_chalk();
|
|
46736
46736
|
var runAsync = require_run_async();
|
|
46737
46737
|
var Choices = require_choices2();
|
|
46738
46738
|
var ScreenManager = require_screen_manager2();
|
|
@@ -46752,7 +46752,7 @@ var require_base2 = __commonJS({
|
|
|
46752
46752
|
return true;
|
|
46753
46753
|
},
|
|
46754
46754
|
suffix: "",
|
|
46755
|
-
prefix:
|
|
46755
|
+
prefix: chalk17.green("?")
|
|
46756
46756
|
});
|
|
46757
46757
|
if (!this.opt.message) {
|
|
46758
46758
|
this.throwParamError("message");
|
|
@@ -46809,9 +46809,9 @@ var require_base2 = __commonJS({
|
|
|
46809
46809
|
};
|
|
46810
46810
|
};
|
|
46811
46811
|
Prompt.prototype.getQuestion = function() {
|
|
46812
|
-
var message = this.opt.prefix + " " +
|
|
46812
|
+
var message = this.opt.prefix + " " + chalk17.bold(this.opt.message) + this.opt.suffix + chalk17.reset(" ");
|
|
46813
46813
|
if (this.opt.default != null && this.status !== "answered") {
|
|
46814
|
-
message +=
|
|
46814
|
+
message += chalk17.dim("(" + this.opt.default + ") ");
|
|
46815
46815
|
}
|
|
46816
46816
|
return message;
|
|
46817
46817
|
};
|
|
@@ -53502,7 +53502,7 @@ var require_paginator2 = __commonJS({
|
|
|
53502
53502
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/utils/paginator.js"(exports2, module2) {
|
|
53503
53503
|
"use strict";
|
|
53504
53504
|
var _2 = require_lodash();
|
|
53505
|
-
var
|
|
53505
|
+
var chalk17 = require_chalk();
|
|
53506
53506
|
var Paginator = module2.exports = function() {
|
|
53507
53507
|
this.pointer = 0;
|
|
53508
53508
|
this.lastIndex = 0;
|
|
@@ -53521,7 +53521,7 @@ var require_paginator2 = __commonJS({
|
|
|
53521
53521
|
var infinite = _2.flatten([lines, lines, lines]);
|
|
53522
53522
|
var topIndex = Math.max(0, active + lines.length - this.pointer);
|
|
53523
53523
|
var section = infinite.splice(topIndex, pageSize).join("\n");
|
|
53524
|
-
return section + "\n" +
|
|
53524
|
+
return section + "\n" + chalk17.dim("(Move up and down to reveal more choices)");
|
|
53525
53525
|
};
|
|
53526
53526
|
}
|
|
53527
53527
|
});
|
|
@@ -87716,7 +87716,7 @@ var {
|
|
|
87716
87716
|
} = import_index.default;
|
|
87717
87717
|
|
|
87718
87718
|
// cli.ts
|
|
87719
|
-
var
|
|
87719
|
+
var import_chalk16 = __toESM(require_source(), 1);
|
|
87720
87720
|
var import_inquirer9 = __toESM(require_inquirer(), 1);
|
|
87721
87721
|
|
|
87722
87722
|
// package.json
|
|
@@ -87725,7 +87725,7 @@ var package_default = {
|
|
|
87725
87725
|
type: "module",
|
|
87726
87726
|
homepage: "https://appwrite.io/support",
|
|
87727
87727
|
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",
|
|
87728
|
-
version: "18.
|
|
87728
|
+
version: "18.2.0",
|
|
87729
87729
|
license: "BSD-3-Clause",
|
|
87730
87730
|
main: "dist/index.cjs",
|
|
87731
87731
|
module: "dist/index.js",
|
|
@@ -102035,7 +102035,7 @@ var import_child_process = __toESM(require("child_process"), 1);
|
|
|
102035
102035
|
// lib/constants.ts
|
|
102036
102036
|
var SDK_TITLE = "Appwrite";
|
|
102037
102037
|
var SDK_TITLE_LOWER = "appwrite";
|
|
102038
|
-
var SDK_VERSION = "18.
|
|
102038
|
+
var SDK_VERSION = "18.2.0";
|
|
102039
102039
|
var SDK_NAME = "Command Line";
|
|
102040
102040
|
var SDK_PLATFORM = "console";
|
|
102041
102041
|
var SDK_LANGUAGE = "cli";
|
|
@@ -102057,6 +102057,7 @@ var CONFIG_RESOURCE_KEYS = [
|
|
|
102057
102057
|
"tablesDB",
|
|
102058
102058
|
"tables",
|
|
102059
102059
|
"teams",
|
|
102060
|
+
"webhooks",
|
|
102060
102061
|
"collections"
|
|
102061
102062
|
];
|
|
102062
102063
|
var TOP_LEVEL_RESOURCE_ARRAY_KEYS = new Set(
|
|
@@ -102347,7 +102348,10 @@ var getCacheForVersionSource = (cache, source) => {
|
|
|
102347
102348
|
var syncVersionCheckCache = (currentVersion, latestVersion) => {
|
|
102348
102349
|
const now = getCurrentTimestamp();
|
|
102349
102350
|
const source = getLatestVersionSource();
|
|
102350
|
-
const existingCache = getCacheForVersionSource(
|
|
102351
|
+
const existingCache = getCacheForVersionSource(
|
|
102352
|
+
readUpdateCheckCache(),
|
|
102353
|
+
source
|
|
102354
|
+
);
|
|
102351
102355
|
const updateAvailable = compareVersions(currentVersion, latestVersion) > 0;
|
|
102352
102356
|
tryWriteUpdateCheckCache({
|
|
102353
102357
|
checkedAt: now,
|
|
@@ -130595,6 +130599,18 @@ var validateNonNegativeInteger = (value) => {
|
|
|
130595
130599
|
}
|
|
130596
130600
|
return true;
|
|
130597
130601
|
};
|
|
130602
|
+
var buildSelectionLabel = (name, id) => `${name} (${id})`;
|
|
130603
|
+
var extractSelectionId = (value) => {
|
|
130604
|
+
const match = value.match(/\(([^()]+)\)$/);
|
|
130605
|
+
return match ? match[1] : value;
|
|
130606
|
+
};
|
|
130607
|
+
var getInitProjectOverrideMessage = () => {
|
|
130608
|
+
const projectName = localConfig.getProject().projectName;
|
|
130609
|
+
if (projectName) {
|
|
130610
|
+
return `A project is already linked to this directory (${projectName}). Override?`;
|
|
130611
|
+
}
|
|
130612
|
+
return "A project is already linked to this directory. Override?";
|
|
130613
|
+
};
|
|
130598
130614
|
var getIgnores = (runtime) => {
|
|
130599
130615
|
const language = runtime.split("-").slice(0, -1).join("-");
|
|
130600
130616
|
switch (language) {
|
|
@@ -130695,7 +130711,7 @@ var questionsInitProject = [
|
|
|
130695
130711
|
{
|
|
130696
130712
|
type: "confirm",
|
|
130697
130713
|
name: "override",
|
|
130698
|
-
message:
|
|
130714
|
+
message: getInitProjectOverrideMessage(),
|
|
130699
130715
|
when() {
|
|
130700
130716
|
return Object.keys(localConfig.getProject()).length !== 0;
|
|
130701
130717
|
}
|
|
@@ -130704,14 +130720,14 @@ var questionsInitProject = [
|
|
|
130704
130720
|
type: "list",
|
|
130705
130721
|
name: "start",
|
|
130706
130722
|
when: whenOverride,
|
|
130707
|
-
message: "
|
|
130723
|
+
message: "Select a setup method:",
|
|
130708
130724
|
choices: [
|
|
130709
130725
|
{
|
|
130710
|
-
name: "Create new project",
|
|
130726
|
+
name: "Create a new project",
|
|
130711
130727
|
value: "new"
|
|
130712
130728
|
},
|
|
130713
130729
|
{
|
|
130714
|
-
name: "Link directory to an existing project",
|
|
130730
|
+
name: "Link this directory to an existing project",
|
|
130715
130731
|
value: "existing"
|
|
130716
130732
|
}
|
|
130717
130733
|
]
|
|
@@ -130719,7 +130735,7 @@ var questionsInitProject = [
|
|
|
130719
130735
|
{
|
|
130720
130736
|
type: "search-list",
|
|
130721
130737
|
name: "organization",
|
|
130722
|
-
message: "Choose your organization",
|
|
130738
|
+
message: "Choose your organization:",
|
|
130723
130739
|
choices: async () => {
|
|
130724
130740
|
const client2 = await sdkForConsole(true);
|
|
130725
130741
|
const { teams: teams2 } = isCloud() ? await paginate(
|
|
@@ -130738,9 +130754,10 @@ var questionsInitProject = [
|
|
|
130738
130754
|
"teams"
|
|
130739
130755
|
);
|
|
130740
130756
|
const choices = teams2.map((team, _idx) => {
|
|
130757
|
+
const label = buildSelectionLabel(team.name, team["$id"]);
|
|
130741
130758
|
return {
|
|
130742
|
-
name:
|
|
130743
|
-
value:
|
|
130759
|
+
name: label,
|
|
130760
|
+
value: label
|
|
130744
130761
|
};
|
|
130745
130762
|
});
|
|
130746
130763
|
if (choices.length == 0) {
|
|
@@ -130769,13 +130786,13 @@ var questionsInitProject = [
|
|
|
130769
130786
|
{
|
|
130770
130787
|
type: "search-list",
|
|
130771
130788
|
name: "project",
|
|
130772
|
-
message:
|
|
130789
|
+
message: "Choose your project:",
|
|
130773
130790
|
choices: async (answers) => {
|
|
130774
130791
|
const queries = [
|
|
130775
130792
|
JSON.stringify({
|
|
130776
130793
|
method: "equal",
|
|
130777
130794
|
attribute: "teamId",
|
|
130778
|
-
values: [answers.organization]
|
|
130795
|
+
values: [extractSelectionId(answers.organization)]
|
|
130779
130796
|
}),
|
|
130780
130797
|
JSON.stringify({ method: "orderDesc", attribute: "$id" })
|
|
130781
130798
|
];
|
|
@@ -130787,14 +130804,10 @@ var questionsInitProject = [
|
|
|
130787
130804
|
queries
|
|
130788
130805
|
);
|
|
130789
130806
|
const choices = projects2.map((project2) => {
|
|
130790
|
-
const label =
|
|
130807
|
+
const label = buildSelectionLabel(project2.name, project2["$id"]);
|
|
130791
130808
|
return {
|
|
130792
130809
|
name: label,
|
|
130793
|
-
|
|
130794
|
-
value: {
|
|
130795
|
-
$id: project2["$id"],
|
|
130796
|
-
region: project2.region || ""
|
|
130797
|
-
}
|
|
130810
|
+
value: label
|
|
130798
130811
|
};
|
|
130799
130812
|
});
|
|
130800
130813
|
if (choices.length === 0) {
|
|
@@ -130837,7 +130850,7 @@ var questionsInitProjectAutopull = [
|
|
|
130837
130850
|
{
|
|
130838
130851
|
type: "confirm",
|
|
130839
130852
|
name: "autopull",
|
|
130840
|
-
message:
|
|
130853
|
+
message: "Pull all resources from this project?"
|
|
130841
130854
|
}
|
|
130842
130855
|
];
|
|
130843
130856
|
var questionsPullResources = [
|
|
@@ -132364,6 +132377,7 @@ var import_fs9 = __toESM(require("fs"), 1);
|
|
|
132364
132377
|
var import_path8 = __toESM(require("path"), 1);
|
|
132365
132378
|
var import_child_process2 = __toESM(require("child_process"), 1);
|
|
132366
132379
|
var import_inquirer4 = __toESM(require_inquirer(), 1);
|
|
132380
|
+
var import_chalk9 = __toESM(require_source(), 1);
|
|
132367
132381
|
|
|
132368
132382
|
// lib/commands/pull.ts
|
|
132369
132383
|
var import_fs8 = __toESM(require("fs"), 1);
|
|
@@ -136787,6 +136801,123 @@ pull.command("webhook").alias("webhooks").description("Pull your Appwrite webhoo
|
|
|
136787
136801
|
pull.command("topic").alias("topics").description("Pull your Appwrite messaging topics").action(actionRunner(pullMessagingTopic));
|
|
136788
136802
|
|
|
136789
136803
|
// lib/commands/init.ts
|
|
136804
|
+
var extractSelectionId2 = (value) => {
|
|
136805
|
+
const match = value.match(/\(([^()]+)\)$/);
|
|
136806
|
+
return match ? match[1] : value;
|
|
136807
|
+
};
|
|
136808
|
+
var getExistingProjectSummary = async (projectId) => {
|
|
136809
|
+
const projectsService = await getProjectsService();
|
|
136810
|
+
const project2 = await projectsService.get(extractSelectionId2(projectId));
|
|
136811
|
+
return {
|
|
136812
|
+
$id: project2.$id,
|
|
136813
|
+
name: project2.name,
|
|
136814
|
+
region: project2.region || ""
|
|
136815
|
+
};
|
|
136816
|
+
};
|
|
136817
|
+
var printInitProjectSuccess = (message) => {
|
|
136818
|
+
console.log(`${import_chalk9.default.green.bold("\u2713")} ${import_chalk9.default.green(message)}`);
|
|
136819
|
+
};
|
|
136820
|
+
var printInitProjectNextSteps = (steps) => {
|
|
136821
|
+
if (steps.length === 0) {
|
|
136822
|
+
return;
|
|
136823
|
+
}
|
|
136824
|
+
const longestCommand = steps.reduce(
|
|
136825
|
+
(longest, step) => Math.max(longest, step.command.length),
|
|
136826
|
+
0
|
|
136827
|
+
);
|
|
136828
|
+
console.log("");
|
|
136829
|
+
console.log(" Next steps:");
|
|
136830
|
+
for (const step of steps) {
|
|
136831
|
+
const spacing = " ".repeat(longestCommand - step.command.length + 4);
|
|
136832
|
+
console.log(
|
|
136833
|
+
` ${import_chalk9.default.cyan(step.command)}${spacing}${step.description}`
|
|
136834
|
+
);
|
|
136835
|
+
}
|
|
136836
|
+
};
|
|
136837
|
+
var getLocalInitProjectResourceState = () => {
|
|
136838
|
+
const functions2 = localConfig.getFunctions();
|
|
136839
|
+
const sites2 = localConfig.getSites();
|
|
136840
|
+
const collections = localConfig.getCollections();
|
|
136841
|
+
const tables = localConfig.getTables();
|
|
136842
|
+
const buckets = localConfig.getBuckets();
|
|
136843
|
+
const teams2 = localConfig.getTeams();
|
|
136844
|
+
const webhooks2 = localConfig.getWebhooks();
|
|
136845
|
+
const topics = localConfig.getMessagingTopics();
|
|
136846
|
+
return {
|
|
136847
|
+
hasFunctions: functions2.length > 0,
|
|
136848
|
+
hasResources: functions2.length > 0 || sites2.length > 0 || collections.length > 0 || tables.length > 0 || buckets.length > 0 || teams2.length > 0 || webhooks2.length > 0 || topics.length > 0
|
|
136849
|
+
};
|
|
136850
|
+
};
|
|
136851
|
+
var getInitProjectNextSteps = ({
|
|
136852
|
+
start,
|
|
136853
|
+
autoPulled
|
|
136854
|
+
}) => {
|
|
136855
|
+
const { hasFunctions, hasResources } = getLocalInitProjectResourceState();
|
|
136856
|
+
const nextSteps = [];
|
|
136857
|
+
if (start === "existing" && !autoPulled) {
|
|
136858
|
+
nextSteps.push(
|
|
136859
|
+
{
|
|
136860
|
+
command: `${EXECUTABLE_NAME} pull`,
|
|
136861
|
+
description: "Choose a resource to sync"
|
|
136862
|
+
},
|
|
136863
|
+
{
|
|
136864
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136865
|
+
description: "Create a new resource"
|
|
136866
|
+
}
|
|
136867
|
+
);
|
|
136868
|
+
return nextSteps;
|
|
136869
|
+
}
|
|
136870
|
+
if (start === "new") {
|
|
136871
|
+
nextSteps.push({
|
|
136872
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136873
|
+
description: "Create your first resource"
|
|
136874
|
+
});
|
|
136875
|
+
return nextSteps;
|
|
136876
|
+
}
|
|
136877
|
+
nextSteps.push({
|
|
136878
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136879
|
+
description: "Create another resource"
|
|
136880
|
+
});
|
|
136881
|
+
if (hasFunctions) {
|
|
136882
|
+
nextSteps.push({
|
|
136883
|
+
command: `${EXECUTABLE_NAME} run function`,
|
|
136884
|
+
description: "Run a pulled function locally"
|
|
136885
|
+
});
|
|
136886
|
+
}
|
|
136887
|
+
if (hasResources) {
|
|
136888
|
+
nextSteps.push({
|
|
136889
|
+
command: `${EXECUTABLE_NAME} push`,
|
|
136890
|
+
description: "Deploy your local edits"
|
|
136891
|
+
});
|
|
136892
|
+
}
|
|
136893
|
+
return nextSteps;
|
|
136894
|
+
};
|
|
136895
|
+
var installInitProjectSkills = async () => {
|
|
136896
|
+
if (hasSkillsInstalled(localConfig.configDirectoryPath)) {
|
|
136897
|
+
log("Agent skills already found. Skipping installation.");
|
|
136898
|
+
return;
|
|
136899
|
+
}
|
|
136900
|
+
try {
|
|
136901
|
+
const skillsCwd = localConfig.configDirectoryPath;
|
|
136902
|
+
const { skills, tempDir } = fetchAvailableSkills();
|
|
136903
|
+
try {
|
|
136904
|
+
const detected = detectProjectSkills(skillsCwd, skills);
|
|
136905
|
+
if (detected.length > 0) {
|
|
136906
|
+
const names = detected.map((s3) => s3.dirName);
|
|
136907
|
+
placeSkills(skillsCwd, tempDir, names, [".agents", ".claude"], true);
|
|
136908
|
+
printInitProjectSuccess(
|
|
136909
|
+
`Installed ${names.length} agent skill${names.length === 1 ? "" : "s"}: ${detected.map((s3) => s3.name).join(", ")}`
|
|
136910
|
+
);
|
|
136911
|
+
}
|
|
136912
|
+
} finally {
|
|
136913
|
+
import_fs9.default.rmSync(tempDir, { recursive: true, force: true });
|
|
136914
|
+
}
|
|
136915
|
+
} catch (e) {
|
|
136916
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
136917
|
+
error48(`Failed to install agent skills: ${msg}`);
|
|
136918
|
+
hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
|
|
136919
|
+
}
|
|
136920
|
+
};
|
|
136790
136921
|
var initResources = async () => {
|
|
136791
136922
|
const actions = {
|
|
136792
136923
|
function: initFunction,
|
|
@@ -136831,19 +136962,21 @@ var initProject = async ({
|
|
|
136831
136962
|
log("No changes made. Existing project configuration was kept.");
|
|
136832
136963
|
return;
|
|
136833
136964
|
}
|
|
136965
|
+
if (typeof answers.organization === "string") {
|
|
136966
|
+
answers.organization = extractSelectionId2(answers.organization);
|
|
136967
|
+
}
|
|
136834
136968
|
} else {
|
|
136835
136969
|
const selectedOrganization = organizationId ?? (await import_inquirer4.default.prompt([questionsInitProject[2]])).organization;
|
|
136836
136970
|
const selectedProjectName = projectName ?? (await import_inquirer4.default.prompt([questionsInitProject[3]])).project;
|
|
136837
136971
|
const selectedProjectId = projectId ?? (await import_inquirer4.default.prompt([questionsInitProject[4]])).id;
|
|
136972
|
+
const normalizedOrganization = extractSelectionId2(selectedOrganization);
|
|
136838
136973
|
answers = {
|
|
136839
136974
|
start: "existing",
|
|
136840
136975
|
project: selectedProjectId,
|
|
136841
|
-
organization:
|
|
136976
|
+
organization: normalizedOrganization
|
|
136842
136977
|
};
|
|
136843
136978
|
try {
|
|
136844
|
-
|
|
136845
|
-
const existingProject = await projectsService.get(selectedProjectId);
|
|
136846
|
-
answers.project = existingProject;
|
|
136979
|
+
answers.project = await getExistingProjectSummary(selectedProjectId);
|
|
136847
136980
|
} catch (e) {
|
|
136848
136981
|
if (e instanceof AppwriteException && e.code === 404) {
|
|
136849
136982
|
answers = {
|
|
@@ -136857,6 +136990,9 @@ var initProject = async ({
|
|
|
136857
136990
|
}
|
|
136858
136991
|
}
|
|
136859
136992
|
}
|
|
136993
|
+
if (answers.start === "existing" && typeof answers.project === "string") {
|
|
136994
|
+
answers.project = await getExistingProjectSummary(answers.project);
|
|
136995
|
+
}
|
|
136860
136996
|
localConfig.clear();
|
|
136861
136997
|
const url2 = new URL(DEFAULT_ENDPOINT);
|
|
136862
136998
|
if (answers.start === "new") {
|
|
@@ -136883,7 +137019,7 @@ var initProject = async ({
|
|
|
136883
137019
|
answers.organization,
|
|
136884
137020
|
answers.region
|
|
136885
137021
|
);
|
|
136886
|
-
localConfig.setProject(response["$id"]);
|
|
137022
|
+
localConfig.setProject(response["$id"], response.name ?? "");
|
|
136887
137023
|
if (answers.region) {
|
|
136888
137024
|
localConfig.setEndpoint(
|
|
136889
137025
|
`https://${answers.region}.${url2.host}${url2.pathname}`
|
|
@@ -136902,58 +137038,40 @@ var initProject = async ({
|
|
|
136902
137038
|
selectedProject = { $id: "" };
|
|
136903
137039
|
break;
|
|
136904
137040
|
}
|
|
136905
|
-
localConfig.setProject(selectedProject.$id);
|
|
137041
|
+
localConfig.setProject(selectedProject.$id, selectedProject.name ?? "");
|
|
136906
137042
|
if (isCloud() && selectedProject.region) {
|
|
136907
137043
|
localConfig.setEndpoint(
|
|
136908
137044
|
`https://${selectedProject.region}.${url2.host}${url2.pathname}`
|
|
136909
137045
|
);
|
|
136910
137046
|
}
|
|
136911
137047
|
}
|
|
136912
|
-
|
|
136913
|
-
`Project successfully ${answers.start === "existing" ? "linked" : "created"}. Details are now stored in appwrite.config.json file.`
|
|
136914
|
-
);
|
|
137048
|
+
let autoPulled = false;
|
|
136915
137049
|
if (answers.start === "existing") {
|
|
136916
137050
|
const autopullAnswers = await import_inquirer4.default.prompt(
|
|
136917
137051
|
questionsInitProjectAutopull
|
|
136918
137052
|
);
|
|
137053
|
+
console.log("");
|
|
137054
|
+
printInitProjectSuccess("Project linked \u2192 appwrite.config.json");
|
|
137055
|
+
await installInitProjectSkills();
|
|
136919
137056
|
if (autopullAnswers.autopull) {
|
|
137057
|
+
console.log("");
|
|
137058
|
+
autoPulled = true;
|
|
136920
137059
|
cliConfig.all = true;
|
|
136921
137060
|
cliConfig.force = true;
|
|
136922
137061
|
await pullResources({
|
|
136923
137062
|
skipDeprecated: true
|
|
136924
137063
|
});
|
|
136925
|
-
} else {
|
|
136926
|
-
log(
|
|
136927
|
-
`You can run '${EXECUTABLE_NAME} pull all' to synchronize all of your existing resources.`
|
|
136928
|
-
);
|
|
136929
|
-
}
|
|
136930
|
-
}
|
|
136931
|
-
hint(
|
|
136932
|
-
`Next you can use '${EXECUTABLE_NAME} init' to create resources in your project, or use '${EXECUTABLE_NAME} pull' and '${EXECUTABLE_NAME} push' to synchronize your project.`
|
|
136933
|
-
);
|
|
136934
|
-
if (!hasSkillsInstalled(localConfig.configDirectoryPath)) {
|
|
136935
|
-
try {
|
|
136936
|
-
const skillsCwd = localConfig.configDirectoryPath;
|
|
136937
|
-
log("Setting up Appwrite agent skills ...");
|
|
136938
|
-
const { skills, tempDir } = fetchAvailableSkills();
|
|
136939
|
-
try {
|
|
136940
|
-
const detected = detectProjectSkills(skillsCwd, skills);
|
|
136941
|
-
if (detected.length > 0) {
|
|
136942
|
-
const names = detected.map((s3) => s3.dirName);
|
|
136943
|
-
placeSkills(skillsCwd, tempDir, names, [".agents", ".claude"], true);
|
|
136944
|
-
success2(
|
|
136945
|
-
`Installed ${names.length} agent skill${names.length === 1 ? "" : "s"} based on your project: ${detected.map((s3) => s3.name).join(", ")}`
|
|
136946
|
-
);
|
|
136947
|
-
}
|
|
136948
|
-
} finally {
|
|
136949
|
-
import_fs9.default.rmSync(tempDir, { recursive: true, force: true });
|
|
136950
|
-
}
|
|
136951
|
-
} catch (e) {
|
|
136952
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
136953
|
-
error48(`Failed to install agent skills: ${msg}`);
|
|
136954
|
-
hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
|
|
136955
137064
|
}
|
|
137065
|
+
} else {
|
|
137066
|
+
console.log("");
|
|
137067
|
+
printInitProjectSuccess("Project created \u2192 appwrite.config.json");
|
|
137068
|
+
await installInitProjectSkills();
|
|
136956
137069
|
}
|
|
137070
|
+
const nextSteps = getInitProjectNextSteps({
|
|
137071
|
+
start: answers.start,
|
|
137072
|
+
autoPulled
|
|
137073
|
+
});
|
|
137074
|
+
printInitProjectNextSteps(nextSteps);
|
|
136957
137075
|
};
|
|
136958
137076
|
var initBucket = async () => {
|
|
136959
137077
|
const answers = await import_inquirer4.default.prompt(questionsCreateBucket);
|
|
@@ -138917,7 +139035,7 @@ var types = new Command("types").description("Generate types for your Appwrite p
|
|
|
138917
139035
|
// lib/commands/run.ts
|
|
138918
139036
|
var import_tail = __toESM(require_tail(), 1);
|
|
138919
139037
|
var import_dotenv = __toESM(require_main(), 1);
|
|
138920
|
-
var
|
|
139038
|
+
var import_chalk11 = __toESM(require_source(), 1);
|
|
138921
139039
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
138922
139040
|
var import_fs15 = __toESM(require("fs"), 1);
|
|
138923
139041
|
var import_chokidar = __toESM(require_chokidar(), 1);
|
|
@@ -138926,7 +139044,7 @@ var import_path14 = __toESM(require("path"), 1);
|
|
|
138926
139044
|
|
|
138927
139045
|
// lib/emulation/utils.ts
|
|
138928
139046
|
var import_node_events2 = require("node:events");
|
|
138929
|
-
var openRuntimesVersion = "
|
|
139047
|
+
var openRuntimesVersion = "v5";
|
|
138930
139048
|
var runtimeNames = {
|
|
138931
139049
|
node: "Node.js",
|
|
138932
139050
|
php: "PHP",
|
|
@@ -138945,67 +139063,67 @@ var runtimeNames = {
|
|
|
138945
139063
|
var systemTools = {
|
|
138946
139064
|
node: {
|
|
138947
139065
|
isCompiled: false,
|
|
138948
|
-
startCommand: "
|
|
139066
|
+
startCommand: "bash helpers/server.sh",
|
|
138949
139067
|
dependencyFiles: ["package.json", "package-lock.json"]
|
|
138950
139068
|
},
|
|
138951
139069
|
php: {
|
|
138952
139070
|
isCompiled: false,
|
|
138953
|
-
startCommand: "
|
|
139071
|
+
startCommand: "bash helpers/server.sh",
|
|
138954
139072
|
dependencyFiles: ["composer.json", "composer.lock"]
|
|
138955
139073
|
},
|
|
138956
139074
|
ruby: {
|
|
138957
139075
|
isCompiled: false,
|
|
138958
|
-
startCommand: "
|
|
139076
|
+
startCommand: "bash helpers/server.sh",
|
|
138959
139077
|
dependencyFiles: ["Gemfile", "Gemfile.lock"]
|
|
138960
139078
|
},
|
|
138961
139079
|
python: {
|
|
138962
139080
|
isCompiled: false,
|
|
138963
|
-
startCommand: "
|
|
139081
|
+
startCommand: "bash helpers/server.sh",
|
|
138964
139082
|
dependencyFiles: ["requirements.txt", "requirements.lock"]
|
|
138965
139083
|
},
|
|
138966
139084
|
"python-ml": {
|
|
138967
139085
|
isCompiled: false,
|
|
138968
|
-
startCommand: "
|
|
139086
|
+
startCommand: "bash helpers/server.sh",
|
|
138969
139087
|
dependencyFiles: ["requirements.txt", "requirements.lock"]
|
|
138970
139088
|
},
|
|
138971
139089
|
deno: {
|
|
138972
139090
|
isCompiled: false,
|
|
138973
|
-
startCommand: "
|
|
139091
|
+
startCommand: "bash helpers/server.sh",
|
|
138974
139092
|
dependencyFiles: []
|
|
138975
139093
|
},
|
|
138976
139094
|
dart: {
|
|
138977
139095
|
isCompiled: true,
|
|
138978
|
-
startCommand: "
|
|
139096
|
+
startCommand: "bash helpers/server.sh",
|
|
138979
139097
|
dependencyFiles: []
|
|
138980
139098
|
},
|
|
138981
139099
|
dotnet: {
|
|
138982
139100
|
isCompiled: true,
|
|
138983
|
-
startCommand: "
|
|
139101
|
+
startCommand: "bash helpers/server.sh",
|
|
138984
139102
|
dependencyFiles: []
|
|
138985
139103
|
},
|
|
138986
139104
|
java: {
|
|
138987
139105
|
isCompiled: true,
|
|
138988
|
-
startCommand: "
|
|
139106
|
+
startCommand: "bash helpers/server.sh",
|
|
138989
139107
|
dependencyFiles: []
|
|
138990
139108
|
},
|
|
138991
139109
|
swift: {
|
|
138992
139110
|
isCompiled: true,
|
|
138993
|
-
startCommand: "
|
|
139111
|
+
startCommand: "bash helpers/server.sh",
|
|
138994
139112
|
dependencyFiles: []
|
|
138995
139113
|
},
|
|
138996
139114
|
kotlin: {
|
|
138997
139115
|
isCompiled: true,
|
|
138998
|
-
startCommand: "
|
|
139116
|
+
startCommand: "bash helpers/server.sh",
|
|
138999
139117
|
dependencyFiles: []
|
|
139000
139118
|
},
|
|
139001
139119
|
bun: {
|
|
139002
139120
|
isCompiled: false,
|
|
139003
|
-
startCommand: "
|
|
139121
|
+
startCommand: "bash helpers/server.sh",
|
|
139004
139122
|
dependencyFiles: ["package.json", "package-lock.json", "bun.lockb"]
|
|
139005
139123
|
},
|
|
139006
139124
|
go: {
|
|
139007
139125
|
isCompiled: true,
|
|
139008
|
-
startCommand: "
|
|
139126
|
+
startCommand: "bash helpers/server.sh",
|
|
139009
139127
|
dependencyFiles: []
|
|
139010
139128
|
}
|
|
139011
139129
|
};
|
|
@@ -139100,11 +139218,118 @@ var Queue = {
|
|
|
139100
139218
|
// lib/emulation/docker.ts
|
|
139101
139219
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
139102
139220
|
var import_net2 = __toESM(require("net"), 1);
|
|
139103
|
-
var
|
|
139221
|
+
var import_chalk10 = __toESM(require_source(), 1);
|
|
139104
139222
|
var import_child_process3 = __toESM(require("child_process"), 1);
|
|
139105
139223
|
var import_path13 = __toESM(require("path"), 1);
|
|
139106
139224
|
var import_fs14 = __toESM(require("fs"), 1);
|
|
139107
139225
|
var ignore2 = import_ignore2.default.default ?? import_ignore2.default;
|
|
139226
|
+
function getFunctionIgnorer(func, functionDir) {
|
|
139227
|
+
const ignorer = ignore2();
|
|
139228
|
+
ignorer.add(".appwrite");
|
|
139229
|
+
if (func.ignore) {
|
|
139230
|
+
ignorer.add(func.ignore);
|
|
139231
|
+
} else if (import_fs14.default.existsSync(import_path13.default.join(functionDir, ".gitignore"))) {
|
|
139232
|
+
ignorer.add(
|
|
139233
|
+
import_fs14.default.readFileSync(import_path13.default.join(functionDir, ".gitignore")).toString()
|
|
139234
|
+
);
|
|
139235
|
+
}
|
|
139236
|
+
return ignorer;
|
|
139237
|
+
}
|
|
139238
|
+
function getFunctionFiles(func) {
|
|
139239
|
+
const functionDir = import_path13.default.join(localConfig.getDirname(), func.path);
|
|
139240
|
+
const ignorer = getFunctionIgnorer(func, functionDir);
|
|
139241
|
+
const files = getAllFiles(functionDir).map((file2) => import_path13.default.relative(functionDir, file2)).filter((file2) => !ignorer.ignores(file2));
|
|
139242
|
+
return { functionDir, files, ignorer };
|
|
139243
|
+
}
|
|
139244
|
+
function assertFunctionSourceCode(func) {
|
|
139245
|
+
const functionDir = import_path13.default.join(localConfig.getDirname(), func.path);
|
|
139246
|
+
if (!import_fs14.default.existsSync(functionDir)) {
|
|
139247
|
+
throw new Error(
|
|
139248
|
+
`Function path '${func.path}' was not found. Add your source code before running locally.`
|
|
139249
|
+
);
|
|
139250
|
+
}
|
|
139251
|
+
const { files, ignorer } = getFunctionFiles(func);
|
|
139252
|
+
if (!func.entrypoint) {
|
|
139253
|
+
throw new Error(
|
|
139254
|
+
`Function '${func.name}' is missing an entrypoint. Update appwrite.config.json before running locally.`
|
|
139255
|
+
);
|
|
139256
|
+
}
|
|
139257
|
+
const normalizedEntrypoint = import_path13.default.normalize(func.entrypoint);
|
|
139258
|
+
const relativeEntrypoint = normalizedEntrypoint.split(import_path13.default.sep).join("/");
|
|
139259
|
+
if (ignorer.ignores(relativeEntrypoint)) {
|
|
139260
|
+
throw new Error(
|
|
139261
|
+
`Entrypoint '${func.entrypoint}' is ignored by your local ignore rules. Update appwrite.config.json or your ignore file before running locally.`
|
|
139262
|
+
);
|
|
139263
|
+
}
|
|
139264
|
+
if (!import_fs14.default.existsSync(import_path13.default.join(functionDir, normalizedEntrypoint))) {
|
|
139265
|
+
throw new Error(
|
|
139266
|
+
`Entrypoint '${func.entrypoint}' was not found in '${func.path}'. Add your source code before running locally.`
|
|
139267
|
+
);
|
|
139268
|
+
}
|
|
139269
|
+
if (files.length === 0) {
|
|
139270
|
+
throw new Error(
|
|
139271
|
+
`No source files were found in '${func.path}'. Add your source code before running locally.`
|
|
139272
|
+
);
|
|
139273
|
+
}
|
|
139274
|
+
}
|
|
139275
|
+
function getRuntimeImageName(func) {
|
|
139276
|
+
const runtimeChunks = func.runtime.split("-");
|
|
139277
|
+
const runtimeVersion = runtimeChunks.pop();
|
|
139278
|
+
const runtimeName = runtimeChunks.join("-");
|
|
139279
|
+
return `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139280
|
+
}
|
|
139281
|
+
async function waitForProcessClose(process4) {
|
|
139282
|
+
return new Promise((resolve3, reject) => {
|
|
139283
|
+
process4.once("error", reject);
|
|
139284
|
+
process4.once("close", (code, signal) => {
|
|
139285
|
+
resolve3({ code, signal });
|
|
139286
|
+
});
|
|
139287
|
+
});
|
|
139288
|
+
}
|
|
139289
|
+
function assertDockerSuccess(code, signal, errorMessage) {
|
|
139290
|
+
if (code === 0) {
|
|
139291
|
+
return;
|
|
139292
|
+
}
|
|
139293
|
+
if (signal) {
|
|
139294
|
+
throw new Error(
|
|
139295
|
+
`${errorMessage} Docker process exited with signal ${signal}.`
|
|
139296
|
+
);
|
|
139297
|
+
}
|
|
139298
|
+
throw new Error(
|
|
139299
|
+
`${errorMessage} Docker process exited with code ${code ?? "unknown"}.`
|
|
139300
|
+
);
|
|
139301
|
+
}
|
|
139302
|
+
function getDockerExitMessage(code, signal) {
|
|
139303
|
+
if (signal) {
|
|
139304
|
+
return `Docker process exited with signal ${signal}.`;
|
|
139305
|
+
}
|
|
139306
|
+
return `Docker process exited with code ${code ?? "unknown"}.`;
|
|
139307
|
+
}
|
|
139308
|
+
function waitForProcessOutput(process4, needle) {
|
|
139309
|
+
return new Promise((resolve3) => {
|
|
139310
|
+
let output = "";
|
|
139311
|
+
const onData = (data) => {
|
|
139312
|
+
output += data.toString();
|
|
139313
|
+
if (output.includes(needle)) {
|
|
139314
|
+
cleanup();
|
|
139315
|
+
resolve3();
|
|
139316
|
+
}
|
|
139317
|
+
if (output.length > needle.length * 4) {
|
|
139318
|
+
output = output.slice(-needle.length * 4);
|
|
139319
|
+
}
|
|
139320
|
+
};
|
|
139321
|
+
const cleanup = () => {
|
|
139322
|
+
process4.stdout.off("data", onData);
|
|
139323
|
+
process4.stderr.off("data", onData);
|
|
139324
|
+
process4.off("close", cleanup);
|
|
139325
|
+
process4.off("error", cleanup);
|
|
139326
|
+
};
|
|
139327
|
+
process4.stdout.on("data", onData);
|
|
139328
|
+
process4.stderr.on("data", onData);
|
|
139329
|
+
process4.once("close", cleanup);
|
|
139330
|
+
process4.once("error", cleanup);
|
|
139331
|
+
});
|
|
139332
|
+
}
|
|
139108
139333
|
async function dockerStop(id) {
|
|
139109
139334
|
const stopProcess = import_child_process3.default.spawn("docker", ["rm", "--force", id], {
|
|
139110
139335
|
stdio: "pipe",
|
|
@@ -139118,10 +139343,7 @@ async function dockerStop(id) {
|
|
|
139118
139343
|
});
|
|
139119
139344
|
}
|
|
139120
139345
|
async function dockerPull(func) {
|
|
139121
|
-
const
|
|
139122
|
-
const runtimeVersion = runtimeChunks.pop();
|
|
139123
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139124
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139346
|
+
const imageName = getRuntimeImageName(func);
|
|
139125
139347
|
log("Verifying Docker image ...");
|
|
139126
139348
|
const pullProcess = import_child_process3.default.spawn("docker", ["pull", imageName], {
|
|
139127
139349
|
stdio: "pipe",
|
|
@@ -139130,27 +139352,17 @@ async function dockerPull(func) {
|
|
|
139130
139352
|
DOCKER_CLI_HINTS: "false"
|
|
139131
139353
|
}
|
|
139132
139354
|
});
|
|
139133
|
-
await
|
|
139134
|
-
|
|
139135
|
-
|
|
139355
|
+
const { code, signal } = await waitForProcessClose(pullProcess);
|
|
139356
|
+
assertDockerSuccess(
|
|
139357
|
+
code,
|
|
139358
|
+
signal,
|
|
139359
|
+
`Unable to pull Docker image '${imageName}'.`
|
|
139360
|
+
);
|
|
139136
139361
|
}
|
|
139137
139362
|
async function dockerBuild(func, variables) {
|
|
139138
|
-
const
|
|
139139
|
-
const
|
|
139140
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139141
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139142
|
-
const functionDir = import_path13.default.join(localConfig.getDirname(), func.path);
|
|
139363
|
+
const imageName = getRuntimeImageName(func);
|
|
139364
|
+
const { functionDir, files } = getFunctionFiles(func);
|
|
139143
139365
|
const id = func.$id;
|
|
139144
|
-
const ignorer = ignore2();
|
|
139145
|
-
ignorer.add(".appwrite");
|
|
139146
|
-
if (func.ignore) {
|
|
139147
|
-
ignorer.add(func.ignore);
|
|
139148
|
-
} else if (import_fs14.default.existsSync(import_path13.default.join(functionDir, ".gitignore"))) {
|
|
139149
|
-
ignorer.add(
|
|
139150
|
-
import_fs14.default.readFileSync(import_path13.default.join(functionDir, ".gitignore")).toString()
|
|
139151
|
-
);
|
|
139152
|
-
}
|
|
139153
|
-
const files = getAllFiles(functionDir).map((file2) => import_path13.default.relative(functionDir, file2)).filter((file2) => !ignorer.ignores(file2));
|
|
139154
139366
|
const tmpBuildPath = import_path13.default.join(functionDir, ".appwrite/tmp-build");
|
|
139155
139367
|
if (!import_fs14.default.existsSync(tmpBuildPath)) {
|
|
139156
139368
|
import_fs14.default.mkdirSync(tmpBuildPath, { recursive: true });
|
|
@@ -139184,13 +139396,19 @@ async function dockerBuild(func, variables) {
|
|
|
139184
139396
|
DOCKER_CLI_HINTS: "false"
|
|
139185
139397
|
}
|
|
139186
139398
|
});
|
|
139399
|
+
let hasPrintedBuildSeparator = false;
|
|
139400
|
+
const writeBuildChunk = (stream, data) => {
|
|
139401
|
+
if (!hasPrintedBuildSeparator) {
|
|
139402
|
+
stream.write("\n");
|
|
139403
|
+
hasPrintedBuildSeparator = true;
|
|
139404
|
+
}
|
|
139405
|
+
stream.write(import_chalk10.default.blackBright(data));
|
|
139406
|
+
};
|
|
139187
139407
|
buildProcess.stdout.on("data", (data) => {
|
|
139188
|
-
process.stdout
|
|
139189
|
-
`));
|
|
139408
|
+
writeBuildChunk(process.stdout, data);
|
|
139190
139409
|
});
|
|
139191
139410
|
buildProcess.stderr.on("data", (data) => {
|
|
139192
|
-
process.stderr
|
|
139193
|
-
`));
|
|
139411
|
+
writeBuildChunk(process.stderr, data);
|
|
139194
139412
|
});
|
|
139195
139413
|
killInterval = setInterval(() => {
|
|
139196
139414
|
if (!Queue.isEmpty()) {
|
|
@@ -139202,15 +139420,18 @@ async function dockerBuild(func, variables) {
|
|
|
139202
139420
|
clearInterval(killInterval);
|
|
139203
139421
|
}
|
|
139204
139422
|
}, 100);
|
|
139205
|
-
await
|
|
139206
|
-
buildProcess.on("close", res);
|
|
139207
|
-
});
|
|
139423
|
+
const { code, signal } = await waitForProcessClose(buildProcess);
|
|
139208
139424
|
clearInterval(killInterval);
|
|
139209
139425
|
killInterval = void 0;
|
|
139210
139426
|
if (!Queue.isEmpty()) {
|
|
139211
139427
|
await dockerStop(id);
|
|
139212
139428
|
return;
|
|
139213
139429
|
}
|
|
139430
|
+
assertDockerSuccess(
|
|
139431
|
+
code,
|
|
139432
|
+
signal,
|
|
139433
|
+
`Unable to build function '${func.name}'.`
|
|
139434
|
+
);
|
|
139214
139435
|
const copyPath = import_path13.default.join(
|
|
139215
139436
|
localConfig.getDirname(),
|
|
139216
139437
|
func.path,
|
|
@@ -139233,11 +139454,15 @@ async function dockerBuild(func, variables) {
|
|
|
139233
139454
|
}
|
|
139234
139455
|
}
|
|
139235
139456
|
);
|
|
139236
|
-
await
|
|
139237
|
-
|
|
139238
|
-
|
|
139457
|
+
const copyResult = await waitForProcessClose(copyProcess);
|
|
139458
|
+
assertDockerSuccess(
|
|
139459
|
+
copyResult.code,
|
|
139460
|
+
copyResult.signal,
|
|
139461
|
+
`Unable to copy built bundle for function '${func.name}'.`
|
|
139462
|
+
);
|
|
139239
139463
|
await dockerStop(id);
|
|
139240
139464
|
} finally {
|
|
139465
|
+
await dockerStop(id);
|
|
139241
139466
|
if (killInterval !== void 0) {
|
|
139242
139467
|
clearInterval(killInterval);
|
|
139243
139468
|
}
|
|
@@ -139254,10 +139479,8 @@ async function dockerBuild(func, variables) {
|
|
|
139254
139479
|
}
|
|
139255
139480
|
async function dockerStart(func, variables, port) {
|
|
139256
139481
|
const functionDir = import_path13.default.join(localConfig.getDirname(), func.path);
|
|
139257
|
-
const
|
|
139258
|
-
const
|
|
139259
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139260
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139482
|
+
const imageName = getRuntimeImageName(func);
|
|
139483
|
+
const runtimeName = func.runtime.split("-").slice(0, -1).join("-");
|
|
139261
139484
|
const tool = systemTools[runtimeName];
|
|
139262
139485
|
const id = func.$id;
|
|
139263
139486
|
const params = ["run"];
|
|
@@ -139292,19 +139515,62 @@ async function dockerStart(func, variables, port) {
|
|
|
139292
139515
|
}
|
|
139293
139516
|
});
|
|
139294
139517
|
startProcess.stdout.on("data", (data) => {
|
|
139295
|
-
process.stdout.write(
|
|
139518
|
+
process.stdout.write(import_chalk10.default.blackBright(data));
|
|
139296
139519
|
});
|
|
139297
139520
|
startProcess.stderr.on("data", (data) => {
|
|
139298
|
-
process.
|
|
139521
|
+
process.stderr.write(import_chalk10.default.blackBright(data));
|
|
139522
|
+
});
|
|
139523
|
+
const startProcessExit = waitForProcessClose(startProcess);
|
|
139524
|
+
void startProcessExit.catch(() => {
|
|
139525
|
+
});
|
|
139526
|
+
const startupLogDetected = waitForProcessOutput(
|
|
139527
|
+
startProcess,
|
|
139528
|
+
"HTTP server successfully started!"
|
|
139529
|
+
);
|
|
139530
|
+
void startupLogDetected.catch(() => {
|
|
139299
139531
|
});
|
|
139300
139532
|
try {
|
|
139301
|
-
await
|
|
139533
|
+
const result = await Promise.race([
|
|
139534
|
+
waitUntilPortOpen(port).then(() => ({
|
|
139535
|
+
type: "port-open"
|
|
139536
|
+
})),
|
|
139537
|
+
startProcessExit.then(({ code, signal }) => ({
|
|
139538
|
+
type: "process-exit",
|
|
139539
|
+
code,
|
|
139540
|
+
signal
|
|
139541
|
+
}))
|
|
139542
|
+
]);
|
|
139543
|
+
if (result.type === "process-exit") {
|
|
139544
|
+
throw new Error(
|
|
139545
|
+
`Function container exited before opening port ${port}. ${getDockerExitMessage(result.code, result.signal)}`
|
|
139546
|
+
);
|
|
139547
|
+
}
|
|
139548
|
+
const postStartupResult = await Promise.race([
|
|
139549
|
+
startupLogDetected.then(() => ({
|
|
139550
|
+
type: "startup-log"
|
|
139551
|
+
})),
|
|
139552
|
+
startProcessExit.then(({ code, signal }) => ({
|
|
139553
|
+
type: "process-exit",
|
|
139554
|
+
code,
|
|
139555
|
+
signal
|
|
139556
|
+
})),
|
|
139557
|
+
new Promise((resolve3) => {
|
|
139558
|
+
setTimeout(() => resolve3({ type: "timeout" }), 1500);
|
|
139559
|
+
})
|
|
139560
|
+
]);
|
|
139561
|
+
if (postStartupResult.type === "process-exit") {
|
|
139562
|
+
throw new Error(
|
|
139563
|
+
`Function container exited before startup logs completed. ${getDockerExitMessage(postStartupResult.code, postStartupResult.signal)}`
|
|
139564
|
+
);
|
|
139565
|
+
}
|
|
139302
139566
|
} catch (err) {
|
|
139303
139567
|
const message = err instanceof Error ? err.message : String(err);
|
|
139304
139568
|
error48(`Failed to start function with error: ${message}`);
|
|
139305
139569
|
return;
|
|
139306
139570
|
}
|
|
139571
|
+
process.stdout.write("\n");
|
|
139307
139572
|
success2(`Visit http://localhost:${port}/ to execute your function.`);
|
|
139573
|
+
process.stdout.write("\n");
|
|
139308
139574
|
}
|
|
139309
139575
|
async function dockerCleanup(functionId) {
|
|
139310
139576
|
await dockerStop(functionId);
|
|
@@ -139420,12 +139686,13 @@ var runFunction = async ({
|
|
|
139420
139686
|
scopes: func.scopes ?? []
|
|
139421
139687
|
};
|
|
139422
139688
|
drawTable([settings]);
|
|
139423
|
-
|
|
139689
|
+
hint(
|
|
139424
139690
|
"If you wish to change your local settings, update the appwrite.config.json file and rerun the 'appwrite run' command."
|
|
139425
139691
|
);
|
|
139426
139692
|
hint(
|
|
139427
139693
|
"Permissions, events, CRON and timeouts don't apply when running locally."
|
|
139428
139694
|
);
|
|
139695
|
+
assertFunctionSourceCode(func);
|
|
139429
139696
|
await dockerCleanup(func.$id);
|
|
139430
139697
|
process.on("SIGINT", async () => {
|
|
139431
139698
|
log("Cleaning up ...");
|
|
@@ -139508,12 +139775,22 @@ var runFunction = async ({
|
|
|
139508
139775
|
);
|
|
139509
139776
|
}
|
|
139510
139777
|
await dockerPull(func);
|
|
139778
|
+
let hasShownRuntimeLogsHeader = false;
|
|
139779
|
+
const showRuntimeLogsHeader = () => {
|
|
139780
|
+
if (hasShownRuntimeLogsHeader) {
|
|
139781
|
+
return;
|
|
139782
|
+
}
|
|
139783
|
+
hasShownRuntimeLogsHeader = true;
|
|
139784
|
+
log("Runtime logs:");
|
|
139785
|
+
};
|
|
139511
139786
|
new import_tail.Tail(logsPath).on("line", function(data) {
|
|
139512
|
-
|
|
139787
|
+
showRuntimeLogsHeader();
|
|
139788
|
+
process.stdout.write(import_chalk11.default.white(`${data}
|
|
139513
139789
|
`));
|
|
139514
139790
|
});
|
|
139515
139791
|
new import_tail.Tail(errorsPath).on("line", function(data) {
|
|
139516
|
-
|
|
139792
|
+
showRuntimeLogsHeader();
|
|
139793
|
+
process.stdout.write(import_chalk11.default.white(`${data}
|
|
139517
139794
|
`));
|
|
139518
139795
|
});
|
|
139519
139796
|
if (reload) {
|
|
@@ -139545,6 +139822,7 @@ var runFunction = async ({
|
|
|
139545
139822
|
Queue.lock();
|
|
139546
139823
|
try {
|
|
139547
139824
|
await dockerStop(func.$id);
|
|
139825
|
+
assertFunctionSourceCode(func);
|
|
139548
139826
|
const dependencyFile = files.find(
|
|
139549
139827
|
(filePath) => tool.dependencyFiles.includes(filePath)
|
|
139550
139828
|
);
|
|
@@ -139608,7 +139886,7 @@ var runFunction = async ({
|
|
|
139608
139886
|
await dockerStart(func, allVariables, portNum);
|
|
139609
139887
|
}
|
|
139610
139888
|
} catch (err) {
|
|
139611
|
-
|
|
139889
|
+
error48(`Failed to reload function with error: ${getErrorMessage(err)}`);
|
|
139612
139890
|
} finally {
|
|
139613
139891
|
Queue.unlock();
|
|
139614
139892
|
}
|
|
@@ -139620,8 +139898,10 @@ var runFunction = async ({
|
|
|
139620
139898
|
Queue.unlock();
|
|
139621
139899
|
return;
|
|
139622
139900
|
}
|
|
139901
|
+
process.stdout.write("\n");
|
|
139623
139902
|
log("Starting function using Docker ...");
|
|
139624
139903
|
hint("Function automatically restarts when you edit your code.");
|
|
139904
|
+
process.stdout.write("\n");
|
|
139625
139905
|
await dockerStart(func, allVariables, portNum);
|
|
139626
139906
|
Queue.unlock();
|
|
139627
139907
|
};
|
|
@@ -139646,7 +139926,7 @@ var import_path15 = __toESM(require("path"), 1);
|
|
|
139646
139926
|
var import_node_readline = __toESM(require("node:readline"), 1);
|
|
139647
139927
|
var import_node_util = require("node:util");
|
|
139648
139928
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
139649
|
-
var
|
|
139929
|
+
var import_chalk14 = __toESM(require_source(), 1);
|
|
139650
139930
|
var import_inquirer7 = __toESM(require_inquirer(), 1);
|
|
139651
139931
|
|
|
139652
139932
|
// lib/commands/utils/error-formatter.ts
|
|
@@ -140176,7 +140456,7 @@ var Pools = class {
|
|
|
140176
140456
|
};
|
|
140177
140457
|
|
|
140178
140458
|
// lib/commands/utils/attributes.ts
|
|
140179
|
-
var
|
|
140459
|
+
var import_chalk12 = __toESM(require_source(), 1);
|
|
140180
140460
|
var import_inquirer6 = __toESM(require_inquirer(), 1);
|
|
140181
140461
|
var changeableKeys = [
|
|
140182
140462
|
"status",
|
|
@@ -140246,11 +140526,11 @@ var Attributes = class {
|
|
|
140246
140526
|
if (Array.isArray(remote) && Array.isArray(local)) {
|
|
140247
140527
|
if (JSON.stringify(remote) !== JSON.stringify(local)) {
|
|
140248
140528
|
const bol = reason === "" ? "" : "\n";
|
|
140249
|
-
reason += `${bol}${key} changed from ${
|
|
140529
|
+
reason += `${bol}${key} changed from ${import_chalk12.default.red(remote)} to ${import_chalk12.default.green(local)}`;
|
|
140250
140530
|
}
|
|
140251
140531
|
} else if (!this.isEqual(remote, local)) {
|
|
140252
140532
|
const bol = reason === "" ? "" : "\n";
|
|
140253
|
-
reason += `${bol}${key} changed from ${
|
|
140533
|
+
reason += `${bol}${key} changed from ${import_chalk12.default.red(remote)} to ${import_chalk12.default.green(local)}`;
|
|
140254
140534
|
}
|
|
140255
140535
|
return reason;
|
|
140256
140536
|
};
|
|
@@ -140262,8 +140542,8 @@ var Attributes = class {
|
|
|
140262
140542
|
if (local === void 0) {
|
|
140263
140543
|
return void 0;
|
|
140264
140544
|
}
|
|
140265
|
-
const keyName = `${
|
|
140266
|
-
const action =
|
|
140545
|
+
const keyName = `${import_chalk12.default.yellow(local.key)} in ${collection.name} (${collection["$id"]})`;
|
|
140546
|
+
const action = import_chalk12.default.cyan(recreating ? "recreating" : "changing");
|
|
140267
140547
|
let reason = "";
|
|
140268
140548
|
const attribute = recreating ? remote : local;
|
|
140269
140549
|
for (const key of Object.keys(remote)) {
|
|
@@ -140289,10 +140569,10 @@ var Attributes = class {
|
|
|
140289
140569
|
attributesContains = (attribute, attributes) => attributes.find((attr) => attr.key === attribute.key);
|
|
140290
140570
|
generateChangesObject = (attribute, collection, isAdding) => {
|
|
140291
140571
|
return {
|
|
140292
|
-
key: `${
|
|
140572
|
+
key: `${import_chalk12.default.yellow(attribute.key)} in ${collection.name} (${collection["$id"]})`,
|
|
140293
140573
|
attribute,
|
|
140294
140574
|
reason: isAdding ? "Field isn't present on the remote server" : "Field isn't present on the appwrite.config.json file",
|
|
140295
|
-
action: isAdding ?
|
|
140575
|
+
action: isAdding ? import_chalk12.default.green("adding") : import_chalk12.default.red("deleting")
|
|
140296
140576
|
};
|
|
140297
140577
|
};
|
|
140298
140578
|
createAttribute = async (databaseId, collectionId, attribute) => {
|
|
@@ -140698,25 +140978,25 @@ var Attributes = class {
|
|
|
140698
140978
|
if (!cliConfig.force) {
|
|
140699
140979
|
if (deleting.length > 0 && !isIndex) {
|
|
140700
140980
|
console.log(
|
|
140701
|
-
`${
|
|
140981
|
+
`${import_chalk12.default.red("------------------------------------------------------")}`
|
|
140702
140982
|
);
|
|
140703
140983
|
console.log(
|
|
140704
|
-
`${
|
|
140984
|
+
`${import_chalk12.default.red("| WARNING: Attribute deletion may cause loss of data |")}`
|
|
140705
140985
|
);
|
|
140706
140986
|
console.log(
|
|
140707
|
-
`${
|
|
140987
|
+
`${import_chalk12.default.red("------------------------------------------------------")}`
|
|
140708
140988
|
);
|
|
140709
140989
|
console.log();
|
|
140710
140990
|
}
|
|
140711
140991
|
if (conflicts.length > 0 && !isIndex) {
|
|
140712
140992
|
console.log(
|
|
140713
|
-
`${
|
|
140993
|
+
`${import_chalk12.default.red("--------------------------------------------------------")}`
|
|
140714
140994
|
);
|
|
140715
140995
|
console.log(
|
|
140716
|
-
`${
|
|
140996
|
+
`${import_chalk12.default.red("| WARNING: Attribute recreation may cause loss of data |")}`
|
|
140717
140997
|
);
|
|
140718
140998
|
console.log(
|
|
140719
|
-
`${
|
|
140999
|
+
`${import_chalk12.default.red("--------------------------------------------------------")}`
|
|
140720
141000
|
);
|
|
140721
141001
|
console.log();
|
|
140722
141002
|
}
|
|
@@ -140849,7 +141129,7 @@ var Attributes = class {
|
|
|
140849
141129
|
};
|
|
140850
141130
|
|
|
140851
141131
|
// lib/commands/utils/database-sync.ts
|
|
140852
|
-
var
|
|
141132
|
+
var import_chalk13 = __toESM(require_source(), 1);
|
|
140853
141133
|
var isTablesDBResource = (value) => {
|
|
140854
141134
|
if (!value || typeof value !== "object") {
|
|
140855
141135
|
return false;
|
|
@@ -140894,7 +141174,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140894
141174
|
toDelete.push(remoteDB);
|
|
140895
141175
|
changes.push({
|
|
140896
141176
|
id: remoteDB.$id,
|
|
140897
|
-
action:
|
|
141177
|
+
action: import_chalk13.default.red("deleting"),
|
|
140898
141178
|
key: "Database",
|
|
140899
141179
|
remote: remoteDB.name,
|
|
140900
141180
|
local: "(deleted locally)"
|
|
@@ -140907,7 +141187,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140907
141187
|
toCreate.push(localDB);
|
|
140908
141188
|
changes.push({
|
|
140909
141189
|
id: localDB.$id,
|
|
140910
|
-
action:
|
|
141190
|
+
action: import_chalk13.default.green("creating"),
|
|
140911
141191
|
key: "Database",
|
|
140912
141192
|
remote: "(does not exist)",
|
|
140913
141193
|
local: localDB.name
|
|
@@ -140918,7 +141198,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140918
141198
|
hasChanges = true;
|
|
140919
141199
|
changes.push({
|
|
140920
141200
|
id: localDB.$id,
|
|
140921
|
-
action:
|
|
141201
|
+
action: import_chalk13.default.yellow("updating"),
|
|
140922
141202
|
key: "Name",
|
|
140923
141203
|
remote: remoteDB.name,
|
|
140924
141204
|
local: localDB.name
|
|
@@ -140928,7 +141208,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140928
141208
|
hasChanges = true;
|
|
140929
141209
|
changes.push({
|
|
140930
141210
|
id: localDB.$id,
|
|
140931
|
-
action:
|
|
141211
|
+
action: import_chalk13.default.yellow("updating"),
|
|
140932
141212
|
key: "Enabled",
|
|
140933
141213
|
remote: remoteDB.enabled,
|
|
140934
141214
|
local: localDB.enabled
|
|
@@ -140946,13 +141226,13 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140946
141226
|
drawTable(changes);
|
|
140947
141227
|
if (toDelete.length > 0) {
|
|
140948
141228
|
console.log(
|
|
140949
|
-
`${
|
|
141229
|
+
`${import_chalk13.default.red("------------------------------------------------------------------")}`
|
|
140950
141230
|
);
|
|
140951
141231
|
console.log(
|
|
140952
|
-
`${
|
|
141232
|
+
`${import_chalk13.default.red("| WARNING: Database deletion will also delete all related tables |")}`
|
|
140953
141233
|
);
|
|
140954
141234
|
console.log(
|
|
140955
|
-
`${
|
|
141235
|
+
`${import_chalk13.default.red("------------------------------------------------------------------")}`
|
|
140956
141236
|
);
|
|
140957
141237
|
console.log();
|
|
140958
141238
|
}
|
|
@@ -141379,7 +141659,7 @@ var Push = class {
|
|
|
141379
141659
|
settings: config2.settings
|
|
141380
141660
|
});
|
|
141381
141661
|
this.success(
|
|
141382
|
-
`Successfully pushed ${
|
|
141662
|
+
`Successfully pushed ${import_chalk14.default.bold("all")} project settings.`
|
|
141383
141663
|
);
|
|
141384
141664
|
results.settings = { success: true };
|
|
141385
141665
|
} catch (e) {
|
|
@@ -141392,7 +141672,7 @@ var Push = class {
|
|
|
141392
141672
|
this.log("Pushing buckets ...");
|
|
141393
141673
|
const result = await this.pushBuckets(config2.buckets);
|
|
141394
141674
|
this.success(
|
|
141395
|
-
`Successfully pushed ${
|
|
141675
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} buckets.`
|
|
141396
141676
|
);
|
|
141397
141677
|
results.buckets = result;
|
|
141398
141678
|
allErrors.push(...result.errors);
|
|
@@ -141406,7 +141686,7 @@ var Push = class {
|
|
|
141406
141686
|
this.log("Pushing teams ...");
|
|
141407
141687
|
const result = await this.pushTeams(config2.teams);
|
|
141408
141688
|
this.success(
|
|
141409
|
-
`Successfully pushed ${
|
|
141689
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} teams.`
|
|
141410
141690
|
);
|
|
141411
141691
|
results.teams = result;
|
|
141412
141692
|
allErrors.push(...result.errors);
|
|
@@ -141420,7 +141700,7 @@ var Push = class {
|
|
|
141420
141700
|
this.log("Pushing webhooks ...");
|
|
141421
141701
|
const result = await this.pushWebhooks(config2.webhooks);
|
|
141422
141702
|
this.success(
|
|
141423
|
-
`Successfully pushed ${
|
|
141703
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} webhooks.`
|
|
141424
141704
|
);
|
|
141425
141705
|
results.webhooks = result;
|
|
141426
141706
|
allErrors.push(...result.errors);
|
|
@@ -141434,7 +141714,7 @@ var Push = class {
|
|
|
141434
141714
|
this.log("Pushing topics ...");
|
|
141435
141715
|
const result = await this.pushMessagingTopics(config2.topics);
|
|
141436
141716
|
this.success(
|
|
141437
|
-
`Successfully pushed ${
|
|
141717
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} topics.`
|
|
141438
141718
|
);
|
|
141439
141719
|
results.topics = result;
|
|
141440
141720
|
allErrors.push(...result.errors);
|
|
@@ -141451,7 +141731,7 @@ var Push = class {
|
|
|
141451
141731
|
options.functionOptions
|
|
141452
141732
|
);
|
|
141453
141733
|
this.success(
|
|
141454
|
-
`Successfully pushed ${
|
|
141734
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} functions.`
|
|
141455
141735
|
);
|
|
141456
141736
|
results.functions = result;
|
|
141457
141737
|
allErrors.push(...result.errors);
|
|
@@ -141473,7 +141753,7 @@ var Push = class {
|
|
|
141473
141753
|
options.siteOptions
|
|
141474
141754
|
);
|
|
141475
141755
|
this.success(
|
|
141476
|
-
`Successfully pushed ${
|
|
141756
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} sites.`
|
|
141477
141757
|
);
|
|
141478
141758
|
results.sites = result;
|
|
141479
141759
|
allErrors.push(...result.errors);
|
|
@@ -141495,7 +141775,7 @@ var Push = class {
|
|
|
141495
141775
|
skipConfirmation: options.skipConfirmation
|
|
141496
141776
|
});
|
|
141497
141777
|
this.success(
|
|
141498
|
-
`Successfully pushed ${
|
|
141778
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} tables.`
|
|
141499
141779
|
);
|
|
141500
141780
|
results.tables = result;
|
|
141501
141781
|
allErrors.push(...result.errors);
|
|
@@ -141522,7 +141802,7 @@ var Push = class {
|
|
|
141522
141802
|
skipConfirmation: options.skipConfirmation
|
|
141523
141803
|
});
|
|
141524
141804
|
this.success(
|
|
141525
|
-
`Successfully pushed ${
|
|
141805
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} collections.`
|
|
141526
141806
|
);
|
|
141527
141807
|
results.collections = result;
|
|
141528
141808
|
allErrors.push(...result.errors);
|
|
@@ -141647,14 +141927,14 @@ var Push = class {
|
|
|
141647
141927
|
};
|
|
141648
141928
|
for (const bucket of buckets) {
|
|
141649
141929
|
try {
|
|
141650
|
-
this.log(`Pushing bucket ${
|
|
141930
|
+
this.log(`Pushing bucket ${import_chalk14.default.bold(bucket["name"])} ...`);
|
|
141651
141931
|
const storageService = await getStorageService(this.projectClient);
|
|
141652
141932
|
try {
|
|
141653
141933
|
const remoteBucket = await storageService.getBucket(bucket["$id"]);
|
|
141654
141934
|
const hasChanges = hasBucketChanges(remoteBucket, bucket);
|
|
141655
141935
|
if (!hasChanges) {
|
|
141656
141936
|
this.log(
|
|
141657
|
-
`No changes detected for bucket ${
|
|
141937
|
+
`No changes detected for bucket ${import_chalk14.default.bold(bucket["name"])}. Skipping.`
|
|
141658
141938
|
);
|
|
141659
141939
|
continue;
|
|
141660
141940
|
}
|
|
@@ -141705,7 +141985,7 @@ var Push = class {
|
|
|
141705
141985
|
const errors = [];
|
|
141706
141986
|
for (const team of teams2) {
|
|
141707
141987
|
try {
|
|
141708
|
-
this.log(`Pushing team ${
|
|
141988
|
+
this.log(`Pushing team ${import_chalk14.default.bold(team["name"])} ...`);
|
|
141709
141989
|
const teamsService = await getTeamsService(this.projectClient);
|
|
141710
141990
|
try {
|
|
141711
141991
|
await teamsService.get(team["$id"]);
|
|
@@ -141739,7 +142019,7 @@ var Push = class {
|
|
|
141739
142019
|
const errors = [];
|
|
141740
142020
|
for (const webhook of webhooks2) {
|
|
141741
142021
|
try {
|
|
141742
|
-
this.log(`Pushing webhook ${
|
|
142022
|
+
this.log(`Pushing webhook ${import_chalk14.default.bold(webhook["name"])} ...`);
|
|
141743
142023
|
const webhooksService = await getWebhooksService(this.projectClient);
|
|
141744
142024
|
try {
|
|
141745
142025
|
await webhooksService.get({ webhookId: webhook["$id"] });
|
|
@@ -141781,7 +142061,7 @@ var Push = class {
|
|
|
141781
142061
|
const errors = [];
|
|
141782
142062
|
for (const topic of topics) {
|
|
141783
142063
|
try {
|
|
141784
|
-
this.log(`Pushing topic ${
|
|
142064
|
+
this.log(`Pushing topic ${import_chalk14.default.bold(topic["name"])} ...`);
|
|
141785
142065
|
const messagingService = await getMessagingService(this.projectClient);
|
|
141786
142066
|
try {
|
|
141787
142067
|
await messagingService.getTopic(topic["$id"]);
|
|
@@ -142228,9 +142508,9 @@ var Push = class {
|
|
|
142228
142508
|
process.stdout.write("\n");
|
|
142229
142509
|
}
|
|
142230
142510
|
if (dl.url) {
|
|
142231
|
-
this.log(`Preview link: ${
|
|
142511
|
+
this.log(`Preview link: ${import_chalk14.default.cyan(dl.url)}`);
|
|
142232
142512
|
}
|
|
142233
|
-
this.log(`Deployment page: ${
|
|
142513
|
+
this.log(`Deployment page: ${import_chalk14.default.cyan(dl.consoleUrl)}`);
|
|
142234
142514
|
});
|
|
142235
142515
|
process.stdout.write("\n");
|
|
142236
142516
|
}
|
|
@@ -142706,7 +142986,7 @@ var Push = class {
|
|
|
142706
142986
|
process.stdout.write("\n");
|
|
142707
142987
|
}
|
|
142708
142988
|
if (deploymentLogs.length > 1) {
|
|
142709
|
-
process.stdout.write(`${
|
|
142989
|
+
process.stdout.write(`${import_chalk14.default.cyan.bold(`Site: ${dl.name}`)}
|
|
142710
142990
|
`);
|
|
142711
142991
|
}
|
|
142712
142992
|
if (dl.screenshotsPending) {
|
|
@@ -142723,7 +143003,7 @@ var Push = class {
|
|
|
142723
143003
|
if (preview.preview) {
|
|
142724
143004
|
process.stdout.write(
|
|
142725
143005
|
`
|
|
142726
|
-
${
|
|
143006
|
+
${import_chalk14.default.cyan.bold("Screenshot preview")}
|
|
142727
143007
|
|
|
142728
143008
|
`
|
|
142729
143009
|
);
|
|
@@ -142747,9 +143027,9 @@ ${import_chalk13.default.cyan.bold("Screenshot preview")}
|
|
|
142747
143027
|
}
|
|
142748
143028
|
}
|
|
142749
143029
|
if (dl.url) {
|
|
142750
|
-
this.log(`Preview link: ${
|
|
143030
|
+
this.log(`Preview link: ${import_chalk14.default.cyan(dl.url)}`);
|
|
142751
143031
|
}
|
|
142752
|
-
this.log(`Deployment page: ${
|
|
143032
|
+
this.log(`Deployment page: ${import_chalk14.default.cyan(dl.consoleUrl)}`);
|
|
142753
143033
|
}
|
|
142754
143034
|
process.stdout.write("\n");
|
|
142755
143035
|
}
|
|
@@ -142845,7 +143125,7 @@ ${import_chalk13.default.cyan.bold("Screenshot preview")}
|
|
|
142845
143125
|
if (!hadChanges && columns.length <= 0 && indexes.length <= 0) {
|
|
142846
143126
|
if (!tablesChanged.has(table["$id"])) {
|
|
142847
143127
|
this.log(
|
|
142848
|
-
`No changes detected for table ${
|
|
143128
|
+
`No changes detected for table ${import_chalk14.default.bold(table["name"])}. Skipping.`
|
|
142849
143129
|
);
|
|
142850
143130
|
}
|
|
142851
143131
|
continue;
|
|
@@ -143170,7 +143450,7 @@ var pushSettings = async () => {
|
|
|
143170
143450
|
projectName: config2.projectName,
|
|
143171
143451
|
settings: config2.projectSettings
|
|
143172
143452
|
});
|
|
143173
|
-
success2(`Successfully pushed ${
|
|
143453
|
+
success2(`Successfully pushed ${import_chalk14.default.bold("all")} project settings.`);
|
|
143174
143454
|
} catch (e) {
|
|
143175
143455
|
throw e;
|
|
143176
143456
|
}
|
|
@@ -143292,11 +143572,11 @@ var pushSite = async ({
|
|
|
143292
143572
|
error48("No sites were pushed.");
|
|
143293
143573
|
} else if (successfullyDeployed !== successfullyPushed) {
|
|
143294
143574
|
warn(
|
|
143295
|
-
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} sites in ${
|
|
143575
|
+
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} sites in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143296
143576
|
);
|
|
143297
143577
|
} else {
|
|
143298
143578
|
success2(
|
|
143299
|
-
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "site" : "sites"} in ${
|
|
143579
|
+
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "site" : "sites"} in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143300
143580
|
);
|
|
143301
143581
|
}
|
|
143302
143582
|
} else {
|
|
@@ -143427,11 +143707,11 @@ var pushFunction = async ({
|
|
|
143427
143707
|
error48("No functions were pushed.");
|
|
143428
143708
|
} else if (successfullyDeployed !== successfullyPushed) {
|
|
143429
143709
|
warn(
|
|
143430
|
-
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} functions in ${
|
|
143710
|
+
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} functions in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143431
143711
|
);
|
|
143432
143712
|
} else {
|
|
143433
143713
|
success2(
|
|
143434
|
-
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "function" : "functions"} in ${
|
|
143714
|
+
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "function" : "functions"} in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143435
143715
|
);
|
|
143436
143716
|
}
|
|
143437
143717
|
} else {
|
|
@@ -143512,7 +143792,7 @@ var pushTable = async ({
|
|
|
143512
143792
|
log("Found tables that exist remotely but not locally:");
|
|
143513
143793
|
const deletionChanges = tablesToDelete.map((table) => ({
|
|
143514
143794
|
id: table.$id,
|
|
143515
|
-
action:
|
|
143795
|
+
action: import_chalk14.default.red("deleting"),
|
|
143516
143796
|
key: "Table",
|
|
143517
143797
|
database: table.databaseName,
|
|
143518
143798
|
remote: table.name,
|
|
@@ -143900,7 +144180,7 @@ var import_fs17 = __toESM(require("fs"), 1);
|
|
|
143900
144180
|
var import_os7 = __toESM(require("os"), 1);
|
|
143901
144181
|
var import_path16 = __toESM(require("path"), 1);
|
|
143902
144182
|
var import_child_process4 = require("child_process");
|
|
143903
|
-
var
|
|
144183
|
+
var import_chalk15 = __toESM(require_source(), 1);
|
|
143904
144184
|
var import_inquirer8 = __toESM(require_inquirer(), 1);
|
|
143905
144185
|
var { version: version2 } = package_default;
|
|
143906
144186
|
var getStandaloneBinaryArtifactName = () => {
|
|
@@ -143947,7 +144227,9 @@ var quoteShellArgument = (value) => {
|
|
|
143947
144227
|
};
|
|
143948
144228
|
var downloadStandaloneBinary = async (destinationPath) => {
|
|
143949
144229
|
const artifact = getStandaloneBinaryArtifactName();
|
|
143950
|
-
const response = await fetch(
|
|
144230
|
+
const response = await fetch(
|
|
144231
|
+
`${GITHUB_RELEASES_URL}/latest/download/${artifact}`
|
|
144232
|
+
);
|
|
143951
144233
|
if (!response.ok) {
|
|
143952
144234
|
throw new Error(
|
|
143953
144235
|
`Failed to download standalone binary (HTTP ${response.status}).`
|
|
@@ -144064,10 +144346,10 @@ var updateViaStandaloneBinary = async (latestVersion) => {
|
|
|
144064
144346
|
var showManualInstructions = (latestVersion) => {
|
|
144065
144347
|
log("Manual update options:");
|
|
144066
144348
|
console.log("");
|
|
144067
|
-
log(`${
|
|
144349
|
+
log(`${import_chalk15.default.bold("Option 1: NPM")}`);
|
|
144068
144350
|
console.log(` npm install -g ${NPM_PACKAGE_NAME}@latest`);
|
|
144069
144351
|
console.log("");
|
|
144070
|
-
log(`${
|
|
144352
|
+
log(`${import_chalk15.default.bold("Option 2: Homebrew")}`);
|
|
144071
144353
|
console.log(` brew upgrade appwrite`);
|
|
144072
144354
|
console.log("");
|
|
144073
144355
|
if (process.platform !== "win32") {
|
|
@@ -144078,7 +144360,7 @@ var showManualInstructions = (latestVersion) => {
|
|
|
144078
144360
|
throw new Error("Could not determine the standalone binary path.");
|
|
144079
144361
|
}
|
|
144080
144362
|
const tempPath = import_path16.default.join(import_os7.default.tmpdir(), import_path16.default.basename(targetPath));
|
|
144081
|
-
log(`${
|
|
144363
|
+
log(`${import_chalk15.default.bold("Option 3: Install Script / Standalone Binary")}`);
|
|
144082
144364
|
console.log(
|
|
144083
144365
|
` curl -fsSL ${GITHUB_RELEASES_URL}/latest/download/${artifact} -o ${tempPath}`
|
|
144084
144366
|
);
|
|
@@ -144088,7 +144370,7 @@ var showManualInstructions = (latestVersion) => {
|
|
|
144088
144370
|
} catch (_error) {
|
|
144089
144371
|
}
|
|
144090
144372
|
}
|
|
144091
|
-
log(`${
|
|
144373
|
+
log(`${import_chalk15.default.bold("Option 4: Download Binary")}`);
|
|
144092
144374
|
console.log(` Visit: ${GITHUB_RELEASES_URL}/latest`);
|
|
144093
144375
|
};
|
|
144094
144376
|
var chooseUpdateMethod = async (latestVersion) => {
|
|
@@ -144130,24 +144412,22 @@ var chooseUpdateMethod = async (latestVersion) => {
|
|
|
144130
144412
|
var updateCli = async ({ manual } = {}) => {
|
|
144131
144413
|
try {
|
|
144132
144414
|
const installationMethod = detectInstallationMethod();
|
|
144133
|
-
const latestVersion = await getLatestVersionForInstallation(
|
|
144134
|
-
installationMethod
|
|
144135
|
-
);
|
|
144415
|
+
const latestVersion = await getLatestVersionForInstallation(installationMethod);
|
|
144136
144416
|
const comparison = compareVersions(version2, latestVersion);
|
|
144137
144417
|
if (comparison === 0) {
|
|
144138
144418
|
success2(
|
|
144139
|
-
`You're already running the latest version (${
|
|
144419
|
+
`You're already running the latest version (${import_chalk15.default.bold(version2)})!`
|
|
144140
144420
|
);
|
|
144141
144421
|
return;
|
|
144142
144422
|
} else if (comparison < 0) {
|
|
144143
144423
|
warn(
|
|
144144
|
-
`You're running a newer version (${
|
|
144424
|
+
`You're running a newer version (${import_chalk15.default.bold(version2)}) than the latest released version (${import_chalk15.default.bold(latestVersion)}).`
|
|
144145
144425
|
);
|
|
144146
144426
|
hint("This might be a pre-release or development version.");
|
|
144147
144427
|
return;
|
|
144148
144428
|
}
|
|
144149
144429
|
log(
|
|
144150
|
-
`Updating from ${
|
|
144430
|
+
`Updating from ${import_chalk15.default.blue(version2)} to ${import_chalk15.default.green(latestVersion)}...`
|
|
144151
144431
|
);
|
|
144152
144432
|
console.log("");
|
|
144153
144433
|
if (manual) {
|
|
@@ -149100,16 +149380,16 @@ var VERSION_CHECK_TIMEOUT_MS = 5e3;
|
|
|
149100
149380
|
function writeUpdateAvailableNotice(currentVersion, latestVersion, toStderr = false) {
|
|
149101
149381
|
const stream = toStderr ? process.stderr : process.stdout;
|
|
149102
149382
|
stream.write(
|
|
149103
|
-
|
|
149383
|
+
import_chalk16.default.yellow(
|
|
149104
149384
|
`
|
|
149105
|
-
\u26A0\uFE0F A newer version is available: ${
|
|
149385
|
+
\u26A0\uFE0F A newer version is available: ${import_chalk16.default.bold(currentVersion)} ${import_chalk16.default.bold("\u2192")} ${import_chalk16.default.bold(
|
|
149106
149386
|
latestVersion
|
|
149107
149387
|
)}`
|
|
149108
149388
|
) + "\n"
|
|
149109
149389
|
);
|
|
149110
149390
|
stream.write(
|
|
149111
|
-
|
|
149112
|
-
`\u{1F4A1} Run '${
|
|
149391
|
+
import_chalk16.default.cyan(
|
|
149392
|
+
`\u{1F4A1} Run '${import_chalk16.default.bold("appwrite update")}' to update to the latest version.`
|
|
149113
149393
|
) + "\n\n"
|
|
149114
149394
|
);
|
|
149115
149395
|
}
|
|
@@ -149127,7 +149407,7 @@ async function maybeShowUpdateNotice() {
|
|
|
149127
149407
|
}
|
|
149128
149408
|
}
|
|
149129
149409
|
async function checkVersion() {
|
|
149130
|
-
process.stdout.write(
|
|
149410
|
+
process.stdout.write(import_chalk16.default.bold(`appwrite version ${version3}`) + "\n");
|
|
149131
149411
|
try {
|
|
149132
149412
|
const latestVersion = await getLatestVersionForCurrentInstallation({
|
|
149133
149413
|
timeoutMs: VERSION_CHECK_TIMEOUT_MS
|
|
@@ -149137,12 +149417,12 @@ async function checkVersion() {
|
|
|
149137
149417
|
if (comparison > 0) {
|
|
149138
149418
|
writeUpdateAvailableNotice(version3, latestVersion);
|
|
149139
149419
|
} else if (comparison === 0) {
|
|
149140
|
-
process.stdout.write(
|
|
149420
|
+
process.stdout.write(import_chalk16.default.green("\n\u2705 You are running the latest version!") + "\n");
|
|
149141
149421
|
} else {
|
|
149142
|
-
process.stdout.write(
|
|
149422
|
+
process.stdout.write(import_chalk16.default.blue("\n\u{1F680} You are running a pre-release or development version.") + "\n");
|
|
149143
149423
|
}
|
|
149144
149424
|
} catch (_error) {
|
|
149145
|
-
process.stdout.write(
|
|
149425
|
+
process.stdout.write(import_chalk16.default.gray("\n(Unable to check for updates)") + "\n");
|
|
149146
149426
|
}
|
|
149147
149427
|
}
|
|
149148
149428
|
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|