@shipfox/client-workspace-settings 4.0.0 → 6.0.1

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 (147) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +51 -0
  3. package/dist/components/members/form-errors.d.ts +1 -0
  4. package/dist/components/members/form-errors.d.ts.map +1 -1
  5. package/dist/components/members/form-errors.js +26 -13
  6. package/dist/components/members/form-errors.js.map +1 -1
  7. package/dist/components/members/workspace-members-section.d.ts.map +1 -1
  8. package/dist/components/members/workspace-members-section.js +31 -28
  9. package/dist/components/members/workspace-members-section.js.map +1 -1
  10. package/dist/core/membership.d.ts +41 -0
  11. package/dist/core/membership.d.ts.map +1 -0
  12. package/dist/core/membership.js +16 -0
  13. package/dist/core/membership.js.map +1 -0
  14. package/dist/feature.d.ts +15 -72
  15. package/dist/feature.d.ts.map +1 -1
  16. package/dist/feature.js +20 -102
  17. package/dist/feature.js.map +1 -1
  18. package/dist/hooks/api/create-invitation.d.ts +4 -2
  19. package/dist/hooks/api/create-invitation.d.ts.map +1 -1
  20. package/dist/hooks/api/create-invitation.js +6 -3
  21. package/dist/hooks/api/create-invitation.js.map +1 -1
  22. package/dist/hooks/api/invitation-mapper.d.ts +2 -2
  23. package/dist/hooks/api/invitation-mapper.d.ts.map +1 -1
  24. package/dist/hooks/api/invitation-mapper.js.map +1 -1
  25. package/dist/hooks/api/list-invitations.d.ts +5 -5
  26. package/dist/hooks/api/list-invitations.d.ts.map +1 -1
  27. package/dist/hooks/api/list-invitations.js.map +1 -1
  28. package/dist/hooks/api/list-members.d.ts +10 -11
  29. package/dist/hooks/api/list-members.d.ts.map +1 -1
  30. package/dist/hooks/api/list-members.js +11 -5
  31. package/dist/hooks/api/list-members.js.map +1 -1
  32. package/dist/hooks/api/membership-mapper.d.ts +4 -0
  33. package/dist/hooks/api/membership-mapper.d.ts.map +1 -0
  34. package/dist/hooks/api/membership-mapper.js +14 -0
  35. package/dist/hooks/api/membership-mapper.js.map +1 -0
  36. package/dist/hooks/api/remove-member.d.ts +2 -1
  37. package/dist/hooks/api/remove-member.d.ts.map +1 -1
  38. package/dist/hooks/api/remove-member.js +6 -8
  39. package/dist/hooks/api/remove-member.js.map +1 -1
  40. package/dist/hooks/api/revoke-invitation.d.ts +2 -1
  41. package/dist/hooks/api/revoke-invitation.d.ts.map +1 -1
  42. package/dist/hooks/api/revoke-invitation.js +4 -4
  43. package/dist/hooks/api/revoke-invitation.js.map +1 -1
  44. package/dist/index.d.ts +0 -7
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +0 -7
  47. package/dist/index.js.map +1 -1
  48. package/dist/tsconfig.test.tsbuildinfo +1 -1
  49. package/package.json +10 -16
  50. package/src/components/members/form-errors.test.ts +57 -4
  51. package/src/components/members/form-errors.ts +21 -10
  52. package/src/components/members/workspace-members-section.tsx +38 -35
  53. package/src/core/membership.test.ts +69 -0
  54. package/src/core/membership.ts +64 -0
  55. package/src/feature.ts +27 -104
  56. package/src/hooks/api/create-invitation.ts +8 -4
  57. package/src/hooks/api/invitation-mapper.ts +2 -2
  58. package/src/hooks/api/list-invitations.ts +2 -2
  59. package/src/hooks/api/list-members.ts +17 -7
  60. package/src/hooks/api/membership-mapper.test.ts +24 -0
  61. package/src/hooks/api/membership-mapper.ts +15 -0
  62. package/src/hooks/api/remove-member.ts +11 -8
  63. package/src/hooks/api/revoke-invitation.ts +11 -6
  64. package/src/index.ts +0 -7
  65. package/test/pages.tsx +1 -5
  66. package/tsconfig.build.tsbuildinfo +1 -1
  67. package/dist/core/invitation.d.ts +0 -15
  68. package/dist/core/invitation.d.ts.map +0 -1
  69. package/dist/core/invitation.js +0 -3
  70. package/dist/core/invitation.js.map +0 -1
  71. package/dist/pages/events-settings-page.d.ts +0 -2
  72. package/dist/pages/events-settings-page.d.ts.map +0 -1
  73. package/dist/pages/events-settings-page.js +0 -30
  74. package/dist/pages/events-settings-page.js.map +0 -1
  75. package/dist/pages/integrations-settings-page.d.ts +0 -2
  76. package/dist/pages/integrations-settings-page.d.ts.map +0 -1
  77. package/dist/pages/integrations-settings-page.js +0 -10
  78. package/dist/pages/integrations-settings-page.js.map +0 -1
  79. package/dist/pages/model-providers-settings-page.d.ts +0 -2
  80. package/dist/pages/model-providers-settings-page.d.ts.map +0 -1
  81. package/dist/pages/model-providers-settings-page.js +0 -20
  82. package/dist/pages/model-providers-settings-page.js.map +0 -1
  83. package/dist/pages/provisioners-settings-page.d.ts +0 -2
  84. package/dist/pages/provisioners-settings-page.d.ts.map +0 -1
  85. package/dist/pages/provisioners-settings-page.js +0 -14
  86. package/dist/pages/provisioners-settings-page.js.map +0 -1
  87. package/dist/pages/runners-settings-page.d.ts +0 -2
  88. package/dist/pages/runners-settings-page.d.ts.map +0 -1
  89. package/dist/pages/runners-settings-page.js +0 -14
  90. package/dist/pages/runners-settings-page.js.map +0 -1
  91. package/dist/pages/secrets-settings-page.d.ts +0 -2
  92. package/dist/pages/secrets-settings-page.d.ts.map +0 -1
  93. package/dist/pages/secrets-settings-page.js +0 -14
  94. package/dist/pages/secrets-settings-page.js.map +0 -1
  95. package/dist/pages/variables-settings-page.d.ts +0 -2
  96. package/dist/pages/variables-settings-page.d.ts.map +0 -1
  97. package/dist/pages/variables-settings-page.js +0 -14
  98. package/dist/pages/variables-settings-page.js.map +0 -1
  99. package/dist/routes/agents.d.ts +0 -6
  100. package/dist/routes/agents.d.ts.map +0 -1
  101. package/dist/routes/agents.js +0 -7
  102. package/dist/routes/agents.js.map +0 -1
  103. package/dist/routes/events.d.ts +0 -8
  104. package/dist/routes/events.d.ts.map +0 -1
  105. package/dist/routes/events.js +0 -9
  106. package/dist/routes/events.js.map +0 -1
  107. package/dist/routes/integrations.d.ts +0 -6
  108. package/dist/routes/integrations.d.ts.map +0 -1
  109. package/dist/routes/integrations.js +0 -7
  110. package/dist/routes/integrations.js.map +0 -1
  111. package/dist/routes/provisioners.d.ts +0 -6
  112. package/dist/routes/provisioners.d.ts.map +0 -1
  113. package/dist/routes/provisioners.js +0 -7
  114. package/dist/routes/provisioners.js.map +0 -1
  115. package/dist/routes/runners.d.ts +0 -6
  116. package/dist/routes/runners.d.ts.map +0 -1
  117. package/dist/routes/runners.js +0 -7
  118. package/dist/routes/runners.js.map +0 -1
  119. package/dist/routes/secrets.d.ts +0 -6
  120. package/dist/routes/secrets.d.ts.map +0 -1
  121. package/dist/routes/secrets.js +0 -7
  122. package/dist/routes/secrets.js.map +0 -1
  123. package/dist/routes/variables.d.ts +0 -6
  124. package/dist/routes/variables.d.ts.map +0 -1
  125. package/dist/routes/variables.js +0 -7
  126. package/dist/routes/variables.js.map +0 -1
  127. package/src/core/invitation.ts +0 -15
  128. package/src/pages/events-settings-page.tsx +0 -25
  129. package/src/pages/integrations-settings-page.test.tsx +0 -72
  130. package/src/pages/integrations-settings-page.tsx +0 -6
  131. package/src/pages/model-providers-settings-page.test.tsx +0 -48
  132. package/src/pages/model-providers-settings-page.tsx +0 -15
  133. package/src/pages/provisioners-settings-page.test.tsx +0 -29
  134. package/src/pages/provisioners-settings-page.tsx +0 -14
  135. package/src/pages/runners-settings-page.test.tsx +0 -23
  136. package/src/pages/runners-settings-page.tsx +0 -14
  137. package/src/pages/secrets-settings-page.tsx +0 -14
  138. package/src/pages/variables-settings-page.tsx +0 -14
  139. package/src/routes/agents.tsx +0 -3
  140. package/src/routes/events.tsx +0 -7
  141. package/src/routes/integrations.tsx +0 -3
  142. package/src/routes/provisioners.tsx +0 -3
  143. package/src/routes/runners.tsx +0 -3
  144. package/src/routes/secrets.tsx +0 -3
  145. package/src/routes/variables.tsx +0 -3
  146. package/test/typecheck/route-ids.tsx +0 -7
  147. package/test/typecheck/settings-composition.tsx +0 -95
