@shahadpichen/docpush 1.0.0
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.
- package/README.md +129 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +116 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/start.d.ts +4 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +58 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +22 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config/index.d.ts +3 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/index.js +9 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/config/loader.d.ts +6 -0
- package/dist/core/config/loader.d.ts.map +1 -0
- package/dist/core/config/loader.js +50 -0
- package/dist/core/config/loader.js.map +1 -0
- package/dist/core/config/schema.d.ts +134 -0
- package/dist/core/config/schema.d.ts.map +1 -0
- package/dist/core/config/schema.js +106 -0
- package/dist/core/config/schema.js.map +1 -0
- package/dist/core/errors.d.ts +45 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +76 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/github/client.d.ts +47 -0
- package/dist/core/github/client.d.ts.map +1 -0
- package/dist/core/github/client.js +159 -0
- package/dist/core/github/client.js.map +1 -0
- package/dist/core/github/index.d.ts +4 -0
- package/dist/core/github/index.d.ts.map +1 -0
- package/dist/core/github/index.js +9 -0
- package/dist/core/github/index.js.map +1 -0
- package/dist/core/github/retry.d.ts +15 -0
- package/dist/core/github/retry.d.ts.map +1 -0
- package/dist/core/github/retry.js +61 -0
- package/dist/core/github/retry.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/react/components/comments-panel.d.ts +14 -0
- package/dist/react/components/comments-panel.d.ts.map +1 -0
- package/dist/react/components/comments-panel.js +62 -0
- package/dist/react/components/comments-panel.js.map +1 -0
- package/dist/react/components/docs-sidebar.d.ts +13 -0
- package/dist/react/components/docs-sidebar.d.ts.map +1 -0
- package/dist/react/components/docs-sidebar.js +70 -0
- package/dist/react/components/docs-sidebar.js.map +1 -0
- package/dist/react/components/drafts-list.d.ts +18 -0
- package/dist/react/components/drafts-list.d.ts.map +1 -0
- package/dist/react/components/drafts-list.js +38 -0
- package/dist/react/components/drafts-list.js.map +1 -0
- package/dist/react/components/markdown-editor.d.ts +8 -0
- package/dist/react/components/markdown-editor.d.ts.map +1 -0
- package/dist/react/components/markdown-editor.js +59 -0
- package/dist/react/components/markdown-editor.js.map +1 -0
- package/dist/react/components/markdown-viewer.d.ts +7 -0
- package/dist/react/components/markdown-viewer.d.ts.map +1 -0
- package/dist/react/components/markdown-viewer.js +58 -0
- package/dist/react/components/markdown-viewer.js.map +1 -0
- package/dist/react/components/search-bar.d.ts +14 -0
- package/dist/react/components/search-bar.d.ts.map +1 -0
- package/dist/react/components/search-bar.js +80 -0
- package/dist/react/components/search-bar.js.map +1 -0
- package/dist/react/components/ui/badge.d.ts +10 -0
- package/dist/react/components/ui/badge.d.ts.map +1 -0
- package/dist/react/components/ui/badge.js +27 -0
- package/dist/react/components/ui/badge.js.map +1 -0
- package/dist/react/components/ui/button.d.ts +12 -0
- package/dist/react/components/ui/button.d.ts.map +1 -0
- package/dist/react/components/ui/button.js +71 -0
- package/dist/react/components/ui/button.js.map +1 -0
- package/dist/react/components/ui/card.d.ts +7 -0
- package/dist/react/components/ui/card.d.ts.map +1 -0
- package/dist/react/components/ui/card.js +52 -0
- package/dist/react/components/ui/card.js.map +1 -0
- package/dist/react/components/ui/input.d.ts +6 -0
- package/dist/react/components/ui/input.d.ts.map +1 -0
- package/dist/react/components/ui/input.js +45 -0
- package/dist/react/components/ui/input.js.map +1 -0
- package/dist/react/components/ui/scroll-area.d.ts +6 -0
- package/dist/react/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/react/components/ui/scroll-area.js +48 -0
- package/dist/react/components/ui/scroll-area.js.map +1 -0
- package/dist/react/components/ui/textarea.d.ts +6 -0
- package/dist/react/components/ui/textarea.d.ts.map +1 -0
- package/dist/react/components/ui/textarea.js +45 -0
- package/dist/react/components/ui/textarea.js.map +1 -0
- package/dist/react/context/docpush-provider.d.ts +17 -0
- package/dist/react/context/docpush-provider.d.ts.map +1 -0
- package/dist/react/context/docpush-provider.js +72 -0
- package/dist/react/context/docpush-provider.js.map +1 -0
- package/dist/react/hooks/use-auth.d.ts +16 -0
- package/dist/react/hooks/use-auth.d.ts.map +1 -0
- package/dist/react/hooks/use-auth.js +72 -0
- package/dist/react/hooks/use-auth.js.map +1 -0
- package/dist/react/hooks/use-comments.d.ts +15 -0
- package/dist/react/hooks/use-comments.d.ts.map +1 -0
- package/dist/react/hooks/use-comments.js +67 -0
- package/dist/react/hooks/use-comments.js.map +1 -0
- package/dist/react/hooks/use-docs.d.ts +13 -0
- package/dist/react/hooks/use-docs.d.ts.map +1 -0
- package/dist/react/hooks/use-docs.js +69 -0
- package/dist/react/hooks/use-docs.js.map +1 -0
- package/dist/react/hooks/use-drafts.d.ts +25 -0
- package/dist/react/hooks/use-drafts.d.ts.map +1 -0
- package/dist/react/hooks/use-drafts.js +99 -0
- package/dist/react/hooks/use-drafts.js.map +1 -0
- package/dist/react/index.d.ts +19 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +52 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/lib/utils.d.ts +3 -0
- package/dist/react/lib/utils.d.ts.map +1 -0
- package/dist/react/lib/utils.js +9 -0
- package/dist/react/lib/utils.js.map +1 -0
- package/dist/server/auth/index.d.ts +18 -0
- package/dist/server/auth/index.d.ts.map +1 -0
- package/dist/server/auth/index.js +50 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/magic-link.d.ts +10 -0
- package/dist/server/auth/magic-link.d.ts.map +1 -0
- package/dist/server/auth/magic-link.js +94 -0
- package/dist/server/auth/magic-link.js.map +1 -0
- package/dist/server/auth/oauth.d.ts +6 -0
- package/dist/server/auth/oauth.d.ts.map +1 -0
- package/dist/server/auth/oauth.js +90 -0
- package/dist/server/auth/oauth.js.map +1 -0
- package/dist/server/auth/public.d.ts +7 -0
- package/dist/server/auth/public.d.ts.map +1 -0
- package/dist/server/auth/public.js +43 -0
- package/dist/server/auth/public.js.map +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +107 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/auth.d.ts +20 -0
- package/dist/server/middleware/auth.d.ts.map +1 -0
- package/dist/server/middleware/auth.js +49 -0
- package/dist/server/middleware/auth.js.map +1 -0
- package/dist/server/routes/auth.d.ts +3 -0
- package/dist/server/routes/auth.d.ts.map +1 -0
- package/dist/server/routes/auth.js +105 -0
- package/dist/server/routes/auth.js.map +1 -0
- package/dist/server/routes/docs.d.ts +3 -0
- package/dist/server/routes/docs.d.ts.map +1 -0
- package/dist/server/routes/docs.js +58 -0
- package/dist/server/routes/docs.js.map +1 -0
- package/dist/server/routes/drafts.d.ts +3 -0
- package/dist/server/routes/drafts.d.ts.map +1 -0
- package/dist/server/routes/drafts.js +264 -0
- package/dist/server/routes/drafts.js.map +1 -0
- package/dist/server/routes/index.d.ts +4 -0
- package/dist/server/routes/index.d.ts.map +1 -0
- package/dist/server/routes/index.js +13 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/storage/index.d.ts +40 -0
- package/dist/server/storage/index.d.ts.map +1 -0
- package/dist/server/storage/index.js +199 -0
- package/dist/server/storage/index.js.map +1 -0
- package/package.json +109 -0
- package/templates/.env.example +20 -0
- package/templates/docs.config.js +21 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configSchema = void 0;
|
|
4
|
+
exports.validateEnv = validateEnv;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
// Auth mode schemas
|
|
7
|
+
const publicAuthSchema = zod_1.z.object({
|
|
8
|
+
mode: zod_1.z.literal('public'),
|
|
9
|
+
adminPassword: zod_1.z.string().min(1, 'Admin password required for public mode'),
|
|
10
|
+
});
|
|
11
|
+
const domainRestrictedAuthSchema = zod_1.z.object({
|
|
12
|
+
mode: zod_1.z.literal('domain-restricted'),
|
|
13
|
+
allowedDomains: zod_1.z.array(zod_1.z.string()).min(1, 'At least one domain required'),
|
|
14
|
+
emailFrom: zod_1.z.string().email('Valid email required for sending magic links'),
|
|
15
|
+
});
|
|
16
|
+
const oauthAuthSchema = zod_1.z.object({
|
|
17
|
+
mode: zod_1.z.literal('oauth'),
|
|
18
|
+
providers: zod_1.z.array(zod_1.z.enum(['github', 'google'])).min(1, 'At least one OAuth provider required'),
|
|
19
|
+
allowedDomains: zod_1.z.array(zod_1.z.string()).optional(),
|
|
20
|
+
});
|
|
21
|
+
exports.configSchema = zod_1.z.object({
|
|
22
|
+
// GitHub repository configuration
|
|
23
|
+
github: zod_1.z.object({
|
|
24
|
+
owner: zod_1.z.string().min(1, 'GitHub owner required'),
|
|
25
|
+
repo: zod_1.z.string().min(1, 'GitHub repo required'),
|
|
26
|
+
branch: zod_1.z.string().default('main'),
|
|
27
|
+
docsPath: zod_1.z.string().default('docs'),
|
|
28
|
+
}),
|
|
29
|
+
// Authentication mode (discriminated union)
|
|
30
|
+
auth: zod_1.z.discriminatedUnion('mode', [
|
|
31
|
+
publicAuthSchema,
|
|
32
|
+
domainRestrictedAuthSchema,
|
|
33
|
+
oauthAuthSchema,
|
|
34
|
+
]),
|
|
35
|
+
// Admin users
|
|
36
|
+
admins: zod_1.z.object({
|
|
37
|
+
emails: zod_1.z.array(zod_1.z.string().email()).min(1, 'At least one admin email required'),
|
|
38
|
+
}),
|
|
39
|
+
// Optional branding
|
|
40
|
+
branding: zod_1.z
|
|
41
|
+
.object({
|
|
42
|
+
name: zod_1.z.string().default('Documentation'),
|
|
43
|
+
logo: zod_1.z.string().optional(),
|
|
44
|
+
})
|
|
45
|
+
.optional(),
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Validate environment variables with detailed feedback
|
|
49
|
+
*/
|
|
50
|
+
function validateEnv(config) {
|
|
51
|
+
const result = {
|
|
52
|
+
valid: true,
|
|
53
|
+
missing: [],
|
|
54
|
+
warnings: [],
|
|
55
|
+
};
|
|
56
|
+
// Always required
|
|
57
|
+
const required = ['GITHUB_TOKEN', 'APP_URL', 'SESSION_SECRET'];
|
|
58
|
+
for (const key of required) {
|
|
59
|
+
if (!process.env[key]) {
|
|
60
|
+
result.missing.push(key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Conditionally required based on auth mode
|
|
64
|
+
if (config) {
|
|
65
|
+
switch (config.auth.mode) {
|
|
66
|
+
case 'domain-restricted':
|
|
67
|
+
if (!process.env.RESEND_API_KEY) {
|
|
68
|
+
result.missing.push('RESEND_API_KEY');
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
case 'oauth':
|
|
72
|
+
if (config.auth.providers.includes('github')) {
|
|
73
|
+
if (!process.env.GITHUB_CLIENT_ID)
|
|
74
|
+
result.missing.push('GITHUB_CLIENT_ID');
|
|
75
|
+
if (!process.env.GITHUB_CLIENT_SECRET)
|
|
76
|
+
result.missing.push('GITHUB_CLIENT_SECRET');
|
|
77
|
+
}
|
|
78
|
+
if (config.auth.providers.includes('google')) {
|
|
79
|
+
if (!process.env.GOOGLE_CLIENT_ID)
|
|
80
|
+
result.missing.push('GOOGLE_CLIENT_ID');
|
|
81
|
+
if (!process.env.GOOGLE_CLIENT_SECRET)
|
|
82
|
+
result.missing.push('GOOGLE_CLIENT_SECRET');
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Warnings for dev environment
|
|
88
|
+
if (process.env.SESSION_SECRET === 'fallback-secret-change-me') {
|
|
89
|
+
result.warnings.push('SESSION_SECRET is using fallback value - change in production!');
|
|
90
|
+
}
|
|
91
|
+
if (process.env.NODE_ENV === 'production' && !process.env.APP_URL?.startsWith('https://')) {
|
|
92
|
+
result.warnings.push('APP_URL should use HTTPS in production');
|
|
93
|
+
}
|
|
94
|
+
result.valid = result.missing.length === 0;
|
|
95
|
+
// Throw if critical vars missing
|
|
96
|
+
if (!result.valid) {
|
|
97
|
+
throw new Error(`Missing required environment variables:\n${result.missing.map((k) => ` - ${k}`).join('\n')}`);
|
|
98
|
+
}
|
|
99
|
+
// Log warnings
|
|
100
|
+
if (result.warnings.length > 0) {
|
|
101
|
+
console.warn('Environment warnings:');
|
|
102
|
+
result.warnings.forEach((w) => console.warn(` ⚠ ${w}`));
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/core/config/schema.ts"],"names":[],"mappings":";;;AA6DA,kCA+DC;AA5HD,6BAAwB;AAExB,oBAAoB;AACpB,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzB,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,yCAAyC,CAAC;CAC5E,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC;IACpC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,8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,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACtC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for DocPush
|
|
3
|
+
*/
|
|
4
|
+
export declare class DocPushError extends Error {
|
|
5
|
+
code: string;
|
|
6
|
+
constructor(message: string, code: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Configuration error
|
|
10
|
+
*/
|
|
11
|
+
export declare class ConfigError extends DocPushError {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Authentication error
|
|
16
|
+
*/
|
|
17
|
+
export declare class AuthError extends DocPushError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Draft not found error
|
|
22
|
+
*/
|
|
23
|
+
export declare class DraftNotFoundError extends DocPushError {
|
|
24
|
+
constructor(draftId: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Document not found error
|
|
28
|
+
*/
|
|
29
|
+
export declare class DocNotFoundError extends DocPushError {
|
|
30
|
+
constructor(path: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validation error
|
|
34
|
+
*/
|
|
35
|
+
export declare class ValidationError extends DocPushError {
|
|
36
|
+
field?: string | undefined;
|
|
37
|
+
constructor(message: string, field?: string | undefined);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Environment variable missing error
|
|
41
|
+
*/
|
|
42
|
+
export declare class EnvError extends DocPushError {
|
|
43
|
+
constructor(variable: string);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAG5B,IAAI,EAAE,MAAM;gBADnB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM;CAKtB;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,IAAI,EAAE,MAAM;CAIzB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAGtC,KAAK,CAAC,EAAE,MAAM;gBADrB,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,EAAE,MAAM,YAAA;CAKxB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAY;gBAC5B,QAAQ,EAAE,MAAM;CAI7B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvError = exports.ValidationError = exports.DocNotFoundError = exports.DraftNotFoundError = exports.AuthError = exports.ConfigError = exports.DocPushError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base error class for DocPush
|
|
6
|
+
*/
|
|
7
|
+
class DocPushError extends Error {
|
|
8
|
+
constructor(message, code) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.name = 'DocPushError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.DocPushError = DocPushError;
|
|
15
|
+
/**
|
|
16
|
+
* Configuration error
|
|
17
|
+
*/
|
|
18
|
+
class ConfigError extends DocPushError {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message, 'CONFIG_ERROR');
|
|
21
|
+
this.name = 'ConfigError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ConfigError = ConfigError;
|
|
25
|
+
/**
|
|
26
|
+
* Authentication error
|
|
27
|
+
*/
|
|
28
|
+
class AuthError extends DocPushError {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message, 'AUTH_ERROR');
|
|
31
|
+
this.name = 'AuthError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AuthError = AuthError;
|
|
35
|
+
/**
|
|
36
|
+
* Draft not found error
|
|
37
|
+
*/
|
|
38
|
+
class DraftNotFoundError extends DocPushError {
|
|
39
|
+
constructor(draftId) {
|
|
40
|
+
super(`Draft not found: ${draftId}`, 'DRAFT_NOT_FOUND');
|
|
41
|
+
this.name = 'DraftNotFoundError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.DraftNotFoundError = DraftNotFoundError;
|
|
45
|
+
/**
|
|
46
|
+
* Document not found error
|
|
47
|
+
*/
|
|
48
|
+
class DocNotFoundError extends DocPushError {
|
|
49
|
+
constructor(path) {
|
|
50
|
+
super(`Document not found: ${path}`, 'DOC_NOT_FOUND');
|
|
51
|
+
this.name = 'DocNotFoundError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.DocNotFoundError = DocNotFoundError;
|
|
55
|
+
/**
|
|
56
|
+
* Validation error
|
|
57
|
+
*/
|
|
58
|
+
class ValidationError extends DocPushError {
|
|
59
|
+
constructor(message, field) {
|
|
60
|
+
super(message, 'VALIDATION_ERROR');
|
|
61
|
+
this.field = field;
|
|
62
|
+
this.name = 'ValidationError';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ValidationError = ValidationError;
|
|
66
|
+
/**
|
|
67
|
+
* Environment variable missing error
|
|
68
|
+
*/
|
|
69
|
+
class EnvError extends DocPushError {
|
|
70
|
+
constructor(variable) {
|
|
71
|
+
super(`Missing required environment variable: ${variable}`, 'ENV_ERROR');
|
|
72
|
+
this.name = 'EnvError';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.EnvError = EnvError;
|
|
76
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACR,IAAY;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,SAAI,GAAJ,IAAI,CAAQ;QAGnB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AARD,oCAQC;AAED;;GAEG;AACH,MAAa,WAAY,SAAQ,YAAY;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,YAAY;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AALD,8BAKC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,YAAY;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,oBAAoB,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,YAAY;IAChD,YAAY,IAAY;QACtB,KAAK,CAAC,uBAAuB,IAAI,EAAE,EAAE,eAAe,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,YAAY;IAC/C,YACE,OAAe,EACR,KAAc;QAErB,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAF5B,UAAK,GAAL,KAAK,CAAS;QAGrB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AARD,0CAQC;AAED;;GAEG;AACH,MAAa,QAAS,SAAQ,YAAY;IACxC,YAAY,QAAgB;QAC1B,KAAK,CAAC,0CAA0C,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AALD,4BAKC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DocsConfig } from '../config';
|
|
2
|
+
export declare class GitHubClient {
|
|
3
|
+
private octokit;
|
|
4
|
+
private config;
|
|
5
|
+
constructor(token: string, config: DocsConfig['github']);
|
|
6
|
+
/**
|
|
7
|
+
* Get documentation file tree
|
|
8
|
+
*/
|
|
9
|
+
getDocsTree(): Promise<Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
type: 'file' | 'dir';
|
|
12
|
+
}>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get file content from repository
|
|
15
|
+
*/
|
|
16
|
+
getFileContent(filePath: string, ref?: string): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new branch for draft
|
|
19
|
+
*/
|
|
20
|
+
createDraftBranch(branchName: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Commit file to branch
|
|
23
|
+
*/
|
|
24
|
+
commitFile(branchName: string, filePath: string, content: string, message: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Create pull request
|
|
27
|
+
*/
|
|
28
|
+
createPullRequest(branchName: string, title: string, body: string): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Merge pull request
|
|
31
|
+
*/
|
|
32
|
+
mergePullRequest(prNumber: number): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Delete branch
|
|
35
|
+
*/
|
|
36
|
+
deleteBranch(branchName: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get commit history for file
|
|
39
|
+
*/
|
|
40
|
+
getFileHistory(filePath: string): Promise<Array<{
|
|
41
|
+
sha: string;
|
|
42
|
+
message: string;
|
|
43
|
+
date: string;
|
|
44
|
+
author: string;
|
|
45
|
+
}>>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/github/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAuB;gBAEzB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC;IAKvD;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,CAAC,CAAC;IAqB3E;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBrE;;OAEG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB5D;;OAEG;IACG,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;IA+BhB;;OAEG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAazF;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASvD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrD;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAC7C,KAAK,CAAC;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CACH;CAiBF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubClient = void 0;
|
|
4
|
+
const rest_1 = require("@octokit/rest");
|
|
5
|
+
const retry_1 = require("./retry");
|
|
6
|
+
class GitHubClient {
|
|
7
|
+
constructor(token, config) {
|
|
8
|
+
this.octokit = new rest_1.Octokit({ auth: token });
|
|
9
|
+
this.config = config;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get documentation file tree
|
|
13
|
+
*/
|
|
14
|
+
async getDocsTree() {
|
|
15
|
+
return (0, retry_1.retryWithBackoff)(async () => {
|
|
16
|
+
const { data } = await this.octokit.git.getTree({
|
|
17
|
+
owner: this.config.owner,
|
|
18
|
+
repo: this.config.repo,
|
|
19
|
+
tree_sha: this.config.branch,
|
|
20
|
+
recursive: '1',
|
|
21
|
+
});
|
|
22
|
+
return data.tree
|
|
23
|
+
.filter((item) => typeof item.path === 'string' && item.path.startsWith(this.config.docsPath))
|
|
24
|
+
.map((item) => ({
|
|
25
|
+
path: item.path.replace(`${this.config.docsPath}/`, ''),
|
|
26
|
+
type: item.type === 'tree' ? 'dir' : 'file',
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get file content from repository
|
|
32
|
+
*/
|
|
33
|
+
async getFileContent(filePath, ref) {
|
|
34
|
+
return (0, retry_1.retryWithBackoff)(async () => {
|
|
35
|
+
const fullPath = `${this.config.docsPath}/${filePath}`;
|
|
36
|
+
const { data } = await this.octokit.repos.getContent({
|
|
37
|
+
owner: this.config.owner,
|
|
38
|
+
repo: this.config.repo,
|
|
39
|
+
path: fullPath,
|
|
40
|
+
ref: ref || this.config.branch,
|
|
41
|
+
});
|
|
42
|
+
if ('content' in data) {
|
|
43
|
+
return Buffer.from(data.content, 'base64').toString('utf-8');
|
|
44
|
+
}
|
|
45
|
+
throw new Error('Path is not a file');
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a new branch for draft
|
|
50
|
+
*/
|
|
51
|
+
async createDraftBranch(branchName) {
|
|
52
|
+
return (0, retry_1.retryWithBackoff)(async () => {
|
|
53
|
+
// Get current main branch SHA
|
|
54
|
+
const { data: ref } = await this.octokit.git.getRef({
|
|
55
|
+
owner: this.config.owner,
|
|
56
|
+
repo: this.config.repo,
|
|
57
|
+
ref: `heads/${this.config.branch}`,
|
|
58
|
+
});
|
|
59
|
+
const sha = ref.object.sha;
|
|
60
|
+
// Create new branch
|
|
61
|
+
await this.octokit.git.createRef({
|
|
62
|
+
owner: this.config.owner,
|
|
63
|
+
repo: this.config.repo,
|
|
64
|
+
ref: `refs/heads/${branchName}`,
|
|
65
|
+
sha,
|
|
66
|
+
});
|
|
67
|
+
return sha;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Commit file to branch
|
|
72
|
+
*/
|
|
73
|
+
async commitFile(branchName, filePath, content, message) {
|
|
74
|
+
const fullPath = `${this.config.docsPath}/${filePath}`;
|
|
75
|
+
// Try to get existing file SHA
|
|
76
|
+
let sha;
|
|
77
|
+
try {
|
|
78
|
+
const { data } = await this.octokit.repos.getContent({
|
|
79
|
+
owner: this.config.owner,
|
|
80
|
+
repo: this.config.repo,
|
|
81
|
+
path: fullPath,
|
|
82
|
+
ref: branchName,
|
|
83
|
+
});
|
|
84
|
+
if ('sha' in data)
|
|
85
|
+
sha = data.sha;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
const error = e;
|
|
89
|
+
if (error.status !== 404)
|
|
90
|
+
throw e;
|
|
91
|
+
// File doesn't exist yet, that's ok
|
|
92
|
+
}
|
|
93
|
+
// Create or update file
|
|
94
|
+
await this.octokit.repos.createOrUpdateFileContents({
|
|
95
|
+
owner: this.config.owner,
|
|
96
|
+
repo: this.config.repo,
|
|
97
|
+
path: fullPath,
|
|
98
|
+
message,
|
|
99
|
+
content: Buffer.from(content).toString('base64'),
|
|
100
|
+
branch: branchName,
|
|
101
|
+
sha,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create pull request
|
|
106
|
+
*/
|
|
107
|
+
async createPullRequest(branchName, title, body) {
|
|
108
|
+
const { data } = await this.octokit.pulls.create({
|
|
109
|
+
owner: this.config.owner,
|
|
110
|
+
repo: this.config.repo,
|
|
111
|
+
head: branchName,
|
|
112
|
+
base: this.config.branch,
|
|
113
|
+
title,
|
|
114
|
+
body,
|
|
115
|
+
});
|
|
116
|
+
return data.number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Merge pull request
|
|
120
|
+
*/
|
|
121
|
+
async mergePullRequest(prNumber) {
|
|
122
|
+
await this.octokit.pulls.merge({
|
|
123
|
+
owner: this.config.owner,
|
|
124
|
+
repo: this.config.repo,
|
|
125
|
+
pull_number: prNumber,
|
|
126
|
+
merge_method: 'squash',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Delete branch
|
|
131
|
+
*/
|
|
132
|
+
async deleteBranch(branchName) {
|
|
133
|
+
await this.octokit.git.deleteRef({
|
|
134
|
+
owner: this.config.owner,
|
|
135
|
+
repo: this.config.repo,
|
|
136
|
+
ref: `heads/${branchName}`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get commit history for file
|
|
141
|
+
*/
|
|
142
|
+
async getFileHistory(filePath) {
|
|
143
|
+
const fullPath = `${this.config.docsPath}/${filePath}`;
|
|
144
|
+
const { data } = await this.octokit.repos.listCommits({
|
|
145
|
+
owner: this.config.owner,
|
|
146
|
+
repo: this.config.repo,
|
|
147
|
+
path: fullPath,
|
|
148
|
+
per_page: 50,
|
|
149
|
+
});
|
|
150
|
+
return data.map((commit) => ({
|
|
151
|
+
sha: commit.sha,
|
|
152
|
+
message: commit.commit.message,
|
|
153
|
+
date: commit.commit.author?.date || '',
|
|
154
|
+
author: commit.commit.author?.name || 'Unknown',
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.GitHubClient = GitHubClient;
|
|
159
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/github/client.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AAExC,mCAA2C;AAE3C,MAAa,YAAY;IAIvB,YAAY,KAAa,EAAE,MAA4B;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,IAAA,wBAAgB,EAAC,KAAK,IAAI,EAAE;YACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;gBAC9C,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;gBACxB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;gBACtB,QAAQ,EA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CA0LC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/github/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3D,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubAPIError = exports.retryWithBackoff = exports.GitHubClient = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "GitHubClient", { enumerable: true, get: function () { return client_1.GitHubClient; } });
|
|
6
|
+
var retry_1 = require("./retry");
|
|
7
|
+
Object.defineProperty(exports, "retryWithBackoff", { enumerable: true, get: function () { return retry_1.retryWithBackoff; } });
|
|
8
|
+
Object.defineProperty(exports, "GitHubAPIError", { enumerable: true, get: function () { return retry_1.GitHubAPIError; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/github/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,iCAA2D;AAAlD,yGAAA,gBAAgB,OAAA;AAAE,uGAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RetryOptions {
|
|
2
|
+
maxRetries?: number;
|
|
3
|
+
baseDelay?: number;
|
|
4
|
+
maxDelay?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class GitHubAPIError extends Error {
|
|
7
|
+
status?: number | undefined;
|
|
8
|
+
retryAfter?: number | undefined;
|
|
9
|
+
constructor(message: string, status?: number | undefined, retryAfter?: number | undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retry a GitHub API call with exponential backoff
|
|
13
|
+
*/
|
|
14
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
15
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/core/github/retry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,cAAe,SAAQ,KAAK;IAG9B,MAAM,CAAC,EAAE,MAAM;IACf,UAAU,CAAC,EAAE,MAAM;gBAF1B,OAAO,EAAE,MAAM,EACR,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,UAAU,CAAC,EAAE,MAAM,YAAA;CAK7B;AASD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CAgDZ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitHubAPIError = void 0;
|
|
4
|
+
exports.retryWithBackoff = retryWithBackoff;
|
|
5
|
+
class GitHubAPIError extends Error {
|
|
6
|
+
constructor(message, status, retryAfter) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.retryAfter = retryAfter;
|
|
10
|
+
this.name = 'GitHubAPIError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.GitHubAPIError = GitHubAPIError;
|
|
14
|
+
/**
|
|
15
|
+
* Sleep for specified milliseconds
|
|
16
|
+
*/
|
|
17
|
+
function sleep(ms) {
|
|
18
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Retry a GitHub API call with exponential backoff
|
|
22
|
+
*/
|
|
23
|
+
async function retryWithBackoff(fn, options = {}) {
|
|
24
|
+
const { maxRetries = 3, baseDelay = 1000, maxDelay = 10000 } = options;
|
|
25
|
+
let lastError = null;
|
|
26
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
27
|
+
try {
|
|
28
|
+
return await fn();
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const err = error;
|
|
32
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
33
|
+
// Don't retry client errors (4xx) except 429 (rate limit)
|
|
34
|
+
if (err.status && err.status >= 400 && err.status < 500 && err.status !== 429) {
|
|
35
|
+
throw new GitHubAPIError(err.message || 'GitHub API client error', err.status);
|
|
36
|
+
}
|
|
37
|
+
// Handle rate limiting (403 or 429)
|
|
38
|
+
if (err.status === 403 || err.status === 429) {
|
|
39
|
+
const resetTime = err.response?.headers?.['x-ratelimit-reset'];
|
|
40
|
+
const remaining = err.response?.headers?.['x-ratelimit-remaining'];
|
|
41
|
+
if (remaining === '0' && resetTime) {
|
|
42
|
+
const waitTime = Number.parseInt(resetTime) * 1000 - Date.now();
|
|
43
|
+
if (waitTime > 0 && waitTime < 60000) {
|
|
44
|
+
console.log(`Rate limited. Waiting ${Math.ceil(waitTime / 1000)}s...`);
|
|
45
|
+
await sleep(waitTime);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
throw new GitHubAPIError('GitHub API rate limit exceeded', err.status, waitTime);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Retry on 5xx errors or network errors
|
|
52
|
+
if (attempt < maxRetries - 1) {
|
|
53
|
+
const delay = Math.min(baseDelay * 2 ** attempt, maxDelay);
|
|
54
|
+
console.log(`Attempt ${attempt + 1} failed. Retrying in ${delay}ms...`);
|
|
55
|
+
await sleep(delay);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw lastError || new Error('All retries failed');
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../src/core/github/retry.ts"],"names":[],"mappings":";;;AA2BA,4CAmDC;AAxED,MAAa,cAAe,SAAQ,KAAK;IACvC,YACE,OAAe,EACR,MAAe,EACf,UAAmB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,WAAM,GAAN,MAAM,CAAS;QACf,eAAU,GAAV,UAAU,CAAS;QAG1B,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AATD,wCASC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,EAAoB,EACpB,UAAwB,EAAE;IAE1B,MAAM,EAAE,UAAU,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAEvE,IAAI,SAAS,GAAiB,IAAI,CAAC;IAEnC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;QACtD,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAIX,CAAC;YACF,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,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G,CAAC,IAAI,OAAO,EAAE,QAAQ,CAAC,CAAC;gBAC3D,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,GAAG,CAAC,wBAAwB,KAAK,OAAO,CAAC,CAAC;gBACxE,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACrD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { loadConfig, configSchema, validateEnv, resetConfigCache } from './core/config';
|
|
2
|
+
export type { DocsConfig } from './core/config';
|
|
3
|
+
export { GitHubClient, retryWithBackoff, GitHubAPIError } from './core/github';
|
|
4
|
+
export type { RetryOptions } from './core/github';
|
|
5
|
+
export { createServer, startServer } from './server';
|
|
6
|
+
export { DocPushError, ConfigError, AuthError, DraftNotFoundError, DocNotFoundError, ValidationError, EnvError, } from './core/errors';
|
|
7
|
+
export { generateId, now, getDrafts, getDraft, createDraft, updateDraft, deleteDraft, getComments, addComment, createSession, getSession, deleteSession, createMagicLink, verifyMagicLink, } from './server/storage';
|
|
8
|
+
export type { Draft, DraftComment } from './server/storage';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxF,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,GAAG,EACH,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyMagicLink = exports.createMagicLink = exports.deleteSession = exports.getSession = exports.createSession = exports.addComment = exports.getComments = exports.deleteDraft = exports.updateDraft = exports.createDraft = exports.getDraft = exports.getDrafts = exports.now = exports.generateId = exports.EnvError = exports.ValidationError = exports.DocNotFoundError = exports.DraftNotFoundError = exports.AuthError = exports.ConfigError = exports.DocPushError = exports.startServer = exports.createServer = exports.GitHubAPIError = exports.retryWithBackoff = exports.GitHubClient = exports.resetConfigCache = exports.validateEnv = exports.configSchema = exports.loadConfig = void 0;
|
|
4
|
+
// Main package exports
|
|
5
|
+
var config_1 = require("./core/config");
|
|
6
|
+
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
|
|
7
|
+
Object.defineProperty(exports, "configSchema", { enumerable: true, get: function () { return config_1.configSchema; } });
|
|
8
|
+
Object.defineProperty(exports, "validateEnv", { enumerable: true, get: function () { return config_1.validateEnv; } });
|
|
9
|
+
Object.defineProperty(exports, "resetConfigCache", { enumerable: true, get: function () { return config_1.resetConfigCache; } });
|
|
10
|
+
var github_1 = require("./core/github");
|
|
11
|
+
Object.defineProperty(exports, "GitHubClient", { enumerable: true, get: function () { return github_1.GitHubClient; } });
|
|
12
|
+
Object.defineProperty(exports, "retryWithBackoff", { enumerable: true, get: function () { return github_1.retryWithBackoff; } });
|
|
13
|
+
Object.defineProperty(exports, "GitHubAPIError", { enumerable: true, get: function () { return github_1.GitHubAPIError; } });
|
|
14
|
+
var server_1 = require("./server");
|
|
15
|
+
Object.defineProperty(exports, "createServer", { enumerable: true, get: function () { return server_1.createServer; } });
|
|
16
|
+
Object.defineProperty(exports, "startServer", { enumerable: true, get: function () { return server_1.startServer; } });
|
|
17
|
+
var errors_1 = require("./core/errors");
|
|
18
|
+
Object.defineProperty(exports, "DocPushError", { enumerable: true, get: function () { return errors_1.DocPushError; } });
|
|
19
|
+
Object.defineProperty(exports, "ConfigError", { enumerable: true, get: function () { return errors_1.ConfigError; } });
|
|
20
|
+
Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return errors_1.AuthError; } });
|
|
21
|
+
Object.defineProperty(exports, "DraftNotFoundError", { enumerable: true, get: function () { return errors_1.DraftNotFoundError; } });
|
|
22
|
+
Object.defineProperty(exports, "DocNotFoundError", { enumerable: true, get: function () { return errors_1.DocNotFoundError; } });
|
|
23
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
24
|
+
Object.defineProperty(exports, "EnvError", { enumerable: true, get: function () { return errors_1.EnvError; } });
|
|
25
|
+
var storage_1 = require("./server/storage");
|
|
26
|
+
Object.defineProperty(exports, "generateId", { enumerable: true, get: function () { return storage_1.generateId; } });
|
|
27
|
+
Object.defineProperty(exports, "now", { enumerable: true, get: function () { return storage_1.now; } });
|
|
28
|
+
Object.defineProperty(exports, "getDrafts", { enumerable: true, get: function () { return storage_1.getDrafts; } });
|
|
29
|
+
Object.defineProperty(exports, "getDraft", { enumerable: true, get: function () { return storage_1.getDraft; } });
|
|
30
|
+
Object.defineProperty(exports, "createDraft", { enumerable: true, get: function () { return storage_1.createDraft; } });
|
|
31
|
+
Object.defineProperty(exports, "updateDraft", { enumerable: true, get: function () { return storage_1.updateDraft; } });
|
|
32
|
+
Object.defineProperty(exports, "deleteDraft", { enumerable: true, get: function () { return storage_1.deleteDraft; } });
|
|
33
|
+
Object.defineProperty(exports, "getComments", { enumerable: true, get: function () { return storage_1.getComments; } });
|
|
34
|
+
Object.defineProperty(exports, "addComment", { enumerable: true, get: function () { return storage_1.addComment; } });
|
|
35
|
+
Object.defineProperty(exports, "createSession", { enumerable: true, get: function () { return storage_1.createSession; } });
|
|
36
|
+
Object.defineProperty(exports, "getSession", { enumerable: true, get: function () { return storage_1.getSession; } });
|
|
37
|
+
Object.defineProperty(exports, "deleteSession", { enumerable: true, get: function () { return storage_1.deleteSession; } });
|
|
38
|
+
Object.defineProperty(exports, "createMagicLink", { enumerable: true, get: function () { return storage_1.createMagicLink; } });
|
|
39
|
+
Object.defineProperty(exports, "verifyMagicLink", { enumerable: true, get: function () { return storage_1.verifyMagicLink; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB,wCAAwF;AAA/E,oGAAA,UAAU,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,qGAAA,WAAW,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAEhE,wCAA+E;AAAtE,sGAAA,YAAY,OAAA;AAAE,0GAAA,gBAAgB,OAAA;AAAE,wGAAA,cAAc,OAAA;AAEvD,mCAAqD;AAA5C,sGAAA,YAAY,OAAA;AAAE,qGAAA,WAAW,OAAA;AAClC,wCAQuB;AAPrB,sGAAA,YAAY,OAAA;AACZ,qGAAA,WAAW,OAAA;AACX,mGAAA,SAAS,OAAA;AACT,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,yGAAA,eAAe,OAAA;AACf,kGAAA,QAAQ,OAAA;AAEV,4CAe0B;AAdxB,qGAAA,UAAU,OAAA;AACV,8FAAA,GAAG,OAAA;AACH,oGAAA,SAAS,OAAA;AACT,mGAAA,QAAQ,OAAA;AACR,sGAAA,WAAW,OAAA;AACX,sGAAA,WAAW,OAAA;AACX,sGAAA,WAAW,OAAA;AACX,sGAAA,WAAW,OAAA;AACX,qGAAA,UAAU,OAAA;AACV,wGAAA,aAAa,OAAA;AACb,qGAAA,UAAU,OAAA;AACV,wGAAA,aAAa,OAAA;AACb,0GAAA,eAAe,OAAA;AACf,0GAAA,eAAe,OAAA"}
|