File tree Expand file tree Collapse file tree 8 files changed +78
-34
lines changed Expand file tree Collapse file tree 8 files changed +78
-34
lines changed Original file line number Diff line number Diff line change 3030 }
3131 ],
3232 "@typescript-eslint/no-explicit-any" : " off" ,
33- "@typescript-eslint/no-unsafe-declaration-merging" : " off " ,
33+ "@typescript-eslint/no-unsafe-declaration-merging" : " error " ,
3434 "eslint/arrow-body-style" : [" error" , " as-needed" ],
3535 "eslint/curly" : " error" ,
3636 "eslint/id-length" : " off" ,
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ export interface ApiOptions
88 resources ?: Resource [ ] ;
99 } > { }
1010
11- export interface Api extends ApiOptions { }
12- export class Api {
11+ export class Api implements ApiOptions {
1312 entrypoint : string ;
13+
14+ title ?: string | null ;
15+ resources ?: Resource [ ] | null ;
16+
1417 constructor ( entrypoint : string , options : ApiOptions = { } ) {
1518 this . entrypoint = entrypoint ;
1619 assignSealed ( this , options ) ;
Original file line number Diff line number Diff line change @@ -40,16 +40,29 @@ export interface FieldOptions
4040 enum ?: { [ key : string | number ] : string | number } ;
4141 reference ?: string | Resource ;
4242 embedded ?: Resource ;
43- required ?: boolean ;
4443 nullable ?: boolean ;
44+ required ?: boolean ;
4545 description ?: string ;
4646 maxCardinality ?: number ;
4747 deprecated ?: boolean ;
4848 } > { }
4949
50- export interface Field extends FieldOptions { }
51- export class Field {
50+ export class Field implements FieldOptions {
5251 name : string ;
52+
53+ id ?: string | null ;
54+ range ?: string | null ;
55+ type ?: FieldType | null ;
56+ arrayType ?: FieldType | null ;
57+ enum ?: { [ key : string | number ] : string | number } | null ;
58+ reference ?: string | Resource | null ;
59+ embedded ?: Resource | null ;
60+ nullable ?: boolean | null ;
61+ required ?: boolean | null ;
62+ description ?: string | null ;
63+ maxCardinality ?: number | null ;
64+ deprecated ?: boolean | null ;
65+
5366 constructor ( name : string , options : FieldOptions = { } ) {
5467 this . name = name ;
5568 assignSealed ( this , options ) ;
Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ export interface OperationOptions
1212 deprecated ?: boolean ;
1313 } > { }
1414
15- export interface Operation extends OperationOptions { }
16- export class Operation {
15+ export class Operation implements OperationOptions {
1716 name : string ;
1817 type : OperationType ;
18+ method ?: string | null ;
19+ expects ?: any | null ;
20+ returns ?: string | null ;
21+ types ?: string [ ] | null ;
22+ deprecated ?: boolean | null ;
23+
1924 constructor (
2025 name : string ,
2126 type : OperationType ,
Original file line number Diff line number Diff line change 1- export class Parameter {
1+ export interface ParameterOptions {
2+ variable : string ;
3+ range : string | null ;
4+ required : boolean ;
5+ description : string ;
6+ deprecated ?: boolean | undefined ;
7+ }
8+
9+ export class Parameter implements ParameterOptions {
210 variable : string ;
311 range : string | null ;
412 required : boolean ;
Original file line number Diff line number Diff line change @@ -9,19 +9,29 @@ export interface ResourceOptions
99 id ?: string ;
1010 title ?: string ;
1111 description ?: string ;
12- deprecated ?: boolean ;
1312 fields ?: Field [ ] ;
1413 readableFields ?: Field [ ] ;
1514 writableFields ?: Field [ ] ;
16- parameters ?: Parameter [ ] ;
1715 getParameters ?: ( ) => Promise < Parameter [ ] > ;
1816 operations ?: Operation [ ] ;
17+ deprecated ?: boolean ;
18+ parameters ?: Parameter [ ] ;
1919 } > { }
2020
21- export interface Resource extends ResourceOptions { }
22- export class Resource {
21+ export class Resource implements ResourceOptions {
2322 name : string ;
2423 url : string ;
24+ id ?: string | null ;
25+ title ?: string | null ;
26+ description ?: string | null ;
27+ fields ?: Field [ ] | null ;
28+ readableFields ?: Field [ ] | null ;
29+ writableFields ?: Field [ ] | null ;
30+ getParameters ?: ( ( ) => Promise < Parameter [ ] > ) | null ;
31+ operations ?: Operation [ ] | null ;
32+ deprecated ?: boolean | null ;
33+ parameters ?: Parameter [ ] | null ;
34+
2535 constructor ( name : string , url : string , options : ResourceOptions = { } ) {
2636 this . name = name ;
2737 this . url = url ;
Original file line number Diff line number Diff line change @@ -18,10 +18,13 @@ interface JsonLdId {
1818 "@id" : Iri ;
1919}
2020
21- /** Zero‑to‑many rdf:types */
22- interface JsonLdType {
23- "@type" ?: Iri | Iri [ ] ;
24- }
21+ /**
22+ * A generic expanded JSON‑LD node.
23+ * • Keys are IRIs.
24+ * • Each predicate maps to an *array* of nodes or literal values.
25+ *
26+ * You can extend this interface with concrete predicates later.
27+ */
2528
2629export interface ExpandedOperation {
2730 "@type" : [ "http://www.w3.org/ns/hydra/core#Operation" ] ;
@@ -73,7 +76,7 @@ interface ExpandedSupportedProperty {
7376 "http://www.w3.org/2002/07/owl#deprecated" ?: [ JsonLdValue < boolean > ] ;
7477}
7578
76- export interface ExpandedClass extends JsonLdNode {
79+ export interface ExpandedClass {
7780 "@id" : string ;
7881 "@type" : [ "http://www.w3.org/ns/hydra/core#Class" ] ;
7982 "http://www.w3.org/2000/01/rdf-schema#label" ?: [ JsonLdValue < string > ] ;
Original file line number Diff line number Diff line change @@ -994,14 +994,7 @@ const parsed = [
994994 description : "" ,
995995 } ,
996996 ] ,
997- parameters : [
998- {
999- variable : "page" ,
1000- range : "integer" ,
1001- required : false ,
1002- description : "The collection page number" ,
1003- } ,
1004- ] ,
997+
1005998 operations : [
1006999 {
10071000 name : "Retrieves a Book resource." ,
@@ -1034,6 +1027,14 @@ const parsed = [
10341027 deprecated : false ,
10351028 } ,
10361029 ] ,
1030+ parameters : [
1031+ {
1032+ variable : "page" ,
1033+ range : "integer" ,
1034+ required : false ,
1035+ description : "The collection page number" ,
1036+ } ,
1037+ ] ,
10371038 } ,
10381039 {
10391040 name : "reviews" ,
@@ -1277,14 +1278,7 @@ const parsed = [
12771278 description : "" ,
12781279 } ,
12791280 ] ,
1280- parameters : [
1281- {
1282- variable : "page" ,
1283- range : "integer" ,
1284- required : false ,
1285- description : "The collection page number" ,
1286- } ,
1287- ] ,
1281+
12881282 operations : [
12891283 {
12901284 name : "Retrieves a Review resource." ,
@@ -1317,6 +1311,14 @@ const parsed = [
13171311 deprecated : false ,
13181312 } ,
13191313 ] ,
1314+ parameters : [
1315+ {
1316+ variable : "page" ,
1317+ range : "integer" ,
1318+ required : false ,
1319+ description : "The collection page number" ,
1320+ } ,
1321+ ] ,
13201322 } ,
13211323] ;
13221324
You can’t perform that action at this time.
0 commit comments