@stardeck-customer-apps/compose 0.1.0 → 0.3.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/dist/index.d.mts CHANGED
@@ -1,3 +1,44 @@
1
+ import { z } from 'zod';
2
+
3
+ /** A data store connected to a project, as the composition rail consumes it. */
4
+ type ConnectedStore = {
5
+ storeId: string;
6
+ slug: string;
7
+ bindingKey: string | null;
8
+ accessLevel: "read" | "write" | "admin";
9
+ };
10
+
11
+ /**
12
+ * Repo-relative inputs file: the platform's two database reads, as JSON.
13
+ *
14
+ * `@stardeck-customer-apps/compose` runs inside a customer app with no platform
15
+ * database, so the two facts the rail reads from one — the data stores connected
16
+ * to the app and each Module's install row — reach it through this file. The
17
+ * platform writes it (`writeComposeInputs`), compose reads it
18
+ * (`readComposeInputs`); the schema below is the single definition both sides
19
+ * parse against, so a drift on the writing side fails in lib rather than as an
20
+ * unexplained empty datastore binding inside a fork's build.
21
+ */
22
+ declare const COMPOSE_INPUTS_PATH = "apps/web/stardeck.compose.json";
23
+ declare const composeInputsSchema: z.ZodObject<{
24
+ connectedStores: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
+ storeId: z.ZodString;
26
+ slug: z.ZodString;
27
+ bindingKey: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
28
+ accessLevel: z.ZodEnum<{
29
+ read: "read";
30
+ write: "write";
31
+ admin: "admin";
32
+ }>;
33
+ }, z.core.$strict>>>;
34
+ installs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
35
+ installedVersion: z.ZodString;
36
+ datastoreBindings: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
37
+ }, z.core.$strict>>>;
38
+ }, z.core.$strict>;
39
+ type ComposeInputsFile = z.infer<typeof composeInputsSchema>;
40
+ type ComposeInputsInstall = ComposeInputsFile["installs"][string];
41
+
1
42
  interface ComposeOptions {
2
43
  /** Repo root of the customer app (the directory holding `apps/web`). */
3
44
  cwd: string;
@@ -16,11 +57,36 @@ interface ComposeResult {
16
57
  deletes: number;
17
58
  /** Directories removed by `prune` (excluded Modules + orphaned enhancements). */
18
59
  pruned: number;
60
+ /** Stub paths listed in the generated `src/app/.gitignore`. */
61
+ /** Null when a partial (`--enabled`) compose left the committed list untouched. */
62
+ gitignoreEntries: number | null;
19
63
  }
64
+
65
+ interface ComposeInputs {
66
+ connectedStores: ConnectedStore[];
67
+ installs: Record<string, ComposeInputsInstall>;
68
+ }
69
+ /**
70
+ * The platform rail resolves data-store bindings and installed versions from
71
+ * its database. A standalone app has none, so compose reads the same two facts
72
+ * from a file the platform writes at deploy time (or a developer writes by
73
+ * hand). Absent file: no stores, every version `unreleased`. A malformed file
74
+ * is fatal — silently composing empty bindings is how an app loses its stores.
75
+ */
76
+ declare function readComposeInputs(cwd: string): ComposeInputs;
77
+ /** Compose needs the TypeScript API the emitters parse route entries with. */
78
+ declare function assertSupportedTypescript(versionMajorMinor: string): void;
79
+ /**
80
+ * gitignore patterns are fnmatch, so a Next.js path segment is not a literal:
81
+ * `[lang]` is a character class and `/[lang]/…/page.tsx` ignores nothing.
82
+ * Escapes every metacharacter, plus a leading `#`/`!` (the caller's `/` prefix
83
+ * rules those out today; a total helper keeps it that way).
84
+ */
85
+ declare function escapeGitignore(pattern: string): string;
20
86
  /**
21
87
  * Regenerate the Module-rail artifacts (the five `src/*.gen.ts` files and every
22
88
  * route/endpoint stub under `src/app`) for the app rooted at `options.cwd`.
23
89
  */
24
90
  declare function compose(options: ComposeOptions): Promise<ComposeResult>;
25
91
 
26
- export { type ComposeOptions, type ComposeResult, compose };
92
+ export { COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, readComposeInputs };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,44 @@
1
+ import { z } from 'zod';
2
+
3
+ /** A data store connected to a project, as the composition rail consumes it. */
4
+ type ConnectedStore = {
5
+ storeId: string;
6
+ slug: string;
7
+ bindingKey: string | null;
8
+ accessLevel: "read" | "write" | "admin";
9
+ };
10
+
11
+ /**
12
+ * Repo-relative inputs file: the platform's two database reads, as JSON.
13
+ *
14
+ * `@stardeck-customer-apps/compose` runs inside a customer app with no platform
15
+ * database, so the two facts the rail reads from one — the data stores connected
16
+ * to the app and each Module's install row — reach it through this file. The
17
+ * platform writes it (`writeComposeInputs`), compose reads it
18
+ * (`readComposeInputs`); the schema below is the single definition both sides
19
+ * parse against, so a drift on the writing side fails in lib rather than as an
20
+ * unexplained empty datastore binding inside a fork's build.
21
+ */
22
+ declare const COMPOSE_INPUTS_PATH = "apps/web/stardeck.compose.json";
23
+ declare const composeInputsSchema: z.ZodObject<{
24
+ connectedStores: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
+ storeId: z.ZodString;
26
+ slug: z.ZodString;
27
+ bindingKey: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
28
+ accessLevel: z.ZodEnum<{
29
+ read: "read";
30
+ write: "write";
31
+ admin: "admin";
32
+ }>;
33
+ }, z.core.$strict>>>;
34
+ installs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
35
+ installedVersion: z.ZodString;
36
+ datastoreBindings: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
37
+ }, z.core.$strict>>>;
38
+ }, z.core.$strict>;
39
+ type ComposeInputsFile = z.infer<typeof composeInputsSchema>;
40
+ type ComposeInputsInstall = ComposeInputsFile["installs"][string];
41
+
1
42
  interface ComposeOptions {
2
43
  /** Repo root of the customer app (the directory holding `apps/web`). */
3
44
  cwd: string;
@@ -16,11 +57,36 @@ interface ComposeResult {
16
57
  deletes: number;
17
58
  /** Directories removed by `prune` (excluded Modules + orphaned enhancements). */
18
59
  pruned: number;
60
+ /** Stub paths listed in the generated `src/app/.gitignore`. */
61
+ /** Null when a partial (`--enabled`) compose left the committed list untouched. */
62
+ gitignoreEntries: number | null;
19
63
  }
64
+
65
+ interface ComposeInputs {
66
+ connectedStores: ConnectedStore[];
67
+ installs: Record<string, ComposeInputsInstall>;
68
+ }
69
+ /**
70
+ * The platform rail resolves data-store bindings and installed versions from
71
+ * its database. A standalone app has none, so compose reads the same two facts
72
+ * from a file the platform writes at deploy time (or a developer writes by
73
+ * hand). Absent file: no stores, every version `unreleased`. A malformed file
74
+ * is fatal — silently composing empty bindings is how an app loses its stores.
75
+ */
76
+ declare function readComposeInputs(cwd: string): ComposeInputs;
77
+ /** Compose needs the TypeScript API the emitters parse route entries with. */
78
+ declare function assertSupportedTypescript(versionMajorMinor: string): void;
79
+ /**
80
+ * gitignore patterns are fnmatch, so a Next.js path segment is not a literal:
81
+ * `[lang]` is a character class and `/[lang]/…/page.tsx` ignores nothing.
82
+ * Escapes every metacharacter, plus a leading `#`/`!` (the caller's `/` prefix
83
+ * rules those out today; a total helper keeps it that way).
84
+ */
85
+ declare function escapeGitignore(pattern: string): string;
20
86
  /**
21
87
  * Regenerate the Module-rail artifacts (the five `src/*.gen.ts` files and every
22
88
  * route/endpoint stub under `src/app`) for the app rooted at `options.cwd`.
23
89
  */
24
90
  declare function compose(options: ComposeOptions): Promise<ComposeResult>;
25
91
 
26
- export { type ComposeOptions, type ComposeResult, compose };
92
+ export { COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, readComposeInputs };