mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 14:27:30 +00:00
feat(infisical-pg): added slug for org and project, resolved build error
This commit is contained in:
Generated
+52
@@ -23,6 +23,7 @@
|
|||||||
"@node-saml/passport-saml": "^4.0.4",
|
"@node-saml/passport-saml": "^4.0.4",
|
||||||
"@octokit/rest": "^20.0.2",
|
"@octokit/rest": "^20.0.2",
|
||||||
"@octokit/webhooks-types": "^7.3.1",
|
"@octokit/webhooks-types": "^7.3.1",
|
||||||
|
"@sindresorhus/slugify": "^2.2.1",
|
||||||
"@ucast/mongo2js": "^1.3.4",
|
"@ucast/mongo2js": "^1.3.4",
|
||||||
"ajv": "^8.12.0",
|
"ajv": "^8.12.0",
|
||||||
"argon2": "^0.31.2",
|
"argon2": "^0.31.2",
|
||||||
@@ -2759,6 +2760,57 @@
|
|||||||
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
|
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@sindresorhus/slugify": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/transliterate": "^1.0.0",
|
||||||
|
"escape-string-regexp": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sindresorhus/slugify/node_modules/escape-string-regexp": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sindresorhus/transliterate": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"escape-string-regexp": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sindresorhus/transliterate/node_modules/escape-string-regexp": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@smithy/abort-controller": {
|
"node_modules/@smithy/abort-controller": {
|
||||||
"version": "2.0.16",
|
"version": "2.0.16",
|
||||||
"resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.16.tgz",
|
"resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.16.tgz",
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
"@node-saml/passport-saml": "^4.0.4",
|
"@node-saml/passport-saml": "^4.0.4",
|
||||||
"@octokit/rest": "^20.0.2",
|
"@octokit/rest": "^20.0.2",
|
||||||
"@octokit/webhooks-types": "^7.3.1",
|
"@octokit/webhooks-types": "^7.3.1",
|
||||||
|
"@sindresorhus/slugify": "^2.2.1",
|
||||||
"@ucast/mongo2js": "^1.3.4",
|
"@ucast/mongo2js": "^1.3.4",
|
||||||
"ajv": "^8.12.0",
|
"ajv": "^8.12.0",
|
||||||
"argon2": "^0.31.2",
|
"argon2": "^0.31.2",
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
|
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
|
||||||
t.string("name").notNullable();
|
t.string("name").notNullable();
|
||||||
t.string("customerId");
|
t.string("customerId");
|
||||||
|
t.string("slug").notNullable();
|
||||||
// does not need update trigger we will do it manually
|
// does not need update trigger we will do it manually
|
||||||
|
t.unique("slug");
|
||||||
t.timestamps(true, true, true);
|
t.timestamps(true, true, true);
|
||||||
});
|
});
|
||||||
await knex.schema.alterTable(TableName.AuthTokens, (t) => {
|
await knex.schema.alterTable(TableName.AuthTokens, (t) => {
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
await knex.schema.createTable(TableName.Project, (t) => {
|
await knex.schema.createTable(TableName.Project, (t) => {
|
||||||
t.string("id", 36).primary().defaultTo(knex.fn.uuid());
|
t.string("id", 36).primary().defaultTo(knex.fn.uuid());
|
||||||
t.string("name").notNullable();
|
t.string("name").notNullable();
|
||||||
|
t.string("slug").notNullable();
|
||||||
t.boolean("autoCapitalization").defaultTo(true);
|
t.boolean("autoCapitalization").defaultTo(true);
|
||||||
t.uuid("orgId").notNullable();
|
t.uuid("orgId").notNullable();
|
||||||
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
|
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
|
||||||
t.timestamps(true, true, true);
|
t.timestamps(true, true, true);
|
||||||
|
t.unique(["orgId", "slug"]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await createOnUpdateTrigger(knex, TableName.Project);
|
await createOnUpdateTrigger(knex, TableName.Project);
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ export const OrganizationsSchema = z.object({
|
|||||||
id: z.string().uuid(),
|
id: z.string().uuid(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
customerId: z.string().nullable().optional(),
|
customerId: z.string().nullable().optional(),
|
||||||
|
slug: z.string(),
|
||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
updatedAt: z.date(),
|
updatedAt: z.date()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TOrganizations = z.infer<typeof OrganizationsSchema>;
|
export type TOrganizations = z.infer<typeof OrganizationsSchema>;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { TImmutableDBKeys } from "./models";
|
|||||||
export const ProjectsSchema = z.object({
|
export const ProjectsSchema = z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
|
slug: z.string(),
|
||||||
autoCapitalization: z.boolean().default(true).nullable().optional(),
|
autoCapitalization: z.boolean().default(true).nullable().optional(),
|
||||||
orgId: z.string().uuid(),
|
orgId: z.string().uuid(),
|
||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
|
|||||||
@@ -1,5 +1,2 @@
|
|||||||
export {
|
export type { TSecretRotationQueueFactory } from "./secret-rotation-queue";
|
||||||
DisableRotationErrors,
|
export { DisableRotationErrors, secretRotationQueueFactory } from "./secret-rotation-queue";
|
||||||
secretRotationQueueFactory,
|
|
||||||
TSecretRotationQueueFactory
|
|
||||||
} from "./secret-rotation-queue";
|
|
||||||
|
|||||||
@@ -1,7 +1,2 @@
|
|||||||
export {
|
export type { TQueueJobTypes, TQueueServiceFactory } from "./queue-service";
|
||||||
QueueJobs,
|
export { QueueJobs, QueueName, queueServiceFactory } from "./queue-service";
|
||||||
QueueName,
|
|
||||||
queueServiceFactory,
|
|
||||||
TQueueJobTypes,
|
|
||||||
TQueueServiceFactory
|
|
||||||
} from "./queue-service";
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
|
import slugify from "@sindresorhus/slugify";
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
|
|
||||||
import { OrgMembershipRole, OrgMembershipStatus } from "@app/db/schemas";
|
import { OrgMembershipRole, OrgMembershipStatus } from "@app/db/schemas";
|
||||||
@@ -13,6 +14,7 @@ import { getConfig } from "@app/lib/config/env";
|
|||||||
import { generateAsymmetricKeyPair } from "@app/lib/crypto";
|
import { generateAsymmetricKeyPair } from "@app/lib/crypto";
|
||||||
import { generateSymmetricKey, infisicalSymmetricEncypt } from "@app/lib/crypto/encryption";
|
import { generateSymmetricKey, infisicalSymmetricEncypt } from "@app/lib/crypto/encryption";
|
||||||
import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
|
import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
|
||||||
|
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||||
import { isDisposableEmail } from "@app/lib/validator";
|
import { isDisposableEmail } from "@app/lib/validator";
|
||||||
|
|
||||||
import { AuthMethod, AuthTokenType } from "../auth/auth-type";
|
import { AuthMethod, AuthTokenType } from "../auth/auth-type";
|
||||||
@@ -128,7 +130,11 @@ export const orgServiceFactory = ({
|
|||||||
|
|
||||||
const customerId = await licenseService.generateOrgCustomerId(orgName, userEmail);
|
const customerId = await licenseService.generateOrgCustomerId(orgName, userEmail);
|
||||||
const organization = await orgDAL.transaction(async (tx) => {
|
const organization = await orgDAL.transaction(async (tx) => {
|
||||||
const org = await orgDAL.create({ name: orgName, customerId }, tx);
|
// akhilmhdh: for now this is auto created. in future we can input from user and for previous users just modifiy
|
||||||
|
const org = await orgDAL.create(
|
||||||
|
{ name: orgName, customerId, slug: slugify(`${orgName}-${alphaNumericNanoId(4)}`) },
|
||||||
|
tx
|
||||||
|
);
|
||||||
await orgDAL.createMembership(
|
await orgDAL.createMembership(
|
||||||
{
|
{
|
||||||
userId,
|
userId,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
|
import slugify from "@sindresorhus/slugify";
|
||||||
|
|
||||||
import { ProjectMembershipRole } from "@app/db/schemas";
|
import { ProjectMembershipRole } from "@app/db/schemas";
|
||||||
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
|
||||||
@@ -14,6 +15,7 @@ import {
|
|||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { createSecretBlindIndex } from "@app/lib/crypto";
|
import { createSecretBlindIndex } from "@app/lib/crypto";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
|
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||||
|
|
||||||
import { TProjectEnvDALFactory } from "../project-env/project-env-dal";
|
import { TProjectEnvDALFactory } from "../project-env/project-env-dal";
|
||||||
import { TProjectMembershipDALFactory } from "../project-membership/project-membership-dal";
|
import { TProjectMembershipDALFactory } from "../project-membership/project-membership-dal";
|
||||||
@@ -73,7 +75,10 @@ export const projectServiceFactory = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newProject = projectDAL.transaction(async (tx) => {
|
const newProject = projectDAL.transaction(async (tx) => {
|
||||||
const project = await projectDAL.create({ name: workspaceName, orgId }, tx);
|
const project = await projectDAL.create(
|
||||||
|
{ name: workspaceName, orgId, slug: slugify(`${workspaceName}-${alphaNumericNanoId(4)}`) },
|
||||||
|
tx
|
||||||
|
);
|
||||||
// set user as admin member for proeject
|
// set user as admin member for proeject
|
||||||
await projectMembershipDAL.create(
|
await projectMembershipDAL.create(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -475,10 +475,8 @@ const OrganizationPage = withPermission(
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const { workspaces, isLoading: isWorkspaceLoading } = useWorkspace();
|
const { workspaces, isLoading: isWorkspaceLoading } = useWorkspace();
|
||||||
const orgWorkspaces =
|
|
||||||
workspaces?.filter((workspace) => workspace.orgId === localStorage.getItem("orgData.id")) ||
|
|
||||||
[];
|
|
||||||
const currentOrg = String(router.query.id);
|
const currentOrg = String(router.query.id);
|
||||||
|
const orgWorkspaces = workspaces?.filter((workspace) => workspace.orgId === currentOrg) || [];
|
||||||
const { createNotification } = useNotificationContext();
|
const { createNotification } = useNotificationContext();
|
||||||
const addWsUser = useAddUserToWs();
|
const addWsUser = useAddUserToWs();
|
||||||
|
|
||||||
@@ -614,21 +612,29 @@ const OrganizationPage = withPermission(
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="mb-4 flex flex-col items-start justify-start px-6 py-6 pb-0 text-3xl">
|
<div className="mb-4 flex flex-col items-start justify-start px-6 py-6 pb-0 text-3xl">
|
||||||
<div className={`${
|
<div
|
||||||
|
className={`${
|
||||||
!updateClosed ? "block" : "hidden"
|
!updateClosed ? "block" : "hidden"
|
||||||
} mb-4 w-full border rounded-md p-2 text-base border-primary-600 bg-primary/10 text-white flex flex-row items-center`}>
|
} mb-4 flex w-full flex-row items-center rounded-md border border-primary-600 bg-primary/10 p-2 text-base text-white`}
|
||||||
<FontAwesomeIcon icon={faWarning} className="text-primary text-4xl p-6"/>
|
>
|
||||||
<div className="text-sm">
|
<FontAwesomeIcon icon={faWarning} className="p-6 text-4xl text-primary" />
|
||||||
<span className="text-lg font-semibold">Scheduled maintenance on January 27th</span> <br />
|
<div className="text-sm">
|
||||||
We've planned a database upgrade and need to pause certain functionality for approximately 3 hours on Saturday, January 27th, 10am EST. During these hours, read operations will continue to function normally but no resources will be editable. No action is required on your end — your applications can continue to fetch secrets.<br />
|
<span className="text-lg font-semibold">Scheduled maintenance on January 27th</span>{" "}
|
||||||
</div>
|
<br />
|
||||||
<button
|
We've planned a database upgrade and need to pause certain functionality for
|
||||||
type="button"
|
approximately 3 hours on Saturday, January 27th, 10am EST. During these hours, read
|
||||||
onClick={() => closeUpdate()}
|
operations will continue to function normally but no resources will be editable. No
|
||||||
className="text-mineshaft-100 duration-200 hover:text-red-400 h-full flex items-start"
|
action is required on your end — your applications can continue to fetch secrets.
|
||||||
>
|
<br />
|
||||||
<FontAwesomeIcon icon={faXmark} />
|
</div>
|
||||||
</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => closeUpdate()}
|
||||||
|
aria-label="close"
|
||||||
|
className="flex h-full items-start text-mineshaft-100 duration-200 hover:text-red-400"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon icon={faXmark} />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p className="mr-4 font-semibold text-white">Projects</p>
|
<p className="mr-4 font-semibold text-white">Projects</p>
|
||||||
<div className="mt-6 flex w-full flex-row">
|
<div className="mt-6 flex w-full flex-row">
|
||||||
|
|||||||
Reference in New Issue
Block a user