@donotdev/functions 0.0.3 → 0.0.4
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/firebase/index.js +30 -45
- package/lib/shared/index.js +5 -8
- package/lib/vercel/api/index.js +7 -11
- package/package.json +3 -3
package/lib/firebase/index.js
CHANGED
|
@@ -31217,14 +31217,11 @@ async function WR(e, t) {
|
|
|
31217
31217
|
let c = { success: !0, customClaims: s };
|
|
31218
31218
|
return (
|
|
31219
31219
|
n &&
|
|
31220
|
-
(await oe()
|
|
31221
|
-
|
|
31222
|
-
.
|
|
31223
|
-
.
|
|
31224
|
-
|
|
31225
|
-
processedAt: new Date().toISOString(),
|
|
31226
|
-
processedBy: t.uid,
|
|
31227
|
-
})),
|
|
31220
|
+
(await oe().collection('idempotency').doc(`claims_${n}`).set({
|
|
31221
|
+
result: c,
|
|
31222
|
+
processedAt: new Date().toISOString(),
|
|
31223
|
+
processedBy: t.uid,
|
|
31224
|
+
})),
|
|
31228
31225
|
c
|
|
31229
31226
|
);
|
|
31230
31227
|
}
|
|
@@ -32504,14 +32501,11 @@ function yI(e, t) {
|
|
|
32504
32501
|
w = Dt({ id: m.id, ...m.data() });
|
|
32505
32502
|
return (
|
|
32506
32503
|
s &&
|
|
32507
|
-
(await u
|
|
32508
|
-
|
|
32509
|
-
.
|
|
32510
|
-
|
|
32511
|
-
|
|
32512
|
-
processedAt: new Date().toISOString(),
|
|
32513
|
-
processedBy: c,
|
|
32514
|
-
})),
|
|
32504
|
+
(await u.collection('idempotency').doc(`create_${s}`).set({
|
|
32505
|
+
result: w,
|
|
32506
|
+
processedAt: new Date().toISOString(),
|
|
32507
|
+
processedBy: c,
|
|
32508
|
+
})),
|
|
32515
32509
|
w
|
|
32516
32510
|
);
|
|
32517
32511
|
}, 'createEntityLogic');
|
|
@@ -32632,14 +32626,11 @@ function wI(e, t) {
|
|
|
32632
32626
|
k = Dt({ id: C.id, ...C.data() });
|
|
32633
32627
|
return (
|
|
32634
32628
|
c &&
|
|
32635
|
-
(await u
|
|
32636
|
-
|
|
32637
|
-
.
|
|
32638
|
-
|
|
32639
|
-
|
|
32640
|
-
processedAt: new Date().toISOString(),
|
|
32641
|
-
processedBy: h,
|
|
32642
|
-
})),
|
|
32629
|
+
(await u.collection('idempotency').doc(`update_${c}`).set({
|
|
32630
|
+
result: k,
|
|
32631
|
+
processedAt: new Date().toISOString(),
|
|
32632
|
+
processedBy: h,
|
|
32633
|
+
})),
|
|
32643
32634
|
k
|
|
32644
32635
|
);
|
|
32645
32636
|
}, 'updateEntityLogic');
|
|
@@ -32682,19 +32673,16 @@ async function Cue(e, t, r, n = 'pull', i) {
|
|
|
32682
32673
|
});
|
|
32683
32674
|
}
|
|
32684
32675
|
(process.env.SAVE_GITHUB_ACCESS_TO_FIRESTORE === 'true' &&
|
|
32685
|
-
(await oe()
|
|
32686
|
-
|
|
32687
|
-
|
|
32688
|
-
|
|
32689
|
-
|
|
32690
|
-
|
|
32691
|
-
|
|
32692
|
-
|
|
32693
|
-
|
|
32694
|
-
|
|
32695
|
-
},
|
|
32696
|
-
{ merge: !0 }
|
|
32697
|
-
)),
|
|
32676
|
+
(await oe().collection('githubAccess').doc(e).set(
|
|
32677
|
+
{
|
|
32678
|
+
githubUsername: t,
|
|
32679
|
+
repoConfig: r,
|
|
32680
|
+
permission: n,
|
|
32681
|
+
accessGranted: !0,
|
|
32682
|
+
grantedAt: Date.now(),
|
|
32683
|
+
},
|
|
32684
|
+
{ merge: !0 }
|
|
32685
|
+
)),
|
|
32698
32686
|
kc.info('GitHub repository access granted', {
|
|
32699
32687
|
userId: e,
|
|
32700
32688
|
githubUsername: t,
|
|
@@ -32964,14 +32952,11 @@ var Jue = TI(async (e) => {
|
|
|
32964
32952
|
let C = { success: !0, credentials: S, profile: z };
|
|
32965
32953
|
return (
|
|
32966
32954
|
c &&
|
|
32967
|
-
(await oe()
|
|
32968
|
-
|
|
32969
|
-
.
|
|
32970
|
-
|
|
32971
|
-
|
|
32972
|
-
processedAt: new Date().toISOString(),
|
|
32973
|
-
processedBy: t,
|
|
32974
|
-
})),
|
|
32955
|
+
(await oe().collection('idempotency').doc(`oauth_${c}`).set({
|
|
32956
|
+
result: C,
|
|
32957
|
+
processedAt: new Date().toISOString(),
|
|
32958
|
+
processedBy: t,
|
|
32959
|
+
})),
|
|
32975
32960
|
C
|
|
32976
32961
|
);
|
|
32977
32962
|
} catch (h) {
|
package/lib/shared/index.js
CHANGED
|
@@ -31308,14 +31308,11 @@ async function c5e(e, t) {
|
|
|
31308
31308
|
o(c5e, 'checkIdempotency');
|
|
31309
31309
|
async function h5e(e, t, r, n) {
|
|
31310
31310
|
try {
|
|
31311
|
-
(await Ue()
|
|
31312
|
-
|
|
31313
|
-
.
|
|
31314
|
-
|
|
31315
|
-
|
|
31316
|
-
processedAt: new Date().toISOString(),
|
|
31317
|
-
processedBy: n,
|
|
31318
|
-
}),
|
|
31311
|
+
(await Ue().collection('idempotency').doc(`${t}_${e}`).set({
|
|
31312
|
+
result: r,
|
|
31313
|
+
processedAt: new Date().toISOString(),
|
|
31314
|
+
processedBy: n,
|
|
31315
|
+
}),
|
|
31319
31316
|
B1.info('Idempotency result stored', {
|
|
31320
31317
|
key: e,
|
|
31321
31318
|
operation: t,
|
package/lib/vercel/api/index.js
CHANGED
|
@@ -30612,23 +30612,19 @@ function Nr(e, t, r, o) {
|
|
|
30612
30612
|
return a.status(405).json({ error: 'Method not allowed' });
|
|
30613
30613
|
let l = Ft(t, i.body);
|
|
30614
30614
|
if (!l.success)
|
|
30615
|
-
return a
|
|
30616
|
-
.
|
|
30617
|
-
|
|
30618
|
-
error: `Validation failed: ${l.issues.map((S) => S.message).join(', ')}`,
|
|
30619
|
-
});
|
|
30615
|
+
return a.status(400).json({
|
|
30616
|
+
error: `Validation failed: ${l.issues.map((S) => S.message).join(', ')}`,
|
|
30617
|
+
});
|
|
30620
30618
|
let h = l.output,
|
|
30621
30619
|
d = P8(i.headers.authorization),
|
|
30622
30620
|
m = `${r}_${d}`,
|
|
30623
30621
|
p = O0[r] || O0.api,
|
|
30624
30622
|
f = await A8(m, p);
|
|
30625
30623
|
if (!f.allowed)
|
|
30626
|
-
return a
|
|
30627
|
-
.
|
|
30628
|
-
.
|
|
30629
|
-
|
|
30630
|
-
retryAfter: f.blockRemainingSeconds,
|
|
30631
|
-
});
|
|
30624
|
+
return a.status(429).json({
|
|
30625
|
+
error: `Rate limit exceeded. Try again in ${f.blockRemainingSeconds} seconds.`,
|
|
30626
|
+
retryAfter: f.blockRemainingSeconds,
|
|
30627
|
+
});
|
|
30632
30628
|
let z = await o(i, a, h, { uid: d });
|
|
30633
30629
|
return (
|
|
30634
30630
|
await D0({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/functions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backend functions for DoNotDev Framework - Firebase, Vercel, and platform-agnostic implementations for auth, billing, CRUD, and OAuth",
|
|
6
6
|
"main": "./lib/firebase/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"serve": "firebase emulators:start --only functions"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@donotdev/core": "0.0.
|
|
46
|
-
"@donotdev/firebase": "0.0.
|
|
45
|
+
"@donotdev/core": "0.0.4",
|
|
46
|
+
"@donotdev/firebase": "0.0.4"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@sentry/node": "^10.25.0",
|