@firebase-function-kits/delete-user-data 0.0.1 → 0.0.2-rc.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +220 -0
  3. package/lib/config.d.ts +22 -0
  4. package/lib/config.d.ts.map +1 -0
  5. package/lib/config.js +153 -0
  6. package/lib/config.js.map +1 -0
  7. package/lib/events.d.ts +18 -0
  8. package/lib/events.d.ts.map +1 -0
  9. package/lib/events.js +71 -0
  10. package/lib/events.js.map +1 -0
  11. package/lib/export-config.d.ts +55 -0
  12. package/lib/export-config.d.ts.map +1 -0
  13. package/lib/export-config.js +56 -0
  14. package/lib/export-config.js.map +1 -0
  15. package/lib/handlers.d.ts +35 -0
  16. package/lib/handlers.d.ts.map +1 -0
  17. package/lib/handlers.js +243 -0
  18. package/lib/handlers.js.map +1 -0
  19. package/lib/helpers.d.ts +19 -0
  20. package/lib/helpers.d.ts.map +1 -0
  21. package/lib/helpers.js +39 -0
  22. package/lib/helpers.js.map +1 -0
  23. package/lib/index.d.ts +6 -0
  24. package/lib/index.d.ts.map +1 -0
  25. package/lib/index.js +112 -0
  26. package/lib/index.js.map +1 -0
  27. package/lib/lib.d.ts +23 -0
  28. package/lib/lib.d.ts.map +1 -0
  29. package/lib/lib.js +38 -0
  30. package/lib/lib.js.map +1 -0
  31. package/lib/logs.d.ts +26 -0
  32. package/lib/logs.d.ts.map +1 -0
  33. package/lib/logs.js +116 -0
  34. package/lib/logs.js.map +1 -0
  35. package/lib/recursiveDelete.d.ts +18 -0
  36. package/lib/recursiveDelete.d.ts.map +1 -0
  37. package/lib/recursiveDelete.js +37 -0
  38. package/lib/recursiveDelete.js.map +1 -0
  39. package/lib/runBatchPubSubDeletions.d.ts +27 -0
  40. package/lib/runBatchPubSubDeletions.d.ts.map +1 -0
  41. package/lib/runBatchPubSubDeletions.js +47 -0
  42. package/lib/runBatchPubSubDeletions.js.map +1 -0
  43. package/lib/runCustomSearchFunction.d.ts +18 -0
  44. package/lib/runCustomSearchFunction.d.ts.map +1 -0
  45. package/lib/runCustomSearchFunction.js +78 -0
  46. package/lib/runCustomSearchFunction.js.map +1 -0
  47. package/lib/search.d.ts +19 -0
  48. package/lib/search.d.ts.map +1 -0
  49. package/lib/search.js +29 -0
  50. package/lib/search.js.map +1 -0
  51. package/npm-shrinkwrap.json +4167 -0
  52. package/package.json +37 -4
  53. package/src/config.ts +188 -0
  54. package/src/events.ts +38 -0
  55. package/src/export-config.ts +112 -0
  56. package/src/handlers.ts +271 -0
  57. package/src/helpers.ts +42 -0
  58. package/src/index.ts +100 -0
  59. package/src/lib.ts +41 -0
  60. package/src/logs.ts +127 -0
  61. package/src/recursiveDelete.ts +42 -0
  62. package/src/runBatchPubSubDeletions.ts +66 -0
  63. package/src/runCustomSearchFunction.ts +50 -0
  64. package/src/search.ts +37 -0
  65. package/tests/config.test.ts +180 -0
  66. package/tests/export-config.test.ts +117 -0
  67. package/tests/fakes.ts +325 -0
  68. package/tests/handlers.test.ts +517 -0
  69. package/tests/helpers.test.ts +126 -0
  70. package/tests/lib.test.ts +40 -0
  71. package/tests/recursiveDelete.test.ts +102 -0
  72. package/tests/runBatchPubSubDeletions.test.ts +164 -0
  73. package/tests/runCustomSearchFunction.test.ts +125 -0
  74. package/tests/search.test.ts +127 -0
  75. package/tsconfig.json +18 -0
  76. package/tsconfig.tsbuildinfo +1 -0
  77. package/index.js +0 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type * as admin from "firebase-admin";
