@shipfox/client-projects 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/.storybook/preview.css +7 -0
  3. package/.storybook/preview.tsx +56 -0
  4. package/.turbo/turbo-build.log +2 -0
  5. package/.turbo/turbo-type$colon$emit.log +1 -0
  6. package/.turbo/turbo-type.log +1 -0
  7. package/CHANGELOG.md +207 -0
  8. package/LICENSE +21 -0
  9. package/dist/chrome.d.ts +3 -0
  10. package/dist/chrome.d.ts.map +1 -0
  11. package/dist/chrome.js +42 -0
  12. package/dist/chrome.js.map +1 -0
  13. package/dist/components/model-provider-reminder-banner.d.ts +4 -0
  14. package/dist/components/model-provider-reminder-banner.d.ts.map +1 -0
  15. package/dist/components/model-provider-reminder-banner.js +73 -0
  16. package/dist/components/model-provider-reminder-banner.js.map +1 -0
  17. package/dist/components/project-crumb.d.ts +7 -0
  18. package/dist/components/project-crumb.d.ts.map +1 -0
  19. package/dist/components/project-crumb.js +93 -0
  20. package/dist/components/project-crumb.js.map +1 -0
  21. package/dist/components/project-switcher.d.ts +7 -0
  22. package/dist/components/project-switcher.d.ts.map +1 -0
  23. package/dist/components/project-switcher.js +138 -0
  24. package/dist/components/project-switcher.js.map +1 -0
  25. package/dist/components/source-strip.d.ts +14 -0
  26. package/dist/components/source-strip.d.ts.map +1 -0
  27. package/dist/components/source-strip.js +98 -0
  28. package/dist/components/source-strip.js.map +1 -0
  29. package/dist/components/workspace-setup-guard.d.ts +9 -0
  30. package/dist/components/workspace-setup-guard.d.ts.map +1 -0
  31. package/dist/components/workspace-setup-guard.js +160 -0
  32. package/dist/components/workspace-setup-guard.js.map +1 -0
  33. package/dist/feature.d.ts +35 -0
  34. package/dist/feature.d.ts.map +1 -0
  35. package/dist/feature.js +45 -0
  36. package/dist/feature.js.map +1 -0
  37. package/dist/hooks/api/definitions.d.ts +97 -0
  38. package/dist/hooks/api/definitions.d.ts.map +1 -0
  39. package/dist/hooks/api/definitions.js +55 -0
  40. package/dist/hooks/api/definitions.js.map +1 -0
  41. package/dist/hooks/api/projects.d.ts +93 -0
  42. package/dist/hooks/api/projects.d.ts.map +1 -0
  43. package/dist/hooks/api/projects.js +79 -0
  44. package/dist/hooks/api/projects.js.map +1 -0
  45. package/dist/index.d.ts +13 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +13 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/pages/create-project-page.d.ts +2 -0
  50. package/dist/pages/create-project-page.d.ts.map +1 -0
  51. package/dist/pages/create-project-page.js +406 -0
  52. package/dist/pages/create-project-page.js.map +1 -0
  53. package/dist/pages/create-project-page.stories.d.ts +24 -0
  54. package/dist/pages/create-project-page.stories.d.ts.map +1 -0
  55. package/dist/pages/create-project-page.stories.js +345 -0
  56. package/dist/pages/create-project-page.stories.js.map +1 -0
  57. package/dist/pages/home-router.d.ts +2 -0
  58. package/dist/pages/home-router.d.ts.map +1 -0
  59. package/dist/pages/home-router.js +7 -0
  60. package/dist/pages/home-router.js.map +1 -0
  61. package/dist/pages/project-workflows-page.d.ts +4 -0
  62. package/dist/pages/project-workflows-page.d.ts.map +1 -0
  63. package/dist/pages/project-workflows-page.js +481 -0
  64. package/dist/pages/project-workflows-page.js.map +1 -0
  65. package/dist/pages/projects-hub-page.d.ts +2 -0
  66. package/dist/pages/projects-hub-page.d.ts.map +1 -0
  67. package/dist/pages/projects-hub-page.js +256 -0
  68. package/dist/pages/projects-hub-page.js.map +1 -0
  69. package/dist/project-error.d.ts +7 -0
  70. package/dist/project-error.d.ts.map +1 -0
  71. package/dist/project-error.js +93 -0
  72. package/dist/project-error.js.map +1 -0
  73. package/dist/routes/create-project.d.ts +6 -0
  74. package/dist/routes/create-project.d.ts.map +1 -0
  75. package/dist/routes/create-project.js +7 -0
  76. package/dist/routes/create-project.js.map +1 -0
  77. package/dist/routes/home.d.ts +6 -0
  78. package/dist/routes/home.d.ts.map +1 -0
  79. package/dist/routes/home.js +7 -0
  80. package/dist/routes/home.js.map +1 -0
  81. package/dist/routes/project-index.d.ts +10 -0
  82. package/dist/routes/project-index.d.ts.map +1 -0
  83. package/dist/routes/project-index.js +15 -0
  84. package/dist/routes/project-index.js.map +1 -0
  85. package/dist/routes/workflows.d.ts +5 -0
  86. package/dist/routes/workflows.d.ts.map +1 -0
  87. package/dist/routes/workflows.js +16 -0
  88. package/dist/routes/workflows.js.map +1 -0
  89. package/dist/tsconfig.test.tsbuildinfo +1 -0
  90. package/package.json +120 -0
  91. package/src/chrome.tsx +26 -0
  92. package/src/components/model-provider-reminder-banner.tsx +78 -0
  93. package/src/components/project-crumb.tsx +70 -0
  94. package/src/components/project-switcher.test.tsx +91 -0
  95. package/src/components/project-switcher.tsx +127 -0
  96. package/src/components/source-strip.tsx +91 -0
  97. package/src/components/workspace-setup-guard.test.tsx +534 -0
  98. package/src/components/workspace-setup-guard.tsx +185 -0
  99. package/src/feature.ts +44 -0
  100. package/src/hooks/api/definitions.ts +50 -0
  101. package/src/hooks/api/projects.test.ts +78 -0
  102. package/src/hooks/api/projects.ts +75 -0
  103. package/src/index.ts +15 -0
  104. package/src/pages/create-project-page.stories.tsx +344 -0
  105. package/src/pages/create-project-page.test.tsx +317 -0
  106. package/src/pages/create-project-page.tsx +386 -0
  107. package/src/pages/home-router.test.tsx +27 -0
  108. package/src/pages/home-router.tsx +5 -0
  109. package/src/pages/project-workflows-page.test.tsx +258 -0
  110. package/src/pages/project-workflows-page.tsx +445 -0
  111. package/src/pages/projects-hub-page.test.tsx +313 -0
  112. package/src/pages/projects-hub-page.tsx +246 -0
  113. package/src/project-error.test.ts +59 -0
  114. package/src/project-error.ts +106 -0
  115. package/src/routes/create-project.tsx +4 -0
  116. package/src/routes/home.tsx +4 -0
  117. package/src/routes/project-index.tsx +11 -0
  118. package/src/routes/workflows.tsx +10 -0
  119. package/test/pages.tsx +151 -0
  120. package/test/setup.ts +3 -0
  121. package/tsconfig.build.json +9 -0
  122. package/tsconfig.build.tsbuildinfo +1 -0
  123. package/tsconfig.json +3 -0
  124. package/tsconfig.test.json +8 -0
  125. package/vitest.config.ts +70 -0
