@offworld/backend-api 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ import type * as admin from "../admin.js";
12
12
  import type * as auth from "../auth.js";
13
13
  import type * as github from "../github.js";
14
14
  import type * as http from "../http.js";
15
+ import type * as lib_githubAuth from "../lib/githubAuth.js";
15
16
  import type * as references from "../references.js";
16
17
  import type * as repository from "../repository.js";
17
18
  import type * as validation_github from "../validation/github.js";
@@ -29,6 +30,7 @@ declare const fullApi: ApiFromModules<{
29
30
  auth: typeof auth;
30
31
  github: typeof github;
31
32
  http: typeof http;
33
+ "lib/githubAuth": typeof lib_githubAuth;
32
34
  references: typeof references;
33
35
  repository: typeof repository;
34
36
  "validation/github": typeof validation_github;
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "@offworld/backend-api",
3
- "version": "0.1.0",
4
- "description": "Generated Convex API types for Offworld",
5
- "license": "MIT",
6
- "files": [
7
- "dist"
8
- ],
9
- "type": "module",
10
- "exports": {
11
- "./api": {
12
- "types": "./dist/_generated/api.d.ts",
13
- "import": "./dist/_generated/api.js"
14
- },
15
- "./server": {
16
- "types": "./dist/_generated/server.d.ts",
17
- "import": "./dist/_generated/server.js"
18
- }
19
- },
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "scripts": {
24
- "build": "tsc -p tsconfig.json && bun run ./scripts/copy-generated.ts",
25
- "prepublishOnly": "bun run build"
26
- },
27
- "dependencies": {
28
- "convex": "catalog:"
29
- },
30
- "devDependencies": {
31
- "typescript": "catalog:"
32
- }
2
+ "name": "@offworld/backend-api",
3
+ "version": "0.1.1",
4
+ "description": "Generated Convex API types for Offworld",
5
+ "license": "MIT",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "type": "module",
10
+ "exports": {
11
+ "./api": {
12
+ "types": "./dist/_generated/api.d.ts",
13
+ "import": "./dist/_generated/api.js"
14
+ },
15
+ "./server": {
16
+ "types": "./dist/_generated/server.d.ts",
17
+ "import": "./dist/_generated/server.js"
18
+ }
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "bun run ./scripts/copy-generated.ts",
25
+ "prepublishOnly": "bun run build"
26
+ },
27
+ "dependencies": {
28
+ "convex": "catalog:"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "catalog:"
32
+ }
33
33
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/admin.d.ts DELETED
@@ -1,26 +0,0 @@
1
- export declare const listAllReferences: import("convex/server").RegisteredQuery<"public", {}, Promise<{
2
- _id: import("convex/values").GenericId<"reference">;
3
- fullName: string;
4
- pullCount: number;
5
- generatedAt: string;
6
- commitSha: string;
7
- isVerified: boolean;
8
- }[]>>;
9
- export declare const listAllUsers: import("convex/server").RegisteredQuery<"public", {}, Promise<{
10
- _id: import("convex/values").GenericId<"user">;
11
- email: string;
12
- name: string | undefined;
13
- image: string | undefined;
14
- createdAt: string;
15
- }[]>>;
16
- export declare const deleteReference: import("convex/server").RegisteredMutation<"public", {
17
- fullName: string;
18
- }, Promise<{
19
- success: boolean;
20
- }>>;
21
- export declare const toggleVerified: import("convex/server").RegisteredMutation<"public", {
22
- fullName: string;
23
- }, Promise<{
24
- success: boolean;
25
- isVerified: boolean;
26
- }>>;
@@ -1,16 +0,0 @@
1
- declare const _default: {
2
- providers: ({
3
- type: "customJwt";
4
- issuer: string;
5
- algorithm: "RS256";
6
- jwks: string;
7
- applicationID: string;
8
- } | {
9
- type: "customJwt";
10
- issuer: string;
11
- algorithm: "RS256";
12
- jwks: string;
13
- applicationID?: undefined;
14
- })[];
15
- };
16
- export default _default;
package/dist/auth.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { type QueryCtx, type MutationCtx } from "./_generated/server";
2
- export declare function getAuthUser(ctx: QueryCtx | MutationCtx): Promise<{
3
- _id: import("convex/values").GenericId<"user">;
4
- _creationTime: number;
5
- name?: string | undefined;
6
- image?: string | undefined;
7
- workosId: string;
8
- email: string;
9
- createdAt: string;
10
- } | null>;
11
- export declare const ensureUser: import("convex/server").RegisteredMutation<"public", {}, Promise<import("convex/values").GenericId<"user">>>;
12
- export declare const getCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
13
- _id: import("convex/values").GenericId<"user">;
14
- _creationTime: number;
15
- name?: string | undefined;
16
- image?: string | undefined;
17
- workosId: string;
18
- email: string;
19
- createdAt: string;
20
- } | null>>;
21
- export declare const getCurrentUserSafe: import("convex/server").RegisteredQuery<"public", {}, Promise<{
22
- _id: import("convex/values").GenericId<"user">;
23
- _creationTime: number;
24
- name?: string | undefined;
25
- image?: string | undefined;
26
- workosId: string;
27
- email: string;
28
- createdAt: string;
29
- } | null>>;
30
- export declare function requireAdmin(ctx: QueryCtx | MutationCtx): Promise<{
31
- _id: import("convex/values").GenericId<"user">;
32
- _creationTime: number;
33
- name?: string | undefined;
34
- image?: string | undefined;
35
- workosId: string;
36
- email: string;
37
- createdAt: string;
38
- }>;
39
- export declare const isAdmin: import("convex/server").RegisteredQuery<"public", {}, Promise<boolean>>;
@@ -1,3 +0,0 @@
1
- import type { AppDefinition } from "convex/server";
2
- declare const app: AppDefinition;
3
- export default app;
package/dist/github.d.ts DELETED
@@ -1,36 +0,0 @@
1
- export declare const fetchRepoMetadata: import("convex/server").RegisteredAction<"public", {
2
- owner: string;
3
- name: string;
4
- }, Promise<{
5
- owner: string;
6
- name: string;
7
- fullName: string;
8
- description: string | undefined;
9
- stars: number;
10
- language: string | undefined;
11
- githubUrl: string;
12
- defaultBranch: string;
13
- } | null>>;
14
- export declare const fetchOwnerInfo: import("convex/server").RegisteredAction<"public", {
15
- owner: string;
16
- }, Promise<{
17
- login: string;
18
- name: string;
19
- avatarUrl: string;
20
- bio: string | undefined;
21
- type: "user" | "organization";
22
- publicRepos: number;
23
- followers: number;
24
- htmlUrl: string;
25
- } | null>>;
26
- export declare const fetchOwnerRepos: import("convex/server").RegisteredAction<"public", {
27
- perPage?: number | undefined;
28
- owner: string;
29
- }, Promise<{
30
- owner: string;
31
- name: string;
32
- fullName: string;
33
- description: string | undefined;
34
- stars: number;
35
- language: string | undefined;
36
- }[] | null>>;
@@ -1,2 +0,0 @@
1
- import type { QueryBuilder } from "convex/server";
2
- export declare const get: ReturnType<QueryBuilder<any, "public">>;
package/dist/http.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const http: import("convex/server").HttpRouter;
2
- export default http;
@@ -1,154 +0,0 @@
1
- /**
2
- * Reference Convex Functions
3
- * Public queries/mutations for CLI and web app
4
- */
5
- /**
6
- * Get reference by repository fullName (public)
7
- * Display reference on web
8
- */
9
- export declare const get: import("convex/server").RegisteredQuery<"public", {
10
- fullName: string;
11
- }, Promise<{
12
- _id: import("convex/values").GenericId<"reference">;
13
- _creationTime: number;
14
- workosId?: string | undefined;
15
- repositoryId: import("convex/values").GenericId<"repository">;
16
- referenceName: string;
17
- referenceDescription: string;
18
- referenceContent: string;
19
- commitSha: string;
20
- generatedAt: string;
21
- pullCount: number;
22
- isVerified: boolean;
23
- } | null>>;
24
- /**
25
- * Get reference by repository fullName + referenceName (public)
26
- * Display specific reference on web
27
- */
28
- export declare const getByName: import("convex/server").RegisteredQuery<"public", {
29
- fullName: string;
30
- referenceName: string;
31
- }, Promise<{
32
- _id: import("convex/values").GenericId<"reference">;
33
- _creationTime: number;
34
- workosId?: string | undefined;
35
- repositoryId: import("convex/values").GenericId<"repository">;
36
- referenceName: string;
37
- referenceDescription: string;
38
- referenceContent: string;
39
- commitSha: string;
40
- generatedAt: string;
41
- pullCount: number;
42
- isVerified: boolean;
43
- } | null>>;
44
- /**
45
- * List all references for a repository (public)
46
- */
47
- export declare const listByRepo: import("convex/server").RegisteredQuery<"public", {
48
- fullName: string;
49
- }, Promise<{
50
- referenceName: string;
51
- referenceDescription: string;
52
- generatedAt: string;
53
- commitSha: string;
54
- pullCount: number;
55
- isVerified: boolean;
56
- }[]>>;
57
- /**
58
- * List all references sorted by pull count (public)
59
- * Repo directory/explore page
60
- */
61
- export declare const list: import("convex/server").RegisteredQuery<"public", {
62
- limit?: number | undefined;
63
- cursor?: string | undefined;
64
- }, Promise<{
65
- fullName: string;
66
- pullCount: number;
67
- generatedAt: string;
68
- commitSha: string;
69
- isVerified: boolean;
70
- }[]>>;
71
- /**
72
- * List references pushed by the current user
73
- */
74
- export declare const listByCurrentUser: import("convex/server").RegisteredQuery<"public", {}, Promise<{
75
- fullName: string;
76
- owner: string;
77
- name: string;
78
- referenceName: string;
79
- referenceDescription: string;
80
- pullCount: number;
81
- generatedAt: string;
82
- commitSha: string;
83
- isVerified: boolean;
84
- }[]>>;
85
- /**
86
- * Fetch reference for CLI pull (no pull count tracking)
87
- */
88
- export declare const pull: import("convex/server").RegisteredQuery<"public", {
89
- referenceName?: string | undefined;
90
- fullName: string;
91
- }, Promise<{
92
- fullName: string;
93
- referenceName: string;
94
- referenceDescription: string;
95
- referenceContent: string;
96
- commitSha: string;
97
- generatedAt: string;
98
- } | null>>;
99
- /**
100
- * Lightweight existence check for CLI
101
- */
102
- export declare const check: import("convex/server").RegisteredQuery<"public", {
103
- referenceName?: string | undefined;
104
- fullName: string;
105
- }, Promise<{
106
- exists: false;
107
- commitSha?: undefined;
108
- generatedAt?: undefined;
109
- } | {
110
- exists: true;
111
- commitSha: string;
112
- generatedAt: string;
113
- }>>;
114
- export type PushError = "auth_required" | "invalid_input" | "invalid_reference" | "repo_not_found" | "low_stars" | "private_repo" | "commit_not_found" | "commit_already_exists" | "rate_limit" | "github_error";
115
- export type PushResult = {
116
- success: true;
117
- } | {
118
- success: false;
119
- error: PushError;
120
- message?: string;
121
- };
122
- /**
123
- * Push reference - public action with full validation
124
- */
125
- export declare const push: import("convex/server").RegisteredAction<"public", {
126
- fullName: string;
127
- referenceName: string;
128
- referenceDescription: string;
129
- referenceContent: string;
130
- commitSha: string;
131
- generatedAt: string;
132
- }, Promise<PushResult>>;
133
- /**
134
- * Internal mutation - DB operations only, not directly callable
135
- */
136
- export declare const pushInternal: import("convex/server").RegisteredMutation<"internal", {
137
- canonicalFullName?: string | undefined;
138
- repoStars?: number | undefined;
139
- repoDescription?: string | undefined;
140
- fullName: string;
141
- referenceName: string;
142
- referenceDescription: string;
143
- referenceContent: string;
144
- commitSha: string;
145
- generatedAt: string;
146
- workosId: string;
147
- }, Promise<PushResult>>;
148
- /**
149
- * Record a pull event - increments pullCount for display on repo pages
150
- */
151
- export declare const recordPull: import("convex/server").RegisteredMutation<"public", {
152
- referenceName?: string | undefined;
153
- fullName: string;
154
- }, Promise<void>>;
@@ -1,93 +0,0 @@
1
- /**
2
- * Repository Convex Functions
3
- * Queries for GitHub repository metadata
4
- */
5
- /**
6
- * Get repository by fullName
7
- */
8
- export declare const get: import("convex/server").RegisteredQuery<"public", {
9
- fullName: string;
10
- }, Promise<{
11
- _id: import("convex/values").GenericId<"repository">;
12
- _creationTime: number;
13
- description?: string | undefined;
14
- language?: string | undefined;
15
- fullName: string;
16
- fullNameLower: string;
17
- owner: string;
18
- name: string;
19
- stars: number;
20
- defaultBranch: string;
21
- githubUrl: string;
22
- fetchedAt: string;
23
- } | null>>;
24
- /**
25
- * List repositories by owner
26
- */
27
- export declare const listByOwner: import("convex/server").RegisteredQuery<"public", {
28
- owner: string;
29
- }, Promise<{
30
- _id: import("convex/values").GenericId<"repository">;
31
- _creationTime: number;
32
- description?: string | undefined;
33
- language?: string | undefined;
34
- fullName: string;
35
- fullNameLower: string;
36
- owner: string;
37
- name: string;
38
- stars: number;
39
- defaultBranch: string;
40
- githubUrl: string;
41
- fetchedAt: string;
42
- }[]>>;
43
- /**
44
- * List repositories sorted by stars (for explore page)
45
- */
46
- export declare const list: import("convex/server").RegisteredQuery<"public", {
47
- limit?: number | undefined;
48
- }, Promise<{
49
- _id: import("convex/values").GenericId<"repository">;
50
- _creationTime: number;
51
- description?: string | undefined;
52
- language?: string | undefined;
53
- fullName: string;
54
- fullNameLower: string;
55
- owner: string;
56
- name: string;
57
- stars: number;
58
- defaultBranch: string;
59
- githubUrl: string;
60
- fetchedAt: string;
61
- }[]>>;
62
- /**
63
- * List recently indexed repositories (for homepage carousel)
64
- */
65
- export declare const listRecent: import("convex/server").RegisteredQuery<"public", {
66
- limit?: number | undefined;
67
- }, Promise<{
68
- _id: import("convex/values").GenericId<"repository">;
69
- _creationTime: number;
70
- description?: string | undefined;
71
- language?: string | undefined;
72
- fullName: string;
73
- fullNameLower: string;
74
- owner: string;
75
- name: string;
76
- stars: number;
77
- defaultBranch: string;
78
- githubUrl: string;
79
- fetchedAt: string;
80
- }[]>>;
81
- /**
82
- * Upsert repository (internal - called after fetching from GitHub)
83
- */
84
- export declare const upsert: import("convex/server").RegisteredMutation<"internal", {
85
- description?: string | undefined;
86
- language?: string | undefined;
87
- fullName: string;
88
- owner: string;
89
- name: string;
90
- stars: number;
91
- defaultBranch: string;
92
- githubUrl: string;
93
- }, Promise<import("convex/values").GenericId<"repository">>>;
package/dist/schema.d.ts DELETED
@@ -1,94 +0,0 @@
1
- /**
2
- * Offworld Backend Schema
3
- * Convex schema for reference storage
4
- */
5
- declare const _default: import("convex/server").SchemaDefinition<{
6
- repository: import("convex/server").TableDefinition<import("convex/values").VObject<{
7
- description?: string | undefined;
8
- language?: string | undefined;
9
- fullName: string;
10
- fullNameLower: string;
11
- owner: string;
12
- name: string;
13
- stars: number;
14
- defaultBranch: string;
15
- githubUrl: string;
16
- fetchedAt: string;
17
- }, {
18
- fullName: import("convex/values").VString<string, "required">;
19
- fullNameLower: import("convex/values").VString<string, "required">;
20
- owner: import("convex/values").VString<string, "required">;
21
- name: import("convex/values").VString<string, "required">;
22
- description: import("convex/values").VString<string | undefined, "optional">;
23
- stars: import("convex/values").VFloat64<number, "required">;
24
- language: import("convex/values").VString<string | undefined, "optional">;
25
- defaultBranch: import("convex/values").VString<string, "required">;
26
- githubUrl: import("convex/values").VString<string, "required">;
27
- fetchedAt: import("convex/values").VString<string, "required">;
28
- }, "required", "fullName" | "fullNameLower" | "owner" | "name" | "description" | "stars" | "language" | "defaultBranch" | "githubUrl" | "fetchedAt">, {
29
- by_fullName: ["fullName", "_creationTime"];
30
- by_fullNameLower: ["fullNameLower", "_creationTime"];
31
- by_owner: ["owner", "_creationTime"];
32
- by_stars: ["stars", "_creationTime"];
33
- by_fetchedAt: ["fetchedAt", "_creationTime"];
34
- }, {}, {}>;
35
- reference: import("convex/server").TableDefinition<import("convex/values").VObject<{
36
- workosId?: string | undefined;
37
- repositoryId: import("convex/values").GenericId<"repository">;
38
- referenceName: string;
39
- referenceDescription: string;
40
- referenceContent: string;
41
- commitSha: string;
42
- generatedAt: string;
43
- pullCount: number;
44
- isVerified: boolean;
45
- }, {
46
- repositoryId: import("convex/values").VId<import("convex/values").GenericId<"repository">, "required">;
47
- referenceName: import("convex/values").VString<string, "required">;
48
- referenceDescription: import("convex/values").VString<string, "required">;
49
- referenceContent: import("convex/values").VString<string, "required">;
50
- commitSha: import("convex/values").VString<string, "required">;
51
- generatedAt: import("convex/values").VString<string, "required">;
52
- pullCount: import("convex/values").VFloat64<number, "required">;
53
- isVerified: import("convex/values").VBoolean<boolean, "required">;
54
- workosId: import("convex/values").VString<string | undefined, "optional">;
55
- }, "required", "repositoryId" | "referenceName" | "referenceDescription" | "referenceContent" | "commitSha" | "generatedAt" | "pullCount" | "isVerified" | "workosId">, {
56
- by_repositoryId: ["repositoryId", "_creationTime"];
57
- by_repositoryId_referenceName: ["repositoryId", "referenceName", "_creationTime"];
58
- by_repositoryId_commitSha: ["repositoryId", "commitSha", "_creationTime"];
59
- by_pullCount: ["pullCount", "_creationTime"];
60
- by_generatedAt: ["generatedAt", "_creationTime"];
61
- by_workosId: ["workosId", "_creationTime"];
62
- }, {}, {}>;
63
- pushLog: import("convex/server").TableDefinition<import("convex/values").VObject<{
64
- fullName: string;
65
- commitSha: string;
66
- workosId: string;
67
- pushedAt: string;
68
- }, {
69
- fullName: import("convex/values").VString<string, "required">;
70
- workosId: import("convex/values").VString<string, "required">;
71
- pushedAt: import("convex/values").VString<string, "required">;
72
- commitSha: import("convex/values").VString<string, "required">;
73
- }, "required", "fullName" | "commitSha" | "workosId" | "pushedAt">, {
74
- by_repo_date: ["fullName", "pushedAt", "_creationTime"];
75
- by_workos_date: ["workosId", "pushedAt", "_creationTime"];
76
- }, {}, {}>;
77
- user: import("convex/server").TableDefinition<import("convex/values").VObject<{
78
- name?: string | undefined;
79
- image?: string | undefined;
80
- workosId: string;
81
- email: string;
82
- createdAt: string;
83
- }, {
84
- workosId: import("convex/values").VString<string, "required">;
85
- email: import("convex/values").VString<string, "required">;
86
- name: import("convex/values").VString<string | undefined, "optional">;
87
- image: import("convex/values").VString<string | undefined, "optional">;
88
- createdAt: import("convex/values").VString<string, "required">;
89
- }, "required", "name" | "workosId" | "email" | "image" | "createdAt">, {
90
- by_email: ["email", "_creationTime"];
91
- by_workosId: ["workosId", "_creationTime"];
92
- }, {}, {}>;
93
- }, true>;
94
- export default _default;
@@ -1,19 +0,0 @@
1
- export interface RepoValidationResult {
2
- valid: boolean;
3
- error?: string;
4
- stars?: number;
5
- description?: string;
6
- canonicalFullName?: string;
7
- }
8
- export interface CommitValidationResult {
9
- valid: boolean;
10
- error?: string;
11
- }
12
- /**
13
- * Verify repo exists and has minimum stars
14
- */
15
- export declare function validateRepo(fullName: string): Promise<RepoValidationResult>;
16
- /**
17
- * Verify commit exists in repo
18
- */
19
- export declare function validateCommit(fullName: string, commitSha: string): Promise<CommitValidationResult>;
@@ -1,36 +0,0 @@
1
- export declare const FULLNAME_MIN = 3;
2
- export declare const FULLNAME_MAX = 200;
3
- export declare const SKILLNAME_MIN = 2;
4
- export declare const SKILLNAME_MAX = 80;
5
- export declare const DESCRIPTION_MAX = 200;
6
- export declare const CONTENT_MIN = 500;
7
- export declare const CONTENT_MAX = 200000;
8
- export declare const COMMIT_SHA_LENGTH = 40;
9
- export declare const FULLNAME_PATTERN: RegExp;
10
- export declare const SKILLNAME_PATTERN: RegExp;
11
- export declare const COMMIT_SHA_PATTERN: RegExp;
12
- export declare const pushArgs: {
13
- fullName: import("convex/values").VString<string, "required">;
14
- referenceName: import("convex/values").VString<string, "required">;
15
- referenceDescription: import("convex/values").VString<string, "required">;
16
- referenceContent: import("convex/values").VString<string, "required">;
17
- commitSha: import("convex/values").VString<string, "required">;
18
- generatedAt: import("convex/values").VString<string, "required">;
19
- };
20
- export interface ValidationResult {
21
- valid: boolean;
22
- error?: string;
23
- field?: string;
24
- }
25
- /**
26
- * Validates push arguments at runtime
27
- * Returns first validation error or { valid: true }
28
- */
29
- export declare function validatePushArgs(args: {
30
- fullName: string;
31
- referenceName: string;
32
- referenceDescription: string;
33
- referenceContent: string;
34
- commitSha: string;
35
- generatedAt: string;
36
- }): ValidationResult;
@@ -1,7 +0,0 @@
1
- export interface ContentValidationResult {
2
- valid: boolean;
3
- error?: string;
4
- name?: string;
5
- description?: string;
6
- }
7
- export declare function validateReferenceContent(content: string): ContentValidationResult;