@blinkk/root-cms 1.0.1-alpha.0 → 1.0.1

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.
@@ -0,0 +1,76 @@
1
+ import { Request, Plugin } from '@blinkk/root';
2
+ import { App } from 'firebase-admin/app';
3
+
4
+ interface CMSUser {
5
+ email: string;
6
+ }
7
+ type CMSPluginOptions = {
8
+ /**
9
+ * The ID of the project. Data will be stored under the namespace
10
+ * `Projects/${id}` in firestore.
11
+ */
12
+ id?: string;
13
+ /**
14
+ * The name of the project. Used in the header of the CMS to help identify
15
+ * the project.
16
+ */
17
+ name?: string;
18
+ /**
19
+ * Firebase config object, which can be obtained in the Firebase Console by
20
+ * going to "Project Settings".
21
+ */
22
+ firebaseConfig: {
23
+ [key: string]: string;
24
+ apiKey: string;
25
+ authDomain: string;
26
+ projectId: string;
27
+ storageBucket: string;
28
+ };
29
+ /**
30
+ * GAPI credentials. Include if using Google Drive and Google Sheets features.
31
+ * See: https://developers.google.com/sheets/api/quickstart/js
32
+ */
33
+ gapi?: {
34
+ /** https://developers.google.com/sheets/api/quickstart/js#create_an_api_key */
35
+ apiKey: string;
36
+ /** https://developers.google.com/sheets/api/quickstart/js#authorize_credentials_for_a_web_application */
37
+ clientId: string;
38
+ };
39
+ /**
40
+ * Secret value(s) used for signing the user authentication cookie.
41
+ * @deprecated This is now handled directly by root's sessionMiddleware under
42
+ * `server.sessionCookieSecret` in root.config.ts.
43
+ */
44
+ cookieSecret?: string | string[];
45
+ /** Function called to check if a user should have access to the CMS. */
46
+ isUserAuthorized?: (req: Request, user: CMSUser) => boolean | Promise<boolean>;
47
+ /**
48
+ * Function to call to check if login is required for a particular request.
49
+ */
50
+ isLoginRequired?: (req: Request) => boolean;
51
+ /**
52
+ * URL to GCI service for transforming uploaded GCS images to a Google App
53
+ * Engine Images API serving URL.
54
+ *
55
+ * Setting this to `true` uses the default hosted service at
56
+ * https://gci.rootjs.dev.
57
+ *
58
+ * To set up GCI:
59
+ *
60
+ * - Create a GCS bucket with fine-grained permissions
61
+ * - Share owner access to the bucket with the service account returned in
62
+ * https://gci.rootjs.dev/_/service_account
63
+ *
64
+ * To disable GCI, leave this value empty or set to `false`, which which will
65
+ * serve images directly from GCS instead.
66
+ */
67
+ gci?: string | boolean;
68
+ };
69
+ type CMSPlugin = Plugin & {
70
+ name: 'root-cms';
71
+ getConfig: () => CMSPluginOptions;
72
+ getFirebaseApp: () => App;
73
+ };
74
+ declare function cmsPlugin(options: CMSPluginOptions): CMSPlugin;
75
+
76
+ export { type CMSPlugin, type CMSPluginOptions, type CMSUser, cmsPlugin };