mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 04:00:09 +00:00
Initial commit of eigent-main
This commit is contained in:
commit
723df5a03e
1144 changed files with 103478 additions and 0 deletions
17
package/@stackframe/stack-shared/dist/esm/helpers/password.js
vendored
Normal file
17
package/@stackframe/stack-shared/dist/esm/helpers/password.js
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// src/helpers/password.ts
|
||||
import { KnownErrors } from "..";
|
||||
var minLength = 8;
|
||||
var maxLength = 70;
|
||||
function getPasswordError(password) {
|
||||
if (password.length < minLength) {
|
||||
return new KnownErrors.PasswordTooShort(minLength);
|
||||
}
|
||||
if (password.length > maxLength) {
|
||||
return new KnownErrors.PasswordTooLong(maxLength);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
export {
|
||||
getPasswordError
|
||||
};
|
||||
//# sourceMappingURL=password.js.map
|
||||
1
package/@stackframe/stack-shared/dist/esm/helpers/password.js.map
vendored
Normal file
1
package/@stackframe/stack-shared/dist/esm/helpers/password.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/helpers/password.ts"],"sourcesContent":["import { KnownErrors } from \"..\";\n\nconst minLength = 8;\nconst maxLength = 70;\n\nexport function getPasswordError(password: string): KnownErrors[\"PasswordRequirementsNotMet\"] | undefined {\n if (password.length < minLength) {\n return new KnownErrors.PasswordTooShort(minLength);\n }\n\n if (password.length > maxLength) {\n return new KnownErrors.PasswordTooLong(maxLength);\n }\n\n return undefined;\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,IAAM,YAAY;AAClB,IAAM,YAAY;AAEX,SAAS,iBAAiB,UAAyE;AACxG,MAAI,SAAS,SAAS,WAAW;AAC/B,WAAO,IAAI,YAAY,iBAAiB,SAAS;AAAA,EACnD;AAEA,MAAI,SAAS,SAAS,WAAW;AAC/B,WAAO,IAAI,YAAY,gBAAgB,SAAS;AAAA,EAClD;AAEA,SAAO;AACT;","names":[]}
|
||||
50
package/@stackframe/stack-shared/dist/esm/helpers/production-mode.js
vendored
Normal file
50
package/@stackframe/stack-shared/dist/esm/helpers/production-mode.js
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// src/helpers/production-mode.ts
|
||||
import { StackAssertionError, captureError } from "../utils/errors";
|
||||
import { isLocalhost } from "../utils/urls";
|
||||
function getProductionModeErrors(project) {
|
||||
const errors = [];
|
||||
const domainsFixUrl = `/projects/${project.id}/domains`;
|
||||
if (project.config.allow_localhost) {
|
||||
errors.push({
|
||||
message: "Localhost is not allowed in production mode, turn off 'Allow localhost' in project settings",
|
||||
relativeFixUrl: domainsFixUrl
|
||||
});
|
||||
}
|
||||
for (const { domain } of project.config.domains) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(domain);
|
||||
} catch (e) {
|
||||
captureError("production-mode-domain-not-valid", new StackAssertionError("Domain was somehow not a valid URL; we should've caught this when setting the domain in the first place", {
|
||||
domain,
|
||||
projectId: project
|
||||
}));
|
||||
errors.push({
|
||||
message: "Trusted domain is not a valid URL: " + domain,
|
||||
relativeFixUrl: domainsFixUrl
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (isLocalhost(url)) {
|
||||
errors.push({
|
||||
message: "Localhost domains are not allowed to be trusted in production mode: " + domain,
|
||||
relativeFixUrl: domainsFixUrl
|
||||
});
|
||||
} else if (url.hostname.match(/^\d+(\.\d+)*$/)) {
|
||||
errors.push({
|
||||
message: "Direct IPs are not valid for trusted domains in production mode: " + domain,
|
||||
relativeFixUrl: domainsFixUrl
|
||||
});
|
||||
} else if (url.protocol !== "https:") {
|
||||
errors.push({
|
||||
message: "Trusted domains should be HTTPS: " + domain,
|
||||
relativeFixUrl: domainsFixUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
export {
|
||||
getProductionModeErrors
|
||||
};
|
||||
//# sourceMappingURL=production-mode.js.map
|
||||
1
package/@stackframe/stack-shared/dist/esm/helpers/production-mode.js.map
vendored
Normal file
1
package/@stackframe/stack-shared/dist/esm/helpers/production-mode.js.map
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["../../../src/helpers/production-mode.ts"],"sourcesContent":["import { ProjectsCrud } from \"../interface/crud/projects\";\nimport { StackAssertionError, captureError } from \"../utils/errors\";\nimport { isLocalhost } from \"../utils/urls\";\n\nexport type ProductionModeError = {\n message: string,\n relativeFixUrl: `/${string}`,\n};\n\nexport function getProductionModeErrors(project: ProjectsCrud[\"Admin\"][\"Read\"]): ProductionModeError[] {\n const errors: ProductionModeError[] = [];\n const domainsFixUrl = `/projects/${project.id}/domains` as const;\n\n if (project.config.allow_localhost) {\n errors.push({\n message: \"Localhost is not allowed in production mode, turn off 'Allow localhost' in project settings\",\n relativeFixUrl: domainsFixUrl,\n });\n }\n\n for (const { domain } of project.config.domains) {\n let url;\n try {\n url = new URL(domain);\n } catch (e) {\n captureError(\"production-mode-domain-not-valid\", new StackAssertionError(\"Domain was somehow not a valid URL; we should've caught this when setting the domain in the first place\", {\n domain,\n projectId: project\n }));\n errors.push({\n message: \"Trusted domain is not a valid URL: \" + domain,\n relativeFixUrl: domainsFixUrl,\n });\n continue;\n }\n\n if (isLocalhost(url)) {\n errors.push({\n message: \"Localhost domains are not allowed to be trusted in production mode: \" + domain,\n relativeFixUrl: domainsFixUrl,\n });\n } else if (url.hostname.match(/^\\d+(\\.\\d+)*$/)) {\n errors.push({\n message: \"Direct IPs are not valid for trusted domains in production mode: \" + domain,\n relativeFixUrl: domainsFixUrl,\n });\n } else if (url.protocol !== \"https:\") {\n errors.push({\n message: \"Trusted domains should be HTTPS: \" + domain,\n relativeFixUrl: domainsFixUrl,\n });\n }\n }\n\n return errors;\n}\n"],"mappings":";AACA,SAAS,qBAAqB,oBAAoB;AAClD,SAAS,mBAAmB;AAOrB,SAAS,wBAAwB,SAA+D;AACrG,QAAM,SAAgC,CAAC;AACvC,QAAM,gBAAgB,aAAa,QAAQ,EAAE;AAE7C,MAAI,QAAQ,OAAO,iBAAiB;AAClC,WAAO,KAAK;AAAA,MACV,SAAS;AAAA,MACT,gBAAgB;AAAA,IAClB,CAAC;AAAA,EACH;AAEA,aAAW,EAAE,OAAO,KAAK,QAAQ,OAAO,SAAS;AAC/C,QAAI;AACJ,QAAI;AACF,YAAM,IAAI,IAAI,MAAM;AAAA,IACtB,SAAS,GAAG;AACV,mBAAa,oCAAoC,IAAI,oBAAoB,2GAA2G;AAAA,QAClL;AAAA,QACA,WAAW;AAAA,MACb,CAAC,CAAC;AACF,aAAO,KAAK;AAAA,QACV,SAAS,wCAAwC;AAAA,QACjD,gBAAgB;AAAA,MAClB,CAAC;AACD;AAAA,IACF;AAEA,QAAI,YAAY,GAAG,GAAG;AACpB,aAAO,KAAK;AAAA,QACV,SAAS,yEAAyE;AAAA,QAClF,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH,WAAW,IAAI,SAAS,MAAM,eAAe,GAAG;AAC9C,aAAO,KAAK;AAAA,QACV,SAAS,sEAAsE;AAAA,QAC/E,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH,WAAW,IAAI,aAAa,UAAU;AACpC,aAAO,KAAK;AAAA,QACV,SAAS,sCAAsC;AAAA,QAC/C,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue