@@ -8,9 +8,15 @@ export const tags = ["Memory Storage"];
88
99export const Null = z . literal ( null ) ;
1010export const Unit = z . object ( { } ) ;
11- export const Meta = z . record ( z . string ( ) , z . string ( ) ) . describe ( "Arbitrary metadata" ) ;
12- export const The = z . string ( ) . describe ( "Type of the fact usually formatted as media type" ) ;
13- export const Of = z . string ( ) . describe ( "Unique identifier for the mutable entity" ) ;
11+ export const Meta = z . record ( z . string ( ) , z . string ( ) ) . describe (
12+ "Arbitrary metadata" ,
13+ ) ;
14+ export const The = z . string ( ) . describe (
15+ "Type of the fact usually formatted as media type" ,
16+ ) ;
17+ export const Of = z . string ( ) . describe (
18+ "Unique identifier for the mutable entity" ,
19+ ) ;
1420
1521export const UTCUnixTimestampInSeconds = z . number ( ) . int ( ) ;
1622
@@ -34,10 +40,14 @@ export const Principal = z
3440 . union ( [ z . string ( ) , DID ] )
3541 . describe ( "Unique DID identifier of the issuing principal" ) ;
3642
37- export const Cause = z . string ( ) . describe ( "Merkle reference to the previous state of the entity" ) ;
43+ export const Cause = z . string ( ) . describe (
44+ "Merkle reference to the previous state of the entity" ,
45+ ) ;
3846export const Retract = z
3947 . object ( {
40- is : z . literal ( undefined ) . optional ( ) . describe ( "Retraction has no 'is' field" ) ,
48+ is : z . literal ( undefined ) . optional ( ) . describe (
49+ "Retraction has no 'is' field" ,
50+ ) ,
4151 } )
4252 . describe ( "Retracts fact" ) ;
4353export const Claim = z . literal ( true ) . describe ( "Expects fact" ) ;
@@ -67,23 +77,29 @@ export const Fact = z.object({
6777} ) ;
6878
6979export const Delegation = z . never ( ) . describe ( "UCAN delegation" ) ;
70- export const Since = z . number ( ) . int ( ) . describe ( "Sequence number of the transaction" ) ;
80+ export const Since = z . number ( ) . int ( ) . describe (
81+ "Sequence number of the transaction" ,
82+ ) ;
7183export const Selector = z . record (
7284 Of ,
7385 z . record (
7486 The ,
7587 z . record (
7688 Cause ,
7789 z . object ( {
78- is : Unit . optional ( ) . describe ( "If omitted will includes retracted facts" ) ,
90+ is : Unit . optional ( ) . describe (
91+ "If omitted will includes retracted facts" ,
92+ ) ,
7993 } ) ,
8094 ) ,
8195 ) ,
8296) ;
8397
8498const Access = z
8599 . record (
86- z . string ( ) . describe ( "Merkle reference to the invocation / delegation being authorized" ) ,
100+ z . string ( ) . describe (
101+ "Merkle reference to the invocation / delegation being authorized" ,
102+ ) ,
87103 Unit ,
88104 )
89105 . describe ( "Access that was authorized" ) ;
@@ -94,7 +110,9 @@ const Bytes = z
94110 bytes : z . string ( ) . describe ( "Base64 encoded binary" ) ,
95111 } ) ,
96112 } )
97- . transform < Uint8Array > ( ( source ) => JSON . decode < Uint8Array > ( JSON . encode ( source ) as Uint8Array ) )
113+ . transform < Uint8Array > ( ( source ) =>
114+ JSON . decode < Uint8Array > ( JSON . encode ( source ) as Uint8Array )
115+ )
98116 . describe ( "Bytes in DAG-JSON format" ) ;
99117
100118const Signature = Bytes . describe ( "Signature" ) ;
@@ -110,7 +128,10 @@ export const ucan = <T extends z.ZodTypeAny>(invocation: T) =>
110128 authorization : Authorization ,
111129 } ) ;
112130
113- const invocation = < Ability extends string , Args extends z . ZodTypeAny > ( cmd : Ability , args : Args ) =>
131+ const invocation = < Ability extends string , Args extends z . ZodTypeAny > (
132+ cmd : Ability ,
133+ args : Args ,
134+ ) =>
114135 z . object ( {
115136 cmd : z . literal ( cmd ) ,
116137 iss : Principal ,
@@ -122,7 +143,10 @@ const invocation = <Ability extends string, Args extends z.ZodTypeAny>(cmd: Abil
122143 prf : Delegation . array ( ) . describe ( "UCAN delegation chain" ) ,
123144 } ) ;
124145
125- export const Transaction = invocation ( "/memory/transact" , z . object ( { changes : Changes } ) ) ;
146+ export const Transaction = invocation (
147+ "/memory/transact" ,
148+ z . object ( { changes : Changes } ) ,
149+ ) ;
126150
127151export const Query = invocation (
128152 "/memory/query" ,
@@ -216,8 +240,14 @@ export const transact = createRoute({
216240 } ,
217241 responses : {
218242 [ HttpStatusCodes . OK ] : jsonContent ( ok ( Commit ) , "Successful transaction" ) ,
219- [ HttpStatusCodes . CONFLICT ] : jsonContent ( error ( ConflictError ) , "Conflict occurred" ) ,
220- [ HttpStatusCodes . UNAUTHORIZED ] : jsonContent ( error ( AuthorizationError ) , "Unauthorized" ) ,
243+ [ HttpStatusCodes . CONFLICT ] : jsonContent (
244+ error ( ConflictError ) ,
245+ "Conflict occurred" ,
246+ ) ,
247+ [ HttpStatusCodes . UNAUTHORIZED ] : jsonContent (
248+ error ( AuthorizationError ) ,
249+ "Unauthorized" ,
250+ ) ,
221251 [ HttpStatusCodes . SERVICE_UNAVAILABLE ] : jsonContent (
222252 error ( ConnectionError . or ( TransactionError ) ) ,
223253 "Memory service is unable to process transaction" ,
@@ -269,7 +299,10 @@ export const query = createRoute({
269299 error ( QueryError . or ( ConnectionError ) ) ,
270300 "Memory service unable to process query" ,
271301 ) ,
272- [ HttpStatusCodes . UNAUTHORIZED ] : jsonContent ( error ( AuthorizationError ) , "Unauthorized" ) ,
302+ [ HttpStatusCodes . UNAUTHORIZED ] : jsonContent (
303+ error ( AuthorizationError ) ,
304+ "Unauthorized" ,
305+ ) ,
273306 [ HttpStatusCodes . INTERNAL_SERVER_ERROR ] : jsonContent (
274307 error ( SystemError ) ,
275308 "Memory service error" ,
0 commit comments