@getxflow/cli 1.6.0 → 1.7.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.
@@ -48,14 +48,22 @@ async function logs(args) {
48
48
  async function functionsLogs(args) {
49
49
  const name = args.words[1];
50
50
  const { projectId, client } = await (0, session_1.projectTarget)(args);
51
- const query = new URLSearchParams({ source: 'function', limit: String((0, args_1.flagNumber)(args, 'limit') ?? DEFAULT_LIMIT) });
51
+ const all = (0, args_1.flagBool)(args, 'all');
52
+ const query = new URLSearchParams({ source: 'function', limit: String((0, args_1.flagNumber)(args, 'limit') ?? DEFAULT_LIMIT), calls: all ? 'all' : 'failed' });
52
53
  if (name)
53
54
  query.set('name', name);
54
- const { logs: rows } = await (0, api_1.apiJson)(client, `/api/v1/projects/${projectId}/logs?${query.toString()}`);
55
+ const cursor = (0, args_1.flagString)(args, 'cursor');
56
+ if (cursor)
57
+ query.set('cursor', cursor);
58
+ const { logs: rows, cursor: next } = await (0, api_1.apiJson)(client, `/api/v1/projects/${projectId}/logs?${query.toString()}`);
55
59
  if (rows.length === 0) {
56
- (0, ui_1.note)(name ? `Function ${name} has not crashed` : 'No function has crashed');
57
- (0, ui_1.note)((0, ui_1.dim)(' Only failed calls land here: successful ones write nothing'));
60
+ (0, ui_1.note)(name ? `Function ${name}: nothing ${all ? 'called' : 'failed'} in the kept period` : `No function ${all ? 'was called' : 'failed'} in the kept period`);
61
+ (0, ui_1.note)((0, ui_1.dim)(' Kept for 7 days, 1 day on the Free plan'));
62
+ if (next)
63
+ (0, ui_1.note)((0, ui_1.dim)(` Older: xflow functions logs${name ? ` ${name}` : ''}${all ? ' --all' : ''} --cursor ${next}`));
58
64
  return;
59
65
  }
60
66
  render(rows, () => 'browser');
67
+ if (next)
68
+ (0, ui_1.note)((0, ui_1.dim)(`Older: xflow functions logs${name ? ` ${name}` : ''}${all ? ' --all' : ''} --cursor ${next}`));
61
69
  }
package/dist/flags.js CHANGED
@@ -56,7 +56,7 @@ exports.KNOWN = {
56
56
  functions: ['project'],
57
57
  'functions list': ['project'],
58
58
  'functions invoke': ['data', 'data-file', 'method', 'project'],
59
- 'functions logs': ['limit', 'project'],
59
+ 'functions logs': ['limit', 'project', 'all', 'cursor'],
60
60
  logs: ['limit', 'project', 'app'],
61
61
  env: ['project'],
62
62
  'env list': ['project'],