@@ -0,0 +1,97 @@
1
+ export declare const definitionsQueryKeys: {
2
+ all: readonly ["definitions"];
3
+ list: (projectId: string) => readonly ["definitions", "list", string];
4
+ };
5
+ export declare function listDefinitions({ projectId, limit, cursor, signal, }: {
6
+ projectId: string;
7
+ limit?: number;
8
+ cursor?: string | undefined;
9
+ signal?: AbortSignal;
10
+ }): Promise<{
11
+ definitions: {
12
+ id: string;
13
+ project_id: string;
14
+ config_path: string | null;
15
+ source: "manual" | "vcs";
16
+ sha: string | null;
17
+ ref: string | null;
18
+ name: string;
19
+ workflow_document: unknown;
20
+ workflow_model: unknown;
21
+ manual_trigger: {
22
+ name: string;
23
+ } | null;
24
+ fetched_at: string;
25
+ created_at: string;
26
+ updated_at: string;
27
+ }[];
28
+ sync: {
29
+ ref: string | null;
30
+ status: "pending" | "syncing" | "succeeded" | "failed";
31
+ last_sync_at: string;
32
+ started_at: string | null;
33
+ finished_at: string | null;
34
+ last_error_code: "unknown" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-unavailable" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable" | null;
35
+ last_error_message: string | null;
36
+ } | null;
37
+ next_cursor: string | null;
38
+ }>;
39
+ export declare function useDefinitionsInfiniteQuery(projectId: string | undefined, limit?: number): import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<{
40
+ definitions: {
41
+ id: string;
42
+ project_id: string;
43
+ config_path: string | null;
44
+ source: "manual" | "vcs";
45
+ sha: string | null;
46
+ ref: string | null;
47
+ name: string;
48
+ workflow_document: unknown;
49
+ workflow_model: unknown;
50
+ manual_trigger: {
51
+ name: string;
52
+ } | null;
53
+ fetched_at: string;
54
+ created_at: string;
55
+ updated_at: string;
56
+ }[];
57
+ sync: {
58
+ ref: string | null;
59
+ status: "pending" | "syncing" | "succeeded" | "failed";
60
+ last_sync_at: string;
61
+ started_at: string | null;
62
+ finished_at: string | null;
63
+ last_error_code: "unknown" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-unavailable" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable" | null;
64
+ last_error_message: string | null;
65
+ } | null;
66
+ next_cursor: string | null;
67
+ }, unknown>, Error>;
68
+ export declare function useDefinitionsQuery(projectId: string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<{
69
+ definitions: {
70
+ id: string;
71
+ project_id: string;
72
+ config_path: string | null;
73
+ source: "manual" | "vcs";
74
+ sha: string | null;
75
+ ref: string | null;
76
+ name: string;
77
+ workflow_document: unknown;
78
+ workflow_model: unknown;
79
+ manual_trigger: {
80
+ name: string;
81
+ } | null;
82
+ fetched_at: string;
83
+ created_at: string;
84
+ updated_at: string;
85
+ }[];
86
+ sync: {
87
+ ref: string | null;
88
+ status: "pending" | "syncing" | "succeeded" | "failed";
89
+ last_sync_at: string;
90
+ started_at: string | null;
91
+ finished_at: string | null;
92
+ last_error_code: "unknown" | "no-workflow-files" | "invalid-definition" | "provider-repository-not-found" | "provider-file-not-found" | "provider-access-denied" | "provider-rate-limited" | "provider-timeout" | "provider-unavailable" | "provider-malformed-response" | "content-too-large" | "too-many-files" | "connection-unavailable" | null;
93
+ last_error_message: string | null;
94
+ } | null;
95
+ next_cursor: string | null;
96
+ }>, Error>;
97
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/definitions.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;sBAEb,MAAM;CACzB,CAAC;AAEF,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,KAAU,EACV,MAAM,EACN,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMA;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,SAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAYpF;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAQhE"}
@@ -0,0 +1,55 @@
1
+ import { apiRequest } from '@shipfox/client-api';
2
+ import { keepPreviousData, useInfiniteQuery, useQuery } from '@tanstack/react-query';
3
+ export const definitionsQueryKeys = {
4
+ all: [
5
+ 'definitions'
6
+ ],
7
+ list: (projectId)=>[
8
+ ...definitionsQueryKeys.all,
9
+ 'list',
10
+ projectId
11
+ ]
12
+ };
13
+ export async function listDefinitions({ projectId, limit = 50, cursor, signal }) {
14
+ const params = new URLSearchParams({
15
+ project_id: projectId,
16
+ limit: String(limit)
17
+ });
18
+ if (cursor) params.set('cursor', cursor);
19
+ return await apiRequest(`/definitions?${params.toString()}`, {
20
+ signal
21
+ });
22
+ }
23
+ export function useDefinitionsInfiniteQuery(projectId, limit = 50) {
24
+ return useInfiniteQuery({
25
+ queryKey: projectId ? definitionsQueryKeys.list(projectId) : [
26
+ ...definitionsQueryKeys.all,
27
+ 'list'
28
+ ],
29
+ enabled: Boolean(projectId),
30
+ initialPageParam: undefined,
31
+ queryFn: ({ pageParam, signal })=>listDefinitions({
32
+ projectId: projectId ?? '',
33
+ limit,
34
+ cursor: pageParam,
35
+ signal
36
+ }),
37
+ getNextPageParam: (lastPage)=>lastPage.next_cursor ?? undefined,
38
+ placeholderData: keepPreviousData
39
+ });
40
+ }
41
+ export function useDefinitionsQuery(projectId) {
42
+ return useQuery({
43
+ queryKey: projectId ? definitionsQueryKeys.list(projectId) : [
44
+ ...definitionsQueryKeys.all,
45
+ 'list'
46
+ ],
47
+ enabled: Boolean(projectId),
48
+ queryFn: ({ signal })=>listDefinitions({
49
+ projectId: projectId ?? '',
50
+ signal
51
+ })
52
+ });
53
+ }
54
+
55
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/api/definitions.ts"],"sourcesContent":["import type {DefinitionListResponseDto} from '@shipfox/api-definitions-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {keepPreviousData, useInfiniteQuery, useQuery} from '@tanstack/react-query';\n\nexport const definitionsQueryKeys = {\n all: ['definitions'] as const,\n list: (projectId: string) => [...definitionsQueryKeys.all, 'list', projectId] as const,\n};\n\nexport async function listDefinitions({\n projectId,\n limit = 50,\n cursor,\n signal,\n}: {\n projectId: string;\n limit?: number;\n cursor?: string | undefined;\n signal?: AbortSignal;\n}) {\n const params = new URLSearchParams({project_id: projectId, limit: String(limit)});\n if (cursor) params.set('cursor', cursor);\n return await apiRequest<DefinitionListResponseDto>(`/definitions?${params.toString()}`, {\n signal,\n });\n}\n\nexport function useDefinitionsInfiniteQuery(projectId: string | undefined, limit = 50) {\n return useInfiniteQuery({\n queryKey: projectId\n ? definitionsQueryKeys.list(projectId)\n : [...definitionsQueryKeys.all, 'list'],\n enabled: Boolean(projectId),\n initialPageParam: undefined as string | undefined,\n queryFn: ({pageParam, signal}) =>\n listDefinitions({projectId: projectId ?? '', limit, cursor: pageParam, signal}),\n getNextPageParam: (lastPage) => lastPage.next_cursor ?? undefined,\n placeholderData: keepPreviousData,\n });\n}\n\nexport function useDefinitionsQuery(projectId: string | undefined) {\n return useQuery({\n queryKey: projectId\n ? definitionsQueryKeys.list(projectId)\n : [...definitionsQueryKeys.all, 'list'],\n enabled: Boolean(projectId),\n queryFn: ({signal}) => listDefinitions({projectId: projectId ?? '', signal}),\n });\n}\n"],"names":["apiRequest","keepPreviousData","useInfiniteQuery","useQuery","definitionsQueryKeys","all","list","projectId","listDefinitions","limit","cursor","signal","params","URLSearchParams","project_id","String","set","toString","useDefinitionsInfiniteQuery","queryKey","enabled","Boolean","initialPageParam","undefined","queryFn","pageParam","getNextPageParam","lastPage","next_cursor","placeholderData","useDefinitionsQuery"],"mappings":"AACA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,gBAAgB,EAAEC,gBAAgB,EAAEC,QAAQ,QAAO,wBAAwB;AAEnF,OAAO,MAAMC,uBAAuB;IAClCC,KAAK;QAAC;KAAc;IACpBC,MAAM,CAACC,YAAsB;eAAIH,qBAAqBC,GAAG;YAAE;YAAQE;SAAU;AAC/E,EAAE;AAEF,OAAO,eAAeC,gBAAgB,EACpCD,SAAS,EACTE,QAAQ,EAAE,EACVC,MAAM,EACNC,MAAM,EAMP;IACC,MAAMC,SAAS,IAAIC,gBAAgB;QAACC,YAAYP;QAAWE,OAAOM,OAAON;IAAM;IAC/E,IAAIC,QAAQE,OAAOI,GAAG,CAAC,UAAUN;IACjC,OAAO,MAAMV,WAAsC,CAAC,aAAa,EAAEY,OAAOK,QAAQ,IAAI,EAAE;QACtFN;IACF;AACF;AAEA,OAAO,SAASO,4BAA4BX,SAA6B,EAAEE,QAAQ,EAAE;IACnF,OAAOP,iBAAiB;QACtBiB,UAAUZ,YACNH,qBAAqBE,IAAI,CAACC,aAC1B;eAAIH,qBAAqBC,GAAG;YAAE;SAAO;QACzCe,SAASC,QAAQd;QACjBe,kBAAkBC;QAClBC,SAAS,CAAC,EAACC,SAAS,EAAEd,MAAM,EAAC,GAC3BH,gBAAgB;gBAACD,WAAWA,aAAa;gBAAIE;gBAAOC,QAAQe;gBAAWd;YAAM;QAC/Ee,kBAAkB,CAACC,WAAaA,SAASC,WAAW,IAAIL;QACxDM,iBAAiB5B;IACnB;AACF;AAEA,OAAO,SAAS6B,oBAAoBvB,SAA6B;IAC/D,OAAOJ,SAAS;QACdgB,UAAUZ,YACNH,qBAAqBE,IAAI,CAACC,aAC1B;eAAIH,qBAAqBC,GAAG;YAAE;SAAO;QACzCe,SAASC,QAAQd;QACjBiB,SAAS,CAAC,EAACb,MAAM,EAAC,GAAKH,gBAAgB;gBAACD,WAAWA,aAAa;gBAAII;YAAM;IAC5E;AACF"}
@@ -0,0 +1,93 @@
1
+ import type { CreateProjectBodyDto } from '@shipfox/api-projects-dto';
2
+ export declare const projectsQueryKeys: {
3
+ all: readonly ["projects"];
4
+ list: (workspaceId: string, search?: string) => readonly ["projects", "list", string, string];
5
+ exists: (workspaceId: string) => readonly ["projects", "exists", string];
6
+ detail: (projectId: string) => readonly ["projects", "detail", string];
7
+ };
8
+ export declare function listProjects({ workspaceId, limit, cursor, search, signal, }: {
9
+ workspaceId: string;
10
+ limit?: number;
11
+ cursor?: string | undefined;
12
+ search?: string | undefined;
13
+ signal?: AbortSignal;
14
+ }): Promise<{
15
+ projects: {
16
+ id: string;
17
+ workspace_id: string;
18
+ name: string;
19
+ source: {
20
+ connection_id: string;
21
+ external_repository_id: string;
22
+ };
23
+ created_at: string;
24
+ updated_at: string;
25
+ }[];
26
+ next_cursor: string | null;
27
+ }>;
28
+ export declare function getProject(projectId: string): Promise<{
29
+ id: string;
30
+ workspace_id: string;
31
+ name: string;
32
+ source: {
33
+ connection_id: string;
34
+ external_repository_id: string;
35
+ };
36
+ created_at: string;
37
+ updated_at: string;
38
+ }>;
39
+ export declare function createProject(body: CreateProjectBodyDto): Promise<{
40
+ id: string;
41
+ workspace_id: string;
42
+ name: string;
43
+ source: {
44
+ connection_id: string;
45
+ external_repository_id: string;
46
+ };
47
+ created_at: string;
48
+ updated_at: string;
49
+ }>;
50
+ export declare function useProjectsInfiniteQuery(workspaceId: string | undefined, search?: string, limit?: number): import("@tanstack/react-query").UseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<{
51
+ projects: {
52
+ id: string;
53
+ workspace_id: string;
54
+ name: string;
55
+ source: {
56
+ connection_id: string;
57
+ external_repository_id: string;
58
+ };
59
+ created_at: string;
60
+ updated_at: string;
61
+ }[];
62
+ next_cursor: string | null;
63
+ }, unknown>, Error>;
64
+ export declare function useProjectQuery(projectId: string | undefined): import("@tanstack/react-query").UseQueryResult<NoInfer<{
65
+ id: string;
66
+ workspace_id: string;
67
+ name: string;
68
+ source: {
69
+ connection_id: string;
70
+ external_repository_id: string;
71
+ };
72
+ created_at: string;
73
+ updated_at: string;
74
+ }>, Error>;
75
+ export declare function useCreateProjectMutation(): import("@tanstack/react-query").UseMutationResult<{
76
+ id: string;
77
+ workspace_id: string;
78
+ name: string;
79
+ source: {
80
+ connection_id: string;
81
+ external_repository_id: string;
82
+ };
83
+ created_at: string;
84
+ updated_at: string;
85
+ }, Error, {
86
+ workspace_id: string;
87
+ name: string;
88
+ source: {
89
+ connection_id: string;
90
+ external_repository_id: string;
91
+ };
92
+ }, unknown>;
93
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,2BAA2B,CAAC;AAInC,eAAO,MAAM,iBAAiB;;wBAER,MAAM,WAAW,MAAM;0BAErB,MAAM;wBACR,MAAM;CAC3B,CAAC;AAEF,wBAAsB,YAAY,CAAC,EACjC,WAAW,EACX,KAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,GACP,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;;;;;;;;;;;;;GAMA;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM;;;;;;;;;;GAEjD;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB;;;;;;;;;;GAE7D;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,SAAK;;;;;;;;;;;;;oBAaX;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;WAQ5D;AAED,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;YAEvC"}
@@ -0,0 +1,79 @@
1
+ import { apiRequest } from '@shipfox/client-api';
2
+ import { keepPreviousData, useInfiniteQuery, useMutation, useQuery } from '@tanstack/react-query';
3
+ export const projectsQueryKeys = {
4
+ all: [
5
+ 'projects'
6
+ ],
7
+ list: (workspaceId, search)=>[
8
+ ...projectsQueryKeys.all,
9
+ 'list',
10
+ workspaceId,
11
+ search ?? ''
12
+ ],
13
+ exists: (workspaceId)=>[
14
+ ...projectsQueryKeys.all,
15
+ 'exists',
16
+ workspaceId
17
+ ],
18
+ detail: (projectId)=>[
19
+ ...projectsQueryKeys.all,
20
+ 'detail',
21
+ projectId
22
+ ]
23
+ };
24
+ export async function listProjects({ workspaceId, limit = 50, cursor, search, signal }) {
25
+ const params = new URLSearchParams({
26
+ workspace_id: workspaceId,
27
+ limit: String(limit)
28
+ });
29
+ if (cursor) params.set('cursor', cursor);
30
+ if (search) params.set('search', search);
31
+ return await apiRequest(`/projects?${params.toString()}`, {
32
+ signal
33
+ });
34
+ }
35
+ export async function getProject(projectId) {
36
+ return await apiRequest(`/projects/${projectId}`);
37
+ }
38
+ export async function createProject(body) {
39
+ return await apiRequest('/projects', {
40
+ method: 'POST',
41
+ body
42
+ });
43
+ }
44
+ export function useProjectsInfiniteQuery(workspaceId, search, limit = 50) {
45
+ return useInfiniteQuery({
46
+ queryKey: workspaceId ? projectsQueryKeys.list(workspaceId, search) : [
47
+ ...projectsQueryKeys.all,
48
+ 'list'
49
+ ],
50
+ enabled: Boolean(workspaceId),
51
+ initialPageParam: undefined,
52
+ queryFn: ({ pageParam, signal })=>listProjects({
53
+ workspaceId: workspaceId ?? '',
54
+ limit,
55
+ cursor: pageParam,
56
+ search,
57
+ signal
58
+ }),
59
+ getNextPageParam: (lastPage)=>lastPage.next_cursor ?? undefined,
60
+ placeholderData: keepPreviousData
61
+ });
62
+ }
63
+ export function useProjectQuery(projectId) {
64
+ return useQuery({
65
+ queryKey: projectId ? projectsQueryKeys.detail(projectId) : [
66
+ ...projectsQueryKeys.all,
67
+ 'detail'
68
+ ],
69
+ enabled: Boolean(projectId),
70
+ queryFn: ()=>getProject(projectId ?? '')
71
+ });
72
+ }
73
+ export function useCreateProjectMutation() {
74
+ return useMutation({
75
+ mutationFn: createProject
76
+ });
77
+ }
78
+
79
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/hooks/api/projects.ts"],"sourcesContent":["import type {\n CreateProjectBodyDto,\n ListProjectsResponseDto,\n ProjectResponseDto,\n} from '@shipfox/api-projects-dto';\nimport {apiRequest} from '@shipfox/client-api';\nimport {keepPreviousData, useInfiniteQuery, useMutation, useQuery} from '@tanstack/react-query';\n\nexport const projectsQueryKeys = {\n all: ['projects'] as const,\n list: (workspaceId: string, search?: string) =>\n [...projectsQueryKeys.all, 'list', workspaceId, search ?? ''] as const,\n exists: (workspaceId: string) => [...projectsQueryKeys.all, 'exists', workspaceId] as const,\n detail: (projectId: string) => [...projectsQueryKeys.all, 'detail', projectId] as const,\n};\n\nexport async function listProjects({\n workspaceId,\n limit = 50,\n cursor,\n search,\n signal,\n}: {\n workspaceId: string;\n limit?: number;\n cursor?: string | undefined;\n search?: string | undefined;\n signal?: AbortSignal;\n}) {\n const params = new URLSearchParams({workspace_id: workspaceId, limit: String(limit)});\n if (cursor) params.set('cursor', cursor);\n if (search) params.set('search', search);\n\n return await apiRequest<ListProjectsResponseDto>(`/projects?${params.toString()}`, {signal});\n}\n\nexport async function getProject(projectId: string) {\n return await apiRequest<ProjectResponseDto>(`/projects/${projectId}`);\n}\n\nexport async function createProject(body: CreateProjectBodyDto) {\n return await apiRequest<ProjectResponseDto>('/projects', {method: 'POST', body});\n}\n\nexport function useProjectsInfiniteQuery(\n workspaceId: string | undefined,\n search?: string,\n limit = 50,\n) {\n return useInfiniteQuery({\n queryKey: workspaceId\n ? projectsQueryKeys.list(workspaceId, search)\n : [...projectsQueryKeys.all, 'list'],\n enabled: Boolean(workspaceId),\n initialPageParam: undefined as string | undefined,\n queryFn: ({pageParam, signal}) =>\n listProjects({workspaceId: workspaceId ?? '', limit, cursor: pageParam, search, signal}),\n getNextPageParam: (lastPage) => lastPage.next_cursor ?? undefined,\n placeholderData: keepPreviousData,\n });\n}\n\nexport function useProjectQuery(projectId: string | undefined) {\n return useQuery({\n queryKey: projectId\n ? projectsQueryKeys.detail(projectId)\n : [...projectsQueryKeys.all, 'detail'],\n enabled: Boolean(projectId),\n queryFn: () => getProject(projectId ?? ''),\n });\n}\n\nexport function useCreateProjectMutation() {\n return useMutation({mutationFn: createProject});\n}\n"],"names":["apiRequest","keepPreviousData","useInfiniteQuery","useMutation","useQuery","projectsQueryKeys","all","list","workspaceId","search","exists","detail","projectId","listProjects","limit","cursor","signal","params","URLSearchParams","workspace_id","String","set","toString","getProject","createProject","body","method","useProjectsInfiniteQuery","queryKey","enabled","Boolean","initialPageParam","undefined","queryFn","pageParam","getNextPageParam","lastPage","next_cursor","placeholderData","useProjectQuery","useCreateProjectMutation","mutationFn"],"mappings":"AAKA,SAAQA,UAAU,QAAO,sBAAsB;AAC/C,SAAQC,gBAAgB,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,QAAQ,QAAO,wBAAwB;AAEhG,OAAO,MAAMC,oBAAoB;IAC/BC,KAAK;QAAC;KAAW;IACjBC,MAAM,CAACC,aAAqBC,SAC1B;eAAIJ,kBAAkBC,GAAG;YAAE;YAAQE;YAAaC,UAAU;SAAG;IAC/DC,QAAQ,CAACF,cAAwB;eAAIH,kBAAkBC,GAAG;YAAE;YAAUE;SAAY;IAClFG,QAAQ,CAACC,YAAsB;eAAIP,kBAAkBC,GAAG;YAAE;YAAUM;SAAU;AAChF,EAAE;AAEF,OAAO,eAAeC,aAAa,EACjCL,WAAW,EACXM,QAAQ,EAAE,EACVC,MAAM,EACNN,MAAM,EACNO,MAAM,EAOP;IACC,MAAMC,SAAS,IAAIC,gBAAgB;QAACC,cAAcX;QAAaM,OAAOM,OAAON;IAAM;IACnF,IAAIC,QAAQE,OAAOI,GAAG,CAAC,UAAUN;IACjC,IAAIN,QAAQQ,OAAOI,GAAG,CAAC,UAAUZ;IAEjC,OAAO,MAAMT,WAAoC,CAAC,UAAU,EAAEiB,OAAOK,QAAQ,IAAI,EAAE;QAACN;IAAM;AAC5F;AAEA,OAAO,eAAeO,WAAWX,SAAiB;IAChD,OAAO,MAAMZ,WAA+B,CAAC,UAAU,EAAEY,WAAW;AACtE;AAEA,OAAO,eAAeY,cAAcC,IAA0B;IAC5D,OAAO,MAAMzB,WAA+B,aAAa;QAAC0B,QAAQ;QAAQD;IAAI;AAChF;AAEA,OAAO,SAASE,yBACdnB,WAA+B,EAC/BC,MAAe,EACfK,QAAQ,EAAE;IAEV,OAAOZ,iBAAiB;QACtB0B,UAAUpB,cACNH,kBAAkBE,IAAI,CAACC,aAAaC,UACpC;eAAIJ,kBAAkBC,GAAG;YAAE;SAAO;QACtCuB,SAASC,QAAQtB;QACjBuB,kBAAkBC;QAClBC,SAAS,CAAC,EAACC,SAAS,EAAElB,MAAM,EAAC,GAC3BH,aAAa;gBAACL,aAAaA,eAAe;gBAAIM;gBAAOC,QAAQmB;gBAAWzB;gBAAQO;YAAM;QACxFmB,kBAAkB,CAACC,WAAaA,SAASC,WAAW,IAAIL;QACxDM,iBAAiBrC;IACnB;AACF;AAEA,OAAO,SAASsC,gBAAgB3B,SAA6B;IAC3D,OAAOR,SAAS;QACdwB,UAAUhB,YACNP,kBAAkBM,MAAM,CAACC,aACzB;eAAIP,kBAAkBC,GAAG;YAAE;SAAS;QACxCuB,SAASC,QAAQlB;QACjBqB,SAAS,IAAMV,WAAWX,aAAa;IACzC;AACF;AAEA,OAAO,SAAS4B;IACd,OAAOrC,YAAY;QAACsC,YAAYjB;IAAa;AAC/C"}
@@ -0,0 +1,13 @@
1
+ export type { WorkspaceSetupState } from '@shipfox/client-shell/runtime';
2
+ export { ProjectBreadcrumb, ProjectLayoutGuard } from './chrome.js';
3
+ export { ProjectCrumb, type ProjectCrumbProps } from './components/project-crumb.js';
4
+ export { ProjectSwitcher, type ProjectSwitcherProps } from './components/project-switcher.js';
5
+ export { loadWorkspaceSetupRoute, type WorkspaceSetupRouteOptions, } from './components/workspace-setup-guard.js';
6
+ export * from './hooks/api/definitions.js';
7
+ export * from './hooks/api/projects.js';
8
+ export * from './pages/create-project-page.js';
9
+ export * from './pages/home-router.js';
10
+ export * from './pages/project-workflows-page.js';
11
+ export * from './pages/projects-hub-page.js';
12
+ export * from './project-error.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAC,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAClE,OAAO,EAAC,YAAY,EAAE,KAAK,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAC,eAAe,EAAE,KAAK,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EACL,uBAAuB,EACvB,KAAK,0BAA0B,GAChC,MAAM,uCAAuC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ export { ProjectBreadcrumb, ProjectLayoutGuard } from './chrome.js';
2
+ export { ProjectCrumb } from './components/project-crumb.js';
3
+ export { ProjectSwitcher } from './components/project-switcher.js';
4
+ export { loadWorkspaceSetupRoute } from './components/workspace-setup-guard.js';
5
+ export * from './hooks/api/definitions.js';
6
+ export * from './hooks/api/projects.js';
7
+ export * from './pages/create-project-page.js';
8
+ export * from './pages/home-router.js';
9
+ export * from './pages/project-workflows-page.js';
10
+ export * from './pages/projects-hub-page.js';
11
+ export * from './project-error.js';
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {WorkspaceSetupState} from '@shipfox/client-shell/runtime';\nexport {ProjectBreadcrumb, ProjectLayoutGuard} from './chrome.js';\nexport {ProjectCrumb, type ProjectCrumbProps} from './components/project-crumb.js';\nexport {ProjectSwitcher, type ProjectSwitcherProps} from './components/project-switcher.js';\nexport {\n loadWorkspaceSetupRoute,\n type WorkspaceSetupRouteOptions,\n} from './components/workspace-setup-guard.js';\nexport * from './hooks/api/definitions.js';\nexport * from './hooks/api/projects.js';\nexport * from './pages/create-project-page.js';\nexport * from './pages/home-router.js';\nexport * from './pages/project-workflows-page.js';\nexport * from './pages/projects-hub-page.js';\nexport * from './project-error.js';\n"],"names":["ProjectBreadcrumb","ProjectLayoutGuard","ProjectCrumb","ProjectSwitcher","loadWorkspaceSetupRoute"],"mappings":"AACA,SAAQA,iBAAiB,EAAEC,kBAAkB,QAAO,cAAc;AAClE,SAAQC,YAAY,QAA+B,gCAAgC;AACnF,SAAQC,eAAe,QAAkC,mCAAmC;AAC5F,SACEC,uBAAuB,QAElB,wCAAwC;AAC/C,cAAc,6BAA6B;AAC3C,cAAc,0BAA0B;AACxC,cAAc,iCAAiC;AAC/C,cAAc,yBAAyB;AACvC,cAAc,oCAAoC;AAClD,cAAc,+BAA+B;AAC7C,cAAc,qBAAqB"}
@@ -0,0 +1,2 @@
1
+ export declare function CreateProjectPage(): import("react").JSX.Element;
2
+ //# sourceMappingURL=create-project-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-project-page.d.ts","sourceRoot":"","sources":["../../src/pages/create-project-page.tsx"],"names":[],"mappings":"AA+BA,wBAAgB,iBAAiB,gCA0ShC"}