@cobaltcore-dev/aurora 0.17.1 → 0.19.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 (92) hide show
  1. package/dist/client/AuthProvider-Cj_Btfnc.mjs +56 -0
  2. package/dist/client/AuthProvider-Cj_Btfnc.mjs.map +1 -0
  3. package/dist/client/{BucketToastNotifications-D2Cq2VrV.mjs → BucketToastNotifications-BGd2wVmh.mjs} +2 -2
  4. package/dist/client/{BucketToastNotifications-D2Cq2VrV.mjs.map → BucketToastNotifications-BGd2wVmh.mjs.map} +1 -1
  5. package/dist/client/DeletePcaModal-BU6kbKsw.mjs +80 -0
  6. package/dist/client/DeletePcaModal-BU6kbKsw.mjs.map +1 -0
  7. package/dist/client/DetailsInfo-BUyuYpJj.mjs +52 -0
  8. package/dist/client/DetailsInfo-BUyuYpJj.mjs.map +1 -0
  9. package/dist/client/{FloatingIpActionModals-BUc6yaQ8.mjs → FloatingIpActionModals-DAtZoYGS.mjs} +22 -22
  10. package/dist/client/{FloatingIpActionModals-BUc6yaQ8.mjs.map → FloatingIpActionModals-DAtZoYGS.mjs.map} +1 -1
  11. package/dist/client/{ImageToastNotifications-Dz-VsSwl.mjs → ImageToastNotifications-BhjU1bfT.mjs} +7 -7
  12. package/dist/client/{ImageToastNotifications-Dz-VsSwl.mjs.map → ImageToastNotifications-BhjU1bfT.mjs.map} +1 -1
  13. package/dist/client/{_auth-6uste_10.mjs → _auth-BtRCgHQe.mjs} +2 -2
  14. package/dist/client/{_auth-6uste_10.mjs.map → _auth-BtRCgHQe.mjs.map} +1 -1
  15. package/dist/client/{_flavorId-Cx5tf2KQ.mjs → _flavorId-BQY7YhNx.mjs} +2 -2
  16. package/dist/client/{_flavorId-Cx5tf2KQ.mjs.map → _flavorId-BQY7YhNx.mjs.map} +1 -1
  17. package/dist/client/{_flavorId-C6RJfhh8.mjs → _flavorId-sS1sg_DZ.mjs} +3 -3
  18. package/dist/client/{_flavorId-C6RJfhh8.mjs.map → _flavorId-sS1sg_DZ.mjs.map} +1 -1
  19. package/dist/client/{_floatingIpId-B0l4YNQc.mjs → _floatingIpId-BHZGh8U8.mjs} +2 -2
  20. package/dist/client/{_floatingIpId-B0l4YNQc.mjs.map → _floatingIpId-BHZGh8U8.mjs.map} +1 -1
  21. package/dist/client/{_floatingIpId-cpueAc2F2.mjs → _floatingIpId-CR3aD38l2.mjs} +5 -5
  22. package/dist/client/{_floatingIpId-cpueAc2F2.mjs.map → _floatingIpId-CR3aD38l2.mjs.map} +1 -1
  23. package/dist/client/{_imageId-Bv711w1n.mjs → _imageId-Cf-Xdksv.mjs} +3 -3
  24. package/dist/client/{_imageId-Bv711w1n.mjs.map → _imageId-Cf-Xdksv.mjs.map} +1 -1
  25. package/dist/client/_pcaId-B7j0sXnY.mjs +545 -0
  26. package/dist/client/_pcaId-B7j0sXnY.mjs.map +1 -0
  27. package/dist/client/{_projectId-fEA6fnFQ.mjs → _projectId-Cq9JnhRj.mjs} +3 -3
  28. package/dist/client/{_projectId-fEA6fnFQ.mjs.map → _projectId-Cq9JnhRj.mjs.map} +1 -1
  29. package/dist/client/{_projectId-w-tZz0FI.mjs → _projectId-D8FHe0gr.mjs} +2 -2
  30. package/dist/client/{_projectId-w-tZz0FI.mjs.map → _projectId-D8FHe0gr.mjs.map} +1 -1
  31. package/dist/client/{_projectId-qvINx3Dx.mjs → _projectId-Ig3QqYzt.mjs} +2 -2
  32. package/dist/client/{_projectId-qvINx3Dx.mjs.map → _projectId-Ig3QqYzt.mjs.map} +1 -1
  33. package/dist/client/{_projectId-BOaPmCuz.mjs → _projectId-b4NGeECR.mjs} +3 -3
  34. package/dist/client/{_projectId-BOaPmCuz.mjs.map → _projectId-b4NGeECR.mjs.map} +1 -1
  35. package/dist/client/{_securityGroupId-B-RYPDDc.mjs → _securityGroupId-BVSsCus9.mjs} +2 -2
  36. package/dist/client/{_securityGroupId-B-RYPDDc.mjs.map → _securityGroupId-BVSsCus9.mjs.map} +1 -1
  37. package/dist/client/{_securityGroupId-BC3KC6h5.mjs → _securityGroupId-gwV4eB0s.mjs} +16 -16
  38. package/dist/client/{_securityGroupId-BC3KC6h5.mjs.map → _securityGroupId-gwV4eB0s.mjs.map} +1 -1
  39. package/dist/client/{_storageType-ZFnIALny.mjs → _storageType-CH2khFcZ.mjs} +2 -2
  40. package/dist/client/{_storageType-ZFnIALny.mjs.map → _storageType-CH2khFcZ.mjs.map} +1 -1
  41. package/dist/client/{_storageType-MgntkZb6.mjs → _storageType-D-1H6SX1.mjs} +856 -856
  42. package/dist/client/{_storageType-MgntkZb6.mjs.map → _storageType-D-1H6SX1.mjs.map} +1 -1
  43. package/dist/client/{aurora-AAy9BJE7.mjs → aurora-Owys0YMN.mjs} +2 -2
  44. package/dist/client/{aurora-AAy9BJE7.mjs.map → aurora-Owys0YMN.mjs.map} +1 -1
  45. package/dist/client/build-DgeVmENN.mjs.map +1 -1
  46. package/dist/client/{floatingips-Bkk5-I_p.mjs → floatingips-DyBEotB8.mjs} +10 -10
  47. package/dist/client/{floatingips-Bkk5-I_p.mjs.map → floatingips-DyBEotB8.mjs.map} +1 -1
  48. package/dist/client/hooks-iGiEkLTp.mjs +12 -0
  49. package/dist/client/hooks-iGiEkLTp.mjs.map +1 -0
  50. package/dist/client/{images-FE3vJ6pP.mjs → images-BklbSacK.mjs} +2 -2
  51. package/dist/client/{images-FE3vJ6pP.mjs.map → images-BklbSacK.mjs.map} +1 -1
  52. package/dist/client/{images-DBLfzuJA.mjs → images-C3voJ3B1.mjs} +259 -259
  53. package/dist/client/{images-DBLfzuJA.mjs.map → images-C3voJ3B1.mjs.map} +1 -1
  54. package/dist/client/index.d.ts +3 -1
  55. package/dist/client/index.js +370 -414
  56. package/dist/client/index.js.map +1 -1
  57. package/dist/client/md-CyCflQee.mjs.map +1 -1
  58. package/dist/client/{objects-DpgXMFrG.mjs → objects-B3Z8h4RU.mjs} +2 -2
  59. package/dist/client/{objects-DpgXMFrG.mjs.map → objects-B3Z8h4RU.mjs.map} +1 -1
  60. package/dist/client/{objects-Deo1Ic1A.mjs → objects-CGOfO00N.mjs} +499 -475
  61. package/dist/client/objects-CGOfO00N.mjs.map +1 -0
  62. package/dist/client/{pca-BkAJ5jvX.mjs → pca-72YR_Pk0.mjs} +3 -3
  63. package/dist/client/pca-72YR_Pk0.mjs.map +1 -0
  64. package/dist/client/pca-CsBx_IDO.mjs +251 -0
  65. package/dist/client/pca-CsBx_IDO.mjs.map +1 -0
  66. package/dist/client/pcaAccess-Br4kVjLQ.mjs +9 -0
  67. package/dist/client/pcaAccess-Br4kVjLQ.mjs.map +1 -0
  68. package/dist/client/{securitygroups-D14Jv1GQ.mjs → securitygroups-8vRbXmBL.mjs} +3 -3
  69. package/dist/client/{securitygroups-D14Jv1GQ.mjs.map → securitygroups-8vRbXmBL.mjs.map} +1 -1
  70. package/dist/client/trpcClient-BxcNKnhv.mjs +65 -0
  71. package/dist/client/trpcClient-BxcNKnhv.mjs.map +1 -0
  72. package/dist/client/trpcClient.d.ts +3014 -0
  73. package/dist/server/index.d.ts +3058 -1
  74. package/dist/server/index.js +53 -23
  75. package/package.json +4 -2
  76. package/dist/client/AuthProvider-BQSJk5R4.mjs +0 -63
  77. package/dist/client/AuthProvider-BQSJk5R4.mjs.map +0 -1
  78. package/dist/client/_pcaId-CPLb5J6d.mjs +0 -479
  79. package/dist/client/_pcaId-CPLb5J6d.mjs.map +0 -1
  80. package/dist/client/_pcaId-Hx_72pnp.mjs +0 -36
  81. package/dist/client/_pcaId-Hx_72pnp.mjs.map +0 -1
  82. package/dist/client/constants-BAqOfvr0.mjs +0 -153
  83. package/dist/client/constants-BAqOfvr0.mjs.map +0 -1
  84. package/dist/client/hooks-CnX5q5wN.mjs +0 -2
  85. package/dist/client/objects-Deo1Ic1A.mjs.map +0 -1
  86. package/dist/client/pca-BkAJ5jvX.mjs.map +0 -1
  87. package/dist/client/pca-P0ud1PA9.mjs +0 -202
  88. package/dist/client/pca-P0ud1PA9.mjs.map +0 -1
  89. package/dist/client/pcaAccess-BYUY700H.mjs +0 -9
  90. package/dist/client/pcaAccess-BYUY700H.mjs.map +0 -1
  91. package/dist/client/trpcClient-Dy_MP_Pv.mjs +0 -57
  92. package/dist/client/trpcClient-Dy_MP_Pv.mjs.map +0 -1
