Skip to content

Commit 718b4ba

Browse files
committed
feat(gdr): add unimplemented documents::incomingGlobalDocRefCount()
1 parent 40f299c commit 718b4ba

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/evaluator/functions/documents.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ documents['get'] = constantExecutor(() => {
88
documents['incomingRefCount'] = constantExecutor(() => {
99
throw new Error('not implemented')
1010
})
11+
documents['incomingGlobalDocumentReferenceCount'] = constantExecutor(() => {
12+
throw new Error('not implemented')
13+
})
1114
export default documents

src/typeEvaluator/functions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ export function handleFuncCallNode(node: FuncCallNode, scope: Scope): TypeNode {
511511
case 'documents.incomingRefCount': {
512512
return {type: 'number'}
513513
}
514+
case 'documents.incomingGlobalDocumentReferenceCount': {
515+
return {type: 'number'}
516+
}
514517
default: {
515518
return {type: 'unknown'}
516519
}

test/typeEvaluate.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,8 @@ t.test('function: documents::*', (t) => {
29862986
const query = `*[_type == "post"] {
29872987
"name": documents::get(name),
29882988
"author": documents::get(author),
2989-
"refCnt": documents::incomingRefCount(),
2989+
"refCount": documents::incomingRefCount(),
2990+
"gdrCount": documents::incomingGlobalDocumentReferenceCount(),
29902991
}`
29912992
const ast = parse(query)
29922993
const res = typeEvaluate(ast, schemas)
@@ -3008,7 +3009,13 @@ t.test('function: documents::*', (t) => {
30083009
type: 'unknown',
30093010
},
30103011
},
3011-
refCnt: {
3012+
refCount: {
3013+
type: 'objectAttribute',
3014+
value: {
3015+
type: 'number',
3016+
},
3017+
},
3018+
gdrCount: {
30123019
type: 'objectAttribute',
30133020
value: {
30143021
type: 'number',

0 commit comments

Comments
 (0)