@verdant-web/common 2.5.1 → 2.5.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.
@@ -4,33 +4,49 @@ export declare const fields: {
4
4
  properties: Props;
5
5
  nullable?: boolean;
6
6
  default?: ShapeFromFieldsWithDefaults<Props> | (() => ShapeFromFieldsWithDefaults<Props>);
7
+ /** Add some docs to your field which will annotate the generated typing */
8
+ documentation?: string;
7
9
  }) => StorageObjectFieldSchema<Props>;
8
10
  array: <T extends StorageFieldSchema>(args: {
9
11
  items: T;
10
12
  nullable?: boolean;
13
+ /** Add some docs to your field which will annotate the generated typing */
14
+ documentation?: string;
11
15
  }) => StorageArrayFieldSchema<T>;
12
16
  string: (args?: {
13
17
  nullable?: boolean;
14
18
  default?: string | (() => string);
15
19
  options?: string[];
20
+ /** Add some docs to your field which will annotate the generated typing */
21
+ documentation?: string;
16
22
  }) => StorageStringFieldSchema;
17
23
  number: (args?: {
18
24
  nullable?: boolean;
19
25
  default?: number | (() => number);
26
+ /** Add some docs to your field which will annotate the generated typing */
27
+ documentation?: string;
20
28
  }) => StorageNumberFieldSchema;
21
29
  boolean: (args?: {
22
30
  nullable?: boolean;
23
31
  default?: boolean | (() => boolean);
32
+ /** Add some docs to your field which will annotate the generated typing */
33
+ documentation?: string;
24
34
  }) => StorageBooleanFieldSchema;
25
35
  any: <TShape>(args?: {
26
36
  default?: TShape;
37
+ /** Add some docs to your field which will annotate the generated typing */
38
+ documentation?: string;
27
39
  }) => StorageAnyFieldSchema<TShape>;
28
40
  map: <T_1 extends StorageFieldSchema>(args: {
29
41
  values: T_1;
42
+ /** Add some docs to your field which will annotate the generated typing */
43
+ documentation?: string | undefined;
30
44
  }) => StorageMapFieldSchema<T_1>;
31
45
  file: (args?: {
32
46
  nullable?: boolean;
33
47
  downloadRemote?: boolean;
48
+ /** Add some docs to your field which will annotate the generated typing */
49
+ documentation?: string;
34
50
  }) => StorageFileFieldSchema;
35
51
  id: () => StorageStringFieldSchema;
36
52
  };
