@budibase/shared-core 2.29.4 → 2.29.8

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.
@@ -98,13 +98,16 @@ export declare const ValidSnippetNameRegex: RegExp;
98
98
  export declare const REBOOT_CRON = "@reboot";
99
99
  export declare const InvalidFileExtensions: string[];
100
100
  export declare enum BpmCorrelationKey {
101
- ONBOARDING = "budibase:onboarding:correlationkey"
101
+ ONBOARDING = "budibase:onboarding:correlationkey",
102
+ VERIFY_SSO_LOGIN = "budibase:verify_sso_login:correlationkey"
102
103
  }
103
104
  export declare enum BpmInstanceKey {
104
- ONBOARDING = "budibase:onboarding:instancekey"
105
+ ONBOARDING = "budibase:onboarding:instancekey",
106
+ VERIFY_SSO_LOGIN = "budibase:verify_sso_login:instancekey"
105
107
  }
106
108
  export declare enum BpmStatusKey {
107
- ONBOARDING = "budibase:onboarding:status"
109
+ ONBOARDING = "budibase:onboarding:status",
110
+ VERIFY_SSO_LOGIN = "budibase:verify_sso_login:status"
108
111
  }
109
112
  export declare enum BpmStatusValue {
110
113
  STARTED = "started",
package/dist/filters.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Datasource, BBReferenceFieldSubType, FieldType, FormulaType, SearchFilter, SearchFilters, SearchQueryFields, SortType, FieldConstraints, SortOrder, RowSearchParams, SearchResponse } from "@budibase/types";
1
+ import { Datasource, BBReferenceFieldSubType, FieldType, FormulaType, SearchFilter, SearchFilters, SearchQueryFields, SortType, FieldConstraints, SortOrder, RowSearchParams, SearchResponse, Table } from "@budibase/types";
2
2
  /**
3
3
  * Returns the valid operator options for a certain data type
4
4
  */
@@ -21,6 +21,29 @@ export declare const NoEmptyFilterStrings: (keyof SearchQueryFields)[];
21
21
  * Removes a numeric prefix on field names designed to give fields uniqueness
22
22
  */
23
23
  export declare const removeKeyNumbering: (key: string) => string;
24
+ /**
25
+ * Gets the part of the keys, returning the numeric prefix and the field name
26
+ */
27
+ export declare const getKeyNumbering: (key: string) => {
28
+ prefix?: string;
29
+ key: string;
30
+ };
31
+ /**
32
+ * Generates a splitter which can be used to split columns from a context into
33
+ * their components (number prefix, relationship column/table, column name)
34
+ */
35
+ export declare class ColumnSplitter {
36
+ tableNames: string[];
37
+ tableIds: string[];
38
+ relationshipColumnNames: string[];
39
+ relationships: string[];
40
+ constructor(tables: Table[]);
41
+ run(key: string): {
42
+ numberPrefix?: string;
43
+ relationshipPrefix?: string;
44
+ column: string;
45
+ };
46
+ }
24
47
  /**
25
48
  * Builds a JSON query from the filter structure generated in the builder
26
49
  * @param filter the builder filter structure
package/dist/index.js CHANGED
@@ -10352,14 +10352,17 @@ var InvalidFileExtensions = [
10352
10352
  ];
10353
10353
  var BpmCorrelationKey = /* @__PURE__ */ ((BpmCorrelationKey2) => {
10354
10354
  BpmCorrelationKey2["ONBOARDING"] = "budibase:onboarding:correlationkey";
10355
+ BpmCorrelationKey2["VERIFY_SSO_LOGIN"] = "budibase:verify_sso_login:correlationkey";
10355
10356
  return BpmCorrelationKey2;
10356
10357
  })(BpmCorrelationKey || {});
10357
10358
  var BpmInstanceKey = /* @__PURE__ */ ((BpmInstanceKey2) => {
10358
10359
  BpmInstanceKey2["ONBOARDING"] = "budibase:onboarding:instancekey";
10360
+ BpmInstanceKey2["VERIFY_SSO_LOGIN"] = "budibase:verify_sso_login:instancekey";
10359
10361
  return BpmInstanceKey2;
10360
10362
  })(BpmInstanceKey || {});
10361
10363
  var BpmStatusKey = /* @__PURE__ */ ((BpmStatusKey2) => {
10362
10364
  BpmStatusKey2["ONBOARDING"] = "budibase:onboarding:status";
10365
+ BpmStatusKey2["VERIFY_SSO_LOGIN"] = "budibase:verify_sso_login:status";
10363
10366
  return BpmStatusKey2;
10364
10367
  })(BpmStatusKey || {});
10365
10368
  var BpmStatusValue = /* @__PURE__ */ ((BpmStatusValue2) => {
@@ -10374,8 +10377,10 @@ var DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default";
10374
10377
  // src/filters.ts
10375
10378
  var filters_exports = {};
10376
10379
  __export(filters_exports, {
10380
+ ColumnSplitter: () => ColumnSplitter,
10377
10381
  NoEmptyFilterStrings: () => NoEmptyFilterStrings,
10378
10382
  buildQuery: () => buildQuery,
10383
+ getKeyNumbering: () => getKeyNumbering,
10379
10384
  getValidOperatorsForType: () => getValidOperatorsForType,
10380
10385
  hasFilters: () => hasFilters,
10381
10386
  limit: () => limit,
@@ -10611,12 +10616,46 @@ var cleanupQuery = (query) => {
10611
10616
  return query;
10612
10617
  };
10613
10618
  var removeKeyNumbering = (key) => {
10619
+ return getKeyNumbering(key).key;
10620
+ };
10621
+ var getKeyNumbering = (key) => {
10614
10622
  if (typeof key === "string" && key.match(/\d[0-9]*:/g) != null) {
10615
10623
  const parts = key.split(":");
10616
- parts.shift();
10617
- return parts.join(":");
10624
+ const number = parts.shift();
10625
+ return { prefix: `${number}:`, key: parts.join(":") };
10618
10626
  } else {
10619
- return key;
10627
+ return { key };
10628
+ }
10629
+ };
10630
+ var ColumnSplitter = class {
10631
+ constructor(tables) {
10632
+ this.tableNames = tables.map((table) => table.name);
10633
+ this.tableIds = tables.map((table) => table._id);
10634
+ this.relationshipColumnNames = tables.flatMap(
10635
+ (table) => Object.keys(table.schema).filter(
10636
+ (columnName) => table.schema[columnName].type === "link" /* LINK */
10637
+ )
10638
+ );
10639
+ this.relationships = this.tableNames.concat(this.tableIds).concat(this.relationshipColumnNames).sort((a, b) => b.length - a.length);
10640
+ }
10641
+ run(key) {
10642
+ let { prefix, key: splitKey } = getKeyNumbering(key);
10643
+ let relationship;
10644
+ for (let possibleRelationship of this.relationships) {
10645
+ const withDot = `${possibleRelationship}.`;
10646
+ if (splitKey.startsWith(withDot)) {
10647
+ const finalKeyParts = splitKey.split(withDot);
10648
+ finalKeyParts.shift();
10649
+ relationship = withDot;
10650
+ splitKey = finalKeyParts.join(".");
10651
+ break;
10652
+ }
10653
+ }
10654
+ return {
10655
+ numberPrefix: prefix,
10656
+ relationshipPrefix: relationship,
10657
+ column: splitKey
10658
+ };
10620
10659
  }
10621
10660
  };
10622
10661
  var buildQuery = (filter) => {