@rebasepro/core 0.2.5 → 0.4.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/index.umd.js CHANGED
@@ -2634,15 +2634,18 @@
2634
2634
  if (filterValues_0) {
2635
2635
  Object.entries(filterValues_0).forEach(([key, value]) => {
2636
2636
  if (value && Array.isArray(value)) {
2637
- const [op, val] = value;
2638
- const postgrestOp = op === "==" ? "eq" : op === "!=" ? "neq" : op === ">" ? "gt" : op === ">=" ? "gte" : op === "<" ? "lt" : op === "<=" ? "lte" : op === "in" ? "in" : op === "not-in" ? "nin" : op === "array-contains" ? "cs" : op === "array-contains-any" ? "csa" : "eq";
2639
- let stringVal;
2640
- if (Array.isArray(val)) {
2641
- stringVal = `(${val.join(",")})`;
2642
- } else {
2643
- stringVal = String(val);
2637
+ const conditions = Array.isArray(value[0]) ? value : [value];
2638
+ const [op, val] = conditions[0] || [];
2639
+ if (op) {
2640
+ const postgrestOp = op === "==" ? "eq" : op === "!=" ? "neq" : op === ">" ? "gt" : op === ">=" ? "gte" : op === "<" ? "lt" : op === "<=" ? "lte" : op === "in" ? "in" : op === "not-in" ? "nin" : op === "array-contains" ? "cs" : op === "array-contains-any" ? "csa" : "eq";
2641
+ let stringVal;
2642
+ if (Array.isArray(val)) {
2643
+ stringVal = `(${val.join(",")})`;
2644
+ } else {
2645
+ stringVal = String(val);
2646
+ }
2647
+ whereMap[key] = `${postgrestOp}.${stringVal}`;
2644
2648
  }
2645
- whereMap[key] = `${postgrestOp}.${stringVal}`;
2646
2649
  }
2647
2650
  });
2648
2651
  }
@@ -2744,34 +2747,37 @@
2744
2747
  if (filterValues) {
2745
2748
  Object.entries(filterValues).forEach(([key, value]) => {
2746
2749
  if (value) {
2747
- const [op, val] = value;
2748
- let encodedValue = val;
2749
- try {
2750
- if (typeof val === "object") {
2751
- if (val instanceof Date) {
2752
- encodedValue = val.toISOString();
2753
- } else if (Array.isArray(val)) {
2754
- encodedValue = JSON.stringify(val, (k, v) => {
2755
- if (v instanceof types.EntityRelation) {
2756
- return encodeRelation(v);
2757
- }
2758
- if (v instanceof types.EntityReference) {
2759
- return encodeReference(v);
2760
- }
2761
- return v;
2762
- });
2763
- } else if (val instanceof types.EntityRelation) {
2764
- encodedValue = encodeRelation(val);
2765
- } else if (val instanceof types.EntityReference) {
2766
- encodedValue = encodeReference(val);
2750
+ const conditions = Array.isArray(value[0]) ? value : [value];
2751
+ const [op, val] = conditions[0] || [];
2752
+ if (op) {
2753
+ let encodedValue = val;
2754
+ try {
2755
+ if (typeof val === "object") {
2756
+ if (val instanceof Date) {
2757
+ encodedValue = val.toISOString();
2758
+ } else if (Array.isArray(val)) {
2759
+ encodedValue = JSON.stringify(val, (k, v) => {
2760
+ if (v instanceof types.EntityRelation) {
2761
+ return encodeRelation(v);
2762
+ }
2763
+ if (v instanceof types.EntityReference) {
2764
+ return encodeReference(v);
2765
+ }
2766
+ return v;
2767
+ });
2768
+ } else if (val instanceof types.EntityRelation) {
2769
+ encodedValue = encodeRelation(val);
2770
+ } else if (val instanceof types.EntityReference) {
2771
+ encodedValue = encodeReference(val);
2772
+ }
2767
2773
  }
2774
+ } catch (e) {
2775
+ encodedValue = val;
2776
+ }
2777
+ if (encodedValue !== void 0) {
2778
+ entries[encodeURIComponent(`${key}_op`)] = encodeURIComponent(op);
2779
+ entries[encodeURIComponent(`${key}_value`)] = encodedValue ? encodeURIComponent(String(encodedValue)) : "null";
2768
2780
  }
2769
- } catch (e) {
2770
- encodedValue = val;
2771
- }
2772
- if (encodedValue !== void 0) {
2773
- entries[encodeURIComponent(`${key}_op`)] = encodeURIComponent(op);
2774
- entries[encodeURIComponent(`${key}_value`)] = encodedValue ? encodeURIComponent(String(encodedValue)) : "null";
2775
2781
  }
2776
2782
  }
2777
2783
  });
@@ -8079,14 +8085,14 @@
8079
8085
  data_imported_successfully: "Data imported successfully",
8080
8086
  export: "Export",
8081
8087
  export_data: "Export data",
8082
- download_table_csv: "Download the the content of this table as a CSV",
8088
+ download_table_csv: "Download the content of this table as a CSV",
8083
8089
  csv: "CSV",
8084
8090
  json: "JSON",
8085
8091
  dates_as_timestamps: "Dates as timestamps",
8086
8092
  dates_as_strings: "Dates as strings",
8087
8093
  flatten_arrays: "Flatten arrays",
8088
8094
  download: "Download",
8089
- large_number_of_documents: "This collections has a large number of documents ({{count}}).",
8095
+ large_number_of_documents: "This collection has a large number of documents ({{count}}).",
8090
8096
  include_undefined_values: "Include undefined values",
8091
8097
  submit: "Submit",
8092
8098
  no_filterable_properties: "No filterable properties available",