@stigmer/react 0.0.89 → 0.0.91

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.
Files changed (128) hide show
  1. package/identity-provider/CreateIdentityProviderForm.d.ts.map +1 -1
  2. package/identity-provider/CreateIdentityProviderForm.js +60 -2
  3. package/identity-provider/CreateIdentityProviderForm.js.map +1 -1
  4. package/identity-provider/IdentityProviderDetailPanel.d.ts.map +1 -1
  5. package/identity-provider/IdentityProviderDetailPanel.js +87 -4
  6. package/identity-provider/IdentityProviderDetailPanel.js.map +1 -1
  7. package/identity-provider/IdentityProviderListPanel.js +5 -3
  8. package/identity-provider/IdentityProviderListPanel.js.map +1 -1
  9. package/identity-provider/IdentityProviderWizard.d.ts.map +1 -1
  10. package/identity-provider/IdentityProviderWizard.js +59 -4
  11. package/identity-provider/IdentityProviderWizard.js.map +1 -1
  12. package/index.d.ts +2 -0
  13. package/index.d.ts.map +1 -1
  14. package/index.js +2 -0
  15. package/index.js.map +1 -1
  16. package/package.json +7 -7
  17. package/platform-client/CreatePlatformClientForm.d.ts +42 -0
  18. package/platform-client/CreatePlatformClientForm.d.ts.map +1 -0
  19. package/platform-client/CreatePlatformClientForm.js +148 -0
  20. package/platform-client/CreatePlatformClientForm.js.map +1 -0
  21. package/platform-client/PlatformClientDetailPanel.d.ts +51 -0
  22. package/platform-client/PlatformClientDetailPanel.d.ts.map +1 -0
  23. package/platform-client/PlatformClientDetailPanel.js +247 -0
  24. package/platform-client/PlatformClientDetailPanel.js.map +1 -0
  25. package/platform-client/PlatformClientListPanel.d.ts +41 -0
  26. package/platform-client/PlatformClientListPanel.d.ts.map +1 -0
  27. package/platform-client/PlatformClientListPanel.js +123 -0
  28. package/platform-client/PlatformClientListPanel.js.map +1 -0
  29. package/platform-client/PlatformClientSecretAlert.d.ts +39 -0
  30. package/platform-client/PlatformClientSecretAlert.d.ts.map +1 -0
  31. package/platform-client/PlatformClientSecretAlert.js +74 -0
  32. package/platform-client/PlatformClientSecretAlert.js.map +1 -0
  33. package/platform-client/index.d.ts +11 -0
  34. package/platform-client/index.d.ts.map +1 -0
  35. package/platform-client/index.js +11 -0
  36. package/platform-client/index.js.map +1 -0
  37. package/platform-client/useCreatePlatformClient.d.ts +42 -0
  38. package/platform-client/useCreatePlatformClient.d.ts.map +1 -0
  39. package/platform-client/useCreatePlatformClient.js +49 -0
  40. package/platform-client/useCreatePlatformClient.js.map +1 -0
  41. package/platform-client/useDeletePlatformClient.d.ts +31 -0
  42. package/platform-client/useDeletePlatformClient.d.ts.map +1 -0
  43. package/platform-client/useDeletePlatformClient.js +42 -0
  44. package/platform-client/useDeletePlatformClient.js.map +1 -0
  45. package/platform-client/usePlatformClient.d.ts +37 -0
  46. package/platform-client/usePlatformClient.d.ts.map +1 -0
  47. package/platform-client/usePlatformClient.js +62 -0
  48. package/platform-client/usePlatformClient.js.map +1 -0
  49. package/platform-client/usePlatformClientList.d.ts +42 -0
  50. package/platform-client/usePlatformClientList.d.ts.map +1 -0
  51. package/platform-client/usePlatformClientList.js +71 -0
  52. package/platform-client/usePlatformClientList.js.map +1 -0
  53. package/platform-client/useRotatePlatformClientSecret.d.ts +35 -0
  54. package/platform-client/useRotatePlatformClientSecret.d.ts.map +1 -0
  55. package/platform-client/useRotatePlatformClientSecret.js +43 -0
  56. package/platform-client/useRotatePlatformClientSecret.js.map +1 -0
  57. package/platform-client/useUpdatePlatformClient.d.ts +39 -0
  58. package/platform-client/useUpdatePlatformClient.d.ts.map +1 -0
  59. package/platform-client/useUpdatePlatformClient.js +50 -0
  60. package/platform-client/useUpdatePlatformClient.js.map +1 -0
  61. package/src/identity-provider/CreateIdentityProviderForm.tsx +220 -0
  62. package/src/identity-provider/IdentityProviderDetailPanel.tsx +288 -6
  63. package/src/identity-provider/IdentityProviderListPanel.tsx +9 -2
  64. package/src/identity-provider/IdentityProviderWizard.tsx +231 -25
  65. package/src/index.ts +26 -0
  66. package/src/platform-client/CreatePlatformClientForm.tsx +519 -0
  67. package/src/platform-client/PlatformClientDetailPanel.tsx +898 -0
  68. package/src/platform-client/PlatformClientListPanel.tsx +413 -0
  69. package/src/platform-client/PlatformClientSecretAlert.tsx +252 -0
  70. package/src/platform-client/index.ts +49 -0
  71. package/src/platform-client/useCreatePlatformClient.ts +77 -0
  72. package/src/platform-client/useDeletePlatformClient.ts +64 -0
  73. package/src/platform-client/usePlatformClient.ts +86 -0
  74. package/src/platform-client/usePlatformClientList.ts +96 -0
  75. package/src/platform-client/useRotatePlatformClientSecret.ts +68 -0
  76. package/src/platform-client/useUpdatePlatformClient.ts +70 -0
  77. package/src/test/index.ts +6 -0
  78. package/src/{demo → test}/samples.ts +1 -1
  79. package/styles.css +1 -1
  80. package/test/__tests__/samples.test.d.ts.map +1 -0
  81. package/{demo → test}/__tests__/samples.test.js.map +1 -1
  82. package/test/index.d.ts +2 -0
  83. package/test/index.d.ts.map +1 -0
  84. package/test/index.js +6 -0
  85. package/test/index.js.map +1 -0
  86. package/{demo → test}/samples.d.ts +1 -1
  87. package/{demo → test}/samples.d.ts.map +1 -1
  88. package/{demo → test}/samples.js +1 -1
  89. package/{demo → test}/samples.js.map +1 -1
  90. package/demo/__tests__/demo-client.test.d.ts +0 -2
  91. package/demo/__tests__/demo-client.test.d.ts.map +0 -1
  92. package/demo/__tests__/demo-client.test.js +0 -133
  93. package/demo/__tests__/demo-client.test.js.map +0 -1
  94. package/demo/__tests__/fixtures.test.d.ts +0 -2
  95. package/demo/__tests__/fixtures.test.d.ts.map +0 -1
  96. package/demo/__tests__/fixtures.test.js +0 -135
  97. package/demo/__tests__/fixtures.test.js.map +0 -1
  98. package/demo/__tests__/samples.test.d.ts.map +0 -1
  99. package/demo/client.d.ts +0 -29
  100. package/demo/client.d.ts.map +0 -1
  101. package/demo/client.js +0 -52
  102. package/demo/client.js.map +0 -1
  103. package/demo/fixtures.d.ts +0 -194
  104. package/demo/fixtures.d.ts.map +0 -1
  105. package/demo/fixtures.js +0 -267
  106. package/demo/fixtures.js.map +0 -1
  107. package/demo/index.d.ts +0 -6
  108. package/demo/index.d.ts.map +0 -1
  109. package/demo/index.js +0 -6
  110. package/demo/index.js.map +0 -1
  111. package/demo/transport.d.ts +0 -59
  112. package/demo/transport.d.ts.map +0 -1
  113. package/demo/transport.js +0 -75
  114. package/demo/transport.js.map +0 -1
  115. package/demo/types.d.ts +0 -62
  116. package/demo/types.d.ts.map +0 -1
  117. package/demo/types.js +0 -16
  118. package/demo/types.js.map +0 -1
  119. package/src/demo/__tests__/demo-client.test.tsx +0 -213
  120. package/src/demo/__tests__/fixtures.test.ts +0 -214
  121. package/src/demo/client.ts +0 -78
  122. package/src/demo/fixtures.ts +0 -409
  123. package/src/demo/index.ts +0 -12
  124. package/src/demo/transport.ts +0 -116
  125. package/src/demo/types.ts +0 -69
  126. /package/src/{demo → test}/__tests__/samples.test.ts +0 -0
  127. /package/{demo → test}/__tests__/samples.test.d.ts +0 -0
  128. /package/{demo → test}/__tests__/samples.test.js +0 -0