@@ -23,6 +23,10 @@ const mapField = (args) => {
23
23
  const fileField = (args) => {
24
24
  return Object.assign({ type: 'file' }, args);
25
25
  };
26
+ /**
27
+ * Meant for use on primary key fields. Do not use this to refer
28
+ * to another document as a 'foreign key'
29
+ */
26
30
  const idField = () => {
27
31
  return {
28
32
  type: 'string',
@@ -1 +1 @@
1
- {"version":3,"file":"fieldHelpers.js","sourceRoot":"","sources":["../../../src/schema/fieldHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAexB,MAAM,WAAW,GAAG,CAAoC,IAMvD,EAAmC,EAAE;IACrC,uBACC,IAAI,EAAE,QAAQ,IACX,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAA+B,IAGjD,EAA8B,EAAE;IAChC,uBACC,IAAI,EAAE,OAAO,IACV,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAIpB,EAA4B,EAAE;IAC9B,uBACC,IAAI,EAAE,QAAQ,IACX,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAGpB,EAA4B,EAAE;IAC9B,uBACC,IAAI,EAAE,QAAQ,IACX,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAGrB,EAA6B,EAAE;IAC/B,uBACC,IAAI,EAAE,SAAS,IACZ,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAS,IAEzB,EAAiC,EAAE;IACnC,uBACC,IAAI,EAAE,KAAK,IACR,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAA+B,IAE/C,EAA4B,EAAE;IAC9B,uBACC,IAAI,EAAE,KAAK,IACR,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,IAGlB,EAA0B,EAAE;IAC5B,uBACC,IAAI,E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AC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAA+B,IAI/C,EAA4B,EAAE;IAC9B,uBACC,IAAI,EAAE,KAAK,IACR,IAAI,EACN;AACH,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,IAKlB,EAA0B,EAAE;IAC5B,uBACC,IAAI,EAAE,MAAM,IACT,IAAI,EACN;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,GAAG,GAA6B,EAAE;IAC9C,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,IAAI;KACb,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,SAAS;IACf,EAAE,EAAE,OAAO;CACX,CAAC"}
@@ -10,33 +10,41 @@ export declare namespace schema {
10
10
  properties: Props;
11
11
  nullable?: boolean | undefined;
12
12
  default?: import("./types.js").ShapeFromFieldsWithDefaults<Props> | (() => import("./types.js").ShapeFromFieldsWithDefaults<Props>) | undefined;
13
+ documentation?: string | undefined;
13
14
  }) => import("./types.js").StorageObjectFieldSchema<Props>;
14
15
  array: <T extends import("./types.js").StorageFieldSchema>(args: {
15
16
  items: T;
16
17
  nullable?: boolean | undefined;
18
+ documentation?: string | undefined;
17
19
  }) => import("./types.js").StorageArrayFieldSchema<T>;
18
20
  string: (args?: {
19
21
  nullable?: boolean | undefined;
20
22
  default?: string | (() => string) | undefined;
21
23
  options?: string[] | undefined;
24
+ documentation?: string | undefined;
22
25
  } | undefined) => import("./types.js").StorageStringFieldSchema;
23
26
  number: (args?: {
24
27
  nullable?: boolean | undefined;
25
28
  default?: number | (() => number) | undefined;
29
+ documentation?: string | undefined;
26
30
  } | undefined) => import("./types.js").StorageNumberFieldSchema;
27
31
  boolean: (args?: {
28
32
  nullable?: boolean | undefined;
29
33
  default?: boolean | (() => boolean) | undefined;
34
+ documentation?: string | undefined;
30
35
  } | undefined) => import("./types.js").StorageBooleanFieldSchema;
31
36
  any: <TShape>(args?: {
32
37
  default?: TShape | undefined;
38
+ documentation?: string | undefined;
33
39
  } | undefined) => import("./types.js").StorageAnyFieldSchema<TShape>;
34
40
  map: <T_1 extends import("./types.js").StorageFieldSchema>(args: {
35
41
  values: T_1;
42
+ documentation?: string | undefined;
36
43
  }) => import("./types.js").StorageMapFieldSchema<T_1>;
37
44
  file: (args?: {
38
45
  nullable?: boolean | undefined;
39
46
  downloadRemote?: boolean | undefined;
47
+ documentation?: string | undefined;
40
48
  } | undefined) => import("./types.js").StorageFileFieldSchema;
41
49
  id: () => import("./types.js").StorageStringFieldSchema;
42
50
  };
@@ -4,35 +4,49 @@ export type StorageStringFieldSchema = {
4
4
  default?: string | (() => string);
5
5
  /** Limit the values to a certain set of options */
6
6
  options?: string[];
7
+ /** Add some docs to your field which will annotate the generated typing */
8
+ documentation?: string;
7
9
  };
8
10
  export type StorageNumberFieldSchema = {
9
11
  type: 'number';
10
12
  nullable?: boolean;
11
13
  default?: number | (() => number);
14
+ /** Add some docs to your field which will annotate the generated typing */
15
+ documentation?: string;
12
16
  };
13
17
  export type StorageBooleanFieldSchema = {
14
18
  type: 'boolean';
15
19
  nullable?: boolean;
16
20
  default?: boolean | (() => boolean);
21
+ /** Add some docs to your field which will annotate the generated typing */
22
+ documentation?: string;
17
23
  };
18
24
  export type StorageArrayFieldSchema<TItems extends StorageFieldSchema> = {
19
25
  type: 'array';
20
26
  items: TItems;
21
27
  nullable?: boolean;
28
+ /** Add some docs to your field which will annotate the generated typing */
29
+ documentation?: string;
22
30
  };
23
31
  export type StorageObjectFieldSchema<Props extends StorageFieldsSchema> = {
24
32
  type: 'object';
25
33
  properties: Props;
26
34
  nullable?: boolean;
27
35
  default?: Record<string, any> | (() => Record<string, any>);
36
+ /** Add some docs to your field which will annotate the generated typing */
37
+ documentation?: string;
28
38
  };
29
39
  export type StorageAnyFieldSchema<TShape = any> = {
30
40
  type: 'any';
31
41
  default?: TShape;
42
+ /** Add some docs to your field which will annotate the generated typing */
43
+ documentation?: string;
32
44
  };
33
45
  export type StorageMapFieldSchema<V extends StorageFieldSchema> = {
34
46
  type: 'map';
35
47
  values: V;
48
+ /** Add some docs to your field which will annotate the generated typing */
49
+ documentation?: string;
36
50
  };
37
51
  export type StorageFileFieldSchema = {
38
52
  type: 'file';
@@ -43,6 +57,8 @@ export type StorageFileFieldSchema = {
43
57
  * connection to use files created by other devices.
44
58
  */
45
59
  downloadRemote?: boolean;
60
+ /** Add some docs to your field which will annotate the generated typing */
61
+ documentation?: string;
46
62
  };
47
63
  export type StorageFieldSchema = StorageStringFieldSchema | StorageNumberFieldSchema | StorageBooleanFieldSchema | StorageArrayFieldSchema<any> | StorageObjectFieldSchema<any> | StorageAnyFieldSchema | StorageMapFieldSchema<any> | StorageFileFieldSchema;
48
64
  export type StorageFieldsSchema = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdant-web/common",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "access": "public",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,6 +19,8 @@ const objectField = <Props extends StorageFieldsSchema>(args: {
19
19
  default?:
20
20
  | ShapeFromFieldsWithDefaults<Props>
21
21
  | (() => ShapeFromFieldsWithDefaults<Props>);
22
+ /** Add some docs to your field which will annotate the generated typing */
23
+ documentation?: string;
22
24
  }): StorageObjectFieldSchema<Props> => {
23
25
  return {
24
26
  type: 'object',
@@ -29,6 +31,8 @@ const objectField = <Props extends StorageFieldsSchema>(args: {
29
31
  const arrayField = <T extends StorageFieldSchema>(args: {
30
32
  items: T;
31
33
  nullable?: boolean;
34
+ /** Add some docs to your field which will annotate the generated typing */
35
+ documentation?: string;
32
36
  }): StorageArrayFieldSchema<T> => {
33
37
  return {
34
38
  type: 'array',
@@ -40,6 +44,8 @@ const stringField = (args?: {
40
44
  nullable?: boolean;
41
45
  default?: string | (() => string);
42
46
  options?: string[];
47
+ /** Add some docs to your field which will annotate the generated typing */
48
+ documentation?: string;
43
49
  }): StorageStringFieldSchema => {
44
50
  return {
45
51
  type: 'string',
@@ -50,6 +56,8 @@ const stringField = (args?: {
50
56
  const numberField = (args?: {
51
57
  nullable?: boolean;
52
58
  default?: number | (() => number);
59
+ /** Add some docs to your field which will annotate the generated typing */
60
+ documentation?: string;
53
61
  }): StorageNumberFieldSchema => {
54
62
  return {
55
63
  type: 'number',
@@ -60,6 +68,8 @@ const numberField = (args?: {
60
68
  const booleanField = (args?: {
61
69
  nullable?: boolean;
62
70
  default?: boolean | (() => boolean);
71
+ /** Add some docs to your field which will annotate the generated typing */
72
+ documentation?: string;
63
73
  }): StorageBooleanFieldSchema => {
64
74
  return {
65
75
  type: 'boolean',
@@ -69,6 +79,8 @@ const booleanField = (args?: {
69
79
 
70
80
  const anyField = <TShape>(args?: {
71
81
  default?: TShape;
82
+ /** Add some docs to your field which will annotate the generated typing */
83
+ documentation?: string;
72
84
  }): StorageAnyFieldSchema<TShape> => {
73
85
  return {
74
86
  type: 'any',
@@ -78,6 +90,8 @@ const anyField = <TShape>(args?: {
78
90
 
79
91
  const mapField = <T extends StorageFieldSchema>(args: {
80
92
  values: T;
93
+ /** Add some docs to your field which will annotate the generated typing */
94
+ documentation?: string;
81
95
  }): StorageMapFieldSchema<T> => {
82
96
  return {
83
97
  type: 'map',
@@ -88,6 +102,8 @@ const mapField = <T extends StorageFieldSchema>(args: {
88
102
  const fileField = (args?: {
89
103
  nullable?: boolean;
90
104
  downloadRemote?: boolean;
105
+ /** Add some docs to your field which will annotate the generated typing */
106
+ documentation?: string;
91
107
  }): StorageFileFieldSchema => {
92
108
  return {
93
109
  type: 'file',
@@ -95,6 +111,10 @@ const fileField = (args?: {
95
111
  };
96
112
  };
97
113
 
114
+ /**
115
+ * Meant for use on primary key fields. Do not use this to refer
116
+ * to another document as a 'foreign key'
117
+ */
98
118
  const idField = (): StorageStringFieldSchema => {
99
119
  return {
100
120
  type: 'string',
@@ -4,35 +4,49 @@ export type StorageStringFieldSchema = {
4
4
  default?: string | (() => string);
5
5
  /** Limit the values to a certain set of options */
6
6
  options?: string[];
7
+ /** Add some docs to your field which will annotate the generated typing */
8
+ documentation?: string;
7
9
  };
8
10
  export type StorageNumberFieldSchema = {
9
11
  type: 'number';
10
12
  nullable?: boolean;
11
13
  default?: number | (() => number);
14
+ /** Add some docs to your field which will annotate the generated typing */
15
+ documentation?: string;
12
16
  };
13
17
  export type StorageBooleanFieldSchema = {
14
18
  type: 'boolean';
15
19
  nullable?: boolean;
16
20
  default?: boolean | (() => boolean);
21
+ /** Add some docs to your field which will annotate the generated typing */
22
+ documentation?: string;
17
23
  };
18
24
  export type StorageArrayFieldSchema<TItems extends StorageFieldSchema> = {
19
25
  type: 'array';
20
26
  items: TItems;
21
27
  nullable?: boolean;
28
+ /** Add some docs to your field which will annotate the generated typing */
29
+ documentation?: string;
22
30
  };
23
31
  export type StorageObjectFieldSchema<Props extends StorageFieldsSchema> = {
24
32
  type: 'object';
25
33
  properties: Props;
26
34
  nullable?: boolean;
27
35
  default?: Record<string, any> | (() => Record<string, any>);
36
+ /** Add some docs to your field which will annotate the generated typing */
37
+ documentation?: string;
28
38
  };
29
39
  export type StorageAnyFieldSchema<TShape = any> = {
30
40
  type: 'any';
31
41
  default?: TShape;
42
+ /** Add some docs to your field which will annotate the generated typing */
43
+ documentation?: string;
32
44
  };
33
45
  export type StorageMapFieldSchema<V extends StorageFieldSchema> = {
34
46
  type: 'map';
35
47
  values: V;
48
+ /** Add some docs to your field which will annotate the generated typing */
49
+ documentation?: string;
36
50
  };
37
51
  export type StorageFileFieldSchema = {
38
52
  type: 'file';
@@ -43,6 +57,8 @@ export type StorageFileFieldSchema = {
43
57
  * connection to use files created by other devices.
44
58
  */
45
59
  downloadRemote?: boolean;
60
+ /** Add some docs to your field which will annotate the generated typing */
61
+ documentation?: string;
46
62
  };
47
63
 
48
64
  export type StorageFieldSchema =