Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo checkouts #444

Merged
merged 28 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions lexicons/com/atproto/sync/getCheckout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getCheckout",
"defs": {
"main": {
"type": "query",
"description": "Gets the repo state.",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"commit": {"type": "string", "description": "The commit to get the checkout from. Defaults to current HEAD."}
}
},
"output": {
"encoding": "application/cbor"
}
}
}
}
32 changes: 32 additions & 0 deletions lexicons/com/atproto/sync/getCommitPath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"lexicon": 1,
"id": "com.atproto.sync.getCommitPath",
"defs": {
"main": {
"type": "query",
"description": "Gets the path of repo commits",
"parameters": {
"type": "params",
"required": ["did"],
"properties": {
"did": {"type": "string", "description": "The DID of the repo."},
"latest": { "type": "string", "description": "The most recent commit"},
"earliest": { "type": "string", "description": "The earliest commit to start from"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["commits"],
"properties": {
"commits": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
}
}
}
1 change: 0 additions & 1 deletion packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
## Libraries

- [API](./api): A library for communicating with ATP servers.
- [Auth](./auth): ATP's core permissioning library (based on UCANs).
- [Common](./common): A library containing code which is shared between ATP packages.
- [Crypto](./crypto): ATP's common cryptographic operations.
- [DID Resolver](./did-resolver): A library for resolving ATP's Decentralized ID methods.
Expand Down
26 changes: 26 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import * as ComAtprotoSessionCreate from './types/com/atproto/session/create'
import * as ComAtprotoSessionDelete from './types/com/atproto/session/delete'
import * as ComAtprotoSessionGet from './types/com/atproto/session/get'
import * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh'
import * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout'
import * as ComAtprotoSyncGetCommitPath from './types/com/atproto/sync/getCommitPath'
import * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
import * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot'
import * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo'
Expand Down Expand Up @@ -90,6 +92,8 @@ export * as ComAtprotoSessionCreate from './types/com/atproto/session/create'
export * as ComAtprotoSessionDelete from './types/com/atproto/session/delete'
export * as ComAtprotoSessionGet from './types/com/atproto/session/get'
export * as ComAtprotoSessionRefresh from './types/com/atproto/session/refresh'
export * as ComAtprotoSyncGetCheckout from './types/com/atproto/sync/getCheckout'
export * as ComAtprotoSyncGetCommitPath from './types/com/atproto/sync/getCommitPath'
export * as ComAtprotoSyncGetRepo from './types/com/atproto/sync/getRepo'
export * as ComAtprotoSyncGetRoot from './types/com/atproto/sync/getRoot'
export * as ComAtprotoSyncUpdateRepo from './types/com/atproto/sync/updateRepo'
Expand Down Expand Up @@ -481,6 +485,28 @@ export class SyncNS {
this._service = service
}

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

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

getRepo(
params?: ComAtprotoSyncGetRepo.QueryParams,
opts?: ComAtprotoSyncGetRepo.CallOptions,
Expand Down
73 changes: 73 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,77 @@ export const schemaDict = {
},
},
},
ComAtprotoSyncGetCheckout: {
lexicon: 1,
id: 'com.atproto.sync.getCheckout',
defs: {
main: {
type: 'query',
description: 'Gets the repo state.',
parameters: {
type: 'params',
required: ['did'],
properties: {
did: {
type: 'string',
description: 'The DID of the repo.',
},
commit: {
type: 'string',
description:
'The commit to get the checkout from. Defaults to current HEAD.',
},
},
},
output: {
encoding: 'application/cbor',
},
},
},
},
ComAtprotoSyncGetCommitPath: {
lexicon: 1,
id: 'com.atproto.sync.getCommitPath',
defs: {
main: {
type: 'query',
description: 'Gets the path of repo commits',
parameters: {
type: 'params',
required: ['did'],
properties: {
did: {
type: 'string',
description: 'The DID of the repo.',
},
latest: {
type: 'string',
description: 'The most recent commit',
},
earliest: {
type: 'string',
description: 'The earliest commit to start from',
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['commits'],
properties: {
commits: {
type: 'array',
items: {
type: 'string',
},
},
},
},
},
},
},
},
ComAtprotoSyncGetRepo: {
lexicon: 1,
id: 'com.atproto.sync.getRepo',
Expand Down Expand Up @@ -2998,6 +3069,8 @@ export const ids = {
ComAtprotoSessionDelete: 'com.atproto.session.delete',
ComAtprotoSessionGet: 'com.atproto.session.get',
ComAtprotoSessionRefresh: 'com.atproto.session.refresh',
ComAtprotoSyncGetCheckout: 'com.atproto.sync.getCheckout',
ComAtprotoSyncGetCommitPath: 'com.atproto.sync.getCommitPath',
ComAtprotoSyncGetRepo: 'com.atproto.sync.getRepo',
ComAtprotoSyncGetRoot: 'com.atproto.sync.getRoot',
ComAtprotoSyncUpdateRepo: 'com.atproto.sync.updateRepo',
Expand Down
29 changes: 29 additions & 0 deletions packages/api/src/client/types/com/atproto/sync/getCheckout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import { Headers, XRPCError } from '@atproto/xrpc'

export interface QueryParams {
/** The DID of the repo. */
did: string
/** The commit to get the checkout from. Defaults to current HEAD. */
commit?: string
}

export type InputSchema = undefined

export interface CallOptions {
headers?: Headers
}

export interface Response {
success: boolean
headers: Headers
data: Uint8Array
}

export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
}
return e
}
36 changes: 36 additions & 0 deletions packages/api/src/client/types/com/atproto/sync/getCommitPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import { Headers, XRPCError } from '@atproto/xrpc'

export interface QueryParams {
/** The DID of the repo. */
did: string
/** The most recent commit */
latest?: string
/** The earliest commit to start from */
earliest?: string
}

export type InputSchema = undefined

export interface OutputSchema {
commits: string[]
[k: string]: unknown
}

export interface CallOptions {
headers?: Headers
}

export interface Response {
success: boolean
headers: Headers
data: OutputSchema
}

export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
}
return e
}
3 changes: 0 additions & 3 deletions packages/auth/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions packages/auth/build.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/auth/jest.config.js

This file was deleted.

23 changes: 0 additions & 23 deletions packages/auth/package.json

This file was deleted.

30 changes: 0 additions & 30 deletions packages/auth/src/atp-capabilities.ts

This file was deleted.