Skip to content

Commit

Permalink
Make requestCrawl & notifyOfUpdate procedures (#1217)
Browse files Browse the repository at this point in the history
make requestCrawl & notifyOfUpdate procedures
  • Loading branch information
dholms committed Jun 20, 2023
1 parent 7f3b583 commit 2768fb9
Show file tree
Hide file tree
Showing 12 changed files with 138 additions and 88 deletions.
15 changes: 9 additions & 6 deletions lexicons/com/atproto/sync/notifyOfUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"id": "com.atproto.sync.notifyOfUpdate",
"defs": {
"main": {
"type": "query",
"type": "procedure",
"description": "Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.",
"parameters": {
"type": "params",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is notifying of update."}
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is notifying of update."}
}
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions lexicons/com/atproto/sync/requestCrawl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"id": "com.atproto.sync.requestCrawl",
"defs": {
"main": {
"type": "query",
"type": "procedure",
"description": "Request a service to persistently crawl hosted repos.",
"parameters": {
"type": "params",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is requesting to be crawled."}
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is requesting to be crawled."}
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,22 +982,22 @@ export class SyncNS {
}

notifyOfUpdate(
params?: ComAtprotoSyncNotifyOfUpdate.QueryParams,
data?: ComAtprotoSyncNotifyOfUpdate.InputSchema,
opts?: ComAtprotoSyncNotifyOfUpdate.CallOptions,
): Promise<ComAtprotoSyncNotifyOfUpdate.Response> {
return this._service.xrpc
.call('com.atproto.sync.notifyOfUpdate', params, undefined, opts)
.call('com.atproto.sync.notifyOfUpdate', opts?.qp, data, opts)
.catch((e) => {
throw ComAtprotoSyncNotifyOfUpdate.toKnownErr(e)
})
}

requestCrawl(
params?: ComAtprotoSyncRequestCrawl.QueryParams,
data?: ComAtprotoSyncRequestCrawl.InputSchema,
opts?: ComAtprotoSyncRequestCrawl.CallOptions,
): Promise<ComAtprotoSyncRequestCrawl.Response> {
return this._service.xrpc
.call('com.atproto.sync.requestCrawl', params, undefined, opts)
.call('com.atproto.sync.requestCrawl', opts?.qp, data, opts)
.catch((e) => {
throw ComAtprotoSyncRequestCrawl.toKnownErr(e)
})
Expand Down
42 changes: 24 additions & 18 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3248,17 +3248,20 @@ export const schemaDict = {
id: 'com.atproto.sync.notifyOfUpdate',
defs: {
main: {
type: 'query',
type: 'procedure',
description:
'Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
},
},
},
},
Expand All @@ -3270,16 +3273,19 @@ export const schemaDict = {
id: 'com.atproto.sync.requestCrawl',
defs: {
main: {
type: 'query',
type: 'procedure',
description: 'Request a service to persistently crawl hosted repos.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import { isObj, hasProp } from '../../../../util'
import { lexicons } from '../../../../lexicons'
import { CID } from 'multiformats/cid'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is notifying of update. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined

export interface CallOptions {
headers?: Headers
qp?: QueryParams
encoding: 'application/json'
}

export interface Response {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import { isObj, hasProp } from '../../../../util'
import { lexicons } from '../../../../lexicons'
import { CID } from 'multiformats/cid'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is requesting to be crawled. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined

export interface CallOptions {
headers?: Headers
qp?: QueryParams
encoding: 'application/json'
}

export interface Response {
Expand Down
42 changes: 24 additions & 18 deletions packages/bsky/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3248,17 +3248,20 @@ export const schemaDict = {
id: 'com.atproto.sync.notifyOfUpdate',
defs: {
main: {
type: 'query',
type: 'procedure',
description:
'Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
},
},
},
},
Expand All @@ -3270,16 +3273,19 @@ export const schemaDict = {
id: 'com.atproto.sync.requestCrawl',
defs: {
main: {
type: 'query',
type: 'procedure',
description: 'Request a service to persistently crawl hosted repos.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import { isObj, hasProp } from '../../../../util'
import { CID } from 'multiformats/cid'
import { HandlerAuth } from '@atproto/xrpc-server'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is notifying of update. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined
export type HandlerInput = undefined
export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

export interface HandlerError {
status: number
Expand Down
11 changes: 8 additions & 3 deletions packages/bsky/src/lexicon/types/com/atproto/sync/requestCrawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import { isObj, hasProp } from '../../../../util'
import { CID } from 'multiformats/cid'
import { HandlerAuth } from '@atproto/xrpc-server'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is requesting to be crawled. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined
export type HandlerInput = undefined
export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

export interface HandlerError {
status: number
Expand Down
42 changes: 24 additions & 18 deletions packages/pds/src/lexicon/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3248,17 +3248,20 @@ export const schemaDict = {
id: 'com.atproto.sync.notifyOfUpdate',
defs: {
main: {
type: 'query',
type: 'procedure',
description:
'Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is notifying of update.',
},
},
},
},
Expand All @@ -3270,16 +3273,19 @@ export const schemaDict = {
id: 'com.atproto.sync.requestCrawl',
defs: {
main: {
type: 'query',
type: 'procedure',
description: 'Request a service to persistently crawl hosted repos.',
parameters: {
type: 'params',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['hostname'],
properties: {
hostname: {
type: 'string',
description:
'Hostname of the service that is requesting to be crawled.',
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import { isObj, hasProp } from '../../../../util'
import { CID } from 'multiformats/cid'
import { HandlerAuth } from '@atproto/xrpc-server'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is notifying of update. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined
export type HandlerInput = undefined
export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

export interface HandlerError {
status: number
Expand Down
11 changes: 8 additions & 3 deletions packages/pds/src/lexicon/types/com/atproto/sync/requestCrawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ import { isObj, hasProp } from '../../../../util'
import { CID } from 'multiformats/cid'
import { HandlerAuth } from '@atproto/xrpc-server'

export interface QueryParams {
export interface QueryParams {}

export interface InputSchema {
/** Hostname of the service that is requesting to be crawled. */
hostname: string
[k: string]: unknown
}

export type InputSchema = undefined
export type HandlerInput = undefined
export interface HandlerInput {
encoding: 'application/json'
body: InputSchema
}

export interface HandlerError {
status: number
Expand Down

0 comments on commit 2768fb9

Please sign in to comment.