@moloodev/platform 0.6.0 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moloodev/platform",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -11,6 +11,7 @@
11
11
  "./occupancy-protocol": "./src/occupancy-protocol.ts",
12
12
  "./file-content": "./src/file-content.ts",
13
13
  "./bundle": "./src/bundle.ts",
14
+ "./editor-track": "./src/editor-track.ts",
14
15
  "./file-delivery": "./src/file-delivery.ts",
15
16
  "./ids": "./src/ids.ts"
16
17
  },
@@ -22,7 +23,7 @@
22
23
  "@types/node": "^24.13.3",
23
24
  "tsx": "^4.23.13",
24
25
  "typescript": "^7.0.2",
25
- "@moloodev/typescript-config": "0.6.0"
26
+ "@moloodev/typescript-config": "0.7.0"
26
27
  },
27
28
  "publishConfig": {
28
29
  "access": "public"
@@ -189,9 +189,7 @@ export function patternForContentType(contentType: string): KnownPatternId {
189
189
 
190
190
  const COMPOUND_SCHEMA_BY_SUFFIX: readonly [string, string][] = [
191
191
  [".layout.json", FIRST_PARTY_SCHEMAS.layout],
192
- [".mlayout", FIRST_PARTY_SCHEMAS.layout],
193
192
  [".catalog.json", FIRST_PARTY_SCHEMAS.catalog],
194
- [".mcat", FIRST_PARTY_SCHEMAS.catalog],
195
193
  [".table.json", FIRST_PARTY_SCHEMAS.table],
196
194
  [".loop.json", FIRST_PARTY_SCHEMAS.loop],
197
195
  [".bundle.json", FIRST_PARTY_SCHEMAS.bundle],
@@ -199,8 +197,6 @@ const COMPOUND_SCHEMA_BY_SUFFIX: readonly [string, string][] = [
199
197
 
200
198
  const EXTENSION_MIME_MAP: Record<string, { contentType: string; storageMode: StorageMode }> = {
201
199
  ".json": { contentType: "application/json", storageMode: "json" },
202
- ".mlayout": { contentType: "application/json", storageMode: "json" },
203
- ".mcat": { contentType: "application/json", storageMode: "json" },
204
200
  ".md": { contentType: "text/markdown", storageMode: "text" },
205
201
  ".markdown": { contentType: "text/markdown", storageMode: "text" },
206
202
  ".txt": { contentType: "text/plain", storageMode: "text" },
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+
3
+ export const editorStatusResponseSchema = z.object({ data: z.array(z.object({
4
+ id: z.string(), revision: z.number().int(), status: z.string(),
5
+ tracks: z.array(z.enum(["stable", "beta"])),
6
+ submittedAt: z.string(), reviewedAt: z.string().nullable(), rejectionReason: z.string().nullable(),
7
+ checkFindings: z.array(z.object({ code: z.string(), detail: z.string() })),
8
+ })) });
@@ -0,0 +1,8 @@
1
+ /** Release tracks. A track points at one editor revision; `stable` is the default. */
2
+ export const EDITOR_TRACKS = ["stable", "beta"] as const;
3
+
4
+ export type EditorTrack = (typeof EDITOR_TRACKS)[number];
5
+
6
+ export function isEditorTrack(value: unknown): value is EditorTrack {
7
+ return typeof value === "string" && (EDITOR_TRACKS as readonly string[]).includes(value);
8
+ }
package/src/index.ts CHANGED
@@ -88,7 +88,9 @@ export * from "./bundle";
88
88
  export * from "./file-delivery";
89
89
 
90
90
  export { loopbackOrigin } from "./editor-dev";
91
+ export { editorStatusResponseSchema } from "./editor-status";
92
+ export { EDITOR_TRACKS, isEditorTrack, type EditorTrack } from "./editor-track";
91
93
 
92
94
  export type { PublishTarget } from "./publish-target";
93
- export { PUBLISH_ERROR_MESSAGES, publishErrorBody } from "./publish-target";
95
+ export { PUBLISH_ERROR_MESSAGES, publishErrorBody, parsePublishName } from "./publish-target";
94
96
  export { isPublisherHandle, isReservedPublisherHandle, reservedPublishers } from "./publisher-handle";
@@ -1,5 +1,17 @@
1
+ import { isPublisherHandle } from "./publisher-handle";
2
+ import { parseQualifiedName } from "./qualified-name";
3
+
1
4
  export type PublishTarget = { kind: "workspace"; workspaceSlug: string };
2
5
 
6
+ export function parsePublishName(id: string) {
7
+ const dot = id.indexOf(".");
8
+ if (dot !== -1 && !isPublisherHandle(id.slice(0, dot))) {
9
+ return { ok: false, error: "invalid_publisher_handle" } as const;
10
+ }
11
+ const name = parseQualifiedName(id);
12
+ return name ? { ok: true, name } as const : { ok: false, error: "invalid_manifest" } as const;
13
+ }
14
+
3
15
  /** Shared copy for API responses and CLI fallbacks. Services return only codes. */
4
16
  export const PUBLISH_ERROR_MESSAGES = {
5
17
  invalid_publisher_handle: "Publisher handles must be 2–39 lowercase letters, digits or hyphens, start with a letter, and have no trailing or consecutive hyphens.",
@@ -11,6 +23,8 @@ export const PUBLISH_ERROR_MESSAGES = {
11
23
  unknown_workspace: "The selected workspace does not exist.",
12
24
  unknown_editor: "No submitted editor with this manifest id exists in the selected workspace.",
13
25
  checks_failed: "Editor checks failed. Fix the findings before publishing again.",
26
+ behind_stable: "This revision is older than the stable revision. Publish a new build to beta.",
27
+ no_beta: "This editor has no beta revision to promote.",
14
28
  } as const;
15
29
 
16
30
  export function publishErrorBody(error: string): { error: string; message?: string } {