-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.yaml
91 lines (80 loc) · 3.49 KB
/
extension.yaml
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
# Learn detailed information about the fields of an extension.yaml file in the docs:
# https://firebase.google.com/docs/extensions/reference/extension-yaml
# Identifier for your extension
name: firestore-document-changes-tracker
version: 0.0.1 # Follow semver versioning
specVersion: v1beta # Version of the Firebase Extensions specification
# Friendly display name for your extension (~3-5 words)
displayName: Firestore Document Changes Tracker
# Brief description of the task your extension performs (~1 sentence)
description: >-
Creates firestore logs for every change on a collection.
license: Apache-2.0 # https://spdx.org/licenses/
author:
authorName: Gaussiana
url: https://github.com/InGaussiana
# Public URL for the source code of your extension.
# TODO: Replace this with your GitHub repo.
sourceUrl: https://github.com/InGaussiana/ext-firestore-changes-tracker
# 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: trackDocumentChanges
type: firebaseextensions.v1beta.function
description: >-
Firestore-OnWrite-triggered function that keep track of the changes of documents
properties:
eventTrigger:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${PROJECT_ID}/databases/(default)/documents/${COLLECTION}/{documentId}
runtime: "nodejs16"
# 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: COLLECTION
label: Collection path to track changes
description: >-
Collection path to track changes
type: string
example: collection/{documentId}/subcollection
default: "{document=**}"
required: false
- param: LOGS_COLLECTION
label: Collection path to store changes
description: >-
Collection path where all the logs will be saved
type: string
example: collection/{documentId}/subcollection
default: logs
required: false
- param: IGNORE_FIELDS
label: Ignore fields
description: >-
Comma separated fields that won't trigger a new history version (nor will be saved on the version data). Nested fields are supported with parent.child syntax.
type: string
example: updated_at,created_at
default:
required: false
- param: AUTHOR_FIELD
label: Field name with modifier user information
description: >-
Field where the user that made the last change is store (if present it gets copied to log, else ignored)
type: string
example: updated_by
default: updated_by
required: false