astro-integration-pocketbase 3.0.0 → 3.1.0-next.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-integration-pocketbase",
3
- "version": "3.0.0",
3
+ "version": "3.1.0-next.1",
4
4
  "description": "An Astro integration to support developers working with astro-loader-pocketbase.",
5
5
  "keywords": [
6
6
  "astro",
@@ -40,24 +40,24 @@
40
40
  "lint": "oxlint --type-aware --type-check",
41
41
  "lint:fix": "oxlint --type-aware --type-check --fix",
42
42
  "prepare": "husky",
43
- "typecheck": "npx @typescript/native-preview --noEmit"
43
+ "typecheck": "npx @typescript/native-preview --noEmit -p src/tsconfig.json"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@commitlint/cli": "20.5.0",
47
47
  "@commitlint/config-conventional": "20.5.0",
48
48
  "@types/node": "24.12.0",
49
- "astro": "6.0.8",
49
+ "astro": "6.1.5",
50
50
  "eventsource": "4.1.0",
51
- "globals": "17.4.0",
51
+ "globals": "17.5.0",
52
52
  "husky": "9.1.7",
53
53
  "lint-staged": "16.4.0",
54
- "oxfmt": "0.41.0",
55
- "oxlint": "1.56.0",
56
- "oxlint-tsgolint": "0.17.1"
54
+ "oxfmt": "0.44.0",
55
+ "oxlint": "1.59.0",
56
+ "oxlint-tsgolint": "0.20.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "astro": "^6.0.0",
60
60
  "eventsource": "^4.0.0"
61
61
  },
62
- "packageManager": "npm@11.12.0"
62
+ "packageManager": "npm@11.12.1"
63
63
  }
@@ -144,7 +144,7 @@ async function handleConnectEvent(
144
144
  Authorization: superuserToken || ""
145
145
  },
146
146
  body: JSON.stringify({
147
- clientId: clientId,
147
+ clientId,
148
148
  subscriptions: remoteCollections.map((collection) => `${collection}/*`)
149
149
  })
150
150
  });
@@ -33,7 +33,7 @@ export function handleRefreshCollections({
33
33
  loaders: ["pocketbase-loader"],
34
34
  context: {
35
35
  source: "astro-integration-pocketbase",
36
- force: force
36
+ force
37
37
  }
38
38
  });
39
39
 
@@ -4,8 +4,15 @@ import type { Entity } from "../types/entity";
4
4
  * Creates cards for the entities.
5
5
  */
6
6
  export function createEntities(data: Array<Entity>, baseUrl: string): string {
7
+ const groupedData = Object.groupBy(data, (data) => data.collectionName);
8
+ const collections = Object.keys(groupedData);
9
+
7
10
  return /* HTML */ `
8
11
  <style>
12
+ .collectionName {
13
+ text-transform: capitalize;
14
+ }
15
+
9
16
  .entity {
10
17
  position: relative;
11
18
 
@@ -22,7 +29,16 @@ export function createEntities(data: Array<Entity>, baseUrl: string): string {
22
29
  }
23
30
  </style>
24
31
 
25
- ${data.map((entity) => createEntity(entity, baseUrl)).join("")}
32
+ ${collections
33
+ .map(
34
+ (collection) => /* HTML */ `
35
+ <b class=".collectionName">${collection}</b>
36
+ ${groupedData[collection]
37
+ ?.map((entity) => createEntity(entity, baseUrl))
38
+ .join("")}
39
+ `
40
+ )
41
+ .join("")}
26
42
  `;
27
43
  }
28
44
 
@@ -35,20 +51,18 @@ function createEntity(data: Entity, baseUrl: string): string {
35
51
  <div class="entity">
36
52
  <pre>${JSON.stringify(data, undefined, 2).replaceAll("<", "&lt;")}</pre>
37
53
 
38
- ${
39
- baseUrl
40
- ? /* HTML */ `
54
+ ${baseUrl
55
+ ? /* HTML */ `
41
56
  <astro-dev-toolbar-button
42
57
  size="small"
43
58
  button-style="purple"
44
59
  title="View in PocketBase"
45
- onclick="window.open('${baseUrl}/_/#/collections?collection=${data.collectionId}&recordId=${data.id}', '_blank')"
60
+ onclick="window.open('${baseUrl}/_/#/collections?collection=${data.collectionId}&recordId=${data.id}&record=${data.id}', '_blank')"
46
61
  >
47
62
  View in PocketBase
48
63
  </astro-dev-toolbar-button>
49
64
  `
50
- : ""
51
- }
65
+ : ""}
52
66
  </div>
53
67
  </astro-dev-toolbar-card>
54
68
  `;
@@ -59,9 +59,8 @@ export function createHeader(
59
59
  </astro-dev-toolbar-badge>
60
60
 
61
61
  <div class="actions">
62
- ${
63
- realtime
64
- ? /* HTML */ `
62
+ ${realtime
63
+ ? /* HTML */ `
65
64
  <div class="toggle-container">
66
65
  <label
67
66
  for="real-time"
@@ -72,11 +71,9 @@ export function createHeader(
72
71
  <!-- real-time-toggle -->
73
72
  </div>
74
73
  `
75
- : ""
76
- }
77
- ${
78
- hasContentLoader
79
- ? /* HTML */ `
74
+ : ""}
75
+ ${hasContentLoader
76
+ ? /* HTML */ `
80
77
  <astro-dev-toolbar-button
81
78
  id="refresh-content"
82
79
  size="small"
@@ -86,8 +83,7 @@ export function createHeader(
86
83
  Refresh content
87
84
  </astro-dev-toolbar-button>
88
85
  `
89
- : ""
90
- }
86
+ : ""}
91
87
  </div>
92
88
  `;
93
89
 
@@ -75,11 +75,9 @@ export function initToolbar(
75
75
  <hr />
76
76
 
77
77
  <main>
78
- ${
79
- entities.length > 0
80
- ? createEntities(entities, options.baseUrl)
81
- : createPlaceholder()
82
- }
78
+ ${entities.length > 0
79
+ ? createEntities(entities, options.baseUrl)
80
+ : createPlaceholder()}
83
81
  </main>
84
82
  `);
85
83
 
@@ -4,4 +4,5 @@
4
4
  export interface Entity {
5
5
  id: string;
6
6
  collectionId: string;
7
+ collectionName: string;
7
8
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "include": ["./**/*"],
4
+ "compilerOptions": {
5
+ "noUncheckedIndexedAccess": true
6
+ }
7
+ }
@@ -36,6 +36,9 @@ export function mapCollectionsToWatch(
36
36
  const collectionsMap = new Map<string, Array<string>>();
37
37
  for (const localCollection in collectionsToWatch) {
38
38
  const watch = collectionsToWatch[localCollection];
39
+ if (!watch) {
40
+ continue;
41
+ }
39
42
 
40
43
  // Check if collection should be watched by itself
41
44
  if (watch === true) {