mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 20:20:16 +00:00
Initial commit of eigent-main
This commit is contained in:
commit
723df5a03e
1144 changed files with 103478 additions and 0 deletions
11
package/@stackframe/stack-shared/dist/helpers/password.d.mts
vendored
Normal file
11
package/@stackframe/stack-shared/dist/helpers/password.d.mts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import '../crud.mjs';
|
||||
import { KnownErrors } from '../known-errors.mjs';
|
||||
import 'yup';
|
||||
import '../utils/types.mjs';
|
||||
import '../utils/errors.mjs';
|
||||
import '../utils/json.mjs';
|
||||
import '../utils/results.mjs';
|
||||
|
||||
declare function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined;
|
||||
|
||||
export { getPasswordError };
|
||||
11
package/@stackframe/stack-shared/dist/helpers/password.d.ts
vendored
Normal file
11
package/@stackframe/stack-shared/dist/helpers/password.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import '../crud.js';
|
||||
import { KnownErrors } from '../known-errors.js';
|
||||
import 'yup';
|
||||
import '../utils/types.js';
|
||||
import '../utils/errors.js';
|
||||
import '../utils/json.js';
|
||||
import '../utils/results.js';
|
||||
|
||||
declare function getPasswordError(password: string): KnownErrors["PasswordRequirementsNotMet"] | undefined;
|
||||
|
||||
export { getPasswordError };
|
||||
42
package/@stackframe/stack-shared/dist/helpers/password.js
vendored
Normal file
42
package/@stackframe/stack-shared/dist/helpers/password.js
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/helpers/password.ts
|
||||
var password_exports = {};
|
||||
__export(password_exports, {
|
||||
getPasswordError: () => getPasswordError
|
||||
});
|
||||
module.exports = __toCommonJS(password_exports);
|
||||
var import__ = require("..");
|
||||
var minLength = 8;
|
||||
var maxLength = 70;
|
||||
function getPasswordError(password) {
|
||||
if (password.length < minLength) {
|
||||
return new import__.KnownErrors.PasswordTooShort(minLength);
|
||||
}
|
||||
if (password.length > maxLength) {
|
||||
return new import__.KnownErrors.PasswordTooLong(maxLength);
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getPasswordError
|
||||
});
|
||||
//# sourceMappingURL=password.js.map
|
||||
1
package/@stackframe/stack-shared/dist/helpers/password.js.map
vendored
Normal file
1
package/@stackframe/stack-shared/dist/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;AAAA;AAAA;AAAA;AAAA;AAAA,eAA4B;AAE5B,IAAM,YAAY;AAClB,IAAM,YAAY;AAEX,SAAS,iBAAiB,UAAyE;AACxG,MAAI,SAAS,SAAS,WAAW;AAC/B,WAAO,IAAI,qBAAY,iBAAiB,SAAS;AAAA,EACnD;AAEA,MAAI,SAAS,SAAS,WAAW;AAC/B,WAAO,IAAI,qBAAY,gBAAgB,SAAS;AAAA,EAClD;AAEA,SAAO;AACT;","names":[]}
|
||||
12
package/@stackframe/stack-shared/dist/helpers/production-mode.d.mts
vendored
Normal file
12
package/@stackframe/stack-shared/dist/helpers/production-mode.d.mts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { ProjectsCrud } from '../interface/crud/projects.mjs';
|
||||
import '../crud.mjs';
|
||||
import 'yup';
|
||||
import '../utils/types.mjs';
|
||||
|
||||
type ProductionModeError = {
|
||||
message: string;
|
||||
relativeFixUrl: `/${string}`;
|
||||
};
|
||||
declare function getProductionModeErrors(project: ProjectsCrud["Admin"]["Read"]): ProductionModeError[];
|
||||
|
||||
export { type ProductionModeError, getProductionModeErrors };
|
||||
12
package/@stackframe/stack-shared/dist/helpers/production-mode.d.ts
vendored
Normal file
12
package/@stackframe/stack-shared/dist/helpers/production-mode.d.ts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { ProjectsCrud } from '../interface/crud/projects.js';
|
||||
import '../crud.js';
|
||||
import 'yup';
|
||||
import '../utils/types.js';
|
||||
|
||||
type ProductionModeError = {
|
||||
message: string;
|
||||
relativeFixUrl: `/${string}`;
|
||||
};
|
||||
declare function getProductionModeErrors(project: ProjectsCrud["Admin"]["Read"]): ProductionModeError[];
|
||||
|
||||
export { type ProductionModeError, getProductionModeErrors };
|
||||
75
package/@stackframe/stack-shared/dist/helpers/production-mode.js
vendored
Normal file
75
package/@stackframe/stack-shared/dist/helpers/production-mode.js
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/helpers/production-mode.ts
|
||||
var production_mode_exports = {};
|
||||
__export(production_mode_exports, {
|
||||
getProductionModeErrors: () => getProductionModeErrors
|
||||
});
|
||||
module.exports = __toCommonJS(production_mode_exports);
|
||||
var import_errors = require("../utils/errors");
|
||||
var import_urls = require("../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) {
|
||||
(0, import_errors.captureError)("production-mode-domain-not-valid", new import_errors.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 ((0, import_urls.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;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getProductionModeErrors
|
||||
});
|
||||
//# sourceMappingURL=production-mode.js.map
|
||||
1
package/@stackframe/stack-shared/dist/helpers/production-mode.js.map
vendored
Normal file
1
package/@stackframe/stack-shared/dist/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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAkD;AAClD,kBAA4B;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,sCAAa,oCAAoC,IAAI,kCAAoB,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,YAAI,yBAAY,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