@@ -80,20 +80,20 @@ allow if {
8080 } ) ;
8181
8282 it ( "can be called without types, without input" , async ( ) => {
83- const res = await new OPAClient ( serverURL ) . authorize ( "test/p_bool" ) ;
83+ const res = await new OPAClient ( serverURL ) . evaluate ( "test/p_bool" ) ;
8484 assert . strictEqual ( res , true ) ;
8585 } ) ;
8686
8787 it ( "can be called with input==false" , async ( ) => {
88- const res = await new OPAClient ( serverURL ) . authorize (
88+ const res = await new OPAClient ( serverURL ) . evaluate (
8989 "test/p_bool_false" ,
9090 false ,
9191 ) ;
9292 assert . strictEqual ( res , true ) ;
9393 } ) ;
9494
9595 it ( "supports rules with slashes" , async ( ) => {
96- const res = await new OPAClient ( serverURL ) . authorize (
96+ const res = await new OPAClient ( serverURL ) . evaluate (
9797 "has/weird%2fpackage/but/it_is" ,
9898 ) ;
9999 assert . strictEqual ( res , true ) ;
@@ -108,7 +108,7 @@ allow if {
108108 foo : string ;
109109 }
110110 const inp : myInput = { name : "alice" , list : [ 1 , 2 , true ] } ;
111- const res = await new OPAClient ( serverURL ) . authorize < myInput , myResult > (
111+ const res = await new OPAClient ( serverURL ) . evaluate < myInput , myResult > (
112112 "test/compound_input" ,
113113 inp ,
114114 ) ;
@@ -120,7 +120,7 @@ allow if {
120120 type : string ;
121121 }
122122 const inp = true ;
123- const res = await new OPAClient ( serverURL ) . authorize < boolean , typeResult > (
123+ const res = await new OPAClient ( serverURL ) . evaluate < boolean , typeResult > (
124124 "test/has_type" ,
125125 inp ,
126126 ) ;
@@ -143,7 +143,7 @@ allow if {
143143 interface myResult {
144144 foo : string ;
145145 }
146- const res = await new OPAClient ( serverURL ) . authorize < A , myResult > (
146+ const res = await new OPAClient ( serverURL ) . evaluate < A , myResult > (
147147 "test/compound_input" ,
148148 inp ,
149149 ) ;
@@ -170,15 +170,15 @@ allow if {
170170 interface myResult {
171171 foo : string ;
172172 }
173- const res = await new OPAClient ( serverURL ) . authorize < A , myResult > (
173+ const res = await new OPAClient ( serverURL ) . evaluate < A , myResult > (
174174 "test/compound_input" ,
175175 inp ,
176176 ) ;
177177 assert . deepStrictEqual ( res , { foo : "bar" } ) ;
178178 } ) ;
179179
180180 it ( "supports result class implementing FromResult" , async ( ) => {
181- const res = await new OPAClient ( serverURL ) . authorize < any , boolean > (
181+ const res = await new OPAClient ( serverURL ) . evaluate < any , boolean > (
182182 "test/compound_result" ,
183183 undefined , // input
184184 ( r ?: Result ) => ( r as Record < string , any > ) [ "allowed" ] ?? false ,
@@ -195,7 +195,7 @@ allow if {
195195 } ) ;
196196 const res = await new OPAClient ( serverURL , {
197197 sdk : { httpClient } ,
198- } ) . authorize ( "test/p_bool" ) ;
198+ } ) . evaluate ( "test/p_bool" ) ;
199199 assert . strictEqual ( res , true ) ;
200200 assert . strictEqual ( called , true ) ;
201201 } ) ;
@@ -204,7 +204,7 @@ allow if {
204204 const authorization = "Bearer opensesame" ;
205205 const res = await new OPAClient ( serverURL , {
206206 headers : { authorization } ,
207- } ) . authorize ( "token/p" ) ;
207+ } ) . evaluate ( "token/p" ) ;
208208 assert . strictEqual ( res , true ) ;
209209 } ) ;
210210
0 commit comments