@intlayer/backend-contract 0.0.0-stage → 9.7.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/dist/cjs/ai.cjs +267 -0
- package/dist/cjs/ai.cjs.map +1 -0
- package/dist/cjs/analytics.cjs +175 -0
- package/dist/cjs/analytics.cjs.map +1 -0
- package/dist/cjs/asset.cjs +88 -0
- package/dist/cjs/asset.cjs.map +1 -0
- package/dist/cjs/blogComment.cjs +98 -0
- package/dist/cjs/blogComment.cjs.map +1 -0
- package/dist/cjs/cliSessionToken.cjs +40 -0
- package/dist/cjs/cliSessionToken.cjs.map +1 -0
- package/dist/cjs/common.cjs +42 -0
- package/dist/cjs/common.cjs.map +1 -0
- package/dist/cjs/defineRoute.cjs +26 -0
- package/dist/cjs/defineRoute.cjs.map +1 -0
- package/dist/cjs/demo.cjs +22 -0
- package/dist/cjs/demo.cjs.map +1 -0
- package/dist/cjs/dictionary.cjs +168 -0
- package/dist/cjs/dictionary.cjs.map +1 -0
- package/dist/cjs/environment.cjs +91 -0
- package/dist/cjs/environment.cjs.map +1 -0
- package/dist/cjs/eventListener.cjs +19 -0
- package/dist/cjs/eventListener.cjs.map +1 -0
- package/dist/cjs/gitProviders.cjs +361 -0
- package/dist/cjs/gitProviders.cjs.map +1 -0
- package/dist/cjs/newsletter.cjs +50 -0
- package/dist/cjs/newsletter.cjs.map +1 -0
- package/dist/cjs/oAuth2.cjs +62 -0
- package/dist/cjs/oAuth2.cjs.map +1 -0
- package/dist/cjs/organization.cjs +226 -0
- package/dist/cjs/organization.cjs.map +1 -0
- package/dist/cjs/project.cjs +401 -0
- package/dist/cjs/project.cjs.map +1 -0
- package/dist/cjs/public.cjs +60 -0
- package/dist/cjs/public.cjs.map +1 -0
- package/dist/cjs/responseData.cjs +33 -0
- package/dist/cjs/responseData.cjs.map +1 -0
- package/dist/cjs/reviewer.cjs +401 -0
- package/dist/cjs/reviewer.cjs.map +1 -0
- package/dist/cjs/scan.cjs +235 -0
- package/dist/cjs/scan.cjs.map +1 -0
- package/dist/cjs/search.cjs +40 -0
- package/dist/cjs/search.cjs.map +1 -0
- package/dist/cjs/session.cjs +56 -0
- package/dist/cjs/session.cjs.map +1 -0
- package/dist/cjs/showcaseProject.cjs +185 -0
- package/dist/cjs/showcaseProject.cjs.map +1 -0
- package/dist/cjs/stripe.cjs +388 -0
- package/dist/cjs/stripe.cjs.map +1 -0
- package/dist/cjs/tag.cjs +83 -0
- package/dist/cjs/tag.cjs.map +1 -0
- package/dist/cjs/translation.cjs +54 -0
- package/dist/cjs/translation.cjs.map +1 -0
- package/dist/cjs/user.cjs +153 -0
- package/dist/cjs/user.cjs.map +1 -0
- package/dist/esm/ai.mjs +261 -0
- package/dist/esm/ai.mjs.map +1 -0
- package/dist/esm/analytics.mjs +168 -0
- package/dist/esm/analytics.mjs.map +1 -0
- package/dist/esm/asset.mjs +86 -0
- package/dist/esm/asset.mjs.map +1 -0
- package/dist/esm/blogComment.mjs +94 -0
- package/dist/esm/blogComment.mjs.map +1 -0
- package/dist/esm/cliSessionToken.mjs +39 -0
- package/dist/esm/cliSessionToken.mjs.map +1 -0
- package/dist/esm/common.mjs +35 -0
- package/dist/esm/common.mjs.map +1 -0
- package/dist/esm/defineRoute.mjs +23 -0
- package/dist/esm/defineRoute.mjs.map +1 -0
- package/dist/esm/demo.mjs +21 -0
- package/dist/esm/demo.mjs.map +1 -0
- package/dist/esm/dictionary.mjs +163 -0
- package/dist/esm/dictionary.mjs.map +1 -0
- package/dist/esm/environment.mjs +90 -0
- package/dist/esm/environment.mjs.map +1 -0
- package/dist/esm/eventListener.mjs +18 -0
- package/dist/esm/eventListener.mjs.map +1 -0
- package/dist/esm/gitProviders.mjs +352 -0
- package/dist/esm/gitProviders.mjs.map +1 -0
- package/dist/esm/newsletter.mjs +49 -0
- package/dist/esm/newsletter.mjs.map +1 -0
- package/dist/esm/oAuth2.mjs +60 -0
- package/dist/esm/oAuth2.mjs.map +1 -0
- package/dist/esm/organization.mjs +219 -0
- package/dist/esm/organization.mjs.map +1 -0
- package/dist/esm/project.mjs +387 -0
- package/dist/esm/project.mjs.map +1 -0
- package/dist/esm/public.mjs +58 -0
- package/dist/esm/public.mjs.map +1 -0
- package/dist/esm/responseData.mjs +30 -0
- package/dist/esm/responseData.mjs.map +1 -0
- package/dist/esm/reviewer.mjs +390 -0
- package/dist/esm/reviewer.mjs.map +1 -0
- package/dist/esm/scan.mjs +225 -0
- package/dist/esm/scan.mjs.map +1 -0
- package/dist/esm/search.mjs +38 -0
- package/dist/esm/search.mjs.map +1 -0
- package/dist/esm/session.mjs +53 -0
- package/dist/esm/session.mjs.map +1 -0
- package/dist/esm/showcaseProject.mjs +182 -0
- package/dist/esm/showcaseProject.mjs.map +1 -0
- package/dist/esm/stripe.mjs +379 -0
- package/dist/esm/stripe.mjs.map +1 -0
- package/dist/esm/tag.mjs +81 -0
- package/dist/esm/tag.mjs.map +1 -0
- package/dist/esm/translation.mjs +53 -0
- package/dist/esm/translation.mjs.map +1 -0
- package/dist/esm/user.mjs +149 -0
- package/dist/esm/user.mjs.map +1 -0
- package/dist/types/@intlayer/config/dist/types/defaultValues/dictionary.d.ts +1 -0
- package/dist/types/@intlayer/config/dist/types/defaultValues/index.d.ts +3 -0
- package/dist/types/@intlayer/config/dist/types/defaultValues/internationalization.d.ts +2 -0
- package/dist/types/@intlayer/config/dist/types/defaultValues/routing.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/plainDynamicLoader.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/dictionaryManipulator/qualifiedDynamicLoader.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/formatters/compact.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/currency.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/date.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/index.d.ts +9 -0
- package/dist/types/@intlayer/core/dist/types/formatters/list.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/number.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/percentage.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/relativeTime.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/formatters/units.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/dictionaryTransformCache.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getCondition.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/deepTransform.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/getContent.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/index.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getContent/plugins.d.ts +7 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionary.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getDictionaryAsync.d.ts +6 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getEnumeration.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getGender.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getInsertion.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayer.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getIntlayerAsync.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getNesting.d.ts +6 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getPlural.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getSelect.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/getTranslation.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/index.d.ts +19 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/interpolableNode.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/interpreter/resolveInterpreterLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/comparePaths.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/domainUtils.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/generateSitemap.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getBrowserLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getCanonicalPath.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getHTMLTextDir.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromPath.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleFromRequest.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleLang.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocaleName.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedPath.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getLocalizedUrl.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getMultilingualUrls.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/getPathWithoutLocale.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/getPrefix.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/index.d.ts +23 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeDetector.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeMapper.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/localeResolver.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/resolveBrowserLocale.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/rewriteMatch.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/localization/rewriteUtils.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/localization/validatePrefix.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/markdown/index.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/condition.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/condition/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/enumeration.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/enumeration/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/file/file.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/file/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/gender.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/gender/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/html/html.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/html/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/index.d.ts +22 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/insertion/insertion.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/markdown/markdown.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/nesting/nesting.d.ts +4 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/plural/plural.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/select/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/select/select.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/index.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/transpiler/translation/translation.d.ts +2 -0
- package/dist/types/@intlayer/core/dist/types/utils/index.d.ts +3 -0
- package/dist/types/@intlayer/core/dist/types/utils/intl.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/utils/isSameKeyPath.d.ts +1 -0
- package/dist/types/@intlayer/core/dist/types/utils/localeStorage.d.ts +2 -0
- package/dist/types/ai.d.ts +549 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/analytics.d.ts +378 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/asset.d.ts +207 -0
- package/dist/types/asset.d.ts.map +1 -0
- package/dist/types/blogComment.d.ts +241 -0
- package/dist/types/blogComment.d.ts.map +1 -0
- package/dist/types/cliSessionToken.d.ts +264 -0
- package/dist/types/cliSessionToken.d.ts.map +1 -0
- package/dist/types/common.d.ts +32 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/defineRoute.d.ts +57 -0
- package/dist/types/defineRoute.d.ts.map +1 -0
- package/dist/types/demo.d.ts +21 -0
- package/dist/types/demo.d.ts.map +1 -0
- package/dist/types/dictionary.d.ts +360 -0
- package/dist/types/dictionary.d.ts.map +1 -0
- package/dist/types/environment.d.ts +285 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/eventListener.d.ts +17 -0
- package/dist/types/eventListener.d.ts.map +1 -0
- package/dist/types/gitProviders.d.ts +807 -0
- package/dist/types/gitProviders.d.ts.map +1 -0
- package/dist/types/intlayer/dist/types/index.d.ts +13 -0
- package/dist/types/newsletter.d.ts +165 -0
- package/dist/types/newsletter.d.ts.map +1 -0
- package/dist/types/oAuth2.d.ts +482 -0
- package/dist/types/oAuth2.d.ts.map +1 -0
- package/dist/types/organization.d.ts +1069 -0
- package/dist/types/organization.d.ts.map +1 -0
- package/dist/types/project.d.ts +1735 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/public.d.ts +109 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/responseData.d.ts +68 -0
- package/dist/types/responseData.d.ts.map +1 -0
- package/dist/types/reviewer.d.ts +1239 -0
- package/dist/types/reviewer.d.ts.map +1 -0
- package/dist/types/scan.d.ts +625 -0
- package/dist/types/scan.d.ts.map +1 -0
- package/dist/types/search.d.ts +55 -0
- package/dist/types/search.d.ts.map +1 -0
- package/dist/types/session.d.ts +286 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/showcaseProject.d.ts +550 -0
- package/dist/types/showcaseProject.d.ts.map +1 -0
- package/dist/types/stripe.d.ts +1219 -0
- package/dist/types/stripe.d.ts.map +1 -0
- package/dist/types/tag.d.ts +193 -0
- package/dist/types/tag.d.ts.map +1 -0
- package/dist/types/translation.d.ts +162 -0
- package/dist/types/translation.d.ts.map +1 -0
- package/dist/types/user.d.ts +447 -0
- package/dist/types/user.d.ts.map +1 -0
- package/package.json +300 -4
- package/README.md +0 -3
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
3
|
+
const require_responseData = require('./responseData.cjs');
|
|
4
|
+
let zod_mini = require("zod/mini");
|
|
5
|
+
|
|
6
|
+
//#region src/gitProviders.ts
|
|
7
|
+
/**
|
|
8
|
+
* Git provider OAuth + repository routes (repository linking in the
|
|
9
|
+
* dashboard). Each provider gets its own group; the shapes below are shared.
|
|
10
|
+
*/
|
|
11
|
+
const authUrlResponseSchema = require_responseData.responseDataSchema(zod_mini.z.object({ authUrl: zod_mini.z.string() }));
|
|
12
|
+
const tokenResponseSchema = require_responseData.responseDataSchema(zod_mini.z.object({ token: zod_mini.z.string() }));
|
|
13
|
+
const checkConfigResponseSchema = require_responseData.responseDataSchema(zod_mini.z.object({
|
|
14
|
+
hasConfig: zod_mini.z.boolean(),
|
|
15
|
+
configPaths: zod_mini.z.array(zod_mini.z.string())
|
|
16
|
+
}));
|
|
17
|
+
const configFileResponseSchema = require_responseData.responseDataSchema(zod_mini.z.object({ content: zod_mini.z.string() }));
|
|
18
|
+
/** Optional provider token: defaults to the one linked to the user. */
|
|
19
|
+
const tokenShape = { token: zod_mini.z.optional(zod_mini.z.string()) };
|
|
20
|
+
const branchAndPathShape = {
|
|
21
|
+
branch: zod_mini.z.optional(zod_mini.z.string()),
|
|
22
|
+
path: zod_mini.z.optional(zod_mini.z.string())
|
|
23
|
+
};
|
|
24
|
+
/** GitHub repository (subset of the REST API item the dashboard reads). */
|
|
25
|
+
const gitHubRepositorySchema = zod_mini.z.looseObject({
|
|
26
|
+
id: zod_mini.z.number(),
|
|
27
|
+
name: zod_mini.z.string(),
|
|
28
|
+
full_name: zod_mini.z.string(),
|
|
29
|
+
owner: zod_mini.z.looseObject({
|
|
30
|
+
login: zod_mini.z.string(),
|
|
31
|
+
avatar_url: zod_mini.z.optional(zod_mini.z.string())
|
|
32
|
+
}),
|
|
33
|
+
private: zod_mini.z.boolean(),
|
|
34
|
+
html_url: zod_mini.z.string(),
|
|
35
|
+
default_branch: zod_mini.z.optional(zod_mini.z.string()),
|
|
36
|
+
updated_at: zod_mini.z.optional(zod_mini.z.nullable(zod_mini.z.string()))
|
|
37
|
+
});
|
|
38
|
+
/** GitLab project (subset the dashboard reads). */
|
|
39
|
+
const gitLabProjectSchema = zod_mini.z.looseObject({
|
|
40
|
+
id: zod_mini.z.number(),
|
|
41
|
+
name: zod_mini.z.string(),
|
|
42
|
+
path_with_namespace: zod_mini.z.string(),
|
|
43
|
+
web_url: zod_mini.z.string(),
|
|
44
|
+
default_branch: zod_mini.z.string(),
|
|
45
|
+
visibility: zod_mini.z.string(),
|
|
46
|
+
last_activity_at: zod_mini.z.string(),
|
|
47
|
+
namespace: zod_mini.z.looseObject({
|
|
48
|
+
id: zod_mini.z.number(),
|
|
49
|
+
name: zod_mini.z.string(),
|
|
50
|
+
path: zod_mini.z.string()
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
/** Bitbucket repository (subset the dashboard reads). */
|
|
54
|
+
const bitbucketRepositorySchema = zod_mini.z.looseObject({
|
|
55
|
+
uuid: zod_mini.z.string(),
|
|
56
|
+
name: zod_mini.z.string(),
|
|
57
|
+
full_name: zod_mini.z.string(),
|
|
58
|
+
slug: zod_mini.z.string(),
|
|
59
|
+
mainbranch: zod_mini.z.optional(zod_mini.z.looseObject({
|
|
60
|
+
name: zod_mini.z.string(),
|
|
61
|
+
type: zod_mini.z.string()
|
|
62
|
+
})),
|
|
63
|
+
links: zod_mini.z.looseObject({ html: zod_mini.z.looseObject({ href: zod_mini.z.string() }) }),
|
|
64
|
+
workspace: zod_mini.z.looseObject({
|
|
65
|
+
slug: zod_mini.z.string(),
|
|
66
|
+
name: zod_mini.z.string(),
|
|
67
|
+
uuid: zod_mini.z.string()
|
|
68
|
+
}),
|
|
69
|
+
is_private: zod_mini.z.optional(zod_mini.z.boolean()),
|
|
70
|
+
updated_on: zod_mini.z.optional(zod_mini.z.string())
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Repository of a Gitea-compatible forge (Codeberg/Forgejo, Gitee), normalized
|
|
74
|
+
* by the backend. `name` is the URL slug used in API paths.
|
|
75
|
+
*/
|
|
76
|
+
const forgeRepositorySchema = zod_mini.z.object({
|
|
77
|
+
id: zod_mini.z.number(),
|
|
78
|
+
name: zod_mini.z.string(),
|
|
79
|
+
/** Human-readable name (can differ from the slug on Gitee). */
|
|
80
|
+
displayName: zod_mini.z.string(),
|
|
81
|
+
full_name: zod_mini.z.string(),
|
|
82
|
+
owner: zod_mini.z.object({
|
|
83
|
+
login: zod_mini.z.string(),
|
|
84
|
+
avatar_url: zod_mini.z.optional(zod_mini.z.string())
|
|
85
|
+
}),
|
|
86
|
+
private: zod_mini.z.boolean(),
|
|
87
|
+
html_url: zod_mini.z.string(),
|
|
88
|
+
default_branch: zod_mini.z.optional(zod_mini.z.string()),
|
|
89
|
+
updated_at: zod_mini.z.optional(zod_mini.z.nullable(zod_mini.z.string()))
|
|
90
|
+
});
|
|
91
|
+
const forgeRepositoryShape = {
|
|
92
|
+
...tokenShape,
|
|
93
|
+
owner: zod_mini.z.string(),
|
|
94
|
+
repository: zod_mini.z.string()
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Builds the contract of a Gitea-compatible forge: repositories are listed and
|
|
98
|
+
* read with the account linked through better-auth.
|
|
99
|
+
*/
|
|
100
|
+
const defineForgeContract = (prefix, tag) => require_defineRoute.defineRouteGroup({
|
|
101
|
+
prefix,
|
|
102
|
+
tag,
|
|
103
|
+
routes: {
|
|
104
|
+
listRepos: require_defineRoute.defineRoute({
|
|
105
|
+
method: "GET",
|
|
106
|
+
path: "/repos",
|
|
107
|
+
summary: `Repositories of the ${tag} account`,
|
|
108
|
+
schemas: {
|
|
109
|
+
querystring: zod_mini.z.object(tokenShape),
|
|
110
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(forgeRepositorySchema)) }
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
checkConfig: require_defineRoute.defineRoute({
|
|
114
|
+
method: "POST",
|
|
115
|
+
path: "/check-config",
|
|
116
|
+
summary: "Find Intlayer configuration files in a repository",
|
|
117
|
+
schemas: {
|
|
118
|
+
body: zod_mini.z.object({
|
|
119
|
+
...forgeRepositoryShape,
|
|
120
|
+
branch: zod_mini.z.optional(zod_mini.z.string())
|
|
121
|
+
}),
|
|
122
|
+
response: { 200: checkConfigResponseSchema }
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
getConfigFile: require_defineRoute.defineRoute({
|
|
126
|
+
method: "POST",
|
|
127
|
+
path: "/get-config-file",
|
|
128
|
+
summary: "Read an Intlayer configuration file of a repository",
|
|
129
|
+
schemas: {
|
|
130
|
+
body: zod_mini.z.object({
|
|
131
|
+
...forgeRepositoryShape,
|
|
132
|
+
...branchAndPathShape
|
|
133
|
+
}),
|
|
134
|
+
response: { 200: configFileResponseSchema }
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
/** REST contract of the `/api/codeberg` routes (Codeberg / Forgejo). */
|
|
140
|
+
const codebergContract = defineForgeContract("/api/codeberg", "Codeberg");
|
|
141
|
+
/** REST contract of the `/api/gitee` routes. */
|
|
142
|
+
const giteeContract = defineForgeContract("/api/gitee", "Gitee");
|
|
143
|
+
/** REST contract of the `/api/github` routes. */
|
|
144
|
+
const githubContract = require_defineRoute.defineRouteGroup({
|
|
145
|
+
prefix: "/api/github",
|
|
146
|
+
tag: "GitHub",
|
|
147
|
+
routes: {
|
|
148
|
+
getAuthUrl: require_defineRoute.defineRoute({
|
|
149
|
+
method: "GET",
|
|
150
|
+
path: "/auth-url",
|
|
151
|
+
summary: "GitHub OAuth authorization URL",
|
|
152
|
+
schemas: {
|
|
153
|
+
querystring: zod_mini.z.object({
|
|
154
|
+
redirectUri: zod_mini.z.string(),
|
|
155
|
+
login: zod_mini.z.optional(zod_mini.z.string())
|
|
156
|
+
}),
|
|
157
|
+
response: { 200: authUrlResponseSchema }
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
authCallback: require_defineRoute.defineRoute({
|
|
161
|
+
method: "POST",
|
|
162
|
+
path: "/auth",
|
|
163
|
+
summary: "Exchange the OAuth code for a GitHub token",
|
|
164
|
+
schemas: {
|
|
165
|
+
body: zod_mini.z.object({ code: zod_mini.z.string() }),
|
|
166
|
+
response: { 200: tokenResponseSchema }
|
|
167
|
+
}
|
|
168
|
+
}),
|
|
169
|
+
listRepos: require_defineRoute.defineRoute({
|
|
170
|
+
method: "GET",
|
|
171
|
+
path: "/repos",
|
|
172
|
+
summary: "Repositories of the GitHub account",
|
|
173
|
+
schemas: {
|
|
174
|
+
querystring: zod_mini.z.object(tokenShape),
|
|
175
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(gitHubRepositorySchema)) }
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
checkConfig: require_defineRoute.defineRoute({
|
|
179
|
+
method: "POST",
|
|
180
|
+
path: "/check-config",
|
|
181
|
+
summary: "Find Intlayer configuration files in a repository",
|
|
182
|
+
schemas: {
|
|
183
|
+
body: zod_mini.z.object({
|
|
184
|
+
...tokenShape,
|
|
185
|
+
owner: zod_mini.z.string(),
|
|
186
|
+
repository: zod_mini.z.string(),
|
|
187
|
+
branch: zod_mini.z.optional(zod_mini.z.string())
|
|
188
|
+
}),
|
|
189
|
+
response: { 200: checkConfigResponseSchema }
|
|
190
|
+
}
|
|
191
|
+
}),
|
|
192
|
+
getConfigFile: require_defineRoute.defineRoute({
|
|
193
|
+
method: "POST",
|
|
194
|
+
path: "/get-config-file",
|
|
195
|
+
summary: "Read an Intlayer configuration file of a repository",
|
|
196
|
+
schemas: {
|
|
197
|
+
body: zod_mini.z.object({
|
|
198
|
+
...tokenShape,
|
|
199
|
+
...branchAndPathShape,
|
|
200
|
+
owner: zod_mini.z.string(),
|
|
201
|
+
repository: zod_mini.z.string()
|
|
202
|
+
}),
|
|
203
|
+
response: { 200: configFileResponseSchema }
|
|
204
|
+
}
|
|
205
|
+
}),
|
|
206
|
+
getToken: require_defineRoute.defineRoute({
|
|
207
|
+
method: "GET",
|
|
208
|
+
path: "/token",
|
|
209
|
+
summary: "GitHub token linked to the signed-in user's account",
|
|
210
|
+
schemas: { response: { 200: tokenResponseSchema } }
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
/** REST contract of the `/api/gitlab` routes. */
|
|
215
|
+
const gitlabContract = require_defineRoute.defineRouteGroup({
|
|
216
|
+
prefix: "/api/gitlab",
|
|
217
|
+
tag: "GitLab",
|
|
218
|
+
routes: {
|
|
219
|
+
getAuthUrl: require_defineRoute.defineRoute({
|
|
220
|
+
method: "GET",
|
|
221
|
+
path: "/auth-url",
|
|
222
|
+
summary: "GitLab OAuth authorization URL",
|
|
223
|
+
schemas: {
|
|
224
|
+
querystring: zod_mini.z.object({
|
|
225
|
+
redirectUri: zod_mini.z.string(),
|
|
226
|
+
/** Self-managed GitLab instance (ex: https://gitlab.company.com). */
|
|
227
|
+
instanceUrl: zod_mini.z.optional(zod_mini.z.string()),
|
|
228
|
+
login: zod_mini.z.optional(zod_mini.z.string())
|
|
229
|
+
}),
|
|
230
|
+
response: { 200: authUrlResponseSchema }
|
|
231
|
+
}
|
|
232
|
+
}),
|
|
233
|
+
authCallback: require_defineRoute.defineRoute({
|
|
234
|
+
method: "POST",
|
|
235
|
+
path: "/auth",
|
|
236
|
+
summary: "Exchange the OAuth code for a GitLab token",
|
|
237
|
+
schemas: {
|
|
238
|
+
body: zod_mini.z.object({
|
|
239
|
+
code: zod_mini.z.string(),
|
|
240
|
+
redirectUri: zod_mini.z.string(),
|
|
241
|
+
instanceUrl: zod_mini.z.optional(zod_mini.z.string())
|
|
242
|
+
}),
|
|
243
|
+
response: { 200: tokenResponseSchema }
|
|
244
|
+
}
|
|
245
|
+
}),
|
|
246
|
+
listProjects: require_defineRoute.defineRoute({
|
|
247
|
+
method: "GET",
|
|
248
|
+
path: "/projects",
|
|
249
|
+
summary: "Projects of the GitLab account",
|
|
250
|
+
schemas: {
|
|
251
|
+
querystring: zod_mini.z.object({
|
|
252
|
+
...tokenShape,
|
|
253
|
+
instanceUrl: zod_mini.z.optional(zod_mini.z.string())
|
|
254
|
+
}),
|
|
255
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(gitLabProjectSchema)) }
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
258
|
+
checkConfig: require_defineRoute.defineRoute({
|
|
259
|
+
method: "POST",
|
|
260
|
+
path: "/check-config",
|
|
261
|
+
summary: "Find Intlayer configuration files in a project",
|
|
262
|
+
schemas: {
|
|
263
|
+
body: zod_mini.z.object({
|
|
264
|
+
...tokenShape,
|
|
265
|
+
projectId: zod_mini.z.number(),
|
|
266
|
+
branch: zod_mini.z.optional(zod_mini.z.string()),
|
|
267
|
+
instanceUrl: zod_mini.z.optional(zod_mini.z.string())
|
|
268
|
+
}),
|
|
269
|
+
response: { 200: checkConfigResponseSchema }
|
|
270
|
+
}
|
|
271
|
+
}),
|
|
272
|
+
getConfigFile: require_defineRoute.defineRoute({
|
|
273
|
+
method: "POST",
|
|
274
|
+
path: "/get-config-file",
|
|
275
|
+
summary: "Read an Intlayer configuration file of a project",
|
|
276
|
+
schemas: {
|
|
277
|
+
body: zod_mini.z.object({
|
|
278
|
+
...tokenShape,
|
|
279
|
+
...branchAndPathShape,
|
|
280
|
+
projectId: zod_mini.z.number(),
|
|
281
|
+
instanceUrl: zod_mini.z.optional(zod_mini.z.string())
|
|
282
|
+
}),
|
|
283
|
+
response: { 200: configFileResponseSchema }
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
/** REST contract of the `/api/bitbucket` routes. */
|
|
289
|
+
const bitbucketContract = require_defineRoute.defineRouteGroup({
|
|
290
|
+
prefix: "/api/bitbucket",
|
|
291
|
+
tag: "Bitbucket",
|
|
292
|
+
routes: {
|
|
293
|
+
getAuthUrl: require_defineRoute.defineRoute({
|
|
294
|
+
method: "GET",
|
|
295
|
+
path: "/auth-url",
|
|
296
|
+
summary: "Bitbucket OAuth authorization URL",
|
|
297
|
+
schemas: {
|
|
298
|
+
querystring: zod_mini.z.object({ redirectUri: zod_mini.z.string() }),
|
|
299
|
+
response: { 200: authUrlResponseSchema }
|
|
300
|
+
}
|
|
301
|
+
}),
|
|
302
|
+
authCallback: require_defineRoute.defineRoute({
|
|
303
|
+
method: "POST",
|
|
304
|
+
path: "/auth",
|
|
305
|
+
summary: "Exchange the OAuth code for a Bitbucket token",
|
|
306
|
+
schemas: {
|
|
307
|
+
body: zod_mini.z.object({ code: zod_mini.z.string() }),
|
|
308
|
+
response: { 200: tokenResponseSchema }
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
listRepos: require_defineRoute.defineRoute({
|
|
312
|
+
method: "GET",
|
|
313
|
+
path: "/repos",
|
|
314
|
+
summary: "Repositories of the Bitbucket account",
|
|
315
|
+
schemas: {
|
|
316
|
+
querystring: zod_mini.z.object(tokenShape),
|
|
317
|
+
response: { 200: require_responseData.responseDataSchema(zod_mini.z.array(bitbucketRepositorySchema)) }
|
|
318
|
+
}
|
|
319
|
+
}),
|
|
320
|
+
checkConfig: require_defineRoute.defineRoute({
|
|
321
|
+
method: "POST",
|
|
322
|
+
path: "/check-config",
|
|
323
|
+
summary: "Find Intlayer configuration files in a repository",
|
|
324
|
+
schemas: {
|
|
325
|
+
body: zod_mini.z.object({
|
|
326
|
+
...tokenShape,
|
|
327
|
+
workspace: zod_mini.z.string(),
|
|
328
|
+
repoSlug: zod_mini.z.string(),
|
|
329
|
+
branch: zod_mini.z.optional(zod_mini.z.string())
|
|
330
|
+
}),
|
|
331
|
+
response: { 200: checkConfigResponseSchema }
|
|
332
|
+
}
|
|
333
|
+
}),
|
|
334
|
+
getConfigFile: require_defineRoute.defineRoute({
|
|
335
|
+
method: "POST",
|
|
336
|
+
path: "/get-config-file",
|
|
337
|
+
summary: "Read an Intlayer configuration file of a repository",
|
|
338
|
+
schemas: {
|
|
339
|
+
body: zod_mini.z.object({
|
|
340
|
+
...tokenShape,
|
|
341
|
+
...branchAndPathShape,
|
|
342
|
+
workspace: zod_mini.z.string(),
|
|
343
|
+
repoSlug: zod_mini.z.string()
|
|
344
|
+
}),
|
|
345
|
+
response: { 200: configFileResponseSchema }
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
//#endregion
|
|
352
|
+
exports.bitbucketContract = bitbucketContract;
|
|
353
|
+
exports.bitbucketRepositorySchema = bitbucketRepositorySchema;
|
|
354
|
+
exports.codebergContract = codebergContract;
|
|
355
|
+
exports.forgeRepositorySchema = forgeRepositorySchema;
|
|
356
|
+
exports.gitHubRepositorySchema = gitHubRepositorySchema;
|
|
357
|
+
exports.gitLabProjectSchema = gitLabProjectSchema;
|
|
358
|
+
exports.giteeContract = giteeContract;
|
|
359
|
+
exports.githubContract = githubContract;
|
|
360
|
+
exports.gitlabContract = gitlabContract;
|
|
361
|
+
//# sourceMappingURL=gitProviders.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitProviders.cjs","names":["responseDataSchema","z","defineRouteGroup","defineRoute"],"sources":["../../src/gitProviders.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n type RouteQuerystring,\n} from './defineRoute';\nimport { type ResponseData, responseDataSchema } from './responseData';\n\n/**\n * Git provider OAuth + repository routes (repository linking in the\n * dashboard). Each provider gets its own group; the shapes below are shared.\n */\n\nconst authUrlResponseSchema = responseDataSchema(\n z.object({ authUrl: z.string() })\n);\nconst tokenResponseSchema = responseDataSchema(z.object({ token: z.string() }));\nconst checkConfigResponseSchema = responseDataSchema(\n z.object({ hasConfig: z.boolean(), configPaths: z.array(z.string()) })\n);\nconst configFileResponseSchema = responseDataSchema(\n z.object({ content: z.string() })\n);\n\n/** Optional provider token: defaults to the one linked to the user. */\nconst tokenShape = { token: z.optional(z.string()) };\nconst branchAndPathShape = {\n branch: z.optional(z.string()),\n path: z.optional(z.string()),\n};\n\n/** GitHub repository (subset of the REST API item the dashboard reads). */\nexport const gitHubRepositorySchema = z.looseObject({\n id: z.number(),\n name: z.string(),\n full_name: z.string(),\n owner: z.looseObject({\n login: z.string(),\n avatar_url: z.optional(z.string()),\n }),\n private: z.boolean(),\n html_url: z.string(),\n default_branch: z.optional(z.string()),\n updated_at: z.optional(z.nullable(z.string())),\n});\n\n/** GitLab project (subset the dashboard reads). */\nexport const gitLabProjectSchema = z.looseObject({\n id: z.number(),\n name: z.string(),\n path_with_namespace: z.string(),\n web_url: z.string(),\n default_branch: z.string(),\n visibility: z.string(),\n last_activity_at: z.string(),\n namespace: z.looseObject({\n id: z.number(),\n name: z.string(),\n path: z.string(),\n }),\n});\n\n/** Bitbucket repository (subset the dashboard reads). */\nexport const bitbucketRepositorySchema = z.looseObject({\n uuid: z.string(),\n name: z.string(),\n full_name: z.string(),\n slug: z.string(),\n mainbranch: z.optional(z.looseObject({ name: z.string(), type: z.string() })),\n links: z.looseObject({ html: z.looseObject({ href: z.string() }) }),\n workspace: z.looseObject({\n slug: z.string(),\n name: z.string(),\n uuid: z.string(),\n }),\n is_private: z.optional(z.boolean()),\n updated_on: z.optional(z.string()),\n});\n\n/**\n * Repository of a Gitea-compatible forge (Codeberg/Forgejo, Gitee), normalized\n * by the backend. `name` is the URL slug used in API paths.\n */\nexport const forgeRepositorySchema = z.object({\n id: z.number(),\n name: z.string(),\n /** Human-readable name (can differ from the slug on Gitee). */\n displayName: z.string(),\n full_name: z.string(),\n owner: z.object({\n login: z.string(),\n avatar_url: z.optional(z.string()),\n }),\n private: z.boolean(),\n html_url: z.string(),\n default_branch: z.optional(z.string()),\n updated_at: z.optional(z.nullable(z.string())),\n});\n\nconst forgeRepositoryShape = {\n ...tokenShape,\n owner: z.string(),\n repository: z.string(),\n};\n\n/**\n * Builds the contract of a Gitea-compatible forge: repositories are listed and\n * read with the account linked through better-auth.\n */\nconst defineForgeContract = <Prefix extends string, Tag extends string>(\n prefix: Prefix,\n tag: Tag\n) =>\n defineRouteGroup({\n prefix,\n tag,\n routes: {\n listRepos: defineRoute({\n method: 'GET',\n path: '/repos',\n summary: `Repositories of the ${tag} account`,\n schemas: {\n querystring: z.object(tokenShape),\n response: {\n 200: responseDataSchema(z.array(forgeRepositorySchema)),\n },\n },\n }),\n checkConfig: defineRoute({\n method: 'POST',\n path: '/check-config',\n summary: 'Find Intlayer configuration files in a repository',\n schemas: {\n body: z.object({\n ...forgeRepositoryShape,\n branch: z.optional(z.string()),\n }),\n response: { 200: checkConfigResponseSchema },\n },\n }),\n getConfigFile: defineRoute({\n method: 'POST',\n path: '/get-config-file',\n summary: 'Read an Intlayer configuration file of a repository',\n schemas: {\n body: z.object({ ...forgeRepositoryShape, ...branchAndPathShape }),\n response: { 200: configFileResponseSchema },\n },\n }),\n },\n });\n\n/** REST contract of the `/api/codeberg` routes (Codeberg / Forgejo). */\nexport const codebergContract = defineForgeContract(\n '/api/codeberg',\n 'Codeberg'\n);\n\n/** REST contract of the `/api/gitee` routes. */\nexport const giteeContract = defineForgeContract('/api/gitee', 'Gitee');\n\n/** REST contract of the `/api/github` routes. */\nexport const githubContract = defineRouteGroup({\n prefix: '/api/github',\n tag: 'GitHub',\n routes: {\n getAuthUrl: defineRoute({\n method: 'GET',\n path: '/auth-url',\n summary: 'GitHub OAuth authorization URL',\n schemas: {\n querystring: z.object({\n redirectUri: z.string(),\n login: z.optional(z.string()),\n }),\n response: { 200: authUrlResponseSchema },\n },\n }),\n authCallback: defineRoute({\n method: 'POST',\n path: '/auth',\n summary: 'Exchange the OAuth code for a GitHub token',\n schemas: {\n body: z.object({ code: z.string() }),\n response: { 200: tokenResponseSchema },\n },\n }),\n listRepos: defineRoute({\n method: 'GET',\n path: '/repos',\n summary: 'Repositories of the GitHub account',\n schemas: {\n querystring: z.object(tokenShape),\n response: {\n 200: responseDataSchema(z.array(gitHubRepositorySchema)),\n },\n },\n }),\n checkConfig: defineRoute({\n method: 'POST',\n path: '/check-config',\n summary: 'Find Intlayer configuration files in a repository',\n schemas: {\n body: z.object({\n ...tokenShape,\n owner: z.string(),\n repository: z.string(),\n branch: z.optional(z.string()),\n }),\n response: { 200: checkConfigResponseSchema },\n },\n }),\n getConfigFile: defineRoute({\n method: 'POST',\n path: '/get-config-file',\n summary: 'Read an Intlayer configuration file of a repository',\n schemas: {\n body: z.object({\n ...tokenShape,\n ...branchAndPathShape,\n owner: z.string(),\n repository: z.string(),\n }),\n response: { 200: configFileResponseSchema },\n },\n }),\n getToken: defineRoute({\n method: 'GET',\n path: '/token',\n summary: \"GitHub token linked to the signed-in user's account\",\n schemas: {\n response: { 200: tokenResponseSchema },\n },\n }),\n },\n});\n\n/** REST contract of the `/api/gitlab` routes. */\nexport const gitlabContract = defineRouteGroup({\n prefix: '/api/gitlab',\n tag: 'GitLab',\n routes: {\n getAuthUrl: defineRoute({\n method: 'GET',\n path: '/auth-url',\n summary: 'GitLab OAuth authorization URL',\n schemas: {\n querystring: z.object({\n redirectUri: z.string(),\n /** Self-managed GitLab instance (ex: https://gitlab.company.com). */\n instanceUrl: z.optional(z.string()),\n login: z.optional(z.string()),\n }),\n response: { 200: authUrlResponseSchema },\n },\n }),\n authCallback: defineRoute({\n method: 'POST',\n path: '/auth',\n summary: 'Exchange the OAuth code for a GitLab token',\n schemas: {\n body: z.object({\n code: z.string(),\n redirectUri: z.string(),\n instanceUrl: z.optional(z.string()),\n }),\n response: { 200: tokenResponseSchema },\n },\n }),\n listProjects: defineRoute({\n method: 'GET',\n path: '/projects',\n summary: 'Projects of the GitLab account',\n schemas: {\n querystring: z.object({\n ...tokenShape,\n instanceUrl: z.optional(z.string()),\n }),\n response: { 200: responseDataSchema(z.array(gitLabProjectSchema)) },\n },\n }),\n checkConfig: defineRoute({\n method: 'POST',\n path: '/check-config',\n summary: 'Find Intlayer configuration files in a project',\n schemas: {\n body: z.object({\n ...tokenShape,\n projectId: z.number(),\n branch: z.optional(z.string()),\n instanceUrl: z.optional(z.string()),\n }),\n response: { 200: checkConfigResponseSchema },\n },\n }),\n getConfigFile: defineRoute({\n method: 'POST',\n path: '/get-config-file',\n summary: 'Read an Intlayer configuration file of a project',\n schemas: {\n body: z.object({\n ...tokenShape,\n ...branchAndPathShape,\n projectId: z.number(),\n instanceUrl: z.optional(z.string()),\n }),\n response: { 200: configFileResponseSchema },\n },\n }),\n },\n});\n\n/** REST contract of the `/api/bitbucket` routes. */\nexport const bitbucketContract = defineRouteGroup({\n prefix: '/api/bitbucket',\n tag: 'Bitbucket',\n routes: {\n getAuthUrl: defineRoute({\n method: 'GET',\n path: '/auth-url',\n summary: 'Bitbucket OAuth authorization URL',\n schemas: {\n querystring: z.object({ redirectUri: z.string() }),\n response: { 200: authUrlResponseSchema },\n },\n }),\n authCallback: defineRoute({\n method: 'POST',\n path: '/auth',\n summary: 'Exchange the OAuth code for a Bitbucket token',\n schemas: {\n body: z.object({ code: z.string() }),\n response: { 200: tokenResponseSchema },\n },\n }),\n listRepos: defineRoute({\n method: 'GET',\n path: '/repos',\n summary: 'Repositories of the Bitbucket account',\n schemas: {\n querystring: z.object(tokenShape),\n response: {\n 200: responseDataSchema(z.array(bitbucketRepositorySchema)),\n },\n },\n }),\n checkConfig: defineRoute({\n method: 'POST',\n path: '/check-config',\n summary: 'Find Intlayer configuration files in a repository',\n schemas: {\n body: z.object({\n ...tokenShape,\n workspace: z.string(),\n repoSlug: z.string(),\n branch: z.optional(z.string()),\n }),\n response: { 200: checkConfigResponseSchema },\n },\n }),\n getConfigFile: defineRoute({\n method: 'POST',\n path: '/get-config-file',\n summary: 'Read an Intlayer configuration file of a repository',\n schemas: {\n body: z.object({\n ...tokenShape,\n ...branchAndPathShape,\n workspace: z.string(),\n repoSlug: z.string(),\n }),\n response: { 200: configFileResponseSchema },\n },\n }),\n },\n});\n\nexport type GitHubRoutes = (typeof githubContract)['routes'];\nexport type GitLabRoutes = (typeof gitlabContract)['routes'];\nexport type BitbucketRoutes = (typeof bitbucketContract)['routes'];\n/** Routes shared by every Gitea-compatible forge (Codeberg, Gitee). */\nexport type ForgeRoutes = (typeof codebergContract)['routes'];\nexport type CodebergRoutes = ForgeRoutes;\nexport type GiteeRoutes = (typeof giteeContract)['routes'];\n\ntype AuthUrlResult = ResponseData<{ authUrl: string }>;\ntype TokenResult = ResponseData<{ token: string }>;\ntype CheckConfigResult = ResponseData<{\n hasConfig: boolean;\n configPaths: string[];\n}>;\ntype ConfigFileResult = ResponseData<{ content: string }>;\n\nexport type GitHubRepository = z.output<typeof gitHubRepositorySchema>;\nexport type GitLabProject = z.output<typeof gitLabProjectSchema>;\nexport type BitbucketRepository = z.output<typeof bitbucketRepositorySchema>;\nexport type ForgeRepository = z.output<typeof forgeRepositorySchema>;\n\nexport type GitHubGetAuthUrlQuerystring = RouteQuerystring<\n GitHubRoutes['getAuthUrl']\n>;\nexport type GitHubGetAuthUrlResult = AuthUrlResult;\nexport type GitHubAuthCallbackBody = RouteBodyInput<\n GitHubRoutes['authCallback']\n>;\nexport type GitHubAuthCallbackResult = TokenResult;\nexport type GitHubListReposQuerystring = RouteQuerystring<\n GitHubRoutes['listRepos']\n>;\nexport type GitHubListReposResult = ResponseData<GitHubRepository[]>;\nexport type GitHubCheckConfigBody = RouteBodyInput<GitHubRoutes['checkConfig']>;\nexport type GitHubCheckConfigResult = CheckConfigResult;\nexport type GitHubGetConfigFileBody = RouteBodyInput<\n GitHubRoutes['getConfigFile']\n>;\nexport type GitHubGetConfigFileResult = ConfigFileResult;\nexport type GitHubGetTokenResult = TokenResult;\n\nexport type GitLabGetAuthUrlQuerystring = RouteQuerystring<\n GitLabRoutes['getAuthUrl']\n>;\nexport type GitLabGetAuthUrlResult = AuthUrlResult;\nexport type GitLabAuthCallbackBody = RouteBodyInput<\n GitLabRoutes['authCallback']\n>;\nexport type GitLabAuthCallbackResult = TokenResult;\nexport type GitLabListProjectsQuerystring = RouteQuerystring<\n GitLabRoutes['listProjects']\n>;\nexport type GitLabListProjectsResult = ResponseData<GitLabProject[]>;\nexport type GitLabCheckConfigBody = RouteBodyInput<GitLabRoutes['checkConfig']>;\nexport type GitLabCheckConfigResult = CheckConfigResult;\nexport type GitLabGetConfigFileBody = RouteBodyInput<\n GitLabRoutes['getConfigFile']\n>;\nexport type GitLabGetConfigFileResult = ConfigFileResult;\n\nexport type BitbucketGetAuthUrlQuerystring = RouteQuerystring<\n BitbucketRoutes['getAuthUrl']\n>;\nexport type BitbucketGetAuthUrlResult = AuthUrlResult;\nexport type BitbucketAuthCallbackBody = RouteBodyInput<\n BitbucketRoutes['authCallback']\n>;\nexport type BitbucketAuthCallbackResult = TokenResult;\nexport type BitbucketListReposQuerystring = RouteQuerystring<\n BitbucketRoutes['listRepos']\n>;\nexport type BitbucketListReposResult = ResponseData<BitbucketRepository[]>;\nexport type BitbucketCheckConfigBody = RouteBodyInput<\n BitbucketRoutes['checkConfig']\n>;\nexport type BitbucketCheckConfigResult = CheckConfigResult;\nexport type BitbucketGetConfigFileBody = RouteBodyInput<\n BitbucketRoutes['getConfigFile']\n>;\nexport type BitbucketGetConfigFileResult = ConfigFileResult;\n\nexport type ForgeListReposQuerystring = RouteQuerystring<\n ForgeRoutes['listRepos']\n>;\nexport type ForgeListReposResult = ResponseData<ForgeRepository[]>;\nexport type ForgeCheckConfigBody = RouteBodyInput<ForgeRoutes['checkConfig']>;\nexport type ForgeCheckConfigResult = CheckConfigResult;\nexport type ForgeGetConfigFileBody = RouteBodyInput<\n ForgeRoutes['getConfigFile']\n>;\nexport type ForgeGetConfigFileResult = ConfigFileResult;\n"],"mappings":";;;;;;;;;;AAcA,MAAM,wBAAwBA,wCAC5BC,WAAE,OAAO,EAAE,SAASA,WAAE,OAAO,EAAE,CAAC,CAClC;AACA,MAAM,sBAAsBD,wCAAmBC,WAAE,OAAO,EAAE,OAAOA,WAAE,OAAO,EAAE,CAAC,CAAC;AAC9E,MAAM,4BAA4BD,wCAChCC,WAAE,OAAO;CAAE,WAAWA,WAAE,QAAQ;CAAG,aAAaA,WAAE,MAAMA,WAAE,OAAO,CAAC;AAAE,CAAC,CACvE;AACA,MAAM,2BAA2BD,wCAC/BC,WAAE,OAAO,EAAE,SAASA,WAAE,OAAO,EAAE,CAAC,CAClC;;AAGA,MAAM,aAAa,EAAE,OAAOA,WAAE,SAASA,WAAE,OAAO,CAAC,EAAE;AACnD,MAAM,qBAAqB;CACzB,QAAQA,WAAE,SAASA,WAAE,OAAO,CAAC;CAC7B,MAAMA,WAAE,SAASA,WAAE,OAAO,CAAC;AAC7B;;AAGA,MAAa,yBAAyBA,WAAE,YAAY;CAClD,IAAIA,WAAE,OAAO;CACb,MAAMA,WAAE,OAAO;CACf,WAAWA,WAAE,OAAO;CACpB,OAAOA,WAAE,YAAY;EACnB,OAAOA,WAAE,OAAO;EAChB,YAAYA,WAAE,SAASA,WAAE,OAAO,CAAC;CACnC,CAAC;CACD,SAASA,WAAE,QAAQ;CACnB,UAAUA,WAAE,OAAO;CACnB,gBAAgBA,WAAE,SAASA,WAAE,OAAO,CAAC;C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,aAAaF,WAAE,OAAO,EAAE,aAAaA,WAAE,OAAO,EAAE,CAAC;IACjD,UAAU,EAAE,KAAK,sBAAsB;GACzC;EACF,CAAC;EACD,cAAcE,gCAAY;GACxB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMF,WAAE,OAAO,EAAE,MAAMA,WAAE,OAAO,EAAE,CAAC;IACnC,UAAU,EAAE,KAAK,oBAAoB;GACvC;EACF,CAAC;EACD,WAAWE,gCAAY;GACrB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,aAAaF,WAAE,OAAO,UAAU;IAChC,UAAU,EACR,KAAKD,wCAAmBC,WAAE,MAAM,yBAAyB,CAAC,EAC5D;GACF;EACF,CAAC;EACD,aAAaE,gCAAY;GACvB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMF,WAAE,OAAO;KACb,GAAG;KACH,WAAWA,WAAE,OAAO;KACpB,UAAUA,WAAE,OAAO;KACnB,QAAQA,WAAE,SAASA,WAAE,OAAO,CAAC;IAC/B,CAAC;IACD,UAAU,EAAE,KAAK,0BAA0B;GAC7C;EACF,CAAC;EACD,eAAeE,gCAAY;GACzB,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMF,WAAE,OAAO;KACb,GAAG;KACH,GAAG;KACH,WAAWA,WAAE,OAAO;KACpB,UAAUA,WAAE,OAAO;IACrB,CAAC;IACD,UAAU,EAAE,KAAK,yBAAyB;GAC5C;EACF,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
3
|
+
const require_responseData = require('./responseData.cjs');
|
|
4
|
+
const require_user = require('./user.cjs');
|
|
5
|
+
let zod_mini = require("zod/mini");
|
|
6
|
+
|
|
7
|
+
//#region src/newsletter.ts
|
|
8
|
+
/** One mailing list or several. */
|
|
9
|
+
const emailListSchema = zod_mini.z.union([require_user.emailsListSchema, zod_mini.z.array(require_user.emailsListSchema)]);
|
|
10
|
+
/** REST contract of the `/api/newsletter` routes. */
|
|
11
|
+
const newsletterContract = require_defineRoute.defineRouteGroup({
|
|
12
|
+
prefix: "/api/newsletter",
|
|
13
|
+
tag: "Newsletter",
|
|
14
|
+
routes: {
|
|
15
|
+
subscribeToNewsletter: require_defineRoute.defineRoute({
|
|
16
|
+
method: "POST",
|
|
17
|
+
path: "/subscribe",
|
|
18
|
+
summary: "Subscribe an email to mailing lists",
|
|
19
|
+
schemas: {
|
|
20
|
+
body: zod_mini.z.object({
|
|
21
|
+
email: zod_mini.z.string().check(zod_mini.z.minLength(1)),
|
|
22
|
+
emailList: emailListSchema
|
|
23
|
+
}),
|
|
24
|
+
response: { 200: require_responseData.responseDataSchema(require_user.userSchema) }
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
unsubscribeFromNewsletter: require_defineRoute.defineRoute({
|
|
28
|
+
method: "POST",
|
|
29
|
+
path: "/unsubscribe",
|
|
30
|
+
summary: "Unsubscribe a user from mailing lists",
|
|
31
|
+
schemas: {
|
|
32
|
+
body: zod_mini.z.object({
|
|
33
|
+
userId: zod_mini.z.string(),
|
|
34
|
+
emailList: emailListSchema
|
|
35
|
+
}),
|
|
36
|
+
response: { 200: require_responseData.responseDataSchema(require_user.userSchema) }
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
getNewsletterStatus: require_defineRoute.defineRoute({
|
|
40
|
+
method: "GET",
|
|
41
|
+
path: "/status",
|
|
42
|
+
summary: "Mailing list subscriptions of the signed-in user",
|
|
43
|
+
schemas: { response: { 200: require_responseData.responseDataSchema(require_user.userSchema) } }
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.newsletterContract = newsletterContract;
|
|
50
|
+
//# sourceMappingURL=newsletter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newsletter.cjs","names":["z","emailsListSchema","defineRouteGroup","defineRoute","responseDataSchema","userSchema"],"sources":["../../src/newsletter.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n} from './defineRoute';\nimport { type ResponseData, responseDataSchema } from './responseData';\nimport { emailsListSchema, type UserAPI, userSchema } from './user';\n\n/** One mailing list or several. */\nconst emailListSchema = z.union([emailsListSchema, z.array(emailsListSchema)]);\n\n/** REST contract of the `/api/newsletter` routes. */\nexport const newsletterContract = defineRouteGroup({\n prefix: '/api/newsletter',\n tag: 'Newsletter',\n routes: {\n subscribeToNewsletter: defineRoute({\n method: 'POST',\n path: '/subscribe',\n summary: 'Subscribe an email to mailing lists',\n schemas: {\n body: z.object({\n email: z.string().check(z.minLength(1)),\n emailList: emailListSchema,\n }),\n response: { 200: responseDataSchema(userSchema) },\n },\n }),\n unsubscribeFromNewsletter: defineRoute({\n method: 'POST',\n path: '/unsubscribe',\n summary: 'Unsubscribe a user from mailing lists',\n schemas: {\n body: z.object({\n userId: z.string(),\n emailList: emailListSchema,\n }),\n response: { 200: responseDataSchema(userSchema) },\n },\n }),\n getNewsletterStatus: defineRoute({\n method: 'GET',\n path: '/status',\n summary: 'Mailing list subscriptions of the signed-in user',\n schemas: {\n response: { 200: responseDataSchema(userSchema) },\n },\n }),\n },\n});\n\n/** Route definitions of the `/api/newsletter` group, by name. */\nexport type NewsletterRoutes = (typeof newsletterContract)['routes'];\n\nexport type NewsletterSubscriptionBody = RouteBodyInput<\n NewsletterRoutes['subscribeToNewsletter']\n>;\nexport type NewsletterSubscriptionResult = ResponseData<UserAPI>;\nexport type NewsletterUnsubscriptionBody = RouteBodyInput<\n NewsletterRoutes['unsubscribeFromNewsletter']\n>;\nexport type NewsletterUnsubscriptionResult = ResponseData<UserAPI>;\nexport type GetNewsletterStatusResult = ResponseData<UserAPI>;\n"],"mappings":";;;;;;;;AAUA,MAAM,kBAAkBA,WAAE,MAAM,CAACC,+BAAkBD,WAAE,MAAMC,6BAAgB,CAAC,CAAC;;AAG7E,MAAa,qBAAqBC,qCAAiB;CACjD,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,uBAAuBC,gCAAY;GACjC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMH,WAAE,OAAO;KACb,OAAOA,WAAE,OAAO,CAAC,CAAC,MAAMA,WAAE,UAAU,CAAC,CAAC;KACtC,WAAW;IACb,CAAC;IACD,UAAU,EAAE,KAAKI,wCAAmBC,uBAAU,EAAE;GAClD;EACF,CAAC;EACD,2BAA2BF,gCAAY;GACrC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;IACP,MAAMH,WAAE,OAAO;KACb,QAAQA,WAAE,OAAO;KACjB,WAAW;IACb,CAAC;IACD,UAAU,EAAE,KAAKI,wCAAmBC,uBAAU,EAAE;GAClD;EACF,CAAC;EACD,qBAAqBF,gCAAY;GAC/B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EAAE,KAAKC,wCAAmBC,uBAAU,EAAE,EAClD;EACF,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_common = require('./common.cjs');
|
|
3
|
+
const require_defineRoute = require('./defineRoute.cjs');
|
|
4
|
+
const require_responseData = require('./responseData.cjs');
|
|
5
|
+
const require_project = require('./project.cjs');
|
|
6
|
+
const require_organization = require('./organization.cjs');
|
|
7
|
+
const require_user = require('./user.cjs');
|
|
8
|
+
let zod_mini = require("zod/mini");
|
|
9
|
+
|
|
10
|
+
//#region src/oAuth2.ts
|
|
11
|
+
/** Access token issued for an access key (client credentials). */
|
|
12
|
+
const oAuth2TokenSchema = zod_mini.z.looseObject({
|
|
13
|
+
accessToken: zod_mini.z.string(),
|
|
14
|
+
/** `null` for a token without expiry. */
|
|
15
|
+
accessTokenExpiresAt: zod_mini.z.optional(zod_mini.z.nullable(require_common.dateTimeSchema)),
|
|
16
|
+
grants: zod_mini.z.optional(zod_mini.z.array(zod_mini.z.string())),
|
|
17
|
+
client: zod_mini.z.looseObject({
|
|
18
|
+
id: zod_mini.z.string(),
|
|
19
|
+
grants: zod_mini.z.array(zod_mini.z.string())
|
|
20
|
+
}),
|
|
21
|
+
user: require_user.userSchema,
|
|
22
|
+
organization: require_organization.organizationSchema,
|
|
23
|
+
project: require_project.projectSchema
|
|
24
|
+
});
|
|
25
|
+
/** REST contract of the OAuth2 client-credentials routes. */
|
|
26
|
+
const oAuth2Contract = require_defineRoute.defineRouteGroup({
|
|
27
|
+
prefix: "/oauth2",
|
|
28
|
+
tag: "OAuth2",
|
|
29
|
+
routes: {
|
|
30
|
+
getOAuth2AccessToken: require_defineRoute.defineRoute({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/token",
|
|
33
|
+
summary: "Exchange access key credentials for an access token",
|
|
34
|
+
schemas: {
|
|
35
|
+
/**
|
|
36
|
+
* Documented only: the OAuth2 server validates it (credentials may
|
|
37
|
+
* also come from a Basic auth header) and answers spec errors.
|
|
38
|
+
*/
|
|
39
|
+
body: zod_mini.z.looseObject({
|
|
40
|
+
grant_type: zod_mini.z.optional(zod_mini.z.string()),
|
|
41
|
+
client_id: zod_mini.z.optional(zod_mini.z.string()),
|
|
42
|
+
client_secret: zod_mini.z.optional(zod_mini.z.string())
|
|
43
|
+
}),
|
|
44
|
+
response: { 200: require_responseData.responseDataSchema(oAuth2TokenSchema) }
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
extendOAuth2Token: require_defineRoute.defineRoute({
|
|
48
|
+
method: "POST",
|
|
49
|
+
path: "/token/extend",
|
|
50
|
+
summary: "Extend the lifetime of the current access token",
|
|
51
|
+
schemas: { response: { 200: require_responseData.responseDataSchema(zod_mini.z.object({
|
|
52
|
+
accessToken: zod_mini.z.string(),
|
|
53
|
+
accessTokenExpiresAt: require_common.dateTimeSchema
|
|
54
|
+
})) } }
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
exports.oAuth2Contract = oAuth2Contract;
|
|
61
|
+
exports.oAuth2TokenSchema = oAuth2TokenSchema;
|
|
62
|
+
//# sourceMappingURL=oAuth2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oAuth2.cjs","names":["z","dateTimeSchema","userSchema","organizationSchema","projectSchema","defineRouteGroup","defineRoute","responseDataSchema"],"sources":["../../src/oAuth2.ts"],"sourcesContent":["import { z } from 'zod/mini';\nimport { dateTimeSchema } from './common';\nimport {\n defineRoute,\n defineRouteGroup,\n type RouteBodyInput,\n} from './defineRoute';\nimport { organizationSchema } from './organization';\nimport { projectSchema } from './project';\nimport { type ResponseData, responseDataSchema } from './responseData';\nimport { userSchema } from './user';\n\n/** Access token issued for an access key (client credentials). */\nexport const oAuth2TokenSchema = z.looseObject({\n accessToken: z.string(),\n /** `null` for a token without expiry. */\n accessTokenExpiresAt: z.optional(z.nullable(dateTimeSchema)),\n grants: z.optional(z.array(z.string())),\n client: z.looseObject({ id: z.string(), grants: z.array(z.string()) }),\n user: userSchema,\n organization: organizationSchema,\n project: projectSchema,\n});\n\n/** REST contract of the OAuth2 client-credentials routes. */\nexport const oAuth2Contract = defineRouteGroup({\n prefix: '/oauth2',\n tag: 'OAuth2',\n routes: {\n getOAuth2AccessToken: defineRoute({\n method: 'POST',\n path: '/token',\n summary: 'Exchange access key credentials for an access token',\n schemas: {\n /**\n * Documented only: the OAuth2 server validates it (credentials may\n * also come from a Basic auth header) and answers spec errors.\n */\n body: z.looseObject({\n grant_type: z.optional(z.string()),\n client_id: z.optional(z.string()),\n client_secret: z.optional(z.string()),\n }),\n response: { 200: responseDataSchema(oAuth2TokenSchema) },\n },\n }),\n extendOAuth2Token: defineRoute({\n method: 'POST',\n path: '/token/extend',\n summary: 'Extend the lifetime of the current access token',\n schemas: {\n response: {\n 200: responseDataSchema(\n z.object({\n accessToken: z.string(),\n accessTokenExpiresAt: dateTimeSchema,\n })\n ),\n },\n },\n }),\n },\n});\n\n/** Route definitions of the OAuth2 group, by name. */\nexport type OAuth2Routes = (typeof oAuth2Contract)['routes'];\n\nexport type OAuth2Token = z.output<typeof oAuth2TokenSchema>;\nexport type GetOAuth2TokenBody = RouteBodyInput<\n OAuth2Routes['getOAuth2AccessToken']\n>;\nexport type GetOAuth2TokenResult = ResponseData<OAuth2Token>;\nexport type ExtendOAuth2TokenResult = ResponseData<{\n accessToken: string;\n accessTokenExpiresAt: string;\n}>;\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,oBAAoBA,WAAE,YAAY;CAC7C,aAAaA,WAAE,OAAO;;CAEtB,sBAAsBA,WAAE,SAASA,WAAE,SAASC,6BAAc,CAAC;CAC3D,QAAQD,WAAE,SAASA,WAAE,MAAMA,WAAE,OAAO,CAAC,CAAC;CACtC,QAAQA,WAAE,YAAY;EAAE,IAAIA,WAAE,OAAO;EAAG,QAAQA,WAAE,MAAMA,WAAE,OAAO,CAAC;CAAE,CAAC;CACrE,MAAME;CACN,cAAcC;CACd,SAASC;AACX,CAAC;;AAGD,MAAa,iBAAiBC,qCAAiB;CAC7C,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,sBAAsBC,gCAAY;GAChC,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS;;;;;IAKP,MAAMN,WAAE,YAAY;KAClB,YAAYA,WAAE,SAASA,WAAE,OAAO,CAAC;KACjC,WAAWA,WAAE,SAASA,WAAE,OAAO,CAAC;KAChC,eAAeA,WAAE,SAASA,WAAE,OAAO,CAAC;IACtC,CAAC;IACD,UAAU,EAAE,KAAKO,wCAAmB,iBAAiB,EAAE;GACzD;EACF,CAAC;EACD,mBAAmBD,gCAAY;GAC7B,QAAQ;GACR,MAAM;GACN,SAAS;GACT,SAAS,EACP,UAAU,EACR,KAAKC,wCACHP,WAAE,OAAO;IACP,aAAaA,WAAE,OAAO;IACtB,sBAAsBC;GACxB,CAAC,CACH,EACF,EACF;EACF,CAAC;CACH;AACF,CAAC"}
|