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
|
@@ -4085,14 +4085,14 @@ var require_templates = __commonJS({
|
|
|
4085
4085
|
}
|
|
4086
4086
|
return results;
|
|
4087
4087
|
}
|
|
4088
|
-
function buildStyle(
|
|
4088
|
+
function buildStyle(chalk17, styles) {
|
|
4089
4089
|
const enabled = {};
|
|
4090
4090
|
for (const layer of styles) {
|
|
4091
4091
|
for (const style of layer.styles) {
|
|
4092
4092
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
4093
4093
|
}
|
|
4094
4094
|
}
|
|
4095
|
-
let current =
|
|
4095
|
+
let current = chalk17;
|
|
4096
4096
|
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
4097
4097
|
if (!Array.isArray(styles2)) {
|
|
4098
4098
|
continue;
|
|
@@ -4104,7 +4104,7 @@ var require_templates = __commonJS({
|
|
|
4104
4104
|
}
|
|
4105
4105
|
return current;
|
|
4106
4106
|
}
|
|
4107
|
-
module.exports = (
|
|
4107
|
+
module.exports = (chalk17, temporary) => {
|
|
4108
4108
|
const styles = [];
|
|
4109
4109
|
const chunks = [];
|
|
4110
4110
|
let chunk = [];
|
|
@@ -4114,13 +4114,13 @@ var require_templates = __commonJS({
|
|
|
4114
4114
|
} else if (style) {
|
|
4115
4115
|
const string4 = chunk.join("");
|
|
4116
4116
|
chunk = [];
|
|
4117
|
-
chunks.push(styles.length === 0 ? string4 : buildStyle(
|
|
4117
|
+
chunks.push(styles.length === 0 ? string4 : buildStyle(chalk17, styles)(string4));
|
|
4118
4118
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
4119
4119
|
} else if (close) {
|
|
4120
4120
|
if (styles.length === 0) {
|
|
4121
4121
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
4122
4122
|
}
|
|
4123
|
-
chunks.push(buildStyle(
|
|
4123
|
+
chunks.push(buildStyle(chalk17, styles)(chunk.join("")));
|
|
4124
4124
|
chunk = [];
|
|
4125
4125
|
styles.pop();
|
|
4126
4126
|
} else {
|
|
@@ -4168,16 +4168,16 @@ var require_source = __commonJS({
|
|
|
4168
4168
|
}
|
|
4169
4169
|
};
|
|
4170
4170
|
var chalkFactory = (options) => {
|
|
4171
|
-
const
|
|
4172
|
-
applyOptions(
|
|
4173
|
-
|
|
4174
|
-
Object.setPrototypeOf(
|
|
4175
|
-
Object.setPrototypeOf(
|
|
4176
|
-
|
|
4171
|
+
const chalk18 = {};
|
|
4172
|
+
applyOptions(chalk18, options);
|
|
4173
|
+
chalk18.template = (...arguments_) => chalkTag(chalk18.template, ...arguments_);
|
|
4174
|
+
Object.setPrototypeOf(chalk18, Chalk.prototype);
|
|
4175
|
+
Object.setPrototypeOf(chalk18.template, chalk18);
|
|
4176
|
+
chalk18.template.constructor = () => {
|
|
4177
4177
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
4178
4178
|
};
|
|
4179
|
-
|
|
4180
|
-
return
|
|
4179
|
+
chalk18.template.Instance = ChalkClass;
|
|
4180
|
+
return chalk18.template;
|
|
4181
4181
|
};
|
|
4182
4182
|
function Chalk(options) {
|
|
4183
4183
|
return chalkFactory(options);
|
|
@@ -4288,7 +4288,7 @@ var require_source = __commonJS({
|
|
|
4288
4288
|
return openAll + string4 + closeAll;
|
|
4289
4289
|
};
|
|
4290
4290
|
var template;
|
|
4291
|
-
var chalkTag = (
|
|
4291
|
+
var chalkTag = (chalk18, ...strings) => {
|
|
4292
4292
|
const [firstString] = strings;
|
|
4293
4293
|
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
4294
4294
|
return strings.join(" ");
|
|
@@ -4304,14 +4304,14 @@ var require_source = __commonJS({
|
|
|
4304
4304
|
if (template === void 0) {
|
|
4305
4305
|
template = require_templates();
|
|
4306
4306
|
}
|
|
4307
|
-
return template(
|
|
4307
|
+
return template(chalk18, parts.join(""));
|
|
4308
4308
|
};
|
|
4309
4309
|
Object.defineProperties(Chalk.prototype, styles);
|
|
4310
|
-
var
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
module.exports =
|
|
4310
|
+
var chalk17 = Chalk();
|
|
4311
|
+
chalk17.supportsColor = stdoutColor;
|
|
4312
|
+
chalk17.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
4313
|
+
chalk17.stderr.supportsColor = stderrColor;
|
|
4314
|
+
module.exports = chalk17;
|
|
4315
4315
|
}
|
|
4316
4316
|
});
|
|
4317
4317
|
|
|
@@ -4479,12 +4479,12 @@ var require_figures = __commonJS({
|
|
|
4479
4479
|
var require_separator = __commonJS({
|
|
4480
4480
|
"node_modules/inquirer/lib/objects/separator.js"(exports, module) {
|
|
4481
4481
|
"use strict";
|
|
4482
|
-
var
|
|
4482
|
+
var chalk17 = require_source();
|
|
4483
4483
|
var figures = require_figures();
|
|
4484
4484
|
var Separator = class {
|
|
4485
4485
|
constructor(line) {
|
|
4486
4486
|
this.type = "separator";
|
|
4487
|
-
this.line =
|
|
4487
|
+
this.line = chalk17.dim(line || new Array(15).join(figures.line));
|
|
4488
4488
|
}
|
|
4489
4489
|
/**
|
|
4490
4490
|
* Stringify separator
|
|
@@ -20554,19 +20554,19 @@ var require_is_unicode_supported = __commonJS({
|
|
|
20554
20554
|
var require_log_symbols = __commonJS({
|
|
20555
20555
|
"node_modules/log-symbols/index.js"(exports, module) {
|
|
20556
20556
|
"use strict";
|
|
20557
|
-
var
|
|
20557
|
+
var chalk17 = require_source();
|
|
20558
20558
|
var isUnicodeSupported = require_is_unicode_supported();
|
|
20559
20559
|
var main = {
|
|
20560
|
-
info:
|
|
20561
|
-
success:
|
|
20562
|
-
warning:
|
|
20563
|
-
error:
|
|
20560
|
+
info: chalk17.blue("\u2139"),
|
|
20561
|
+
success: chalk17.green("\u2714"),
|
|
20562
|
+
warning: chalk17.yellow("\u26A0"),
|
|
20563
|
+
error: chalk17.red("\u2716")
|
|
20564
20564
|
};
|
|
20565
20565
|
var fallback = {
|
|
20566
|
-
info:
|
|
20567
|
-
success:
|
|
20568
|
-
warning:
|
|
20569
|
-
error:
|
|
20566
|
+
info: chalk17.blue("i"),
|
|
20567
|
+
success: chalk17.green("\u221A"),
|
|
20568
|
+
warning: chalk17.yellow("\u203C"),
|
|
20569
|
+
error: chalk17.red("\xD7")
|
|
20570
20570
|
};
|
|
20571
20571
|
module.exports = isUnicodeSupported() ? main : fallback;
|
|
20572
20572
|
}
|
|
@@ -24034,7 +24034,7 @@ var require_ora = __commonJS({
|
|
|
24034
24034
|
"node_modules/ora/index.js"(exports, module) {
|
|
24035
24035
|
"use strict";
|
|
24036
24036
|
var readline2 = __require("readline");
|
|
24037
|
-
var
|
|
24037
|
+
var chalk17 = require_source();
|
|
24038
24038
|
var cliCursor = require_cli_cursor();
|
|
24039
24039
|
var cliSpinners = require_cli_spinners();
|
|
24040
24040
|
var logSymbols = require_log_symbols();
|
|
@@ -24231,7 +24231,7 @@ var require_ora = __commonJS({
|
|
|
24231
24231
|
const { frames } = this.spinner;
|
|
24232
24232
|
let frame = frames[this.frameIndex];
|
|
24233
24233
|
if (this.color) {
|
|
24234
|
-
frame =
|
|
24234
|
+
frame = chalk17[this.color](frame);
|
|
24235
24235
|
}
|
|
24236
24236
|
this.frameIndex = ++this.frameIndex % frames.length;
|
|
24237
24237
|
const fullPrefixText = typeof this.prefixText === "string" && this.prefixText !== "" ? this.prefixText + " " : "";
|
|
@@ -24484,7 +24484,7 @@ var require_base = __commonJS({
|
|
|
24484
24484
|
defaults: require_defaults(),
|
|
24485
24485
|
clone: require_clone()
|
|
24486
24486
|
};
|
|
24487
|
-
var
|
|
24487
|
+
var chalk17 = require_source();
|
|
24488
24488
|
var runAsync = require_run_async();
|
|
24489
24489
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
24490
24490
|
var Choices = require_choices();
|
|
@@ -24502,7 +24502,7 @@ var require_base = __commonJS({
|
|
|
24502
24502
|
filteringText: "",
|
|
24503
24503
|
when: () => true,
|
|
24504
24504
|
suffix: "",
|
|
24505
|
-
prefix:
|
|
24505
|
+
prefix: chalk17.green("?")
|
|
24506
24506
|
});
|
|
24507
24507
|
if (!this.opt.name) {
|
|
24508
24508
|
this.throwParamError("name");
|
|
@@ -24603,12 +24603,12 @@ var require_base = __commonJS({
|
|
|
24603
24603
|
* @return {String} prompt question string
|
|
24604
24604
|
*/
|
|
24605
24605
|
getQuestion() {
|
|
24606
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
24606
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk17.bold(this.opt.message) + this.opt.suffix + chalk17.reset(" ");
|
|
24607
24607
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
24608
24608
|
if (this.opt.type === "password") {
|
|
24609
|
-
message +=
|
|
24609
|
+
message += chalk17.italic.dim("[hidden] ");
|
|
24610
24610
|
} else {
|
|
24611
|
-
message +=
|
|
24611
|
+
message += chalk17.dim("(" + this.opt.default + ") ");
|
|
24612
24612
|
}
|
|
24613
24613
|
}
|
|
24614
24614
|
return message;
|
|
@@ -24670,7 +24670,7 @@ var require_events = __commonJS({
|
|
|
24670
24670
|
var require_paginator = __commonJS({
|
|
24671
24671
|
"node_modules/inquirer/lib/utils/paginator.js"(exports, module) {
|
|
24672
24672
|
"use strict";
|
|
24673
|
-
var
|
|
24673
|
+
var chalk17 = require_source();
|
|
24674
24674
|
var Paginator = class {
|
|
24675
24675
|
/**
|
|
24676
24676
|
* @param {import("./screen-manager")} [screen]
|
|
@@ -24695,7 +24695,7 @@ var require_paginator = __commonJS({
|
|
|
24695
24695
|
}
|
|
24696
24696
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
24697
24697
|
this.lastIndex = active;
|
|
24698
|
-
return visibleLines.join("\n") + "\n" +
|
|
24698
|
+
return visibleLines.join("\n") + "\n" + chalk17.dim("(Move up and down to reveal more choices)");
|
|
24699
24699
|
}
|
|
24700
24700
|
getInfiniteLines(lines, active, pageSize) {
|
|
24701
24701
|
if (this.pointer === void 0) {
|
|
@@ -24751,7 +24751,7 @@ var require_incrementListIndex = __commonJS({
|
|
|
24751
24751
|
var require_list = __commonJS({
|
|
24752
24752
|
"node_modules/inquirer/lib/prompts/list.js"(exports, module) {
|
|
24753
24753
|
"use strict";
|
|
24754
|
-
var
|
|
24754
|
+
var chalk17 = require_source();
|
|
24755
24755
|
var figures = require_figures();
|
|
24756
24756
|
var cliCursor = require_cli_cursor();
|
|
24757
24757
|
var runAsync = require_run_async();
|
|
@@ -24809,10 +24809,10 @@ var require_list = __commonJS({
|
|
|
24809
24809
|
render() {
|
|
24810
24810
|
let message = this.getQuestion();
|
|
24811
24811
|
if (this.firstRender) {
|
|
24812
|
-
message +=
|
|
24812
|
+
message += chalk17.dim("(Use arrow keys)");
|
|
24813
24813
|
}
|
|
24814
24814
|
if (this.status === "answered") {
|
|
24815
|
-
message +=
|
|
24815
|
+
message += chalk17.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
24816
24816
|
} else {
|
|
24817
24817
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
24818
24818
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -24887,7 +24887,7 @@ var require_list = __commonJS({
|
|
|
24887
24887
|
const isSelected = i - separatorOffset === pointer;
|
|
24888
24888
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
24889
24889
|
if (isSelected) {
|
|
24890
|
-
line =
|
|
24890
|
+
line = chalk17.cyan(line);
|
|
24891
24891
|
}
|
|
24892
24892
|
output += line + " \n";
|
|
24893
24893
|
});
|
|
@@ -24901,7 +24901,7 @@ var require_list = __commonJS({
|
|
|
24901
24901
|
var require_input = __commonJS({
|
|
24902
24902
|
"node_modules/inquirer/lib/prompts/input.js"(exports, module) {
|
|
24903
24903
|
"use strict";
|
|
24904
|
-
var
|
|
24904
|
+
var chalk17 = require_source();
|
|
24905
24905
|
var { map: map2, takeUntil } = require_operators();
|
|
24906
24906
|
var Base = require_base();
|
|
24907
24907
|
var observe = require_events();
|
|
@@ -24940,10 +24940,10 @@ var require_input = __commonJS({
|
|
|
24940
24940
|
if (transformer) {
|
|
24941
24941
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
24942
24942
|
} else {
|
|
24943
|
-
message += isFinal ?
|
|
24943
|
+
message += isFinal ? chalk17.cyan(appendContent) : appendContent;
|
|
24944
24944
|
}
|
|
24945
24945
|
if (error49) {
|
|
24946
|
-
bottomContent =
|
|
24946
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
24947
24947
|
}
|
|
24948
24948
|
this.screen.render(message, bottomContent);
|
|
24949
24949
|
}
|
|
@@ -25005,7 +25005,7 @@ var require_number = __commonJS({
|
|
|
25005
25005
|
var require_confirm = __commonJS({
|
|
25006
25006
|
"node_modules/inquirer/lib/prompts/confirm.js"(exports, module) {
|
|
25007
25007
|
"use strict";
|
|
25008
|
-
var
|
|
25008
|
+
var chalk17 = require_source();
|
|
25009
25009
|
var { take, takeUntil } = require_operators();
|
|
25010
25010
|
var Base = require_base();
|
|
25011
25011
|
var observe = require_events();
|
|
@@ -25047,7 +25047,7 @@ var require_confirm = __commonJS({
|
|
|
25047
25047
|
render(answer) {
|
|
25048
25048
|
let message = this.getQuestion();
|
|
25049
25049
|
if (typeof answer === "boolean") {
|
|
25050
|
-
message +=
|
|
25050
|
+
message += chalk17.cyan(answer ? "Yes" : "No");
|
|
25051
25051
|
} else {
|
|
25052
25052
|
message += this.rl.line;
|
|
25053
25053
|
}
|
|
@@ -25079,7 +25079,7 @@ var require_confirm = __commonJS({
|
|
|
25079
25079
|
var require_rawlist = __commonJS({
|
|
25080
25080
|
"node_modules/inquirer/lib/prompts/rawlist.js"(exports, module) {
|
|
25081
25081
|
"use strict";
|
|
25082
|
-
var
|
|
25082
|
+
var chalk17 = require_source();
|
|
25083
25083
|
var { map: map2, takeUntil } = require_operators();
|
|
25084
25084
|
var Base = require_base();
|
|
25085
25085
|
var Separator = require_separator();
|
|
@@ -25142,7 +25142,7 @@ var require_rawlist = __commonJS({
|
|
|
25142
25142
|
let message = this.getQuestion();
|
|
25143
25143
|
let bottomContent = "";
|
|
25144
25144
|
if (this.status === "answered") {
|
|
25145
|
-
message +=
|
|
25145
|
+
message += chalk17.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
25146
25146
|
} else {
|
|
25147
25147
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
25148
25148
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -25150,7 +25150,7 @@ var require_rawlist = __commonJS({
|
|
|
25150
25150
|
}
|
|
25151
25151
|
message += this.rl.line;
|
|
25152
25152
|
if (error49) {
|
|
25153
|
-
bottomContent = "\n" +
|
|
25153
|
+
bottomContent = "\n" + chalk17.red(">> ") + error49;
|
|
25154
25154
|
}
|
|
25155
25155
|
this.screen.render(message, bottomContent);
|
|
25156
25156
|
}
|
|
@@ -25233,7 +25233,7 @@ var require_rawlist = __commonJS({
|
|
|
25233
25233
|
const index = i - separatorOffset;
|
|
25234
25234
|
let display = index + 1 + ") " + choice.name;
|
|
25235
25235
|
if (index === pointer) {
|
|
25236
|
-
display =
|
|
25236
|
+
display = chalk17.cyan(display);
|
|
25237
25237
|
}
|
|
25238
25238
|
output += display;
|
|
25239
25239
|
});
|
|
@@ -25247,7 +25247,7 @@ var require_rawlist = __commonJS({
|
|
|
25247
25247
|
var require_expand2 = __commonJS({
|
|
25248
25248
|
"node_modules/inquirer/lib/prompts/expand.js"(exports, module) {
|
|
25249
25249
|
"use strict";
|
|
25250
|
-
var
|
|
25250
|
+
var chalk17 = require_source();
|
|
25251
25251
|
var { map: map2, takeUntil } = require_operators();
|
|
25252
25252
|
var Base = require_base();
|
|
25253
25253
|
var Separator = require_separator();
|
|
@@ -25299,7 +25299,7 @@ var require_expand2 = __commonJS({
|
|
|
25299
25299
|
let message = this.getQuestion();
|
|
25300
25300
|
let bottomContent = "";
|
|
25301
25301
|
if (this.status === "answered") {
|
|
25302
|
-
message +=
|
|
25302
|
+
message += chalk17.cyan(this.answer);
|
|
25303
25303
|
} else if (this.status === "expanded") {
|
|
25304
25304
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
25305
25305
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -25307,10 +25307,10 @@ var require_expand2 = __commonJS({
|
|
|
25307
25307
|
}
|
|
25308
25308
|
message += this.rl.line;
|
|
25309
25309
|
if (error49) {
|
|
25310
|
-
bottomContent =
|
|
25310
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
25311
25311
|
}
|
|
25312
25312
|
if (hint2) {
|
|
25313
|
-
bottomContent =
|
|
25313
|
+
bottomContent = chalk17.cyan(">> ") + hint2;
|
|
25314
25314
|
}
|
|
25315
25315
|
this.screen.render(message, bottomContent);
|
|
25316
25316
|
}
|
|
@@ -25338,7 +25338,7 @@ var require_expand2 = __commonJS({
|
|
|
25338
25338
|
}
|
|
25339
25339
|
let choiceStr = choice.key + ") " + choice.name;
|
|
25340
25340
|
if (this.selectedKey === choice.key) {
|
|
25341
|
-
choiceStr =
|
|
25341
|
+
choiceStr = chalk17.cyan(choiceStr);
|
|
25342
25342
|
}
|
|
25343
25343
|
output += choiceStr;
|
|
25344
25344
|
});
|
|
@@ -25440,7 +25440,7 @@ var require_expand2 = __commonJS({
|
|
|
25440
25440
|
}
|
|
25441
25441
|
let choiceStr = choice.key + ") " + choice.name;
|
|
25442
25442
|
if (pointer === choice.key) {
|
|
25443
|
-
choiceStr =
|
|
25443
|
+
choiceStr = chalk17.cyan(choiceStr);
|
|
25444
25444
|
}
|
|
25445
25445
|
output += choiceStr;
|
|
25446
25446
|
});
|
|
@@ -25454,7 +25454,7 @@ var require_expand2 = __commonJS({
|
|
|
25454
25454
|
var require_checkbox = __commonJS({
|
|
25455
25455
|
"node_modules/inquirer/lib/prompts/checkbox.js"(exports, module) {
|
|
25456
25456
|
"use strict";
|
|
25457
|
-
var
|
|
25457
|
+
var chalk17 = require_source();
|
|
25458
25458
|
var cliCursor = require_cli_cursor();
|
|
25459
25459
|
var figures = require_figures();
|
|
25460
25460
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -25512,10 +25512,10 @@ var require_checkbox = __commonJS({
|
|
|
25512
25512
|
let message = this.getQuestion();
|
|
25513
25513
|
let bottomContent = "";
|
|
25514
25514
|
if (!this.dontShowHints) {
|
|
25515
|
-
message += "(Press " +
|
|
25515
|
+
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)";
|
|
25516
25516
|
}
|
|
25517
25517
|
if (this.status === "answered") {
|
|
25518
|
-
message +=
|
|
25518
|
+
message += chalk17.cyan(this.selection.join(", "));
|
|
25519
25519
|
} else {
|
|
25520
25520
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
25521
25521
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -25538,7 +25538,7 @@ var require_checkbox = __commonJS({
|
|
|
25538
25538
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
25539
25539
|
}
|
|
25540
25540
|
if (error49) {
|
|
25541
|
-
bottomContent =
|
|
25541
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
25542
25542
|
}
|
|
25543
25543
|
this.screen.render(message, bottomContent);
|
|
25544
25544
|
}
|
|
@@ -25624,7 +25624,7 @@ var require_checkbox = __commonJS({
|
|
|
25624
25624
|
} else {
|
|
25625
25625
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
25626
25626
|
if (i - separatorOffset === pointer) {
|
|
25627
|
-
output +=
|
|
25627
|
+
output += chalk17.cyan(figures.pointer + line);
|
|
25628
25628
|
} else {
|
|
25629
25629
|
output += " " + line;
|
|
25630
25630
|
}
|
|
@@ -25634,7 +25634,7 @@ var require_checkbox = __commonJS({
|
|
|
25634
25634
|
return output.replace(/\n$/, "");
|
|
25635
25635
|
}
|
|
25636
25636
|
function getCheckbox(checked) {
|
|
25637
|
-
return checked ?
|
|
25637
|
+
return checked ? chalk17.green(figures.radioOn) : figures.radioOff;
|
|
25638
25638
|
}
|
|
25639
25639
|
module.exports = CheckboxPrompt;
|
|
25640
25640
|
}
|
|
@@ -25644,7 +25644,7 @@ var require_checkbox = __commonJS({
|
|
|
25644
25644
|
var require_password = __commonJS({
|
|
25645
25645
|
"node_modules/inquirer/lib/prompts/password.js"(exports, module) {
|
|
25646
25646
|
"use strict";
|
|
25647
|
-
var
|
|
25647
|
+
var chalk17 = require_source();
|
|
25648
25648
|
var { map: map2, takeUntil } = require_operators();
|
|
25649
25649
|
var Base = require_base();
|
|
25650
25650
|
var observe = require_events();
|
|
@@ -25686,15 +25686,15 @@ var require_password = __commonJS({
|
|
|
25686
25686
|
message += this.getMaskedValue(this.rl.line || "");
|
|
25687
25687
|
}
|
|
25688
25688
|
if (error49) {
|
|
25689
|
-
bottomContent = "\n" +
|
|
25689
|
+
bottomContent = "\n" + chalk17.red(">> ") + error49;
|
|
25690
25690
|
}
|
|
25691
25691
|
this.screen.render(message, bottomContent);
|
|
25692
25692
|
}
|
|
25693
25693
|
getMaskedValue(value) {
|
|
25694
25694
|
if (this.status === "answered") {
|
|
25695
|
-
return this.opt.mask ?
|
|
25695
|
+
return this.opt.mask ? chalk17.cyan(mask(value, this.opt.mask)) : chalk17.italic.dim("[hidden]");
|
|
25696
25696
|
}
|
|
25697
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
25697
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk17.italic.dim("[input is hidden] ");
|
|
25698
25698
|
}
|
|
25699
25699
|
/**
|
|
25700
25700
|
* Mask value during async filter/validation.
|
|
@@ -35416,7 +35416,7 @@ var require_commonjs = __commonJS({
|
|
|
35416
35416
|
var require_editor = __commonJS({
|
|
35417
35417
|
"node_modules/inquirer/lib/prompts/editor.js"(exports, module) {
|
|
35418
35418
|
"use strict";
|
|
35419
|
-
var
|
|
35419
|
+
var chalk17 = require_source();
|
|
35420
35420
|
var { editAsync } = require_commonjs();
|
|
35421
35421
|
var Base = require_base();
|
|
35422
35422
|
var observe = require_events();
|
|
@@ -35448,12 +35448,12 @@ var require_editor = __commonJS({
|
|
|
35448
35448
|
let bottomContent = "";
|
|
35449
35449
|
let message = this.getQuestion();
|
|
35450
35450
|
if (this.status === "answered") {
|
|
35451
|
-
message +=
|
|
35451
|
+
message += chalk17.dim("Received");
|
|
35452
35452
|
} else {
|
|
35453
|
-
message +=
|
|
35453
|
+
message += chalk17.dim("Press <enter> to launch your preferred editor.");
|
|
35454
35454
|
}
|
|
35455
35455
|
if (error49) {
|
|
35456
|
-
bottomContent =
|
|
35456
|
+
bottomContent = chalk17.red(">> ") + error49;
|
|
35457
35457
|
}
|
|
35458
35458
|
this.screen.render(message, bottomContent);
|
|
35459
35459
|
}
|
|
@@ -45878,14 +45878,14 @@ var require_templates2 = __commonJS({
|
|
|
45878
45878
|
}
|
|
45879
45879
|
return results;
|
|
45880
45880
|
}
|
|
45881
|
-
function buildStyle(
|
|
45881
|
+
function buildStyle(chalk17, styles) {
|
|
45882
45882
|
const enabled = {};
|
|
45883
45883
|
for (const layer of styles) {
|
|
45884
45884
|
for (const style of layer.styles) {
|
|
45885
45885
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
45886
45886
|
}
|
|
45887
45887
|
}
|
|
45888
|
-
let current =
|
|
45888
|
+
let current = chalk17;
|
|
45889
45889
|
for (const styleName of Object.keys(enabled)) {
|
|
45890
45890
|
if (Array.isArray(enabled[styleName])) {
|
|
45891
45891
|
if (!(styleName in current)) {
|
|
@@ -45900,7 +45900,7 @@ var require_templates2 = __commonJS({
|
|
|
45900
45900
|
}
|
|
45901
45901
|
return current;
|
|
45902
45902
|
}
|
|
45903
|
-
module.exports = (
|
|
45903
|
+
module.exports = (chalk17, tmp) => {
|
|
45904
45904
|
const styles = [];
|
|
45905
45905
|
const chunks = [];
|
|
45906
45906
|
let chunk = [];
|
|
@@ -45910,13 +45910,13 @@ var require_templates2 = __commonJS({
|
|
|
45910
45910
|
} else if (style) {
|
|
45911
45911
|
const str = chunk.join("");
|
|
45912
45912
|
chunk = [];
|
|
45913
|
-
chunks.push(styles.length === 0 ? str : buildStyle(
|
|
45913
|
+
chunks.push(styles.length === 0 ? str : buildStyle(chalk17, styles)(str));
|
|
45914
45914
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
45915
45915
|
} else if (close) {
|
|
45916
45916
|
if (styles.length === 0) {
|
|
45917
45917
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
45918
45918
|
}
|
|
45919
|
-
chunks.push(buildStyle(
|
|
45919
|
+
chunks.push(buildStyle(chalk17, styles)(chunk.join("")));
|
|
45920
45920
|
chunk = [];
|
|
45921
45921
|
styles.pop();
|
|
45922
45922
|
} else {
|
|
@@ -45953,16 +45953,16 @@ var require_chalk = __commonJS({
|
|
|
45953
45953
|
}
|
|
45954
45954
|
function Chalk(options) {
|
|
45955
45955
|
if (!this || !(this instanceof Chalk) || this.template) {
|
|
45956
|
-
const
|
|
45957
|
-
applyOptions(
|
|
45958
|
-
|
|
45956
|
+
const chalk17 = {};
|
|
45957
|
+
applyOptions(chalk17, options);
|
|
45958
|
+
chalk17.template = function() {
|
|
45959
45959
|
const args = [].slice.call(arguments);
|
|
45960
|
-
return chalkTag.apply(null, [
|
|
45960
|
+
return chalkTag.apply(null, [chalk17.template].concat(args));
|
|
45961
45961
|
};
|
|
45962
|
-
Object.setPrototypeOf(
|
|
45963
|
-
Object.setPrototypeOf(
|
|
45964
|
-
|
|
45965
|
-
return
|
|
45962
|
+
Object.setPrototypeOf(chalk17, Chalk.prototype);
|
|
45963
|
+
Object.setPrototypeOf(chalk17.template, chalk17);
|
|
45964
|
+
chalk17.template.constructor = Chalk;
|
|
45965
|
+
return chalk17.template;
|
|
45966
45966
|
}
|
|
45967
45967
|
applyOptions(this, options);
|
|
45968
45968
|
}
|
|
@@ -46081,7 +46081,7 @@ var require_chalk = __commonJS({
|
|
|
46081
46081
|
ansiStyles.dim.open = originalDim;
|
|
46082
46082
|
return str;
|
|
46083
46083
|
}
|
|
46084
|
-
function chalkTag(
|
|
46084
|
+
function chalkTag(chalk17, strings) {
|
|
46085
46085
|
if (!Array.isArray(strings)) {
|
|
46086
46086
|
return [].slice.call(arguments, 1).join(" ");
|
|
46087
46087
|
}
|
|
@@ -46091,7 +46091,7 @@ var require_chalk = __commonJS({
|
|
|
46091
46091
|
parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
|
46092
46092
|
parts.push(String(strings.raw[i]));
|
|
46093
46093
|
}
|
|
46094
|
-
return template(
|
|
46094
|
+
return template(chalk17, parts.join(""));
|
|
46095
46095
|
}
|
|
46096
46096
|
Object.defineProperties(Chalk.prototype, styles);
|
|
46097
46097
|
module.exports = Chalk();
|
|
@@ -46260,11 +46260,11 @@ var require_figures2 = __commonJS({
|
|
|
46260
46260
|
var require_separator2 = __commonJS({
|
|
46261
46261
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/objects/separator.js"(exports, module) {
|
|
46262
46262
|
"use strict";
|
|
46263
|
-
var
|
|
46263
|
+
var chalk17 = require_chalk();
|
|
46264
46264
|
var figures = require_figures2();
|
|
46265
46265
|
var Separator = module.exports = function(line) {
|
|
46266
46266
|
this.type = "separator";
|
|
46267
|
-
this.line =
|
|
46267
|
+
this.line = chalk17.dim(line || new Array(15).join(figures.line));
|
|
46268
46268
|
};
|
|
46269
46269
|
Separator.exclude = function(obj) {
|
|
46270
46270
|
return obj.type !== "separator";
|
|
@@ -46738,7 +46738,7 @@ var require_screen_manager2 = __commonJS({
|
|
|
46738
46738
|
var require_base2 = __commonJS({
|
|
46739
46739
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/prompts/base.js"(exports, module) {
|
|
46740
46740
|
var _2 = require_lodash();
|
|
46741
|
-
var
|
|
46741
|
+
var chalk17 = require_chalk();
|
|
46742
46742
|
var runAsync = require_run_async();
|
|
46743
46743
|
var Choices = require_choices2();
|
|
46744
46744
|
var ScreenManager = require_screen_manager2();
|
|
@@ -46758,7 +46758,7 @@ var require_base2 = __commonJS({
|
|
|
46758
46758
|
return true;
|
|
46759
46759
|
},
|
|
46760
46760
|
suffix: "",
|
|
46761
|
-
prefix:
|
|
46761
|
+
prefix: chalk17.green("?")
|
|
46762
46762
|
});
|
|
46763
46763
|
if (!this.opt.message) {
|
|
46764
46764
|
this.throwParamError("message");
|
|
@@ -46815,9 +46815,9 @@ var require_base2 = __commonJS({
|
|
|
46815
46815
|
};
|
|
46816
46816
|
};
|
|
46817
46817
|
Prompt.prototype.getQuestion = function() {
|
|
46818
|
-
var message = this.opt.prefix + " " +
|
|
46818
|
+
var message = this.opt.prefix + " " + chalk17.bold(this.opt.message) + this.opt.suffix + chalk17.reset(" ");
|
|
46819
46819
|
if (this.opt.default != null && this.status !== "answered") {
|
|
46820
|
-
message +=
|
|
46820
|
+
message += chalk17.dim("(" + this.opt.default + ") ");
|
|
46821
46821
|
}
|
|
46822
46822
|
return message;
|
|
46823
46823
|
};
|
|
@@ -53508,7 +53508,7 @@ var require_paginator2 = __commonJS({
|
|
|
53508
53508
|
"node_modules/inquirer-search-list/node_modules/inquirer/lib/utils/paginator.js"(exports, module) {
|
|
53509
53509
|
"use strict";
|
|
53510
53510
|
var _2 = require_lodash();
|
|
53511
|
-
var
|
|
53511
|
+
var chalk17 = require_chalk();
|
|
53512
53512
|
var Paginator = module.exports = function() {
|
|
53513
53513
|
this.pointer = 0;
|
|
53514
53514
|
this.lastIndex = 0;
|
|
@@ -53527,7 +53527,7 @@ var require_paginator2 = __commonJS({
|
|
|
53527
53527
|
var infinite = _2.flatten([lines, lines, lines]);
|
|
53528
53528
|
var topIndex = Math.max(0, active + lines.length - this.pointer);
|
|
53529
53529
|
var section = infinite.splice(topIndex, pageSize).join("\n");
|
|
53530
|
-
return section + "\n" +
|
|
53530
|
+
return section + "\n" + chalk17.dim("(Move up and down to reveal more choices)");
|
|
53531
53531
|
};
|
|
53532
53532
|
}
|
|
53533
53533
|
});
|
|
@@ -87722,7 +87722,7 @@ var {
|
|
|
87722
87722
|
} = import_index.default;
|
|
87723
87723
|
|
|
87724
87724
|
// cli.ts
|
|
87725
|
-
var
|
|
87725
|
+
var import_chalk16 = __toESM(require_source(), 1);
|
|
87726
87726
|
var import_inquirer9 = __toESM(require_inquirer(), 1);
|
|
87727
87727
|
|
|
87728
87728
|
// package.json
|
|
@@ -87731,7 +87731,7 @@ var package_default = {
|
|
|
87731
87731
|
type: "module",
|
|
87732
87732
|
homepage: "https://appwrite.io/support",
|
|
87733
87733
|
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",
|
|
87734
|
-
version: "18.
|
|
87734
|
+
version: "18.2.0",
|
|
87735
87735
|
license: "BSD-3-Clause",
|
|
87736
87736
|
main: "dist/index.cjs",
|
|
87737
87737
|
module: "dist/index.js",
|
|
@@ -102041,7 +102041,7 @@ import childProcess from "child_process";
|
|
|
102041
102041
|
// lib/constants.ts
|
|
102042
102042
|
var SDK_TITLE = "Appwrite";
|
|
102043
102043
|
var SDK_TITLE_LOWER = "appwrite";
|
|
102044
|
-
var SDK_VERSION = "18.
|
|
102044
|
+
var SDK_VERSION = "18.2.0";
|
|
102045
102045
|
var SDK_NAME = "Command Line";
|
|
102046
102046
|
var SDK_PLATFORM = "console";
|
|
102047
102047
|
var SDK_LANGUAGE = "cli";
|
|
@@ -102063,6 +102063,7 @@ var CONFIG_RESOURCE_KEYS = [
|
|
|
102063
102063
|
"tablesDB",
|
|
102064
102064
|
"tables",
|
|
102065
102065
|
"teams",
|
|
102066
|
+
"webhooks",
|
|
102066
102067
|
"collections"
|
|
102067
102068
|
];
|
|
102068
102069
|
var TOP_LEVEL_RESOURCE_ARRAY_KEYS = new Set(
|
|
@@ -102353,7 +102354,10 @@ var getCacheForVersionSource = (cache, source) => {
|
|
|
102353
102354
|
var syncVersionCheckCache = (currentVersion, latestVersion) => {
|
|
102354
102355
|
const now = getCurrentTimestamp();
|
|
102355
102356
|
const source = getLatestVersionSource();
|
|
102356
|
-
const existingCache = getCacheForVersionSource(
|
|
102357
|
+
const existingCache = getCacheForVersionSource(
|
|
102358
|
+
readUpdateCheckCache(),
|
|
102359
|
+
source
|
|
102360
|
+
);
|
|
102357
102361
|
const updateAvailable = compareVersions(currentVersion, latestVersion) > 0;
|
|
102358
102362
|
tryWriteUpdateCheckCache({
|
|
102359
102363
|
checkedAt: now,
|
|
@@ -130601,6 +130605,18 @@ var validateNonNegativeInteger = (value) => {
|
|
|
130601
130605
|
}
|
|
130602
130606
|
return true;
|
|
130603
130607
|
};
|
|
130608
|
+
var buildSelectionLabel = (name, id) => `${name} (${id})`;
|
|
130609
|
+
var extractSelectionId = (value) => {
|
|
130610
|
+
const match = value.match(/\(([^()]+)\)$/);
|
|
130611
|
+
return match ? match[1] : value;
|
|
130612
|
+
};
|
|
130613
|
+
var getInitProjectOverrideMessage = () => {
|
|
130614
|
+
const projectName = localConfig.getProject().projectName;
|
|
130615
|
+
if (projectName) {
|
|
130616
|
+
return `A project is already linked to this directory (${projectName}). Override?`;
|
|
130617
|
+
}
|
|
130618
|
+
return "A project is already linked to this directory. Override?";
|
|
130619
|
+
};
|
|
130604
130620
|
var getIgnores = (runtime) => {
|
|
130605
130621
|
const language = runtime.split("-").slice(0, -1).join("-");
|
|
130606
130622
|
switch (language) {
|
|
@@ -130701,7 +130717,7 @@ var questionsInitProject = [
|
|
|
130701
130717
|
{
|
|
130702
130718
|
type: "confirm",
|
|
130703
130719
|
name: "override",
|
|
130704
|
-
message:
|
|
130720
|
+
message: getInitProjectOverrideMessage(),
|
|
130705
130721
|
when() {
|
|
130706
130722
|
return Object.keys(localConfig.getProject()).length !== 0;
|
|
130707
130723
|
}
|
|
@@ -130710,14 +130726,14 @@ var questionsInitProject = [
|
|
|
130710
130726
|
type: "list",
|
|
130711
130727
|
name: "start",
|
|
130712
130728
|
when: whenOverride,
|
|
130713
|
-
message: "
|
|
130729
|
+
message: "Select a setup method:",
|
|
130714
130730
|
choices: [
|
|
130715
130731
|
{
|
|
130716
|
-
name: "Create new project",
|
|
130732
|
+
name: "Create a new project",
|
|
130717
130733
|
value: "new"
|
|
130718
130734
|
},
|
|
130719
130735
|
{
|
|
130720
|
-
name: "Link directory to an existing project",
|
|
130736
|
+
name: "Link this directory to an existing project",
|
|
130721
130737
|
value: "existing"
|
|
130722
130738
|
}
|
|
130723
130739
|
]
|
|
@@ -130725,7 +130741,7 @@ var questionsInitProject = [
|
|
|
130725
130741
|
{
|
|
130726
130742
|
type: "search-list",
|
|
130727
130743
|
name: "organization",
|
|
130728
|
-
message: "Choose your organization",
|
|
130744
|
+
message: "Choose your organization:",
|
|
130729
130745
|
choices: async () => {
|
|
130730
130746
|
const client2 = await sdkForConsole(true);
|
|
130731
130747
|
const { teams: teams2 } = isCloud() ? await paginate(
|
|
@@ -130744,9 +130760,10 @@ var questionsInitProject = [
|
|
|
130744
130760
|
"teams"
|
|
130745
130761
|
);
|
|
130746
130762
|
const choices = teams2.map((team, _idx) => {
|
|
130763
|
+
const label = buildSelectionLabel(team.name, team["$id"]);
|
|
130747
130764
|
return {
|
|
130748
|
-
name:
|
|
130749
|
-
value:
|
|
130765
|
+
name: label,
|
|
130766
|
+
value: label
|
|
130750
130767
|
};
|
|
130751
130768
|
});
|
|
130752
130769
|
if (choices.length == 0) {
|
|
@@ -130775,13 +130792,13 @@ var questionsInitProject = [
|
|
|
130775
130792
|
{
|
|
130776
130793
|
type: "search-list",
|
|
130777
130794
|
name: "project",
|
|
130778
|
-
message:
|
|
130795
|
+
message: "Choose your project:",
|
|
130779
130796
|
choices: async (answers) => {
|
|
130780
130797
|
const queries = [
|
|
130781
130798
|
JSON.stringify({
|
|
130782
130799
|
method: "equal",
|
|
130783
130800
|
attribute: "teamId",
|
|
130784
|
-
values: [answers.organization]
|
|
130801
|
+
values: [extractSelectionId(answers.organization)]
|
|
130785
130802
|
}),
|
|
130786
130803
|
JSON.stringify({ method: "orderDesc", attribute: "$id" })
|
|
130787
130804
|
];
|
|
@@ -130793,14 +130810,10 @@ var questionsInitProject = [
|
|
|
130793
130810
|
queries
|
|
130794
130811
|
);
|
|
130795
130812
|
const choices = projects2.map((project2) => {
|
|
130796
|
-
const label =
|
|
130813
|
+
const label = buildSelectionLabel(project2.name, project2["$id"]);
|
|
130797
130814
|
return {
|
|
130798
130815
|
name: label,
|
|
130799
|
-
|
|
130800
|
-
value: {
|
|
130801
|
-
$id: project2["$id"],
|
|
130802
|
-
region: project2.region || ""
|
|
130803
|
-
}
|
|
130816
|
+
value: label
|
|
130804
130817
|
};
|
|
130805
130818
|
});
|
|
130806
130819
|
if (choices.length === 0) {
|
|
@@ -130843,7 +130856,7 @@ var questionsInitProjectAutopull = [
|
|
|
130843
130856
|
{
|
|
130844
130857
|
type: "confirm",
|
|
130845
130858
|
name: "autopull",
|
|
130846
|
-
message:
|
|
130859
|
+
message: "Pull all resources from this project?"
|
|
130847
130860
|
}
|
|
130848
130861
|
];
|
|
130849
130862
|
var questionsPullResources = [
|
|
@@ -132370,6 +132383,7 @@ import fs6 from "fs";
|
|
|
132370
132383
|
import path4 from "path";
|
|
132371
132384
|
import childProcess2 from "child_process";
|
|
132372
132385
|
var import_inquirer4 = __toESM(require_inquirer(), 1);
|
|
132386
|
+
var import_chalk9 = __toESM(require_source(), 1);
|
|
132373
132387
|
|
|
132374
132388
|
// lib/commands/pull.ts
|
|
132375
132389
|
var import_chalk8 = __toESM(require_source(), 1);
|
|
@@ -136793,6 +136807,123 @@ pull.command("webhook").alias("webhooks").description("Pull your Appwrite webhoo
|
|
|
136793
136807
|
pull.command("topic").alias("topics").description("Pull your Appwrite messaging topics").action(actionRunner(pullMessagingTopic));
|
|
136794
136808
|
|
|
136795
136809
|
// lib/commands/init.ts
|
|
136810
|
+
var extractSelectionId2 = (value) => {
|
|
136811
|
+
const match = value.match(/\(([^()]+)\)$/);
|
|
136812
|
+
return match ? match[1] : value;
|
|
136813
|
+
};
|
|
136814
|
+
var getExistingProjectSummary = async (projectId) => {
|
|
136815
|
+
const projectsService = await getProjectsService();
|
|
136816
|
+
const project2 = await projectsService.get(extractSelectionId2(projectId));
|
|
136817
|
+
return {
|
|
136818
|
+
$id: project2.$id,
|
|
136819
|
+
name: project2.name,
|
|
136820
|
+
region: project2.region || ""
|
|
136821
|
+
};
|
|
136822
|
+
};
|
|
136823
|
+
var printInitProjectSuccess = (message) => {
|
|
136824
|
+
console.log(`${import_chalk9.default.green.bold("\u2713")} ${import_chalk9.default.green(message)}`);
|
|
136825
|
+
};
|
|
136826
|
+
var printInitProjectNextSteps = (steps) => {
|
|
136827
|
+
if (steps.length === 0) {
|
|
136828
|
+
return;
|
|
136829
|
+
}
|
|
136830
|
+
const longestCommand = steps.reduce(
|
|
136831
|
+
(longest, step) => Math.max(longest, step.command.length),
|
|
136832
|
+
0
|
|
136833
|
+
);
|
|
136834
|
+
console.log("");
|
|
136835
|
+
console.log(" Next steps:");
|
|
136836
|
+
for (const step of steps) {
|
|
136837
|
+
const spacing = " ".repeat(longestCommand - step.command.length + 4);
|
|
136838
|
+
console.log(
|
|
136839
|
+
` ${import_chalk9.default.cyan(step.command)}${spacing}${step.description}`
|
|
136840
|
+
);
|
|
136841
|
+
}
|
|
136842
|
+
};
|
|
136843
|
+
var getLocalInitProjectResourceState = () => {
|
|
136844
|
+
const functions2 = localConfig.getFunctions();
|
|
136845
|
+
const sites2 = localConfig.getSites();
|
|
136846
|
+
const collections = localConfig.getCollections();
|
|
136847
|
+
const tables = localConfig.getTables();
|
|
136848
|
+
const buckets = localConfig.getBuckets();
|
|
136849
|
+
const teams2 = localConfig.getTeams();
|
|
136850
|
+
const webhooks2 = localConfig.getWebhooks();
|
|
136851
|
+
const topics = localConfig.getMessagingTopics();
|
|
136852
|
+
return {
|
|
136853
|
+
hasFunctions: functions2.length > 0,
|
|
136854
|
+
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
|
|
136855
|
+
};
|
|
136856
|
+
};
|
|
136857
|
+
var getInitProjectNextSteps = ({
|
|
136858
|
+
start,
|
|
136859
|
+
autoPulled
|
|
136860
|
+
}) => {
|
|
136861
|
+
const { hasFunctions, hasResources } = getLocalInitProjectResourceState();
|
|
136862
|
+
const nextSteps = [];
|
|
136863
|
+
if (start === "existing" && !autoPulled) {
|
|
136864
|
+
nextSteps.push(
|
|
136865
|
+
{
|
|
136866
|
+
command: `${EXECUTABLE_NAME} pull`,
|
|
136867
|
+
description: "Choose a resource to sync"
|
|
136868
|
+
},
|
|
136869
|
+
{
|
|
136870
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136871
|
+
description: "Create a new resource"
|
|
136872
|
+
}
|
|
136873
|
+
);
|
|
136874
|
+
return nextSteps;
|
|
136875
|
+
}
|
|
136876
|
+
if (start === "new") {
|
|
136877
|
+
nextSteps.push({
|
|
136878
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136879
|
+
description: "Create your first resource"
|
|
136880
|
+
});
|
|
136881
|
+
return nextSteps;
|
|
136882
|
+
}
|
|
136883
|
+
nextSteps.push({
|
|
136884
|
+
command: `${EXECUTABLE_NAME} init`,
|
|
136885
|
+
description: "Create another resource"
|
|
136886
|
+
});
|
|
136887
|
+
if (hasFunctions) {
|
|
136888
|
+
nextSteps.push({
|
|
136889
|
+
command: `${EXECUTABLE_NAME} run function`,
|
|
136890
|
+
description: "Run a pulled function locally"
|
|
136891
|
+
});
|
|
136892
|
+
}
|
|
136893
|
+
if (hasResources) {
|
|
136894
|
+
nextSteps.push({
|
|
136895
|
+
command: `${EXECUTABLE_NAME} push`,
|
|
136896
|
+
description: "Deploy your local edits"
|
|
136897
|
+
});
|
|
136898
|
+
}
|
|
136899
|
+
return nextSteps;
|
|
136900
|
+
};
|
|
136901
|
+
var installInitProjectSkills = async () => {
|
|
136902
|
+
if (hasSkillsInstalled(localConfig.configDirectoryPath)) {
|
|
136903
|
+
log("Agent skills already found. Skipping installation.");
|
|
136904
|
+
return;
|
|
136905
|
+
}
|
|
136906
|
+
try {
|
|
136907
|
+
const skillsCwd = localConfig.configDirectoryPath;
|
|
136908
|
+
const { skills, tempDir } = fetchAvailableSkills();
|
|
136909
|
+
try {
|
|
136910
|
+
const detected = detectProjectSkills(skillsCwd, skills);
|
|
136911
|
+
if (detected.length > 0) {
|
|
136912
|
+
const names = detected.map((s3) => s3.dirName);
|
|
136913
|
+
placeSkills(skillsCwd, tempDir, names, [".agents", ".claude"], true);
|
|
136914
|
+
printInitProjectSuccess(
|
|
136915
|
+
`Installed ${names.length} agent skill${names.length === 1 ? "" : "s"}: ${detected.map((s3) => s3.name).join(", ")}`
|
|
136916
|
+
);
|
|
136917
|
+
}
|
|
136918
|
+
} finally {
|
|
136919
|
+
fs6.rmSync(tempDir, { recursive: true, force: true });
|
|
136920
|
+
}
|
|
136921
|
+
} catch (e) {
|
|
136922
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
136923
|
+
error48(`Failed to install agent skills: ${msg}`);
|
|
136924
|
+
hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
|
|
136925
|
+
}
|
|
136926
|
+
};
|
|
136796
136927
|
var initResources = async () => {
|
|
136797
136928
|
const actions = {
|
|
136798
136929
|
function: initFunction,
|
|
@@ -136837,19 +136968,21 @@ var initProject = async ({
|
|
|
136837
136968
|
log("No changes made. Existing project configuration was kept.");
|
|
136838
136969
|
return;
|
|
136839
136970
|
}
|
|
136971
|
+
if (typeof answers.organization === "string") {
|
|
136972
|
+
answers.organization = extractSelectionId2(answers.organization);
|
|
136973
|
+
}
|
|
136840
136974
|
} else {
|
|
136841
136975
|
const selectedOrganization = organizationId ?? (await import_inquirer4.default.prompt([questionsInitProject[2]])).organization;
|
|
136842
136976
|
const selectedProjectName = projectName ?? (await import_inquirer4.default.prompt([questionsInitProject[3]])).project;
|
|
136843
136977
|
const selectedProjectId = projectId ?? (await import_inquirer4.default.prompt([questionsInitProject[4]])).id;
|
|
136978
|
+
const normalizedOrganization = extractSelectionId2(selectedOrganization);
|
|
136844
136979
|
answers = {
|
|
136845
136980
|
start: "existing",
|
|
136846
136981
|
project: selectedProjectId,
|
|
136847
|
-
organization:
|
|
136982
|
+
organization: normalizedOrganization
|
|
136848
136983
|
};
|
|
136849
136984
|
try {
|
|
136850
|
-
|
|
136851
|
-
const existingProject = await projectsService.get(selectedProjectId);
|
|
136852
|
-
answers.project = existingProject;
|
|
136985
|
+
answers.project = await getExistingProjectSummary(selectedProjectId);
|
|
136853
136986
|
} catch (e) {
|
|
136854
136987
|
if (e instanceof AppwriteException && e.code === 404) {
|
|
136855
136988
|
answers = {
|
|
@@ -136863,6 +136996,9 @@ var initProject = async ({
|
|
|
136863
136996
|
}
|
|
136864
136997
|
}
|
|
136865
136998
|
}
|
|
136999
|
+
if (answers.start === "existing" && typeof answers.project === "string") {
|
|
137000
|
+
answers.project = await getExistingProjectSummary(answers.project);
|
|
137001
|
+
}
|
|
136866
137002
|
localConfig.clear();
|
|
136867
137003
|
const url2 = new URL(DEFAULT_ENDPOINT);
|
|
136868
137004
|
if (answers.start === "new") {
|
|
@@ -136889,7 +137025,7 @@ var initProject = async ({
|
|
|
136889
137025
|
answers.organization,
|
|
136890
137026
|
answers.region
|
|
136891
137027
|
);
|
|
136892
|
-
localConfig.setProject(response["$id"]);
|
|
137028
|
+
localConfig.setProject(response["$id"], response.name ?? "");
|
|
136893
137029
|
if (answers.region) {
|
|
136894
137030
|
localConfig.setEndpoint(
|
|
136895
137031
|
`https://${answers.region}.${url2.host}${url2.pathname}`
|
|
@@ -136908,58 +137044,40 @@ var initProject = async ({
|
|
|
136908
137044
|
selectedProject = { $id: "" };
|
|
136909
137045
|
break;
|
|
136910
137046
|
}
|
|
136911
|
-
localConfig.setProject(selectedProject.$id);
|
|
137047
|
+
localConfig.setProject(selectedProject.$id, selectedProject.name ?? "");
|
|
136912
137048
|
if (isCloud() && selectedProject.region) {
|
|
136913
137049
|
localConfig.setEndpoint(
|
|
136914
137050
|
`https://${selectedProject.region}.${url2.host}${url2.pathname}`
|
|
136915
137051
|
);
|
|
136916
137052
|
}
|
|
136917
137053
|
}
|
|
136918
|
-
|
|
136919
|
-
`Project successfully ${answers.start === "existing" ? "linked" : "created"}. Details are now stored in appwrite.config.json file.`
|
|
136920
|
-
);
|
|
137054
|
+
let autoPulled = false;
|
|
136921
137055
|
if (answers.start === "existing") {
|
|
136922
137056
|
const autopullAnswers = await import_inquirer4.default.prompt(
|
|
136923
137057
|
questionsInitProjectAutopull
|
|
136924
137058
|
);
|
|
137059
|
+
console.log("");
|
|
137060
|
+
printInitProjectSuccess("Project linked \u2192 appwrite.config.json");
|
|
137061
|
+
await installInitProjectSkills();
|
|
136925
137062
|
if (autopullAnswers.autopull) {
|
|
137063
|
+
console.log("");
|
|
137064
|
+
autoPulled = true;
|
|
136926
137065
|
cliConfig.all = true;
|
|
136927
137066
|
cliConfig.force = true;
|
|
136928
137067
|
await pullResources({
|
|
136929
137068
|
skipDeprecated: true
|
|
136930
137069
|
});
|
|
136931
|
-
} else {
|
|
136932
|
-
log(
|
|
136933
|
-
`You can run '${EXECUTABLE_NAME} pull all' to synchronize all of your existing resources.`
|
|
136934
|
-
);
|
|
136935
|
-
}
|
|
136936
|
-
}
|
|
136937
|
-
hint(
|
|
136938
|
-
`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.`
|
|
136939
|
-
);
|
|
136940
|
-
if (!hasSkillsInstalled(localConfig.configDirectoryPath)) {
|
|
136941
|
-
try {
|
|
136942
|
-
const skillsCwd = localConfig.configDirectoryPath;
|
|
136943
|
-
log("Setting up Appwrite agent skills ...");
|
|
136944
|
-
const { skills, tempDir } = fetchAvailableSkills();
|
|
136945
|
-
try {
|
|
136946
|
-
const detected = detectProjectSkills(skillsCwd, skills);
|
|
136947
|
-
if (detected.length > 0) {
|
|
136948
|
-
const names = detected.map((s3) => s3.dirName);
|
|
136949
|
-
placeSkills(skillsCwd, tempDir, names, [".agents", ".claude"], true);
|
|
136950
|
-
success2(
|
|
136951
|
-
`Installed ${names.length} agent skill${names.length === 1 ? "" : "s"} based on your project: ${detected.map((s3) => s3.name).join(", ")}`
|
|
136952
|
-
);
|
|
136953
|
-
}
|
|
136954
|
-
} finally {
|
|
136955
|
-
fs6.rmSync(tempDir, { recursive: true, force: true });
|
|
136956
|
-
}
|
|
136957
|
-
} catch (e) {
|
|
136958
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
136959
|
-
error48(`Failed to install agent skills: ${msg}`);
|
|
136960
|
-
hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
|
|
136961
137070
|
}
|
|
137071
|
+
} else {
|
|
137072
|
+
console.log("");
|
|
137073
|
+
printInitProjectSuccess("Project created \u2192 appwrite.config.json");
|
|
137074
|
+
await installInitProjectSkills();
|
|
136962
137075
|
}
|
|
137076
|
+
const nextSteps = getInitProjectNextSteps({
|
|
137077
|
+
start: answers.start,
|
|
137078
|
+
autoPulled
|
|
137079
|
+
});
|
|
137080
|
+
printInitProjectNextSteps(nextSteps);
|
|
136963
137081
|
};
|
|
136964
137082
|
var initBucket = async () => {
|
|
136965
137083
|
const answers = await import_inquirer4.default.prompt(questionsCreateBucket);
|
|
@@ -138923,7 +139041,7 @@ var types = new Command("types").description("Generate types for your Appwrite p
|
|
|
138923
139041
|
// lib/commands/run.ts
|
|
138924
139042
|
var import_tail = __toESM(require_tail(), 1);
|
|
138925
139043
|
var import_dotenv = __toESM(require_main(), 1);
|
|
138926
|
-
var
|
|
139044
|
+
var import_chalk11 = __toESM(require_source(), 1);
|
|
138927
139045
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
138928
139046
|
var import_chokidar = __toESM(require_chokidar(), 1);
|
|
138929
139047
|
var import_inquirer5 = __toESM(require_inquirer(), 1);
|
|
@@ -138932,7 +139050,7 @@ import path11 from "path";
|
|
|
138932
139050
|
|
|
138933
139051
|
// lib/emulation/utils.ts
|
|
138934
139052
|
import { EventEmitter } from "node:events";
|
|
138935
|
-
var openRuntimesVersion = "
|
|
139053
|
+
var openRuntimesVersion = "v5";
|
|
138936
139054
|
var runtimeNames = {
|
|
138937
139055
|
node: "Node.js",
|
|
138938
139056
|
php: "PHP",
|
|
@@ -138951,67 +139069,67 @@ var runtimeNames = {
|
|
|
138951
139069
|
var systemTools = {
|
|
138952
139070
|
node: {
|
|
138953
139071
|
isCompiled: false,
|
|
138954
|
-
startCommand: "
|
|
139072
|
+
startCommand: "bash helpers/server.sh",
|
|
138955
139073
|
dependencyFiles: ["package.json", "package-lock.json"]
|
|
138956
139074
|
},
|
|
138957
139075
|
php: {
|
|
138958
139076
|
isCompiled: false,
|
|
138959
|
-
startCommand: "
|
|
139077
|
+
startCommand: "bash helpers/server.sh",
|
|
138960
139078
|
dependencyFiles: ["composer.json", "composer.lock"]
|
|
138961
139079
|
},
|
|
138962
139080
|
ruby: {
|
|
138963
139081
|
isCompiled: false,
|
|
138964
|
-
startCommand: "
|
|
139082
|
+
startCommand: "bash helpers/server.sh",
|
|
138965
139083
|
dependencyFiles: ["Gemfile", "Gemfile.lock"]
|
|
138966
139084
|
},
|
|
138967
139085
|
python: {
|
|
138968
139086
|
isCompiled: false,
|
|
138969
|
-
startCommand: "
|
|
139087
|
+
startCommand: "bash helpers/server.sh",
|
|
138970
139088
|
dependencyFiles: ["requirements.txt", "requirements.lock"]
|
|
138971
139089
|
},
|
|
138972
139090
|
"python-ml": {
|
|
138973
139091
|
isCompiled: false,
|
|
138974
|
-
startCommand: "
|
|
139092
|
+
startCommand: "bash helpers/server.sh",
|
|
138975
139093
|
dependencyFiles: ["requirements.txt", "requirements.lock"]
|
|
138976
139094
|
},
|
|
138977
139095
|
deno: {
|
|
138978
139096
|
isCompiled: false,
|
|
138979
|
-
startCommand: "
|
|
139097
|
+
startCommand: "bash helpers/server.sh",
|
|
138980
139098
|
dependencyFiles: []
|
|
138981
139099
|
},
|
|
138982
139100
|
dart: {
|
|
138983
139101
|
isCompiled: true,
|
|
138984
|
-
startCommand: "
|
|
139102
|
+
startCommand: "bash helpers/server.sh",
|
|
138985
139103
|
dependencyFiles: []
|
|
138986
139104
|
},
|
|
138987
139105
|
dotnet: {
|
|
138988
139106
|
isCompiled: true,
|
|
138989
|
-
startCommand: "
|
|
139107
|
+
startCommand: "bash helpers/server.sh",
|
|
138990
139108
|
dependencyFiles: []
|
|
138991
139109
|
},
|
|
138992
139110
|
java: {
|
|
138993
139111
|
isCompiled: true,
|
|
138994
|
-
startCommand: "
|
|
139112
|
+
startCommand: "bash helpers/server.sh",
|
|
138995
139113
|
dependencyFiles: []
|
|
138996
139114
|
},
|
|
138997
139115
|
swift: {
|
|
138998
139116
|
isCompiled: true,
|
|
138999
|
-
startCommand: "
|
|
139117
|
+
startCommand: "bash helpers/server.sh",
|
|
139000
139118
|
dependencyFiles: []
|
|
139001
139119
|
},
|
|
139002
139120
|
kotlin: {
|
|
139003
139121
|
isCompiled: true,
|
|
139004
|
-
startCommand: "
|
|
139122
|
+
startCommand: "bash helpers/server.sh",
|
|
139005
139123
|
dependencyFiles: []
|
|
139006
139124
|
},
|
|
139007
139125
|
bun: {
|
|
139008
139126
|
isCompiled: false,
|
|
139009
|
-
startCommand: "
|
|
139127
|
+
startCommand: "bash helpers/server.sh",
|
|
139010
139128
|
dependencyFiles: ["package.json", "package-lock.json", "bun.lockb"]
|
|
139011
139129
|
},
|
|
139012
139130
|
go: {
|
|
139013
139131
|
isCompiled: true,
|
|
139014
|
-
startCommand: "
|
|
139132
|
+
startCommand: "bash helpers/server.sh",
|
|
139015
139133
|
dependencyFiles: []
|
|
139016
139134
|
}
|
|
139017
139135
|
};
|
|
@@ -139105,12 +139223,119 @@ var Queue = {
|
|
|
139105
139223
|
|
|
139106
139224
|
// lib/emulation/docker.ts
|
|
139107
139225
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
139108
|
-
var
|
|
139226
|
+
var import_chalk10 = __toESM(require_source(), 1);
|
|
139109
139227
|
import net2 from "net";
|
|
139110
139228
|
import childProcess3 from "child_process";
|
|
139111
139229
|
import path10 from "path";
|
|
139112
139230
|
import fs12 from "fs";
|
|
139113
139231
|
var ignore2 = import_ignore2.default.default ?? import_ignore2.default;
|
|
139232
|
+
function getFunctionIgnorer(func, functionDir) {
|
|
139233
|
+
const ignorer = ignore2();
|
|
139234
|
+
ignorer.add(".appwrite");
|
|
139235
|
+
if (func.ignore) {
|
|
139236
|
+
ignorer.add(func.ignore);
|
|
139237
|
+
} else if (fs12.existsSync(path10.join(functionDir, ".gitignore"))) {
|
|
139238
|
+
ignorer.add(
|
|
139239
|
+
fs12.readFileSync(path10.join(functionDir, ".gitignore")).toString()
|
|
139240
|
+
);
|
|
139241
|
+
}
|
|
139242
|
+
return ignorer;
|
|
139243
|
+
}
|
|
139244
|
+
function getFunctionFiles(func) {
|
|
139245
|
+
const functionDir = path10.join(localConfig.getDirname(), func.path);
|
|
139246
|
+
const ignorer = getFunctionIgnorer(func, functionDir);
|
|
139247
|
+
const files = getAllFiles(functionDir).map((file2) => path10.relative(functionDir, file2)).filter((file2) => !ignorer.ignores(file2));
|
|
139248
|
+
return { functionDir, files, ignorer };
|
|
139249
|
+
}
|
|
139250
|
+
function assertFunctionSourceCode(func) {
|
|
139251
|
+
const functionDir = path10.join(localConfig.getDirname(), func.path);
|
|
139252
|
+
if (!fs12.existsSync(functionDir)) {
|
|
139253
|
+
throw new Error(
|
|
139254
|
+
`Function path '${func.path}' was not found. Add your source code before running locally.`
|
|
139255
|
+
);
|
|
139256
|
+
}
|
|
139257
|
+
const { files, ignorer } = getFunctionFiles(func);
|
|
139258
|
+
if (!func.entrypoint) {
|
|
139259
|
+
throw new Error(
|
|
139260
|
+
`Function '${func.name}' is missing an entrypoint. Update appwrite.config.json before running locally.`
|
|
139261
|
+
);
|
|
139262
|
+
}
|
|
139263
|
+
const normalizedEntrypoint = path10.normalize(func.entrypoint);
|
|
139264
|
+
const relativeEntrypoint = normalizedEntrypoint.split(path10.sep).join("/");
|
|
139265
|
+
if (ignorer.ignores(relativeEntrypoint)) {
|
|
139266
|
+
throw new Error(
|
|
139267
|
+
`Entrypoint '${func.entrypoint}' is ignored by your local ignore rules. Update appwrite.config.json or your ignore file before running locally.`
|
|
139268
|
+
);
|
|
139269
|
+
}
|
|
139270
|
+
if (!fs12.existsSync(path10.join(functionDir, normalizedEntrypoint))) {
|
|
139271
|
+
throw new Error(
|
|
139272
|
+
`Entrypoint '${func.entrypoint}' was not found in '${func.path}'. Add your source code before running locally.`
|
|
139273
|
+
);
|
|
139274
|
+
}
|
|
139275
|
+
if (files.length === 0) {
|
|
139276
|
+
throw new Error(
|
|
139277
|
+
`No source files were found in '${func.path}'. Add your source code before running locally.`
|
|
139278
|
+
);
|
|
139279
|
+
}
|
|
139280
|
+
}
|
|
139281
|
+
function getRuntimeImageName(func) {
|
|
139282
|
+
const runtimeChunks = func.runtime.split("-");
|
|
139283
|
+
const runtimeVersion = runtimeChunks.pop();
|
|
139284
|
+
const runtimeName = runtimeChunks.join("-");
|
|
139285
|
+
return `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139286
|
+
}
|
|
139287
|
+
async function waitForProcessClose(process4) {
|
|
139288
|
+
return new Promise((resolve3, reject) => {
|
|
139289
|
+
process4.once("error", reject);
|
|
139290
|
+
process4.once("close", (code, signal) => {
|
|
139291
|
+
resolve3({ code, signal });
|
|
139292
|
+
});
|
|
139293
|
+
});
|
|
139294
|
+
}
|
|
139295
|
+
function assertDockerSuccess(code, signal, errorMessage) {
|
|
139296
|
+
if (code === 0) {
|
|
139297
|
+
return;
|
|
139298
|
+
}
|
|
139299
|
+
if (signal) {
|
|
139300
|
+
throw new Error(
|
|
139301
|
+
`${errorMessage} Docker process exited with signal ${signal}.`
|
|
139302
|
+
);
|
|
139303
|
+
}
|
|
139304
|
+
throw new Error(
|
|
139305
|
+
`${errorMessage} Docker process exited with code ${code ?? "unknown"}.`
|
|
139306
|
+
);
|
|
139307
|
+
}
|
|
139308
|
+
function getDockerExitMessage(code, signal) {
|
|
139309
|
+
if (signal) {
|
|
139310
|
+
return `Docker process exited with signal ${signal}.`;
|
|
139311
|
+
}
|
|
139312
|
+
return `Docker process exited with code ${code ?? "unknown"}.`;
|
|
139313
|
+
}
|
|
139314
|
+
function waitForProcessOutput(process4, needle) {
|
|
139315
|
+
return new Promise((resolve3) => {
|
|
139316
|
+
let output = "";
|
|
139317
|
+
const onData = (data) => {
|
|
139318
|
+
output += data.toString();
|
|
139319
|
+
if (output.includes(needle)) {
|
|
139320
|
+
cleanup();
|
|
139321
|
+
resolve3();
|
|
139322
|
+
}
|
|
139323
|
+
if (output.length > needle.length * 4) {
|
|
139324
|
+
output = output.slice(-needle.length * 4);
|
|
139325
|
+
}
|
|
139326
|
+
};
|
|
139327
|
+
const cleanup = () => {
|
|
139328
|
+
process4.stdout.off("data", onData);
|
|
139329
|
+
process4.stderr.off("data", onData);
|
|
139330
|
+
process4.off("close", cleanup);
|
|
139331
|
+
process4.off("error", cleanup);
|
|
139332
|
+
};
|
|
139333
|
+
process4.stdout.on("data", onData);
|
|
139334
|
+
process4.stderr.on("data", onData);
|
|
139335
|
+
process4.once("close", cleanup);
|
|
139336
|
+
process4.once("error", cleanup);
|
|
139337
|
+
});
|
|
139338
|
+
}
|
|
139114
139339
|
async function dockerStop(id) {
|
|
139115
139340
|
const stopProcess = childProcess3.spawn("docker", ["rm", "--force", id], {
|
|
139116
139341
|
stdio: "pipe",
|
|
@@ -139124,10 +139349,7 @@ async function dockerStop(id) {
|
|
|
139124
139349
|
});
|
|
139125
139350
|
}
|
|
139126
139351
|
async function dockerPull(func) {
|
|
139127
|
-
const
|
|
139128
|
-
const runtimeVersion = runtimeChunks.pop();
|
|
139129
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139130
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139352
|
+
const imageName = getRuntimeImageName(func);
|
|
139131
139353
|
log("Verifying Docker image ...");
|
|
139132
139354
|
const pullProcess = childProcess3.spawn("docker", ["pull", imageName], {
|
|
139133
139355
|
stdio: "pipe",
|
|
@@ -139136,27 +139358,17 @@ async function dockerPull(func) {
|
|
|
139136
139358
|
DOCKER_CLI_HINTS: "false"
|
|
139137
139359
|
}
|
|
139138
139360
|
});
|
|
139139
|
-
await
|
|
139140
|
-
|
|
139141
|
-
|
|
139361
|
+
const { code, signal } = await waitForProcessClose(pullProcess);
|
|
139362
|
+
assertDockerSuccess(
|
|
139363
|
+
code,
|
|
139364
|
+
signal,
|
|
139365
|
+
`Unable to pull Docker image '${imageName}'.`
|
|
139366
|
+
);
|
|
139142
139367
|
}
|
|
139143
139368
|
async function dockerBuild(func, variables) {
|
|
139144
|
-
const
|
|
139145
|
-
const
|
|
139146
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139147
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139148
|
-
const functionDir = path10.join(localConfig.getDirname(), func.path);
|
|
139369
|
+
const imageName = getRuntimeImageName(func);
|
|
139370
|
+
const { functionDir, files } = getFunctionFiles(func);
|
|
139149
139371
|
const id = func.$id;
|
|
139150
|
-
const ignorer = ignore2();
|
|
139151
|
-
ignorer.add(".appwrite");
|
|
139152
|
-
if (func.ignore) {
|
|
139153
|
-
ignorer.add(func.ignore);
|
|
139154
|
-
} else if (fs12.existsSync(path10.join(functionDir, ".gitignore"))) {
|
|
139155
|
-
ignorer.add(
|
|
139156
|
-
fs12.readFileSync(path10.join(functionDir, ".gitignore")).toString()
|
|
139157
|
-
);
|
|
139158
|
-
}
|
|
139159
|
-
const files = getAllFiles(functionDir).map((file2) => path10.relative(functionDir, file2)).filter((file2) => !ignorer.ignores(file2));
|
|
139160
139372
|
const tmpBuildPath = path10.join(functionDir, ".appwrite/tmp-build");
|
|
139161
139373
|
if (!fs12.existsSync(tmpBuildPath)) {
|
|
139162
139374
|
fs12.mkdirSync(tmpBuildPath, { recursive: true });
|
|
@@ -139190,13 +139402,19 @@ async function dockerBuild(func, variables) {
|
|
|
139190
139402
|
DOCKER_CLI_HINTS: "false"
|
|
139191
139403
|
}
|
|
139192
139404
|
});
|
|
139405
|
+
let hasPrintedBuildSeparator = false;
|
|
139406
|
+
const writeBuildChunk = (stream, data) => {
|
|
139407
|
+
if (!hasPrintedBuildSeparator) {
|
|
139408
|
+
stream.write("\n");
|
|
139409
|
+
hasPrintedBuildSeparator = true;
|
|
139410
|
+
}
|
|
139411
|
+
stream.write(import_chalk10.default.blackBright(data));
|
|
139412
|
+
};
|
|
139193
139413
|
buildProcess.stdout.on("data", (data) => {
|
|
139194
|
-
process.stdout
|
|
139195
|
-
`));
|
|
139414
|
+
writeBuildChunk(process.stdout, data);
|
|
139196
139415
|
});
|
|
139197
139416
|
buildProcess.stderr.on("data", (data) => {
|
|
139198
|
-
process.stderr
|
|
139199
|
-
`));
|
|
139417
|
+
writeBuildChunk(process.stderr, data);
|
|
139200
139418
|
});
|
|
139201
139419
|
killInterval = setInterval(() => {
|
|
139202
139420
|
if (!Queue.isEmpty()) {
|
|
@@ -139208,15 +139426,18 @@ async function dockerBuild(func, variables) {
|
|
|
139208
139426
|
clearInterval(killInterval);
|
|
139209
139427
|
}
|
|
139210
139428
|
}, 100);
|
|
139211
|
-
await
|
|
139212
|
-
buildProcess.on("close", res);
|
|
139213
|
-
});
|
|
139429
|
+
const { code, signal } = await waitForProcessClose(buildProcess);
|
|
139214
139430
|
clearInterval(killInterval);
|
|
139215
139431
|
killInterval = void 0;
|
|
139216
139432
|
if (!Queue.isEmpty()) {
|
|
139217
139433
|
await dockerStop(id);
|
|
139218
139434
|
return;
|
|
139219
139435
|
}
|
|
139436
|
+
assertDockerSuccess(
|
|
139437
|
+
code,
|
|
139438
|
+
signal,
|
|
139439
|
+
`Unable to build function '${func.name}'.`
|
|
139440
|
+
);
|
|
139220
139441
|
const copyPath = path10.join(
|
|
139221
139442
|
localConfig.getDirname(),
|
|
139222
139443
|
func.path,
|
|
@@ -139239,11 +139460,15 @@ async function dockerBuild(func, variables) {
|
|
|
139239
139460
|
}
|
|
139240
139461
|
}
|
|
139241
139462
|
);
|
|
139242
|
-
await
|
|
139243
|
-
|
|
139244
|
-
|
|
139463
|
+
const copyResult = await waitForProcessClose(copyProcess);
|
|
139464
|
+
assertDockerSuccess(
|
|
139465
|
+
copyResult.code,
|
|
139466
|
+
copyResult.signal,
|
|
139467
|
+
`Unable to copy built bundle for function '${func.name}'.`
|
|
139468
|
+
);
|
|
139245
139469
|
await dockerStop(id);
|
|
139246
139470
|
} finally {
|
|
139471
|
+
await dockerStop(id);
|
|
139247
139472
|
if (killInterval !== void 0) {
|
|
139248
139473
|
clearInterval(killInterval);
|
|
139249
139474
|
}
|
|
@@ -139260,10 +139485,8 @@ async function dockerBuild(func, variables) {
|
|
|
139260
139485
|
}
|
|
139261
139486
|
async function dockerStart(func, variables, port) {
|
|
139262
139487
|
const functionDir = path10.join(localConfig.getDirname(), func.path);
|
|
139263
|
-
const
|
|
139264
|
-
const
|
|
139265
|
-
const runtimeName = runtimeChunks.join("-");
|
|
139266
|
-
const imageName = `openruntimes/${runtimeName}:${openRuntimesVersion}-${runtimeVersion}`;
|
|
139488
|
+
const imageName = getRuntimeImageName(func);
|
|
139489
|
+
const runtimeName = func.runtime.split("-").slice(0, -1).join("-");
|
|
139267
139490
|
const tool = systemTools[runtimeName];
|
|
139268
139491
|
const id = func.$id;
|
|
139269
139492
|
const params = ["run"];
|
|
@@ -139298,19 +139521,62 @@ async function dockerStart(func, variables, port) {
|
|
|
139298
139521
|
}
|
|
139299
139522
|
});
|
|
139300
139523
|
startProcess.stdout.on("data", (data) => {
|
|
139301
|
-
process.stdout.write(
|
|
139524
|
+
process.stdout.write(import_chalk10.default.blackBright(data));
|
|
139302
139525
|
});
|
|
139303
139526
|
startProcess.stderr.on("data", (data) => {
|
|
139304
|
-
process.
|
|
139527
|
+
process.stderr.write(import_chalk10.default.blackBright(data));
|
|
139528
|
+
});
|
|
139529
|
+
const startProcessExit = waitForProcessClose(startProcess);
|
|
139530
|
+
void startProcessExit.catch(() => {
|
|
139531
|
+
});
|
|
139532
|
+
const startupLogDetected = waitForProcessOutput(
|
|
139533
|
+
startProcess,
|
|
139534
|
+
"HTTP server successfully started!"
|
|
139535
|
+
);
|
|
139536
|
+
void startupLogDetected.catch(() => {
|
|
139305
139537
|
});
|
|
139306
139538
|
try {
|
|
139307
|
-
await
|
|
139539
|
+
const result = await Promise.race([
|
|
139540
|
+
waitUntilPortOpen(port).then(() => ({
|
|
139541
|
+
type: "port-open"
|
|
139542
|
+
})),
|
|
139543
|
+
startProcessExit.then(({ code, signal }) => ({
|
|
139544
|
+
type: "process-exit",
|
|
139545
|
+
code,
|
|
139546
|
+
signal
|
|
139547
|
+
}))
|
|
139548
|
+
]);
|
|
139549
|
+
if (result.type === "process-exit") {
|
|
139550
|
+
throw new Error(
|
|
139551
|
+
`Function container exited before opening port ${port}. ${getDockerExitMessage(result.code, result.signal)}`
|
|
139552
|
+
);
|
|
139553
|
+
}
|
|
139554
|
+
const postStartupResult = await Promise.race([
|
|
139555
|
+
startupLogDetected.then(() => ({
|
|
139556
|
+
type: "startup-log"
|
|
139557
|
+
})),
|
|
139558
|
+
startProcessExit.then(({ code, signal }) => ({
|
|
139559
|
+
type: "process-exit",
|
|
139560
|
+
code,
|
|
139561
|
+
signal
|
|
139562
|
+
})),
|
|
139563
|
+
new Promise((resolve3) => {
|
|
139564
|
+
setTimeout(() => resolve3({ type: "timeout" }), 1500);
|
|
139565
|
+
})
|
|
139566
|
+
]);
|
|
139567
|
+
if (postStartupResult.type === "process-exit") {
|
|
139568
|
+
throw new Error(
|
|
139569
|
+
`Function container exited before startup logs completed. ${getDockerExitMessage(postStartupResult.code, postStartupResult.signal)}`
|
|
139570
|
+
);
|
|
139571
|
+
}
|
|
139308
139572
|
} catch (err) {
|
|
139309
139573
|
const message = err instanceof Error ? err.message : String(err);
|
|
139310
139574
|
error48(`Failed to start function with error: ${message}`);
|
|
139311
139575
|
return;
|
|
139312
139576
|
}
|
|
139577
|
+
process.stdout.write("\n");
|
|
139313
139578
|
success2(`Visit http://localhost:${port}/ to execute your function.`);
|
|
139579
|
+
process.stdout.write("\n");
|
|
139314
139580
|
}
|
|
139315
139581
|
async function dockerCleanup(functionId) {
|
|
139316
139582
|
await dockerStop(functionId);
|
|
@@ -139426,12 +139692,13 @@ var runFunction = async ({
|
|
|
139426
139692
|
scopes: func.scopes ?? []
|
|
139427
139693
|
};
|
|
139428
139694
|
drawTable([settings]);
|
|
139429
|
-
|
|
139695
|
+
hint(
|
|
139430
139696
|
"If you wish to change your local settings, update the appwrite.config.json file and rerun the 'appwrite run' command."
|
|
139431
139697
|
);
|
|
139432
139698
|
hint(
|
|
139433
139699
|
"Permissions, events, CRON and timeouts don't apply when running locally."
|
|
139434
139700
|
);
|
|
139701
|
+
assertFunctionSourceCode(func);
|
|
139435
139702
|
await dockerCleanup(func.$id);
|
|
139436
139703
|
process.on("SIGINT", async () => {
|
|
139437
139704
|
log("Cleaning up ...");
|
|
@@ -139514,12 +139781,22 @@ var runFunction = async ({
|
|
|
139514
139781
|
);
|
|
139515
139782
|
}
|
|
139516
139783
|
await dockerPull(func);
|
|
139784
|
+
let hasShownRuntimeLogsHeader = false;
|
|
139785
|
+
const showRuntimeLogsHeader = () => {
|
|
139786
|
+
if (hasShownRuntimeLogsHeader) {
|
|
139787
|
+
return;
|
|
139788
|
+
}
|
|
139789
|
+
hasShownRuntimeLogsHeader = true;
|
|
139790
|
+
log("Runtime logs:");
|
|
139791
|
+
};
|
|
139517
139792
|
new import_tail.Tail(logsPath).on("line", function(data) {
|
|
139518
|
-
|
|
139793
|
+
showRuntimeLogsHeader();
|
|
139794
|
+
process.stdout.write(import_chalk11.default.white(`${data}
|
|
139519
139795
|
`));
|
|
139520
139796
|
});
|
|
139521
139797
|
new import_tail.Tail(errorsPath).on("line", function(data) {
|
|
139522
|
-
|
|
139798
|
+
showRuntimeLogsHeader();
|
|
139799
|
+
process.stdout.write(import_chalk11.default.white(`${data}
|
|
139523
139800
|
`));
|
|
139524
139801
|
});
|
|
139525
139802
|
if (reload) {
|
|
@@ -139551,6 +139828,7 @@ var runFunction = async ({
|
|
|
139551
139828
|
Queue.lock();
|
|
139552
139829
|
try {
|
|
139553
139830
|
await dockerStop(func.$id);
|
|
139831
|
+
assertFunctionSourceCode(func);
|
|
139554
139832
|
const dependencyFile = files.find(
|
|
139555
139833
|
(filePath) => tool.dependencyFiles.includes(filePath)
|
|
139556
139834
|
);
|
|
@@ -139614,7 +139892,7 @@ var runFunction = async ({
|
|
|
139614
139892
|
await dockerStart(func, allVariables, portNum);
|
|
139615
139893
|
}
|
|
139616
139894
|
} catch (err) {
|
|
139617
|
-
|
|
139895
|
+
error48(`Failed to reload function with error: ${getErrorMessage(err)}`);
|
|
139618
139896
|
} finally {
|
|
139619
139897
|
Queue.unlock();
|
|
139620
139898
|
}
|
|
@@ -139626,8 +139904,10 @@ var runFunction = async ({
|
|
|
139626
139904
|
Queue.unlock();
|
|
139627
139905
|
return;
|
|
139628
139906
|
}
|
|
139907
|
+
process.stdout.write("\n");
|
|
139629
139908
|
log("Starting function using Docker ...");
|
|
139630
139909
|
hint("Function automatically restarts when you edit your code.");
|
|
139910
|
+
process.stdout.write("\n");
|
|
139631
139911
|
await dockerStart(func, allVariables, portNum);
|
|
139632
139912
|
Queue.unlock();
|
|
139633
139913
|
};
|
|
@@ -139648,7 +139928,7 @@ run.command("function").alias("functions").description("Run functions in the cur
|
|
|
139648
139928
|
|
|
139649
139929
|
// lib/commands/push.ts
|
|
139650
139930
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
139651
|
-
var
|
|
139931
|
+
var import_chalk14 = __toESM(require_source(), 1);
|
|
139652
139932
|
var import_inquirer7 = __toESM(require_inquirer(), 1);
|
|
139653
139933
|
import fs14 from "fs";
|
|
139654
139934
|
import path12 from "path";
|
|
@@ -140182,7 +140462,7 @@ var Pools = class {
|
|
|
140182
140462
|
};
|
|
140183
140463
|
|
|
140184
140464
|
// lib/commands/utils/attributes.ts
|
|
140185
|
-
var
|
|
140465
|
+
var import_chalk12 = __toESM(require_source(), 1);
|
|
140186
140466
|
var import_inquirer6 = __toESM(require_inquirer(), 1);
|
|
140187
140467
|
var changeableKeys = [
|
|
140188
140468
|
"status",
|
|
@@ -140252,11 +140532,11 @@ var Attributes = class {
|
|
|
140252
140532
|
if (Array.isArray(remote) && Array.isArray(local)) {
|
|
140253
140533
|
if (JSON.stringify(remote) !== JSON.stringify(local)) {
|
|
140254
140534
|
const bol = reason === "" ? "" : "\n";
|
|
140255
|
-
reason += `${bol}${key} changed from ${
|
|
140535
|
+
reason += `${bol}${key} changed from ${import_chalk12.default.red(remote)} to ${import_chalk12.default.green(local)}`;
|
|
140256
140536
|
}
|
|
140257
140537
|
} else if (!this.isEqual(remote, local)) {
|
|
140258
140538
|
const bol = reason === "" ? "" : "\n";
|
|
140259
|
-
reason += `${bol}${key} changed from ${
|
|
140539
|
+
reason += `${bol}${key} changed from ${import_chalk12.default.red(remote)} to ${import_chalk12.default.green(local)}`;
|
|
140260
140540
|
}
|
|
140261
140541
|
return reason;
|
|
140262
140542
|
};
|
|
@@ -140268,8 +140548,8 @@ var Attributes = class {
|
|
|
140268
140548
|
if (local === void 0) {
|
|
140269
140549
|
return void 0;
|
|
140270
140550
|
}
|
|
140271
|
-
const keyName = `${
|
|
140272
|
-
const action =
|
|
140551
|
+
const keyName = `${import_chalk12.default.yellow(local.key)} in ${collection.name} (${collection["$id"]})`;
|
|
140552
|
+
const action = import_chalk12.default.cyan(recreating ? "recreating" : "changing");
|
|
140273
140553
|
let reason = "";
|
|
140274
140554
|
const attribute = recreating ? remote : local;
|
|
140275
140555
|
for (const key of Object.keys(remote)) {
|
|
@@ -140295,10 +140575,10 @@ var Attributes = class {
|
|
|
140295
140575
|
attributesContains = (attribute, attributes) => attributes.find((attr) => attr.key === attribute.key);
|
|
140296
140576
|
generateChangesObject = (attribute, collection, isAdding) => {
|
|
140297
140577
|
return {
|
|
140298
|
-
key: `${
|
|
140578
|
+
key: `${import_chalk12.default.yellow(attribute.key)} in ${collection.name} (${collection["$id"]})`,
|
|
140299
140579
|
attribute,
|
|
140300
140580
|
reason: isAdding ? "Field isn't present on the remote server" : "Field isn't present on the appwrite.config.json file",
|
|
140301
|
-
action: isAdding ?
|
|
140581
|
+
action: isAdding ? import_chalk12.default.green("adding") : import_chalk12.default.red("deleting")
|
|
140302
140582
|
};
|
|
140303
140583
|
};
|
|
140304
140584
|
createAttribute = async (databaseId, collectionId, attribute) => {
|
|
@@ -140704,25 +140984,25 @@ var Attributes = class {
|
|
|
140704
140984
|
if (!cliConfig.force) {
|
|
140705
140985
|
if (deleting.length > 0 && !isIndex) {
|
|
140706
140986
|
console.log(
|
|
140707
|
-
`${
|
|
140987
|
+
`${import_chalk12.default.red("------------------------------------------------------")}`
|
|
140708
140988
|
);
|
|
140709
140989
|
console.log(
|
|
140710
|
-
`${
|
|
140990
|
+
`${import_chalk12.default.red("| WARNING: Attribute deletion may cause loss of data |")}`
|
|
140711
140991
|
);
|
|
140712
140992
|
console.log(
|
|
140713
|
-
`${
|
|
140993
|
+
`${import_chalk12.default.red("------------------------------------------------------")}`
|
|
140714
140994
|
);
|
|
140715
140995
|
console.log();
|
|
140716
140996
|
}
|
|
140717
140997
|
if (conflicts.length > 0 && !isIndex) {
|
|
140718
140998
|
console.log(
|
|
140719
|
-
`${
|
|
140999
|
+
`${import_chalk12.default.red("--------------------------------------------------------")}`
|
|
140720
141000
|
);
|
|
140721
141001
|
console.log(
|
|
140722
|
-
`${
|
|
141002
|
+
`${import_chalk12.default.red("| WARNING: Attribute recreation may cause loss of data |")}`
|
|
140723
141003
|
);
|
|
140724
141004
|
console.log(
|
|
140725
|
-
`${
|
|
141005
|
+
`${import_chalk12.default.red("--------------------------------------------------------")}`
|
|
140726
141006
|
);
|
|
140727
141007
|
console.log();
|
|
140728
141008
|
}
|
|
@@ -140855,7 +141135,7 @@ var Attributes = class {
|
|
|
140855
141135
|
};
|
|
140856
141136
|
|
|
140857
141137
|
// lib/commands/utils/database-sync.ts
|
|
140858
|
-
var
|
|
141138
|
+
var import_chalk13 = __toESM(require_source(), 1);
|
|
140859
141139
|
var isTablesDBResource = (value) => {
|
|
140860
141140
|
if (!value || typeof value !== "object") {
|
|
140861
141141
|
return false;
|
|
@@ -140900,7 +141180,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140900
141180
|
toDelete.push(remoteDB);
|
|
140901
141181
|
changes.push({
|
|
140902
141182
|
id: remoteDB.$id,
|
|
140903
|
-
action:
|
|
141183
|
+
action: import_chalk13.default.red("deleting"),
|
|
140904
141184
|
key: "Database",
|
|
140905
141185
|
remote: remoteDB.name,
|
|
140906
141186
|
local: "(deleted locally)"
|
|
@@ -140913,7 +141193,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140913
141193
|
toCreate.push(localDB);
|
|
140914
141194
|
changes.push({
|
|
140915
141195
|
id: localDB.$id,
|
|
140916
|
-
action:
|
|
141196
|
+
action: import_chalk13.default.green("creating"),
|
|
140917
141197
|
key: "Database",
|
|
140918
141198
|
remote: "(does not exist)",
|
|
140919
141199
|
local: localDB.name
|
|
@@ -140924,7 +141204,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140924
141204
|
hasChanges = true;
|
|
140925
141205
|
changes.push({
|
|
140926
141206
|
id: localDB.$id,
|
|
140927
|
-
action:
|
|
141207
|
+
action: import_chalk13.default.yellow("updating"),
|
|
140928
141208
|
key: "Name",
|
|
140929
141209
|
remote: remoteDB.name,
|
|
140930
141210
|
local: localDB.name
|
|
@@ -140934,7 +141214,7 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140934
141214
|
hasChanges = true;
|
|
140935
141215
|
changes.push({
|
|
140936
141216
|
id: localDB.$id,
|
|
140937
|
-
action:
|
|
141217
|
+
action: import_chalk13.default.yellow("updating"),
|
|
140938
141218
|
key: "Enabled",
|
|
140939
141219
|
remote: remoteDB.enabled,
|
|
140940
141220
|
local: localDB.enabled
|
|
@@ -140952,13 +141232,13 @@ var checkAndApplyTablesDBChanges = async () => {
|
|
|
140952
141232
|
drawTable(changes);
|
|
140953
141233
|
if (toDelete.length > 0) {
|
|
140954
141234
|
console.log(
|
|
140955
|
-
`${
|
|
141235
|
+
`${import_chalk13.default.red("------------------------------------------------------------------")}`
|
|
140956
141236
|
);
|
|
140957
141237
|
console.log(
|
|
140958
|
-
`${
|
|
141238
|
+
`${import_chalk13.default.red("| WARNING: Database deletion will also delete all related tables |")}`
|
|
140959
141239
|
);
|
|
140960
141240
|
console.log(
|
|
140961
|
-
`${
|
|
141241
|
+
`${import_chalk13.default.red("------------------------------------------------------------------")}`
|
|
140962
141242
|
);
|
|
140963
141243
|
console.log();
|
|
140964
141244
|
}
|
|
@@ -141385,7 +141665,7 @@ var Push = class {
|
|
|
141385
141665
|
settings: config2.settings
|
|
141386
141666
|
});
|
|
141387
141667
|
this.success(
|
|
141388
|
-
`Successfully pushed ${
|
|
141668
|
+
`Successfully pushed ${import_chalk14.default.bold("all")} project settings.`
|
|
141389
141669
|
);
|
|
141390
141670
|
results.settings = { success: true };
|
|
141391
141671
|
} catch (e) {
|
|
@@ -141398,7 +141678,7 @@ var Push = class {
|
|
|
141398
141678
|
this.log("Pushing buckets ...");
|
|
141399
141679
|
const result = await this.pushBuckets(config2.buckets);
|
|
141400
141680
|
this.success(
|
|
141401
|
-
`Successfully pushed ${
|
|
141681
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} buckets.`
|
|
141402
141682
|
);
|
|
141403
141683
|
results.buckets = result;
|
|
141404
141684
|
allErrors.push(...result.errors);
|
|
@@ -141412,7 +141692,7 @@ var Push = class {
|
|
|
141412
141692
|
this.log("Pushing teams ...");
|
|
141413
141693
|
const result = await this.pushTeams(config2.teams);
|
|
141414
141694
|
this.success(
|
|
141415
|
-
`Successfully pushed ${
|
|
141695
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} teams.`
|
|
141416
141696
|
);
|
|
141417
141697
|
results.teams = result;
|
|
141418
141698
|
allErrors.push(...result.errors);
|
|
@@ -141426,7 +141706,7 @@ var Push = class {
|
|
|
141426
141706
|
this.log("Pushing webhooks ...");
|
|
141427
141707
|
const result = await this.pushWebhooks(config2.webhooks);
|
|
141428
141708
|
this.success(
|
|
141429
|
-
`Successfully pushed ${
|
|
141709
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} webhooks.`
|
|
141430
141710
|
);
|
|
141431
141711
|
results.webhooks = result;
|
|
141432
141712
|
allErrors.push(...result.errors);
|
|
@@ -141440,7 +141720,7 @@ var Push = class {
|
|
|
141440
141720
|
this.log("Pushing topics ...");
|
|
141441
141721
|
const result = await this.pushMessagingTopics(config2.topics);
|
|
141442
141722
|
this.success(
|
|
141443
|
-
`Successfully pushed ${
|
|
141723
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} topics.`
|
|
141444
141724
|
);
|
|
141445
141725
|
results.topics = result;
|
|
141446
141726
|
allErrors.push(...result.errors);
|
|
@@ -141457,7 +141737,7 @@ var Push = class {
|
|
|
141457
141737
|
options.functionOptions
|
|
141458
141738
|
);
|
|
141459
141739
|
this.success(
|
|
141460
|
-
`Successfully pushed ${
|
|
141740
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} functions.`
|
|
141461
141741
|
);
|
|
141462
141742
|
results.functions = result;
|
|
141463
141743
|
allErrors.push(...result.errors);
|
|
@@ -141479,7 +141759,7 @@ var Push = class {
|
|
|
141479
141759
|
options.siteOptions
|
|
141480
141760
|
);
|
|
141481
141761
|
this.success(
|
|
141482
|
-
`Successfully pushed ${
|
|
141762
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} sites.`
|
|
141483
141763
|
);
|
|
141484
141764
|
results.sites = result;
|
|
141485
141765
|
allErrors.push(...result.errors);
|
|
@@ -141501,7 +141781,7 @@ var Push = class {
|
|
|
141501
141781
|
skipConfirmation: options.skipConfirmation
|
|
141502
141782
|
});
|
|
141503
141783
|
this.success(
|
|
141504
|
-
`Successfully pushed ${
|
|
141784
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} tables.`
|
|
141505
141785
|
);
|
|
141506
141786
|
results.tables = result;
|
|
141507
141787
|
allErrors.push(...result.errors);
|
|
@@ -141528,7 +141808,7 @@ var Push = class {
|
|
|
141528
141808
|
skipConfirmation: options.skipConfirmation
|
|
141529
141809
|
});
|
|
141530
141810
|
this.success(
|
|
141531
|
-
`Successfully pushed ${
|
|
141811
|
+
`Successfully pushed ${import_chalk14.default.bold(result.successfullyPushed)} collections.`
|
|
141532
141812
|
);
|
|
141533
141813
|
results.collections = result;
|
|
141534
141814
|
allErrors.push(...result.errors);
|
|
@@ -141653,14 +141933,14 @@ var Push = class {
|
|
|
141653
141933
|
};
|
|
141654
141934
|
for (const bucket of buckets) {
|
|
141655
141935
|
try {
|
|
141656
|
-
this.log(`Pushing bucket ${
|
|
141936
|
+
this.log(`Pushing bucket ${import_chalk14.default.bold(bucket["name"])} ...`);
|
|
141657
141937
|
const storageService = await getStorageService(this.projectClient);
|
|
141658
141938
|
try {
|
|
141659
141939
|
const remoteBucket = await storageService.getBucket(bucket["$id"]);
|
|
141660
141940
|
const hasChanges = hasBucketChanges(remoteBucket, bucket);
|
|
141661
141941
|
if (!hasChanges) {
|
|
141662
141942
|
this.log(
|
|
141663
|
-
`No changes detected for bucket ${
|
|
141943
|
+
`No changes detected for bucket ${import_chalk14.default.bold(bucket["name"])}. Skipping.`
|
|
141664
141944
|
);
|
|
141665
141945
|
continue;
|
|
141666
141946
|
}
|
|
@@ -141711,7 +141991,7 @@ var Push = class {
|
|
|
141711
141991
|
const errors = [];
|
|
141712
141992
|
for (const team of teams2) {
|
|
141713
141993
|
try {
|
|
141714
|
-
this.log(`Pushing team ${
|
|
141994
|
+
this.log(`Pushing team ${import_chalk14.default.bold(team["name"])} ...`);
|
|
141715
141995
|
const teamsService = await getTeamsService(this.projectClient);
|
|
141716
141996
|
try {
|
|
141717
141997
|
await teamsService.get(team["$id"]);
|
|
@@ -141745,7 +142025,7 @@ var Push = class {
|
|
|
141745
142025
|
const errors = [];
|
|
141746
142026
|
for (const webhook of webhooks2) {
|
|
141747
142027
|
try {
|
|
141748
|
-
this.log(`Pushing webhook ${
|
|
142028
|
+
this.log(`Pushing webhook ${import_chalk14.default.bold(webhook["name"])} ...`);
|
|
141749
142029
|
const webhooksService = await getWebhooksService(this.projectClient);
|
|
141750
142030
|
try {
|
|
141751
142031
|
await webhooksService.get({ webhookId: webhook["$id"] });
|
|
@@ -141787,7 +142067,7 @@ var Push = class {
|
|
|
141787
142067
|
const errors = [];
|
|
141788
142068
|
for (const topic of topics) {
|
|
141789
142069
|
try {
|
|
141790
|
-
this.log(`Pushing topic ${
|
|
142070
|
+
this.log(`Pushing topic ${import_chalk14.default.bold(topic["name"])} ...`);
|
|
141791
142071
|
const messagingService = await getMessagingService(this.projectClient);
|
|
141792
142072
|
try {
|
|
141793
142073
|
await messagingService.getTopic(topic["$id"]);
|
|
@@ -142234,9 +142514,9 @@ var Push = class {
|
|
|
142234
142514
|
process.stdout.write("\n");
|
|
142235
142515
|
}
|
|
142236
142516
|
if (dl.url) {
|
|
142237
|
-
this.log(`Preview link: ${
|
|
142517
|
+
this.log(`Preview link: ${import_chalk14.default.cyan(dl.url)}`);
|
|
142238
142518
|
}
|
|
142239
|
-
this.log(`Deployment page: ${
|
|
142519
|
+
this.log(`Deployment page: ${import_chalk14.default.cyan(dl.consoleUrl)}`);
|
|
142240
142520
|
});
|
|
142241
142521
|
process.stdout.write("\n");
|
|
142242
142522
|
}
|
|
@@ -142712,7 +142992,7 @@ var Push = class {
|
|
|
142712
142992
|
process.stdout.write("\n");
|
|
142713
142993
|
}
|
|
142714
142994
|
if (deploymentLogs.length > 1) {
|
|
142715
|
-
process.stdout.write(`${
|
|
142995
|
+
process.stdout.write(`${import_chalk14.default.cyan.bold(`Site: ${dl.name}`)}
|
|
142716
142996
|
`);
|
|
142717
142997
|
}
|
|
142718
142998
|
if (dl.screenshotsPending) {
|
|
@@ -142729,7 +143009,7 @@ var Push = class {
|
|
|
142729
143009
|
if (preview.preview) {
|
|
142730
143010
|
process.stdout.write(
|
|
142731
143011
|
`
|
|
142732
|
-
${
|
|
143012
|
+
${import_chalk14.default.cyan.bold("Screenshot preview")}
|
|
142733
143013
|
|
|
142734
143014
|
`
|
|
142735
143015
|
);
|
|
@@ -142753,9 +143033,9 @@ ${import_chalk13.default.cyan.bold("Screenshot preview")}
|
|
|
142753
143033
|
}
|
|
142754
143034
|
}
|
|
142755
143035
|
if (dl.url) {
|
|
142756
|
-
this.log(`Preview link: ${
|
|
143036
|
+
this.log(`Preview link: ${import_chalk14.default.cyan(dl.url)}`);
|
|
142757
143037
|
}
|
|
142758
|
-
this.log(`Deployment page: ${
|
|
143038
|
+
this.log(`Deployment page: ${import_chalk14.default.cyan(dl.consoleUrl)}`);
|
|
142759
143039
|
}
|
|
142760
143040
|
process.stdout.write("\n");
|
|
142761
143041
|
}
|
|
@@ -142851,7 +143131,7 @@ ${import_chalk13.default.cyan.bold("Screenshot preview")}
|
|
|
142851
143131
|
if (!hadChanges && columns.length <= 0 && indexes.length <= 0) {
|
|
142852
143132
|
if (!tablesChanged.has(table["$id"])) {
|
|
142853
143133
|
this.log(
|
|
142854
|
-
`No changes detected for table ${
|
|
143134
|
+
`No changes detected for table ${import_chalk14.default.bold(table["name"])}. Skipping.`
|
|
142855
143135
|
);
|
|
142856
143136
|
}
|
|
142857
143137
|
continue;
|
|
@@ -143176,7 +143456,7 @@ var pushSettings = async () => {
|
|
|
143176
143456
|
projectName: config2.projectName,
|
|
143177
143457
|
settings: config2.projectSettings
|
|
143178
143458
|
});
|
|
143179
|
-
success2(`Successfully pushed ${
|
|
143459
|
+
success2(`Successfully pushed ${import_chalk14.default.bold("all")} project settings.`);
|
|
143180
143460
|
} catch (e) {
|
|
143181
143461
|
throw e;
|
|
143182
143462
|
}
|
|
@@ -143298,11 +143578,11 @@ var pushSite = async ({
|
|
|
143298
143578
|
error48("No sites were pushed.");
|
|
143299
143579
|
} else if (successfullyDeployed !== successfullyPushed) {
|
|
143300
143580
|
warn(
|
|
143301
|
-
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} sites in ${
|
|
143581
|
+
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} sites in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143302
143582
|
);
|
|
143303
143583
|
} else {
|
|
143304
143584
|
success2(
|
|
143305
|
-
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "site" : "sites"} in ${
|
|
143585
|
+
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "site" : "sites"} in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143306
143586
|
);
|
|
143307
143587
|
}
|
|
143308
143588
|
} else {
|
|
@@ -143433,11 +143713,11 @@ var pushFunction = async ({
|
|
|
143433
143713
|
error48("No functions were pushed.");
|
|
143434
143714
|
} else if (successfullyDeployed !== successfullyPushed) {
|
|
143435
143715
|
warn(
|
|
143436
|
-
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} functions in ${
|
|
143716
|
+
`Successfully deployed ${successfullyDeployed} of ${successfullyPushed} functions in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143437
143717
|
);
|
|
143438
143718
|
} else {
|
|
143439
143719
|
success2(
|
|
143440
|
-
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "function" : "functions"} in ${
|
|
143720
|
+
`Successfully deployed ${successfullyPushed} ${successfullyPushed === 1 ? "function" : "functions"} in ${import_chalk14.default.bold(totalElapsed + "s")}.`
|
|
143441
143721
|
);
|
|
143442
143722
|
}
|
|
143443
143723
|
} else {
|
|
@@ -143518,7 +143798,7 @@ var pushTable = async ({
|
|
|
143518
143798
|
log("Found tables that exist remotely but not locally:");
|
|
143519
143799
|
const deletionChanges = tablesToDelete.map((table) => ({
|
|
143520
143800
|
id: table.$id,
|
|
143521
|
-
action:
|
|
143801
|
+
action: import_chalk14.default.red("deleting"),
|
|
143522
143802
|
key: "Table",
|
|
143523
143803
|
database: table.databaseName,
|
|
143524
143804
|
remote: table.name,
|
|
@@ -143906,7 +144186,7 @@ import fs15 from "fs";
|
|
|
143906
144186
|
import os8 from "os";
|
|
143907
144187
|
import path13 from "path";
|
|
143908
144188
|
import { spawn } from "child_process";
|
|
143909
|
-
var
|
|
144189
|
+
var import_chalk15 = __toESM(require_source(), 1);
|
|
143910
144190
|
var import_inquirer8 = __toESM(require_inquirer(), 1);
|
|
143911
144191
|
var { version: version2 } = package_default;
|
|
143912
144192
|
var getStandaloneBinaryArtifactName = () => {
|
|
@@ -143953,7 +144233,9 @@ var quoteShellArgument = (value) => {
|
|
|
143953
144233
|
};
|
|
143954
144234
|
var downloadStandaloneBinary = async (destinationPath) => {
|
|
143955
144235
|
const artifact = getStandaloneBinaryArtifactName();
|
|
143956
|
-
const response = await fetch(
|
|
144236
|
+
const response = await fetch(
|
|
144237
|
+
`${GITHUB_RELEASES_URL}/latest/download/${artifact}`
|
|
144238
|
+
);
|
|
143957
144239
|
if (!response.ok) {
|
|
143958
144240
|
throw new Error(
|
|
143959
144241
|
`Failed to download standalone binary (HTTP ${response.status}).`
|
|
@@ -144070,10 +144352,10 @@ var updateViaStandaloneBinary = async (latestVersion) => {
|
|
|
144070
144352
|
var showManualInstructions = (latestVersion) => {
|
|
144071
144353
|
log("Manual update options:");
|
|
144072
144354
|
console.log("");
|
|
144073
|
-
log(`${
|
|
144355
|
+
log(`${import_chalk15.default.bold("Option 1: NPM")}`);
|
|
144074
144356
|
console.log(` npm install -g ${NPM_PACKAGE_NAME}@latest`);
|
|
144075
144357
|
console.log("");
|
|
144076
|
-
log(`${
|
|
144358
|
+
log(`${import_chalk15.default.bold("Option 2: Homebrew")}`);
|
|
144077
144359
|
console.log(` brew upgrade appwrite`);
|
|
144078
144360
|
console.log("");
|
|
144079
144361
|
if (process.platform !== "win32") {
|
|
@@ -144084,7 +144366,7 @@ var showManualInstructions = (latestVersion) => {
|
|
|
144084
144366
|
throw new Error("Could not determine the standalone binary path.");
|
|
144085
144367
|
}
|
|
144086
144368
|
const tempPath = path13.join(os8.tmpdir(), path13.basename(targetPath));
|
|
144087
|
-
log(`${
|
|
144369
|
+
log(`${import_chalk15.default.bold("Option 3: Install Script / Standalone Binary")}`);
|
|
144088
144370
|
console.log(
|
|
144089
144371
|
` curl -fsSL ${GITHUB_RELEASES_URL}/latest/download/${artifact} -o ${tempPath}`
|
|
144090
144372
|
);
|
|
@@ -144094,7 +144376,7 @@ var showManualInstructions = (latestVersion) => {
|
|
|
144094
144376
|
} catch (_error) {
|
|
144095
144377
|
}
|
|
144096
144378
|
}
|
|
144097
|
-
log(`${
|
|
144379
|
+
log(`${import_chalk15.default.bold("Option 4: Download Binary")}`);
|
|
144098
144380
|
console.log(` Visit: ${GITHUB_RELEASES_URL}/latest`);
|
|
144099
144381
|
};
|
|
144100
144382
|
var chooseUpdateMethod = async (latestVersion) => {
|
|
@@ -144136,24 +144418,22 @@ var chooseUpdateMethod = async (latestVersion) => {
|
|
|
144136
144418
|
var updateCli = async ({ manual } = {}) => {
|
|
144137
144419
|
try {
|
|
144138
144420
|
const installationMethod = detectInstallationMethod();
|
|
144139
|
-
const latestVersion = await getLatestVersionForInstallation(
|
|
144140
|
-
installationMethod
|
|
144141
|
-
);
|
|
144421
|
+
const latestVersion = await getLatestVersionForInstallation(installationMethod);
|
|
144142
144422
|
const comparison = compareVersions(version2, latestVersion);
|
|
144143
144423
|
if (comparison === 0) {
|
|
144144
144424
|
success2(
|
|
144145
|
-
`You're already running the latest version (${
|
|
144425
|
+
`You're already running the latest version (${import_chalk15.default.bold(version2)})!`
|
|
144146
144426
|
);
|
|
144147
144427
|
return;
|
|
144148
144428
|
} else if (comparison < 0) {
|
|
144149
144429
|
warn(
|
|
144150
|
-
`You're running a newer version (${
|
|
144430
|
+
`You're running a newer version (${import_chalk15.default.bold(version2)}) than the latest released version (${import_chalk15.default.bold(latestVersion)}).`
|
|
144151
144431
|
);
|
|
144152
144432
|
hint("This might be a pre-release or development version.");
|
|
144153
144433
|
return;
|
|
144154
144434
|
}
|
|
144155
144435
|
log(
|
|
144156
|
-
`Updating from ${
|
|
144436
|
+
`Updating from ${import_chalk15.default.blue(version2)} to ${import_chalk15.default.green(latestVersion)}...`
|
|
144157
144437
|
);
|
|
144158
144438
|
console.log("");
|
|
144159
144439
|
if (manual) {
|
|
@@ -149106,16 +149386,16 @@ var VERSION_CHECK_TIMEOUT_MS = 5e3;
|
|
|
149106
149386
|
function writeUpdateAvailableNotice(currentVersion, latestVersion, toStderr = false) {
|
|
149107
149387
|
const stream = toStderr ? process.stderr : process.stdout;
|
|
149108
149388
|
stream.write(
|
|
149109
|
-
|
|
149389
|
+
import_chalk16.default.yellow(
|
|
149110
149390
|
`
|
|
149111
|
-
\u26A0\uFE0F A newer version is available: ${
|
|
149391
|
+
\u26A0\uFE0F A newer version is available: ${import_chalk16.default.bold(currentVersion)} ${import_chalk16.default.bold("\u2192")} ${import_chalk16.default.bold(
|
|
149112
149392
|
latestVersion
|
|
149113
149393
|
)}`
|
|
149114
149394
|
) + "\n"
|
|
149115
149395
|
);
|
|
149116
149396
|
stream.write(
|
|
149117
|
-
|
|
149118
|
-
`\u{1F4A1} Run '${
|
|
149397
|
+
import_chalk16.default.cyan(
|
|
149398
|
+
`\u{1F4A1} Run '${import_chalk16.default.bold("appwrite update")}' to update to the latest version.`
|
|
149119
149399
|
) + "\n\n"
|
|
149120
149400
|
);
|
|
149121
149401
|
}
|
|
@@ -149133,7 +149413,7 @@ async function maybeShowUpdateNotice() {
|
|
|
149133
149413
|
}
|
|
149134
149414
|
}
|
|
149135
149415
|
async function checkVersion() {
|
|
149136
|
-
process.stdout.write(
|
|
149416
|
+
process.stdout.write(import_chalk16.default.bold(`appwrite version ${version3}`) + "\n");
|
|
149137
149417
|
try {
|
|
149138
149418
|
const latestVersion = await getLatestVersionForCurrentInstallation({
|
|
149139
149419
|
timeoutMs: VERSION_CHECK_TIMEOUT_MS
|
|
@@ -149143,12 +149423,12 @@ async function checkVersion() {
|
|
|
149143
149423
|
if (comparison > 0) {
|
|
149144
149424
|
writeUpdateAvailableNotice(version3, latestVersion);
|
|
149145
149425
|
} else if (comparison === 0) {
|
|
149146
|
-
process.stdout.write(
|
|
149426
|
+
process.stdout.write(import_chalk16.default.green("\n\u2705 You are running the latest version!") + "\n");
|
|
149147
149427
|
} else {
|
|
149148
|
-
process.stdout.write(
|
|
149428
|
+
process.stdout.write(import_chalk16.default.blue("\n\u{1F680} You are running a pre-release or development version.") + "\n");
|
|
149149
149429
|
}
|
|
149150
149430
|
} catch (_error) {
|
|
149151
|
-
process.stdout.write(
|
|
149431
|
+
process.stdout.write(import_chalk16.default.gray("\n(Unable to check for updates)") + "\n");
|
|
149152
149432
|
}
|
|
149153
149433
|
}
|
|
149154
149434
|
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|