@constructive-io/react 1.21.46 → 1.21.48

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 (109) hide show
  1. package/admin/schema-types.d.ts +4 -0
  2. package/agent/schema-types.d.ts +4 -0
  3. package/api/orm/input-types.d.ts +663 -69
  4. package/api/orm/input-types.js +22 -0
  5. package/api/schema-types.d.ts +199 -44
  6. package/auth/schema-types.d.ts +4 -0
  7. package/compute/schema-types.d.ts +4 -0
  8. package/config/schema-types.d.ts +4 -0
  9. package/esm/admin/schema-types.d.ts +4 -0
  10. package/esm/agent/schema-types.d.ts +4 -0
  11. package/esm/api/orm/input-types.d.ts +663 -69
  12. package/esm/api/orm/input-types.js +22 -0
  13. package/esm/api/schema-types.d.ts +199 -44
  14. package/esm/auth/schema-types.d.ts +4 -0
  15. package/esm/compute/schema-types.d.ts +4 -0
  16. package/esm/config/schema-types.d.ts +4 -0
  17. package/esm/infra/schema-types.d.ts +4 -0
  18. package/esm/modules/hooks/index.d.ts +1 -1
  19. package/esm/modules/hooks/index.js +1 -1
  20. package/esm/modules/hooks/invalidation.d.ts +6 -0
  21. package/esm/modules/hooks/invalidation.js +17 -1
  22. package/esm/modules/hooks/mutation-keys.d.ts +12 -0
  23. package/esm/modules/hooks/mutation-keys.js +7 -0
  24. package/esm/modules/hooks/mutations/index.d.ts +3 -0
  25. package/esm/modules/hooks/mutations/index.js +3 -0
  26. package/esm/modules/hooks/mutations/useCreatePrincipalAuthModuleMutation.d.ts +2 -2
  27. package/esm/modules/hooks/mutations/useCreatePrincipalAuthModuleMutation.js +1 -1
  28. package/esm/modules/hooks/mutations/useCreatePrincipalsModuleMutation.d.ts +34 -0
  29. package/esm/modules/hooks/mutations/useCreatePrincipalsModuleMutation.js +31 -0
  30. package/esm/modules/hooks/mutations/useDeletePrincipalAuthModuleMutation.d.ts +2 -2
  31. package/esm/modules/hooks/mutations/useDeletePrincipalAuthModuleMutation.js +1 -1
  32. package/esm/modules/hooks/mutations/useDeletePrincipalsModuleMutation.d.ts +38 -0
  33. package/esm/modules/hooks/mutations/useDeletePrincipalsModuleMutation.js +36 -0
  34. package/esm/modules/hooks/mutations/useUpdatePrincipalAuthModuleMutation.d.ts +2 -2
  35. package/esm/modules/hooks/mutations/useUpdatePrincipalAuthModuleMutation.js +1 -1
  36. package/esm/modules/hooks/mutations/useUpdatePrincipalsModuleMutation.d.ts +40 -0
  37. package/esm/modules/hooks/mutations/useUpdatePrincipalsModuleMutation.js +37 -0
  38. package/esm/modules/hooks/queries/index.d.ts +2 -0
  39. package/esm/modules/hooks/queries/index.js +2 -0
  40. package/esm/modules/hooks/queries/usePrincipalAuthModuleQuery.d.ts +4 -4
  41. package/esm/modules/hooks/queries/usePrincipalAuthModuleQuery.js +1 -1
  42. package/esm/modules/hooks/queries/usePrincipalAuthModulesQuery.d.ts +4 -4
  43. package/esm/modules/hooks/queries/usePrincipalAuthModulesQuery.js +1 -1
  44. package/esm/modules/hooks/queries/usePrincipalsModuleQuery.d.ts +65 -0
  45. package/esm/modules/hooks/queries/usePrincipalsModuleQuery.js +47 -0
  46. package/esm/modules/hooks/queries/usePrincipalsModulesQuery.d.ts +69 -0
  47. package/esm/modules/hooks/queries/usePrincipalsModulesQuery.js +32 -0
  48. package/esm/modules/hooks/query-keys.d.ts +14 -0
  49. package/esm/modules/hooks/query-keys.js +8 -0
  50. package/esm/modules/orm/index.d.ts +2 -0
  51. package/esm/modules/orm/index.js +2 -0
  52. package/esm/modules/orm/input-types.d.ts +190 -1
  53. package/esm/modules/orm/models/index.d.ts +1 -0
  54. package/esm/modules/orm/models/index.js +1 -0
  55. package/esm/modules/orm/models/principalsModule.d.ts +54 -0
  56. package/esm/modules/orm/models/principalsModule.js +100 -0
  57. package/esm/modules/schema-types.d.ts +124 -1
  58. package/esm/modules/types.d.ts +16 -0
  59. package/esm/objects/schema-types.d.ts +4 -0
  60. package/esm/remote/schema-types.d.ts +4 -0
  61. package/esm/storage/schema-types.d.ts +4 -0
  62. package/esm/usage/schema-types.d.ts +4 -0
  63. package/infra/schema-types.d.ts +4 -0
  64. package/modules/hooks/index.d.ts +1 -1
  65. package/modules/hooks/index.js +1 -1
  66. package/modules/hooks/invalidation.d.ts +6 -0
  67. package/modules/hooks/invalidation.js +16 -0
  68. package/modules/hooks/mutation-keys.d.ts +12 -0
  69. package/modules/hooks/mutation-keys.js +8 -1
  70. package/modules/hooks/mutations/index.d.ts +3 -0
  71. package/modules/hooks/mutations/index.js +3 -0
  72. package/modules/hooks/mutations/useCreatePrincipalAuthModuleMutation.d.ts +2 -2
  73. package/modules/hooks/mutations/useCreatePrincipalAuthModuleMutation.js +1 -1
  74. package/modules/hooks/mutations/useCreatePrincipalsModuleMutation.d.ts +34 -0
  75. package/modules/hooks/mutations/useCreatePrincipalsModuleMutation.js +34 -0
  76. package/modules/hooks/mutations/useDeletePrincipalAuthModuleMutation.d.ts +2 -2
  77. package/modules/hooks/mutations/useDeletePrincipalAuthModuleMutation.js +1 -1
  78. package/modules/hooks/mutations/useDeletePrincipalsModuleMutation.d.ts +38 -0
  79. package/modules/hooks/mutations/useDeletePrincipalsModuleMutation.js +39 -0
  80. package/modules/hooks/mutations/useUpdatePrincipalAuthModuleMutation.d.ts +2 -2
  81. package/modules/hooks/mutations/useUpdatePrincipalAuthModuleMutation.js +1 -1
  82. package/modules/hooks/mutations/useUpdatePrincipalsModuleMutation.d.ts +40 -0
  83. package/modules/hooks/mutations/useUpdatePrincipalsModuleMutation.js +40 -0
  84. package/modules/hooks/queries/index.d.ts +2 -0
  85. package/modules/hooks/queries/index.js +2 -0
  86. package/modules/hooks/queries/usePrincipalAuthModuleQuery.d.ts +4 -4
  87. package/modules/hooks/queries/usePrincipalAuthModuleQuery.js +1 -1
  88. package/modules/hooks/queries/usePrincipalAuthModulesQuery.d.ts +4 -4
  89. package/modules/hooks/queries/usePrincipalAuthModulesQuery.js +1 -1
  90. package/modules/hooks/queries/usePrincipalsModuleQuery.d.ts +65 -0
  91. package/modules/hooks/queries/usePrincipalsModuleQuery.js +53 -0
  92. package/modules/hooks/queries/usePrincipalsModulesQuery.d.ts +69 -0
  93. package/modules/hooks/queries/usePrincipalsModulesQuery.js +38 -0
  94. package/modules/hooks/query-keys.d.ts +14 -0
  95. package/modules/hooks/query-keys.js +9 -1
  96. package/modules/orm/index.d.ts +2 -0
  97. package/modules/orm/index.js +2 -0
  98. package/modules/orm/input-types.d.ts +190 -1
  99. package/modules/orm/models/index.d.ts +1 -0
  100. package/modules/orm/models/index.js +3 -1
  101. package/modules/orm/models/principalsModule.d.ts +54 -0
  102. package/modules/orm/models/principalsModule.js +104 -0
  103. package/modules/schema-types.d.ts +124 -1
  104. package/modules/types.d.ts +16 -0
  105. package/objects/schema-types.d.ts +4 -0
  106. package/package.json +3 -3
  107. package/remote/schema-types.d.ts +4 -0
  108. package/storage/schema-types.d.ts +4 -0
  109. package/usage/schema-types.d.ts +4 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
