@databutton/firebase-types 0.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.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ [![Deploy functions to firebase](https://github.com/databutton/databutton-firebase/actions/workflows/deploy-firebase-functions.yml/badge.svg)](https://github.com/databutton/databutton-firebase/actions/workflows/deploy-firebase-functions.yml)
2
+ [![Deploy functions to firebase](https://github.com/databutton/databutton-firebase/actions/workflows/deploy-firebase-functions.yml/badge.svg)](https://github.com/databutton/databutton-firebase/actions/workflows/deploy-firebase-functions.yml)
3
+
4
+ # Running functions in shell (locally)
5
+
6
+ *Note:* You need Google Credentials
7
+
8
+ ```bash
9
+ yarn shell
10
+ ```
11
+
12
+ ## Execute firebase scripts (for migration etch.)
13
+
14
+ Set up GOOGLE_APPLICATION_CREDENTIALS from the following guide: <https://firebase.google.com/docs/admin/setup#initialize-sdk> and add the environment variable to the file `<PROJECT_ROOT>/.env`
15
+
16
+ Modify the `src/run.ts`-file to do what you want.
17
+
18
+ Execute the script running this command
19
+
20
+ ```bash
21
+ yarn execute
22
+ ```
23
+
24
+ **Note:** This file is added to git with a non-destructive example script and then put into `.gitignore` so it doesn't change elsewhere than locally.
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./persisted";
@@ -0,0 +1,94 @@
1
+ import * as admin from "firebase-admin";
2
+ /**
3
+ * Types here should reflect data format stored in firestore and
4
+ * either be backwards-compatible or migrated when needed
5
+ */
6
+ export interface Profile {
7
+ displayName: string;
8
+ email: string;
9
+ userId?: string;
10
+ earlyAccess?: boolean;
11
+ earlyAccessChangedAt?: admin.firestore.Timestamp;
12
+ enabledFeatures?: string[];
13
+ admin?: boolean;
14
+ }
15
+ export interface App {
16
+ name: string;
17
+ slug: string;
18
+ createdBy: string;
19
+ createdAt: admin.firestore.Timestamp;
20
+ variant: "streamlit";
21
+ markedForDeletionAt: admin.firestore.Timestamp | null;
22
+ shortUrl: string;
23
+ }
24
+ export interface Job {
25
+ name: string;
26
+ slug: string;
27
+ createdBy: string;
28
+ createdAt: admin.firestore.Timestamp;
29
+ markedForDeletionAt: admin.firestore.Timestamp | null;
30
+ category: string | null;
31
+ }
32
+ export interface CodeBlock {
33
+ type: "app" | "job";
34
+ createdAtUtc: admin.firestore.Timestamp;
35
+ componentId: string;
36
+ }
37
+ export interface CodeBlockVersion {
38
+ code: string;
39
+ createdAtUtc: admin.firestore.Timestamp;
40
+ version: string;
41
+ description: string;
42
+ }
43
+ export interface Deployment {
44
+ createdAt: admin.firestore.Timestamp;
45
+ createdById: string;
46
+ createdByName: string;
47
+ codeBlockId: string;
48
+ codeBlockVersionId: string;
49
+ codeRef: string;
50
+ }
51
+ export interface Schedule {
52
+ createdAt: admin.firestore.Timestamp;
53
+ updatedAt: admin.firestore.Timestamp;
54
+ cronExpressionUtc: string;
55
+ cronExpression: string;
56
+ cronTimezone: string;
57
+ state: "ACTIVE" | "PAUSED";
58
+ id?: string;
59
+ }
60
+ export interface Dataframe {
61
+ createdAtMillis: number;
62
+ etag: string;
63
+ href: string;
64
+ lastUpdatedAtMillis: number;
65
+ md5: string;
66
+ numberOfProperties: number;
67
+ numberOfRows: number;
68
+ size: string;
69
+ sizeInMb: string;
70
+ markedForDeletionAt?: admin.firestore.Timestamp | null;
71
+ }
72
+ export interface Viewer {
73
+ userId: string | null;
74
+ recipient: string;
75
+ revoked: boolean;
76
+ createdByUserId: string;
77
+ createdAtUtc: admin.firestore.Timestamp;
78
+ }
79
+ export interface ShortUrlRef {
80
+ type: "ref";
81
+ createdAtUtc: admin.firestore.Timestamp;
82
+ createdByUserId: string;
83
+ active: boolean;
84
+ projectId: string;
85
+ componentRef: string;
86
+ }
87
+ export interface ShortUrlRedirect {
88
+ type: "redirect";
89
+ createdAtUtc: admin.firestore.Timestamp;
90
+ createdByUserId: string;
91
+ active: boolean;
92
+ to: string;
93
+ }
94
+ export declare type ShortUrl = ShortUrlRef | ShortUrlRedirect;
@@ -0,0 +1,37 @@
1
+ import * as admin from "firebase-admin";
2
+ export interface Project {
3
+ createdAt: admin.firestore.Timestamp;
4
+ isPublic: boolean;
5
+ markedForDeletionAt: admin.firestore.Timestamp | null;
6
+ members: string[];
7
+ name: string;
8
+ owner: string;
9
+ projectCardColor: string;
10
+ projectUrl: string;
11
+ about?: string;
12
+ githubUrl?: string;
13
+ isShowcase?: boolean;
14
+ last_deployed?: admin.firestore.Timestamp;
15
+ schema?: "2022-08-22" | null;
16
+ deployIsInProgress?: boolean;
17
+ deployFinishedAt?: admin.firestore.Timestamp;
18
+ deployCurrentDeployedId?: string;
19
+ deployLastDeploymentSuccess?: boolean;
20
+ }
21
+ export interface ProjectInvitation {
22
+ project: {
23
+ id: string;
24
+ name: string;
25
+ };
26
+ state: "pending" | "withdrawn" | "accepted" | "cancelled";
27
+ createdAt: admin.firestore.Timestamp;
28
+ acceptedAt: admin.firestore.Timestamp | null;
29
+ role: "member";
30
+ from: {
31
+ userId: string;
32
+ email: string;
33
+ };
34
+ to: {
35
+ email: string;
36
+ };
37
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@databutton/firebase-types",
3
+ "version": "0.0.1",
4
+ "main": "",
5
+ "types": "lib/types/published/index.d.ts",
6
+ "files": [
7
+ "lib/types/published/**/*.d.ts"
8
+ ],
9
+ "scripts": {
10
+ "lint": "eslint --ext .js,.ts .",
11
+ "prepublish": "tsc",
12
+ "build": "tsc",
13
+ "execute": "ts-node functions/run.ts",
14
+ "serve": "yarn build && firebase emulators:start --only functions",
15
+ "shell": "yarn build && firebase functions:shell",
16
+ "start": "yarn shell",
17
+ "firebase": "firebase",
18
+ "emulate:firestore": "firebase emulators:start --only firestore --project test",
19
+ "test:rules": "firebase emulators:exec --only firestore 'jest ./test/firestore-rules'",
20
+ "test": "jest ./test/firestore-rules",
21
+ "deploy:rules": "firebase deploy --only firestore:rules",
22
+ "deploy:functions": "firebase deploy --only functions --debug",
23
+ "export:config": "firebase functions:config:get > .runtimeconfig.json",
24
+ "logs": "firebase functions:log",
25
+ "jest": "jest"
26
+ },
27
+ "engines": {
28
+ "node": "16"
29
+ },
30
+ "dependencies": {
31
+ "@sendgrid/mail": "7.7.0",
32
+ "@sentry/node": "7.14.0",
33
+ "@sentry/tracing": "7.14.0",
34
+ "@slack/web-api": "6.7.2",
35
+ "analytics-node": "6.2.0",
36
+ "axios": "0.27.2",
37
+ "cors": "2.8.5",
38
+ "firebase-admin": "11.0.1",
39
+ "firebase-functions": "3.24.0",
40
+ "intercom-client": "3.1.5",
41
+ "lodash": "4.17.21",
42
+ "uuid": "8.3.2"
43
+ },
44
+ "devDependencies": {
45
+ "@firebase/rules-unit-testing": "2.0.4",
46
+ "@sentry/types": "7.14.0",
47
+ "@types/analytics-node": "3.1.9",
48
+ "@types/jest": "29.0.3",
49
+ "@types/lodash": "4.14.186",
50
+ "@types/node": "18.7.14",
51
+ "@types/uuid": "8.3.4",
52
+ "@typescript-eslint/eslint-plugin": "5.38.1",
53
+ "@typescript-eslint/parser": "5.38.1",
54
+ "dotenv": "16.0.3",
55
+ "eslint": "8.24.0",
56
+ "eslint-config-airbnb-base": "15.0.0",
57
+ "eslint-config-google": "0.14.0",
58
+ "eslint-config-prettier": "8.5.0",
59
+ "eslint-plugin-import": "2.26.0",
60
+ "eslint-plugin-jest": "27.0.4",
61
+ "firebase": "9.10.0",
62
+ "firebase-functions-test": "2.4.0",
63
+ "firebase-tools": "11.10.0",
64
+ "jest": "28.1.3",
65
+ "ts-jest": "28.0.8",
66
+ "ts-node": "10.9.1",
67
+ "typescript": "4.8.4"
68
+ }
69
+ }