zinkee 0.1.70 → 0.1.71

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/index.js CHANGED
@@ -5363,6 +5363,16 @@ function resolveDeleteRecordIds(options) {
5363
5363
  function collectStringValues(value, previous = []) {
5364
5364
  return [...previous, value];
5365
5365
  }
5366
+ function buildSearch(options) {
5367
+ const search = { term: options.search ?? "" };
5368
+ if (options.searchFields && options.searchFields.length > 0) {
5369
+ search.fields = [...options.searchFields];
5370
+ }
5371
+ if (options.searchTimezone !== void 0) {
5372
+ search.timezone = options.searchTimezone;
5373
+ }
5374
+ return search;
5375
+ }
5366
5376
  function collectSelectValues(value, previous = []) {
5367
5377
  return dedupeStrings([...previous, ...parseCommaSeparatedValues(value, "--select")]);
5368
5378
  }
@@ -5506,7 +5516,7 @@ function buildRecordQueryInput(options, allowRaw) {
5506
5516
  input.where = where;
5507
5517
  }
5508
5518
  if (options.search !== void 0) {
5509
- input.search = { term: options.search };
5519
+ input.search = buildSearch(options);
5510
5520
  }
5511
5521
  if (options.sort && options.sort.length > 0) {
5512
5522
  input.sort = [...options.sort];
@@ -5526,7 +5536,7 @@ function buildRecordAggregateInput(options) {
5526
5536
  input.where = where;
5527
5537
  }
5528
5538
  if (options.search !== void 0) {
5529
- input.search = { term: options.search };
5539
+ input.search = buildSearch(options);
5530
5540
  }
5531
5541
  if (options.groupBy && options.groupBy.length > 0) {
5532
5542
  input.groupBy = [...options.groupBy];
@@ -5709,7 +5719,15 @@ function registerRecordsCommands(program, options = {}) {
5709
5719
  'native where as JSON: an array of conditions (AND) or one condition/{"and"|"or": [...]} group (not combinable with --where)'
5710
5720
  ).option(
5711
5721
  "--search <term>",
5712
- "free-text search term (matched across the schema's searchable fields)"
5722
+ 'free-text search: every word must appear in some field, as the field shows it (formatted numbers, dates as dd/mm/yyyy or yyyy-mm-dd, members by alias or email, files by name); "quoted text" is one phrase'
5723
+ ).option(
5724
+ "--search-fields <fields>",
5725
+ "field slugs the search looks in (comma-separated, repeatable; default: every searchable field)",
5726
+ collectSelectValues,
5727
+ []
5728
+ ).option(
5729
+ "--search-timezone <iana>",
5730
+ "timezone dates are searched in, e.g. Europe/Madrid (default: workspace timezone)"
5713
5731
  ).option("--sort <field:direction>", "sort field(s)", collectSortValues, []).option("--limit <number>", "limit results", parseNonNegativeInteger).option("--offset <number>", "offset results", parseNonNegativeInteger).option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, commandOptions) {
5714
5732
  const { api, schemasApi, json } = createRecordsApi(this, filePath);
5715
5733
  const query = buildRecordQueryInput(commandOptions, true);
@@ -5750,7 +5768,15 @@ function registerRecordsCommands(program, options = {}) {
5750
5768
  'native where as JSON: an array of conditions (AND) or one condition/{"and"|"or": [...]} group (not combinable with --where)'
5751
5769
  ).option(
5752
5770
  "--search <term>",
5753
- "free-text search term (matched across the schema's searchable fields)"
5771
+ 'free-text search: every word must appear in some field, as the field shows it (formatted numbers, dates as dd/mm/yyyy or yyyy-mm-dd, members by alias or email, files by name); "quoted text" is one phrase'
5772
+ ).option(
5773
+ "--search-fields <fields>",
5774
+ "field slugs the search looks in (comma-separated, repeatable; default: every searchable field)",
5775
+ collectSelectValues,
5776
+ []
5777
+ ).option(
5778
+ "--search-timezone <iana>",
5779
+ "timezone dates are searched in, e.g. Europe/Madrid (default: workspace timezone)"
5754
5780
  ).option(
5755
5781
  "--sort <alias|field[:direction]>",
5756
5782
  "sort groups by a metric alias or group-by field, asc|desc (repeatable, up to 4)",