@fireemu/linux-arm64 0.29.0 → 0.30.0
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 +1 -1
- package/bin/fireemu +0 -0
- package/bin/runner-node/index.mjs +38 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @fireemu/linux-arm64
|
|
2
2
|
|
|
3
3
|
The [fireemu](https://www.npmjs.com/package/fireemu) daemon built for `linux-arm64`
|
|
4
|
-
(Rust target `aarch64-unknown-linux-musl`), version 0.
|
|
4
|
+
(Rust target `aarch64-unknown-linux-musl`), version 0.30.0.
|
|
5
5
|
|
|
6
6
|
Statically linked against musl: any glibc or musl distribution, including distroless and Alpine.
|
|
7
7
|
|
package/bin/fireemu
CHANGED
|
Binary file
|
|
@@ -726,13 +726,6 @@ function ignoredBlocking(base, eventType) {
|
|
|
726
726
|
// Products the official emulator has a trigger service for and fireemu does not serve.
|
|
727
727
|
// The event-type substring is matched the way `getServiceFromEventType` matches it.
|
|
728
728
|
const DEFERRED_TRIGGER_PRODUCTS = [
|
|
729
|
-
{
|
|
730
|
-
match: (type) =>
|
|
731
|
-
type.includes("firebase.database") || type.includes("google.firebase.database"),
|
|
732
|
-
triggerType: "database",
|
|
733
|
-
scope: "deferred",
|
|
734
|
-
reason: "deferred: the Realtime Database emulator is not in the active supported surface",
|
|
735
|
-
},
|
|
736
729
|
{
|
|
737
730
|
match: (type) => type.includes("remoteconfig"),
|
|
738
731
|
triggerType: "remoteConfig",
|
|
@@ -774,6 +767,16 @@ function deferredProduct(type) {
|
|
|
774
767
|
// firebase-functions v1 triggers: legacy event types and a resource pattern.
|
|
775
768
|
function describeV1Event(base, type, resource, schedule, retry) {
|
|
776
769
|
const v1 = { v1: true };
|
|
770
|
+
const dbMatch = type.match(/^providers\/google\.firebase\.database\/eventTypes\/ref\.(create|update|delete|write)$/);
|
|
771
|
+
if (dbMatch) {
|
|
772
|
+
resource = triggerString(resource, "eventTrigger.resource", { optional: true, allowEmpty: true }) ?? "";
|
|
773
|
+
const match = resource.match(/^projects\/_\/instances\/([^/]+)\/refs(?:\/(.*))?$/s);
|
|
774
|
+
if (!match) return ignored(base, "database", "unsupported", "v1 Database resource has an unsupported shape");
|
|
775
|
+
return { ...base, ...v1, retry, trigger: {
|
|
776
|
+
type: "database", instance: match[1], ref: `/${match[2] || ""}`,
|
|
777
|
+
eventType: `google.firebase.database.ref.v1.${{create:"created",update:"updated",delete:"deleted",write:"written"}[dbMatch[1]]}`,
|
|
778
|
+
}};
|
|
779
|
+
}
|
|
777
780
|
const fsMatch = type.match(
|
|
778
781
|
/^providers\/cloud\.firestore\/eventTypes\/document\.(create|update|delete|write)$/,
|
|
779
782
|
);
|
|
@@ -981,6 +984,17 @@ function describe(name, fn, instrumentation) {
|
|
|
981
984
|
const et = ep.eventTrigger;
|
|
982
985
|
const type = et.eventType || "";
|
|
983
986
|
base.retry = resolvedBoolean(et.retry, "eventTrigger.retry") ?? false;
|
|
987
|
+
if (type.startsWith("google.firebase.database.ref.v1.")) {
|
|
988
|
+
const filters = triggerRecord(et.eventFilters, "eventFilters");
|
|
989
|
+
const patterns = triggerRecord(et.eventFilterPathPatterns, "eventFilterPathPatterns");
|
|
990
|
+
const reference = triggerString(patterns.ref, "eventFilterPathPatterns.ref", { optional: true }) ??
|
|
991
|
+
triggerString(filters.ref, "eventFilters.ref");
|
|
992
|
+
return { ...base, trigger: {
|
|
993
|
+
type: "database", eventType: type, ref: `/${reference.replace(/^\/+|\/+$/g, "")}`,
|
|
994
|
+
instance: triggerString(patterns.instance, "eventFilterPathPatterns.instance", { optional: true }) ??
|
|
995
|
+
triggerString(filters.instance, "eventFilters.instance", { optional: true }) ?? "*",
|
|
996
|
+
}};
|
|
997
|
+
}
|
|
984
998
|
if (type.startsWith("google.cloud.firestore.")) {
|
|
985
999
|
const filters = triggerRecord(et.eventFilters, "eventFilters");
|
|
986
1000
|
const patterns = triggerRecord(et.eventFilterPathPatterns, "eventFilterPathPatterns");
|
|
@@ -1140,6 +1154,19 @@ const strictProfile = () => process.env.FIREEMU_HTTP_PROFILE === "strict";
|
|
|
1140
1154
|
function v1Context(msg) {
|
|
1141
1155
|
const event = msg.event;
|
|
1142
1156
|
switch (msg.trigger) {
|
|
1157
|
+
case "database": {
|
|
1158
|
+
const operation = {created:"create",updated:"update",deleted:"delete",written:"write"}[event.type.split(".").at(-1)];
|
|
1159
|
+
const context = {
|
|
1160
|
+
eventId: event.id, timestamp: event.time,
|
|
1161
|
+
eventType: `providers/google.firebase.database/eventTypes/ref.${operation}`,
|
|
1162
|
+
resource: `projects/_/instances/${event.instance}/refs/${event.ref}`,
|
|
1163
|
+
domain: event.firebasedatabasehost,
|
|
1164
|
+
authType: {admin:"ADMIN",app_user:"USER",unauthenticated:"UNAUTHENTICATED"}[event.authtype],
|
|
1165
|
+
};
|
|
1166
|
+
if (context.authType === "USER") context.auth = {variable:event.auth};
|
|
1167
|
+
if (context.authType === "ADMIN") context.auth = {admin:true};
|
|
1168
|
+
return context;
|
|
1169
|
+
}
|
|
1143
1170
|
case "firestore": {
|
|
1144
1171
|
const legacy = {
|
|
1145
1172
|
"google.cloud.firestore.document.v1.created":
|
|
@@ -1510,7 +1537,7 @@ async function invoke(functions, manifest, msg) {
|
|
|
1510
1537
|
throw new Error("entry point does not match the function manifest");
|
|
1511
1538
|
}
|
|
1512
1539
|
if (msg.trigger !== spec.trigger?.type ||
|
|
1513
|
-
!["schedule", "firestore", "storage", "pubsub", "eventarc", "auth"].includes(msg.trigger)) {
|
|
1540
|
+
!["schedule", "database", "firestore", "storage", "pubsub", "eventarc", "auth"].includes(msg.trigger)) {
|
|
1514
1541
|
throw new Error("trigger does not match the function manifest");
|
|
1515
1542
|
}
|
|
1516
1543
|
const fn = functions.get(spec.entryPoint);
|
|
@@ -1532,6 +1559,9 @@ async function invoke(functions, manifest, msg) {
|
|
|
1532
1559
|
return;
|
|
1533
1560
|
}
|
|
1534
1561
|
switch (msg.trigger) {
|
|
1562
|
+
case "database":
|
|
1563
|
+
await fn(msg.event);
|
|
1564
|
+
return;
|
|
1535
1565
|
case "schedule": {
|
|
1536
1566
|
// The strict profile calls the function the way production's Scheduler does, through its HTTP wrapper,
|
|
1537
1567
|
// so the SDK builds the event from the scheduler headers (job id, Los Angeles time, `context` getter)
|