@codraoss/schema 0.9.4
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/LICENSE +625 -0
- package/README.md +15 -0
- package/dist/api.d.ts +71 -0
- package/dist/api.js +1 -0
- package/dist/api.js.map +1 -0
- package/dist/chunk-WTXH6CHA.js +20 -0
- package/dist/chunk-WTXH6CHA.js.map +1 -0
- package/dist/github.d.ts +101 -0
- package/dist/github.js +10 -0
- package/dist/github.js.map +1 -0
- package/dist/hex.d.ts +4 -0
- package/dist/hex.js +18 -0
- package/dist/hex.js.map +1 -0
- package/dist/index.d.ts +219 -0
- package/dist/index.js +548 -0
- package/dist/index.js.map +1 -0
- package/dist/review-limits.d.ts +12 -0
- package/dist/review-limits.js +15 -0
- package/dist/review-limits.js.map +1 -0
- package/dist/schema-0fUkjd2C.d.ts +897 -0
- package/dist/timezone.d.ts +3 -0
- package/dist/timezone.js +13 -0
- package/dist/timezone.js.map +1 -0
- package/dist/transient-errors.d.ts +6 -0
- package/dist/transient-errors.js +25 -0
- package/dist/transient-errors.js.map +1 -0
- package/dist/webhook.d.ts +42 -0
- package/dist/webhook.js +1 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +112 -0
package/dist/timezone.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/timezone.ts"],"sourcesContent":["// Shared so three call sites (account settings write, stats read fallback, dashboard pre-paint fallback) agree on what's storable.\nexport function isSupportedTimeZone(zone: string) {\n try {\n new Intl.DateTimeFormat('en-US', { timeZone: zone });\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AACO,SAAS,oBAAoB,MAAc;AAChD,MAAI;AACF,QAAI,KAAK,eAAe,SAAS,EAAE,UAAU,KAAK,CAAC;AACnD,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const SHARED_TRANSIENT_ERROR_SUBSTRINGS: readonly ["unavailable", "high demand", "returned no review content", "empty response", "[redacted]"];
|
|
2
|
+
declare function isTimeoutMessage(lowerMessage: string): boolean;
|
|
3
|
+
declare function isSubrequestBudgetMessage(error: unknown): boolean;
|
|
4
|
+
declare function matchesAnyTransientSubstring(lowerMessage: string, substrings?: readonly string[]): boolean;
|
|
5
|
+
|
|
6
|
+
export { SHARED_TRANSIENT_ERROR_SUBSTRINGS, isSubrequestBudgetMessage, isTimeoutMessage, matchesAnyTransientSubstring };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/transient-errors.ts
|
|
2
|
+
var SHARED_TRANSIENT_ERROR_SUBSTRINGS = [
|
|
3
|
+
"unavailable",
|
|
4
|
+
"high demand",
|
|
5
|
+
"returned no review content",
|
|
6
|
+
"empty response",
|
|
7
|
+
"[redacted]"
|
|
8
|
+
];
|
|
9
|
+
function isTimeoutMessage(lowerMessage) {
|
|
10
|
+
return lowerMessage.includes("timed out") || lowerMessage.includes("timeout");
|
|
11
|
+
}
|
|
12
|
+
function isSubrequestBudgetMessage(error) {
|
|
13
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
14
|
+
return message.toLowerCase().includes("subrequest");
|
|
15
|
+
}
|
|
16
|
+
function matchesAnyTransientSubstring(lowerMessage, substrings = SHARED_TRANSIENT_ERROR_SUBSTRINGS) {
|
|
17
|
+
return substrings.some((substring) => lowerMessage.includes(substring));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
SHARED_TRANSIENT_ERROR_SUBSTRINGS,
|
|
21
|
+
isSubrequestBudgetMessage,
|
|
22
|
+
isTimeoutMessage,
|
|
23
|
+
matchesAnyTransientSubstring
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=transient-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transient-errors.ts"],"sourcesContent":["export const SHARED_TRANSIENT_ERROR_SUBSTRINGS = [\n 'unavailable',\n 'high demand',\n 'returned no review content',\n 'empty response',\n '[redacted]',\n] as const;\n\nexport function isTimeoutMessage(lowerMessage: string): boolean {\n return lowerMessage.includes('timed out') || lowerMessage.includes('timeout');\n}\n\nexport function isSubrequestBudgetMessage(error: unknown): boolean {\n const message = error instanceof Error ? error.message : String(error ?? '');\n return message.toLowerCase().includes('subrequest');\n}\n\nexport function matchesAnyTransientSubstring(\n lowerMessage: string,\n substrings: readonly string[] = SHARED_TRANSIENT_ERROR_SUBSTRINGS,\n): boolean {\n return substrings.some((substring) => lowerMessage.includes(substring));\n}\n"],"mappings":";AAAO,IAAM,oCAAoC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,iBAAiB,cAA+B;AAC9D,SAAO,aAAa,SAAS,WAAW,KAAK,aAAa,SAAS,SAAS;AAC9E;AAEO,SAAS,0BAA0B,OAAyB;AACjE,QAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,SAAS,EAAE;AAC3E,SAAO,QAAQ,YAAY,EAAE,SAAS,YAAY;AACpD;AAEO,SAAS,6BACd,cACA,aAAgC,mCACvB;AACT,SAAO,WAAW,KAAK,CAAC,cAAc,aAAa,SAAS,SAAS,CAAC;AACxE;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type WebhookEventName = 'change_request' | 'comment';
|
|
2
|
+
type ChangeRequestWebhookPayload = {
|
|
3
|
+
action: 'opened' | 'synchronize' | 'ready_for_review' | 'reopened' | 'closed';
|
|
4
|
+
installationId: string;
|
|
5
|
+
repository: {
|
|
6
|
+
owner: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
changeRequest: {
|
|
10
|
+
number: number;
|
|
11
|
+
title: string;
|
|
12
|
+
author: string;
|
|
13
|
+
head: {
|
|
14
|
+
sha: string;
|
|
15
|
+
ref: string;
|
|
16
|
+
};
|
|
17
|
+
base: {
|
|
18
|
+
sha: string;
|
|
19
|
+
ref: string;
|
|
20
|
+
};
|
|
21
|
+
draft: boolean;
|
|
22
|
+
body: string | null;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type CommentWebhookPayload = {
|
|
26
|
+
action: 'created';
|
|
27
|
+
installationId: string;
|
|
28
|
+
repository: {
|
|
29
|
+
owner: string;
|
|
30
|
+
name: string;
|
|
31
|
+
};
|
|
32
|
+
issue: {
|
|
33
|
+
number: number;
|
|
34
|
+
isChangeRequest: boolean;
|
|
35
|
+
};
|
|
36
|
+
comment: {
|
|
37
|
+
body: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type WebhookPayload = ChangeRequestWebhookPayload | CommentWebhookPayload;
|
|
41
|
+
|
|
42
|
+
export type { ChangeRequestWebhookPayload, CommentWebhookPayload, WebhookEventName, WebhookPayload };
|
package/dist/webhook.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=webhook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codraoss/schema",
|
|
3
|
+
"version": "0.9.4",
|
|
4
|
+
"description": "Shared types and Zod contracts for Codra, the open-source code review engine.",
|
|
5
|
+
"author": "Devarshi Shimpi",
|
|
6
|
+
"license": "AGPL-3.0-only",
|
|
7
|
+
"homepage": "https://codra.run",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/devarshishimpi/codra.git",
|
|
11
|
+
"directory": "packages/schema"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/devarshishimpi/codra/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./api": {
|
|
24
|
+
"types": "./dist/api.d.ts",
|
|
25
|
+
"import": "./dist/api.js"
|
|
26
|
+
},
|
|
27
|
+
"./github": {
|
|
28
|
+
"types": "./dist/github.d.ts",
|
|
29
|
+
"import": "./dist/github.js"
|
|
30
|
+
},
|
|
31
|
+
"./hex": {
|
|
32
|
+
"types": "./dist/hex.d.ts",
|
|
33
|
+
"import": "./dist/hex.js"
|
|
34
|
+
},
|
|
35
|
+
"./review-limits": {
|
|
36
|
+
"types": "./dist/review-limits.d.ts",
|
|
37
|
+
"import": "./dist/review-limits.js"
|
|
38
|
+
},
|
|
39
|
+
"./timezone": {
|
|
40
|
+
"types": "./dist/timezone.d.ts",
|
|
41
|
+
"import": "./dist/timezone.js"
|
|
42
|
+
},
|
|
43
|
+
"./transient-errors": {
|
|
44
|
+
"types": "./dist/transient-errors.d.ts",
|
|
45
|
+
"import": "./dist/transient-errors.js"
|
|
46
|
+
},
|
|
47
|
+
"./webhook": {
|
|
48
|
+
"types": "./dist/webhook.d.ts",
|
|
49
|
+
"import": "./dist/webhook.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"LICENSE",
|
|
55
|
+
"README.md"
|
|
56
|
+
],
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public",
|
|
59
|
+
"main": "./dist/index.js",
|
|
60
|
+
"module": "./dist/index.js",
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"exports": {
|
|
63
|
+
".": {
|
|
64
|
+
"types": "./dist/index.d.ts",
|
|
65
|
+
"import": "./dist/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./api": {
|
|
68
|
+
"types": "./dist/api.d.ts",
|
|
69
|
+
"import": "./dist/api.js"
|
|
70
|
+
},
|
|
71
|
+
"./github": {
|
|
72
|
+
"types": "./dist/github.d.ts",
|
|
73
|
+
"import": "./dist/github.js"
|
|
74
|
+
},
|
|
75
|
+
"./hex": {
|
|
76
|
+
"types": "./dist/hex.d.ts",
|
|
77
|
+
"import": "./dist/hex.js"
|
|
78
|
+
},
|
|
79
|
+
"./review-limits": {
|
|
80
|
+
"types": "./dist/review-limits.d.ts",
|
|
81
|
+
"import": "./dist/review-limits.js"
|
|
82
|
+
},
|
|
83
|
+
"./timezone": {
|
|
84
|
+
"types": "./dist/timezone.d.ts",
|
|
85
|
+
"import": "./dist/timezone.js"
|
|
86
|
+
},
|
|
87
|
+
"./transient-errors": {
|
|
88
|
+
"types": "./dist/transient-errors.d.ts",
|
|
89
|
+
"import": "./dist/transient-errors.js"
|
|
90
|
+
},
|
|
91
|
+
"./webhook": {
|
|
92
|
+
"types": "./dist/webhook.d.ts",
|
|
93
|
+
"import": "./dist/webhook.js"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "tsup",
|
|
99
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
100
|
+
"prepack": "node ../../scripts/swap-publish-exports.mjs promote",
|
|
101
|
+
"postpack": "node ../../scripts/swap-publish-exports.mjs restore"
|
|
102
|
+
},
|
|
103
|
+
"dependencies": {
|
|
104
|
+
"zod": "^4.3.6"
|
|
105
|
+
},
|
|
106
|
+
"devDependencies": {
|
|
107
|
+
"tsup": "^8.0.0"
|
|
108
|
+
},
|
|
109
|
+
"main": "./dist/index.js",
|
|
110
|
+
"module": "./dist/index.js",
|
|
111
|
+
"types": "./dist/index.d.ts"
|
|
112
|
+
}
|