Skip to content

Commit 67a0576

Browse files
committed
secrets: rename SecretTupleInput to VariableInput
1 parent 9a107e7 commit 67a0576

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

schema.graphql

+7-7
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ type Mutation {
697697
"""Create a new secret for a team and env."""
698698
createSecret(
699699
"""The secret data."""
700-
data: [SecretTupleInput!]!
700+
data: [VariableInput!]!
701701

702702
"""The environment the secret is deployed to."""
703703
env: String!
@@ -875,7 +875,7 @@ type Mutation {
875875
"""Update an existing secret for a team and env."""
876876
updateSecret(
877877
"""The secret data."""
878-
data: [SecretTupleInput!]!
878+
data: [VariableInput!]!
879879

880880
"""The environment the secret is deployed to."""
881881
env: String!
@@ -1474,11 +1474,6 @@ type Secret {
14741474
team: Team!
14751475
}
14761476

1477-
input SecretTupleInput {
1478-
name: String!
1479-
value: String!
1480-
}
1481-
14821477
"""Service account type."""
14831478
type ServiceAccount {
14841479
"""Unique ID of the service account."""
@@ -1943,6 +1938,11 @@ type Variable {
19431938
value: String!
19441939
}
19451940

1941+
input VariableInput {
1942+
name: String!
1943+
value: String!
1944+
}
1945+
19461946
type Vulnerability {
19471947
appName: String!
19481948
env: String!

src/routes/team/[team]/(teamTabs)/secrets/CreateSecret.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { graphql, type SecretTupleInput } from '$houdini';
2+
import { graphql, type VariableInput } from '$houdini';
33
import { Alert, Button, Heading, Modal, TextField } from '@nais/ds-svelte-community';
44
import { goto } from '$app/navigation';
55
@@ -10,14 +10,14 @@
1010
export let existingNames: string[];
1111
1212
let name = '';
13-
let data: SecretTupleInput[] = [];
13+
let data: VariableInput[] = [];
1414
1515
const createSecret = graphql(`
1616
mutation createSecret(
1717
$name: String!
1818
$team: Slug!
1919
$env: String!
20-
$data: [SecretTupleInput!]!
20+
$data: [VariableInput!]!
2121
) {
2222
createSecret(name: $name, team: $team, env: $env, data: $data) {
2323
id

src/routes/team/[team]/[env]/secret/[secret]/+page.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
} from '@nais/ds-svelte-community';
1414
import type { PageData } from './$houdini';
1515
import Card from '$lib/Card.svelte';
16-
import { graphql, type SecretTupleInput } from '$houdini';
16+
import { graphql, type VariableInput } from '$houdini';
1717
import { filterAddKvs, mergeChanges, type operation } from './state-machinery';
1818
import Confirm from '$lib/components/Confirm.svelte';
1919
import SecretKv from './SecretKv.svelte';
@@ -47,7 +47,7 @@
4747
$name: String!
4848
$team: Slug!
4949
$env: String!
50-
$data: [SecretTupleInput!]!
50+
$data: [VariableInput!]!
5151
) {
5252
updateSecret(name: $name, team: $team, env: $env, data: $data) {
5353
id
@@ -66,7 +66,7 @@
6666
const updateSecret = async () => {
6767
if (!secret) return;
6868
69-
let data: SecretTupleInput[] = changes.reduce(mergeChanges, secret.data);
69+
let data: VariableInput[] = changes.reduce(mergeChanges, secret.data);
7070
7171
await updateSecretMutation.mutate({
7272
data: data,

src/routes/team/[team]/[env]/secret/[secret]/state-machinery.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect, test } from 'vitest';
22
import { mergeChanges, type operation } from './state-machinery';
3-
import type { SecretTupleInput } from '$houdini';
3+
import type { VariableInput } from '$houdini';
44

5-
const initialState: SecretTupleInput[] = [
5+
const initialState: VariableInput[] = [
66
{
77
name: 'some-key',
88
value: 'some-value'
@@ -42,7 +42,7 @@ test('delete kv', () => {
4242
});
4343

4444
test('delete exactly one kv', () => {
45-
const initialState: SecretTupleInput[] = [
45+
const initialState: VariableInput[] = [
4646
{
4747
name: 'some-key',
4848
value: 'some-value'

src/routes/team/[team]/[env]/secret/[secret]/state-machinery.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SecretTupleInput } from '$houdini';
1+
import type { VariableInput } from '$houdini';
22

33
export type AddKv = {
44
type: 'AddKv';
@@ -33,7 +33,7 @@ export type UpdateValue = {
3333

3434
export type operation = AddKv | DeleteKv | UndoDeleteKv | UpdateValue;
3535

36-
export function mergeChanges(tuples: SecretTupleInput[], curr: operation): SecretTupleInput[] {
36+
export function mergeChanges(tuples: VariableInput[], curr: operation): VariableInput[] {
3737
switch (curr.type) {
3838
case 'AddKv':
3939
return [...tuples, { name: curr.data.name, value: curr.data.value }];

0 commit comments

Comments
 (0)