4
4
  * @generated by @constructive-io/graphql-codegen
5
5
  * DO NOT EDIT - changes will be overwritten
6
6
  */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
7
+ import type { PrincipalsModuleSelect, PrincipalsModuleWithRelations, CreatePrincipalsModuleInput } from '../../orm/input-types';
8
+ import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
+ export type { PrincipalsModuleSelect, PrincipalsModuleWithRelations, CreatePrincipalsModuleInput, } from '../../orm/input-types';
10
+ /**
11
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { mutate, isPending } = useCreatePrincipalsModuleMutation({
16
+ * selection: { fields: { id: true, name: true } },
17
+ * });
18
+ *
19
+ * mutate({ name: 'New item' });
20
+ * ```
21
+ */
22
+ export declare function useCreatePrincipalsModuleMutation<S extends PrincipalsModuleSelect>(params: {
23
+ selection: {
24
+ fields: S & PrincipalsModuleSelect;
25
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
26
+ } & Omit<UseMutationOptions<{
27
+ createPrincipalsModule: {
28
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
29
+ };
30
+ }, Error, CreatePrincipalsModuleInput['principalsModule']>, 'mutationFn'>): UseMutationResult<{
31
+ createPrincipalsModule: {
32
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
33
+ };
34
+ }, Error, CreatePrincipalsModuleInput['principalsModule']>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
4
+ * @generated by @constructive-io/graphql-codegen
5
+ * DO NOT EDIT - changes will be overwritten
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.useCreatePrincipalsModuleMutation = useCreatePrincipalsModuleMutation;
9
+ const react_query_1 = require("@tanstack/react-query");
10
+ const client_1 = require("../client");
11
+ const selection_1 = require("../selection");
12
+ const query_keys_1 = require("../query-keys");
13
+ const mutation_keys_1 = require("../mutation-keys");
14
+ function useCreatePrincipalsModuleMutation(params) {
15
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
16
+ const { selection: _selection, ...mutationOptions } = params ?? {};
17
+ void _selection;
18
+ const queryClient = (0, react_query_1.useQueryClient)();
19
+ return (0, react_query_1.useMutation)({
20
+ mutationKey: mutation_keys_1.principalsModuleMutationKeys.create(),
21
+ mutationFn: (data) => (0, client_1.getClient)()
22
+ .principalsModule.create({
23
+ data,
24
+ select: args.select,
25
+ })
26
+ .unwrap(),
27
+ onSuccess: () => {
28
+ queryClient.invalidateQueries({
29
+ queryKey: query_keys_1.principalsModuleKeys.lists(),
30
+ });
31
+ },
32
+ ...mutationOptions,
33
+ });
34
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
2
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
3
  * @generated by @constructive-io/graphql-codegen
4
4
  * DO NOT EDIT - changes will be overwritten
5
5
  */
@@ -8,7 +8,7 @@ import type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations } from
8
8
  import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
9
  export type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations, } from '../../orm/input-types';
