@kapeta/local-cluster-service 0.70.0 → 0.70.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.70.1](https://github.com/kapetacom/local-cluster-service/compare/v0.70.0...v0.70.1) (2024-09-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * filenames and lazier generation for refs ([#235](https://github.com/kapetacom/local-cluster-service/issues/235)) ([02c5589](https://github.com/kapetacom/local-cluster-service/commit/02c55895c4ae3ed5632f4b53f33509ec18c87dcb))
7
+
1
8
  # [0.70.0](https://github.com/kapetacom/local-cluster-service/compare/v0.69.0...v0.70.0) (2024-09-04)
2
9
 
3
10
 
@@ -103,6 +103,9 @@ class PageQueue extends node_events_1.EventEmitter {
103
103
  generator.on('event', (event) => this.emit('event', event));
104
104
  generator.on('page_refs', async ({ event, references }) => {
105
105
  try {
106
+ const matchesExistingPages = (url) => {
107
+ return [...this.pages.keys()].some((path) => new RegExp(path.replaceAll('/*', '/[^/]+')).test(url));
108
+ };
106
109
  const initialPrompts = [];
107
110
  const resourcePromises = references.map(async (reference) => {
108
111
  if (reference.url.startsWith('#') ||
@@ -124,6 +127,9 @@ class PageQueue extends node_events_1.EventEmitter {
124
127
  break;
125
128
  case 'html':
126
129
  //console.log('Adding page generator for', reference);
130
+ if (matchesExistingPages(reference.url)) {
131
+ break;
132
+ }
127
133
  this.pages.set(reference.url, reference.description);
128
134
  initialPrompts.push({
129
135
  name: reference.name,
@@ -134,7 +140,8 @@ class PageQueue extends node_events_1.EventEmitter {
134
140
  prompt: `Implement a page for ${reference.name} at ${reference.url} with the following description: ${reference.description}.\n` +
135
141
  `The page was referenced from this page: \n### PATH: ${event.payload.path}\n\`\`\`html\n${event.payload.content}\n\`\`\`\n`,
136
142
  description: reference.description,
137
- filename: '',
143
+ // Only used for matching
144
+ filename: reference.name + '.ref.html',
138
145
  theme: this.theme,
139
146
  });
140
147
  break;
@@ -153,7 +160,7 @@ class PageQueue extends node_events_1.EventEmitter {
153
160
  payload: {
154
161
  name: prompt.name,
155
162
  title: prompt.title,
156
- filename: '',
163
+ filename: prompt.filename,
157
164
  method: 'GET',
158
165
  path: prompt.path,
159
166
  prompt: prompt.description,
@@ -103,6 +103,9 @@ class PageQueue extends node_events_1.EventEmitter {
103
103
  generator.on('event', (event) => this.emit('event', event));
104
104
  generator.on('page_refs', async ({ event, references }) => {
105
105
  try {
106
+ const matchesExistingPages = (url) => {
107
+ return [...this.pages.keys()].some((path) => new RegExp(path.replaceAll('/*', '/[^/]+')).test(url));
108
+ };
106
109
  const initialPrompts = [];
107
110
  const resourcePromises = references.map(async (reference) => {
108
111
  if (reference.url.startsWith('#') ||
@@ -124,6 +127,9 @@ class PageQueue extends node_events_1.EventEmitter {
124
127
  break;
125
128
  case 'html':
126
129
  //console.log('Adding page generator for', reference);
130
+ if (matchesExistingPages(reference.url)) {
131
+ break;
132
+ }
127
133
  this.pages.set(reference.url, reference.description);
128
134
  initialPrompts.push({
129
135
  name: reference.name,
@@ -134,7 +140,8 @@ class PageQueue extends node_events_1.EventEmitter {
134
140
  prompt: `Implement a page for ${reference.name} at ${reference.url} with the following description: ${reference.description}.\n` +
135
141
  `The page was referenced from this page: \n### PATH: ${event.payload.path}\n\`\`\`html\n${event.payload.content}\n\`\`\`\n`,
136
142
  description: reference.description,
137
- filename: '',
143
+ // Only used for matching
144
+ filename: reference.name + '.ref.html',
138
145
  theme: this.theme,
139
146
  });
140
147
  break;
@@ -153,7 +160,7 @@ class PageQueue extends node_events_1.EventEmitter {
153
160
  payload: {
154
161
  name: prompt.name,
155
162
  title: prompt.title,
156
- filename: '',
163
+ filename: prompt.filename,
157
164
  method: 'GET',
158
165
  path: prompt.path,
159
166
  prompt: prompt.description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.70.0",
3
+ "version": "0.70.1",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -136,6 +136,9 @@ export class PageQueue extends EventEmitter {
136
136
  generator.on('event', (event: StormEvent) => this.emit('event', event));
137
137
  generator.on('page_refs', async ({ event, references }) => {
138
138
  try {
139
+ const matchesExistingPages = (url: string) => {
140
+ return [...this.pages.keys()].some((path) => new RegExp(path.replaceAll('/*', '/[^/]+')).test(url));
141
+ };
139
142
  const initialPrompts: InitialPrompt[] = [];
140
143
  const resourcePromises = references.map(async (reference) => {
141
144
  if (
@@ -160,6 +163,9 @@ export class PageQueue extends EventEmitter {
160
163
  break;
161
164
  case 'html':
162
165
  //console.log('Adding page generator for', reference);
166
+ if (matchesExistingPages(reference.url)) {
167
+ break;
168
+ }
163
169
  this.pages.set(reference.url, reference.description);
164
170
 
165
171
  initialPrompts.push({
@@ -172,7 +178,8 @@ export class PageQueue extends EventEmitter {
172
178
  `Implement a page for ${reference.name} at ${reference.url} with the following description: ${reference.description}.\n` +
173
179
  `The page was referenced from this page: \n### PATH: ${event.payload.path}\n\`\`\`html\n${event.payload.content}\n\`\`\`\n`,
174
180
  description: reference.description,
175
- filename: '',
181
+ // Only used for matching
182
+ filename: reference.name + '.ref.html',
176
183
  theme: this.theme,
177
184
  });
178
185
  break;
@@ -193,7 +200,7 @@ export class PageQueue extends EventEmitter {
193
200
  payload: {
194
201
  name: prompt.name,
195
202
  title: prompt.title,
196
- filename: '',
203
+ filename: prompt.filename,
197
204
  method: 'GET',
198
205
  path: prompt.path,
199
206
  prompt: prompt.description,