@plasmicpkgs/plasmic-cms 0.0.284 → 0.0.286

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.ts CHANGED
@@ -1,8 +1,254 @@
1
- import registerComponent from "@plasmicapp/host/registerComponent";
2
- import registerGlobalContext from "@plasmicapp/host/registerGlobalContext";
3
- export declare function registerAll(loader?: {
4
- registerComponent: typeof registerComponent;
5
- registerGlobalContext: typeof registerGlobalContext;
6
- }): void;
7
- export * from "./api";
8
- export * from "./components";
1
+ import { ApiCmsRow as ApiCmsRow_2 } from './schema';
2
+ import { ApiCmsTable as ApiCmsTable_2 } from './schema';
3
+ import { CanvasComponentProps } from '@plasmicapp/host/registerComponent';
4
+ import { ComponentMeta } from '@plasmicapp/host/registerComponent';
5
+ import { GlobalContextMeta } from '@plasmicapp/host/registerGlobalContext';
6
+ import { default as React_2 } from 'react';
7
+ import registerComponent from '@plasmicapp/host/registerComponent';
8
+ import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
9
+
10
+ export declare class API {
11
+ private config;
12
+ constructor(config: DatabaseConfig);
13
+ get(endpoint: string, params?: any): Promise<any>;
14
+ fetchTables(): Promise<ApiCmsTable[]>;
15
+ private useDraftForTable;
16
+ query(table: string, params?: QueryParams): Promise<ApiCmsRow[]>;
17
+ count(table: string, params?: Pick<QueryParams, "where" | "useDraft">): Promise<number>;
18
+ }
19
+
20
+ declare interface ApiCmsRow {
21
+ identifier: string | null;
22
+ data: Record<string, any> | null;
23
+ }
24
+
25
+ declare interface ApiCmsTable {
26
+ identifier: string;
27
+ name: string;
28
+ schema: CmsTableSchema;
29
+ }
30
+
31
+ declare interface CmsBaseType {
32
+ identifier: string;
33
+ name: string;
34
+ helperText: string;
35
+ required: boolean;
36
+ hidden: boolean;
37
+ }
38
+
39
+ declare interface CmsBoolean extends CmsBaseType {
40
+ type: CmsMetaType.BOOLEAN;
41
+ defaultValue?: boolean;
42
+ }
43
+
44
+ export declare function CmsCount({ className, table, setControlContextData, ...rest }: CmsCountProps): React_2.JSX.Element | null;
45
+
46
+ export declare const cmsCountFieldMeta: ComponentMeta<CmsCountProps>;
47
+
48
+ declare interface CmsCountProps extends CanvasComponentProps<RowContextData> {
49
+ table: string;
50
+ className?: string;
51
+ }
52
+
53
+ export declare function CmsCredentialsProvider({ children, databaseId, databaseToken, host, locale, useDraft, }: CmsCredentialsProviderProps): React_2.JSX.Element;
54
+
55
+ export declare const cmsCredentialsProviderMeta: GlobalContextMeta<CmsCredentialsProviderProps>;
56
+
57
+ declare interface CmsCredentialsProviderProps extends DatabaseConfig {
58
+ children?: React_2.ReactNode;
59
+ }
60
+
61
+ declare interface CmsDateTime extends CmsBaseType {
62
+ type: CmsMetaType.DATE_TIME;
63
+ defaultValue?: string;
64
+ }
65
+
66
+ declare interface CmsEnum extends CmsBaseType {
67
+ type: CmsMetaType.ENUM;
68
+ defaultValue?: string;
69
+ options: string[];
70
+ }
71
+
72
+ declare type CmsFieldMeta = CmsText | CmsLongText | CmsNumber | CmsBoolean | CmsImage | CmsFile | CmsDateTime | CmsRef | CmsRichText | CmsEnum;
73
+
74
+ declare interface CmsFile extends CmsBaseType {
75
+ type: CmsMetaType.FILE;
76
+ defaultValue?: string;
77
+ }
78
+
79
+ declare interface CmsImage extends CmsBaseType {
80
+ type: CmsMetaType.IMAGE;
81
+ defaultValue?: string;
82
+ }
83
+
84
+ declare interface CmsLongText extends CmsBaseType, CmsTextLike {
85
+ type: CmsMetaType.LONG_TEXT;
86
+ }
87
+
88
+ declare const enum CmsMetaType {
89
+ TEXT = "text",
90
+ LONG_TEXT = "long-text",
91
+ NUMBER = "number",
92
+ IMAGE = "image",
93
+ FILE = "file",
94
+ DATE_TIME = "date-time",
95
+ BOOLEAN = "boolean",
96
+ COLOR = "color",
97
+ RICH_TEXT = "rich-text",
98
+ REF = "ref",
99
+ LIST = "list",
100
+ OBJECT = "object",
101
+ ENUM = "enum"
102
+ }
103
+
104
+ declare interface CmsNumber extends CmsBaseType {
105
+ type: CmsMetaType.NUMBER;
106
+ defaultValue?: number;
107
+ }
108
+
109
+ export declare function CmsQueryRepeater({ table, children, setControlContextData, mode, where, useDraft, orderBy, desc, limit, offset, emptyMessage, forceEmptyState, loadingMessage, forceLoadingState, noLayout, noAutoRepeat, className, filterField, filterValue, fields, }: CmsQueryRepeaterProps): React_2.JSX.Element;
110
+
111
+ export declare const cmsQueryRepeaterMeta: ComponentMeta<CmsQueryRepeaterProps>;
112
+
113
+ declare interface CmsQueryRepeaterProps extends QueryParams, CanvasComponentProps<TableContextData> {
114
+ children: React_2.ReactNode;
115
+ table: string;
116
+ emptyMessage?: React_2.ReactNode;
117
+ forceEmptyState?: boolean;
118
+ loadingMessage?: React_2.ReactNode;
119
+ forceLoadingState?: boolean;
120
+ noLayout?: boolean;
121
+ noAutoRepeat?: boolean;
122
+ className?: string;
123
+ filterField?: string;
124
+ filterValue?: string;
125
+ fields?: string[];
126
+ mode?: "rows" | "count";
127
+ }
128
+
129
+ declare interface CmsRef extends CmsBaseType {
130
+ type: CmsMetaType.REF;
131
+ defaultValue?: string;
132
+ }
133
+
134
+ declare interface CmsRichText extends CmsBaseType {
135
+ type: CmsMetaType.RICH_TEXT;
136
+ defaultValue?: string;
137
+ }
138
+
139
+ export declare function CmsRowField({ className, table, field, dateFormat, setControlContextData, usePlasmicTheme, themeResetClassName, ...rest }: CmsRowFieldProps): React_2.JSX.Element | null;
140
+
141
+ export declare const cmsRowFieldMeta: ComponentMeta<CmsRowFieldProps>;
142
+
143
+ declare interface CmsRowFieldProps extends CanvasComponentProps<RowContextData> {
144
+ table: string;
145
+ field: string;
146
+ className?: string;
147
+ dateFormat?: string;
148
+ usePlasmicTheme?: boolean;
149
+ themeResetClassName?: string;
150
+ }
151
+
152
+ export declare function CmsRowFieldValue({ table, field, valueProp, children, setControlContextData, ...rest }: CmsRowFieldValueProps): React_2.ReactElement | null;
153
+
154
+ export declare const cmsRowFieldValueMeta: ComponentMeta<CmsRowFieldValueProps>;
155
+
156
+ declare interface CmsRowFieldValueProps extends CanvasComponentProps<RowContextData> {
157
+ table: string;
158
+ field: string;
159
+ valueProp: string;
160
+ children: React_2.ReactNode;
161
+ }
162
+
163
+ export declare function CmsRowImage({ table, field, srcProp, children, setControlContextData, }: CmsRowImageProps): React_2.ReactElement | null;
164
+
165
+ export declare const cmsRowImageMeta: ComponentMeta<CmsRowImageProps>;
166
+
167
+ declare interface CmsRowImageProps extends CanvasComponentProps<RowContextData> {
168
+ table: string;
169
+ field: string;
170
+ srcProp: string;
171
+ children: React_2.ReactNode;
172
+ }
173
+
174
+ export declare function CmsRowLink({ table, field, hrefProp, children, setControlContextData, prefix, suffix, }: CmsRowLinkProps): React_2.ReactElement | null;
175
+
176
+ export declare const cmsRowLinkMeta: ComponentMeta<CmsRowLinkProps>;
177
+
178
+ declare interface CmsRowLinkProps extends CanvasComponentProps<RowContextData> {
179
+ table: string;
180
+ field: string;
181
+ hrefProp: string;
182
+ children: React_2.ReactNode;
183
+ prefix?: string;
184
+ suffix?: string;
185
+ }
186
+
187
+ declare interface CmsTableSchema {
188
+ fields: CmsFieldMeta[];
189
+ }
190
+
191
+ declare interface CmsText extends CmsBaseType, CmsTextLike {
192
+ type: CmsMetaType.TEXT;
193
+ }
194
+
195
+ declare interface CmsTextLike {
196
+ defaultValue?: string;
197
+ minChars?: number;
198
+ maxChars?: number;
199
+ }
200
+
201
+ export declare interface DatabaseConfig {
202
+ host: string;
203
+ databaseId: string;
204
+ databaseToken: string;
205
+ locale?: string;
206
+ useDraft?: boolean | string[];
207
+ }
208
+
209
+ export declare function fetchContent(cmsId: string, cmsPublicToken: string, tableId: string, params: QueryParams, useDraft: boolean, locale: string): Promise<ApiCmsRow_2[]>;
210
+
211
+ export declare function fetchCount(cmsId: string, cmsPublicToken: string, tableId: string, params: QueryParams, useDraft: boolean): Promise<number>;
212
+
213
+ export declare function fetchTables(cmsId: string, cmsPublicToken: string): Promise<ApiCmsTable_2[]>;
214
+
215
+ export declare class HttpError extends Error {
216
+ status: number;
217
+ constructor(status: number, message: string);
218
+ }
219
+
220
+ export declare function mkApi(config: DatabaseConfig | undefined): API;
221
+
222
+ export declare interface QueryParams {
223
+ useDraft?: boolean;
224
+ where?: any;
225
+ orderBy?: string;
226
+ desc?: boolean;
227
+ limit?: number;
228
+ offset?: number;
229
+ fields?: string[];
230
+ }
231
+
232
+ export declare function registerAll(loader?: {
233
+ registerComponent: typeof registerComponent;
234
+ registerGlobalContext: typeof registerGlobalContext;
235
+ }): void;
236
+
237
+ export declare function registerAllCustomFunctions(loader?: {
238
+ registerFunction: any;
239
+ }): void;
240
+
241
+ declare interface RowContextData extends TableContextData {
242
+ row?: ApiCmsRow;
243
+ fieldMeta?: CmsFieldMeta;
244
+ }
245
+
246
+ declare interface TableContextData extends TablesContextData {
247
+ table?: string;
248
+ }
249
+
250
+ declare type TablesContextData = {
251
+ tables?: ApiCmsTable[];
252
+ };
253
+
254
+ export { }