@everipedia/iq-utils 0.1.0 → 0.1.2

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
@@ -1,5 +1,38 @@
1
1
  # @everipedia/iq-utils
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 81787e9: # Changes
8
+
9
+ - Adds RecordTypePicker which works for any type
10
+
11
+ # Example
12
+
13
+ ```ts
14
+ // The NewWikiType will only have user, title, content, summary and user only has id, profile with username and avatar.
15
+ type NewWikiType = RecordTypePicker<
16
+ Wiki,
17
+ {
18
+ user: {
19
+ id;
20
+ profile: {
21
+ username;
22
+ avatar;
23
+ };
24
+ };
25
+ },
26
+ 'title' | 'content' | 'summary'
27
+ >;
28
+ ```
29
+
30
+ ## 0.1.1
31
+
32
+ ### Patch Changes
33
+
34
+ - 77bca5e: Adds WikiTypeBuilder to constuct custom wiki types
35
+
3
36
  ## 0.1.0
4
37
 
5
38
  ### Minor Changes
@@ -1,2 +1,3 @@
1
1
  export * from './lib/wikiScore';
2
2
  export * from './types/wiki';
3
+ export * from './types/wikiBuilder';
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./lib/wikiScore"), exports);
18
18
  __exportStar(require("./types/wiki"), exports);
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGtEQUFnQztBQUNoQywrQ0FBNkIifQ==
19
+ __exportStar(require("./types/wikiBuilder"), exports);
20
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGtEQUFnQztBQUNoQywrQ0FBNkI7QUFDN0Isc0RBQW9DIn0=
@@ -0,0 +1,11 @@
1
+ import { Wiki } from './wiki';
2
+ type DeepPartial<T> = {
3
+ [P in keyof T]?: DeepPartial<T[P]>;
4
+ };
5
+ type PrimitiveType = number | string | boolean | symbol | null | undefined;
6
+ export type RecordTypeNonPrimitive<T> = DeepPartial<{
7
+ [K in keyof T]: [T[K]] extends [PrimitiveType] ? never : T[K];
8
+ }>;
9
+ export type RecordTypePicker<T extends object, NonPrimitiveOverrides extends RecordTypeNonPrimitive<T>, Keys extends keyof T> = NonPrimitiveOverrides & Pick<T, Exclude<Keys, keyof NonPrimitiveOverrides>>;
10
+ export type WikiBuilder<NonPrimitiveOverrides extends RecordTypeNonPrimitive<Wiki>, Keys extends keyof Wiki> = RecordTypePicker<Wiki, NonPrimitiveOverrides, Keys>;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2lraUJ1aWxkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvd2lraUJ1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -1,2 +1,3 @@
1
1
  export * from './lib/wikiScore';
2
2
  export * from './types/wiki';
3
+ export * from './types/wikiBuilder';
@@ -1,3 +1,4 @@
1
1
  export * from './lib/wikiScore';
2
2
  export * from './types/wiki';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGNBQWMsQ0FBQyJ9
3
+ export * from './types/wikiBuilder';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLHFCQUFxQixDQUFDIn0=
@@ -0,0 +1,11 @@
1
+ import { Wiki } from './wiki';
2
+ type DeepPartial<T> = {
3
+ [P in keyof T]?: DeepPartial<T[P]>;
4
+ };
5
+ type PrimitiveType = number | string | boolean | symbol | null | undefined;
6
+ export type RecordTypeNonPrimitive<T> = DeepPartial<{
7
+ [K in keyof T]: [T[K]] extends [PrimitiveType] ? never : T[K];
8
+ }>;
9
+ export type RecordTypePicker<T extends object, NonPrimitiveOverrides extends RecordTypeNonPrimitive<T>, Keys extends keyof T> = NonPrimitiveOverrides & Pick<T, Exclude<Keys, keyof NonPrimitiveOverrides>>;
10
+ export type WikiBuilder<NonPrimitiveOverrides extends RecordTypeNonPrimitive<Wiki>, Keys extends keyof Wiki> = RecordTypePicker<Wiki, NonPrimitiveOverrides, Keys>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2lraUJ1aWxkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHlwZXMvd2lraUJ1aWxkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everipedia/iq-utils",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Common utility library for IQ projects",
5
5
  "main": "build/main/index.js",
6
6
  "typings": "build/main/index.d.ts",