firebase-admin 11.9.0 → 11.10.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/lib/app/core.d.ts +1 -1
- package/lib/app/core.js +1 -1
- package/lib/app/credential-factory.d.ts +1 -1
- package/lib/app/credential-factory.js +1 -1
- package/lib/app/credential-internal.d.ts +1 -1
- package/lib/app/credential-internal.js +1 -1
- package/lib/app/credential.d.ts +1 -1
- package/lib/app/credential.js +1 -1
- package/lib/app/firebase-app.d.ts +1 -1
- package/lib/app/firebase-app.js +1 -1
- package/lib/app/firebase-namespace.d.ts +1 -1
- package/lib/app/firebase-namespace.js +1 -1
- package/lib/app/index.d.ts +1 -1
- package/lib/app/index.js +1 -1
- package/lib/app/lifecycle.d.ts +1 -1
- package/lib/app/lifecycle.js +1 -1
- package/lib/app-check/app-check-api-client-internal.d.ts +1 -1
- package/lib/app-check/app-check-api-client-internal.js +1 -1
- package/lib/app-check/app-check-api.d.ts +1 -1
- package/lib/app-check/app-check-api.js +1 -1
- package/lib/app-check/app-check-namespace.d.ts +1 -1
- package/lib/app-check/app-check-namespace.js +1 -1
- package/lib/app-check/app-check.d.ts +1 -1
- package/lib/app-check/app-check.js +1 -1
- package/lib/app-check/index.d.ts +1 -1
- package/lib/app-check/index.js +1 -1
- package/lib/app-check/token-generator.d.ts +1 -1
- package/lib/app-check/token-generator.js +1 -1
- package/lib/app-check/token-verifier.d.ts +1 -1
- package/lib/app-check/token-verifier.js +1 -1
- package/lib/auth/action-code-settings-builder.d.ts +1 -1
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.d.ts +1 -1
- package/lib/auth/auth-api-request.js +1 -1
- package/lib/auth/auth-config.d.ts +1 -1
- package/lib/auth/auth-config.js +13 -13
- package/lib/auth/auth-namespace.d.ts +1 -1
- package/lib/auth/auth-namespace.js +1 -1
- package/lib/auth/auth.d.ts +1 -1
- package/lib/auth/auth.js +1 -1
- package/lib/auth/base-auth.d.ts +1 -1
- package/lib/auth/base-auth.js +1 -1
- package/lib/auth/identifier.d.ts +1 -1
- package/lib/auth/identifier.js +1 -1
- package/lib/auth/index.d.ts +1 -1
- package/lib/auth/index.js +1 -1
- package/lib/auth/project-config-manager.d.ts +1 -1
- package/lib/auth/project-config-manager.js +1 -1
- package/lib/auth/project-config.d.ts +1 -1
- package/lib/auth/project-config.js +1 -1
- package/lib/auth/tenant-manager.d.ts +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.d.ts +1 -1
- package/lib/auth/tenant.js +1 -1
- package/lib/auth/token-generator.d.ts +1 -1
- package/lib/auth/token-generator.js +1 -1
- package/lib/auth/token-verifier.d.ts +1 -1
- package/lib/auth/token-verifier.js +1 -1
- package/lib/auth/user-import-builder.d.ts +1 -1
- package/lib/auth/user-import-builder.js +1 -1
- package/lib/auth/user-record.d.ts +28 -4
- package/lib/auth/user-record.js +58 -6
- package/lib/credential/index.d.ts +1 -1
- package/lib/credential/index.js +1 -1
- package/lib/database/database-namespace.d.ts +1 -1
- package/lib/database/database-namespace.js +1 -1
- package/lib/database/database.d.ts +1 -1
- package/lib/database/database.js +1 -1
- package/lib/database/index.d.ts +1 -1
- package/lib/database/index.js +1 -1
- package/lib/default-namespace.d.ts +1 -1
- package/lib/default-namespace.js +1 -1
- package/lib/esm/storage/index.js +1 -0
- package/lib/eventarc/cloudevent.d.ts +1 -1
- package/lib/eventarc/cloudevent.js +1 -1
- package/lib/eventarc/eventarc-client-internal.d.ts +1 -1
- package/lib/eventarc/eventarc-client-internal.js +1 -1
- package/lib/eventarc/eventarc-utils.d.ts +1 -1
- package/lib/eventarc/eventarc-utils.js +1 -1
- package/lib/eventarc/eventarc.d.ts +1 -1
- package/lib/eventarc/eventarc.js +1 -1
- package/lib/eventarc/index.d.ts +1 -1
- package/lib/eventarc/index.js +1 -1
- package/lib/extensions/extensions-api-client-internal.d.ts +1 -1
- package/lib/extensions/extensions-api-client-internal.js +1 -1
- package/lib/extensions/extensions-api.d.ts +1 -1
- package/lib/extensions/extensions-api.js +1 -1
- package/lib/extensions/extensions.d.ts +1 -1
- package/lib/extensions/extensions.js +1 -1
- package/lib/extensions/index.d.ts +1 -1
- package/lib/extensions/index.js +1 -1
- package/lib/firebase-namespace-api.d.ts +1 -1
- package/lib/firebase-namespace-api.js +1 -1
- package/lib/firestore/firestore-internal.d.ts +1 -1
- package/lib/firestore/firestore-internal.js +1 -1
- package/lib/firestore/firestore-namespace.d.ts +1 -1
- package/lib/firestore/firestore-namespace.js +1 -1
- package/lib/firestore/index.d.ts +67 -23
- package/lib/firestore/index.js +1 -1
- package/lib/functions/functions-api-client-internal.d.ts +3 -2
- package/lib/functions/functions-api-client-internal.js +105 -27
- package/lib/functions/functions-api.d.ts +33 -1
- package/lib/functions/functions-api.js +1 -1
- package/lib/functions/functions.d.ts +7 -1
- package/lib/functions/functions.js +9 -1
- package/lib/functions/index.d.ts +2 -2
- package/lib/functions/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/installations/index.d.ts +1 -1
- package/lib/installations/index.js +1 -1
- package/lib/installations/installations-namespace.d.ts +1 -1
- package/lib/installations/installations-namespace.js +1 -1
- package/lib/installations/installations-request-handler.d.ts +1 -1
- package/lib/installations/installations-request-handler.js +1 -1
- package/lib/installations/installations.d.ts +1 -1
- package/lib/installations/installations.js +1 -1
- package/lib/instance-id/index.d.ts +1 -1
- package/lib/instance-id/index.js +1 -1
- package/lib/instance-id/instance-id-namespace.d.ts +1 -1
- package/lib/instance-id/instance-id-namespace.js +1 -1
- package/lib/instance-id/instance-id.d.ts +1 -1
- package/lib/instance-id/instance-id.js +1 -1
- package/lib/machine-learning/index.d.ts +1 -1
- package/lib/machine-learning/index.js +1 -1
- package/lib/machine-learning/machine-learning-api-client.d.ts +1 -1
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- package/lib/machine-learning/machine-learning-namespace.d.ts +1 -1
- 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 +1 -1
- package/lib/machine-learning/machine-learning.js +1 -1
- package/lib/messaging/batch-request-internal.d.ts +1 -1
- package/lib/messaging/batch-request-internal.js +1 -1
- package/lib/messaging/index.d.ts +1 -1
- package/lib/messaging/index.js +1 -1
- package/lib/messaging/messaging-api-request-internal.d.ts +1 -1
- package/lib/messaging/messaging-api-request-internal.js +1 -1
- package/lib/messaging/messaging-api.d.ts +1 -1
- package/lib/messaging/messaging-api.js +1 -1
- package/lib/messaging/messaging-errors-internal.d.ts +1 -1
- package/lib/messaging/messaging-errors-internal.js +1 -1
- package/lib/messaging/messaging-internal.d.ts +1 -1
- package/lib/messaging/messaging-internal.js +1 -1
- package/lib/messaging/messaging-namespace.d.ts +1 -1
- package/lib/messaging/messaging-namespace.js +1 -1
- package/lib/messaging/messaging.d.ts +1 -1
- package/lib/messaging/messaging.js +1 -1
- package/lib/project-management/android-app.d.ts +1 -1
- package/lib/project-management/android-app.js +1 -1
- 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 +1 -1
- package/lib/project-management/index.js +1 -1
- package/lib/project-management/ios-app.d.ts +1 -1
- package/lib/project-management/ios-app.js +1 -1
- package/lib/project-management/project-management-api-request-internal.d.ts +1 -1
- package/lib/project-management/project-management-api-request-internal.js +1 -1
- package/lib/project-management/project-management-namespace.d.ts +1 -1
- package/lib/project-management/project-management-namespace.js +1 -1
- package/lib/project-management/project-management.d.ts +1 -1
- package/lib/project-management/project-management.js +1 -1
- package/lib/remote-config/index.d.ts +1 -1
- package/lib/remote-config/index.js +1 -1
- package/lib/remote-config/remote-config-api-client-internal.d.ts +1 -1
- package/lib/remote-config/remote-config-api-client-internal.js +1 -1
- package/lib/remote-config/remote-config-api.d.ts +1 -1
- package/lib/remote-config/remote-config-api.js +1 -1
- package/lib/remote-config/remote-config-namespace.d.ts +1 -1
- package/lib/remote-config/remote-config-namespace.js +1 -1
- package/lib/remote-config/remote-config.d.ts +1 -1
- package/lib/remote-config/remote-config.js +1 -1
- package/lib/security-rules/index.d.ts +1 -1
- package/lib/security-rules/index.js +1 -1
- 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 +1 -1
- package/lib/security-rules/security-rules-namespace.js +1 -1
- package/lib/security-rules/security-rules.d.ts +1 -1
- package/lib/security-rules/security-rules.js +1 -1
- package/lib/storage/index.d.ts +14 -1
- package/lib/storage/index.js +29 -7
- package/lib/storage/storage-namespace.d.ts +1 -1
- package/lib/storage/storage-namespace.js +1 -1
- package/lib/storage/storage.d.ts +1 -1
- package/lib/storage/storage.js +1 -1
- package/lib/storage/utils.d.ts +20 -0
- package/lib/storage/utils.js +21 -0
- package/lib/utils/api-request.d.ts +1 -1
- package/lib/utils/api-request.js +1 -9
- package/lib/utils/crypto-signer.d.ts +1 -1
- package/lib/utils/crypto-signer.js +1 -1
- package/lib/utils/deep-copy.d.ts +1 -1
- package/lib/utils/deep-copy.js +1 -1
- package/lib/utils/error.d.ts +1 -1
- package/lib/utils/error.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/jwt.d.ts +1 -1
- package/lib/utils/jwt.js +1 -1
- package/lib/utils/validator.d.ts +9 -1
- package/lib/utils/validator.js +17 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -23,7 +23,8 @@ const error_1 = require("../utils/error");
|
|
|
23
23
|
const utils = require("../utils/index");
|
|
24
24
|
const validator = require("../utils/validator");
|
|
25
25
|
const credential_internal_1 = require("../app/credential-internal");
|
|
26
|
-
const
|
|
26
|
+
const CLOUD_TASKS_API_RESOURCE_PATH = 'projects/{projectId}/locations/{locationId}/queues/{resourceId}/tasks';
|
|
27
|
+
const CLOUD_TASKS_API_URL_FORMAT = 'https://cloudtasks.googleapis.com/v2/' + CLOUD_TASKS_API_RESOURCE_PATH;
|
|
27
28
|
const FIREBASE_FUNCTION_URL_FORMAT = 'https://{locationId}-{projectId}.cloudfunctions.net/{resourceId}';
|
|
28
29
|
const FIREBASE_FUNCTIONS_CONFIG_HEADERS = {
|
|
29
30
|
'X-Firebase-Client': `fire-admin-node/${utils.getSdkVersion()}`
|
|
@@ -43,6 +44,58 @@ class FunctionsApiClient {
|
|
|
43
44
|
}
|
|
44
45
|
this.httpClient = new api_request_1.AuthorizedHttpClient(app);
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Deletes a task from a queue.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The ID of the task to delete.
|
|
51
|
+
* @param functionName - The function name of the queue.
|
|
52
|
+
* @param extensionId - Optional canonical ID of the extension.
|
|
53
|
+
*/
|
|
54
|
+
async delete(id, functionName, extensionId) {
|
|
55
|
+
if (!validator.isNonEmptyString(functionName)) {
|
|
56
|
+
throw new FirebaseFunctionsError('invalid-argument', 'Function name must be a non empty string');
|
|
57
|
+
}
|
|
58
|
+
if (!validator.isTaskId(id)) {
|
|
59
|
+
throw new FirebaseFunctionsError('invalid-argument', 'id can contain only letters ([A-Za-z]), numbers ([0-9]), '
|
|
60
|
+
+ 'hyphens (-), or underscores (_). The maximum length is 500 characters.');
|
|
61
|
+
}
|
|
62
|
+
let resources;
|
|
63
|
+
try {
|
|
64
|
+
resources = utils.parseResourceName(functionName, 'functions');
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
throw new FirebaseFunctionsError('invalid-argument', 'Function name must be a single string or a qualified resource name');
|
|
68
|
+
}
|
|
69
|
+
resources.projectId = resources.projectId || await this.getProjectId();
|
|
70
|
+
resources.locationId = resources.locationId || DEFAULT_LOCATION;
|
|
71
|
+
if (!validator.isNonEmptyString(resources.resourceId)) {
|
|
72
|
+
throw new FirebaseFunctionsError('invalid-argument', 'No valid function name specified to enqueue tasks for.');
|
|
73
|
+
}
|
|
74
|
+
if (typeof extensionId !== 'undefined' && validator.isNonEmptyString(extensionId)) {
|
|
75
|
+
resources.resourceId = `ext-${extensionId}-${resources.resourceId}`;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const serviceUrl = await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT.concat('/', id));
|
|
79
|
+
const request = {
|
|
80
|
+
method: 'DELETE',
|
|
81
|
+
url: serviceUrl,
|
|
82
|
+
headers: FIREBASE_FUNCTIONS_CONFIG_HEADERS,
|
|
83
|
+
};
|
|
84
|
+
await this.httpClient.send(request);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
if (err instanceof api_request_1.HttpError) {
|
|
88
|
+
if (err.response.status === 404) {
|
|
89
|
+
// if no task with the provided ID exists, then ignore the delete.
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
throw this.toFirebaseError(err);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
46
99
|
/**
|
|
47
100
|
* Creates a task and adds it to a queue.
|
|
48
101
|
*
|
|
@@ -51,11 +104,10 @@ class FunctionsApiClient {
|
|
|
51
104
|
* @param extensionId - Optional canonical ID of the extension.
|
|
52
105
|
* @param opts - Optional options when enqueuing a new task.
|
|
53
106
|
*/
|
|
54
|
-
enqueue(data, functionName, extensionId, opts) {
|
|
107
|
+
async enqueue(data, functionName, extensionId, opts) {
|
|
55
108
|
if (!validator.isNonEmptyString(functionName)) {
|
|
56
109
|
throw new FirebaseFunctionsError('invalid-argument', 'Function name must be a non empty string');
|
|
57
110
|
}
|
|
58
|
-
const task = this.validateTaskOptions(data, opts);
|
|
59
111
|
let resources;
|
|
60
112
|
try {
|
|
61
113
|
resources = utils.parseResourceName(functionName, 'functions');
|
|
@@ -63,30 +115,41 @@ class FunctionsApiClient {
|
|
|
63
115
|
catch (err) {
|
|
64
116
|
throw new FirebaseFunctionsError('invalid-argument', 'Function name must be a single string or a qualified resource name');
|
|
65
117
|
}
|
|
118
|
+
resources.projectId = resources.projectId || await this.getProjectId();
|
|
119
|
+
resources.locationId = resources.locationId || DEFAULT_LOCATION;
|
|
120
|
+
if (!validator.isNonEmptyString(resources.resourceId)) {
|
|
121
|
+
throw new FirebaseFunctionsError('invalid-argument', 'No valid function name specified to enqueue tasks for.');
|
|
122
|
+
}
|
|
66
123
|
if (typeof extensionId !== 'undefined' && validator.isNonEmptyString(extensionId)) {
|
|
67
124
|
resources.resourceId = `ext-${extensionId}-${resources.resourceId}`;
|
|
68
125
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
126
|
+
const task = this.validateTaskOptions(data, resources, opts);
|
|
127
|
+
try {
|
|
128
|
+
const serviceUrl = await this.getUrl(resources, CLOUD_TASKS_API_URL_FORMAT);
|
|
129
|
+
const taskPayload = await this.updateTaskPayload(task, resources, extensionId);
|
|
130
|
+
const request = {
|
|
131
|
+
method: 'POST',
|
|
132
|
+
url: serviceUrl,
|
|
133
|
+
headers: FIREBASE_FUNCTIONS_CONFIG_HEADERS,
|
|
134
|
+
data: {
|
|
135
|
+
task: taskPayload,
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
await this.httpClient.send(request);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
if (err instanceof api_request_1.HttpError) {
|
|
142
|
+
if (err.response.status === 409) {
|
|
143
|
+
throw new FirebaseFunctionsError('task-already-exists', `A task with ID ${opts?.id} already exists`);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw this.toFirebaseError(err);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
90
153
|
}
|
|
91
154
|
getUrl(resourceName, urlFormat) {
|
|
92
155
|
let { locationId } = resourceName;
|
|
@@ -142,7 +205,7 @@ class FunctionsApiClient {
|
|
|
142
205
|
return accountId;
|
|
143
206
|
});
|
|
144
207
|
}
|
|
145
|
-
validateTaskOptions(data, opts) {
|
|
208
|
+
validateTaskOptions(data, resources, opts) {
|
|
146
209
|
const task = {
|
|
147
210
|
httpRequest: {
|
|
148
211
|
url: '',
|
|
@@ -150,7 +213,10 @@ class FunctionsApiClient {
|
|
|
150
213
|
serviceAccountEmail: '',
|
|
151
214
|
},
|
|
152
215
|
body: Buffer.from(JSON.stringify({ data })).toString('base64'),
|
|
153
|
-
headers: {
|
|
216
|
+
headers: {
|
|
217
|
+
'Content-Type': 'application/json',
|
|
218
|
+
...opts?.headers,
|
|
219
|
+
}
|
|
154
220
|
}
|
|
155
221
|
};
|
|
156
222
|
if (typeof opts !== 'undefined') {
|
|
@@ -183,6 +249,18 @@ class FunctionsApiClient {
|
|
|
183
249
|
}
|
|
184
250
|
task.dispatchDeadline = `${opts.dispatchDeadlineSeconds}s`;
|
|
185
251
|
}
|
|
252
|
+
if ('id' in opts && typeof opts.id !== 'undefined') {
|
|
253
|
+
if (!validator.isTaskId(opts.id)) {
|
|
254
|
+
throw new FirebaseFunctionsError('invalid-argument', 'id can contain only letters ([A-Za-z]), numbers ([0-9]), '
|
|
255
|
+
+ 'hyphens (-), or underscores (_). The maximum length is 500 characters.');
|
|
256
|
+
}
|
|
257
|
+
const resourcePath = utils.formatString(CLOUD_TASKS_API_RESOURCE_PATH, {
|
|
258
|
+
projectId: resources.projectId,
|
|
259
|
+
locationId: resources.locationId,
|
|
260
|
+
resourceId: resources.resourceId,
|
|
261
|
+
});
|
|
262
|
+
task.name = resourcePath.concat('/', opts.id);
|
|
263
|
+
}
|
|
186
264
|
if (typeof opts.uri !== 'undefined') {
|
|
187
265
|
if (!validator.isURL(opts.uri)) {
|
|
188
266
|
throw new FirebaseFunctionsError('invalid-argument', 'uri must be a valid URL string.');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -54,6 +54,38 @@ export type TaskOptions = DeliverySchedule & TaskOptionsExperimental & {
|
|
|
54
54
|
* The default is 10 minutes. The deadline must be in the range of 15 seconds and 30 minutes.
|
|
55
55
|
*/
|
|
56
56
|
dispatchDeadlineSeconds?: number;
|
|
57
|
+
/**
|
|
58
|
+
* The ID to use for the enqueued event.
|
|
59
|
+
* If not provided, one will be automatically generated.
|
|
60
|
+
* If provided, an explicitly specified task ID enables task de-duplication. If a task's ID is
|
|
61
|
+
* identical to that of an existing task or a task that was deleted or executed recently then
|
|
62
|
+
* the call will throw an error with code "functions/task-already-exists". Another task with
|
|
63
|
+
* the same ID can't be created for ~1hour after the original task was deleted or executed.
|
|
64
|
+
*
|
|
65
|
+
* Because there is an extra lookup cost to identify duplicate task IDs, setting ID
|
|
66
|
+
* significantly increases latency. Using hashed strings for the task ID or for the prefix of
|
|
67
|
+
* the task ID is recommended. Choosing task IDs that are sequential or have sequential
|
|
68
|
+
* prefixes, for example using a timestamp, causes an increase in latency and error rates in
|
|
69
|
+
* all task commands. The infrastructure relies on an approximately uniform distribution of
|
|
70
|
+
* task IDs to store and serve tasks efficiently.
|
|
71
|
+
*
|
|
72
|
+
* "Push IDs" from the Firebase Realtime Database make poor IDs because they are based on
|
|
73
|
+
* timestamps and will cause contention (slowdowns) in your task queue. Reversed push IDs
|
|
74
|
+
* however form a perfect distribution and are an ideal key. To reverse a string in
|
|
75
|
+
* javascript use `someString.split("").reverse().join("")`
|
|
76
|
+
*/
|
|
77
|
+
id?: string;
|
|
78
|
+
/**
|
|
79
|
+
* HTTP request headers to include in the request to the task queue function.
|
|
80
|
+
* These headers represent a subset of the headers that will accompany the task's HTTP
|
|
81
|
+
* request. Some HTTP request headers will be ignored or replaced, e.g. Authorization, Host, Content-Length,
|
|
82
|
+
* User-Agent etc. cannot be overridden.
|
|
83
|
+
*
|
|
84
|
+
* By default, Content-Type is set to 'application/json'.
|
|
85
|
+
*
|
|
86
|
+
* The size of the headers must be less than 80KB.
|
|
87
|
+
*/
|
|
88
|
+
headers?: Record<string, string>;
|
|
57
89
|
};
|
|
58
90
|
/**
|
|
59
91
|
* Type representing experimental (beta) task options.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -60,4 +60,10 @@ export declare class TaskQueue<Args = Record<string, any>> {
|
|
|
60
60
|
* @returns A promise that resolves when the task has successfully been added to the queue.
|
|
61
61
|
*/
|
|
62
62
|
enqueue(data: Args, opts?: TaskOptions): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Deletes an enqueued task if it has not yet completed.
|
|
65
|
+
* @param id - the ID of the task, relative to this queue.
|
|
66
|
+
* @returns A promise that resolves when the task has been deleted.
|
|
67
|
+
*/
|
|
68
|
+
delete(id: string): Promise<void>;
|
|
63
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* @license
|
|
@@ -93,5 +93,13 @@ class TaskQueue {
|
|
|
93
93
|
enqueue(data, opts) {
|
|
94
94
|
return this.client.enqueue(data, this.functionName, this.extensionId, opts);
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Deletes an enqueued task if it has not yet completed.
|
|
98
|
+
* @param id - the ID of the task, relative to this queue.
|
|
99
|
+
* @returns A promise that resolves when the task has been deleted.
|
|
100
|
+
*/
|
|
101
|
+
delete(id) {
|
|
102
|
+
return this.client.delete(id, this.functionName, this.extensionId);
|
|
103
|
+
}
|
|
96
104
|
}
|
|
97
105
|
exports.TaskQueue = TaskQueue;
|
package/lib/functions/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! firebase-admin v11.
|
|
1
|
+
/*! firebase-admin v11.10.1 */
|
|
2
2
|
/*!
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2021 Google Inc.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { App } from '../app';
|
|
24
24
|
import { Functions } from './functions';
|
|
25
|
-
export { DelayDelivery, AbsoluteDelivery, DeliverySchedule, TaskOptions, TaskOptionsExperimental } from './functions-api';
|
|
25
|
+
export { DelayDelivery, AbsoluteDelivery, DeliverySchedule, TaskOptions, TaskOptionsExperimental, } from './functions-api';
|
|
26
26
|
export { Functions, TaskQueue } from './functions';
|
|
27
27
|
/**
|
|
28
28
|
* Gets the {@link Functions} service for the default app
|
package/lib/functions/index.js
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/instance-id/index.js
CHANGED
package/lib/messaging/index.d.ts
CHANGED
package/lib/messaging/index.js
CHANGED