@@ -0,0 +1,11 @@
1
+ export { usePlatformClientList, type UsePlatformClientListReturn, } from "./usePlatformClientList";
2
+ export { usePlatformClient, type UsePlatformClientReturn, } from "./usePlatformClient";
3
+ export { useCreatePlatformClient, type UseCreatePlatformClientReturn, } from "./useCreatePlatformClient";
4
+ export { useUpdatePlatformClient, type UseUpdatePlatformClientReturn, } from "./useUpdatePlatformClient";
5
+ export { useDeletePlatformClient, type UseDeletePlatformClientReturn, } from "./useDeletePlatformClient";
6
+ export { useRotatePlatformClientSecret, type UseRotatePlatformClientSecretReturn, } from "./useRotatePlatformClientSecret";
7
+ export { PlatformClientListPanel, type PlatformClientListPanelProps, } from "./PlatformClientListPanel";
8
+ export { CreatePlatformClientForm, type CreatePlatformClientFormProps, } from "./CreatePlatformClientForm";
9
+ export { PlatformClientDetailPanel, type PlatformClientDetailPanelProps, } from "./PlatformClientDetailPanel";
10
+ export { PlatformClientSecretAlert, type PlatformClientSecretAlertProps, } from "./PlatformClientSecretAlert";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,GACjC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,EACjB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,6BAA6B,EAC7B,KAAK,mCAAmC,GACzC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,GACpC,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { usePlatformClientList, } from "./usePlatformClientList";
2
+ export { usePlatformClient, } from "./usePlatformClient";
3
+ export { useCreatePlatformClient, } from "./useCreatePlatformClient";
4
+ export { useUpdatePlatformClient, } from "./useUpdatePlatformClient";
5
+ export { useDeletePlatformClient, } from "./useDeletePlatformClient";
6
+ export { useRotatePlatformClientSecret, } from "./useRotatePlatformClientSecret";
7
+ export { PlatformClientListPanel, } from "./PlatformClientListPanel";
8
+ export { CreatePlatformClientForm, } from "./CreatePlatformClientForm";
9
+ export { PlatformClientDetailPanel, } from "./PlatformClientDetailPanel";
10
+ export { PlatformClientSecretAlert, } from "./PlatformClientSecretAlert";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,iBAAiB,GAElB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,6BAA6B,GAE9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,yBAAyB,GAE1B,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { PlatformClientInput } from "@stigmer/sdk";
2
+ import type { PlatformClientCreateResponse } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/io_pb";
3
+ /** Return value of {@link useCreatePlatformClient}. */
4
+ export interface UseCreatePlatformClientReturn {
5
+ /**
6
+ * Submit a {@link PlatformClientInput} to create a new platform client.
7
+ * Resolves with a {@link PlatformClientCreateResponse} containing the
8
+ * resource and the **one-time raw client secret**.
9
+ */
10
+ readonly create: (input: PlatformClientInput) => Promise<PlatformClientCreateResponse>;
11
+ /** `true` while the create request is in flight. */
12
+ readonly isCreating: boolean;
13
+ /** Error from the last failed create, or `null` when healthy. */
14
+ readonly error: Error | null;
15
+ /** Reset `error` to `null`. */
16
+ readonly clearError: () => void;
17
+ }
18
+ /**
19
+ * Mutation hook that wraps `platformclient.create()` with loading
20
+ * and error state.
21
+ *
22
+ * Creates a platform client resource within an organization. The
23
+ * response includes a **one-time raw client secret** that must be
24
+ * shown to the user immediately — the server never returns it again.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * const { create, isCreating, error } = useCreatePlatformClient();
29
+ *
30
+ * const response = await create({
31
+ * name: "my-saas-backend",
32
+ * org: "acme",
33
+ * autoProvisionAccounts: true,
34
+ * autoGrantOnOrg: true,
35
+ * });
36
+ *
37
+ * // response.clientSecret is the one-time raw secret
38
+ * // response.platformClient is the created resource
39
+ * ```
40
+ */
41
+ export declare function useCreatePlatformClient(): UseCreatePlatformClientReturn;
42
+ //# sourceMappingURL=useCreatePlatformClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreatePlatformClient.d.ts","sourceRoot":"","sources":["../../src/platform-client/useCreatePlatformClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAI3G,uDAAuD;AACvD,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,CACf,KAAK,EAAE,mBAAmB,KACvB,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,IAAI,6BAA6B,CA2BvE"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { useStigmer } from "../hooks";
4
+ import { toError } from "../internal/toError";
5
+ /**
6
+ * Mutation hook that wraps `platformclient.create()` with loading
7
+ * and error state.
8
+ *
9
+ * Creates a platform client resource within an organization. The
10
+ * response includes a **one-time raw client secret** that must be
11
+ * shown to the user immediately — the server never returns it again.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { create, isCreating, error } = useCreatePlatformClient();
16
+ *
17
+ * const response = await create({
18
+ * name: "my-saas-backend",
19
+ * org: "acme",
20
+ * autoProvisionAccounts: true,
21
+ * autoGrantOnOrg: true,
22
+ * });
23
+ *
24
+ * // response.clientSecret is the one-time raw secret
25
+ * // response.platformClient is the created resource
26
+ * ```
27
+ */
28
+ export function useCreatePlatformClient() {
29
+ const stigmer = useStigmer();
30
+ const [isCreating, setIsCreating] = useState(false);
31
+ const [error, setError] = useState(null);
32
+ const clearError = useCallback(() => setError(null), []);
33
+ const create = useCallback(async (input) => {
34
+ setIsCreating(true);
35
+ setError(null);
36
+ try {
37
+ return await stigmer.platformclient.create(input);
38
+ }
39
+ catch (err) {
40
+ setError(toError(err));
41
+ throw err;
42
+ }
43
+ finally {
44
+ setIsCreating(false);
45
+ }
46
+ }, [stigmer]);
47
+ return { create, isCreating, error, clearError };
48
+ }
49
+ //# sourceMappingURL=useCreatePlatformClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreatePlatformClient.js","sourceRoot":"","sources":["../../src/platform-client/useCreatePlatformClient.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAoB9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,WAAW,CACxB,KAAK,EACH,KAA0B,EACa,EAAE;QACzC,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { DeleteResourceInput } from "@stigmer/sdk";
2
+ import type { PlatformClient } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/api_pb";
3
+ /** Return value of {@link useDeletePlatformClient}. */
4
+ export interface UseDeletePlatformClientReturn {
5
+ /** Delete a platform client. Resolves with the deleted resource for confirmation display. */
6
+ readonly deletePlatformClient: (input: DeleteResourceInput) => Promise<PlatformClient>;
7
+ /** `true` while the delete request is in flight. */
8
+ readonly isDeleting: boolean;
9
+ /** Error from the last failed delete, or `null` when healthy. */
10
+ readonly error: Error | null;
11
+ /** Reset `error` to `null`. */
12
+ readonly clearError: () => void;
13
+ }
14
+ /**
15
+ * Mutation hook that wraps `platformclient.delete()` with loading
16
+ * and error state.
17
+ *
18
+ * Deletes a platform client by its resource ID. Returns the deleted
19
+ * {@link PlatformClient} on success so callers can confirm which
20
+ * resource was removed.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const { deletePlatformClient, isDeleting, error } = useDeletePlatformClient();
25
+ *
26
+ * await deletePlatformClient({ resourceId: "pc-abc123" });
27
+ * refetch(); // refresh the list after deletion
28
+ * ```
29
+ */
30
+ export declare function useDeletePlatformClient(): UseDeletePlatformClientReturn;
31
+ //# sourceMappingURL=useDeletePlatformClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeletePlatformClient.d.ts","sourceRoot":"","sources":["../../src/platform-client/useDeletePlatformClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AAI9F,uDAAuD;AACvD,MAAM,WAAW,6BAA6B;IAC5C,6FAA6F;IAC7F,QAAQ,CAAC,oBAAoB,EAAE,CAC7B,KAAK,EAAE,mBAAmB,KACvB,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,IAAI,6BAA6B,CAyBvE"}
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { useStigmer } from "../hooks";
4
+ import { toError } from "../internal/toError";
5
+ /**
6
+ * Mutation hook that wraps `platformclient.delete()` with loading
7
+ * and error state.
8
+ *
9
+ * Deletes a platform client by its resource ID. Returns the deleted
10
+ * {@link PlatformClient} on success so callers can confirm which
11
+ * resource was removed.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { deletePlatformClient, isDeleting, error } = useDeletePlatformClient();
16
+ *
17
+ * await deletePlatformClient({ resourceId: "pc-abc123" });
18
+ * refetch(); // refresh the list after deletion
19
+ * ```
20
+ */
21
+ export function useDeletePlatformClient() {
22
+ const stigmer = useStigmer();
23
+ const [isDeleting, setIsDeleting] = useState(false);
24
+ const [error, setError] = useState(null);
25
+ const clearError = useCallback(() => setError(null), []);
26
+ const deletePlatformClient = useCallback(async (input) => {
27
+ setIsDeleting(true);
28
+ setError(null);
29
+ try {
30
+ return await stigmer.platformclient.delete(input);
31
+ }
32
+ catch (err) {
33
+ setError(toError(err));
34
+ throw err;
35
+ }
36
+ finally {
37
+ setIsDeleting(false);
38
+ }
39
+ }, [stigmer]);
40
+ return { deletePlatformClient, isDeleting, error, clearError };
41
+ }
42
+ //# sourceMappingURL=useDeletePlatformClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeletePlatformClient.js","sourceRoot":"","sources":["../../src/platform-client/useDeletePlatformClient.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAgB9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,oBAAoB,GAAG,WAAW,CACtC,KAAK,EAAE,KAA0B,EAA2B,EAAE;QAC5D,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACjE,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { PlatformClient } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/api_pb";
2
+ /** Return value of {@link usePlatformClient}. */
3
+ export interface UsePlatformClientReturn {
4
+ /** The fetched PlatformClient, or `null` while loading or on error. */
5
+ readonly platformClient: PlatformClient | null;
6
+ /** `true` while the initial fetch or a refetch is in flight. */
7
+ readonly isLoading: boolean;
8
+ /** Error from the last failed request, or `null` when healthy. */
9
+ readonly error: Error | null;
10
+ /** Discard cached data and re-fetch from the server. */
11
+ readonly refetch: () => void;
12
+ }
13
+ /**
14
+ * Data hook that fetches a single PlatformClient by ID.
15
+ *
16
+ * Pass `null` to skip fetching (stable no-op). When the `id` changes,
17
+ * the previous in-flight request is discarded and a fresh fetch begins.
18
+ *
19
+ * Returns the full proto {@link PlatformClient} resource so consumers
20
+ * have access to metadata, spec (client ID, expiry, JIT config), and
21
+ * status without additional calls.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * function PlatformClientDetail({ pcId }: { pcId: string }) {
26
+ * const { platformClient, isLoading, error } = usePlatformClient(pcId);
27
+ *
28
+ * if (isLoading) return <Skeleton />;
29
+ * if (error) return <ErrorMessage error={error} />;
30
+ * if (!platformClient) return <NotFound />;
31
+ *
32
+ * return <h1>{platformClient.metadata?.name}</h1>;
33
+ * }
34
+ * ```
35
+ */
36
+ export declare function usePlatformClient(id: string | null): UsePlatformClientReturn;
37
+ //# sourceMappingURL=usePlatformClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlatformClient.d.ts","sourceRoot":"","sources":["../../src/platform-client/usePlatformClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AAI9F,iDAAiD;AACjD,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/C,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,GAAG,IAAI,GAChB,uBAAuB,CAyCzB"}
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import { useStigmer } from "../hooks";
4
+ import { toError } from "../internal/toError";
5
+ /**
6
+ * Data hook that fetches a single PlatformClient by ID.
7
+ *
8
+ * Pass `null` to skip fetching (stable no-op). When the `id` changes,
9
+ * the previous in-flight request is discarded and a fresh fetch begins.
10
+ *
11
+ * Returns the full proto {@link PlatformClient} resource so consumers
12
+ * have access to metadata, spec (client ID, expiry, JIT config), and
13
+ * status without additional calls.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * function PlatformClientDetail({ pcId }: { pcId: string }) {
18
+ * const { platformClient, isLoading, error } = usePlatformClient(pcId);
19
+ *
20
+ * if (isLoading) return <Skeleton />;
21
+ * if (error) return <ErrorMessage error={error} />;
22
+ * if (!platformClient) return <NotFound />;
23
+ *
24
+ * return <h1>{platformClient.metadata?.name}</h1>;
25
+ * }
26
+ * ```
27
+ */
28
+ export function usePlatformClient(id) {
29
+ const stigmer = useStigmer();
30
+ const [platformClient, setPlatformClient] = useState(null);
31
+ const [isLoading, setIsLoading] = useState(false);
32
+ const [error, setError] = useState(null);
33
+ const [fetchKey, setFetchKey] = useState(0);
34
+ const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
35
+ useEffect(() => {
36
+ if (!id) {
37
+ setPlatformClient(null);
38
+ setIsLoading(false);
39
+ setError(null);
40
+ return;
41
+ }
42
+ const cancelled = { current: false };
43
+ setIsLoading(true);
44
+ setError(null);
45
+ stigmer.platformclient.get(id).then((result) => {
46
+ if (cancelled.current)
47
+ return;
48
+ setPlatformClient(result);
49
+ setIsLoading(false);
50
+ }, (err) => {
51
+ if (cancelled.current)
52
+ return;
53
+ setError(toError(err));
54
+ setIsLoading(false);
55
+ });
56
+ return () => {
57
+ cancelled.current = true;
58
+ };
59
+ }, [id, stigmer, fetchKey]);
60
+ return { platformClient, isLoading, error, refetch };
61
+ }
62
+ //# sourceMappingURL=usePlatformClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlatformClient.js","sourceRoot":"","sources":["../../src/platform-client/usePlatformClient.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAc9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAAiB;IAEjB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GACvC,QAAQ,CAAwB,IAAI,CAAC,CAAC;IACxC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,OAAO;QACT,CAAC;QAED,MAAM,SAAS,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CACjC,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC1B,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACN,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { PlatformClient } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/api_pb";
2
+ /** Return value of {@link usePlatformClientList}. */
3
+ export interface UsePlatformClientListReturn {
4
+ /** All platform clients for the organization. Empty while loading or on error. */
5
+ readonly platformClients: readonly PlatformClient[];
6
+ /** `true` while the initial fetch or a refetch is in flight. */
7
+ readonly isLoading: boolean;
8
+ /** Error from the last failed request, or `null` when healthy. */
9
+ readonly error: Error | null;
10
+ /** Discard cached data and re-fetch from the server. */
11
+ readonly refetch: () => void;
12
+ }
13
+ /**
14
+ * Data hook that fetches all platform clients for an organization.
15
+ *
16
+ * Platform clients are admin-level resources with small cardinality
17
+ * (typically 1–5 per org), so results are returned as a flat list
18
+ * without pagination.
19
+ *
20
+ * Pass `null` to skip fetching (stable no-op). Call `refetch()` to
21
+ * re-query after mutations (create / update / delete / rotateSecret).
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * function PlatformClientSettings({ org }: { org: string }) {
26
+ * const { platformClients, isLoading, error } = usePlatformClientList(org);
27
+ *
28
+ * if (isLoading) return <Skeleton />;
29
+ * if (error) return <ErrorMessage error={error} />;
30
+ *
31
+ * return (
32
+ * <ul>
33
+ * {platformClients.map((pc) => (
34
+ * <li key={pc.metadata?.id}>{pc.metadata?.name}</li>
35
+ * ))}
36
+ * </ul>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function usePlatformClientList(org: string | null): UsePlatformClientListReturn;
42
+ //# sourceMappingURL=usePlatformClientList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlatformClientList.d.ts","sourceRoot":"","sources":["../../src/platform-client/usePlatformClientList.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AAK9F,qDAAqD;AACrD,MAAM,WAAW,2BAA2B;IAC1C,kFAAkF;IAClF,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IACpD,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,IAAI,GACjB,2BAA2B,CA4C7B"}
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import { create } from "@bufbuild/protobuf";
4
+ import { ListPlatformClientsByOrgInputSchema } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/io_pb";
5
+ import { useStigmer } from "../hooks";
6
+ import { toError } from "../internal/toError";
7
+ /**
8
+ * Data hook that fetches all platform clients for an organization.
9
+ *
10
+ * Platform clients are admin-level resources with small cardinality
11
+ * (typically 1–5 per org), so results are returned as a flat list
12
+ * without pagination.
13
+ *
14
+ * Pass `null` to skip fetching (stable no-op). Call `refetch()` to
15
+ * re-query after mutations (create / update / delete / rotateSecret).
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * function PlatformClientSettings({ org }: { org: string }) {
20
+ * const { platformClients, isLoading, error } = usePlatformClientList(org);
21
+ *
22
+ * if (isLoading) return <Skeleton />;
23
+ * if (error) return <ErrorMessage error={error} />;
24
+ *
25
+ * return (
26
+ * <ul>
27
+ * {platformClients.map((pc) => (
28
+ * <li key={pc.metadata?.id}>{pc.metadata?.name}</li>
29
+ * ))}
30
+ * </ul>
31
+ * );
32
+ * }
33
+ * ```
34
+ */
35
+ export function usePlatformClientList(org) {
36
+ const stigmer = useStigmer();
37
+ const [platformClients, setPlatformClients] = useState([]);
38
+ const [isLoading, setIsLoading] = useState(false);
39
+ const [error, setError] = useState(null);
40
+ const [fetchKey, setFetchKey] = useState(0);
41
+ const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
42
+ useEffect(() => {
43
+ if (!org) {
44
+ setPlatformClients([]);
45
+ setIsLoading(false);
46
+ setError(null);
47
+ return;
48
+ }
49
+ const cancelled = { current: false };
50
+ setIsLoading(true);
51
+ setError(null);
52
+ stigmer.platformclient
53
+ .listByOrg(create(ListPlatformClientsByOrgInputSchema, { org }))
54
+ .then((result) => {
55
+ if (cancelled.current)
56
+ return;
57
+ setPlatformClients([...result.entries]);
58
+ setIsLoading(false);
59
+ }, (err) => {
60
+ if (cancelled.current)
61
+ return;
62
+ setError(toError(err));
63
+ setIsLoading(false);
64
+ });
65
+ return () => {
66
+ cancelled.current = true;
67
+ };
68
+ }, [org, stigmer, fetchKey]);
69
+ return { platformClients, isLoading, error, refetch };
70
+ }
71
+ //# sourceMappingURL=usePlatformClientList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePlatformClientList.js","sourceRoot":"","sources":["../../src/platform-client/usePlatformClientList.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,mCAAmC,EAAE,MAAM,wDAAwD,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAc9C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAkB;IAElB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAmB,EAAE,CAAC,CAAC;IAC7E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,kBAAkB,CAAC,EAAE,CAAC,CAAC;YACvB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;YACf,OAAO;QACT,CAAC;QAED,MAAM,SAAS,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,OAAO,CAAC,cAAc;aACnB,SAAS,CACR,MAAM,CAAC,mCAAmC,EAAE,EAAE,GAAG,EAAE,CAAC,CACrD;aACA,IAAI,CACH,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,kBAAkB,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACxC,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACN,IAAI,SAAS,CAAC,OAAO;gBAAE,OAAO;YAC9B,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CACF,CAAC;QAEJ,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7B,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { PlatformClientCreateResponse } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/io_pb";
2
+ /** Return value of {@link useRotatePlatformClientSecret}. */
3
+ export interface UseRotatePlatformClientSecretReturn {
4
+ /**
5
+ * Rotate the client secret for a platform client by its resource ID.
6
+ * Resolves with a {@link PlatformClientCreateResponse} containing the
7
+ * updated resource and the **one-time new raw client secret**.
8
+ */
9
+ readonly rotateSecret: (id: string) => Promise<PlatformClientCreateResponse>;
10
+ /** `true` while the rotation request is in flight. */
11
+ readonly isRotating: boolean;
12
+ /** Error from the last failed rotation, or `null` when healthy. */
13
+ readonly error: Error | null;
14
+ /** Reset `error` to `null`. */
15
+ readonly clearError: () => void;
16
+ }
17
+ /**
18
+ * Mutation hook that wraps `platformclient.rotateSecret()` with
19
+ * loading and error state.
20
+ *
21
+ * Generates a new client secret, invalidating the previous one.
22
+ * The response includes a **one-time raw client secret** — it must
23
+ * be shown to the user immediately as the server never returns it
24
+ * again.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * const { rotateSecret, isRotating, error } = useRotatePlatformClientSecret();
29
+ *
30
+ * const response = await rotateSecret("pc-abc123");
31
+ * // response.clientSecret is the new one-time raw secret
32
+ * ```
33
+ */
34
+ export declare function useRotatePlatformClientSecret(): UseRotatePlatformClientSecretReturn;
35
+ //# sourceMappingURL=useRotatePlatformClientSecret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRotatePlatformClientSecret.d.ts","sourceRoot":"","sources":["../../src/platform-client/useRotatePlatformClientSecret.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAI3G,6DAA6D;AAC7D,MAAM,WAAW,mCAAmC;IAClD;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,sDAAsD;IACtD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,IAAI,mCAAmC,CAyBnF"}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { useStigmer } from "../hooks";
4
+ import { toError } from "../internal/toError";
5
+ /**
6
+ * Mutation hook that wraps `platformclient.rotateSecret()` with
7
+ * loading and error state.
8
+ *
9
+ * Generates a new client secret, invalidating the previous one.
10
+ * The response includes a **one-time raw client secret** — it must
11
+ * be shown to the user immediately as the server never returns it
12
+ * again.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * const { rotateSecret, isRotating, error } = useRotatePlatformClientSecret();
17
+ *
18
+ * const response = await rotateSecret("pc-abc123");
19
+ * // response.clientSecret is the new one-time raw secret
20
+ * ```
21
+ */
22
+ export function useRotatePlatformClientSecret() {
23
+ const stigmer = useStigmer();
24
+ const [isRotating, setIsRotating] = useState(false);
25
+ const [error, setError] = useState(null);
26
+ const clearError = useCallback(() => setError(null), []);
27
+ const rotateSecret = useCallback(async (id) => {
28
+ setIsRotating(true);
29
+ setError(null);
30
+ try {
31
+ return await stigmer.platformclient.rotateSecret(id);
32
+ }
33
+ catch (err) {
34
+ setError(toError(err));
35
+ throw err;
36
+ }
37
+ finally {
38
+ setIsRotating(false);
39
+ }
40
+ }, [stigmer]);
41
+ return { rotateSecret, isRotating, error, clearError };
42
+ }
43
+ //# sourceMappingURL=useRotatePlatformClientSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRotatePlatformClientSecret.js","sourceRoot":"","sources":["../../src/platform-client/useRotatePlatformClientSecret.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAoB9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,WAAW,CAC9B,KAAK,EAAE,EAAU,EAAyC,EAAE;QAC1D,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { PlatformClientInput } from "@stigmer/sdk";
2
+ import type { PlatformClient } from "@stigmer/protos/ai/stigmer/iam/platformclient/v1/api_pb";
3
+ /** Return value of {@link useUpdatePlatformClient}. */
4
+ export interface UseUpdatePlatformClientReturn {
5
+ /** Submit a {@link PlatformClientInput} to update an existing platform client. Resolves with the updated resource. */
6
+ readonly update: (input: PlatformClientInput) => Promise<PlatformClient>;
7
+ /** `true` while the update request is in flight. */
8
+ readonly isUpdating: boolean;
9
+ /** Error from the last failed update, or `null` when healthy. */
10
+ readonly error: Error | null;
11
+ /** Reset `error` to `null`. */
12
+ readonly clearError: () => void;
13
+ }
14
+ /**
15
+ * Mutation hook that wraps `platformclient.update()` with loading
16
+ * and error state.
17
+ *
18
+ * Updates an existing platform client. The input must include the
19
+ * `slug` field to identify the target resource, along with the
20
+ * updated spec fields. Credential fields (`clientId`,
21
+ * `clientSecretHash`, `secretFingerprint`) are computed and
22
+ * preserved by the backend — do not set them in the input.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * const { update, isUpdating, error } = useUpdatePlatformClient();
27
+ *
28
+ * await update({
29
+ * name: "my-saas-backend",
30
+ * slug: "my-saas-backend",
31
+ * org: "acme",
32
+ * autoProvisionAccounts: true,
33
+ * autoGrantOnOrg: true,
34
+ * });
35
+ * refetch(); // refresh detail view
36
+ * ```
37
+ */
38
+ export declare function useUpdatePlatformClient(): UseUpdatePlatformClientReturn;
39
+ //# sourceMappingURL=useUpdatePlatformClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdatePlatformClient.d.ts","sourceRoot":"","sources":["../../src/platform-client/useUpdatePlatformClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AAI9F,uDAAuD;AACvD,MAAM,WAAW,6BAA6B;IAC5C,sHAAsH;IACtH,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,IAAI,6BAA6B,CAyBvE"}
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { useStigmer } from "../hooks";
4
+ import { toError } from "../internal/toError";
5
+ /**
6
+ * Mutation hook that wraps `platformclient.update()` with loading
7
+ * and error state.
8
+ *
9
+ * Updates an existing platform client. The input must include the
10
+ * `slug` field to identify the target resource, along with the
11
+ * updated spec fields. Credential fields (`clientId`,
12
+ * `clientSecretHash`, `secretFingerprint`) are computed and
13
+ * preserved by the backend — do not set them in the input.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const { update, isUpdating, error } = useUpdatePlatformClient();
18
+ *
19
+ * await update({
20
+ * name: "my-saas-backend",
21
+ * slug: "my-saas-backend",
22
+ * org: "acme",
23
+ * autoProvisionAccounts: true,
24
+ * autoGrantOnOrg: true,
25
+ * });
26
+ * refetch(); // refresh detail view
27
+ * ```
28
+ */
29
+ export function useUpdatePlatformClient() {
30
+ const stigmer = useStigmer();
31
+ const [isUpdating, setIsUpdating] = useState(false);
32
+ const [error, setError] = useState(null);
33
+ const clearError = useCallback(() => setError(null), []);
34
+ const update = useCallback(async (input) => {
35
+ setIsUpdating(true);
36
+ setError(null);
37
+ try {
38
+ return await stigmer.platformclient.update(input);
39
+ }
40
+ catch (err) {
41
+ setError(toError(err));
42
+ throw err;
43
+ }
44
+ finally {
45
+ setIsUpdating(false);
46
+ }
47
+ }, [stigmer]);
48
+ return { update, isUpdating, error, clearError };
49
+ }
50
+ //# sourceMappingURL=useUpdatePlatformClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdatePlatformClient.js","sourceRoot":"","sources":["../../src/platform-client/useUpdatePlatformClient.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAc9C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,WAAW,CACxB,KAAK,EAAE,KAA0B,EAA2B,EAAE;QAC5D,aAAa,CAAC,IAAI,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACnD,CAAC"}