firebase-admin 9.100.0-alpha.0 → 10.0.2
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 +7 -3
- package/lib/app/core.d.ts +15 -22
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +17 -33
- package/lib/app/credential-factory.js +17 -33
- package/lib/app/credential-internal.d.ts +10 -9
- package/lib/app/credential-internal.js +15 -13
- package/lib/app/credential.d.ts +3 -9
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +6 -30
- package/lib/app/firebase-app.js +72 -216
- package/lib/app/firebase-namespace.d.ts +28 -34
- package/lib/app/firebase-namespace.js +119 -99
- package/lib/app/index.d.ts +6 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +24 -3
- package/lib/app/lifecycle.js +119 -25
- package/lib/app-check/app-check-api-client-internal.d.ts +32 -0
- package/lib/app-check/app-check-api-client-internal.js +197 -0
- package/lib/app-check/app-check-api.d.ts +95 -0
- package/lib/app-check/app-check-api.js +19 -0
- package/lib/app-check/app-check-namespace.d.ts +65 -0
- package/lib/app-check/app-check-namespace.js +18 -0
- package/lib/app-check/app-check.d.ts +49 -0
- package/lib/app-check/app-check.js +82 -0
- package/lib/app-check/index.d.ts +53 -0
- package/lib/app-check/index.js +63 -0
- package/lib/app-check/token-generator.d.ts +25 -0
- package/lib/app-check/token-generator.js +159 -0
- package/lib/app-check/token-verifier.d.ts +17 -0
- package/lib/app-check/token-verifier.js +151 -0
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +2 -2
- package/lib/auth/auth-api-request.d.ts +28 -32
- package/lib/auth/auth-api-request.js +167 -125
- package/lib/auth/auth-config.d.ts +123 -21
- package/lib/auth/auth-config.js +85 -34
- package/lib/auth/auth-namespace.d.ts +157 -4
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +5 -3
- package/lib/auth/auth.js +6 -4
- package/lib/auth/base-auth.d.ts +134 -116
- package/lib/auth/base-auth.js +213 -143
- package/lib/auth/identifier.d.ts +5 -5
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +10 -5
- package/lib/auth/index.js +9 -4
- package/lib/auth/tenant-manager.d.ts +19 -19
- package/lib/auth/tenant-manager.js +21 -25
- package/lib/auth/tenant.d.ts +14 -5
- package/lib/auth/tenant.js +19 -11
- package/lib/auth/token-generator.d.ts +7 -108
- package/lib/auth/token-generator.js +52 -145
- package/lib/auth/token-verifier.d.ts +3 -4
- package/lib/auth/token-verifier.js +96 -145
- package/lib/auth/user-import-builder.d.ts +11 -11
- package/lib/auth/user-import-builder.js +9 -9
- package/lib/auth/user-record.d.ts +23 -15
- package/lib/auth/user-record.js +30 -20
- package/lib/credential/index.d.ts +18 -35
- package/lib/credential/index.js +17 -33
- package/lib/database/database-namespace.d.ts +39 -10
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +16 -6
- package/lib/database/database.js +61 -6
- package/lib/database/index.d.ts +19 -18
- package/lib/database/index.js +21 -23
- package/lib/default-namespace.d.ts +7 -1
- package/lib/default-namespace.js +4 -4
- package/lib/esm/app/index.js +10 -0
- package/lib/esm/app-check/index.js +4 -0
- package/lib/esm/auth/index.js +14 -0
- package/lib/esm/database/index.js +6 -0
- package/lib/esm/firestore/index.js +24 -0
- package/lib/esm/installations/index.js +4 -0
- package/lib/esm/instance-id/index.js +4 -0
- package/lib/esm/machine-learning/index.js +5 -0
- package/lib/esm/messaging/index.js +4 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/project-management/index.js +8 -0
- package/lib/esm/remote-config/index.js +4 -0
- package/lib/esm/security-rules/index.js +6 -0
- package/lib/esm/storage/index.js +4 -0
- package/lib/firebase-namespace-api.d.ts +12 -6
- package/lib/firebase-namespace-api.js +5 -1
- package/lib/firestore/firestore-internal.d.ts +2 -2
- package/lib/firestore/firestore-internal.js +2 -2
- package/lib/firestore/firestore-namespace.d.ts +6 -1
- package/lib/firestore/firestore-namespace.js +2 -1
- package/lib/firestore/index.d.ts +36 -4
- package/lib/firestore/index.js +29 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +52 -0
- package/lib/installations/index.js +62 -0
- package/lib/installations/installations-namespace.d.ts +55 -0
- package/lib/installations/installations-namespace.js +18 -0
- package/lib/{instance-id/instance-id-request-internal.d.ts → installations/installations-request-handler.d.ts} +8 -8
- package/lib/{instance-id/instance-id-request-internal.js → installations/installations-request-handler.js} +23 -23
- package/lib/installations/installations.d.ts +38 -0
- package/lib/installations/installations.js +63 -0
- package/lib/instance-id/index.d.ts +20 -9
- package/lib/instance-id/index.js +20 -9
- package/lib/instance-id/instance-id-namespace.d.ts +9 -8
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +8 -6
- package/lib/instance-id/instance-id.js +20 -11
- package/lib/machine-learning/index.d.ts +29 -27
- package/lib/machine-learning/index.js +29 -27
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +4 -4
- package/lib/machine-learning/machine-learning-namespace.d.ts +33 -8
- package/lib/machine-learning/machine-learning-namespace.js +1 -1
- package/lib/machine-learning/machine-learning-utils.d.ts +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.d.ts +19 -19
- package/lib/machine-learning/machine-learning.js +20 -20
- package/lib/messaging/batch-request-internal.d.ts +3 -3
- package/lib/messaging/batch-request-internal.js +9 -9
- package/lib/messaging/index.d.ts +11 -9
- package/lib/messaging/index.js +11 -9
- package/lib/messaging/messaging-api-request-internal.d.ts +8 -8
- package/lib/messaging/messaging-api-request-internal.js +8 -8
- package/lib/messaging/messaging-api.d.ts +79 -75
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +5 -5
- package/lib/messaging/messaging-errors-internal.js +7 -7
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +6 -31
- package/lib/messaging/messaging-namespace.d.ts +105 -8
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +70 -86
- package/lib/messaging/messaging.js +76 -89
- package/lib/project-management/android-app.d.ts +11 -12
- package/lib/project-management/android-app.js +13 -14
- package/lib/project-management/app-metadata.d.ts +1 -1
- package/lib/project-management/app-metadata.js +1 -1
- package/lib/project-management/index.d.ts +11 -9
- package/lib/project-management/index.js +11 -9
- package/lib/project-management/ios-app.d.ts +6 -7
- package/lib/project-management/ios-app.js +6 -7
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -80
- package/lib/project-management/project-management-api-request-internal.js +14 -14
- package/lib/project-management/project-management-namespace.d.ts +31 -9
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +18 -21
- package/lib/project-management/project-management.js +19 -22
- package/lib/remote-config/index.d.ts +12 -10
- package/lib/remote-config/index.js +11 -9
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +2 -2
- package/lib/remote-config/remote-config-api.d.ts +12 -2
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +50 -9
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +19 -21
- package/lib/remote-config/remote-config.js +25 -25
- package/lib/security-rules/index.d.ts +12 -10
- package/lib/security-rules/index.js +12 -10
- package/lib/security-rules/security-rules-api-client-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.d.ts +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules-namespace.d.ts +43 -28
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +39 -42
- package/lib/security-rules/security-rules.js +38 -39
- package/lib/storage/index.d.ts +9 -7
- package/lib/storage/index.js +9 -7
- package/lib/storage/storage-namespace.d.ts +7 -6
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +3 -3
- package/lib/storage/storage.js +14 -4
- package/lib/utils/api-request.d.ts +24 -24
- package/lib/utils/api-request.js +25 -25
- package/lib/utils/crypto-signer.d.ts +128 -0
- package/lib/utils/crypto-signer.js +237 -0
- package/lib/utils/deep-copy.d.ts +6 -6
- package/lib/utils/deep-copy.js +6 -6
- package/lib/utils/error.d.ts +69 -36
- package/lib/utils/error.js +98 -43
- package/lib/utils/index.d.ts +30 -19
- package/lib/utils/index.js +47 -20
- package/lib/utils/jwt.d.ts +131 -0
- package/lib/utils/jwt.js +355 -0
- package/lib/utils/validator.d.ts +37 -37
- package/lib/utils/validator.js +37 -37
- package/package.json +126 -53
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Google Inc.
|
|
4
4
|
*
|
|
@@ -17,38 +17,53 @@
|
|
|
17
17
|
import { App } from '../app';
|
|
18
18
|
import { RulesFile as TRulesFile, Ruleset as TRuleset, RulesetMetadata as TRulesetMetadata, RulesetMetadataList as TRulesetMetadataList, SecurityRules as TSecurityRules } from './security-rules';
|
|
19
19
|
/**
|
|
20
|
-
* Gets the {@link
|
|
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
|
-
|
|
20
|
+
* Gets the {@link firebase-admin.security-rules#SecurityRules} service for the default
|
|
21
|
+
* app or a given app.
|
|
22
|
+
*
|
|
23
|
+
* `admin.securityRules()` can be called with no arguments to access the
|
|
24
|
+
* default app's {@link firebase-admin.security-rules#SecurityRules}
|
|
25
|
+
* service, or as `admin.securityRules(app)` to access
|
|
26
|
+
* the {@link firebase-admin.security-rules#SecurityRules}
|
|
27
|
+
* service associated with a specific app.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```javascript
|
|
31
|
+
* // Get the SecurityRules service for the default app
|
|
32
|
+
* var defaultSecurityRules = admin.securityRules();
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```javascript
|
|
37
|
+
* // Get the SecurityRules service for a given app
|
|
38
|
+
* var otherSecurityRules = admin.securityRules(otherApp);
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param app - Optional app to return the `SecurityRules` service
|
|
42
|
+
* for. If not provided, the default `SecurityRules` service
|
|
43
|
+
* is returned.
|
|
44
|
+
* @returns The default `SecurityRules` service if no app is provided, or the
|
|
45
|
+
* `SecurityRules` service associated with the provided app.
|
|
46
|
+
*/
|
|
47
47
|
export declare function securityRules(app?: App): securityRules.SecurityRules;
|
|
48
48
|
export declare namespace securityRules {
|
|
49
|
+
/**
|
|
50
|
+
* Type alias to {@link firebase-admin.security-rules#RulesFile}.
|
|
51
|
+
*/
|
|
49
52
|
type RulesFile = TRulesFile;
|
|
53
|
+
/**
|
|
54
|
+
* Type alias to {@link firebase-admin.security-rules#Ruleset}.
|
|
55
|
+
*/
|
|
50
56
|
type Ruleset = TRuleset;
|
|
57
|
+
/**
|
|
58
|
+
* Type alias to {@link firebase-admin.security-rules#RulesetMetadata}.
|
|
59
|
+
*/
|
|
51
60
|
type RulesetMetadata = TRulesetMetadata;
|
|
61
|
+
/**
|
|
62
|
+
* Type alias to {@link firebase-admin.security-rules#RulesetMetadataList}.
|
|
63
|
+
*/
|
|
52
64
|
type RulesetMetadataList = TRulesetMetadataList;
|
|
65
|
+
/**
|
|
66
|
+
* Type alias to {@link firebase-admin.security-rules#SecurityRules}.
|
|
67
|
+
*/
|
|
53
68
|
type SecurityRules = TSecurityRules;
|
|
54
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2019 Google Inc.
|
|
4
4
|
*
|
|
@@ -19,8 +19,7 @@ import { App } from '../app';
|
|
|
19
19
|
/**
|
|
20
20
|
* A source file containing some Firebase security rules. The content includes raw
|
|
21
21
|
* source code including text formatting, indentation and comments. Use the
|
|
22
|
-
*
|
|
23
|
-
* method to create new instances of this type.
|
|
22
|
+
* {@link SecurityRules.createRulesFileFromSource} method to create new instances of this type.
|
|
24
23
|
*/
|
|
25
24
|
export interface RulesFile {
|
|
26
25
|
readonly name: string;
|
|
@@ -32,8 +31,7 @@ export interface RulesFile {
|
|
|
32
31
|
export interface RulesetMetadata {
|
|
33
32
|
/**
|
|
34
33
|
* Name of the `Ruleset` as a short string. This can be directly passed into APIs
|
|
35
|
-
* like {@link
|
|
36
|
-
* and {@link securityRules.SecurityRules.deleteRuleset `securityRules.deleteRuleset()`}.
|
|
34
|
+
* like {@link SecurityRules.getRuleset} and {@link SecurityRules.deleteRuleset}.
|
|
37
35
|
*/
|
|
38
36
|
readonly name: string;
|
|
39
37
|
/**
|
|
@@ -77,77 +75,77 @@ export declare class SecurityRules {
|
|
|
77
75
|
private static readonly FIREBASE_STORAGE;
|
|
78
76
|
private readonly client;
|
|
79
77
|
/**
|
|
80
|
-
* Gets the {@link
|
|
78
|
+
* Gets the {@link Ruleset} identified by the given
|
|
81
79
|
* name. The input name should be the short name string without the project ID
|
|
82
80
|
* prefix. For example, to retrieve the `projects/project-id/rulesets/my-ruleset`,
|
|
83
81
|
* pass the short name "my-ruleset". Rejects with a `not-found` error if the
|
|
84
82
|
* specified `Ruleset` cannot be found.
|
|
85
83
|
*
|
|
86
|
-
* @param name Name of the `Ruleset` to retrieve.
|
|
87
|
-
* @
|
|
84
|
+
* @param name - Name of the `Ruleset` to retrieve.
|
|
85
|
+
* @returns A promise that fulfills with the specified `Ruleset`.
|
|
88
86
|
*/
|
|
89
87
|
getRuleset(name: string): Promise<Ruleset>;
|
|
90
88
|
/**
|
|
91
|
-
* Gets the {@link
|
|
89
|
+
* Gets the {@link Ruleset} currently applied to
|
|
92
90
|
* Cloud Firestore. Rejects with a `not-found` error if no ruleset is applied
|
|
93
91
|
* on Firestore.
|
|
94
92
|
*
|
|
95
|
-
* @
|
|
93
|
+
* @returns A promise that fulfills with the Firestore ruleset.
|
|
96
94
|
*/
|
|
97
95
|
getFirestoreRuleset(): Promise<Ruleset>;
|
|
98
96
|
/**
|
|
99
|
-
* Creates a new {@link
|
|
97
|
+
* Creates a new {@link Ruleset} from the given
|
|
100
98
|
* source, and applies it to Cloud Firestore.
|
|
101
99
|
*
|
|
102
|
-
* @param source Rules source to apply.
|
|
103
|
-
* @
|
|
100
|
+
* @param source - Rules source to apply.
|
|
101
|
+
* @returns A promise that fulfills when the ruleset is created and released.
|
|
104
102
|
*/
|
|
105
103
|
releaseFirestoreRulesetFromSource(source: string | Buffer): Promise<Ruleset>;
|
|
106
104
|
/**
|
|
107
|
-
* Applies the specified {@link
|
|
105
|
+
* Applies the specified {@link Ruleset} ruleset
|
|
108
106
|
* to Cloud Firestore.
|
|
109
107
|
*
|
|
110
|
-
* @param ruleset Name of the ruleset to apply or a `RulesetMetadata` object
|
|
108
|
+
* @param ruleset - Name of the ruleset to apply or a `RulesetMetadata` object
|
|
111
109
|
* containing the name.
|
|
112
|
-
* @
|
|
110
|
+
* @returns A promise that fulfills when the ruleset is released.
|
|
113
111
|
*/
|
|
114
112
|
releaseFirestoreRuleset(ruleset: string | RulesetMetadata): Promise<void>;
|
|
115
113
|
/**
|
|
116
|
-
* Gets the {@link
|
|
114
|
+
* Gets the {@link Ruleset} currently applied to a
|
|
117
115
|
* Cloud Storage bucket. Rejects with a `not-found` error if no ruleset is applied
|
|
118
116
|
* on the bucket.
|
|
119
117
|
*
|
|
120
|
-
* @param bucket Optional name of the Cloud Storage bucket to be retrieved. If not
|
|
118
|
+
* @param bucket - Optional name of the Cloud Storage bucket to be retrieved. If not
|
|
121
119
|
* specified, retrieves the ruleset applied on the default bucket configured via
|
|
122
120
|
* `AppOptions`.
|
|
123
|
-
* @
|
|
121
|
+
* @returns A promise that fulfills with the Cloud Storage ruleset.
|
|
124
122
|
*/
|
|
125
123
|
getStorageRuleset(bucket?: string): Promise<Ruleset>;
|
|
126
124
|
/**
|
|
127
|
-
* Creates a new {@link
|
|
125
|
+
* Creates a new {@link Ruleset} from the given
|
|
128
126
|
* source, and applies it to a Cloud Storage bucket.
|
|
129
127
|
*
|
|
130
|
-
* @param source Rules source to apply.
|
|
131
|
-
* @param bucket Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
128
|
+
* @param source - Rules source to apply.
|
|
129
|
+
* @param bucket - Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
132
130
|
* not specified, applies the ruleset on the default bucket configured via
|
|
133
|
-
* {@link AppOptions
|
|
134
|
-
* @
|
|
131
|
+
* {@link firebase-admin.app#AppOptions}.
|
|
132
|
+
* @returns A promise that fulfills when the ruleset is created and released.
|
|
135
133
|
*/
|
|
136
134
|
releaseStorageRulesetFromSource(source: string | Buffer, bucket?: string): Promise<Ruleset>;
|
|
137
135
|
/**
|
|
138
|
-
* Applies the specified {@link
|
|
136
|
+
* Applies the specified {@link Ruleset} ruleset
|
|
139
137
|
* to a Cloud Storage bucket.
|
|
140
138
|
*
|
|
141
|
-
* @param ruleset Name of the ruleset to apply or a `RulesetMetadata` object
|
|
139
|
+
* @param ruleset - Name of the ruleset to apply or a `RulesetMetadata` object
|
|
142
140
|
* containing the name.
|
|
143
|
-
* @param bucket Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
141
|
+
* @param bucket - Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
144
142
|
* not specified, applies the ruleset on the default bucket configured via
|
|
145
|
-
* {@link AppOptions
|
|
146
|
-
* @
|
|
143
|
+
* {@link firebase-admin.app#AppOptions}.
|
|
144
|
+
* @returns A promise that fulfills when the ruleset is released.
|
|
147
145
|
*/
|
|
148
146
|
releaseStorageRuleset(ruleset: string | RulesetMetadata, bucket?: string): Promise<void>;
|
|
149
147
|
/**
|
|
150
|
-
* Creates a {@link
|
|
148
|
+
* Creates a {@link RulesFile} with the given name
|
|
151
149
|
* and source. Throws an error if any of the arguments are invalid. This is a local
|
|
152
150
|
* operation, and does not involve any network API calls.
|
|
153
151
|
*
|
|
@@ -158,39 +156,38 @@ export declare class SecurityRules {
|
|
|
158
156
|
* 'firestore.rules', source);
|
|
159
157
|
* ```
|
|
160
158
|
*
|
|
161
|
-
* @param name Name to assign to the rules file. This is usually a short file name that
|
|
159
|
+
* @param name - Name to assign to the rules file. This is usually a short file name that
|
|
162
160
|
* helps identify the file in a ruleset.
|
|
163
|
-
* @param source Contents of the rules file.
|
|
164
|
-
* @
|
|
161
|
+
* @param source - Contents of the rules file.
|
|
162
|
+
* @returns A new rules file instance.
|
|
165
163
|
*/
|
|
166
164
|
createRulesFileFromSource(name: string, source: string | Buffer): RulesFile;
|
|
167
165
|
/**
|
|
168
|
-
* Creates a new {@link
|
|
169
|
-
* {@link securityRules.RulesFile `RuleFile`}.
|
|
166
|
+
* Creates a new {@link Ruleset} from the given {@link RulesFile}.
|
|
170
167
|
*
|
|
171
|
-
* @param file Rules file to include in the new `Ruleset`.
|
|
168
|
+
* @param file - Rules file to include in the new `Ruleset`.
|
|
172
169
|
* @returns A promise that fulfills with the newly created `Ruleset`.
|
|
173
170
|
*/
|
|
174
171
|
createRuleset(file: RulesFile): Promise<Ruleset>;
|
|
175
172
|
/**
|
|
176
|
-
* Deletes the {@link
|
|
173
|
+
* Deletes the {@link Ruleset} identified by the given
|
|
177
174
|
* name. The input name should be the short name string without the project ID
|
|
178
175
|
* prefix. For example, to delete the `projects/project-id/rulesets/my-ruleset`,
|
|
179
176
|
* pass the short name "my-ruleset". Rejects with a `not-found` error if the
|
|
180
177
|
* specified `Ruleset` cannot be found.
|
|
181
178
|
*
|
|
182
|
-
* @param name Name of the `Ruleset` to delete.
|
|
183
|
-
* @
|
|
179
|
+
* @param name - Name of the `Ruleset` to delete.
|
|
180
|
+
* @returns A promise that fulfills when the `Ruleset` is deleted.
|
|
184
181
|
*/
|
|
185
182
|
deleteRuleset(name: string): Promise<void>;
|
|
186
183
|
/**
|
|
187
184
|
* Retrieves a page of ruleset metadata.
|
|
188
185
|
*
|
|
189
|
-
* @param pageSize The page size, 100 if undefined. This is also the maximum allowed
|
|
186
|
+
* @param pageSize - The page size, 100 if undefined. This is also the maximum allowed
|
|
190
187
|
* limit.
|
|
191
|
-
* @param nextPageToken The next page token. If not specified, returns rulesets
|
|
188
|
+
* @param nextPageToken - The next page token. If not specified, returns rulesets
|
|
192
189
|
* starting without any offset.
|
|
193
|
-
* @
|
|
190
|
+
* @returns A promise that fulfills with a page of rulesets.
|
|
194
191
|
*/
|
|
195
192
|
listRulesetMetadata(pageSize?: number, nextPageToken?: string): Promise<RulesetMetadataList>;
|
|
196
193
|
private getRulesetForRelease;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2019 Google Inc.
|
|
@@ -70,7 +70,7 @@ exports.Ruleset = Ruleset;
|
|
|
70
70
|
*/
|
|
71
71
|
var SecurityRules = /** @class */ (function () {
|
|
72
72
|
/**
|
|
73
|
-
* @param app The app for this SecurityRules service.
|
|
73
|
+
* @param app - The app for this SecurityRules service.
|
|
74
74
|
* @constructor
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
@@ -79,14 +79,14 @@ var SecurityRules = /** @class */ (function () {
|
|
|
79
79
|
this.client = new security_rules_api_client_internal_1.SecurityRulesApiClient(app);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Gets the {@link
|
|
82
|
+
* Gets the {@link Ruleset} identified by the given
|
|
83
83
|
* name. The input name should be the short name string without the project ID
|
|
84
84
|
* prefix. For example, to retrieve the `projects/project-id/rulesets/my-ruleset`,
|
|
85
85
|
* pass the short name "my-ruleset". Rejects with a `not-found` error if the
|
|
86
86
|
* specified `Ruleset` cannot be found.
|
|
87
87
|
*
|
|
88
|
-
* @param name Name of the `Ruleset` to retrieve.
|
|
89
|
-
* @
|
|
88
|
+
* @param name - Name of the `Ruleset` to retrieve.
|
|
89
|
+
* @returns A promise that fulfills with the specified `Ruleset`.
|
|
90
90
|
*/
|
|
91
91
|
SecurityRules.prototype.getRuleset = function (name) {
|
|
92
92
|
return this.client.getRuleset(name)
|
|
@@ -95,21 +95,21 @@ var SecurityRules = /** @class */ (function () {
|
|
|
95
95
|
});
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
|
-
* Gets the {@link
|
|
98
|
+
* Gets the {@link Ruleset} currently applied to
|
|
99
99
|
* Cloud Firestore. Rejects with a `not-found` error if no ruleset is applied
|
|
100
100
|
* on Firestore.
|
|
101
101
|
*
|
|
102
|
-
* @
|
|
102
|
+
* @returns A promise that fulfills with the Firestore ruleset.
|
|
103
103
|
*/
|
|
104
104
|
SecurityRules.prototype.getFirestoreRuleset = function () {
|
|
105
105
|
return this.getRulesetForRelease(SecurityRules.CLOUD_FIRESTORE);
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
|
-
* Creates a new {@link
|
|
108
|
+
* Creates a new {@link Ruleset} from the given
|
|
109
109
|
* source, and applies it to Cloud Firestore.
|
|
110
110
|
*
|
|
111
|
-
* @param source Rules source to apply.
|
|
112
|
-
* @
|
|
111
|
+
* @param source - Rules source to apply.
|
|
112
|
+
* @returns A promise that fulfills when the ruleset is created and released.
|
|
113
113
|
*/
|
|
114
114
|
SecurityRules.prototype.releaseFirestoreRulesetFromSource = function (source) {
|
|
115
115
|
var _this = this;
|
|
@@ -126,25 +126,25 @@ var SecurityRules = /** @class */ (function () {
|
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
/**
|
|
129
|
-
* Applies the specified {@link
|
|
129
|
+
* Applies the specified {@link Ruleset} ruleset
|
|
130
130
|
* to Cloud Firestore.
|
|
131
131
|
*
|
|
132
|
-
* @param ruleset Name of the ruleset to apply or a `RulesetMetadata` object
|
|
132
|
+
* @param ruleset - Name of the ruleset to apply or a `RulesetMetadata` object
|
|
133
133
|
* containing the name.
|
|
134
|
-
* @
|
|
134
|
+
* @returns A promise that fulfills when the ruleset is released.
|
|
135
135
|
*/
|
|
136
136
|
SecurityRules.prototype.releaseFirestoreRuleset = function (ruleset) {
|
|
137
137
|
return this.releaseRuleset(ruleset, SecurityRules.CLOUD_FIRESTORE);
|
|
138
138
|
};
|
|
139
139
|
/**
|
|
140
|
-
* Gets the {@link
|
|
140
|
+
* Gets the {@link Ruleset} currently applied to a
|
|
141
141
|
* Cloud Storage bucket. Rejects with a `not-found` error if no ruleset is applied
|
|
142
142
|
* on the bucket.
|
|
143
143
|
*
|
|
144
|
-
* @param bucket Optional name of the Cloud Storage bucket to be retrieved. If not
|
|
144
|
+
* @param bucket - Optional name of the Cloud Storage bucket to be retrieved. If not
|
|
145
145
|
* specified, retrieves the ruleset applied on the default bucket configured via
|
|
146
146
|
* `AppOptions`.
|
|
147
|
-
* @
|
|
147
|
+
* @returns A promise that fulfills with the Cloud Storage ruleset.
|
|
148
148
|
*/
|
|
149
149
|
SecurityRules.prototype.getStorageRuleset = function (bucket) {
|
|
150
150
|
var _this = this;
|
|
@@ -157,14 +157,14 @@ var SecurityRules = /** @class */ (function () {
|
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
159
|
/**
|
|
160
|
-
* Creates a new {@link
|
|
160
|
+
* Creates a new {@link Ruleset} from the given
|
|
161
161
|
* source, and applies it to a Cloud Storage bucket.
|
|
162
162
|
*
|
|
163
|
-
* @param source Rules source to apply.
|
|
164
|
-
* @param bucket Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
163
|
+
* @param source - Rules source to apply.
|
|
164
|
+
* @param bucket - Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
165
165
|
* not specified, applies the ruleset on the default bucket configured via
|
|
166
|
-
* {@link AppOptions
|
|
167
|
-
* @
|
|
166
|
+
* {@link firebase-admin.app#AppOptions}.
|
|
167
|
+
* @returns A promise that fulfills when the ruleset is created and released.
|
|
168
168
|
*/
|
|
169
169
|
SecurityRules.prototype.releaseStorageRulesetFromSource = function (source, bucket) {
|
|
170
170
|
var _this = this;
|
|
@@ -184,15 +184,15 @@ var SecurityRules = /** @class */ (function () {
|
|
|
184
184
|
});
|
|
185
185
|
};
|
|
186
186
|
/**
|
|
187
|
-
* Applies the specified {@link
|
|
187
|
+
* Applies the specified {@link Ruleset} ruleset
|
|
188
188
|
* to a Cloud Storage bucket.
|
|
189
189
|
*
|
|
190
|
-
* @param ruleset Name of the ruleset to apply or a `RulesetMetadata` object
|
|
190
|
+
* @param ruleset - Name of the ruleset to apply or a `RulesetMetadata` object
|
|
191
191
|
* containing the name.
|
|
192
|
-
* @param bucket Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
192
|
+
* @param bucket - Optional name of the Cloud Storage bucket to apply the rules on. If
|
|
193
193
|
* not specified, applies the ruleset on the default bucket configured via
|
|
194
|
-
* {@link AppOptions
|
|
195
|
-
* @
|
|
194
|
+
* {@link firebase-admin.app#AppOptions}.
|
|
195
|
+
* @returns A promise that fulfills when the ruleset is released.
|
|
196
196
|
*/
|
|
197
197
|
SecurityRules.prototype.releaseStorageRuleset = function (ruleset, bucket) {
|
|
198
198
|
var _this = this;
|
|
@@ -205,7 +205,7 @@ var SecurityRules = /** @class */ (function () {
|
|
|
205
205
|
});
|
|
206
206
|
};
|
|
207
207
|
/**
|
|
208
|
-
* Creates a {@link
|
|
208
|
+
* Creates a {@link RulesFile} with the given name
|
|
209
209
|
* and source. Throws an error if any of the arguments are invalid. This is a local
|
|
210
210
|
* operation, and does not involve any network API calls.
|
|
211
211
|
*
|
|
@@ -216,10 +216,10 @@ var SecurityRules = /** @class */ (function () {
|
|
|
216
216
|
* 'firestore.rules', source);
|
|
217
217
|
* ```
|
|
218
218
|
*
|
|
219
|
-
* @param name Name to assign to the rules file. This is usually a short file name that
|
|
219
|
+
* @param name - Name to assign to the rules file. This is usually a short file name that
|
|
220
220
|
* helps identify the file in a ruleset.
|
|
221
|
-
* @param source Contents of the rules file.
|
|
222
|
-
* @
|
|
221
|
+
* @param source - Contents of the rules file.
|
|
222
|
+
* @returns A new rules file instance.
|
|
223
223
|
*/
|
|
224
224
|
SecurityRules.prototype.createRulesFileFromSource = function (name, source) {
|
|
225
225
|
if (!validator.isNonEmptyString(name)) {
|
|
@@ -241,10 +241,9 @@ var SecurityRules = /** @class */ (function () {
|
|
|
241
241
|
};
|
|
242
242
|
};
|
|
243
243
|
/**
|
|
244
|
-
* Creates a new {@link
|
|
245
|
-
* {@link securityRules.RulesFile `RuleFile`}.
|
|
244
|
+
* Creates a new {@link Ruleset} from the given {@link RulesFile}.
|
|
246
245
|
*
|
|
247
|
-
* @param file Rules file to include in the new `Ruleset`.
|
|
246
|
+
* @param file - Rules file to include in the new `Ruleset`.
|
|
248
247
|
* @returns A promise that fulfills with the newly created `Ruleset`.
|
|
249
248
|
*/
|
|
250
249
|
SecurityRules.prototype.createRuleset = function (file) {
|
|
@@ -259,14 +258,14 @@ var SecurityRules = /** @class */ (function () {
|
|
|
259
258
|
});
|
|
260
259
|
};
|
|
261
260
|
/**
|
|
262
|
-
* Deletes the {@link
|
|
261
|
+
* Deletes the {@link Ruleset} identified by the given
|
|
263
262
|
* name. The input name should be the short name string without the project ID
|
|
264
263
|
* prefix. For example, to delete the `projects/project-id/rulesets/my-ruleset`,
|
|
265
264
|
* pass the short name "my-ruleset". Rejects with a `not-found` error if the
|
|
266
265
|
* specified `Ruleset` cannot be found.
|
|
267
266
|
*
|
|
268
|
-
* @param name Name of the `Ruleset` to delete.
|
|
269
|
-
* @
|
|
267
|
+
* @param name - Name of the `Ruleset` to delete.
|
|
268
|
+
* @returns A promise that fulfills when the `Ruleset` is deleted.
|
|
270
269
|
*/
|
|
271
270
|
SecurityRules.prototype.deleteRuleset = function (name) {
|
|
272
271
|
return this.client.deleteRuleset(name);
|
|
@@ -274,11 +273,11 @@ var SecurityRules = /** @class */ (function () {
|
|
|
274
273
|
/**
|
|
275
274
|
* Retrieves a page of ruleset metadata.
|
|
276
275
|
*
|
|
277
|
-
* @param pageSize The page size, 100 if undefined. This is also the maximum allowed
|
|
276
|
+
* @param pageSize - The page size, 100 if undefined. This is also the maximum allowed
|
|
278
277
|
* limit.
|
|
279
|
-
* @param nextPageToken The next page token. If not specified, returns rulesets
|
|
278
|
+
* @param nextPageToken - The next page token. If not specified, returns rulesets
|
|
280
279
|
* starting without any offset.
|
|
281
|
-
* @
|
|
280
|
+
* @returns A promise that fulfills with a page of rulesets.
|
|
282
281
|
*/
|
|
283
282
|
SecurityRules.prototype.listRulesetMetadata = function (pageSize, nextPageToken) {
|
|
284
283
|
if (pageSize === void 0) { pageSize = 100; }
|
package/lib/storage/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2020 Google Inc.
|
|
4
4
|
*
|
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
/**
|
|
18
|
+
* Cloud Storage for Firebase.
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
17
22
|
import { App } from '../app';
|
|
18
23
|
import { Storage } from './storage';
|
|
19
24
|
export { Storage } from './storage';
|
|
20
25
|
/**
|
|
21
|
-
* Gets the {@link
|
|
22
|
-
* default app or a given app.
|
|
26
|
+
* Gets the {@link Storage} service for the default app or a given app.
|
|
23
27
|
*
|
|
24
28
|
* `getStorage()` can be called with no arguments to access the default
|
|
25
|
-
* app's
|
|
26
|
-
* `
|
|
27
|
-
* {@link storage.Storage `Storage`} service associated with a
|
|
28
|
-
* specific app.
|
|
29
|
+
* app's `Storage` service or as `getStorage(app)` to access the
|
|
30
|
+
* `Storage` service associated with a specific app.
|
|
29
31
|
*
|
|
30
32
|
* @example
|
|
31
33
|
* ```javascript
|
package/lib/storage/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* Copyright 2020 Google Inc.
|
|
@@ -17,19 +17,21 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.getStorage = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* Cloud Storage for Firebase.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
*/
|
|
20
25
|
var app_1 = require("../app");
|
|
21
26
|
var storage_1 = require("./storage");
|
|
22
27
|
var storage_2 = require("./storage");
|
|
23
28
|
Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return storage_2.Storage; } });
|
|
24
29
|
/**
|
|
25
|
-
* Gets the {@link
|
|
26
|
-
* default app or a given app.
|
|
30
|
+
* Gets the {@link Storage} service for the default app or a given app.
|
|
27
31
|
*
|
|
28
32
|
* `getStorage()` can be called with no arguments to access the default
|
|
29
|
-
* app's
|
|
30
|
-
* `
|
|
31
|
-
* {@link storage.Storage `Storage`} service associated with a
|
|
32
|
-
* specific app.
|
|
33
|
+
* app's `Storage` service or as `getStorage(app)` to access the
|
|
34
|
+
* `Storage` service associated with a specific app.
|
|
33
35
|
*
|
|
34
36
|
* @example
|
|
35
37
|
* ```javascript
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Google Inc.
|
|
4
4
|
*
|
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
import { App } from '../app';
|
|
18
18
|
import { Storage as TStorage } from './storage';
|
|
19
19
|
/**
|
|
20
|
-
* Gets the {@link storage
|
|
20
|
+
* Gets the {@link firebase-admin.storage#Storage} service for the
|
|
21
21
|
* default app or a given app.
|
|
22
22
|
*
|
|
23
23
|
* `admin.storage()` can be called with no arguments to access the default
|
|
24
|
-
* app's
|
|
25
|
-
* `
|
|
26
|
-
* {@link storage.Storage `Storage`} service associated with a
|
|
27
|
-
* specific app.
|
|
24
|
+
* app's `Storage` service or as `admin.storage(app)` to access the
|
|
25
|
+
* `Storage` service associated with a specific app.
|
|
28
26
|
*
|
|
29
27
|
* @example
|
|
30
28
|
* ```javascript
|
|
@@ -40,5 +38,8 @@ import { Storage as TStorage } from './storage';
|
|
|
40
38
|
*/
|
|
41
39
|
export declare function storage(app?: App): storage.Storage;
|
|
42
40
|
export declare namespace storage {
|
|
41
|
+
/**
|
|
42
|
+
* Type alias to {@link firebase-admin.storage#Storage}.
|
|
43
|
+
*/
|
|
43
44
|
type Storage = TStorage;
|
|
44
45
|
}
|
package/lib/storage/storage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2017 Google Inc.
|
|
@@ -28,9 +28,9 @@ export declare class Storage {
|
|
|
28
28
|
/**
|
|
29
29
|
* Gets a reference to a Cloud Storage bucket.
|
|
30
30
|
*
|
|
31
|
-
* @param name Optional name of the bucket to be retrieved. If name is not specified,
|
|
31
|
+
* @param name - Optional name of the bucket to be retrieved. If name is not specified,
|
|
32
32
|
* retrieves a reference to the default bucket.
|
|
33
|
-
* @returns A
|
|
33
|
+
* @returns A {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/Bucket | Bucket}
|
|
34
34
|
* instance as defined in the `@google-cloud/storage` package.
|
|
35
35
|
*/
|
|
36
36
|
bucket(name?: string): Bucket;
|
package/lib/storage/storage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin
|
|
1
|
+
/*! firebase-admin v10.0.2 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -29,7 +29,7 @@ var validator = require("../utils/validator");
|
|
|
29
29
|
*/
|
|
30
30
|
var Storage = /** @class */ (function () {
|
|
31
31
|
/**
|
|
32
|
-
* @param app The app for this Storage service.
|
|
32
|
+
* @param app - The app for this Storage service.
|
|
33
33
|
* @constructor
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
@@ -40,6 +40,16 @@ var Storage = /** @class */ (function () {
|
|
|
40
40
|
message: 'First argument passed to admin.storage() must be a valid Firebase app instance.',
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
if (!process.env.STORAGE_EMULATOR_HOST && process.env.FIREBASE_STORAGE_EMULATOR_HOST) {
|
|
44
|
+
var firebaseStorageEmulatorHost = process.env.FIREBASE_STORAGE_EMULATOR_HOST;
|
|
45
|
+
if (firebaseStorageEmulatorHost.match(/https?:\/\//)) {
|
|
46
|
+
throw new error_1.FirebaseError({
|
|
47
|
+
code: 'storage/invalid-emulator-host',
|
|
48
|
+
message: 'FIREBASE_STORAGE_EMULATOR_HOST should not contain a protocol (http or https).',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
process.env.STORAGE_EMULATOR_HOST = "http://" + process.env.FIREBASE_STORAGE_EMULATOR_HOST;
|
|
52
|
+
}
|
|
43
53
|
var storage;
|
|
44
54
|
try {
|
|
45
55
|
storage = require('@google-cloud/storage').Storage;
|
|
@@ -82,9 +92,9 @@ var Storage = /** @class */ (function () {
|
|
|
82
92
|
/**
|
|
83
93
|
* Gets a reference to a Cloud Storage bucket.
|
|
84
94
|
*
|
|
85
|
-
* @param name Optional name of the bucket to be retrieved. If name is not specified,
|
|
95
|
+
* @param name - Optional name of the bucket to be retrieved. If name is not specified,
|
|
86
96
|
* retrieves a reference to the default bucket.
|
|
87
|
-
* @returns A
|
|
97
|
+
* @returns A {@link https://cloud.google.com/nodejs/docs/reference/storage/latest/Bucket | Bucket}
|
|
88
98
|
* instance as defined in the `@google-cloud/storage` package.
|
|
89
99
|
*/
|
|
90
100
|
Storage.prototype.bucket = function (name) {
|