@plume-press/cli 0.0.0-stage → 0.4.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/LICENSE +21 -0
- package/README.md +2 -2
- package/THIRD_PARTY_NOTICES.md +978 -0
- package/dist/cli.mjs +39509 -0
- package/dist/local.d.ts +64 -0
- package/dist/local.mjs +34729 -0
- package/dist/schema.d.ts +230 -0
- package/dist/schema.mjs +585 -0
- package/package.json +38 -4
package/dist/local.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ContentItem, DeliveredValue, Field, MediaPath, ScalarField, SchemaDefinition } from "./schema.js";
|
|
2
|
+
/** The same delivered Item shape as the hosted SDK. */
|
|
3
|
+
export type LocalContentItem<T> = ContentItem<T>;
|
|
4
|
+
export type LocalContentPage<T> = {
|
|
5
|
+
items: LocalContentItem<T>[];
|
|
6
|
+
total: number;
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
revision: number;
|
|
10
|
+
};
|
|
11
|
+
type LocalReadValue<F extends Field, Drafts extends boolean> = F extends {
|
|
12
|
+
kind: "list";
|
|
13
|
+
fields: infer L extends readonly ScalarField[];
|
|
14
|
+
} ? LocalReadFields<L, Drafts>[] : F extends {
|
|
15
|
+
kind: "reference";
|
|
16
|
+
multiple: true;
|
|
17
|
+
required?: false;
|
|
18
|
+
} ? (string | null)[] : DeliveredValue<F>;
|
|
19
|
+
/** Delivered shape: unset optional Fields (and deleted reference targets) read as null;
|
|
20
|
+
* in an optional `multiple` reference a deleted target is null at its position.
|
|
21
|
+
* With drafts, required Fields may still be missing. */
|
|
22
|
+
type LocalReadFields<F extends readonly Field[], Drafts extends boolean> = {
|
|
23
|
+
[P in F[number] as P extends {
|
|
24
|
+
required: true;
|
|
25
|
+
} ? true extends Drafts ? never : P["name"] : never]: LocalReadValue<P, Drafts>;
|
|
26
|
+
} & {
|
|
27
|
+
[P in F[number] as P extends {
|
|
28
|
+
required: true;
|
|
29
|
+
} ? true extends Drafts ? P["name"] : never : never]?: LocalReadValue<P, Drafts>;
|
|
30
|
+
} & {
|
|
31
|
+
[P in F[number] as P extends {
|
|
32
|
+
required: true;
|
|
33
|
+
} ? never : P["name"]]: LocalReadValue<P, Drafts> | null;
|
|
34
|
+
};
|
|
35
|
+
export type LocalCollection<S extends SchemaDefinition, N extends S["collections"][number]["name"], Drafts extends boolean = false> = LocalReadFields<Extract<S["collections"][number], {
|
|
36
|
+
name: N;
|
|
37
|
+
}>["fields"], Drafts>;
|
|
38
|
+
export type LocalSingleton<S extends SchemaDefinition, N extends NonNullable<S["singletons"]>[number]["name"], Drafts extends boolean = false> = LocalReadFields<Extract<NonNullable<S["singletons"]>[number], {
|
|
39
|
+
name: N;
|
|
40
|
+
}>["fields"], Drafts>;
|
|
41
|
+
/** Explicit Node-only development reader. No remote fallback or database creation.
|
|
42
|
+
* Delivers the hosted SDK's value shapes, with media URLs from the same convention. */
|
|
43
|
+
export declare function createLocalPlume<const S extends SchemaDefinition, const Drafts extends boolean = false>(options: {
|
|
44
|
+
schema: S;
|
|
45
|
+
cwd?: string;
|
|
46
|
+
includeDrafts?: Drafts;
|
|
47
|
+
mediaUrl?: (input: {
|
|
48
|
+
collection: string;
|
|
49
|
+
recordId: string;
|
|
50
|
+
path: MediaPath;
|
|
51
|
+
}) => string;
|
|
52
|
+
}): {
|
|
53
|
+
collection<N extends S["collections"][number]["name"]>(name: N): {
|
|
54
|
+
list(input?: {
|
|
55
|
+
offset?: number;
|
|
56
|
+
limit?: number;
|
|
57
|
+
}): Promise<LocalContentPage<LocalCollection<S, N, Drafts>>>;
|
|
58
|
+
get(id: string): Promise<LocalContentItem<LocalCollection<S, N, Drafts>> | null>;
|
|
59
|
+
};
|
|
60
|
+
singleton<N extends NonNullable<S["singletons"]>[number]["name"]>(name: N): {
|
|
61
|
+
get(): Promise<LocalContentItem<LocalSingleton<S, N, Drafts>> | null>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export {};
|