10
10
  /**
11
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
11
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
12
12
  *
13
13
  * @example
14
14
  * ```tsx
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
4
4
  * @generated by @constructive-io/graphql-codegen
5
5
  * DO NOT EDIT - changes will be overwritten
6
6
  */
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
7
+ import type { PrincipalsModuleSelect, PrincipalsModuleWithRelations } from '../../orm/input-types';
8
+ import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
+ export type { PrincipalsModuleSelect, PrincipalsModuleWithRelations } from '../../orm/input-types';
10
+ /**
11
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { mutate, isPending } = useDeletePrincipalsModuleMutation({
16
+ * selection: { fields: { id: true } },
17
+ * });
18
+ *
19
+ * mutate({ id: 'value-to-delete' });
20
+ * ```
21
+ */
22
+ export declare function useDeletePrincipalsModuleMutation<S extends PrincipalsModuleSelect>(params: {
23
+ selection: {
24
+ fields: S & PrincipalsModuleSelect;
25
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
26
+ } & Omit<UseMutationOptions<{
27
+ deletePrincipalsModule: {
28
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
29
+ };
30
+ }, Error, {
31
+ id: string;
32
+ }>, 'mutationFn'>): UseMutationResult<{
33
+ deletePrincipalsModule: {
34
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
35
+ };
36
+ }, Error, {
37
+ id: string;
38
+ }>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
4
+ * @generated by @constructive-io/graphql-codegen
5
+ * DO NOT EDIT - changes will be overwritten
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.useDeletePrincipalsModuleMutation = useDeletePrincipalsModuleMutation;
9
+ const react_query_1 = require("@tanstack/react-query");
10
+ const client_1 = require("../client");
11
+ const selection_1 = require("../selection");
12
+ const query_keys_1 = require("../query-keys");
13
+ const mutation_keys_1 = require("../mutation-keys");
14
+ function useDeletePrincipalsModuleMutation(params) {
15
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
16
+ const { selection: _selection, ...mutationOptions } = params ?? {};
17
+ void _selection;
18
+ const queryClient = (0, react_query_1.useQueryClient)();
19
+ return (0, react_query_1.useMutation)({
20
+ mutationKey: mutation_keys_1.principalsModuleMutationKeys.all,
21
+ mutationFn: ({ id }) => (0, client_1.getClient)()
22
+ .principalsModule.delete({
23
+ where: {
24
+ id,
25
+ },
26
+ select: args.select,
27
+ })
28
+ .unwrap(),
29
+ onSuccess: (_, variables) => {
30
+ queryClient.removeQueries({
31
+ queryKey: query_keys_1.principalsModuleKeys.detail(variables.id),
32
+ });
33
+ queryClient.invalidateQueries({
34
+ queryKey: query_keys_1.principalsModuleKeys.lists(),
35
+ });
36
+ },
37
+ ...mutationOptions,
38
+ });
39
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
2
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
3
  * @generated by @constructive-io/graphql-codegen
4
4
  * DO NOT EDIT - changes will be overwritten
5
5
  */
@@ -8,7 +8,7 @@ import type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations, Princ
8
8
  import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
9
  export type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations, PrincipalAuthModulePatch, } from '../../orm/input-types';
10
10
  /**
11
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
11
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
12
12
  *
13
13
  * @example
14
14
  * ```tsx
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
4
4
  * @generated by @constructive-io/graphql-codegen
5
5
  * DO NOT EDIT - changes will be overwritten
6
6
  */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
7
+ import type { PrincipalsModuleSelect, PrincipalsModuleWithRelations, PrincipalsModulePatch } from '../../orm/input-types';
8
+ import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
+ export type { PrincipalsModuleSelect, PrincipalsModuleWithRelations, PrincipalsModulePatch, } from '../../orm/input-types';
10
+ /**
11
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { mutate, isPending } = useUpdatePrincipalsModuleMutation({
16
+ * selection: { fields: { id: true, name: true } },
17
+ * });
18
+ *
19
+ * mutate({ id: 'value-here', principalsModulePatch: { name: 'Updated' } });
20
+ * ```
21
+ */
22
+ export declare function useUpdatePrincipalsModuleMutation<S extends PrincipalsModuleSelect>(params: {
23
+ selection: {
24
+ fields: S & PrincipalsModuleSelect;
25
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
26
+ } & Omit<UseMutationOptions<{
27
+ updatePrincipalsModule: {
28
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
29
+ };
30
+ }, Error, {
31
+ id: string;
32
+ principalsModulePatch: PrincipalsModulePatch;
33
+ }>, 'mutationFn'>): UseMutationResult<{
34
+ updatePrincipalsModule: {
35
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S>;
36
+ };
37
+ }, Error, {
38
+ id: string;
39
+ principalsModulePatch: PrincipalsModulePatch;
40
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
4
+ * @generated by @constructive-io/graphql-codegen
5
+ * DO NOT EDIT - changes will be overwritten
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.useUpdatePrincipalsModuleMutation = useUpdatePrincipalsModuleMutation;
9
+ const react_query_1 = require("@tanstack/react-query");
10
+ const client_1 = require("../client");
11
+ const selection_1 = require("../selection");
12
+ const query_keys_1 = require("../query-keys");
13
+ const mutation_keys_1 = require("../mutation-keys");
14
+ function useUpdatePrincipalsModuleMutation(params) {
15
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
16
+ const { selection: _selection, ...mutationOptions } = params ?? {};
17
+ void _selection;
18
+ const queryClient = (0, react_query_1.useQueryClient)();
19
+ return (0, react_query_1.useMutation)({
20
+ mutationKey: mutation_keys_1.principalsModuleMutationKeys.all,
21
+ mutationFn: ({ id, principalsModulePatch, }) => (0, client_1.getClient)()
22
+ .principalsModule.update({
23
+ where: {
24
+ id,
25
+ },
26
+ data: principalsModulePatch,
27
+ select: args.select,
28
+ })
29
+ .unwrap(),
30
+ onSuccess: (_, variables) => {
31
+ queryClient.invalidateQueries({
32
+ queryKey: query_keys_1.principalsModuleKeys.detail(variables.id),
33
+ });
34
+ queryClient.invalidateQueries({
35
+ queryKey: query_keys_1.principalsModuleKeys.lists(),
36
+ });
37
+ },
38
+ ...mutationOptions,
39
+ });
40
+ }
@@ -125,6 +125,8 @@ export * from './usePlansModulesQuery';
125
125
  export * from './usePlansModuleQuery';
126
126
  export * from './usePrincipalAuthModulesQuery';
127
127
  export * from './usePrincipalAuthModuleQuery';
128
+ export * from './usePrincipalsModulesQuery';
129
+ export * from './usePrincipalsModuleQuery';
128
130
  export * from './useProfilesModulesQuery';
129
131
  export * from './useProfilesModuleQuery';
130
132
  export * from './useRateLimitMetersModulesQuery';
@@ -141,6 +141,8 @@ __exportStar(require("./usePlansModulesQuery"), exports);
141
141
  __exportStar(require("./usePlansModuleQuery"), exports);
142
142
  __exportStar(require("./usePrincipalAuthModulesQuery"), exports);
143
143
  __exportStar(require("./usePrincipalAuthModuleQuery"), exports);
144
+ __exportStar(require("./usePrincipalsModulesQuery"), exports);
145
+ __exportStar(require("./usePrincipalsModuleQuery"), exports);
144
146
  __exportStar(require("./useProfilesModulesQuery"), exports);
145
147
  __exportStar(require("./useProfilesModuleQuery"), exports);
146
148
  __exportStar(require("./useRateLimitMetersModulesQuery"), exports);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
2
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
3
  * @generated by @constructive-io/graphql-codegen
4
4
  * DO NOT EDIT - changes will be overwritten
5
5
  */
@@ -10,7 +10,7 @@ export type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations, } fro
10
10
  /** Query key factory - re-exported from query-keys.ts */
11
11
  export declare const principalAuthModuleQueryKey: (id: string | number) => readonly ["principalauthmodule", "detail", string | number];
12
12
  /**
13
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
13
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
14
14
  *
15
15
  * @example
16
16
  * ```tsx
@@ -31,7 +31,7 @@ export declare function usePrincipalAuthModuleQuery<S extends PrincipalAuthModul
31
31
  principalAuthModule: InferSelectResult<PrincipalAuthModuleWithRelations, S> | null;
32
32
  }, Error, TData>, 'queryKey' | 'queryFn'>): UseQueryResult<TData>;
33
33
  /**
34
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
34
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
35
35
  *
36
36
  * @example
37
37
  * ```ts
@@ -50,7 +50,7 @@ export declare function fetchPrincipalAuthModuleQuery<S extends PrincipalAuthMod
50
50
  principalAuthModule: InferSelectResult<PrincipalAuthModuleWithRelations, S> | null;
51
51
  }>;
52
52
  /**
53
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
53
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
54
54
  *
55
55
  * @example
56
56
  * ```ts
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
4
4
  * @generated by @constructive-io/graphql-codegen
5
5
  * DO NOT EDIT - changes will be overwritten
6
6
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
2
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
3
  * @generated by @constructive-io/graphql-codegen
4
4
  * DO NOT EDIT - changes will be overwritten
5
5
  */
@@ -11,7 +11,7 @@ export type { PrincipalAuthModuleSelect, PrincipalAuthModuleWithRelations, Princ
11
11
  /** Query key factory - re-exported from query-keys.ts */
12
12
  export declare const principalAuthModulesQueryKey: (variables?: object) => readonly ["principalauthmodule", "list", object];
13
13
  /**
14
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
14
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
15
15
  *
16
16
  * @example
17
17
  * ```tsx
@@ -35,7 +35,7 @@ export declare function usePrincipalAuthModulesQuery<S extends PrincipalAuthModu
35
35
  principalAuthModules: ConnectionResult<InferSelectResult<PrincipalAuthModuleWithRelations, S>>;
36
36
  }, Error, TData>, 'queryKey' | 'queryFn'>): UseQueryResult<TData>;
37
37
  /**
38
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
38
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
39
39
  *
40
40
  * @example
41
41
  * ```ts
@@ -55,7 +55,7 @@ export declare function fetchPrincipalAuthModulesQuery<S extends PrincipalAuthMo
55
55
  principalAuthModules: ConnectionResult<InferSelectResult<PrincipalAuthModuleWithRelations, S>>;
56
56
  }>;
57
57
  /**
58
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
58
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
59
59
  *
60
60
  * @example
61
61
  * ```ts
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Provisions the principals subsystem: a principals table, a principal_entities junction table, create/delete mutations, and org API key management. Supports both human-owned principals (AuthzDirectOwner, AuthzHumanOnly) and org-owned principals (AuthzEntityMembership with is_admin). Org principal and org API key functions are only generated when an org-scoped memberships_module exists for the database.
3
+ * Provisions credentials for principals on top of principals_module: API keys, child sessions, delegation and token exchange, and org API key management. Requires the built-in auth stack (sessions_module, user_auth_module); installing it provisions principals_module first when the database does not have it. Org API key functions are only generated when an org-scoped memberships_module exists for the database.
4
4
  * @generated by @constructive-io/graphql-codegen
5
5
  * DO NOT EDIT - changes will be overwritten
6
6
  */
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query';
7
+ import type { PrincipalsModuleSelect, PrincipalsModuleWithRelations } from '../../orm/input-types';
8
+ import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types';
9
+ export type { PrincipalsModuleSelect, PrincipalsModuleWithRelations } from '../../orm/input-types';
10
+ /** Query key factory - re-exported from query-keys.ts */
11
+ export declare const principalsModuleQueryKey: (id: string | number) => readonly ["principalsmodule", "detail", string | number];
12
+ /**
13
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const { data, isLoading } = usePrincipalsModuleQuery({
18
+ * id: 'some-id',
19
+ * selection: { fields: { id: true, name: true } },
20
+ * });
21
+ * ```
22
+ */
23
+ export declare function usePrincipalsModuleQuery<S extends PrincipalsModuleSelect, TData = {
24
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S> | null;
25
+ }>(params: {
26
+ id: string;
27
+ selection: {
28
+ fields: S;
29
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
30
+ } & Omit<UseQueryOptions<{
31
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S> | null;
32
+ }, Error, TData>, 'queryKey' | 'queryFn'>): UseQueryResult<TData>;
33
+ /**
34
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const data = await fetchPrincipalsModuleQuery({
39
+ * id: 'some-id',
40
+ * selection: { fields: { id: true } },
41
+ * });
42
+ * ```
43
+ */
44
+ export declare function fetchPrincipalsModuleQuery<S extends PrincipalsModuleSelect>(params: {
45
+ id: string;
46
+ selection: {
47
+ fields: S;
48
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
49
+ }): Promise<{
50
+ principalsModule: InferSelectResult<PrincipalsModuleWithRelations, S> | null;
51
+ }>;
52
+ /**
53
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * await prefetchPrincipalsModuleQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } });
58
+ * ```
59
+ */
60
+ export declare function prefetchPrincipalsModuleQuery<S extends PrincipalsModuleSelect>(queryClient: QueryClient, params: {
61
+ id: string;
62
+ selection: {
63
+ fields: S;
64
+ } & HookStrictSelect<NoInfer<S>, PrincipalsModuleSelect>;
65
+ }): Promise<void>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * Provisions principals as authorization data, with no dependency on sessions or sign-in: the principals, principal_entities and principal_scope_overrides tables, the create/update/delete and scope mutations, the SPRT derivation that keeps a principal's capabilities in step with its owner, and the expiry sweep. The caller that opens the transaction sets jwt.claims.principal_id to a principal's user_id. Credentials for principals (API keys, child sessions, token exchange) are principal_auth_module, which builds on this one.
4
+ * @generated by @constructive-io/graphql-codegen
5
+ * DO NOT EDIT - changes will be overwritten
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.principalsModuleQueryKey = void 0;
9
+ exports.usePrincipalsModuleQuery = usePrincipalsModuleQuery;
10
+ exports.fetchPrincipalsModuleQuery = fetchPrincipalsModuleQuery;
11
+ exports.prefetchPrincipalsModuleQuery = prefetchPrincipalsModuleQuery;
12
+ const react_query_1 = require("@tanstack/react-query");
13
+ const client_1 = require("../client");
14
+ const selection_1 = require("../selection");
15
+ const query_keys_1 = require("../query-keys");
16
+ /** Query key factory - re-exported from query-keys.ts */
17
+ exports.principalsModuleQueryKey = query_keys_1.principalsModuleKeys.detail;
18
+ function usePrincipalsModuleQuery(params) {
19
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
20
+ const { selection: _selection, ...queryOptions } = params ?? {};
21
+ void _selection;
22
+ return (0, react_query_1.useQuery)({
23
+ queryKey: query_keys_1.principalsModuleKeys.detail(params.id),
24
+ queryFn: () => (0, client_1.getClient)()
25
+ .principalsModule.findOne({
26
+ id: params.id,
27
+ select: args.select,
28
+ })
29
+ .unwrap(),
30
+ ...queryOptions,
31
+ });
32
+ }
33
+ async function fetchPrincipalsModuleQuery(params) {
34
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
35
+ return (0, client_1.getClient)()
36
+ .principalsModule.findOne({
37
+ id: params.id,
38
+ select: args.select,
39
+ })
40
+ .unwrap();
41
+ }
42
+ async function prefetchPrincipalsModuleQuery(queryClient, params) {
43
+ const args = (0, selection_1.buildSelectionArgs)(params.selection);
44
+ await queryClient.prefetchQuery({
45
+ queryKey: query_keys_1.principalsModuleKeys.detail(params.id),
46
+ queryFn: () => (0, client_1.getClient)()
47
+ .principalsModule.findOne({
48
+ id: params.id,
49
+ select: args.select,
50
+ })
51
+ .unwrap(),
52
+ });
53
+ }