@shipfox/client-secrets 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +1 -0
- package/.storybook/preview.css +4 -0
- package/.storybook/preview.tsx +56 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +102 -0
- package/LICENSE +21 -0
- package/dist/components/copy-key.d.ts +8 -0
- package/dist/components/copy-key.d.ts.map +1 -0
- package/dist/components/copy-key.js +21 -0
- package/dist/components/copy-key.js.map +1 -0
- package/dist/components/delete-entry-dialog.d.ts +9 -0
- package/dist/components/delete-entry-dialog.d.ts.map +1 -0
- package/dist/components/delete-entry-dialog.js +66 -0
- package/dist/components/delete-entry-dialog.js.map +1 -0
- package/dist/components/form-errors.d.ts +17 -0
- package/dist/components/form-errors.d.ts.map +1 -0
- package/dist/components/form-errors.js +81 -0
- package/dist/components/form-errors.js.map +1 -0
- package/dist/components/form-shell.d.ts +14 -0
- package/dist/components/form-shell.d.ts.map +1 -0
- package/dist/components/form-shell.js +28 -0
- package/dist/components/form-shell.js.map +1 -0
- package/dist/components/secret-form.d.ts +10 -0
- package/dist/components/secret-form.d.ts.map +1 -0
- package/dist/components/secret-form.js +176 -0
- package/dist/components/secret-form.js.map +1 -0
- package/dist/components/secret-form.stories.d.ts +9 -0
- package/dist/components/secret-form.stories.d.ts.map +1 -0
- package/dist/components/secret-form.stories.js +60 -0
- package/dist/components/secret-form.stories.js.map +1 -0
- package/dist/components/store-key.d.ts +20 -0
- package/dist/components/store-key.d.ts.map +1 -0
- package/dist/components/store-key.js +25 -0
- package/dist/components/store-key.js.map +1 -0
- package/dist/components/store-section-shell.d.ts +10 -0
- package/dist/components/store-section-shell.d.ts.map +1 -0
- package/dist/components/store-section-shell.js +40 -0
- package/dist/components/store-section-shell.js.map +1 -0
- package/dist/components/variable-form.d.ts +12 -0
- package/dist/components/variable-form.d.ts.map +1 -0
- package/dist/components/variable-form.js +186 -0
- package/dist/components/variable-form.js.map +1 -0
- package/dist/components/variable-form.stories.d.ts +9 -0
- package/dist/components/variable-form.stories.d.ts.map +1 -0
- package/dist/components/variable-form.stories.js +61 -0
- package/dist/components/variable-form.stories.js.map +1 -0
- package/dist/components/workspace-secrets-section.d.ts +4 -0
- package/dist/components/workspace-secrets-section.d.ts.map +1 -0
- package/dist/components/workspace-secrets-section.js +251 -0
- package/dist/components/workspace-secrets-section.js.map +1 -0
- package/dist/components/workspace-secrets-section.stories.d.ts +13 -0
- package/dist/components/workspace-secrets-section.stories.d.ts.map +1 -0
- package/dist/components/workspace-secrets-section.stories.js +140 -0
- package/dist/components/workspace-secrets-section.stories.js.map +1 -0
- package/dist/components/workspace-variables-section.d.ts +4 -0
- package/dist/components/workspace-variables-section.d.ts.map +1 -0
- package/dist/components/workspace-variables-section.js +255 -0
- package/dist/components/workspace-variables-section.js.map +1 -0
- package/dist/components/workspace-variables-section.stories.d.ts +11 -0
- package/dist/components/workspace-variables-section.stories.d.ts.map +1 -0
- package/dist/components/workspace-variables-section.stories.js +127 -0
- package/dist/components/workspace-variables-section.stories.js.map +1 -0
- package/dist/hooks/api/create-store-api.d.ts +56 -0
- package/dist/hooks/api/create-store-api.d.ts.map +1 -0
- package/dist/hooks/api/create-store-api.js +95 -0
- package/dist/hooks/api/create-store-api.js.map +1 -0
- package/dist/hooks/api/secrets.d.ts +61 -0
- package/dist/hooks/api/secrets.d.ts.map +1 -0
- package/dist/hooks/api/secrets.js +15 -0
- package/dist/hooks/api/secrets.js.map +1 -0
- package/dist/hooks/api/variables.d.ts +88 -0
- package/dist/hooks/api/variables.d.ts.map +1 -0
- package/dist/hooks/api/variables.js +52 -0
- package/dist/hooks/api/variables.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +89 -0
- package/src/components/copy-key.test.ts +44 -0
- package/src/components/copy-key.ts +21 -0
- package/src/components/delete-entry-dialog.tsx +57 -0
- package/src/components/form-errors.test.ts +67 -0
- package/src/components/form-errors.ts +59 -0
- package/src/components/form-shell.tsx +31 -0
- package/src/components/secret-form.stories.tsx +58 -0
- package/src/components/secret-form.test.tsx +37 -0
- package/src/components/secret-form.tsx +170 -0
- package/src/components/store-key.test.ts +53 -0
- package/src/components/store-key.ts +36 -0
- package/src/components/store-section-shell.tsx +32 -0
- package/src/components/variable-form.stories.tsx +58 -0
- package/src/components/variable-form.test.tsx +60 -0
- package/src/components/variable-form.tsx +182 -0
- package/src/components/workspace-secrets-section.stories.tsx +128 -0
- package/src/components/workspace-secrets-section.tsx +231 -0
- package/src/components/workspace-variables-section.stories.tsx +121 -0
- package/src/components/workspace-variables-section.tsx +238 -0
- package/src/hooks/api/create-store-api.ts +114 -0
- package/src/hooks/api/secrets.test.ts +157 -0
- package/src/hooks/api/secrets.ts +26 -0
- package/src/hooks/api/variables.ts +61 -0
- package/src/index.ts +5 -0
- package/test/fixtures/secrets.ts +59 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +75 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const secretsQueryKeys: {
|
|
2
|
+
all: readonly [string];
|
|
3
|
+
list: (workspaceId: string) => readonly [string, "list", string];
|
|
4
|
+
};
|
|
5
|
+
export declare const listSecrets: (params: {
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
projectId?: string | undefined;
|
|
8
|
+
signal?: AbortSignal | undefined;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
key: string;
|
|
11
|
+
project_id: string | null;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
last_edited_by: string | null;
|
|
15
|
+
}[]>;
|
|
16
|
+
export declare const putSecret: (params: {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
key: string;
|
|
19
|
+
body: {
|
|
20
|
+
value: string;
|
|
21
|
+
project_id?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
}) => Promise<import("./create-store-api.js").PutResult<{
|
|
24
|
+
key: string;
|
|
25
|
+
project_id: string | null;
|
|
26
|
+
created_at: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
last_edited_by: string | null;
|
|
29
|
+
}>>;
|
|
30
|
+
export declare const deleteSecret: (params: {
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
key: string;
|
|
33
|
+
projectId?: string | undefined;
|
|
34
|
+
}) => Promise<void>;
|
|
35
|
+
export declare const useSecretsQuery: (workspaceId: string | undefined) => import("@tanstack/react-query").UseQueryResult<NoInfer<{
|
|
36
|
+
key: string;
|
|
37
|
+
project_id: string | null;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
last_edited_by: string | null;
|
|
41
|
+
}[]>, Error>;
|
|
42
|
+
export declare const usePutSecretMutation: () => import("@tanstack/react-query").UseMutationResult<import("./create-store-api.js").PutResult<{
|
|
43
|
+
key: string;
|
|
44
|
+
project_id: string | null;
|
|
45
|
+
created_at: string;
|
|
46
|
+
updated_at: string;
|
|
47
|
+
last_edited_by: string | null;
|
|
48
|
+
}>, Error, {
|
|
49
|
+
workspaceId: string;
|
|
50
|
+
key: string;
|
|
51
|
+
body: {
|
|
52
|
+
value: string;
|
|
53
|
+
project_id?: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
}, unknown>;
|
|
56
|
+
export declare const useDeleteSecretMutation: () => import("@tanstack/react-query").UseMutationResult<void, Error, {
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
key: string;
|
|
59
|
+
projectId?: string | undefined;
|
|
60
|
+
}, unknown>;
|
|
61
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/secrets.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,gBAAgB;;;CAAuB,CAAC;AACrD,eAAO,MAAM,WAAW;;;;;;;;;;IAAqB,CAAC;AAC9C,eAAO,MAAM,SAAS;;;;;;;;;;;;;GAAiB,CAAC;AACxC,eAAO,MAAM,YAAY;;;;mBAAoB,CAAC;AAC9C,eAAO,MAAM,eAAe;;;;;;YAA0B,CAAC;AACvD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;WAA4B,CAAC;AAC9D,eAAO,MAAM,uBAAuB;;;;WAA+B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createStoreApi } from './create-store-api.js';
|
|
2
|
+
const secretsApi = createStoreApi({
|
|
3
|
+
resource: 'secrets',
|
|
4
|
+
listItems: (response)=>response.secrets,
|
|
5
|
+
putItem: (response)=>response.secret
|
|
6
|
+
});
|
|
7
|
+
export const secretsQueryKeys = secretsApi.queryKeys;
|
|
8
|
+
export const listSecrets = secretsApi.listAll;
|
|
9
|
+
export const putSecret = secretsApi.put;
|
|
10
|
+
export const deleteSecret = secretsApi.remove;
|
|
11
|
+
export const useSecretsQuery = secretsApi.useListQuery;
|
|
12
|
+
export const usePutSecretMutation = secretsApi.usePutMutation;
|
|
13
|
+
export const useDeleteSecretMutation = secretsApi.useDeleteMutation;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/secrets.ts"],"sourcesContent":["import type {\n ListSecretsResponseDto,\n PutSecretBodyDto,\n PutSecretResponseDto,\n SecretDto,\n} from '@shipfox/api-secrets-dto';\nimport {createStoreApi} from './create-store-api.js';\n\nconst secretsApi = createStoreApi<\n SecretDto,\n ListSecretsResponseDto,\n PutSecretBodyDto,\n PutSecretResponseDto\n>({\n resource: 'secrets',\n listItems: (response) => response.secrets,\n putItem: (response) => response.secret,\n});\n\nexport const secretsQueryKeys = secretsApi.queryKeys;\nexport const listSecrets = secretsApi.listAll;\nexport const putSecret = secretsApi.put;\nexport const deleteSecret = secretsApi.remove;\nexport const useSecretsQuery = secretsApi.useListQuery;\nexport const usePutSecretMutation = secretsApi.usePutMutation;\nexport const useDeleteSecretMutation = secretsApi.useDeleteMutation;\n"],"names":["createStoreApi","secretsApi","resource","listItems","response","secrets","putItem","secret","secretsQueryKeys","queryKeys","listSecrets","listAll","putSecret","put","deleteSecret","remove","useSecretsQuery","useListQuery","usePutSecretMutation","usePutMutation","useDeleteSecretMutation","useDeleteMutation"],"mappings":"AAMA,SAAQA,cAAc,QAAO,wBAAwB;AAErD,MAAMC,aAAaD,eAKjB;IACAE,UAAU;IACVC,WAAW,CAACC,WAAaA,SAASC,OAAO;IACzCC,SAAS,CAACF,WAAaA,SAASG,MAAM;AACxC;AAEA,OAAO,MAAMC,mBAAmBP,WAAWQ,SAAS,CAAC;AACrD,OAAO,MAAMC,cAAcT,WAAWU,OAAO,CAAC;AAC9C,OAAO,MAAMC,YAAYX,WAAWY,GAAG,CAAC;AACxC,OAAO,MAAMC,eAAeb,WAAWc,MAAM,CAAC;AAC9C,OAAO,MAAMC,kBAAkBf,WAAWgB,YAAY,CAAC;AACvD,OAAO,MAAMC,uBAAuBjB,WAAWkB,cAAc,CAAC;AAC9D,OAAO,MAAMC,0BAA0BnB,WAAWoB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { VariableDto } from '@shipfox/api-secrets-dto';
|
|
2
|
+
export declare const variablesQueryKeys: {
|
|
3
|
+
all: readonly [string];
|
|
4
|
+
list: (workspaceId: string) => readonly [string, "list", string];
|
|
5
|
+
};
|
|
6
|
+
export declare const listVariables: (params: {
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
projectId?: string | undefined;
|
|
9
|
+
signal?: AbortSignal | undefined;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
key: string;
|
|
12
|
+
project_id: string | null;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
last_edited_by: string | null;
|
|
16
|
+
value: string;
|
|
17
|
+
value_truncated: boolean;
|
|
18
|
+
}[]>;
|
|
19
|
+
export declare const putVariable: (params: {
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
key: string;
|
|
22
|
+
body: {
|
|
23
|
+
value: string;
|
|
24
|
+
project_id?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
}) => Promise<import("./create-store-api.js").PutResult<{
|
|
27
|
+
key: string;
|
|
28
|
+
project_id: string | null;
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
last_edited_by: string | null;
|
|
32
|
+
value: string;
|
|
33
|
+
value_truncated: boolean;
|
|
34
|
+
}>>;
|
|
35
|
+
export declare const deleteVariable: (params: {
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
key: string;
|
|
38
|
+
projectId?: string | undefined;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
export declare const useVariablesQuery: (workspaceId: string | undefined) => import("@tanstack/react-query").UseQueryResult<NoInfer<{
|
|
41
|
+
key: string;
|
|
42
|
+
project_id: string | null;
|
|
43
|
+
created_at: string;
|
|
44
|
+
updated_at: string;
|
|
45
|
+
last_edited_by: string | null;
|
|
46
|
+
value: string;
|
|
47
|
+
value_truncated: boolean;
|
|
48
|
+
}[]>, Error>;
|
|
49
|
+
export declare const usePutVariableMutation: () => import("@tanstack/react-query").UseMutationResult<import("./create-store-api.js").PutResult<{
|
|
50
|
+
key: string;
|
|
51
|
+
project_id: string | null;
|
|
52
|
+
created_at: string;
|
|
53
|
+
updated_at: string;
|
|
54
|
+
last_edited_by: string | null;
|
|
55
|
+
value: string;
|
|
56
|
+
value_truncated: boolean;
|
|
57
|
+
}>, Error, {
|
|
58
|
+
workspaceId: string;
|
|
59
|
+
key: string;
|
|
60
|
+
body: {
|
|
61
|
+
value: string;
|
|
62
|
+
project_id?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
}, unknown>;
|
|
65
|
+
export declare const useDeleteVariableMutation: () => import("@tanstack/react-query").UseMutationResult<void, Error, {
|
|
66
|
+
workspaceId: string;
|
|
67
|
+
key: string;
|
|
68
|
+
projectId?: string | undefined;
|
|
69
|
+
}, unknown>;
|
|
70
|
+
/**
|
|
71
|
+
* Reads a single variable including its full value. The list only returns a
|
|
72
|
+
* bounded preview, so editing a truncated variable fetches the full value here.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getVariable(params: {
|
|
75
|
+
workspaceId: string;
|
|
76
|
+
key: string;
|
|
77
|
+
projectId?: string | undefined;
|
|
78
|
+
signal?: AbortSignal | undefined;
|
|
79
|
+
}): Promise<VariableDto>;
|
|
80
|
+
export declare function useVariableQuery(workspaceId: string, key: string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<{
|
|
81
|
+
key: string;
|
|
82
|
+
project_id: string | null;
|
|
83
|
+
created_at: string;
|
|
84
|
+
updated_at: string;
|
|
85
|
+
last_edited_by: string | null;
|
|
86
|
+
value: string;
|
|
87
|
+
}>, Error>;
|
|
88
|
+
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,WAAW,EAEZ,MAAM,0BAA0B,CAAC;AAiBlC,eAAO,MAAM,kBAAkB;;;CAAyB,CAAC;AACzD,eAAO,MAAM,aAAa;;;;;;;;;;;;IAAuB,CAAC;AAClD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;GAAmB,CAAC;AAC5C,eAAO,MAAM,cAAc;;;;mBAAsB,CAAC;AAClD,eAAO,MAAM,iBAAiB;;;;;;;;YAA4B,CAAC;AAC3D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;WAA8B,CAAC;AAClE,eAAO,MAAM,yBAAyB;;;;WAAiC,CAAC;AAExE;;;GAGG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAClC,GAAG,OAAO,CAAC,WAAW,CAAC,CASvB;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS;;;;;;;WAQ5E"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { apiRequest } from '@shipfox/client-api';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { createStoreApi } from './create-store-api.js';
|
|
4
|
+
const variablesApi = createStoreApi({
|
|
5
|
+
resource: 'variables',
|
|
6
|
+
listItems: (response)=>response.variables,
|
|
7
|
+
// The list carries only a preview; a freshly-written value is the full value.
|
|
8
|
+
putItem: (response)=>({
|
|
9
|
+
...response.variable,
|
|
10
|
+
value_truncated: false
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
export const variablesQueryKeys = variablesApi.queryKeys;
|
|
14
|
+
export const listVariables = variablesApi.listAll;
|
|
15
|
+
export const putVariable = variablesApi.put;
|
|
16
|
+
export const deleteVariable = variablesApi.remove;
|
|
17
|
+
export const useVariablesQuery = variablesApi.useListQuery;
|
|
18
|
+
export const usePutVariableMutation = variablesApi.usePutMutation;
|
|
19
|
+
export const useDeleteVariableMutation = variablesApi.useDeleteMutation;
|
|
20
|
+
/**
|
|
21
|
+
* Reads a single variable including its full value. The list only returns a
|
|
22
|
+
* bounded preview, so editing a truncated variable fetches the full value here.
|
|
23
|
+
*/ export async function getVariable(params) {
|
|
24
|
+
const search = params.projectId ? `?${new URLSearchParams({
|
|
25
|
+
project_id: params.projectId
|
|
26
|
+
}).toString()}` : '';
|
|
27
|
+
const response = await apiRequest(`/workspaces/${params.workspaceId}/variables/${encodeURIComponent(params.key)}${search}`, {
|
|
28
|
+
signal: params.signal
|
|
29
|
+
});
|
|
30
|
+
return response.variable;
|
|
31
|
+
}
|
|
32
|
+
export function useVariableQuery(workspaceId, key) {
|
|
33
|
+
return useQuery({
|
|
34
|
+
queryKey: key ? [
|
|
35
|
+
...variablesQueryKeys.all,
|
|
36
|
+
'detail',
|
|
37
|
+
workspaceId,
|
|
38
|
+
key
|
|
39
|
+
] : [
|
|
40
|
+
...variablesQueryKeys.all,
|
|
41
|
+
'detail'
|
|
42
|
+
],
|
|
43
|
+
enabled: Boolean(key),
|
|
44
|
+
queryFn: ({ signal })=>getVariable({
|
|
45
|
+
workspaceId,
|
|
46
|
+
key: key ?? '',
|
|
47
|
+
signal
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/variables.ts"],"sourcesContent":["import type {\n GetVariableResponseDto,\n ListVariablesResponseDto,\n PutVariableBodyDto,\n PutVariableResponseDto,\n VariableDto,\n VariableListItemDto,\n} from '@shipfox/api-secrets-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {useQuery} from '@tanstack/react-query';\nimport {createStoreApi} from './create-store-api.js';\n\nconst variablesApi = createStoreApi<\n VariableListItemDto,\n ListVariablesResponseDto,\n PutVariableBodyDto,\n PutVariableResponseDto\n>({\n resource: 'variables',\n listItems: (response) => response.variables,\n // The list carries only a preview; a freshly-written value is the full value.\n putItem: (response) => ({...response.variable, value_truncated: false}),\n});\n\nexport const variablesQueryKeys = variablesApi.queryKeys;\nexport const listVariables = variablesApi.listAll;\nexport const putVariable = variablesApi.put;\nexport const deleteVariable = variablesApi.remove;\nexport const useVariablesQuery = variablesApi.useListQuery;\nexport const usePutVariableMutation = variablesApi.usePutMutation;\nexport const useDeleteVariableMutation = variablesApi.useDeleteMutation;\n\n/**\n * Reads a single variable including its full value. The list only returns a\n * bounded preview, so editing a truncated variable fetches the full value here.\n */\nexport async function getVariable(params: {\n workspaceId: string;\n key: string;\n projectId?: string | undefined;\n signal?: AbortSignal | undefined;\n}): Promise<VariableDto> {\n const search = params.projectId\n ? `?${new URLSearchParams({project_id: params.projectId}).toString()}`\n : '';\n const response = await apiRequest<GetVariableResponseDto>(\n `/workspaces/${params.workspaceId}/variables/${encodeURIComponent(params.key)}${search}`,\n {signal: params.signal},\n );\n return response.variable;\n}\n\nexport function useVariableQuery(workspaceId: string, key: string | undefined) {\n return useQuery({\n queryKey: key\n ? [...variablesQueryKeys.all, 'detail', workspaceId, key]\n : [...variablesQueryKeys.all, 'detail'],\n enabled: Boolean(key),\n queryFn: ({signal}) => getVariable({workspaceId, key: key ?? '', signal}),\n });\n}\n"],"names":["apiRequest","useQuery","createStoreApi","variablesApi","resource","listItems","response","variables","putItem","variable","value_truncated","variablesQueryKeys","queryKeys","listVariables","listAll","putVariable","put","deleteVariable","remove","useVariablesQuery","useListQuery","usePutVariableMutation","usePutMutation","useDeleteVariableMutation","useDeleteMutation","getVariable","params","search","projectId","URLSearchParams","project_id","toString","workspaceId","encodeURIComponent","key","signal","useVariableQuery","queryKey","all","enabled","Boolean","queryFn"],"mappings":"AAQA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,QAAQ,QAAO,wBAAwB;AAC/C,SAAQC,cAAc,QAAO,wBAAwB;AAErD,MAAMC,eAAeD,eAKnB;IACAE,UAAU;IACVC,WAAW,CAACC,WAAaA,SAASC,SAAS;IAC3C,8EAA8E;IAC9EC,SAAS,CAACF,WAAc,CAAA;YAAC,GAAGA,SAASG,QAAQ;YAAEC,iBAAiB;QAAK,CAAA;AACvE;AAEA,OAAO,MAAMC,qBAAqBR,aAAaS,SAAS,CAAC;AACzD,OAAO,MAAMC,gBAAgBV,aAAaW,OAAO,CAAC;AAClD,OAAO,MAAMC,cAAcZ,aAAaa,GAAG,CAAC;AAC5C,OAAO,MAAMC,iBAAiBd,aAAae,MAAM,CAAC;AAClD,OAAO,MAAMC,oBAAoBhB,aAAaiB,YAAY,CAAC;AAC3D,OAAO,MAAMC,yBAAyBlB,aAAamB,cAAc,CAAC;AAClE,OAAO,MAAMC,4BAA4BpB,aAAaqB,iBAAiB,CAAC;AAExE;;;CAGC,GACD,OAAO,eAAeC,YAAYC,MAKjC;IACC,MAAMC,SAASD,OAAOE,SAAS,GAC3B,CAAC,CAAC,EAAE,IAAIC,gBAAgB;QAACC,YAAYJ,OAAOE,SAAS;IAAA,GAAGG,QAAQ,IAAI,GACpE;IACJ,MAAMzB,WAAW,MAAMN,WACrB,CAAC,YAAY,EAAE0B,OAAOM,WAAW,CAAC,WAAW,EAAEC,mBAAmBP,OAAOQ,GAAG,IAAIP,QAAQ,EACxF;QAACQ,QAAQT,OAAOS,MAAM;IAAA;IAExB,OAAO7B,SAASG,QAAQ;AAC1B;AAEA,OAAO,SAAS2B,iBAAiBJ,WAAmB,EAAEE,GAAuB;IAC3E,OAAOjC,SAAS;QACdoC,UAAUH,MACN;eAAIvB,mBAAmB2B,GAAG;YAAE;YAAUN;YAAaE;SAAI,GACvD;eAAIvB,mBAAmB2B,GAAG;YAAE;SAAS;QACzCC,SAASC,QAAQN;QACjBO,SAAS,CAAC,EAACN,MAAM,EAAC,GAAKV,YAAY;gBAACO;gBAAaE,KAAKA,OAAO;gBAAIC;YAAM;IACzE;AACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type SecretsFormErrorMapping, secretsErrorToFormError } from './components/form-errors.js';
|
|
2
|
+
export { WorkspaceSecretsSection } from './components/workspace-secrets-section.js';
|
|
3
|
+
export { WorkspaceVariablesSection } from './components/workspace-variables-section.js';
|
|
4
|
+
export * from './hooks/api/secrets.js';
|
|
5
|
+
export * from './hooks/api/variables.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,uBAAuB,EAAE,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAC,uBAAuB,EAAC,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAC,yBAAyB,EAAC,MAAM,6CAA6C,CAAC;AACtF,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { secretsErrorToFormError } from './components/form-errors.js';
|
|
2
|
+
export { WorkspaceSecretsSection } from './components/workspace-secrets-section.js';
|
|
3
|
+
export { WorkspaceVariablesSection } from './components/workspace-variables-section.js';
|
|
4
|
+
export * from './hooks/api/secrets.js';
|
|
5
|
+
export * from './hooks/api/variables.js';
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {type SecretsFormErrorMapping, secretsErrorToFormError} from './components/form-errors.js';\nexport {WorkspaceSecretsSection} from './components/workspace-secrets-section.js';\nexport {WorkspaceVariablesSection} from './components/workspace-variables-section.js';\nexport * from './hooks/api/secrets.js';\nexport * from './hooks/api/variables.js';\n"],"names":["secretsErrorToFormError","WorkspaceSecretsSection","WorkspaceVariablesSection"],"mappings":"AAAA,SAAsCA,uBAAuB,QAAO,8BAA8B;AAClG,SAAQC,uBAAuB,QAAO,4CAA4C;AAClF,SAAQC,yBAAyB,QAAO,8CAA8C;AACtF,cAAc,yBAAyB;AACvC,cAAc,2BAA2B"}
|