@progressive-development/pd-provider-firebase-functions 0.4.0 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth-trash.d.ts","sourceRoot":"","sources":["../src/auth-trash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAgE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAQvG,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAEtC,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkCD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EACnD,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAmCvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
1
+ {"version":3,"file":"auth-trash.d.ts","sourceRoot":"","sources":["../src/auth-trash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,SAAS,CAAC;AAQjB,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,aAAa,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAEtC,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAoCD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EACnD,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CA0CvB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAuCf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAmCf"}
@@ -1,5 +1,5 @@
1
1
  import { getAuth } from 'firebase-admin/auth';
2
- import { moveToTrash, getTrashItem, restoreFromTrash, permanentDelete } from './trash.js';
2
+ import { moveToTrash, getTrashItem, permanentDelete, restoreFromTrash } from './trash.js';
3
3
  import { NotFoundError } from './errors.js';
4
4
  import { logger } from './logger.js';
5
5
 
@@ -11,20 +11,28 @@ function getAuthUidFromTrashItem(trashItem, options) {
11
11
  const data = trashItem.data;
12
12
  const uid = data[source];
13
13
  if (typeof uid !== "string" || !uid) {
14
- throw new Error(`Auth UID field '${source}' not found or empty in trash item data`);
14
+ throw new Error(
15
+ `Auth UID field '${source}' not found or empty in trash item data`
16
+ );
15
17
  }
16
18
  return uid;
17
19
  }
18
20
  async function moveToTrashWithAuth(collection, documentId, deletedBy, objectType, options) {
19
21
  const authUid = options?.authUidSource === "documentId" || !options?.authUidSource ? documentId : documentId;
20
- logger.info("Disabling Auth user before trash", { authUid, collection, documentId });
22
+ logger.info("Disabling Auth user before trash", {
23
+ authUid,
24
+ collection,
25
+ documentId
26
+ });
21
27
  try {
22
28
  await getAuth().updateUser(authUid, { disabled: true });
23
29
  logger.info("Auth user disabled", { authUid });
24
30
  } catch (error) {
25
31
  const authError = error;
26
32
  if (authError.code === "auth/user-not-found") {
27
- logger.info("Auth user not found, continuing with trash operation", { authUid });
33
+ logger.info("Auth user not found, continuing with trash operation", {
34
+ authUid
35
+ });
28
36
  } else {
29
37
  throw error;
30
38
  }
@@ -56,14 +64,20 @@ async function restoreFromTrashWithAuth(trashItemId, options) {
56
64
  await restoreFromTrash(trashItemId, options?.databaseId);
57
65
  try {
58
66
  await getAuth().updateUser(authUid, { disabled: false });
59
- logger.info("Document restored and Auth user re-enabled", { trashItemId, authUid });
67
+ logger.info("Document restored and Auth user re-enabled", {
68
+ trashItemId,
69
+ authUid
70
+ });
60
71
  } catch (error) {
61
72
  const authError = error;
62
73
  if (authError.code === "auth/user-not-found") {
63
- logger.warn("Document restored but Auth user not found - manual Auth user creation required", {
64
- trashItemId,
65
- authUid
66
- });
74
+ logger.warn(
75
+ "Document restored but Auth user not found - manual Auth user creation required",
76
+ {
77
+ trashItemId,
78
+ authUid
79
+ }
80
+ );
67
81
  } else {
68
82
  throw error;
69
83
  }
@@ -82,11 +96,17 @@ async function permanentDeleteWithAuth(trashItemId, options) {
82
96
  await permanentDelete(trashItemId, options?.databaseId);
83
97
  try {
84
98
  await getAuth().deleteUser(authUid);
85
- logger.info("Trash item and Auth user permanently deleted", { trashItemId, authUid });
99
+ logger.info("Trash item and Auth user permanently deleted", {
100
+ trashItemId,
101
+ authUid
102
+ });
86
103
  } catch (error) {
87
104
  const authError = error;
88
105
  if (authError.code === "auth/user-not-found") {
89
- logger.info("Auth user not found, trash item deleted", { trashItemId, authUid });
106
+ logger.info("Auth user not found, trash item deleted", {
107
+ trashItemId,
108
+ authUid
109
+ });
90
110
  } else {
91
111
  throw error;
92
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,WAAW,CASjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,EAAE,GACrB,WAAW,CAUb;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI,CAMjF"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,WAAW,CASjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,EAAE,GACrB,WAAW,CAUb;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,EACjB,eAAe,EAAE,MAAM,GACtB,IAAI,CAMN"}
@@ -1 +1 @@
1
- {"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
1
+ {"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../src/counter.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAejB"}
package/dist/counter.js CHANGED
@@ -8,7 +8,11 @@ async function getNextCounter(counterName, databaseId) {
8
8
  const doc = await transaction.get(counterRef);
9
9
  const current = doc.exists ? doc.data()?.value ?? 0 : 0;
10
10
  const next = current + 1;
11
- transaction.set(counterRef, { value: next, updatedAt: /* @__PURE__ */ new Date() }, { merge: true });
11
+ transaction.set(
12
+ counterRef,
13
+ { value: next, updatedAt: /* @__PURE__ */ new Date() },
14
+ { merge: true }
15
+ );
12
16
  return next;
13
17
  });
14
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"import-templates.d.ts","sourceRoot":"","sources":["../src/import-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,qBAAqB;IACpC,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA6CD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2FrF"}
1
+ {"version":3,"file":"import-templates.d.ts","sourceRoot":"","sources":["../src/import-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,qBAAqB;IACpC,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAiDD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Ff"}
@@ -3,7 +3,9 @@ import { scriptLog, createScriptContext } from './script-helpers.js';
3
3
 
4
4
  function findTemplates(templatesDir) {
5
5
  const files = readdirSync(templatesDir);
6
- const jsonFiles = files.filter((f) => f.endsWith(".json") && f !== "serviceAccountKey.json");
6
+ const jsonFiles = files.filter(
7
+ (f) => f.endsWith(".json") && f !== "serviceAccountKey.json"
8
+ );
7
9
  return jsonFiles.map((f) => f.replace(".json", ""));
8
10
  }
9
11
  function loadTemplate(templatesDir, name) {
@@ -22,7 +24,9 @@ function loadTemplate(templatesDir, name) {
22
24
  scriptLog(`Text template not found: ${textPath}`, "error");
23
25
  return null;
24
26
  }
25
- const metadata = JSON.parse(readFileSync(jsonPath, "utf-8"));
27
+ const metadata = JSON.parse(
28
+ readFileSync(jsonPath, "utf-8")
29
+ );
26
30
  const html = readFileSync(htmlPath, "utf-8");
27
31
  const text = readFileSync(textPath, "utf-8");
28
32
  return { ...metadata, html, text };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export type { ApiResponse, AuthContext } from './types';
2
2
  export { StatusCode } from './types';
3
- export { AppError, ValidationError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, EmailAlreadyUsedError, SC_EMAIL_ALREADY_USED } from './errors';
3
+ export { AppError, ValidationError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, EmailAlreadyUsedError, SC_EMAIL_ALREADY_USED, } from './errors';
4
4
  export { requireAuth, requireClaims, requireOwnership } from './auth';
5
5
  export { success, created, handleError } from './response';
6
6
  export { getDb } from './firestore';
7
7
  export { getNextCounter } from './counter';
8
8
  export type { TrashItem } from './trash';
9
- export { moveToTrash, restoreFromTrash, permanentDelete, listTrash, getTrashItem } from './trash';
9
+ export { moveToTrash, restoreFromTrash, permanentDelete, listTrash, getTrashItem, } from './trash';
10
10
  export type { AuthTrashOptions } from './auth-trash';
11
- export { moveToTrashWithAuth, restoreFromTrashWithAuth, permanentDeleteWithAuth } from './auth-trash';
11
+ export { moveToTrashWithAuth, restoreFromTrashWithAuth, permanentDeleteWithAuth, } from './auth-trash';
12
12
  export { logger } from './logger';
13
- export type { LogType, ScriptContextConfig, ScriptContext } from './script-helpers';
14
- export { scriptLog, initFirebaseAdmin, createScriptContext } from './script-helpers';
13
+ export type { LogType, ScriptContextConfig, ScriptContext, } from './script-helpers';
14
+ export { scriptLog, initFirebaseAdmin, createScriptContext, } from './script-helpers';
15
15
  export type { ImportTemplatesConfig } from './import-templates';
16
16
  export { runImportTemplates } from './import-templates';
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGpK,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGlG,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGtG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,YAAY,EAAE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGrF,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EACL,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,YAAY,EACV,OAAO,EACP,mBAAmB,EACnB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAIlD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAElD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAElD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBxF"}
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAIlD,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAElD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAElD;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GACb,WAAW,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB9C"}
package/dist/response.js CHANGED
@@ -13,7 +13,10 @@ function handleError(error) {
13
13
  if (error.statusCode >= 500) {
14
14
  logger.error("App error", error);
15
15
  } else {
16
- logger.warn("Request error", { code: error.code, message: error.message });
16
+ logger.warn("Request error", {
17
+ code: error.code,
18
+ message: error.message
19
+ });
17
20
  }
18
21
  return {
19
22
  statusCode: error.statusCode,
@@ -1 +1 @@
1
- {"version":3,"file":"script-helpers.d.ts","sourceRoot":"","sources":["../src/script-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAS5D;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAgB,GAAG,IAAI,CAEvE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CASlE;AAMD,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,EAAE,EAAE,SAAS,CAAC;IACd,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa,CA6B9E"}
1
+ {"version":3,"file":"script-helpers.d.ts","sourceRoot":"","sources":["../src/script-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAS5D;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,OAAgB,GAAG,IAAI,CAEvE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAWlE;AAMD,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,EAAE,EAAE,SAAS,CAAC;IACd,qCAAqC;IACrC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,GAC1B,aAAa,CA+Bf"}
@@ -1,5 +1,5 @@
1
1
  import { getApps, initializeApp, cert } from 'firebase-admin/app';
2
- import { readFileSync, existsSync } from 'fs';
2
+ import { existsSync, readFileSync } from 'fs';
3
3
  import { getDb } from './firestore.js';
4
4
 
5
5
  const LOG_PREFIX = {
@@ -13,7 +13,9 @@ function scriptLog(message, type = "info") {
13
13
  }
14
14
  function initFirebaseAdmin(serviceAccountPath) {
15
15
  if (getApps().length > 0) return;
16
- const serviceAccount = JSON.parse(readFileSync(serviceAccountPath, "utf-8"));
16
+ const serviceAccount = JSON.parse(
17
+ readFileSync(serviceAccountPath, "utf-8")
18
+ );
17
19
  initializeApp({
18
20
  credential: cert(serviceAccount),
19
21
  databaseURL: `https://${serviceAccount.projectId}.firebaseio.com`
@@ -31,8 +33,10 @@ ${title}
31
33
  Expected: ${serviceAccountPath}`);
32
34
  console.log(`
33
35
  Download from Firebase Console:`);
34
- console.log(` Project Settings > Service Accounts > Generate new private key
35
- `);
36
+ console.log(
37
+ ` Project Settings > Service Accounts > Generate new private key
38
+ `
39
+ );
36
40
  process.exit(1);
37
41
  }
38
42
  initFirebaseAdmin(serviceAccountPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-provider-firebase-functions",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Firebase Functions v2 utilities for pd-spa-helper backend",
5
5
  "author": "PD Progressive Development",
6
6
  "license": "SEE LICENSE IN LICENSE",