File tree Expand file tree Collapse file tree 5 files changed +20
-7
lines changed Expand file tree Collapse file tree 5 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,15 @@ export class ResourcePath extends BasePath<ResourcePath> {
215
215
return this . canonicalString ( ) ;
216
216
}
217
217
218
+ /**
219
+ * Returns a string representation of this path
220
+ * where each path segment has been encoded with
221
+ * `encodeURIComponent`.
222
+ */
223
+ toUriEncodedString ( ) : string {
224
+ return this . toArray ( ) . map ( encodeURIComponent ) . join ( '/' ) ;
225
+ }
226
+
218
227
/**
219
228
* Creates a resource path from the given slash-delimited string. If multiple
220
229
* arguments are provided, all components are combined. Leading and trailing
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import * as grpc from '@grpc/grpc-js';
22
22
import { Token } from '../../api/credentials' ;
23
23
import { DatabaseInfo } from '../../core/database_info' ;
24
24
import { SDK_VERSION } from '../../core/version' ;
25
+ import { ResourcePath } from '../../model/path' ;
25
26
import { Connection , Stream } from '../../remote/connection' ;
26
27
import { mapCodeFromRpcCode } from '../../remote/rpc_error' ;
27
28
import { StreamBridge } from '../../remote/stream_bridge' ;
@@ -114,7 +115,7 @@ export class GrpcConnection implements Connection {
114
115
115
116
invokeRPC < Req , Resp > (
116
117
rpcName : string ,
117
- path : string [ ] ,
118
+ path : ResourcePath ,
118
119
request : Req ,
119
120
authToken : Token | null ,
120
121
appCheckToken : Token | null
@@ -166,7 +167,7 @@ export class GrpcConnection implements Connection {
166
167
167
168
invokeStreamingRPC < Req , Resp > (
168
169
rpcName : string ,
169
- path : string [ ] ,
170
+ path : ResourcePath ,
170
171
request : Req ,
171
172
authToken : Token | null ,
172
173
appCheckToken : Token | null ,
Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
import { Token } from '../api/credentials' ;
19
+ import { ResourcePath } from '../model/path' ;
19
20
import { FirestoreError } from '../util/error' ;
20
21
21
22
/**
@@ -46,7 +47,7 @@ export interface Connection {
46
47
*/
47
48
invokeRPC < Req , Resp > (
48
49
rpcName : string ,
49
- path : string [ ] ,
50
+ path : ResourcePath ,
50
51
request : Req ,
51
52
authToken : Token | null ,
52
53
appCheckToken : Token | null
@@ -67,7 +68,7 @@ export interface Connection {
67
68
*/
68
69
invokeStreamingRPC < Req , Resp > (
69
70
rpcName : string ,
70
- path : string [ ] ,
71
+ path : ResourcePath ,
71
72
request : Req ,
72
73
authToken : Token | null ,
73
74
appCheckToken : Token | null ,
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
22
22
DatabaseInfo ,
23
23
DEFAULT_DATABASE_NAME
24
24
} from '../core/database_info' ;
25
+ import { ResourcePath } from '../model/path' ;
25
26
import { debugAssert } from '../util/assert' ;
26
27
import { generateUniqueDebugId } from '../util/debug_uid' ;
27
28
import { FirestoreError } from '../util/error' ;
@@ -82,7 +83,7 @@ export abstract class RestConnection implements Connection {
82
83
83
84
invokeRPC < Req , Resp > (
84
85
rpcName : string ,
85
- path : string [ ] ,
86
+ path : ResourcePath ,
86
87
req : Req ,
87
88
authToken : Token | null ,
88
89
appCheckToken : Token | null
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
24
24
Token
25
25
} from '../../../src/api/credentials' ;
26
26
import { DatabaseId } from '../../../src/core/database_info' ;
27
+ import { ResourcePath } from '../../../src/model/path' ;
27
28
import { Connection , Stream } from '../../../src/remote/connection' ;
28
29
import {
29
30
Datastore ,
@@ -49,7 +50,7 @@ describe('Datastore', () => {
49
50
50
51
invokeRPC < Req , Resp > (
51
52
rpcName : string ,
52
- path : string [ ] ,
53
+ path : ResourcePath ,
53
54
request : Req ,
54
55
token : Token | null
55
56
) : Promise < Resp > {
@@ -58,7 +59,7 @@ describe('Datastore', () => {
58
59
59
60
invokeStreamingRPC < Req , Resp > (
60
61
rpcName : string ,
61
- path : string [ ] ,
62
+ path : ResourcePath ,
62
63
request : Req ,
63
64
token : Token | null
64
65
) : Promise < Resp [ ] > {
You can’t perform that action at this time.
0 commit comments