forked from FirebaseExtended/experimental-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.yaml
101 lines (87 loc) · 3.29 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
92
93
94
95
96
97
98
99
100
101
name: firestore-sentiment-analysis
version: 0.0.2
specVersion: v1beta # Firebase Extensions specification version (do not edit)
displayName: Sentiment Analysis
description: Determines the sentiment magnitude and score for given text values in Firestore
license: Apache-2.0 # The license you want for the extension
sourceUrl: https://github.com/FirebaseExtended/experimental-extensions/tree/main/firestore-sentiment-analysis
#releaseNotesUrl: #TODO https://github.com/firebase/extensions/blob/master/firestore-translate-text/CHANGELOG.md
author:
authorName: Firebase
url: https://firebase.google.com
contributors:
- authorName: Paul Ruiz
email: [email protected]
url: https://github.com/paultr
billingRequired: true
apis:
- apiName: language.googleapis.com
reason: To use Google Natural Language Processing to apply sentiment analysis.
# https://cloud.google.com/datastore/docs/access/iam
roles:
- role: datastore.user
reason: Allows the extension to write to your Firestore Database instance.
resources:
- name: fssentiment
type: firebaseextensions.v1beta.function
description:
Listens for writes of new strings to your specified Cloud Firestore collection, determines sentiment,
then writes the sentiment magnitude and score back to the same document.
properties:
location: ${LOCATION}
runtime: nodejs12
eventTrigger:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${PROJECT_ID}/databases/(default)/documents/${COLLECTION_PATH}/{messageId}
params:
- param: LOCATION
label: Cloud Functions location
description: >-
Where do you want to deploy the functions created for this extension?
You usually want a location close to your database. For help selecting a
location, refer to the [location selection
guide](https://firebase.google.com/docs/functions/locations).
type: select
options:
- label: Iowa (us-central1)
value: us-central1
- label: South Carolina (us-east1)
value: us-east1
- label: Northern Virginia (us-east4)
value: us-east4
- label: Belgium (europe-west1)
value: europe-west1
- label: London (europe-west2)
value: europe-west2
- label: Frankfurt (europe-west3)
value: europe-west3
- label: Hong Kong (asia-east2)
value: asia-east2
- label: Tokyo (asia-northeast1)
value: asia-northeast1
default: us-central1
required: true
immutable: true
- param: COLLECTION_PATH
label: Collection path
description: >
What is the path to the collection that contains the strings that you want to analyze?
example: items
validationRegex: "^[^/]+(/[^/]+/[^/]+)*$"
validationErrorMessage: Must be a valid Cloud Firestore Collection
default: items
required: true
- param: INPUT_FIELD_NAME
label: Input field name
description: >
What is the name of the field that contains the string that you want to analyze?
example: to_analyze
default: to_analyze
required: true
- param: OUTPUT_FIELD_NAME
label: Sentiment output field name
description: >
What is the name of the field where you want to store your sentiment information?
example: sentiment
default: sentiment
required: true