@rmdes/indiekit-endpoint-micropub 1.0.0-beta.25 → 1.0.0-beta.27

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/lib/post-data.js CHANGED
@@ -150,6 +150,11 @@ export const postData = {
150
150
  const typeConfig = postTypes[type];
151
151
  properties["post-type"] = type;
152
152
 
153
+ // Validate post type configuration exists
154
+ if (!typeConfig || !typeConfig.post?.path) {
155
+ throw IndiekitError.notImplemented(type);
156
+ }
157
+
153
158
  // Post paths
154
159
  const path = await renderPath(
155
160
  typeConfig.post.path,
@@ -219,6 +224,11 @@ export const postData = {
219
224
  const type = properties["post-type"];
220
225
  const typeConfig = postTypes[type];
221
226
 
227
+ // Validate post type configuration exists
228
+ if (!typeConfig || !typeConfig.post?.path) {
229
+ throw IndiekitError.notImplemented(type);
230
+ }
231
+
222
232
  // Post paths
223
233
  const path = await renderPath(
224
234
  typeConfig.post.path,
@@ -261,6 +271,11 @@ export const postData = {
261
271
  const type = properties["post-type"];
262
272
  const typeConfig = postTypes[type];
263
273
 
274
+ // Validate post type configuration exists
275
+ if (!typeConfig || !typeConfig.post?.path) {
276
+ throw IndiekitError.notImplemented(type);
277
+ }
278
+
264
279
  // Post paths
265
280
  const path = await renderPath(
266
281
  typeConfig.post.path,
@@ -8,11 +8,18 @@
8
8
  export const getPostType = (postTypes, properties) => {
9
9
  const propertiesMap = new Map(Object.entries(properties));
10
10
 
11
- // If post has the event type, its an event
11
+ // If post has the event type, it's an event
12
12
  if (properties.type && properties.type === "event") {
13
13
  return properties.type;
14
14
  }
15
15
 
16
+ // If post has a custom type (h value) that matches a configured post type
17
+ // This allows plugins to use h: "page" or similar for type-based discovery
18
+ // instead of requiring a discovery property that survives mf2->JF2 conversion
19
+ if (properties.type && properties.type !== "entry" && postTypes[properties.type]) {
20
+ return properties.type;
21
+ }
22
+
16
23
  const basePostTypes = new Map([
17
24
  ["rsvp", "rsvp"],
18
25
  ["repost", "repost-of"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-micropub",
3
- "version": "1.0.0-beta.25",
4
- "description": "Micropub endpoint for Indiekit with mp-syndicate-to preservation. Enables publishing content to your website using the Micropub protocol.",
3
+ "version": "1.0.0-beta.27",
4
+ "description": "Micropub endpoint for Indiekit with custom type-based post discovery. Enables publishing content to your website using the Micropub protocol.",
5
5
  "keywords": [
6
6
  "indiekit",
7
7
  "indiekit-plugin",