-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.yaml
More file actions
132 lines (121 loc) · 4.85 KB
/
extension.yaml
File metadata and controls
132 lines (121 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Learn detailed information about the fields of an extension.yaml file in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml
name: historian
version: 0.3.0 # Follow semver versioning
specVersion: v1beta # Version of the Firebase Extensions specification
# Friendly display name for your extension (~3-5 words)
displayName: Historian
# Brief description of the task your extension performs (~1 sentence)
description: >-
Store your Firestore document history in a subcollection.
license: Apache-2.0 # https://spdx.org/licenses/
icon: historian.png
tags: [utilities]
# Public URL for the source code of your extension.
sourceUrl: https://github.com/nushio/historian
author:
authorName: Juan Rodriguez
email: github@k3rnel.net
url: https://github.com/nushio
contributors:
- authorName: Bryan Jenson
url: https://github.com/bjjenson
- authorName: charlie-topete
url: https://github.com/charlie-topete
# Specify whether a paid-tier billing plan is required to use your extension.
# Learn more in the docs: https://firebase.google.com/docs/extensions/reference/extension-yaml#billing-required-field
billingRequired: true
# In an `apis` field, list any Google APIs (like Cloud Translation, BigQuery, etc.)
# required for your extension to operate.
# Learn more in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml#apis-field
# In a `roles` field, list any IAM access roles required for your extension to operate.
# Learn more in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml#roles-field
roles:
- role: datastore.user
reason: Allows the extension to write to Firestore.
# In the `resources` field, list each of your extension's functions, including the trigger for each function.
# Learn more in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml#resources-field
resources:
- name: processEvent
type: firebaseextensions.v1beta.function
properties:
eventTrigger:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${PROJECT_ID}/databases/(default)/documents/${param:YOUR_COLLECTION}/{id}
runtime: "nodejs22"
# In the `params` field, set up your extension's user-configured parameters.
# Learn more in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml#params-field
params:
- param: YOUR_COLLECTION
label: Monitored Collection Name
description: Where do you want to watch for changes?
type: string
default: path/to/{collectionId} # Specifying a default is optional.
required: true
- param: CHANGED_SUBCOLLECTION_NAME
label: SubCollection Name where changes will be stored
description: >-
Where the difference will be stored, in a subcollection.
type: string
default: historian
required: true
immutable: false
- param: DELETE_AFTER
label: Delete After, (Days), For Time-to-Live
description: >-
Adds deleteAfter to the document. Use with Firebase TTL so changes are deleted after a certain amount of time.
Set to 0 to disable.
type: string
validationRegex: ^\d+$
default: 30
required: true
immutable: false
- param: EXCLUDED_DOCUMENT_KEYS
label: Excluded fields, comma separated
description: >-
Document Fields that will be excluded. If these fields change, historian won't make a changelog document.
This is useful for documents where fields change often, but the data is otherwise unnecessary, like a "lastUpdated" field.
No spaces, just comma separated. E.g. "lastUpdated,lastModified,lastChanged"
type: string
default:
required: true
immutable: false
- param: HISTORIAN_UNDO_FIELD
label: Undo field name, to revert document changes
description: >-
This field allows you to specify a version on your document's historian sub-collection and automatically revert the change, by grabbing the "before" version.
This must be the only field in the document's update, in order to revert the change.
type: string
default: historianUndo
required: true
immutable: false
- param: HISTORIAN_REDO_FIELD
label: Re-do field name
description: >-
This field allows you to specify a version on your document's historian sub-collection and automatically re-apply the change, by grabbing the "after" version.
This must be the only field in the document's update, in order to re-apply the change.
type: string
default: historianRedo
required: true
immutable: false
- param: LOG_LEVEL
label: Log Level
description: >-
Controls the verbosity of logs.
type: select
options:
- label: Info
value: INFO
- label: Warn
value: WARN
- label: Error
value: ERROR
- label: Silent
value: SILENT
default: INFO
required: true
immutable: false