package/dist/feature.js CHANGED
@@ -1,4 +1,22 @@
1
1
  import { defineClientFeature } from '@shipfox/client-shell';
2
+ export const workspaceSettingsNavigation = [
3
+ {
4
+ id: 'nav.settings',
5
+ scope: 'workspace',
6
+ label: 'Settings',
7
+ to: '/workspaces/$wid/settings',
8
+ order: 200
9
+ }
10
+ ];
11
+ export const workspaceSettingsSections = [
12
+ {
13
+ id: 'settings.members',
14
+ pathSegment: 'members',
15
+ label: 'Members',
16
+ icon: 'userLine',
17
+ order: 100
18
+ }
19
+ ];
2
20
  export const workspaceSettingsFeature = defineClientFeature({
3
21
  id: 'shipfox.workspace-settings',
4
22
  routes: [
@@ -11,110 +29,10 @@ export const workspaceSettingsFeature = defineClientFeature({
11
29
  path: '/workspaces/$wid/settings/members',
12
30
  parent: 'workspaceSettings',
13
31
  impl: '@shipfox/client-workspace-settings/routes/members'
14
- },
15
- {
16
- path: '/workspaces/$wid/settings/runners',
17
- parent: 'workspaceSettings',
18
- impl: '@shipfox/client-workspace-settings/routes/runners'
19
- },
20
- {
21
- path: '/workspaces/$wid/settings/provisioners',
22
- parent: 'workspaceSettings',
23
- impl: '@shipfox/client-workspace-settings/routes/provisioners'
24
- },
25
- {
26
- path: '/workspaces/$wid/settings/agents',
27
- parent: 'workspaceSettings',
28
- impl: '@shipfox/client-workspace-settings/routes/agents'
29
- },
30
- {
31
- path: '/workspaces/$wid/settings/secrets',
32
- parent: 'workspaceSettings',
33
- impl: '@shipfox/client-workspace-settings/routes/secrets'
34
- },
35
- {
36
- path: '/workspaces/$wid/settings/variables',
37
- parent: 'workspaceSettings',
38
- impl: '@shipfox/client-workspace-settings/routes/variables'
39
- },
40
- {
41
- path: '/workspaces/$wid/settings/integrations',
42
- parent: 'workspaceSettings',
43
- impl: '@shipfox/client-workspace-settings/routes/integrations'
44
- },
45
- {
46
- path: '/workspaces/$wid/settings/events',
47
- parent: 'workspaceSettings',
48
- impl: '@shipfox/client-workspace-settings/routes/events'
49
32
  }
50
33
  ],
51
- navigation: [
52
- {
53
- id: 'nav.settings',
54
- scope: 'workspace',
55
- label: 'Settings',
56
- to: '/workspaces/$wid/settings',
57
- order: 200
58
- }
59
- ],
60
- settingsSections: [
61
- {
62
- id: 'settings.members',
63
- pathSegment: 'members',
64
- label: 'Members',
65
- icon: 'userLine',
66
- order: 100
67
- },
68
- {
69
- id: 'settings.runners',
70
- pathSegment: 'runners',
71
- label: 'Runners',
72
- icon: 'settings3Line',
73
- order: 200
74
- },
75
- {
76
- id: 'settings.provisioners',
77
- pathSegment: 'provisioners',
78
- label: 'Runner provisioners',
79
- icon: 'serverLine',
80
- order: 300
81
- },
82
- {
83
- id: 'settings.agents',
84
- pathSegment: 'agents',
85
- label: 'Agents',
86
- icon: 'robot2Line',
87
- order: 400
88
- },
89
- {
90
- id: 'settings.secrets',
91
- pathSegment: 'secrets',
92
- label: 'Secrets',
93
- icon: 'keyLine',
94
- order: 500
95
- },
96
- {
97
- id: 'settings.variables',
98
- pathSegment: 'variables',
99
- label: 'Variables',
100
- icon: 'bracesLine',
101
- order: 600
102
- },
103
- {
104
- id: 'settings.integrations',
105
- pathSegment: 'integrations',
106
- label: 'Integrations',
107
- icon: 'plugLine',
108
- order: 700
109
- },
110
- {
111
- id: 'settings.events',
112
- pathSegment: 'events',
113
- label: 'Events',
114
- icon: 'pulseLine',
115
- order: 800
116
- }
117
- ]
34
+ navigation: workspaceSettingsNavigation,
35
+ settingsSections: workspaceSettingsSections
118
36
  });
119
37
 
120
38
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {defineClientFeature} from '@shipfox/client-shell';\nimport type {IconName} from '@shipfox/react-ui/icon';\n\nexport const workspaceSettingsFeature = defineClientFeature({\n id: 'shipfox.workspace-settings',\n routes: [\n {\n path: '/workspaces/$wid/settings',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/index',\n },\n {\n path: '/workspaces/$wid/settings/members',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/members',\n },\n {\n path: '/workspaces/$wid/settings/runners',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/runners',\n },\n {\n path: '/workspaces/$wid/settings/provisioners',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/provisioners',\n },\n {\n path: '/workspaces/$wid/settings/agents',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/agents',\n },\n {\n path: '/workspaces/$wid/settings/secrets',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/secrets',\n },\n {\n path: '/workspaces/$wid/settings/variables',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/variables',\n },\n {\n path: '/workspaces/$wid/settings/integrations',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/integrations',\n },\n {\n path: '/workspaces/$wid/settings/events',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/events',\n },\n ],\n navigation: [\n {\n id: 'nav.settings',\n scope: 'workspace',\n label: 'Settings',\n to: '/workspaces/$wid/settings',\n order: 200,\n },\n ],\n settingsSections: [\n {\n id: 'settings.members',\n pathSegment: 'members',\n label: 'Members',\n icon: 'userLine' as IconName,\n order: 100,\n },\n {\n id: 'settings.runners',\n pathSegment: 'runners',\n label: 'Runners',\n icon: 'settings3Line' as IconName,\n order: 200,\n },\n {\n id: 'settings.provisioners',\n pathSegment: 'provisioners',\n label: 'Runner provisioners',\n icon: 'serverLine' as IconName,\n order: 300,\n },\n {\n id: 'settings.agents',\n pathSegment: 'agents',\n label: 'Agents',\n icon: 'robot2Line' as IconName,\n order: 400,\n },\n {\n id: 'settings.secrets',\n pathSegment: 'secrets',\n label: 'Secrets',\n icon: 'keyLine' as IconName,\n order: 500,\n },\n {\n id: 'settings.variables',\n pathSegment: 'variables',\n label: 'Variables',\n icon: 'bracesLine' as IconName,\n order: 600,\n },\n {\n id: 'settings.integrations',\n pathSegment: 'integrations',\n label: 'Integrations',\n icon: 'plugLine' as IconName,\n order: 700,\n },\n {\n id: 'settings.events',\n pathSegment: 'events',\n label: 'Events',\n icon: 'pulseLine' as IconName,\n order: 800,\n },\n ],\n});\n"],"names":["defineClientFeature","workspaceSettingsFeature","id","routes","path","parent","impl","navigation","scope","label","to","order","settingsSections","pathSegment","icon"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,wBAAwB;AAG1D,OAAO,MAAMC,2BAA2BD,oBAAoB;IAC1DE,IAAI;IACJC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;KACD;IACDC,YAAY;QACV;YACEL,IAAI;YACJM,OAAO;YACPC,OAAO;YACPC,IAAI;YACJC,OAAO;QACT;KACD;IACDC,kBAAkB;QAChB;YACEV,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;QACA;YACET,IAAI;YACJW,aAAa;YACbJ,OAAO;YACPK,MAAM;YACNH,OAAO;QACT;KACD;AACH,GAAG"}
1
+ {"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {\n defineClientFeature,\n type NavTabEntry,\n type SettingsSectionEntry,\n} from '@shipfox/client-shell';\n\nexport const workspaceSettingsNavigation = [\n {\n id: 'nav.settings',\n scope: 'workspace',\n label: 'Settings',\n to: '/workspaces/$wid/settings',\n order: 200,\n },\n] as const satisfies readonly NavTabEntry[];\n\nexport const workspaceSettingsSections = [\n {\n id: 'settings.members',\n pathSegment: 'members',\n label: 'Members',\n icon: 'userLine',\n order: 100,\n },\n] as const satisfies readonly SettingsSectionEntry[];\n\nexport const workspaceSettingsFeature = defineClientFeature({\n id: 'shipfox.workspace-settings',\n routes: [\n {\n path: '/workspaces/$wid/settings',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/index',\n },\n {\n path: '/workspaces/$wid/settings/members',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-workspace-settings/routes/members',\n },\n ],\n navigation: workspaceSettingsNavigation,\n settingsSections: workspaceSettingsSections,\n});\n"],"names":["defineClientFeature","workspaceSettingsNavigation","id","scope","label","to","order","workspaceSettingsSections","pathSegment","icon","workspaceSettingsFeature","routes","path","parent","impl","navigation","settingsSections"],"mappings":"AAAA,SACEA,mBAAmB,QAGd,wBAAwB;AAE/B,OAAO,MAAMC,8BAA8B;IACzC;QACEC,IAAI;QACJC,OAAO;QACPC,OAAO;QACPC,IAAI;QACJC,OAAO;IACT;CACD,CAA2C;AAE5C,OAAO,MAAMC,4BAA4B;IACvC;QACEL,IAAI;QACJM,aAAa;QACbJ,OAAO;QACPK,MAAM;QACNH,OAAO;IACT;CACD,CAAoD;AAErD,OAAO,MAAMI,2BAA2BV,oBAAoB;IAC1DE,IAAI;IACJS,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;KACD;IACDC,YAAYd;IACZe,kBAAkBT;AACpB,GAAG"}
@@ -1,3 +1,5 @@
1
- import type { CreateInvitationCommand, Invitation } from '#core/invitation.js';
2
- export declare function useCreateInvitation(workspaceId: string): import("@tanstack/react-query").UseMutationResult<Invitation, Error, CreateInvitationCommand, unknown>;
1
+ import { type CreateInvitationBodyDto } from '@shipfox/api-workspaces-dto';
2
+ import type { CreateInvitationCommand, PendingInvitation } from '#core/membership.js';
3
+ export declare function toCreateInvitationBody(command: CreateInvitationCommand): CreateInvitationBodyDto;
4
+ export declare function useCreateInvitation(workspaceId: string): import("@tanstack/react-query").UseMutationResult<PendingInvitation, Error, CreateInvitationCommand, unknown>;
3
5
  //# sourceMappingURL=create-invitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/create-invitation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,uBAAuB,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAmB7E,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,0GAQtD"}
1
+ {"version":3,"file":"create-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/create-invitation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,uBAAuB,EAAsB,MAAM,6BAA6B,CAAC;AAG9F,OAAO,KAAK,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAmBpF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAEhG;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,iHAQtD"}
@@ -6,12 +6,15 @@ import { listInvitationsQueryOptions } from './list-invitations.js';
6
6
  async function createInvitation(params) {
7
7
  const response = await checkedApiRequest(invitationDtoSchema, `/workspaces/${params.workspaceId}/invitations`, {
8
8
  method: 'POST',
9
- body: {
10
- email: params.command.email
11
- }
9
+ body: toCreateInvitationBody(params.command)
12
10
  });
13
11
  return toInvitation(response);
14
12
  }
13
+ export function toCreateInvitationBody(command) {
14
+ return {
15
+ email: command.email
16
+ };
17
+ }
15
18
  export function useCreateInvitation(workspaceId) {
16
19
  const queryClient = useQueryClient();
17
20
  return useMutation({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/create-invitation.ts"],"sourcesContent":["import {invitationDtoSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {CreateInvitationCommand, Invitation} from '#core/invitation.js';\nimport {toInvitation} from './invitation-mapper.js';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function createInvitation(params: {\n workspaceId: string;\n command: CreateInvitationCommand;\n}): Promise<Invitation> {\n const response = await checkedApiRequest(\n invitationDtoSchema,\n `/workspaces/${params.workspaceId}/invitations`,\n {\n method: 'POST',\n body: {email: params.command.email},\n },\n );\n return toInvitation(response);\n}\n\nexport function useCreateInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: CreateInvitationCommand) => createInvitation({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["invitationDtoSchema","checkedApiRequest","useMutation","useQueryClient","toInvitation","listInvitationsQueryOptions","createInvitation","params","response","workspaceId","method","body","email","command","useCreateInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,8BAA8B;AAChE,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,YAAY,QAAO,yBAAyB;AACpD,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAG/B;IACC,MAAMC,WAAW,MAAMP,kBACrBD,qBACA,CAAC,YAAY,EAAEO,OAAOE,WAAW,CAAC,YAAY,CAAC,EAC/C;QACEC,QAAQ;QACRC,MAAM;YAACC,OAAOL,OAAOM,OAAO,CAACD,KAAK;QAAA;IACpC;IAEF,OAAOR,aAAaI;AACtB;AAEA,OAAO,SAASM,oBAAoBL,WAAmB;IACrD,MAAMM,cAAcZ;IACpB,OAAOD,YAAY;QACjBc,YAAY,CAACH,UAAqCP,iBAAiB;gBAACG;gBAAaI;YAAO;QACxFI,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACb,4BAA4BI;QAClE;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/create-invitation.ts"],"sourcesContent":["import {type CreateInvitationBodyDto, invitationDtoSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {CreateInvitationCommand, PendingInvitation} from '#core/membership.js';\nimport {toInvitation} from './invitation-mapper.js';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function createInvitation(params: {\n workspaceId: string;\n command: CreateInvitationCommand;\n}): Promise<PendingInvitation> {\n const response = await checkedApiRequest(\n invitationDtoSchema,\n `/workspaces/${params.workspaceId}/invitations`,\n {\n method: 'POST',\n body: toCreateInvitationBody(params.command),\n },\n );\n return toInvitation(response);\n}\n\nexport function toCreateInvitationBody(command: CreateInvitationCommand): CreateInvitationBodyDto {\n return {email: command.email};\n}\n\nexport function useCreateInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: CreateInvitationCommand) => createInvitation({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["invitationDtoSchema","checkedApiRequest","useMutation","useQueryClient","toInvitation","listInvitationsQueryOptions","createInvitation","params","response","workspaceId","method","body","toCreateInvitationBody","command","email","useCreateInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAsCA,mBAAmB,QAAO,8BAA8B;AAC9F,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,YAAY,QAAO,yBAAyB;AACpD,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAG/B;IACC,MAAMC,WAAW,MAAMP,kBACrBD,qBACA,CAAC,YAAY,EAAEO,OAAOE,WAAW,CAAC,YAAY,CAAC,EAC/C;QACEC,QAAQ;QACRC,MAAMC,uBAAuBL,OAAOM,OAAO;IAC7C;IAEF,OAAOT,aAAaI;AACtB;AAEA,OAAO,SAASI,uBAAuBC,OAAgC;IACrE,OAAO;QAACC,OAAOD,QAAQC,KAAK;IAAA;AAC9B;AAEA,OAAO,SAASC,oBAAoBN,WAAmB;IACrD,MAAMO,cAAcb;IACpB,OAAOD,YAAY;QACjBe,YAAY,CAACJ,UAAqCP,iBAAiB;gBAACG;gBAAaI;YAAO;QACxFK,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACd,4BAA4BI;QAClE;IACF;AACF"}
@@ -1,4 +1,4 @@
1
1
  import type { InvitationDto } from '@shipfox/api-workspaces-dto';
2
- import type { Invitation } from '#core/invitation.js';
3
- export declare function toInvitation(dto: InvitationDto): Invitation;
2
+ import type { PendingInvitation } from '#core/membership.js';
3
+ export declare function toInvitation(dto: InvitationDto): PendingInvitation;
4
4
  //# sourceMappingURL=invitation-mapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invitation-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/invitation-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEpD,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,CAY3D"}
1
+ {"version":3,"file":"invitation-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/invitation-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,iBAAiB,CAYlE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/invitation-mapper.ts"],"sourcesContent":["import type {InvitationDto} from '@shipfox/api-workspaces-dto';\nimport type {Invitation} from '#core/invitation.js';\n\nexport function toInvitation(dto: InvitationDto): Invitation {\n return {\n id: dto.id,\n workspaceId: dto.workspace_id,\n email: dto.email,\n expiresAt: dto.expires_at,\n acceptedAt: dto.accepted_at,\n invitedByUserId: dto.invited_by_user_id,\n invitedByDisplay: dto.invited_by_display,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n };\n}\n"],"names":["toInvitation","dto","id","workspaceId","workspace_id","email","expiresAt","expires_at","acceptedAt","accepted_at","invitedByUserId","invited_by_user_id","invitedByDisplay","invited_by_display","createdAt","created_at","updatedAt","updated_at"],"mappings":"AAGA,OAAO,SAASA,aAAaC,GAAkB;IAC7C,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,aAAaF,IAAIG,YAAY;QAC7BC,OAAOJ,IAAII,KAAK;QAChBC,WAAWL,IAAIM,UAAU;QACzBC,YAAYP,IAAIQ,WAAW;QAC3BC,iBAAiBT,IAAIU,kBAAkB;QACvCC,kBAAkBX,IAAIY,kBAAkB;QACxCC,WAAWb,IAAIc,UAAU;QACzBC,WAAWf,IAAIgB,UAAU;IAC3B;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/invitation-mapper.ts"],"sourcesContent":["import type {InvitationDto} from '@shipfox/api-workspaces-dto';\nimport type {PendingInvitation} from '#core/membership.js';\n\nexport function toInvitation(dto: InvitationDto): PendingInvitation {\n return {\n id: dto.id,\n workspaceId: dto.workspace_id,\n email: dto.email,\n expiresAt: dto.expires_at,\n acceptedAt: dto.accepted_at,\n invitedByUserId: dto.invited_by_user_id,\n invitedByDisplay: dto.invited_by_display,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n };\n}\n"],"names":["toInvitation","dto","id","workspaceId","workspace_id","email","expiresAt","expires_at","acceptedAt","accepted_at","invitedByUserId","invited_by_user_id","invitedByDisplay","invited_by_display","createdAt","created_at","updatedAt","updated_at"],"mappings":"AAGA,OAAO,SAASA,aAAaC,GAAkB;IAC7C,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,aAAaF,IAAIG,YAAY;QAC7BC,OAAOJ,IAAII,KAAK;QAChBC,WAAWL,IAAIM,UAAU;QACzBC,YAAYP,IAAIQ,WAAW;QAC3BC,iBAAiBT,IAAIU,kBAAkB;QACvCC,kBAAkBX,IAAIY,kBAAkB;QACxCC,WAAWb,IAAIc,UAAU;QACzBC,WAAWf,IAAIgB,UAAU;IAC3B;AACF"}
@@ -1,12 +1,12 @@
1
- import type { Invitation } from '#core/invitation.js';
1
+ import type { PendingInvitation } from '#core/membership.js';
2
2
  export declare const listInvitationsQueryKey: (workspaceId: string) => readonly ["workspaces", string, "invitations"];
3
- export declare function listInvitationsQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<Invitation[], Error, Invitation[], readonly ["workspaces", string, "invitations"]>, "queryFn"> & {
4
- queryFn?: import("@tanstack/react-query").QueryFunction<Invitation[], readonly ["workspaces", string, "invitations"], never>;
3
+ export declare function listInvitationsQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<PendingInvitation[], Error, PendingInvitation[], readonly ["workspaces", string, "invitations"]>, "queryFn"> & {
4
+ queryFn?: import("@tanstack/react-query").QueryFunction<PendingInvitation[], readonly ["workspaces", string, "invitations"], never>;
5
5
  } & {
6
6
  queryKey: readonly ["workspaces", string, "invitations"] & {
7
- [dataTagSymbol]: Invitation[];
7
+ [dataTagSymbol]: PendingInvitation[];
8
8
  [dataTagErrorSymbol]: Error;
9
9
  };
10
10
  };
11
- export declare function useListInvitations(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<Invitation[]>, Error>;
11
+ export declare function useListInvitations(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<PendingInvitation[]>, Error>;
12
12
  //# sourceMappingURL=list-invitations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-invitations.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-invitations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,mDACN,CAAC;AAUtD,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM;;;;;;;EAK9D;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,gFAErD"}
1
+ {"version":3,"file":"list-invitations.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-invitations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAG3D,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,mDACN,CAAC;AAUtD,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM;;;;;;;EAK9D;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,uFAErD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/list-invitations.ts"],"sourcesContent":["import {listInvitationsResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {Invitation} from '#core/invitation.js';\nimport {toInvitation} from './invitation-mapper.js';\n\nexport const listInvitationsQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'invitations'] as const;\n\nasync function listInvitations(workspaceId: string): Promise<Invitation[]> {\n const response = await checkedApiRequest(\n listInvitationsResponseSchema,\n `/workspaces/${workspaceId}/invitations`,\n );\n return response.invitations.map(toInvitation);\n}\n\nexport function listInvitationsQueryOptions(workspaceId: string) {\n return queryOptions({\n queryKey: listInvitationsQueryKey(workspaceId),\n queryFn: () => listInvitations(workspaceId),\n });\n}\n\nexport function useListInvitations(workspaceId: string) {\n return useQuery(listInvitationsQueryOptions(workspaceId));\n}\n"],"names":["listInvitationsResponseSchema","checkedApiRequest","queryOptions","useQuery","toInvitation","listInvitationsQueryKey","workspaceId","listInvitations","response","invitations","map","listInvitationsQueryOptions","queryKey","queryFn","useListInvitations"],"mappings":"AAAA,SAAQA,6BAA6B,QAAO,8BAA8B;AAC1E,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,YAAY,EAAEC,QAAQ,QAAO,wBAAwB;AAE7D,SAAQC,YAAY,QAAO,yBAAyB;AAEpD,OAAO,MAAMC,0BAA0B,CAACC,cACtC;QAAC;QAAcA;QAAa;KAAc,CAAU;AAEtD,eAAeC,gBAAgBD,WAAmB;IAChD,MAAME,WAAW,MAAMP,kBACrBD,+BACA,CAAC,YAAY,EAAEM,YAAY,YAAY,CAAC;IAE1C,OAAOE,SAASC,WAAW,CAACC,GAAG,CAACN;AAClC;AAEA,OAAO,SAASO,4BAA4BL,WAAmB;IAC7D,OAAOJ,aAAa;QAClBU,UAAUP,wBAAwBC;QAClCO,SAAS,IAAMN,gBAAgBD;IACjC;AACF;AAEA,OAAO,SAASQ,mBAAmBR,WAAmB;IACpD,OAAOH,SAASQ,4BAA4BL;AAC9C"}
1
+ {"version":3,"sources":["../../../src/hooks/api/list-invitations.ts"],"sourcesContent":["import {listInvitationsResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {PendingInvitation} from '#core/membership.js';\nimport {toInvitation} from './invitation-mapper.js';\n\nexport const listInvitationsQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'invitations'] as const;\n\nasync function listInvitations(workspaceId: string): Promise<PendingInvitation[]> {\n const response = await checkedApiRequest(\n listInvitationsResponseSchema,\n `/workspaces/${workspaceId}/invitations`,\n );\n return response.invitations.map(toInvitation);\n}\n\nexport function listInvitationsQueryOptions(workspaceId: string) {\n return queryOptions({\n queryKey: listInvitationsQueryKey(workspaceId),\n queryFn: () => listInvitations(workspaceId),\n });\n}\n\nexport function useListInvitations(workspaceId: string) {\n return useQuery(listInvitationsQueryOptions(workspaceId));\n}\n"],"names":["listInvitationsResponseSchema","checkedApiRequest","queryOptions","useQuery","toInvitation","listInvitationsQueryKey","workspaceId","listInvitations","response","invitations","map","listInvitationsQueryOptions","queryKey","queryFn","useListInvitations"],"mappings":"AAAA,SAAQA,6BAA6B,QAAO,8BAA8B;AAC1E,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,YAAY,EAAEC,QAAQ,QAAO,wBAAwB;AAE7D,SAAQC,YAAY,QAAO,yBAAyB;AAEpD,OAAO,MAAMC,0BAA0B,CAACC,cACtC;QAAC;QAAcA;QAAa;KAAc,CAAU;AAEtD,eAAeC,gBAAgBD,WAAmB;IAChD,MAAME,WAAW,MAAMP,kBACrBD,+BACA,CAAC,YAAY,EAAEM,YAAY,YAAY,CAAC;IAE1C,OAAOE,SAASC,WAAW,CAACC,GAAG,CAACN;AAClC;AAEA,OAAO,SAASO,4BAA4BL,WAAmB;IAC7D,OAAOJ,aAAa;QAClBU,UAAUP,wBAAwBC;QAClCO,SAAS,IAAMN,gBAAgBD;IACjC;AACF;AAEA,OAAO,SAASQ,mBAAmBR,WAAmB;IACpD,OAAOH,SAASQ,4BAA4BL;AAC9C"}
@@ -1,13 +1,12 @@
1
+ import type { WorkspaceMember } from '#core/membership.js';
1
2
  export declare const listMembersQueryKey: (workspaceId: string) => readonly ["workspaces", string, "members"];
2
- export declare function useListMembers(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<{
3
- members: {
4
- id: string;
5
- user_id: string;
6
- workspace_id: string;
7
- created_at: string;
8
- updated_at: string;
9
- user_email: string;
10
- user_name: string | null;
11
- }[];
12
- }>, Error>;
3
+ export declare function listMembersQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<WorkspaceMember[], Error, WorkspaceMember[], readonly ["workspaces", string, "members"]>, "queryFn"> & {
4
+ queryFn?: import("@tanstack/react-query").QueryFunction<WorkspaceMember[], readonly ["workspaces", string, "members"], never>;
5
+ } & {
6
+ queryKey: readonly ["workspaces", string, "members"] & {
7
+ [dataTagSymbol]: WorkspaceMember[];
8
+ [dataTagErrorSymbol]: Error;
9
+ };
10
+ };
11
+ export declare function useListMembers(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<WorkspaceMember[]>, Error>;
13
12
  //# sourceMappingURL=list-members.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-members.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-members.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,+CACN,CAAC;AAMlD,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM;;;;;;;;;;WAKjD"}
1
+ {"version":3,"file":"list-members.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-members.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,+CACN,CAAC;AAUlD,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM;;;;;;;EAK1D;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,qFAEjD"}
@@ -1,18 +1,24 @@
1
- import { apiRequest } from '@shipfox/client-api';
2
- import { useQuery } from '@tanstack/react-query';
1
+ import { listMembersResponseSchema } from '@shipfox/api-workspaces-dto';
2
+ import { checkedApiRequest } from '@shipfox/client-api';
3
+ import { queryOptions, useQuery } from '@tanstack/react-query';
4
+ import { toWorkspaceMember } from './membership-mapper.js';
3
5
  export const listMembersQueryKey = (workspaceId)=>[
4
6
  'workspaces',
5
7
  workspaceId,
6
8
  'members'
7
9
  ];
8
10
  async function listMembers(workspaceId) {
9
- return await apiRequest(`/workspaces/${workspaceId}/members`);
11
+ const response = await checkedApiRequest(listMembersResponseSchema, `/workspaces/${workspaceId}/members`);
12
+ return response.members.map(toWorkspaceMember);
10
13
  }
11
- export function useListMembers(workspaceId) {
12
- return useQuery({
14
+ export function listMembersQueryOptions(workspaceId) {
15
+ return queryOptions({
13
16
  queryKey: listMembersQueryKey(workspaceId),
14
17
  queryFn: ()=>listMembers(workspaceId)
15
18
  });
16
19
  }
20
+ export function useListMembers(workspaceId) {
21
+ return useQuery(listMembersQueryOptions(workspaceId));
22
+ }
17
23
 
18
24
  //# sourceMappingURL=list-members.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/list-members.ts"],"sourcesContent":["import type {ListMembersResponseDto} from '@shipfox/api-workspaces-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {useQuery} from '@tanstack/react-query';\n\nexport const listMembersQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'members'] as const;\n\nasync function listMembers(workspaceId: string): Promise<ListMembersResponseDto> {\n return await apiRequest<ListMembersResponseDto>(`/workspaces/${workspaceId}/members`);\n}\n\nexport function useListMembers(workspaceId: string) {\n return useQuery({\n queryKey: listMembersQueryKey(workspaceId),\n queryFn: () => listMembers(workspaceId),\n });\n}\n"],"names":["apiRequest","useQuery","listMembersQueryKey","workspaceId","listMembers","useListMembers","queryKey","queryFn"],"mappings":"AACA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,QAAQ,QAAO,wBAAwB;AAE/C,OAAO,MAAMC,sBAAsB,CAACC,cAClC;QAAC;QAAcA;QAAa;KAAU,CAAU;AAElD,eAAeC,YAAYD,WAAmB;IAC5C,OAAO,MAAMH,WAAmC,CAAC,YAAY,EAAEG,YAAY,QAAQ,CAAC;AACtF;AAEA,OAAO,SAASE,eAAeF,WAAmB;IAChD,OAAOF,SAAS;QACdK,UAAUJ,oBAAoBC;QAC9BI,SAAS,IAAMH,YAAYD;IAC7B;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/list-members.ts"],"sourcesContent":["import {listMembersResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {WorkspaceMember} from '#core/membership.js';\nimport {toWorkspaceMember} from './membership-mapper.js';\n\nexport const listMembersQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'members'] as const;\n\nasync function listMembers(workspaceId: string): Promise<WorkspaceMember[]> {\n const response = await checkedApiRequest(\n listMembersResponseSchema,\n `/workspaces/${workspaceId}/members`,\n );\n return response.members.map(toWorkspaceMember);\n}\n\nexport function listMembersQueryOptions(workspaceId: string) {\n return queryOptions({\n queryKey: listMembersQueryKey(workspaceId),\n queryFn: () => listMembers(workspaceId),\n });\n}\n\nexport function useListMembers(workspaceId: string) {\n return useQuery(listMembersQueryOptions(workspaceId));\n}\n"],"names":["listMembersResponseSchema","checkedApiRequest","queryOptions","useQuery","toWorkspaceMember","listMembersQueryKey","workspaceId","listMembers","response","members","map","listMembersQueryOptions","queryKey","queryFn","useListMembers"],"mappings":"AAAA,SAAQA,yBAAyB,QAAO,8BAA8B;AACtE,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,YAAY,EAAEC,QAAQ,QAAO,wBAAwB;AAE7D,SAAQC,iBAAiB,QAAO,yBAAyB;AAEzD,OAAO,MAAMC,sBAAsB,CAACC,cAClC;QAAC;QAAcA;QAAa;KAAU,CAAU;AAElD,eAAeC,YAAYD,WAAmB;IAC5C,MAAME,WAAW,MAAMP,kBACrBD,2BACA,CAAC,YAAY,EAAEM,YAAY,QAAQ,CAAC;IAEtC,OAAOE,SAASC,OAAO,CAACC,GAAG,CAACN;AAC9B;AAEA,OAAO,SAASO,wBAAwBL,WAAmB;IACzD,OAAOJ,aAAa;QAClBU,UAAUP,oBAAoBC;QAC9BO,SAAS,IAAMN,YAAYD;IAC7B;AACF;AAEA,OAAO,SAASQ,eAAeR,WAAmB;IAChD,OAAOH,SAASQ,wBAAwBL;AAC1C"}
@@ -0,0 +1,4 @@
1
+ import type { MembershipWithUserDto } from '@shipfox/api-workspaces-dto';
2
+ import type { WorkspaceMember } from '#core/membership.js';
3
+ export declare function toWorkspaceMember(dto: MembershipWithUserDto): WorkspaceMember;
4
+ //# sourceMappingURL=membership-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/membership-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,GAAG,eAAe,CAW7E"}
@@ -0,0 +1,14 @@
1
+ export function toWorkspaceMember(dto) {
2
+ return {
3
+ id: dto.id,
4
+ userId: dto.user_id,
5
+ workspaceId: dto.workspace_id,
6
+ email: dto.user_email,
7
+ name: dto.user_name,
8
+ role: 'admin',
9
+ joinedAt: dto.created_at,
10
+ updatedAt: dto.updated_at
11
+ };
12
+ }
13
+
14
+ //# sourceMappingURL=membership-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/api/membership-mapper.ts"],"sourcesContent":["import type {MembershipWithUserDto} from '@shipfox/api-workspaces-dto';\nimport type {WorkspaceMember} from '#core/membership.js';\n\nexport function toWorkspaceMember(dto: MembershipWithUserDto): WorkspaceMember {\n return {\n id: dto.id,\n userId: dto.user_id,\n workspaceId: dto.workspace_id,\n email: dto.user_email,\n name: dto.user_name,\n role: 'admin',\n joinedAt: dto.created_at,\n updatedAt: dto.updated_at,\n };\n}\n"],"names":["toWorkspaceMember","dto","id","userId","user_id","workspaceId","workspace_id","email","user_email","name","user_name","role","joinedAt","created_at","updatedAt","updated_at"],"mappings":"AAGA,OAAO,SAASA,kBAAkBC,GAA0B;IAC1D,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,QAAQF,IAAIG,OAAO;QACnBC,aAAaJ,IAAIK,YAAY;QAC7BC,OAAON,IAAIO,UAAU;QACrBC,MAAMR,IAAIS,SAAS;QACnBC,MAAM;QACNC,UAAUX,IAAIY,UAAU;QACxBC,WAAWb,IAAIc,UAAU;IAC3B;AACF"}
@@ -1,2 +1,3 @@
1
- export declare function useRemoveMember(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
1
+ import type { RemoveWorkspaceMemberCommand } from '#core/membership.js';
2
+ export declare function useRemoveMember(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, RemoveWorkspaceMemberCommand, unknown>;
2
3
  //# sourceMappingURL=remove-member.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-member.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/remove-member.ts"],"names":[],"mappings":"AAUA,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,mFAQlD"}
1
+ {"version":3,"file":"remove-member.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/remove-member.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,qBAAqB,CAAC;AAWtE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,yGAQlD"}
@@ -1,22 +1,20 @@
1
- import { apiRequest } from '@shipfox/client-api';
1
+ import { checkedApiRequest, emptyResponseSchema } from '@shipfox/client-api';
2
2
  import { useMutation, useQueryClient } from '@tanstack/react-query';
3
- import { listMembersQueryKey } from './list-members.js';
3
+ import { listMembersQueryOptions } from './list-members.js';
4
4
  async function removeMember(params) {
5
- await apiRequest(`/workspaces/${params.workspaceId}/members/${params.userId}`, {
5
+ await checkedApiRequest(emptyResponseSchema, `/workspaces/${params.workspaceId}/members/${params.command.userId}`, {
6
6
  method: 'DELETE'
7
7
  });
8
8
  }
9
9
  export function useRemoveMember(workspaceId) {
10
10
  const queryClient = useQueryClient();
11
11
  return useMutation({
12
- mutationFn: (userId)=>removeMember({
12
+ mutationFn: (command)=>removeMember({
13
13
  workspaceId,
14
- userId
14
+ command
15
15
  }),
16
16
  onSuccess: async ()=>{
17
- await queryClient.invalidateQueries({
18
- queryKey: listMembersQueryKey(workspaceId)
19
- });
17
+ await queryClient.invalidateQueries(listMembersQueryOptions(workspaceId));
20
18
  }
21
19
  });
22
20
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/remove-member.ts"],"sourcesContent":["import {apiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport {listMembersQueryKey} from './list-members.js';\n\nasync function removeMember(params: {workspaceId: string; userId: string}) {\n await apiRequest<void>(`/workspaces/${params.workspaceId}/members/${params.userId}`, {\n method: 'DELETE',\n });\n}\n\nexport function useRemoveMember(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (userId: string) => removeMember({workspaceId, userId}),\n onSuccess: async () => {\n await queryClient.invalidateQueries({queryKey: listMembersQueryKey(workspaceId)});\n },\n });\n}\n"],"names":["apiRequest","useMutation","useQueryClient","listMembersQueryKey","removeMember","params","workspaceId","userId","method","useRemoveMember","queryClient","mutationFn","onSuccess","invalidateQueries","queryKey"],"mappings":"AAAA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAClE,SAAQC,mBAAmB,QAAO,oBAAoB;AAEtD,eAAeC,aAAaC,MAA6C;IACvE,MAAML,WAAiB,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,SAAS,EAAED,OAAOE,MAAM,EAAE,EAAE;QACnFC,QAAQ;IACV;AACF;AAEA,OAAO,SAASC,gBAAgBH,WAAmB;IACjD,MAAMI,cAAcR;IACpB,OAAOD,YAAY;QACjBU,YAAY,CAACJ,SAAmBH,aAAa;gBAACE;gBAAaC;YAAM;QACjEK,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAAC;gBAACC,UAAUX,oBAAoBG;YAAY;QACjF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/remove-member.ts"],"sourcesContent":["import {checkedApiRequest, emptyResponseSchema} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {RemoveWorkspaceMemberCommand} from '#core/membership.js';\nimport {listMembersQueryOptions} from './list-members.js';\n\nasync function removeMember(params: {workspaceId: string; command: RemoveWorkspaceMemberCommand}) {\n await checkedApiRequest(\n emptyResponseSchema,\n `/workspaces/${params.workspaceId}/members/${params.command.userId}`,\n {method: 'DELETE'},\n );\n}\n\nexport function useRemoveMember(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: RemoveWorkspaceMemberCommand) => removeMember({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listMembersQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["checkedApiRequest","emptyResponseSchema","useMutation","useQueryClient","listMembersQueryOptions","removeMember","params","workspaceId","command","userId","method","useRemoveMember","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,iBAAiB,EAAEC,mBAAmB,QAAO,sBAAsB;AAC3E,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,uBAAuB,QAAO,oBAAoB;AAE1D,eAAeC,aAAaC,MAAoE;IAC9F,MAAMN,kBACJC,qBACA,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,SAAS,EAAED,OAAOE,OAAO,CAACC,MAAM,EAAE,EACpE;QAACC,QAAQ;IAAQ;AAErB;AAEA,OAAO,SAASC,gBAAgBJ,WAAmB;IACjD,MAAMK,cAAcT;IACpB,OAAOD,YAAY;QACjBW,YAAY,CAACL,UAA0CH,aAAa;gBAACE;gBAAaC;YAAO;QACzFM,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACX,wBAAwBG;QAC9D;IACF;AACF"}
@@ -1,2 +1,3 @@
1
- export declare function useRevokeInvitation(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
1
+ import type { RevokeInvitationCommand } from '#core/membership.js';
2
+ export declare function useRevokeInvitation(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, RevokeInvitationCommand, unknown>;
2
3
  //# sourceMappingURL=revoke-invitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"revoke-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/revoke-invitation.ts"],"names":[],"mappings":"AAUA,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,mFAQtD"}
1
+ {"version":3,"file":"revoke-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/revoke-invitation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAajE,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,oGAQtD"}
@@ -1,17 +1,17 @@
1
- import { apiRequest } from '@shipfox/client-api';
1
+ import { checkedApiRequest, emptyResponseSchema } from '@shipfox/client-api';
2
2
  import { useMutation, useQueryClient } from '@tanstack/react-query';
3
3
  import { listInvitationsQueryOptions } from './list-invitations.js';
4
4
  async function revokeInvitation(params) {
5
- await apiRequest(`/workspaces/${params.workspaceId}/invitations/${params.invitationId}`, {
5
+ await checkedApiRequest(emptyResponseSchema, `/workspaces/${params.workspaceId}/invitations/${params.command.invitationId}`, {
6
6
  method: 'DELETE'
7
7
  });
8
8
  }
9
9
  export function useRevokeInvitation(workspaceId) {
10
10
  const queryClient = useQueryClient();
11
11
  return useMutation({
12
- mutationFn: (invitationId)=>revokeInvitation({
12
+ mutationFn: (command)=>revokeInvitation({
13
13
  workspaceId,
14
- invitationId
14
+ command
15
15
  }),
16
16
  onSuccess: async ()=>{
17
17
  await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/api/revoke-invitation.ts"],"sourcesContent":["import {apiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function revokeInvitation(params: {workspaceId: string; invitationId: string}) {\n await apiRequest<void>(`/workspaces/${params.workspaceId}/invitations/${params.invitationId}`, {\n method: 'DELETE',\n });\n}\n\nexport function useRevokeInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (invitationId: string) => revokeInvitation({workspaceId, invitationId}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["apiRequest","useMutation","useQueryClient","listInvitationsQueryOptions","revokeInvitation","params","workspaceId","invitationId","method","useRevokeInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAClE,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAAmD;IACjF,MAAML,WAAiB,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,aAAa,EAAED,OAAOE,YAAY,EAAE,EAAE;QAC7FC,QAAQ;IACV;AACF;AAEA,OAAO,SAASC,oBAAoBH,WAAmB;IACrD,MAAMI,cAAcR;IACpB,OAAOD,YAAY;QACjBU,YAAY,CAACJ,eAAyBH,iBAAiB;gBAACE;gBAAaC;YAAY;QACjFK,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACV,4BAA4BG;QAClE;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hooks/api/revoke-invitation.ts"],"sourcesContent":["import {checkedApiRequest, emptyResponseSchema} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {RevokeInvitationCommand} from '#core/membership.js';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function revokeInvitation(params: {workspaceId: string; command: RevokeInvitationCommand}) {\n await checkedApiRequest(\n emptyResponseSchema,\n `/workspaces/${params.workspaceId}/invitations/${params.command.invitationId}`,\n {\n method: 'DELETE',\n },\n );\n}\n\nexport function useRevokeInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: RevokeInvitationCommand) => revokeInvitation({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["checkedApiRequest","emptyResponseSchema","useMutation","useQueryClient","listInvitationsQueryOptions","revokeInvitation","params","workspaceId","command","invitationId","method","useRevokeInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,iBAAiB,EAAEC,mBAAmB,QAAO,sBAAsB;AAC3E,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAA+D;IAC7F,MAAMN,kBACJC,qBACA,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,aAAa,EAAED,OAAOE,OAAO,CAACC,YAAY,EAAE,EAC9E;QACEC,QAAQ;IACV;AAEJ;AAEA,OAAO,SAASC,oBAAoBJ,WAAmB;IACrD,MAAMK,cAAcT;IACpB,OAAOD,YAAY;QACjBW,YAAY,CAACL,UAAqCH,iBAAiB;gBAACE;gBAAaC;YAAO;QACxFM,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACX,4BAA4BG;QAClE;IACF;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,2 @@
1
- export * from './pages/events-settings-page.js';
2
- export * from './pages/integrations-settings-page.js';
3
1
  export * from './pages/members-settings-page.js';
4
- export * from './pages/model-providers-settings-page.js';
5
- export * from './pages/provisioners-settings-page.js';
6
- export * from './pages/runners-settings-page.js';
7
- export * from './pages/secrets-settings-page.js';
8
- export * from './pages/variables-settings-page.js';
9
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,3 @@
1
- export * from './pages/events-settings-page.js';
2
- export * from './pages/integrations-settings-page.js';
3
1
  export * from './pages/members-settings-page.js';
4
- export * from './pages/model-providers-settings-page.js';
5
- export * from './pages/provisioners-settings-page.js';
6
- export * from './pages/runners-settings-page.js';
7
- export * from './pages/secrets-settings-page.js';
8
- export * from './pages/variables-settings-page.js';
9
2
 
10
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './pages/events-settings-page.js';\nexport * from './pages/integrations-settings-page.js';\nexport * from './pages/members-settings-page.js';\nexport * from './pages/model-providers-settings-page.js';\nexport * from './pages/provisioners-settings-page.js';\nexport * from './pages/runners-settings-page.js';\nexport * from './pages/secrets-settings-page.js';\nexport * from './pages/variables-settings-page.js';\n"],"names":[],"mappings":"AAAA,cAAc,kCAAkC;AAChD,cAAc,wCAAwC;AACtD,cAAc,mCAAmC;AACjD,cAAc,2CAA2C;AACzD,cAAc,wCAAwC;AACtD,cAAc,mCAAmC;AACjD,cAAc,mCAAmC;AACjD,cAAc,qCAAqC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './pages/members-settings-page.js';\n"],"names":[],"mappings":"AAAA,cAAc,mCAAmC"}