1- /** Auto-generated with @ipld/schema@v4.2.0 at Thu Sep 14 2023 from IPLD Schema:
1+ /* eslint-disable jsdoc/check-indentation, max-depth */
2+
3+ /**
4+ * Auto-generated with @ipld/schema@v4.2.0 at Thu Sep 14 2023 from IPLD Schema:
25 *
36 * # CarV1HeaderOrV2Pragma is a more relaxed form, and can parse {version:x} where
47 * # roots are optional. This is typically useful for the {verison:2} CARv2
58 * # pragma.
69 *
710 * type CarV1HeaderOrV2Pragma struct {
8- * roots optional [&Any]
9- * # roots is _not_ optional for CarV1 but we defer that check within code to
10- * # gracefully handle the V2 case where it's just {version:X}
11- * version Int
11+ * roots optional [&Any]
12+ * # roots is _not_ optional for CarV1 but we defer that check within code to
13+ * # gracefully handle the V2 case where it's just {version:X}
14+ * version Int
1215 * }
1316 *
1417 * # CarV1Header is the strict form of the header, and requires roots to be
1518 * # present. This is compatible with the CARv1 specification.
1619 *
1720 * # type CarV1Header struct {
18- * # roots [&Any]
19- * # version Int
21+ * # roots [&Any]
22+ * # version Int
2023 * # }
2124 *
2225 */
2326
2427const Kinds = {
25- Null : /** @returns {undefined|null } */ ( /** @type {any } */ obj ) => obj === null ? obj : undefined ,
26- Int : /** @returns {undefined|number } */ ( /** @type {any } */ obj ) => Number . isInteger ( obj ) ? obj : undefined ,
27- Float : /** @returns {undefined|number } */ ( /** @type {any } */ obj ) => typeof obj === 'number' && Number . isFinite ( obj ) ? obj : undefined ,
28- String : /** @returns {undefined|string } */ ( /** @type {any } */ obj ) => typeof obj === 'string' ? obj : undefined ,
29- Bool : /** @returns {undefined|boolean } */ ( /** @type {any } */ obj ) => typeof obj === 'boolean' ? obj : undefined ,
30- Bytes : /** @returns {undefined|Uint8Array } */ ( /** @type {any } */ obj ) => obj instanceof Uint8Array ? obj : undefined ,
31- Link : /** @returns {undefined|object } */ ( /** @type {any } */ obj ) => obj !== null && typeof obj === 'object' && obj . asCID === obj ? obj : undefined ,
32- List : /** @returns {undefined|Array<any> } */ ( /** @type {any } */ obj ) => Array . isArray ( obj ) ? obj : undefined ,
33- Map : /** @returns {undefined|object } */ ( /** @type {any } */ obj ) => obj !== null && typeof obj === 'object' && obj . asCID !== obj && ! Array . isArray ( obj ) && ! ( obj instanceof Uint8Array ) ? obj : undefined
28+ Null : /**
29+ * @param obj
30+ * @returns {undefined|null }
31+ */ ( /** @type {any } */ obj ) => obj === null ? obj : undefined ,
32+ Int : /**
33+ * @param obj
34+ * @returns {undefined|number }
35+ */ ( /** @type {any } */ obj ) => Number . isInteger ( obj ) ? obj : undefined ,
36+ Float : /**
37+ * @param obj
38+ * @returns {undefined|number }
39+ */ ( /** @type {any } */ obj ) => typeof obj === 'number' && Number . isFinite ( obj ) ? obj : undefined ,
40+ String : /**
41+ * @param obj
42+ * @returns {undefined|string }
43+ */ ( /** @type {any } */ obj ) => typeof obj === 'string' ? obj : undefined ,
44+ Bool : /**
45+ * @param obj
46+ * @returns {undefined|boolean }
47+ */ ( /** @type {any } */ obj ) => typeof obj === 'boolean' ? obj : undefined ,
48+ Bytes : /**
49+ * @param obj
50+ * @returns {undefined|Uint8Array }
51+ */ ( /** @type {any } */ obj ) => obj instanceof Uint8Array ? obj : undefined ,
52+ Link : /**
53+ * @param obj
54+ * @returns {undefined|object }
55+ */ ( /** @type {any } */ obj ) => obj !== null && typeof obj === 'object' && obj . asCID === obj ? obj : undefined ,
56+ List : /**
57+ * @param obj
58+ * @returns {undefined|Array<any> }
59+ */ ( /** @type {any } */ obj ) => Array . isArray ( obj ) ? obj : undefined ,
60+ Map : /**
61+ * @param obj
62+ * @returns {undefined|object }
63+ */ ( /** @type {any } */ obj ) => obj !== null && typeof obj === 'object' && obj . asCID !== obj && ! Array . isArray ( obj ) && ! ( obj instanceof Uint8Array ) ? obj : undefined
3464}
3565/** @type {{ [k in string]: (obj:any)=>undefined|any} } */
3666const Types = {
3767 'CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)' : Kinds . Link ,
38- 'CarV1HeaderOrV2Pragma > roots (anon)' : /** @returns {undefined|any } */ ( /** @type {any } */ obj ) => {
68+ 'CarV1HeaderOrV2Pragma > roots (anon)' : /**
69+ * @param obj
70+ * @returns {undefined|any }
71+ */ ( /** @type {any } */ obj ) => {
3972 if ( Kinds . List ( obj ) === undefined ) {
4073 return undefined
4174 }
@@ -61,7 +94,10 @@ const Types = {
6194 return obj
6295 } ,
6396 Int : Kinds . Int ,
64- CarV1HeaderOrV2Pragma : /** @returns {undefined|any } */ ( /** @type {any } */ obj ) => {
97+ CarV1HeaderOrV2Pragma : /**
98+ * @param obj
99+ * @returns {undefined|any }
100+ */ ( /** @type {any } */ obj ) => {
65101 if ( Kinds . Map ( obj ) === undefined ) {
66102 return undefined
67103 }
@@ -123,7 +159,10 @@ const Types = {
123159/** @type {{ [k in string]: (obj:any)=>undefined|any} } */
124160const Reprs = {
125161 'CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)' : Kinds . Link ,
126- 'CarV1HeaderOrV2Pragma > roots (anon)' : /** @returns {undefined|any } */ ( /** @type {any } */ obj ) => {
162+ 'CarV1HeaderOrV2Pragma > roots (anon)' : /**
163+ * @param obj
164+ * @returns {undefined|any }
165+ */ ( /** @type {any } */ obj ) => {
127166 if ( Kinds . List ( obj ) === undefined ) {
128167 return undefined
129168 }
@@ -149,7 +188,10 @@ const Reprs = {
149188 return obj
150189 } ,
151190 Int : Kinds . Int ,
152- CarV1HeaderOrV2Pragma : /** @returns {undefined|any } */ ( /** @type {any } */ obj ) => {
191+ CarV1HeaderOrV2Pragma : /**
192+ * @param obj
193+ * @returns {undefined|any }
194+ */ ( /** @type {any } */ obj ) => {
153195 if ( Kinds . Map ( obj ) === undefined ) {
154196 return undefined
155197 }
0 commit comments