@@ -0,0 +1,65 @@
1
+ import { createTRPCReact as e } from "@trpc/react-query";
2
+ import { createTRPCClient as t, httpBatchLink as n, httpBatchStreamLink as r, httpLink as i, httpSubscriptionLink as a, isNonJsonSerializable as o, splitLink as s } from "@trpc/client";
3
+ //#region src/client/trpcClient.ts
4
+ var c = {
5
+ token: null,
6
+ pending: null,
7
+ async getHeaders() {
8
+ if (this.token) return { "x-csrf-token": this.token };
9
+ this.pending ||= fetch("/csrf-token").then((e) => e.json()).then(({ csrfToken: e }) => (this.token = e, this.pending = null, e)).catch((e) => (this.pending = null, console.error("Failed to fetch CSRF token:", e), null));
10
+ let e = await this.pending;
11
+ return e ? { "x-csrf-token": e } : {};
12
+ },
13
+ invalidate() {
14
+ this.token = null;
15
+ }
16
+ }, l = new Set(["storage.swift.downloadObject", "storage.ceph.objects.downloadObject"]), u = { bffEndpoint: "/polaris-bff" };
17
+ function d(e) {
18
+ u.bffEndpoint = e;
19
+ }
20
+ var f = () => [s({
21
+ condition: (e) => e.type === "subscription",
22
+ true: a({
23
+ url: u.bffEndpoint,
24
+ eventSourceOptions: async () => ({ headers: await c.getHeaders() })
25
+ }),
26
+ false: s({
27
+ condition: (e) => o(e.input),
28
+ true: i({
29
+ url: u.bffEndpoint,
30
+ async headers({ op: e }) {
31
+ let t = await c.getHeaders(), n = e.context?.headers ?? {};
32
+ return {
33
+ ...t,
34
+ ...n
35
+ };
36
+ }
37
+ }),
38
+ false: s({
39
+ condition: (e) => l.has(e.path),
40
+ true: r({
41
+ url: u.bffEndpoint,
42
+ async headers() {
43
+ return c.getHeaders();
44
+ }
45
+ }),
46
+ false: n({
47
+ url: u.bffEndpoint,
48
+ async headers() {
49
+ return c.getHeaders();
50
+ }
51
+ })
52
+ })
53
+ })
54
+ })], p = e(), m = {
55
+ react: null,
56
+ vanilla: null
57
+ }, h = new Proxy({}, { get(e, t) {
58
+ return m.react ||= p.createClient({ links: f() }), m.react[t];
59
+ } }), g = new Proxy({}, { get(e, n) {
60
+ return m.vanilla ||= t({ links: f() }), m.vanilla[n];
61
+ } });
62
+ //#endregion
63
+ export { h as i, g as n, p as r, d as t };
64
+
65
+ //# sourceMappingURL=trpcClient-BxcNKnhv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trpcClient-BxcNKnhv.mjs","names":["createTRPCReact","createTRPCClient","httpBatchLink","httpBatchStreamLink","httpLink","splitLink","isNonJsonSerializable","httpSubscriptionLink","csrfCache","token","pending","getHeaders","fetch","then","res","json","csrfToken","catch","error","console","invalidate","invalidateCsrfToken","STREAMING_PROCEDURES","Set","config","bffEndpoint","setBffEndpoint","endpoint","getLinks","condition","op","type","true","url","eventSourceOptions","headers","false","input","csrf","extra","context","has","path","trpcReact","clients","react","vanilla","trpcReactClient","Proxy","get","_target","prop","createClient","links","trpcClient"],"sources":["../../src/client/trpcClient.ts"],"sourcesContent":["import { createTRPCReact } from \"@trpc/react-query\"\nimport type { CreateTRPCReact } from \"@trpc/react-query\"\nimport { createTRPCClient, type TRPCClient } from \"@trpc/client\"\nimport {\n httpBatchLink,\n httpBatchStreamLink,\n httpLink,\n splitLink,\n isNonJsonSerializable,\n httpSubscriptionLink,\n} from \"@trpc/client\"\nimport type { AuroraRouter } from \"../server/routers\"\n\n/** Type alias for the React tRPC client */\nexport type TrpcReact = ReturnType<typeof createTRPCReact<AuroraRouter>>\n\n/** Type alias for the vanilla tRPC client */\nexport type TrpcClient = ReturnType<typeof createTRPCClient<AuroraRouter>>\n\n/** Generic type for creating a typed React tRPC client with a custom router */\nexport type CreateTypedTrpcReact<TRouter extends AuroraRouter> = CreateTRPCReact<TRouter, unknown>\n\n/** Generic type for creating a typed vanilla tRPC client with a custom router */\nexport type CreateTypedTrpcClient<TRouter extends AuroraRouter> = TRPCClient<TRouter>\n\n// CSRF token cache with request deduplication\nconst csrfCache = {\n token: null as string | null,\n pending: null as Promise<string | null> | null,\n\n async getHeaders() {\n if (this.token) {\n return { \"x-csrf-token\": this.token }\n }\n\n // Dedupe concurrent fetches - only one request in flight at a time\n if (!this.pending) {\n this.pending = fetch(\"/csrf-token\")\n .then((res) => res.json())\n .then(({ csrfToken }) => {\n this.token = csrfToken\n this.pending = null\n return csrfToken as string\n })\n .catch((error) => {\n this.pending = null\n console.error(\"Failed to fetch CSRF token:\", error)\n return null\n })\n }\n\n const token = await this.pending\n return token ? { \"x-csrf-token\": token } : {}\n },\n\n invalidate() {\n this.token = null\n },\n}\n\n/**\n * Invalidate the cached CSRF token.\n * Call this when receiving a 403 response to trigger a fresh token fetch on the next request.\n */\nexport const invalidateCsrfToken = () => csrfCache.invalidate()\n\n// Procedures that return async iterables (chunked streaming responses).\n// These are routed through httpBatchStreamLink instead of httpBatchLink.\n// Add any new streaming procedure paths here.\nconst STREAMING_PROCEDURES = new Set<string>([\"storage.swift.downloadObject\", \"storage.ceph.objects.downloadObject\"])\n\n// BFF endpoint - set once by App before any tRPC calls are made\nconst config = {\n bffEndpoint: \"/polaris-bff\",\n}\n\nexport function setBffEndpoint(endpoint: string) {\n config.bffEndpoint = endpoint\n}\n\nconst getLinks = () => [\n splitLink({\n // First check: is it a subscription?\n condition: (op) => op.type === \"subscription\",\n // Use HTTP subscription link for subscriptions (long-polling)\n true: httpSubscriptionLink({\n url: config.bffEndpoint,\n // Callback to populate headers\n eventSourceOptions: async () => {\n return { headers: await csrfCache.getHeaders() }\n },\n }),\n // For non-subscriptions, check for non-JSON data or streaming procedures\n false: splitLink({\n // Non-JSON serializable input (FormData, Blob, ArrayBuffer, etc.) → plain httpLink.\n condition: (op) => isNonJsonSerializable(op.input),\n true: httpLink({\n url: config.bffEndpoint,\n async headers({ op }) {\n const csrf = await csrfCache.getHeaders()\n // Per-request headers can be injected via tRPC operation context.\n // op.context is set by the caller and forwarded through the link chain.\n const extra = (op.context as { headers?: Record<string, string> } | undefined)?.headers ?? {}\n return { ...csrf, ...extra }\n },\n }),\n // For JSON procedures, decide between streaming and regular batching\n false: splitLink({\n // Procedures returning async iterables must use httpBatchStreamLink.\n // httpBatchLink buffers the full response before resolving, which\n // breaks streaming. httpBatchStreamLink preserves batching while\n // supporting chunked/streamed responses.\n // Note: httpBatchStreamLink is intentionally NOT used globally because\n // it is incompatible with the @fastify/csrf-protection cookie rotation\n // used in this app — CSRF tokens can expire mid-stream on long-lived\n // connections. Scope it only to procedures that actually need streaming.\n condition: (op) => STREAMING_PROCEDURES.has(op.path),\n true: httpBatchStreamLink({\n url: config.bffEndpoint,\n async headers() {\n return csrfCache.getHeaders()\n },\n }),\n // Regular JSON mutations/queries — standard batching\n false: httpBatchLink({\n url: config.bffEndpoint,\n async headers() {\n return csrfCache.getHeaders()\n },\n }),\n }),\n }),\n }),\n]\n\n// React Query client (for hooks like useQuery/useMutation/useSubscription)\nexport const trpcReact: TrpcReact = createTRPCReact<AuroraRouter>()\n\n// Lazy-initialized clients - created on first access after setBffEndpoint() has been called by App\nconst clients = {\n react: null as ReturnType<typeof trpcReact.createClient> | null,\n vanilla: null as TrpcClient | null,\n}\n\nexport const trpcReactClient = new Proxy({} as ReturnType<typeof trpcReact.createClient>, {\n get(_target, prop) {\n if (!clients.react) {\n clients.react = trpcReact.createClient({ links: getLinks() })\n }\n return (clients.react as Record<string | symbol, unknown>)[prop]\n },\n})\n\nexport const trpcClient: TrpcClient = new Proxy({} as TrpcClient, {\n get(_target, prop) {\n if (!clients.vanilla) {\n clients.vanilla = createTRPCClient<AuroraRouter>({ links: getLinks() })\n }\n return (clients.vanilla as Record<string | symbol, unknown>)[prop]\n },\n})\n"],"mappings":";;;AA0BA,IAAMQ,IAAY;CAChBC,OAAO;CACPC,SAAS;CAET,MAAMC,aAAAA;EACJ,IAAI,KAAKF,OACP,OAAO,EAAE,gBAAgB,KAAK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