17
+ import { type PublisherContext } from "./runBatchPubSubDeletions";
18
+ export interface HandlerContext extends PublisherContext {
19
+ firestore: admin.firestore.Firestore;
20
+ storage: admin.storage.Storage;
21
+ database: admin.database.Database;
22
+ }
23
+ export interface DeleteMessageData {
24
+ paths: string[];
25
+ uid: string;
26
+ }
27
+ export interface SearchMessageData {
28
+ path: string;
29
+ depth: number;
30
+ uid: string;
31
+ }
32
+ export declare function handleDeletion(data: DeleteMessageData, ctx: HandlerContext): Promise<void>;
33
+ export declare function handleSearch(data: SearchMessageData, ctx: HandlerContext): Promise<void>;
34
+ export declare function handleClear(uid: string, ctx: HandlerContext): Promise<void>;
35
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAQ7C,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;IACrC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CAwCf;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CAgDf;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ var __importDefault = (this && this.__importDefault) || function (mod) {
51
+ return (mod && mod.__esModule) ? mod : { "default": mod };
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.handleDeletion = handleDeletion;
55
+ exports.handleSearch = handleSearch;
56
+ exports.handleClear = handleClear;
57
+ const firestore_1 = require("firebase-admin/firestore");
58
+ const lodash_chunk_1 = __importDefault(require("lodash.chunk"));
59
+ const events = __importStar(require("./events"));
60
+ const helpers_1 = require("./helpers");
61
+ const logs = __importStar(require("./logs"));
62
+ const recursiveDelete_1 = require("./recursiveDelete");
63
+ const runBatchPubSubDeletions_1 = require("./runBatchPubSubDeletions");
64
+ const runCustomSearchFunction_1 = require("./runCustomSearchFunction");
65
+ const search_1 = require("./search");
66
+ async function handleDeletion(data, ctx) {
67
+ const { paths, uid } = data;
68
+ const batchArray = [];
69
+ const invalidPaths = [];
70
+ for (const chunkedPaths of (0, lodash_chunk_1.default)(paths, 450)) {
71
+ const batch = ctx.firestore.batch();
72
+ for (const path of chunkedPaths) {
73
+ const docRef = ctx.firestore.doc(path);
74
+ const isValidPath = await (0, helpers_1.hasValidUserPath)(docRef, path, uid, ctx.config.searchFields);
75
+ if (!isValidPath) {
76
+ invalidPaths.push(path);
77
+ continue;
78
+ }
79
+ if (ctx.config.firestoreDeleteMode === "recursive") {
80
+ await (0, recursiveDelete_1.recursiveDelete)(path, ctx.firestore);
81
+ }
82
+ else {
83
+ batch.delete(docRef);
84
+ }
85
+ }
86
+ batchArray.push(batch);
87
+ }
88
+ await Promise.all(batchArray.map((batch) => batch.commit()));
89
+ if (invalidPaths.length > 0) {
90
+ logs.warnInvalidPaths(invalidPaths.length, uid);
91
+ }
92
+ await events.publishDeletionEvent("firestore", {
93
+ uid,
94
+ documentPaths: paths,
95
+ invalidPaths,
96
+ });
97
+ }
98
+ async function handleSearch(data, ctx) {
99
+ const { path, depth, uid } = data;
100
+ const nextDepth = depth + 1;
101
+ const collection = ctx.firestore.collection(path);
102
+ if (depth > ctx.config.searchDepth)
103
+ return;
104
+ if (collection.id === uid) {
105
+ await (0, recursiveDelete_1.recursiveDelete)(path, ctx.firestore);
106
+ await events.publishDeletionEvent("firestore", {
107
+ uid,
108
+ collectionPath: collection.path,
109
+ });
110
+ return;
111
+ }
112
+ const documentReferences = await collection.listDocuments();
113
+ const documentReferencesToSearch = [];
114
+ const pathsToDelete = [];
115
+ await Promise.all(documentReferences.map(async (reference) => {
116
+ if (nextDepth <= ctx.config.searchDepth) {
117
+ await (0, search_1.search)(uid, nextDepth, ctx.firestore, ctx, reference);
118
+ }
119
+ if (reference.id === uid) {
120
+ pathsToDelete.push(reference.path);
121
+ }
122
+ else if (ctx.config.searchFields) {
123
+ documentReferencesToSearch.push(reference);
124
+ }
125
+ }));
126
+ if (documentReferencesToSearch.length > 0) {
127
+ const snapshots = await ctx.firestore.getAll(...documentReferencesToSearch);
128
+ for (const snapshot of snapshots) {
129
+ if (snapshot.exists) {
130
+ for (const field of ctx.config.searchFields.split(",")) {
131
+ if (snapshot.get(new firestore_1.FieldPath(field)) === uid) {
132
+ pathsToDelete.push(snapshot.ref.path);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ await (0, runBatchPubSubDeletions_1.runBatchPubSubDeletions)({ firestorePaths: pathsToDelete }, uid, ctx);
139
+ }
140
+ async function handleClear(uid, ctx) {
141
+ logs.start(ctx.config);
142
+ const promises = [];
143
+ if (ctx.config.firestorePaths) {
144
+ promises.push(clearFirestoreData(ctx.config.firestorePaths, uid, ctx));
145
+ }
146
+ else {
147
+ logs.firestoreNotConfigured();
148
+ }
149
+ if (ctx.config.rtdbPaths) {
150
+ promises.push(clearDatabaseData(ctx.config.rtdbPaths, uid, ctx));
151
+ }
152
+ else {
153
+ logs.rtdbNotConfigured();
154
+ }
155
+ if (ctx.config.storagePaths) {
156
+ promises.push(clearStorageData(ctx.config.storagePaths, uid, ctx));
157
+ }
158
+ else {
159
+ logs.storageNotConfigured();
160
+ }
161
+ await Promise.all(promises);
162
+ if (ctx.config.enableAutoDiscovery) {
163
+ await (0, search_1.search)(uid, 1, ctx.firestore, ctx);
164
+ }
165
+ if (ctx.config.searchFunction) {
166
+ await (0, runCustomSearchFunction_1.runCustomSearchFunction)(uid, ctx);
167
+ }
168
+ logs.complete(uid);
169
+ }
170
+ async function clearDatabaseData(databasePaths, uid, ctx) {
171
+ logs.rtdbDeleting();
172
+ const paths = (0, helpers_1.extractUserPaths)(databasePaths, uid);
173
+ await Promise.all(paths.map(async (path) => {
174
+ try {
175
+ logs.rtdbPathDeleting(path);
176
+ await ctx.database.ref(path).remove();
177
+ logs.rtdbPathDeleted(path);
178
+ }
179
+ catch (err) {
180
+ logs.rtdbPathError(path, err);
181
+ }
182
+ }));
183
+ await events.publishDeletionEvent("database", { uid, paths });
184
+ logs.rtdbDeleted();
185
+ }
186
+ async function clearStorageData(storagePaths, uid, ctx) {
187
+ logs.storageDeleting();
188
+ const paths = (0, helpers_1.extractUserPaths)(storagePaths, uid);
189
+ await Promise.all(paths.map(async (path) => {
190
+ const parts = path.split("/");
191
+ const bucketName = parts[0];
192
+ const bucket = bucketName === "{DEFAULT}"
193
+ ? ctx.storage.bucket(ctx.config.storageBucket)
194
+ : ctx.storage.bucket(bucketName);
195
+ const prefix = parts.slice(1).join("/");
196
+ try {
197
+ logs.storagePathDeleting(prefix);
198
+ await bucket.deleteFiles({ prefix });
199
+ logs.storagePathDeleted(prefix);
200
+ }
201
+ catch (err) {
202
+ if (err.code === 404) {
203
+ logs.storagePath404(prefix);
204
+ }
205
+ else {
206
+ logs.storagePathError(prefix, err);
207
+ }
208
+ }
209
+ }));
210
+ await events.publishDeletionEvent("storage", { uid, paths });
211
+ logs.storageDeleted();
212
+ }
213
+ async function clearFirestoreData(firestorePaths, uid, ctx) {
214
+ logs.firestoreDeleting();
215
+ const paths = (0, helpers_1.extractUserPaths)(firestorePaths, uid);
216
+ await Promise.all(paths.map(async (path) => {
217
+ try {
218
+ const isRecursive = ctx.config.firestoreDeleteMode === "recursive";
219
+ if (!isRecursive) {
220
+ logs.firestorePathDeleting(path, false);
221
+ await ctx.firestore.runTransaction((transaction) => {
222
+ transaction.delete(ctx.firestore.doc(path));
223
+ return Promise.resolve();
224
+ });
225
+ logs.firestorePathDeleted(path, false);
226
+ }
227
+ else {
228
+ logs.firestorePathDeleting(path, true);
229
+ await (0, recursiveDelete_1.recursiveDelete)(path, ctx.firestore);
230
+ logs.firestorePathDeleted(path, true);
231
+ }
232
+ }
233
+ catch (err) {
234
+ logs.firestorePathError(path, err);
235
+ }
236
+ }));
237
+ await events.publishDeletionEvent("firestore", {
238
+ uid,
239
+ documentPaths: paths,
240
+ });
241
+ logs.firestoreDeleted();
242
+ }
243
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIH,wDAAqD;AACrD,gEAAiC;AACjC,MAAY,MAAM,qCAAiB;AACnC,uCAA+D;AAC/D,MAAY,IAAI,mCAAe;AAC/B,uDAAoD;AACpD,uEAGmC;AACnC,uEAAoE;AACpE,qCAAkC;AAmB3B,KAAK,yBACV,IAAuB,EACvB,GAAmB;IAEnB,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAiC,EAAE,CAAC;IACpD,MAAM,YAAY,GAAa,EAAE,CAAC;IAElC,KAAK,MAAM,YAAY,IAAI,IAAA,sBAAK,EAAS,KAAK,EAAE,GAAG,CAAC,EAAE,C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IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,GAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,MAAM,MAAM,CAAC,oBAAoB,CAAC,WAAW,EAAE;QAC7C,GAAG;QACH,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type DocumentReference } from "firebase-admin/firestore";
17
+ export declare const hasValidUserPath: (ref: DocumentReference, path: string, uid: string, searchFields: string) => Promise<boolean>;
18
+ export declare const extractUserPaths: (paths: string, uid: string) => string[];
19
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,iBAAiB,EAAa,MAAM,0BAA0B,CAAC;AAE7E,eAAO,MAAM,gBAAgB,QACtB,iBAAiB,QAChB,MAAM,OACP,MAAM,gBACG,MAAM,KACnB,OAAO,CAAC,OAAO,CAejB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,MAAM,OAAO,MAAM,KAAG,MAAM,EACP,CAAC"}
package/lib/helpers.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.extractUserPaths = exports.hasValidUserPath = void 0;
19
+ const firestore_1 = require("firebase-admin/firestore");
20
+ const hasValidUserPath = async (ref, path, uid, searchFields) => {
21
+ if (path.includes(uid))
22
+ return true;
23
+ if (searchFields.length === 0)
24
+ return false;
25
+ const snapshot = await ref.get();
26
+ if (snapshot.exists) {
27
+ for (const field of searchFields.split(",").filter(Boolean)) {
28
+ const fieldValue = snapshot.get(new firestore_1.FieldPath(field));
29
+ if (typeof fieldValue === "string" && fieldValue.includes(uid)) {
30
+ return true;
31
+ }
32
+ }
33
+ }
34
+ return false;
35
+ };
36
+ exports.hasValidUserPath = hasValidUserPath;
37
+ const extractUserPaths = (paths, uid) => paths.split(",").map((path) => path.replace(/{UID}/g, uid));
38
+ exports.extractUserPaths = extractUserPaths;
39
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,wDAA6E;AAEtE,MAAM,gBAAgB,GAAG,KAAK,EACnC,GAAsB,EACtB,IAAY,EACZ,GAAW,EACX,YAAoB,EACF,EAAE;IACpB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE5C,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC;IACjC,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5D,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,qBAAS,CAAC,KAAK,CAAC,CAAC,CAAC;YACtD,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC/D,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AApBW,QAAA,gBAAgB,GAAhB,gBAAgB,CAoB3B;AAEK,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,GAAW,EAAY,EAAE,CACvE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AADjD,QAAA,gBAAgB,GAAhB,gBAAgB,CACiC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import * as functionsV1 from "firebase-functions/v1";
2
+ export * from "./lib";
3
+ export declare const clearData: functionsV1.CloudFunction<import("firebase-admin/auth").UserRecord>;
4
+ export declare const handleSearch: import("firebase-functions/core").CloudFunction<import("firebase-functions/core").CloudEvent<import("firebase-functions/v2/pubsub").MessagePublishedData<any>>>;
5
+ export declare const handleDeletion: import("firebase-functions/core").CloudFunction<import("firebase-functions/core").CloudEvent<import("firebase-functions/v2/pubsub").MessagePublishedData<any>>>;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AAerD,cAAc,OAAO,CAAC;AAiDtB,eAAO,MAAM,SAAS,qEAEpB,CAAC;AAEH,eAAO,MAAM,YAAY,iKAKxB,CAAC;AAEF,eAAO,MAAM,cAAc,iKAK1B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2019 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
51
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.handleDeletion = exports.handleSearch = exports.clearData = void 0;
55
+ const pubsub_1 = require("@google-cloud/pubsub");
56
+ const admin = __importStar(require("firebase-admin"));
57
+ const firestore_1 = require("firebase-admin/firestore");
58
+ const functionsV1 = __importStar(require("firebase-functions/v1"));
59
+ const v2_1 = require("firebase-functions/v2");
60
+ const pubsub_2 = require("firebase-functions/v2/pubsub");
61
+ const config_1 = require("./config");
62
+ const events = __importStar(require("./events"));
63
+ const export_config_1 = require("./export-config");
64
+ const handlers_1 = require("./handlers");
65
+ const logs = __importStar(require("./logs"));
66
+ __exportStar(require("./lib"), exports);
67
+ const REQUIRED_ROLES = [
68
+ "roles/datastore.owner",
69
+ "roles/firebasedatabase.admin",
70
+ "roles/storage.admin",
71
+ "roles/pubsub.admin",
72
+ // Gen2 event triggers need Eventarc receive and run.invoker on the function SA.
73
+ "roles/eventarc.eventReceiver",
74
+ "roles/run.invoker",
75
+ ];
76
+ for (const role of REQUIRED_ROLES) {
77
+ (0, v2_1.requiresRole)(role);
78
+ }
79
+ let ctx;
80
+ function getContext() {
81
+ if (ctx) {
82
+ return ctx;
83
+ }
84
+ const resolved = (0, export_config_1.resolveDeleteUserDataConfig)((0, config_1.configFromEnv)());
85
+ const databaseURL = (0, export_config_1.getDatabaseUrl)(resolved.rtdbInstance, resolved.rtdbLocation);
86
+ if (admin.apps.length === 0) {
87
+ admin.initializeApp({
88
+ credential: admin.credential.applicationDefault(),
89
+ ...(databaseURL ? { databaseURL } : {}),
90
+ });
91
+ }
92
+ events.setupEventChannel();
93
+ logs.init(resolved);
94
+ ctx = {
95
+ firestore: (0, firestore_1.getFirestore)(resolved.firestoreDatabaseId),
96
+ storage: admin.storage(),
97
+ database: admin.database(),
98
+ pubsub: new pubsub_1.PubSub({ projectId: resolved.projectId }),
99
+ config: resolved,
100
+ };
101
+ return ctx;
102
+ }
103
+ exports.clearData = functionsV1.auth.user().onDelete((user) => {
104
+ return (0, handlers_1.handleClear)(user.uid, getContext());
105
+ });
106
+ exports.handleSearch = (0, pubsub_2.onMessagePublished)({
107
+ topic: config_1.CONFIG_EXPRESSIONS.discoveryTopicName,
108
+ }, (event) => (0, handlers_1.handleSearch)(event.data.message.json, getContext()));
109
+ exports.handleDeletion = (0, pubsub_2.onMessagePublished)({
110
+ topic: config_1.CONFIG_EXPRESSIONS.deletionTopicName,
111
+ }, (event) => (0, handlers_1.handleDeletion)(event.data.message.json, getContext()));
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iDAA8C;AAC9C,MAAY,KAAK,2CAAuB;AACxC,wDAAwD;AACxD,MAAY,WAAW,kDAA8B;AAErD,8CAAqD;AACrD,yDAAkE;AAClE,qCAA6D;AAC7D,MAAY,MAAM,qCAAiB;AACnC,mDAA8E;AAC9E,yCAKoB;AACpB,MAAY,IAAI,mCAAe;AAE/B,wCAAsB;AAEtB,MAAM,cAAc,GAAwB;IAC1C,uBAAuB;IACvB,8BAA8B;IAC9B,qBAAqB;IACrB,oBAAoB;IACpB,gFAAgF;IAChF,8BAA8B;IAC9B,mBAAmB;CACpB,CAAC;AAEF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CA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C,CAAC;AAEU,QAAA,YAAY,GAAG,IAAA,2BAAkB,EAC5C;IACE,KAAK,EAAE,2BAAkB,CAAC,kBAAkB;CAC7C,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,uBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAC5D,CAAC;AAEW,QAAA,cAAc,GAAG,IAAA,2BAAkB,EAC9C;IACE,KAAK,EAAE,2BAAkB,CAAC,iBAAiB;CAC5C,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,CAC9D,CAAC"}
package/lib/lib.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright 2026 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { type DeleteUserDataConfig, type FirestoreDeleteMode, getDatabaseUrl, type ResolvedDeleteUserDataConfig, resolveDeleteUserDataConfig, } from "./export-config";
17
+ export { type DeleteMessageData, type HandlerContext, handleClear, handleDeletion, handleSearch, type SearchMessageData, } from "./handlers";
18
+ export { extractUserPaths, hasValidUserPath } from "./helpers";
19
+ export { recursiveDelete } from "./recursiveDelete";
20
+ export { type DeletionPaths, type PublisherContext, publishSearch, runBatchPubSubDeletions, } from "./runBatchPubSubDeletions";
21
+ export { runCustomSearchFunction } from "./runCustomSearchFunction";
22
+ export { search } from "./search";
23
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,cAAc,EACd,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,aAAa,EACb,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
package/lib/lib.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.search = exports.runCustomSearchFunction = exports.runBatchPubSubDeletions = exports.publishSearch = exports.recursiveDelete = exports.hasValidUserPath = exports.extractUserPaths = exports.handleSearch = exports.handleDeletion = exports.handleClear = exports.resolveDeleteUserDataConfig = exports.getDatabaseUrl = void 0;
19
+ var export_config_1 = require("./export-config");
20
+ Object.defineProperty(exports, "getDatabaseUrl", { enumerable: true, get: function () { return export_config_1.getDatabaseUrl; } });
21
+ Object.defineProperty(exports, "resolveDeleteUserDataConfig", { enumerable: true, get: function () { return export_config_1.resolveDeleteUserDataConfig; } });
22
+ var handlers_1 = require("./handlers");
23
+ Object.defineProperty(exports, "handleClear", { enumerable: true, get: function () { return handlers_1.handleClear; } });
24
+ Object.defineProperty(exports, "handleDeletion", { enumerable: true, get: function () { return handlers_1.handleDeletion; } });
25
+ Object.defineProperty(exports, "handleSearch", { enumerable: true, get: function () { return handlers_1.handleSearch; } });
26
+ var helpers_1 = require("./helpers");
27
+ Object.defineProperty(exports, "extractUserPaths", { enumerable: true, get: function () { return helpers_1.extractUserPaths; } });
28
+ Object.defineProperty(exports, "hasValidUserPath", { enumerable: true, get: function () { return helpers_1.hasValidUserPath; } });
29
+ var recursiveDelete_1 = require("./recursiveDelete");
30
+ Object.defineProperty(exports, "recursiveDelete", { enumerable: true, get: function () { return recursiveDelete_1.recursiveDelete; } });
31
+ var runBatchPubSubDeletions_1 = require("./runBatchPubSubDeletions");
32
+ Object.defineProperty(exports, "publishSearch", { enumerable: true, get: function () { return runBatchPubSubDeletions_1.publishSearch; } });
33
+ Object.defineProperty(exports, "runBatchPubSubDeletions", { enumerable: true, get: function () { return runBatchPubSubDeletions_1.runBatchPubSubDeletions; } });
34
+ var runCustomSearchFunction_1 = require("./runCustomSearchFunction");
35
+ Object.defineProperty(exports, "runCustomSearchFunction", { enumerable: true, get: function () { return runCustomSearchFunction_1.runCustomSearchFunction; } });
36
+ var search_1 = require("./search");
37
+ Object.defineProperty(exports, "search", { enumerable: true, get: function () { return search_1.search; } });
38
+ //# sourceMappingURL=lib.js.map
package/lib/lib.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAMyB;AAHvB,+GAAA,cAAc,OAAA;AAEd,4HAAA,2BAA2B,OAAA;AAE7B,uCAOoB;AAJlB,uGAAA,WAAW,OAAA;AACX,0GAAA,cAAc,OAAA;AACd,wGAAA,YAAY,OAAA;AAGd,qCAA+D;AAAtD,2GAAA,gBAAgB,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAC3C,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,qEAKmC;AAFjC,wHAAA,aAAa,OAAA;AACb,kIAAA,uBAAuB,OAAA;AAEzB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
package/lib/logs.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import type { ResolvedDeleteUserDataConfig } from "./export-config";
2
+ export declare const complete: (uid: string) => void;
3
+ export declare const firestoreDeleted: () => void;
4
+ export declare const firestoreDeleting: () => void;
5
+ export declare const firestoreNotConfigured: () => void;
6
+ export declare const firestorePathDeleted: (path: string, recursive: boolean) => void;
7
+ export declare const firestorePathDeleting: (path: string, recursive: boolean) => void;
8
+ export declare const firestorePathError: (path: string, err: Error) => void;
9
+ export declare const init: (config: ResolvedDeleteUserDataConfig) => void;
10
+ export declare const rtdbDeleted: () => void;
11
+ export declare const rtdbDeleting: () => void;
12
+ export declare const rtdbPathDeleted: (path: string) => void;
13
+ export declare const rtdbNotConfigured: () => void;
14
+ export declare const rtdbPathDeleting: (path: string) => void;
15
+ export declare const rtdbPathError: (path: string, err: Error) => void;
16
+ export declare const start: (config: ResolvedDeleteUserDataConfig) => void;
17
+ export declare const storageDeleted: () => void;
18
+ export declare const storageDeleting: () => void;
19
+ export declare const storageNotConfigured: () => void;
20
+ export declare const storagePathDeleted: (path: string) => void;
21
+ export declare const storagePathDeleting: (path: string) => void;
22
+ export declare const storagePath404: (path: string) => void;
23
+ export declare const storagePathError: (path: string, err: Error) => void;
24
+ export declare const customFunctionError: (err: Error) => void;
25
+ export declare function warnInvalidPaths(invalidPathCount: number, uid: string): void;
26
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../src/logs.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAEpE,eAAO,MAAM,QAAQ,QAAS,MAAM,SAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAE5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAE7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAElC,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,aAAa,OAAO,SAMpE,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,MAAM,aAAa,OAAO,SAMrE,CAAC;AAEF,eAAO,MAAM,kBAAkB,SAAU,MAAM,OAAO,KAAK,SAE1D,CAAC;AAEF,eAAO,MAAM,IAAI,WAAY,4BAA4B,SAExD,CAAC;AAEF,eAAO,MAAM,WAAW,YAEvB,CAAC;AAEF,eAAO,MAAM,YAAY,YAExB,CAAC;AAEF,eAAO,MAAM,eAAe,SAAU,MAAM,SAE3C,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAE7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,MAAM,SAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,MAAM,OAAO,KAAK,SAKrD,CAAC;AAEF,eAAO,MAAM,KAAK,WAAY,4BAA4B,SAEzD,CAAC;AAEF,eAAO,MAAM,cAAc,YAE1B,CAAC;AAEF,eAAO,MAAM,eAAe,YAE3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAEhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,SAAU,MAAM,SAE9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,MAAM,SAE/C,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,M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