@dereekb/util 8.12.3 → 8.12.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.12.6](https://github.com/dereekb/dbx-components/compare/v8.12.5-dev...v8.12.6) (2022-07-11)
6
+
7
+
8
+
9
+ ## [8.12.5](https://github.com/dereekb/dbx-components/compare/v8.12.4-dev...v8.12.5) (2022-07-10)
10
+
11
+
12
+
13
+ ## [8.12.4](https://github.com/dereekb/dbx-components/compare/v8.12.3-dev...v8.12.4) (2022-07-10)
14
+
15
+
16
+
5
17
  ## [8.12.3](https://github.com/dereekb/dbx-components/compare/v8.12.2-dev...v8.12.3) (2022-07-09)
6
18
 
7
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "8.12.3",
3
+ "version": "8.12.6",
4
4
  "type": "commonjs",
5
5
  "exports": {
6
6
  ".": {
@@ -11,6 +11,10 @@ export declare type AuthRole = string;
11
11
  * A set of auth roles for a user.
12
12
  */
13
13
  export declare type AuthRoleSet = Set<AuthRole>;
14
+ /**
15
+ * Auth role for an account that has been onboarded.
16
+ */
17
+ export declare const AUTH_ONBOARDED_ROLE = "onboarded";
14
18
  /**
15
19
  * Auth role for a full admin. Is allowed into all sections of the app.
16
20
  */
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.authRolesSetHasRoles = exports.AUTH_USER_ROLE = exports.AUTH_ADMIN_ROLE = void 0;
3
+ exports.authRolesSetHasRoles = exports.AUTH_USER_ROLE = exports.AUTH_ADMIN_ROLE = exports.AUTH_ONBOARDED_ROLE = void 0;
4
4
  const set_1 = require("../set/set");
5
+ /**
6
+ * Auth role for an account that has been onboarded.
7
+ */
8
+ exports.AUTH_ONBOARDED_ROLE = 'onboarded';
5
9
  /**
6
10
  * Auth role for a full admin. Is allowed into all sections of the app.
7
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"auth.role.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/auth/auth.role.ts"],"names":[],"mappings":";;;AAAA,oCAAkD;AAiBlD;;GAEG;AACU,QAAA,eAAe,GAAG,OAAO,CAAC;AAEvC;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC;AAErC,SAAgB,oBAAoB,CAAC,YAAyB,EAAE,KAAgC;IAC9F,OAAO,IAAA,0BAAoB,EAAC,YAAY,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC;AACzD,CAAC;AAFD,oDAEC"}
1
+ {"version":3,"file":"auth.role.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/auth/auth.role.ts"],"names":[],"mappings":";;;AAAA,oCAAkD;AAiBlD;;GAEG;AACU,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAE/C;;GAEG;AACU,QAAA,eAAe,GAAG,OAAO,CAAC;AAEvC;;GAEG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC;AAErC,SAAgB,oBAAoB,CAAC,YAAyB,EAAE,KAAgC;IAC9F,OAAO,IAAA,0BAAoB,EAAC,YAAY,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC;AACzD,CAAC;AAFD,oDAEC"}
package/src/lib/sort.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type SortingOrder = 'desc' | 'asc';
1
+ export declare type SortingOrder = 'asc' | 'desc';
2
2
  export declare const SORT_VALUE_LESS_THAN: SortComparisonNumber;
3
3
  export declare const SORT_VALUE_GREATER_THAN: SortComparisonNumber;
4
4
  export declare const SORT_VALUE_EQUAL: SortComparisonNumber;
@@ -9,8 +9,10 @@ export declare const SORT_VALUE_EQUAL: SortComparisonNumber;
9
9
  * - smaller than another will return -1 (or less).
10
10
  * - equal to another will return 0
11
11
  * - greater than another will return 1 (or more).
12
+ * - Example: a - b
12
13
  *
13
14
  * In "descending" order, this returns the opposite values as "ascending".
15
+ * - Example: b - a
14
16
  */
15
17
  export declare type SortComparisonNumber = number;
16
18
  /**
@@ -19,14 +21,10 @@ export declare type SortComparisonNumber = number;
19
21
  export declare type SortCompareFunction<T> = (a: T, b: T) => SortComparisonNumber;
20
22
  /**
21
23
  * Comparison function that sorts in ascending order.
22
- *
23
- * This is the logical normal return order, where if an item is less than another, it should return SORT_VALUE_LESS_THAN (-1), etc.
24
24
  */
25
25
  export declare type AscendingSortCompareFunction<T> = SortCompareFunction<T>;
26
26
  /**
27
27
  * Comparison function that sorts in descending order.
28
- *
29
- * This is the logical normal return order, where if an item is less than another, it should return SORT_VALUE_LESS_THAN (-1), etc.
30
28
  */
31
29
  export declare type SortDescendingCompareFunction<T> = SortCompareFunction<T>;
32
30
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../../../packages/util/src/lib/sort.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAyB,CAAC,CAAC,CAAC;AAChD,QAAA,uBAAuB,GAAyB,CAAC,CAAC;AAClD,QAAA,gBAAgB,GAAyB,CAAC,CAAC;AAsCxD,SAAgB,gBAAgB,CAAI,SAAiC;IACnE,OAAO,CAAC,CAAI,EAAE,CAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAFD,4CAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAI,kBAAmD,EAAE,QAAsB,KAAK;IAChH,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AACrF,CAAC;AAFD,wCAEC"}
1
+ {"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../../../packages/util/src/lib/sort.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAyB,CAAC,CAAC,CAAC;AAChD,QAAA,uBAAuB,GAAyB,CAAC,CAAC;AAClD,QAAA,gBAAgB,GAAyB,CAAC,CAAC;AAoCxD,SAAgB,gBAAgB,CAAI,SAAiC;IACnE,OAAO,CAAC,CAAI,EAAE,CAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAFD,4CAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAI,kBAAmD,EAAE,QAAsB,KAAK;IAChH,OAAO,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AACrF,CAAC;AAFD,wCAEC"}
@@ -1,3 +1,4 @@
1
+ import { SortCompareFunction } from '../sort';
1
2
  /**
2
3
  * A number that denotes which index an item is at.
3
4
  */
@@ -11,10 +12,24 @@ export interface IndexRef {
11
12
  */
12
13
  i: IndexNumber;
13
14
  }
15
+ /**
16
+ * Creates a SortCompareFunction<T> that sorts by index on IndexRef values.
17
+ *
18
+ * @param input
19
+ * @returns
20
+ */
21
+ export declare function sortAscendingIndexNumberRefFunction<T extends IndexRef>(): SortCompareFunction<T>;
14
22
  /**
15
23
  * Returns an item's IndexNumber.
16
24
  */
17
25
  export declare type ReadIndexFunction<T> = (value: T) => IndexNumber;
26
+ /**
27
+ * Creates a SortCompareFunction<T> that sorts by the read index.
28
+ *
29
+ * @param input
30
+ * @returns
31
+ */
32
+ export declare function sortByIndexAscendingCompareFunction<T>(readIndex: ReadIndexFunction<T>): SortCompareFunction<T>;
18
33
  /**
19
34
  * A min and max value that denote the maximum edges of a range of index values.
20
35
  */
@@ -1,6 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexRangeCheckFunction = exports.indexRangeCheckReaderFunction = void 0;
3
+ exports.indexRangeCheckFunction = exports.indexRangeCheckReaderFunction = exports.sortByIndexAscendingCompareFunction = exports.sortAscendingIndexNumberRefFunction = void 0;
4
+ /**
5
+ * Creates a SortCompareFunction<T> that sorts by index on IndexRef values.
6
+ *
7
+ * @param input
8
+ * @returns
9
+ */
10
+ function sortAscendingIndexNumberRefFunction() {
11
+ return (a, b) => a.i - b.i;
12
+ }
13
+ exports.sortAscendingIndexNumberRefFunction = sortAscendingIndexNumberRefFunction;
14
+ /**
15
+ * Creates a SortCompareFunction<T> that sorts by the read index.
16
+ *
17
+ * @param input
18
+ * @returns
19
+ */
20
+ function sortByIndexAscendingCompareFunction(readIndex) {
21
+ return (a, b) => readIndex(a) - readIndex(b);
22
+ }
23
+ exports.sortByIndexAscendingCompareFunction = sortByIndexAscendingCompareFunction;
4
24
  function indexRangeCheckReaderFunction(range, read = (x) => x.i) {
5
25
  const rangeCheck = indexRangeCheckFunction(range);
6
26
  return (value) => rangeCheck(read(value));
@@ -1 +1 @@
1
- {"version":3,"file":"indexed.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/indexed.ts"],"names":[],"mappings":";;;AA+CA,SAAgB,6BAA6B,CAAI,KAAiB,EAAE,OAA6B,CAAC,CAAI,EAAE,EAAE,CAAE,CAAyB,CAAC,CAAC;IACrI,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,CAAC,KAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC;AAHD,sEAGC;AAOD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,KAAiB;IACvD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,GAAG,QAAQ,CAAC;AAC9C,CAAC;AAHD,0DAGC"}
1
+ {"version":3,"file":"indexed.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/indexed.ts"],"names":[],"mappings":";;;AAiBA;;;;;GAKG;AACH,SAAgB,mCAAmC;IACjD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAFD,kFAEC;AAOD;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAI,SAA+B;IACpF,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAFD,kFAEC;AA6BD,SAAgB,6BAA6B,CAAI,KAAiB,EAAE,OAA6B,CAAC,CAAI,EAAE,EAAE,CAAE,CAAyB,CAAC,CAAC;IACrI,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,CAAC,KAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC;AAHD,sEAGC;AAOD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,KAAiB;IACvD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,QAAQ,IAAI,CAAC,GAAG,QAAQ,CAAC;AAC9C,CAAC;AAHD,0DAGC"}
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [8.12.6](https://github.com/dereekb/dbx-components/compare/v8.12.5-dev...v8.12.6) (2022-07-11)
6
+
7
+
8
+
9
+ ## [8.12.5](https://github.com/dereekb/dbx-components/compare/v8.12.4-dev...v8.12.5) (2022-07-10)
10
+
11
+
12
+
13
+ ## [8.12.4](https://github.com/dereekb/dbx-components/compare/v8.12.3-dev...v8.12.4) (2022-07-10)
14
+
15
+
16
+
5
17
  ## [8.12.3](https://github.com/dereekb/dbx-components/compare/v8.12.2-dev...v8.12.3) (2022-07-09)
6
18
 
7
19
 
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "8.12.3",
3
+ "version": "8.12.6",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
7
7
  "dependencies": {},
8
8
  "peerDependencies": {
9
- "@dereekb/util": "8.12.3",
9
+ "@dereekb/util": "8.12.6",
10
10
  "make-error": "^1.3.0",
11
11
  "ts-essentials": "^9.1.2",
12
12
  "extra-set": "^2.2.11",