@secondlayer/cli 5.2.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2537,9 +2537,6 @@ async function resolveActiveTenant(_opts = {}) {
2537
2537
  fromEnv: false
2538
2538
  };
2539
2539
  }
2540
- function isOssMode() {
2541
- return !!process.env.SL_API_URL && !process.env.SL_SERVICE_KEY;
2542
- }
2543
2540
  var PLATFORM_API_URL2;
2544
2541
  var init_resolve_tenant = __esm(() => {
2545
2542
  init_session();
@@ -15629,8 +15626,8 @@ var require_fill_range = __commonJS((exports, module) => {
15629
15626
  return typeof value === "number" || typeof value === "string" && value !== "";
15630
15627
  };
15631
15628
  var isNumber = (num) => Number.isInteger(+num);
15632
- var zeros = (input6) => {
15633
- let value = `${input6}`;
15629
+ var zeros = (input5) => {
15630
+ let value = `${input5}`;
15634
15631
  let index = -1;
15635
15632
  if (value[0] === "-")
15636
15633
  value = value.slice(1);
@@ -15646,27 +15643,27 @@ var require_fill_range = __commonJS((exports, module) => {
15646
15643
  }
15647
15644
  return options2.stringify === true;
15648
15645
  };
15649
- var pad = (input6, maxLength, toNumber) => {
15646
+ var pad = (input5, maxLength, toNumber) => {
15650
15647
  if (maxLength > 0) {
15651
- let dash = input6[0] === "-" ? "-" : "";
15648
+ let dash = input5[0] === "-" ? "-" : "";
15652
15649
  if (dash)
15653
- input6 = input6.slice(1);
15654
- input6 = dash + input6.padStart(dash ? maxLength - 1 : maxLength, "0");
15650
+ input5 = input5.slice(1);
15651
+ input5 = dash + input5.padStart(dash ? maxLength - 1 : maxLength, "0");
15655
15652
  }
15656
15653
  if (toNumber === false) {
15657
- return String(input6);
15654
+ return String(input5);
15658
15655
  }
15659
- return input6;
15656
+ return input5;
15660
15657
  };
15661
- var toMaxLen = (input6, maxLength) => {
15662
- let negative = input6[0] === "-" ? "-" : "";
15658
+ var toMaxLen = (input5, maxLength) => {
15659
+ let negative = input5[0] === "-" ? "-" : "";
15663
15660
  if (negative) {
15664
- input6 = input6.slice(1);
15661
+ input5 = input5.slice(1);
15665
15662
  maxLength--;
15666
15663
  }
15667
- while (input6.length < maxLength)
15668
- input6 = "0" + input6;
15669
- return negative ? "-" + input6 : input6;
15664
+ while (input5.length < maxLength)
15665
+ input5 = "0" + input5;
15666
+ return negative ? "-" + input5 : input5;
15670
15667
  };
15671
15668
  var toSequence = (parts, options2, maxLen) => {
15672
15669
  parts.negatives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
@@ -16035,25 +16032,25 @@ var require_parse = __commonJS((exports, module) => {
16035
16032
  CHAR_NO_BREAK_SPACE,
16036
16033
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
16037
16034
  } = require_constants();
16038
- var parse2 = (input6, options2 = {}) => {
16039
- if (typeof input6 !== "string") {
16035
+ var parse2 = (input5, options2 = {}) => {
16036
+ if (typeof input5 !== "string") {
16040
16037
  throw new TypeError("Expected a string");
16041
16038
  }
16042
16039
  const opts = options2 || {};
16043
16040
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
16044
- if (input6.length > max) {
16045
- throw new SyntaxError(`Input length (${input6.length}), exceeds max characters (${max})`);
16041
+ if (input5.length > max) {
16042
+ throw new SyntaxError(`Input length (${input5.length}), exceeds max characters (${max})`);
16046
16043
  }
16047
- const ast = { type: "root", input: input6, nodes: [] };
16044
+ const ast = { type: "root", input: input5, nodes: [] };
16048
16045
  const stack = [ast];
16049
16046
  let block = ast;
16050
16047
  let prev = ast;
16051
16048
  let brackets = 0;
16052
- const length = input6.length;
16049
+ const length = input5.length;
16053
16050
  let index = 0;
16054
16051
  let depth = 0;
16055
16052
  let value;
16056
- const advance = () => input6[index++];
16053
+ const advance = () => input5[index++];
16057
16054
  const push = (node) => {
16058
16055
  if (node.type === "text" && prev.type === "dot") {
16059
16056
  prev.type = "text";
@@ -16248,10 +16245,10 @@ var require_braces = __commonJS((exports, module) => {
16248
16245
  var compile = require_compile();
16249
16246
  var expand = require_expand();
16250
16247
  var parse2 = require_parse();
16251
- var braces = (input6, options2 = {}) => {
16248
+ var braces = (input5, options2 = {}) => {
16252
16249
  let output = [];
16253
- if (Array.isArray(input6)) {
16254
- for (const pattern of input6) {
16250
+ if (Array.isArray(input5)) {
16251
+ for (const pattern of input5) {
16255
16252
  const result = braces.create(pattern, options2);
16256
16253
  if (Array.isArray(result)) {
16257
16254
  output.push(...result);
@@ -16260,31 +16257,31 @@ var require_braces = __commonJS((exports, module) => {
16260
16257
  }
16261
16258
  }
16262
16259
  } else {
16263
- output = [].concat(braces.create(input6, options2));
16260
+ output = [].concat(braces.create(input5, options2));
16264
16261
  }
16265
16262
  if (options2 && options2.expand === true && options2.nodupes === true) {
16266
16263
  output = [...new Set(output)];
16267
16264
  }
16268
16265
  return output;
16269
16266
  };
16270
- braces.parse = (input6, options2 = {}) => parse2(input6, options2);
16271
- braces.stringify = (input6, options2 = {}) => {
16272
- if (typeof input6 === "string") {
16273
- return stringify2(braces.parse(input6, options2), options2);
16267
+ braces.parse = (input5, options2 = {}) => parse2(input5, options2);
16268
+ braces.stringify = (input5, options2 = {}) => {
16269
+ if (typeof input5 === "string") {
16270
+ return stringify2(braces.parse(input5, options2), options2);
16274
16271
  }
16275
- return stringify2(input6, options2);
16272
+ return stringify2(input5, options2);
16276
16273
  };
16277
- braces.compile = (input6, options2 = {}) => {
16278
- if (typeof input6 === "string") {
16279
- input6 = braces.parse(input6, options2);
16274
+ braces.compile = (input5, options2 = {}) => {
16275
+ if (typeof input5 === "string") {
16276
+ input5 = braces.parse(input5, options2);
16280
16277
  }
16281
- return compile(input6, options2);
16278
+ return compile(input5, options2);
16282
16279
  };
16283
- braces.expand = (input6, options2 = {}) => {
16284
- if (typeof input6 === "string") {
16285
- input6 = braces.parse(input6, options2);
16280
+ braces.expand = (input5, options2 = {}) => {
16281
+ if (typeof input5 === "string") {
16282
+ input5 = braces.parse(input5, options2);
16286
16283
  }
16287
- let result = expand(input6, options2);
16284
+ let result = expand(input5, options2);
16288
16285
  if (options2.noempty === true) {
16289
16286
  result = result.filter(Boolean);
16290
16287
  }
@@ -16293,11 +16290,11 @@ var require_braces = __commonJS((exports, module) => {
16293
16290
  }
16294
16291
  return result;
16295
16292
  };
16296
- braces.create = (input6, options2 = {}) => {
16297
- if (input6 === "" || input6.length < 3) {
16298
- return [input6];
16293
+ braces.create = (input5, options2 = {}) => {
16294
+ if (input5 === "" || input5.length < 3) {
16295
+ return [input5];
16299
16296
  }
16300
- return options2.expand !== true ? braces.compile(input6, options2) : braces.expand(input6, options2);
16297
+ return options2.expand !== true ? braces.compile(input5, options2) : braces.expand(input5, options2);
16301
16298
  };
16302
16299
  module.exports = braces;
16303
16300
  });
@@ -16475,26 +16472,26 @@ var require_utils2 = __commonJS((exports) => {
16475
16472
  }
16476
16473
  return win32 === true || path2.sep === "\\";
16477
16474
  };
16478
- exports.escapeLast = (input6, char, lastIdx) => {
16479
- const idx = input6.lastIndexOf(char, lastIdx);
16475
+ exports.escapeLast = (input5, char, lastIdx) => {
16476
+ const idx = input5.lastIndexOf(char, lastIdx);
16480
16477
  if (idx === -1)
16481
- return input6;
16482
- if (input6[idx - 1] === "\\")
16483
- return exports.escapeLast(input6, char, idx - 1);
16484
- return `${input6.slice(0, idx)}\\${input6.slice(idx)}`;
16478
+ return input5;
16479
+ if (input5[idx - 1] === "\\")
16480
+ return exports.escapeLast(input5, char, idx - 1);
16481
+ return `${input5.slice(0, idx)}\\${input5.slice(idx)}`;
16485
16482
  };
16486
- exports.removePrefix = (input6, state = {}) => {
16487
- let output = input6;
16483
+ exports.removePrefix = (input5, state = {}) => {
16484
+ let output = input5;
16488
16485
  if (output.startsWith("./")) {
16489
16486
  output = output.slice(2);
16490
16487
  state.prefix = "./";
16491
16488
  }
16492
16489
  return output;
16493
16490
  };
16494
- exports.wrapOutput = (input6, state = {}, options2 = {}) => {
16491
+ exports.wrapOutput = (input5, state = {}, options2 = {}) => {
16495
16492
  const prepend = options2.contains ? "" : "^";
16496
16493
  const append = options2.contains ? "" : "$";
16497
- let output = `${prepend}(?:${input6})${append}`;
16494
+ let output = `${prepend}(?:${input5})${append}`;
16498
16495
  if (state.negated === true) {
16499
16496
  output = `(?:^(?!${output}).*$)`;
16500
16497
  }
@@ -16530,14 +16527,14 @@ var require_scan = __commonJS((exports, module) => {
16530
16527
  token.depth = token.isGlobstar ? Infinity : 1;
16531
16528
  }
16532
16529
  };
16533
- var scan = (input6, options2) => {
16530
+ var scan = (input5, options2) => {
16534
16531
  const opts = options2 || {};
16535
- const length = input6.length - 1;
16532
+ const length = input5.length - 1;
16536
16533
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
16537
16534
  const slashes = [];
16538
16535
  const tokens = [];
16539
16536
  const parts = [];
16540
- let str = input6;
16537
+ let str = input5;
16541
16538
  let index = -1;
16542
16539
  let start = 0;
16543
16540
  let lastIndex = 0;
@@ -16760,7 +16757,7 @@ var require_scan = __commonJS((exports, module) => {
16760
16757
  }
16761
16758
  const state = {
16762
16759
  prefix,
16763
- input: input6,
16760
+ input: input5,
16764
16761
  start,
16765
16762
  base,
16766
16763
  glob,
@@ -16784,7 +16781,7 @@ var require_scan = __commonJS((exports, module) => {
16784
16781
  for (let idx = 0;idx < slashes.length; idx++) {
16785
16782
  const n = prevIndex ? prevIndex + 1 : start;
16786
16783
  const i = slashes[idx];
16787
- const value = input6.slice(n, i);
16784
+ const value = input5.slice(n, i);
16788
16785
  if (opts.tokens) {
16789
16786
  if (idx === 0 && start !== 0) {
16790
16787
  tokens[idx].isPrefix = true;
@@ -16800,8 +16797,8 @@ var require_scan = __commonJS((exports, module) => {
16800
16797
  }
16801
16798
  prevIndex = i;
16802
16799
  }
16803
- if (prevIndex && prevIndex + 1 < input6.length) {
16804
- const value = input6.slice(prevIndex + 1);
16800
+ if (prevIndex && prevIndex + 1 < input5.length) {
16801
+ const value = input5.slice(prevIndex + 1);
16805
16802
  parts.push(value);
16806
16803
  if (opts.tokens) {
16807
16804
  tokens[tokens.length - 1].value = value;
@@ -16844,14 +16841,14 @@ var require_parse2 = __commonJS((exports, module) => {
16844
16841
  var syntaxError = (type, char) => {
16845
16842
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
16846
16843
  };
16847
- var parse2 = (input6, options2) => {
16848
- if (typeof input6 !== "string") {
16844
+ var parse2 = (input5, options2) => {
16845
+ if (typeof input5 !== "string") {
16849
16846
  throw new TypeError("Expected a string");
16850
16847
  }
16851
- input6 = REPLACEMENTS[input6] || input6;
16848
+ input5 = REPLACEMENTS[input5] || input5;
16852
16849
  const opts = { ...options2 };
16853
16850
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
16854
- let len = input6.length;
16851
+ let len = input5.length;
16855
16852
  if (len > max) {
16856
16853
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
16857
16854
  }
@@ -16888,7 +16885,7 @@ var require_parse2 = __commonJS((exports, module) => {
16888
16885
  opts.noextglob = opts.noext;
16889
16886
  }
16890
16887
  const state = {
16891
- input: input6,
16888
+ input: input5,
16892
16889
  index: -1,
16893
16890
  start: 0,
16894
16891
  dot: opts.dot === true,
@@ -16904,17 +16901,17 @@ var require_parse2 = __commonJS((exports, module) => {
16904
16901
  globstar: false,
16905
16902
  tokens
16906
16903
  };
16907
- input6 = utils.removePrefix(input6, state);
16908
- len = input6.length;
16904
+ input5 = utils.removePrefix(input5, state);
16905
+ len = input5.length;
16909
16906
  const extglobs = [];
16910
16907
  const braces = [];
16911
16908
  const stack = [];
16912
16909
  let prev = bos;
16913
16910
  let value;
16914
16911
  const eos = () => state.index === len - 1;
16915
- const peek = state.peek = (n = 1) => input6[state.index + n];
16916
- const advance = state.advance = () => input6[++state.index] || "";
16917
- const remaining = () => input6.slice(state.index + 1);
16912
+ const peek = state.peek = (n = 1) => input5[state.index + n];
16913
+ const advance = state.advance = () => input5[++state.index] || "";
16914
+ const remaining = () => input5.slice(state.index + 1);
16918
16915
  const consume = (value2 = "", num = 0) => {
16919
16916
  state.consumed += value2;
16920
16917
  state.index += num;
@@ -17004,9 +17001,9 @@ var require_parse2 = __commonJS((exports, module) => {
17004
17001
  push({ type: "paren", extglob: true, value, output });
17005
17002
  decrement("parens");
17006
17003
  };
17007
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input6)) {
17004
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input5)) {
17008
17005
  let backslashes = false;
17009
- let output = input6.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
17006
+ let output = input5.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
17010
17007
  if (first === "\\") {
17011
17008
  backslashes = true;
17012
17009
  return m;
@@ -17040,8 +17037,8 @@ var require_parse2 = __commonJS((exports, module) => {
17040
17037
  });
17041
17038
  }
17042
17039
  }
17043
- if (output === input6 && opts.contains === true) {
17044
- state.output = input6;
17040
+ if (output === input5 && opts.contains === true) {
17041
+ state.output = input5;
17045
17042
  return state;
17046
17043
  }
17047
17044
  state.output = utils.wrapOutput(output, state, options2);
@@ -17400,7 +17397,7 @@ var require_parse2 = __commonJS((exports, module) => {
17400
17397
  continue;
17401
17398
  }
17402
17399
  while (rest.slice(0, 3) === "/**") {
17403
- const after = input6[state.index + 4];
17400
+ const after = input5[state.index + 4];
17404
17401
  if (after && after !== "/") {
17405
17402
  break;
17406
17403
  }
@@ -17523,14 +17520,14 @@ var require_parse2 = __commonJS((exports, module) => {
17523
17520
  }
17524
17521
  return state;
17525
17522
  };
17526
- parse2.fastpaths = (input6, options2) => {
17523
+ parse2.fastpaths = (input5, options2) => {
17527
17524
  const opts = { ...options2 };
17528
17525
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
17529
- const len = input6.length;
17526
+ const len = input5.length;
17530
17527
  if (len > max) {
17531
17528
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
17532
17529
  }
17533
- input6 = REPLACEMENTS[input6] || input6;
17530
+ input5 = REPLACEMENTS[input5] || input5;
17534
17531
  const win32 = utils.isWindows(options2);
17535
17532
  const {
17536
17533
  DOT_LITERAL,
@@ -17585,7 +17582,7 @@ var require_parse2 = __commonJS((exports, module) => {
17585
17582
  }
17586
17583
  }
17587
17584
  };
17588
- const output = utils.removePrefix(input6, state);
17585
+ const output = utils.removePrefix(input5, state);
17589
17586
  let source = create2(output);
17590
17587
  if (source && opts.strictSlashes !== true) {
17591
17588
  source += `${SLASH_LITERAL}?`;
@@ -17605,7 +17602,7 @@ var require_picomatch = __commonJS((exports, module) => {
17605
17602
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
17606
17603
  var picomatch = (glob, options2, returnState = false) => {
17607
17604
  if (Array.isArray(glob)) {
17608
- const fns = glob.map((input6) => picomatch(input6, options2, returnState));
17605
+ const fns = glob.map((input5) => picomatch(input5, options2, returnState));
17609
17606
  const arrayMatcher = (str) => {
17610
17607
  for (const isMatch of fns) {
17611
17608
  const state2 = isMatch(str);
@@ -17630,9 +17627,9 @@ var require_picomatch = __commonJS((exports, module) => {
17630
17627
  const ignoreOpts = { ...options2, ignore: null, onMatch: null, onResult: null };
17631
17628
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
17632
17629
  }
17633
- const matcher = (input6, returnObject = false) => {
17634
- const { isMatch, match, output } = picomatch.test(input6, regex, options2, { glob, posix });
17635
- const result = { glob, state, regex, posix, input: input6, output, match, isMatch };
17630
+ const matcher = (input5, returnObject = false) => {
17631
+ const { isMatch, match, output } = picomatch.test(input5, regex, options2, { glob, posix });
17632
+ const result = { glob, state, regex, posix, input: input5, output, match, isMatch };
17636
17633
  if (typeof opts.onResult === "function") {
17637
17634
  opts.onResult(result);
17638
17635
  }
@@ -17640,7 +17637,7 @@ var require_picomatch = __commonJS((exports, module) => {
17640
17637
  result.isMatch = false;
17641
17638
  return returnObject ? result : false;
17642
17639
  }
17643
- if (isIgnored(input6)) {
17640
+ if (isIgnored(input5)) {
17644
17641
  if (typeof opts.onIgnore === "function") {
17645
17642
  opts.onIgnore(result);
17646
17643
  }
@@ -17657,33 +17654,33 @@ var require_picomatch = __commonJS((exports, module) => {
17657
17654
  }
17658
17655
  return matcher;
17659
17656
  };
17660
- picomatch.test = (input6, regex, options2, { glob, posix } = {}) => {
17661
- if (typeof input6 !== "string") {
17657
+ picomatch.test = (input5, regex, options2, { glob, posix } = {}) => {
17658
+ if (typeof input5 !== "string") {
17662
17659
  throw new TypeError("Expected input to be a string");
17663
17660
  }
17664
- if (input6 === "") {
17661
+ if (input5 === "") {
17665
17662
  return { isMatch: false, output: "" };
17666
17663
  }
17667
17664
  const opts = options2 || {};
17668
17665
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
17669
- let match = input6 === glob;
17670
- let output = match && format ? format(input6) : input6;
17666
+ let match = input5 === glob;
17667
+ let output = match && format ? format(input5) : input5;
17671
17668
  if (match === false) {
17672
- output = format ? format(input6) : input6;
17669
+ output = format ? format(input5) : input5;
17673
17670
  match = output === glob;
17674
17671
  }
17675
17672
  if (match === false || opts.capture === true) {
17676
17673
  if (opts.matchBase === true || opts.basename === true) {
17677
- match = picomatch.matchBase(input6, regex, options2, posix);
17674
+ match = picomatch.matchBase(input5, regex, options2, posix);
17678
17675
  } else {
17679
17676
  match = regex.exec(output);
17680
17677
  }
17681
17678
  }
17682
17679
  return { isMatch: Boolean(match), match, output };
17683
17680
  };
17684
- picomatch.matchBase = (input6, glob, options2, posix = utils.isWindows(options2)) => {
17681
+ picomatch.matchBase = (input5, glob, options2, posix = utils.isWindows(options2)) => {
17685
17682
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options2);
17686
- return regex.test(path2.basename(input6));
17683
+ return regex.test(path2.basename(input5));
17687
17684
  };
17688
17685
  picomatch.isMatch = (str, patterns, options2) => picomatch(patterns, options2)(str);
17689
17686
  picomatch.parse = (pattern, options2) => {
@@ -17691,7 +17688,7 @@ var require_picomatch = __commonJS((exports, module) => {
17691
17688
  return pattern.map((p) => picomatch.parse(p, options2));
17692
17689
  return parse2(pattern, { ...options2, fastpaths: false });
17693
17690
  };
17694
- picomatch.scan = (input6, options2) => scan(input6, options2);
17691
+ picomatch.scan = (input5, options2) => scan(input5, options2);
17695
17692
  picomatch.compileRe = (state, options2, returnOutput = false, returnState = false) => {
17696
17693
  if (returnOutput === true) {
17697
17694
  return state.output;
@@ -17709,16 +17706,16 @@ var require_picomatch = __commonJS((exports, module) => {
17709
17706
  }
17710
17707
  return regex;
17711
17708
  };
17712
- picomatch.makeRe = (input6, options2 = {}, returnOutput = false, returnState = false) => {
17713
- if (!input6 || typeof input6 !== "string") {
17709
+ picomatch.makeRe = (input5, options2 = {}, returnOutput = false, returnState = false) => {
17710
+ if (!input5 || typeof input5 !== "string") {
17714
17711
  throw new TypeError("Expected a non-empty string");
17715
17712
  }
17716
17713
  let parsed = { negated: false, fastpaths: true };
17717
- if (options2.fastpaths !== false && (input6[0] === "." || input6[0] === "*")) {
17718
- parsed.output = parse2.fastpaths(input6, options2);
17714
+ if (options2.fastpaths !== false && (input5[0] === "." || input5[0] === "*")) {
17715
+ parsed.output = parse2.fastpaths(input5, options2);
17719
17716
  }
17720
17717
  if (!parsed.output) {
17721
- parsed = parse2(input6, options2);
17718
+ parsed = parse2(input5, options2);
17722
17719
  }
17723
17720
  return picomatch.compileRe(parsed, options2, returnOutput, returnState);
17724
17721
  };
@@ -17864,10 +17861,10 @@ var require_micromatch = __commonJS((exports, module) => {
17864
17861
  }
17865
17862
  return [].concat(patterns).every((p) => picomatch(p, options2)(str));
17866
17863
  };
17867
- micromatch.capture = (glob, input6, options2) => {
17864
+ micromatch.capture = (glob, input5, options2) => {
17868
17865
  let posix = utils.isWindows(options2);
17869
17866
  let regex = picomatch.makeRe(String(glob), { ...options2, capture: true });
17870
- let match = regex.exec(posix ? utils.toPosixSlashes(input6) : input6);
17867
+ let match = regex.exec(posix ? utils.toPosixSlashes(input5) : input5);
17871
17868
  if (match) {
17872
17869
  return match.slice(1).map((v) => v === undefined ? "" : v);
17873
17870
  }
@@ -18202,12 +18199,12 @@ var require_stream = __commonJS((exports) => {
18202
18199
  var require_string = __commonJS((exports) => {
18203
18200
  Object.defineProperty(exports, "__esModule", { value: true });
18204
18201
  exports.isEmpty = exports.isString = undefined;
18205
- function isString(input6) {
18206
- return typeof input6 === "string";
18202
+ function isString(input5) {
18203
+ return typeof input5 === "string";
18207
18204
  }
18208
18205
  exports.isString = isString;
18209
- function isEmpty(input6) {
18210
- return input6 === "";
18206
+ function isEmpty(input5) {
18207
+ return input5 === "";
18211
18208
  }
18212
18209
  exports.isEmpty = isEmpty;
18213
18210
  });
@@ -18237,8 +18234,8 @@ var require_tasks = __commonJS((exports) => {
18237
18234
  Object.defineProperty(exports, "__esModule", { value: true });
18238
18235
  exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = undefined;
18239
18236
  var utils = require_utils3();
18240
- function generate(input6, settings) {
18241
- const patterns = processPatterns(input6, settings);
18237
+ function generate(input5, settings) {
18238
+ const patterns = processPatterns(input5, settings);
18242
18239
  const ignore = processPatterns(settings.ignore, settings);
18243
18240
  const positivePatterns = getPositivePatterns(patterns);
18244
18241
  const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
@@ -18249,8 +18246,8 @@ var require_tasks = __commonJS((exports) => {
18249
18246
  return staticTasks.concat(dynamicTasks);
18250
18247
  }
18251
18248
  exports.generate = generate;
18252
- function processPatterns(input6, settings) {
18253
- let patterns = input6;
18249
+ function processPatterns(input5, settings) {
18250
+ let patterns = input5;
18254
18251
  if (settings.braceExpansion) {
18255
18252
  patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
18256
18253
  }
@@ -20206,8 +20203,8 @@ var require_out4 = __commonJS((exports, module) => {
20206
20203
  const provider = new _Provider(settings);
20207
20204
  return tasks.map(provider.read, provider);
20208
20205
  }
20209
- function assertPatternsInput(input6) {
20210
- const source = [].concat(input6);
20206
+ function assertPatternsInput(input5) {
20207
+ const source = [].concat(input5);
20211
20208
  const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
20212
20209
  if (!isValidSource) {
20213
20210
  throw new TypeError("Patterns must be a string (non empty) or an array of strings");
@@ -22316,10 +22313,10 @@ function requireStyle() {
22316
22313
  const c2 = requireKleur();
22317
22314
  const figures = requireFigures();
22318
22315
  const styles3 = Object.freeze({
22319
- password: { scale: 1, render: (input6) => "*".repeat(input6.length) },
22320
- emoji: { scale: 2, render: (input6) => "\uD83D\uDE03".repeat(input6.length) },
22321
- invisible: { scale: 0, render: (input6) => "" },
22322
- default: { scale: 1, render: (input6) => `${input6}` }
22316
+ password: { scale: 1, render: (input5) => "*".repeat(input5.length) },
22317
+ emoji: { scale: 2, render: (input5) => "\uD83D\uDE03".repeat(input5.length) },
22318
+ invisible: { scale: 0, render: (input5) => "" },
22319
+ default: { scale: 1, render: (input5) => `${input5}` }
22323
22320
  });
22324
22321
  const render = (type) => styles3[type] || styles3.default;
22325
22322
  const symbols = Object.freeze({
@@ -22659,7 +22656,7 @@ ${i2 ? " " : figures.pointerSmall} ${color.red().italic(l2)}`, ``);
22659
22656
  }
22660
22657
  function requireSelect() {
22661
22658
  if (hasRequiredSelect)
22662
- return select5;
22659
+ return select4;
22663
22660
  hasRequiredSelect = 1;
22664
22661
  const color = requireKleur();
22665
22662
  const Prompt = requirePrompt();
@@ -22805,8 +22802,8 @@ function requireSelect() {
22805
22802
  this.out.write(this.outputText);
22806
22803
  }
22807
22804
  }
22808
- select5 = SelectPrompt;
22809
- return select5;
22805
+ select4 = SelectPrompt;
22806
+ return select4;
22810
22807
  }
22811
22808
  function requireToggle() {
22812
22809
  if (hasRequiredToggle)
@@ -24178,7 +24175,7 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter so
24178
24175
  }
24179
24176
  function requireConfirm() {
24180
24177
  if (hasRequiredConfirm)
24181
- return confirm6;
24178
+ return confirm5;
24182
24179
  hasRequiredConfirm = 1;
24183
24180
  const color = requireKleur();
24184
24181
  const Prompt = requirePrompt();
@@ -24251,8 +24248,8 @@ function requireConfirm() {
24251
24248
  this.out.write(erase.line + cursor.to(0) + this.outputText);
24252
24249
  }
24253
24250
  }
24254
- confirm6 = ConfirmPrompt;
24255
- return confirm6;
24251
+ confirm5 = ConfirmPrompt;
24252
+ return confirm5;
24256
24253
  }
24257
24254
  function requireElements() {
24258
24255
  if (hasRequiredElements)
@@ -24327,7 +24324,7 @@ function requirePrompts$1() {
24327
24324
  onSubmit: toSelected
24328
24325
  });
24329
24326
  };
24330
- const byTitle = (input6, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input6.length).toLowerCase() === input6.toLowerCase()));
24327
+ const byTitle = (input5, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input5.length).toLowerCase() === input5.toLowerCase()));
24331
24328
  $.autocomplete = (args) => {
24332
24329
  args.suggest = args.suggest || byTitle;
24333
24330
  args.choices = [].concat(args.choices || []);
@@ -24932,7 +24929,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
24932
24929
  }
24933
24930
  return agent;
24934
24931
  }
24935
- var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select5, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect, confirm6, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
24932
+ var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select4, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect, confirm5, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
24936
24933
  OSC,
24937
24934
  "8",
24938
24935
  SEP,
@@ -25616,12 +25613,12 @@ var init_figures = __esm(() => {
25616
25613
  import tty2 from "node:tty";
25617
25614
  var hasColors, format = (open, close) => {
25618
25615
  if (!hasColors) {
25619
- return (input6) => input6;
25616
+ return (input5) => input5;
25620
25617
  }
25621
25618
  const openCode = `\x1B[${open}m`;
25622
25619
  const closeCode = `\x1B[${close}m`;
25623
- return (input6) => {
25624
- const string = input6 + "";
25620
+ return (input5) => {
25621
+ const string = input5 + "";
25625
25622
  let index = string.indexOf(closeCode);
25626
25623
  if (index === -1) {
25627
25624
  return openCode + string + closeCode;
@@ -27730,16 +27727,16 @@ var init_options2 = __esm(() => {
27730
27727
  var concatenateShell = (file, commandArguments, options3) => options3.shell && commandArguments.length > 0 ? [[file, ...commandArguments].join(" "), [], options3] : [file, commandArguments, options3];
27731
27728
 
27732
27729
  // ../../node_modules/strip-final-newline/index.js
27733
- function stripFinalNewline(input6) {
27734
- if (typeof input6 === "string") {
27735
- return stripFinalNewlineString(input6);
27730
+ function stripFinalNewline(input5) {
27731
+ if (typeof input5 === "string") {
27732
+ return stripFinalNewlineString(input5);
27736
27733
  }
27737
- if (!(ArrayBuffer.isView(input6) && input6.BYTES_PER_ELEMENT === 1)) {
27734
+ if (!(ArrayBuffer.isView(input5) && input5.BYTES_PER_ELEMENT === 1)) {
27738
27735
  throw new Error("Input must be a string or a Uint8Array");
27739
27736
  }
27740
- return stripFinalNewlineBinary(input6);
27737
+ return stripFinalNewlineBinary(input5);
27741
27738
  }
27742
- var stripFinalNewlineString = (input6) => input6.at(-1) === LF ? input6.slice(0, input6.at(-2) === CR ? -2 : -1) : input6, stripFinalNewlineBinary = (input6) => input6.at(-1) === LF_BINARY ? input6.subarray(0, input6.at(-2) === CR_BINARY ? -2 : -1) : input6, LF = `
27739
+ var stripFinalNewlineString = (input5) => input5.at(-1) === LF ? input5.slice(0, input5.at(-2) === CR ? -2 : -1) : input5, stripFinalNewlineBinary = (input5) => input5.at(-1) === LF_BINARY ? input5.subarray(0, input5.at(-2) === CR_BINARY ? -2 : -1) : input5, LF = `
27743
27740
  `, LF_BINARY, CR = "\r", CR_BINARY;
27744
27741
  var init_strip_final_newline = __esm(() => {
27745
27742
  LF_BINARY = LF.codePointAt(0);
@@ -28778,21 +28775,21 @@ var init_native = __esm(() => {
28778
28775
  });
28779
28776
 
28780
28777
  // ../../node_modules/execa/lib/stdio/input-option.js
28781
- var handleInputOptions = ({ input: input6, inputFile }, fdNumber) => fdNumber === 0 ? [
28782
- ...handleInputOption(input6),
28778
+ var handleInputOptions = ({ input: input5, inputFile }, fdNumber) => fdNumber === 0 ? [
28779
+ ...handleInputOption(input5),
28783
28780
  ...handleInputFileOption(inputFile)
28784
- ] : [], handleInputOption = (input6) => input6 === undefined ? [] : [{
28785
- type: getInputType(input6),
28786
- value: input6,
28781
+ ] : [], handleInputOption = (input5) => input5 === undefined ? [] : [{
28782
+ type: getInputType(input5),
28783
+ value: input5,
28787
28784
  optionName: "input"
28788
- }], getInputType = (input6) => {
28789
- if (isReadableStream(input6, { checkOpen: false })) {
28785
+ }], getInputType = (input5) => {
28786
+ if (isReadableStream(input5, { checkOpen: false })) {
28790
28787
  return "nodeStream";
28791
28788
  }
28792
- if (typeof input6 === "string") {
28789
+ if (typeof input5 === "string") {
28793
28790
  return "string";
28794
28791
  }
28795
- if (isUint8Array(input6)) {
28792
+ if (isUint8Array(input5)) {
28796
28793
  return "uint8Array";
28797
28794
  }
28798
28795
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -31908,7 +31905,7 @@ var init_command2 = __esm(() => {
31908
31905
  var setScriptSync = (boundExeca, createNested, boundOptions) => {
31909
31906
  boundExeca.sync = createNested(mapScriptSync, boundOptions);
31910
31907
  boundExeca.s = boundExeca.sync;
31911
- }, mapScriptAsync = ({ options: options3 }) => getScriptOptions(options3), mapScriptSync = ({ options: options3 }) => ({ ...getScriptOptions(options3), isSync: true }), getScriptOptions = (options3) => ({ options: { ...getScriptStdinOption(options3), ...options3 } }), getScriptStdinOption = ({ input: input6, inputFile, stdio }) => input6 === undefined && inputFile === undefined && stdio === undefined ? { stdin: "inherit" } : {}, deepScriptOptions;
31908
+ }, mapScriptAsync = ({ options: options3 }) => getScriptOptions(options3), mapScriptSync = ({ options: options3 }) => ({ ...getScriptOptions(options3), isSync: true }), getScriptOptions = (options3) => ({ options: { ...getScriptStdinOption(options3), ...options3 } }), getScriptStdinOption = ({ input: input5, inputFile, stdio }) => input5 === undefined && inputFile === undefined && stdio === undefined ? { stdin: "inherit" } : {}, deepScriptOptions;
31912
31909
  var init_script = __esm(() => {
31913
31910
  deepScriptOptions = { preferLocal: true };
31914
31911
  });
@@ -32019,20 +32016,20 @@ __export(exports_generate, {
32019
32016
  import path10 from "node:path";
32020
32017
  import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
32021
32018
  import { toCamelCase as toCamelCase8 } from "@secondlayer/stacks/clarity";
32022
- function isContractAddress(input6) {
32019
+ function isContractAddress(input5) {
32023
32020
  const contractIdPattern = /^(SP|ST|SM|SN)[A-Z0-9]{38,}\.[a-zA-Z][a-zA-Z0-9-]*$/;
32024
- return contractIdPattern.test(input6);
32021
+ return contractIdPattern.test(input5);
32025
32022
  }
32026
32023
  async function parseInputs(inputs) {
32027
32024
  const files = [];
32028
32025
  const contractIds = [];
32029
- for (const input6 of inputs) {
32030
- if (isContractAddress(input6)) {
32031
- contractIds.push(input6);
32026
+ for (const input5 of inputs) {
32027
+ if (isContractAddress(input5)) {
32028
+ contractIds.push(input5);
32032
32029
  continue;
32033
32030
  }
32034
- if (input6.includes("*") || input6.includes("?")) {
32035
- const matches = await import_fast_glob.default(input6, { cwd: process.cwd(), absolute: true });
32031
+ if (input5.includes("*") || input5.includes("?")) {
32032
+ const matches = await import_fast_glob.default(input5, { cwd: process.cwd(), absolute: true });
32036
32033
  for (const file of matches) {
32037
32034
  if (file.endsWith(".clar")) {
32038
32035
  files.push(file);
@@ -32040,8 +32037,8 @@ async function parseInputs(inputs) {
32040
32037
  }
32041
32038
  continue;
32042
32039
  }
32043
- if (input6.endsWith(".clar")) {
32044
- const absolutePath = path10.resolve(process.cwd(), input6);
32040
+ if (input5.endsWith(".clar")) {
32041
+ const absolutePath = path10.resolve(process.cwd(), input5);
32045
32042
  files.push(absolutePath);
32046
32043
  }
32047
32044
  }
@@ -32324,7 +32321,7 @@ var {
32324
32321
  // package.json
32325
32322
  var package_default = {
32326
32323
  name: "@secondlayer/cli",
32327
- version: "5.2.1",
32324
+ version: "5.3.0",
32328
32325
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32329
32326
  type: "module",
32330
32327
  bin: {
@@ -32368,7 +32365,7 @@ var package_default = {
32368
32365
  "@inquirer/prompts": "^8.2.0",
32369
32366
  "@secondlayer/bundler": "^0.3.5",
32370
32367
  "@secondlayer/sdk": "^3.6.0",
32371
- "@secondlayer/shared": "^6.3.4",
32368
+ "@secondlayer/shared": "^6.4.0",
32372
32369
  "@secondlayer/stacks": "^2.2.0",
32373
32370
  "@secondlayer/subgraphs": "^2.0.0",
32374
32371
  "@biomejs/js-api": "^0.7.0",
@@ -36815,395 +36812,14 @@ function registerLogoutCommand(program2) {
36815
36812
  success("Logged out.");
36816
36813
  });
36817
36814
  }
36818
- // src/commands/instance.ts
36819
- init_config();
36820
- import { confirm as confirm5, input as input4, select as select4 } from "@inquirer/prompts";
36821
- init_output();
36822
- init_resolve_tenant();
36823
- var INSTANCE_CREATE_TIMEOUT_MS = 180000;
36824
- function registerInstanceCommand(program2) {
36825
- const instance = program2.command("instance", { hidden: true }).description("Manage your dedicated Secondlayer instance");
36826
- instance.command("create").description("Provision a new dedicated instance for the active project").option("--plan <plan>", "Plan: launch | scale", "launch").action(async (opts) => {
36827
- guardOssMode();
36828
- const activeSlug = await requireActiveProject();
36829
- const plan = opts.plan;
36830
- if (!["launch", "scale"].includes(plan)) {
36831
- error(`Invalid plan: ${plan} (expected launch or scale)`);
36832
- process.exit(1);
36833
- }
36834
- const spinner = createSpinner("Provisioning your instance (~60s; safe to interrupt — instance will still be created; check `sl instance info`)");
36835
- try {
36836
- const res = await httpPlatform(`/api/projects/${encodeURIComponent(activeSlug)}/instance`, {
36837
- method: "POST",
36838
- body: { plan },
36839
- timeoutMs: INSTANCE_CREATE_TIMEOUT_MS
36840
- });
36841
- spinner.succeed(`Instance provisioned: ${res.tenant.slug}`);
36842
- printKeyReveal(res.tenant, res.credentials);
36843
- } catch (err) {
36844
- if (isTimeoutError(err)) {
36845
- spinner.fail("Provision request timed out after 3 minutes.");
36846
- error("Provisioning may still finish server-side. Run `sl instance info` to check before retrying.");
36847
- process.exit(1);
36848
- }
36849
- if (err instanceof CliHttpError && err.code === "SUBSCRIPTION_REQUIRED") {
36850
- spinner.fail("Trial required before provisioning.");
36851
- await printTrialCheckoutUrl(plan);
36852
- process.exit(1);
36853
- }
36854
- spinner.fail("Provision failed.");
36855
- handleInstanceError(err, "provision instance");
36856
- }
36857
- });
36858
- instance.command("info").description("Show the active project's instance").action(async () => {
36859
- guardOssMode();
36860
- await renderInstanceInfo();
36861
- });
36862
- instance.command("resize").description("Change your instance plan (brief downtime)").option("--plan <plan>", "Target plan: launch | scale").option("--yes", "Skip confirm").action(async (opts) => {
36863
- guardOssMode();
36864
- let target = opts.plan;
36865
- if (!target) {
36866
- const answer = await select4({
36867
- message: "Target plan",
36868
- choices: [
36869
- {
36870
- value: "launch",
36871
- name: "Launch — $99/mo (2 vCPU · 6 GB · 100 GB)"
36872
- },
36873
- {
36874
- value: "scale",
36875
- name: "Scale — $299/mo (8 vCPU · 24 GB · 500 GB)"
36876
- }
36877
- ]
36878
- });
36879
- target = answer;
36880
- }
36881
- if (!["launch", "scale"].includes(target)) {
36882
- error(`Invalid plan: ${target} (expected launch or scale)`);
36883
- process.exit(1);
36884
- }
36885
- if (!opts.yes) {
36886
- const ok = await confirm5({
36887
- message: `Resize to ${target}? ~30s downtime while containers recreate. Data preserved.`,
36888
- default: false
36889
- });
36890
- if (!ok) {
36891
- info("Cancelled.");
36892
- return;
36893
- }
36894
- }
36895
- try {
36896
- await httpPlatform("/api/tenants/me/resize", {
36897
- method: "POST",
36898
- body: { plan: target }
36899
- });
36900
- success(`Resized to ${target}.`);
36901
- } catch (err) {
36902
- handleInstanceError(err, "resize");
36903
- }
36904
- });
36905
- instance.command("suspend").description("Stop your instance (data preserved)").action(async () => {
36906
- guardOssMode();
36907
- try {
36908
- await httpPlatform("/api/tenants/me/suspend", { method: "POST" });
36909
- success("Instance suspended.");
36910
- } catch (err) {
36911
- handleInstanceError(err, "suspend");
36912
- }
36913
- });
36914
- instance.command("resume").description("Start a suspended instance").action(async () => {
36915
- guardOssMode();
36916
- try {
36917
- await httpPlatform("/api/tenants/me/resume", { method: "POST" });
36918
- success("Instance resumed.");
36919
- } catch (err) {
36920
- handleInstanceError(err, "resume");
36921
- }
36922
- });
36923
- instance.command("delete").description("Permanently delete your instance + all data").option("--yes", "Skip typed-slug confirm").action(async (opts) => {
36924
- guardOssMode();
36925
- const tenant = await fetchCurrentTenant();
36926
- if (!tenant) {
36927
- warn("No instance to delete.");
36928
- return;
36929
- }
36930
- const slug = tenant.slug;
36931
- if (!opts.yes) {
36932
- if (!process.stdin.isTTY) {
36933
- error(`Refusing to prompt in a non-interactive terminal. Re-run with --yes to delete instance "${slug}".`);
36934
- process.exit(1);
36935
- }
36936
- const typed = await input4({
36937
- message: `Type the slug "${slug}" to confirm permanent deletion`,
36938
- validate: (v) => v === slug ? true : "Slug must match exactly"
36939
- });
36940
- if (typed !== slug)
36941
- return;
36942
- }
36943
- try {
36944
- await httpPlatform("/api/tenants/me", { method: "DELETE" });
36945
- success("Instance deleted.");
36946
- } catch (err) {
36947
- const afterDelete = await fetchCurrentTenant().catch(() => {
36948
- return;
36949
- });
36950
- if (afterDelete === null) {
36951
- success("Instance deleted.");
36952
- return;
36953
- }
36954
- handleInstanceError(err, "delete");
36955
- }
36956
- });
36957
- const keys = instance.command("keys").description("Rotate long-lived keys (service, anon)");
36958
- keys.command("rotate").description("Rotate one or both keys").option("--service", "Rotate the service key").option("--anon", "Rotate the anon key").option("--both", "Rotate both keys (nuclear)").action(async (opts) => {
36959
- guardOssMode();
36960
- let type;
36961
- if (opts.both || opts.service && opts.anon)
36962
- type = "both";
36963
- else if (opts.service)
36964
- type = "service";
36965
- else if (opts.anon)
36966
- type = "anon";
36967
- else {
36968
- const answer = await select4({
36969
- message: "Which key(s) to rotate?",
36970
- choices: [
36971
- {
36972
- value: "service",
36973
- name: "Service key (full access, server-side)"
36974
- },
36975
- { value: "anon", name: "Anon key (read-only, client-safe)" },
36976
- {
36977
- value: "both",
36978
- name: "Both (nuclear — offboarding/leak response)"
36979
- }
36980
- ]
36981
- });
36982
- type = answer;
36983
- }
36984
- try {
36985
- const res = await httpPlatform("/api/tenants/me/keys/rotate", {
36986
- method: "POST",
36987
- body: { type }
36988
- });
36989
- success(`${type === "both" ? "Keys" : `${type} key`} rotated.`);
36990
- const rows = [];
36991
- if (res.rotated.serviceKey)
36992
- rows.push(["New service key", res.rotated.serviceKey]);
36993
- if (res.rotated.anonKey)
36994
- rows.push(["New anon key", res.rotated.anonKey]);
36995
- console.log("");
36996
- console.log(warn_box("⚠ Shown once. Save these now — we can't retrieve them later."));
36997
- console.log("");
36998
- console.log(formatKeyValue(rows));
36999
- console.log("");
37000
- } catch (err) {
37001
- handleInstanceError(err, "rotate keys");
37002
- }
37003
- });
37004
- const db = instance.command("db").description("Get a DATABASE_URL for direct Postgres access (via SSH tunnel)");
37005
- db.command("info", { isDefault: true }).description("Print SSH tunnel command + DATABASE_URL for the instance").action(async () => {
37006
- guardOssMode();
37007
- try {
37008
- const res = await httpPlatform("/api/tenants/me/db-access");
37009
- console.log("");
37010
- console.log(dim("1. Upload your public key (one time):"));
37011
- console.log(dim(" sl instance db add-key ~/.ssh/id_ed25519.pub"));
37012
- console.log("");
37013
- console.log(dim("2. Open the SSH tunnel in a separate terminal:"));
37014
- console.log(green(` ${res.sshCommand}`));
37015
- console.log("");
37016
- console.log(dim("3. Use this DATABASE_URL while the tunnel is open:"));
37017
- console.log(green(` ${res.databaseUrl}`));
37018
- console.log("");
37019
- } catch (err) {
37020
- handleInstanceError(err, "fetch db access info");
37021
- }
37022
- });
37023
- db.command("add-key <path>").description("Upload an SSH public key to the bastion for this instance").action(async (path2) => {
37024
- guardOssMode();
37025
- let publicKey;
37026
- try {
37027
- publicKey = (await Bun.file(path2).text()).trim();
37028
- } catch (err) {
37029
- error(`Could not read ${path2}: ${err instanceof Error ? err.message : String(err)}`);
37030
- process.exit(1);
37031
- }
37032
- if (!publicKey) {
37033
- error(`${path2} is empty`);
37034
- process.exit(1);
37035
- }
37036
- try {
37037
- await httpPlatform("/api/tenants/me/db-access/key", { method: "POST", body: { publicKey } });
37038
- success("Bastion key installed. You can now open the SSH tunnel.");
37039
- } catch (err) {
37040
- handleInstanceError(err, "upload bastion key");
37041
- }
37042
- });
37043
- db.command("revoke-key").description("Revoke bastion access for this instance").option("-y, --yes", "Skip confirmation").action(async (opts) => {
37044
- guardOssMode();
37045
- if (!opts.yes) {
37046
- const ok = await confirm5({
37047
- message: "Revoke bastion access for this instance?",
37048
- default: false
37049
- });
37050
- if (!ok)
37051
- return;
37052
- }
37053
- try {
37054
- await httpPlatform("/api/tenants/me/db-access/key", { method: "DELETE" });
37055
- success("Bastion access revoked.");
37056
- } catch (err) {
37057
- handleInstanceError(err, "revoke bastion key");
37058
- }
37059
- });
37060
- }
37061
- async function printTrialCheckoutUrl(plan) {
37062
- const res = await httpPlatform("/api/billing/upgrade", {
37063
- method: "POST",
37064
- body: { tier: plan }
37065
- });
37066
- if (!res.url) {
37067
- error("No checkout URL returned. Open Billing in the dashboard.");
37068
- return;
37069
- }
37070
- info("Start your 30-day trial, then rerun this command:");
37071
- console.log(green(res.url));
37072
- }
37073
- function guardOssMode() {
37074
- if (isOssMode()) {
37075
- error("`sl instance` commands are for hosted deployments. For OSS use `sl local` / `sl stack` or your own provisioning.");
37076
- process.exit(1);
37077
- }
37078
- }
37079
- async function requireActiveProject() {
37080
- const config = await loadConfig();
37081
- const active = await readActiveProject(process.cwd(), config.defaultProject);
37082
- if (!active) {
37083
- error("No active project — run `sl project create <name>` or `sl project use <slug>` first.");
37084
- process.exit(1);
37085
- }
37086
- return active.slug;
37087
- }
37088
- async function fetchCurrentTenant() {
37089
- try {
37090
- const res = await httpPlatform("/api/tenants/me");
37091
- return res.tenant;
37092
- } catch (err) {
37093
- if (err instanceof CliHttpError && err.status === 404) {
37094
- return null;
37095
- }
37096
- throw err;
37097
- }
37098
- }
37099
- async function renderInstanceInfo() {
37100
- try {
37101
- const tenant = await fetchCurrentTenant();
37102
- if (!tenant) {
37103
- info("No instance for the active project. Run `sl instance create --plan launch`.");
37104
- return;
37105
- }
37106
- console.log(formatKeyValue([
37107
- ["URL", tenant.apiUrl],
37108
- ["Plan", tenant.plan],
37109
- ["Status", tenant.status],
37110
- ["Created", new Date(tenant.createdAt).toLocaleString()]
37111
- ]));
37112
- } catch (err) {
37113
- handleInstanceError(err, "fetch instance");
37114
- }
37115
- }
37116
- function printKeyReveal(tenant, creds) {
37117
- console.log("");
37118
- console.log(blue("━".repeat(60)));
37119
- console.log(blue(" Save your keys — shown once. Can't retrieve later."));
37120
- console.log(blue("━".repeat(60)));
37121
- console.log("");
37122
- console.log(formatKeyValue([
37123
- ["URL", creds.apiUrl],
37124
- ["Plan", tenant.plan],
37125
- ["Service key", green(creds.serviceKey)],
37126
- ["Anon key", green(creds.anonKey)]
37127
- ]));
37128
- console.log("");
37129
- console.log(dim("Run `sl subgraphs deploy <file>` to deploy your first subgraph."));
37130
- console.log("");
37131
- }
37132
- function createSpinner(message) {
37133
- if (!process.stderr.isTTY) {
37134
- info(message);
37135
- return {
37136
- succeed: success,
37137
- fail: error
37138
- };
37139
- }
37140
- const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
37141
- let index = 0;
37142
- const render = () => {
37143
- const frame = frames[index % frames.length] ?? frames[0];
37144
- index += 1;
37145
- process.stderr.write(`\r${blue(frame)} ${message}`);
37146
- };
37147
- const clear = () => {
37148
- clearInterval(timer3);
37149
- process.stderr.write("\r\x1B[2K");
37150
- };
37151
- const timer3 = setInterval(render, 80);
37152
- render();
37153
- return {
37154
- succeed(message2) {
37155
- clear();
37156
- success(message2);
37157
- },
37158
- fail(message2) {
37159
- clear();
37160
- error(message2);
37161
- }
37162
- };
37163
- }
37164
- function isTimeoutError(err) {
37165
- if (!(err instanceof Error))
37166
- return false;
37167
- return err.name === "TimeoutError" || err.name === "AbortError" || err.message.toLowerCase().includes("timeout");
37168
- }
37169
- function warn_box(message) {
37170
- return `${"━".repeat(message.length + 4)}
37171
- ${message}
37172
- ${"━".repeat(message.length + 4)}`;
37173
- }
37174
- function handleInstanceError(err, action) {
37175
- if (err instanceof CliHttpError) {
37176
- if (err.code === "SESSION_EXPIRED") {
37177
- error("Session expired. Run: sl login");
37178
- process.exit(1);
37179
- }
37180
- if (err.code === "TENANT_SUSPENDED") {
37181
- error("Instance is suspended. Run: sl instance resume");
37182
- process.exit(1);
37183
- }
37184
- if (err.code === "INSTANCE_EXISTS") {
37185
- error("This project already has an instance. Run `sl instance info` to see it.");
37186
- process.exit(1);
37187
- }
37188
- if (err.code === "PROVISIONER_REJECTED" || err.code === "INSTANCE_RECORD_FAILED" || err.code === "INSTANCE_PROVISION_FAILED") {
37189
- error(err.message || `Failed to ${action}.`);
37190
- error("Run: sl instance info before retrying.");
37191
- process.exit(1);
37192
- }
37193
- error(err.message || `Failed to ${action}.`);
37194
- process.exit(1);
37195
- }
37196
- error(`Failed to ${action}: ${err instanceof Error ? err.message || "Unknown error" : String(err)}`);
37197
- process.exit(1);
37198
- }
37199
36815
  // src/commands/project.ts
37200
36816
  init_config();
37201
- import { input as input5 } from "@inquirer/prompts";
36817
+ import { input as input4 } from "@inquirer/prompts";
37202
36818
  init_output();
37203
36819
  function registerProjectCommand(program2) {
37204
36820
  const project = program2.command("project").description("Manage Secondlayer projects");
37205
36821
  project.command("create [name]").description("Create a new project").option("--slug <slug>", "Project URL identifier").action(async (nameArg, options2 = {}) => {
37206
- const name = nameArg ?? await input5({
36822
+ const name = nameArg ?? await input4({
37207
36823
  message: "Project name",
37208
36824
  validate: (v) => v.length >= 2 ? true : "Name must be at least 2 characters"
37209
36825
  });
@@ -37325,7 +36941,6 @@ registerLoginCommand(program);
37325
36941
  registerLogoutCommand(program);
37326
36942
  registerWhoamiCommand(program);
37327
36943
  registerProjectCommand(program);
37328
- registerInstanceCommand(program);
37329
36944
  registerSubgraphsCommand(program);
37330
36945
  registerCreateCommand(program);
37331
36946
  registerSubscriptionsCommand(program);
@@ -37340,5 +36955,5 @@ registerAccountCommand(program);
37340
36955
  registerBillingCommand(program);
37341
36956
  program.parse();
37342
36957
 
37343
- //# debugId=DFA23CCC28753D5464756E2164756E21
36958
+ //# debugId=C9F2E56BDB69B19A64756E2164756E21
37344
36959
  //# sourceMappingURL=cli.js.map