Commit 821b31c3 authored by John Chilton's avatar John Chilton
Browse files

More structured indexing for user data objects.

I think I clung to the idea of having two ways to do this too long. I did a bunch of testing with the old way (exposing integer references based on numeric database primary keys). Having a config option that if changed would break everything exisiting is also a symptom of maybe me clinging too hard for too long.

The result of dropping this option is a much cleaner API schema, simpler API objects, and better typing throughout. We can also be more certain of how things entering the Vault are stored - I think being more strucutured about this is good.

Ultimately, the future facing stuff (e.g. OAuth 2.0) is going to require UUIDs so that I can store things like refresh tokens in the store before the object has been fully created.
parent d4a4b91a
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -12812,8 +12812,6 @@ export interface components {
            device?: string | null;
            /** Hidden */
            hidden: boolean;
            /** Id */
            id: number | string;
            /** Name */
            name?: string | null;
            /** Object Store Id */
@@ -12891,8 +12889,6 @@ export interface components {
            description: string | null;
            /** Hidden */
            hidden: boolean;
            /** Id */
            id: string | number;
            /** Name */
            name: string;
            /** Purged */
@@ -15195,7 +15191,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The index for a persisted UserFileSourceStore object. */
            /** @description The UUID index for a persisted UserFileSourceStore object. */
            path: {
                user_file_source_id: string;
            };
@@ -15222,7 +15218,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The index for a persisted UserFileSourceStore object. */
            /** @description The UUID index for a persisted UserFileSourceStore object. */
            path: {
                user_file_source_id: string;
            };
@@ -15257,7 +15253,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The index for a persisted UserFileSourceStore object. */
            /** @description The UUID index for a persisted UserFileSourceStore object. */
            path: {
                user_file_source_id: string;
            };
@@ -21119,7 +21115,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The identifier used to index a persisted UserObjectStore object. */
            /** @description The UUID used to identify a persisted UserObjectStore object. */
            path: {
                user_object_store_id: string;
            };
@@ -21146,7 +21142,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The identifier used to index a persisted UserObjectStore object. */
            /** @description The UUID used to identify a persisted UserObjectStore object. */
            path: {
                user_object_store_id: string;
            };
@@ -21181,7 +21177,7 @@ export interface operations {
            header?: {
                "run-as"?: string | null;
            };
            /** @description The identifier used to index a persisted UserObjectStore object. */
            /** @description The UUID used to identify a persisted UserObjectStore object. */
            path: {
                user_object_store_id: string;
            };
+0 −1
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ export const OBJECT_STORE_INSTANCE: UserConcreteObjectStore = {
    secrets: ["oldsecret", "droppedsecret"],
    quota: { enabled: false },
    private: false,
    id: 4,
    uuid: "112f889f-72d7-4619-a8e8-510a8c685aa7",
    active: true,
    hidden: false,
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ import EditSecrets from "./EditSecrets.vue";
import InstanceForm from "@/components/ConfigTemplates/InstanceForm.vue";

interface Props {
    instanceId: number | string;
    instanceId: string;
}

const props = defineProps<Props>();
@@ -36,7 +36,7 @@ const loadingMessage = "Loading file source template and instance information";
async function onSubmit(formData: any) {
    if (template.value) {
        const payload = editFormDataToPayload(template.value, formData);
        const args = { user_file_source_id: String(instance?.value?.id) };
        const args = { user_file_source_id: String(instance?.value?.uuid) };
        const { data: fileSource } = await update({ ...args, ...payload });
        await onUpdate(fileSource);
    }
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ async function onUpdate(secretName: string, secretValue: string) {
        secret_name: secretName,
        secret_value: secretValue,
    };
    const args = { user_file_source_id: String(props.fileSource.id) };
    const args = { user_file_source_id: String(props.fileSource.uuid) };
    await update({ ...args, ...payload });
}
</script>
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ interface Props {
}

const props = defineProps<Props>();
const routeEdit = computed(() => `/file_source_instances/${props.fileSource.id}/edit`);
const routeUpgrade = computed(() => `/file_source_instances/${props.fileSource.id}/upgrade`);
const routeEdit = computed(() => `/file_source_instances/${props.fileSource.uuid}/edit`);
const routeUpgrade = computed(() => `/file_source_instances/${props.fileSource.uuid}/upgrade`);
const isUpgradable = computed(() =>
    fileSourceTemplatesStore.canUpgrade(props.fileSource.template_id, props.fileSource.template_version)
);
Loading