@farm.js/core 0.1.16 → 0.1.17
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/dist/agent-runtime.d.mts +3 -3
- package/dist/agent-runtime.d.ts +3 -3
- package/dist/api/client.cjs +62 -28
- package/dist/api/client.d.mts +3 -3
- package/dist/api/client.d.ts +3 -3
- package/dist/api/client.mjs +3 -3
- package/dist/api/route-manager.cjs +69 -32
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +65 -29
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api/runtime.mjs +6 -3
- package/dist/{api-client-B-n3pm_Q.d.mts → api-client-Cx54IR5g.d.mts} +2 -2
- package/dist/{api-client-C0_NZEBl.d.ts → api-client-DykpaKcY.d.ts} +2 -2
- package/dist/api.cjs +106 -33
- package/dist/api.d.mts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/api.mjs +8 -8
- package/dist/{app-AyjEsCBq.d.ts → app-BHY_10Lm.d.ts} +3 -3
- package/dist/{app-CYPHeOo_.d.mts → app-BMk0do23.d.mts} +3 -3
- package/dist/app-markdown.d.mts +4 -4
- package/dist/app-markdown.d.ts +4 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/cache.cjs +62 -28
- package/dist/cache.d.mts +11 -1
- package/dist/cache.d.ts +11 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-7HDZYYS4.mjs → chunk-4OOBRCJX.mjs} +27 -5
- package/dist/{chunk-NHHKW2T6.mjs → chunk-56DAX2BE.mjs} +170 -52
- package/dist/{chunk-B76DT5Y6.mjs → chunk-57J3Y7Y3.mjs} +1 -1
- package/dist/{chunk-MOQNHLTS.mjs → chunk-5QOEPUYE.mjs} +5 -2
- package/dist/{chunk-HKLRP3BN.mjs → chunk-5SPPCN5J.mjs} +1 -1
- package/dist/{chunk-LUC2FAGW.mjs → chunk-6VQIKZZO.mjs} +1 -1
- package/dist/{chunk-7ZWL7XOU.mjs → chunk-76DG3LF3.mjs} +1 -1
- package/dist/{chunk-EWDK36MM.mjs → chunk-A72YEUZ3.mjs} +1 -1
- package/dist/{chunk-ZHOIQC6U.mjs → chunk-ATERBVHQ.mjs} +2 -2
- package/dist/{chunk-27JNCYEK.mjs → chunk-EN7WTEAY.mjs} +2 -2
- package/dist/{chunk-IGO2HEV7.mjs → chunk-F6SJAKFJ.mjs} +62 -28
- package/dist/{chunk-GSDIZACQ.mjs → chunk-FG5H2VCJ.mjs} +2 -2
- package/dist/{chunk-LZK5CXDW.mjs → chunk-KLSSO6YD.mjs} +2 -2
- package/dist/{chunk-KUO3GBPK.mjs → chunk-L6V3P73N.mjs} +1 -1
- package/dist/{chunk-TYVVIQ5M.mjs → chunk-MVIWBEJF.mjs} +32 -25
- package/dist/{chunk-KTGFMHET.mjs → chunk-N6UROPT7.mjs} +1 -1
- package/dist/{chunk-NDD2YVGU.mjs → chunk-NRVGEI5I.mjs} +10 -3
- package/dist/{chunk-IXTEENRS.mjs → chunk-QGVJVSNX.mjs} +5 -5
- package/dist/{chunk-6SCB2MXB.mjs → chunk-SXHV42UQ.mjs} +16 -1
- package/dist/{chunk-OWTIOHON.mjs → chunk-SYGGPS4A.mjs} +2 -2
- package/dist/{chunk-NC333MFA.mjs → chunk-TSWW5BVH.mjs} +7 -4
- package/dist/{chunk-LK6FGAQR.mjs → chunk-UDBJCUPA.mjs} +7 -4
- package/dist/{chunk-NUD6XBMO.mjs → chunk-UTBVHYS3.mjs} +2 -2
- package/dist/{chunk-76MNRHTS.mjs → chunk-UUYF3CHN.mjs} +2 -2
- package/dist/{chunk-VVTREAG5.mjs → chunk-WD4YXVLV.mjs} +11 -3
- package/dist/{chunk-UQZPTIML.mjs → chunk-WD5PNSOB.mjs} +2 -2
- package/dist/{chunk-DPZUDPVJ.mjs → chunk-XP777LRD.mjs} +1 -1
- package/dist/{chunk-KATQ6I56.mjs → chunk-XWAYMDLB.mjs} +1 -1
- package/dist/{chunk-IL5RWYK7.mjs → chunk-YD4J4XCI.mjs} +1 -1
- package/dist/{chunk-Q3MDL7TM.mjs → chunk-ZCNJKLA2.mjs} +30 -11
- package/dist/{client-plugins-CqVtZi5X.d.ts → client-plugins-C089bQhN.d.ts} +2 -2
- package/dist/{client-plugins-CIPRtSsW.d.mts → client-plugins-JXXmZliS.d.mts} +2 -2
- package/dist/client-plugins.d.mts +3 -3
- package/dist/client-plugins.d.ts +3 -3
- package/dist/client.cjs +62 -28
- package/dist/client.d.mts +8 -8
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +6 -6
- package/dist/config.d.mts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/cron.mjs +2 -2
- package/dist/{devtools-IU7LKZOH.mjs → devtools-UFVTMQX5.mjs} +7 -7
- package/dist/docs.cjs +18 -10
- package/dist/docs.mjs +9 -9
- package/dist/{endpoint-kSAxE52R.d.ts → endpoint-1zA994xL.d.ts} +1 -1
- package/dist/{endpoint-Bu3XgeMK.d.mts → endpoint-DAc96i93.d.mts} +1 -1
- package/dist/env.cjs +39 -5
- package/dist/env.d.mts +5 -3
- package/dist/env.d.ts +5 -3
- package/dist/env.mjs +2 -1
- package/dist/index.cjs +311 -93
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +34 -34
- package/dist/integrations.d.mts +3 -3
- package/dist/integrations.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +342 -121
- package/dist/internal/build-runtime.d.mts +5 -5
- package/dist/internal/build-runtime.d.ts +5 -5
- package/dist/internal/build-runtime.mjs +23 -23
- package/dist/internal/cli-runtime.cjs +77 -31
- package/dist/internal/cli-runtime.mjs +13 -13
- package/dist/internal/client-error-overlay.cjs +1 -1
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +3 -3
- package/dist/internal/compression-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.cjs +14 -2
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +101 -41
- package/dist/internal/production-runtime.d.mts +9 -9
- package/dist/internal/production-runtime.d.ts +9 -9
- package/dist/internal/production-runtime.mjs +6 -6
- package/dist/markdown.cjs +16 -1
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-8g__AMPM.d.ts → metadata-BcNJP4fq.d.ts} +1 -1
- package/dist/{metadata-OMX6wFNf.d.mts → metadata-C1Z9vLbb.d.mts} +1 -1
- package/dist/middleware.cjs +10 -3
- package/dist/middleware.d.mts +5 -5
- package/dist/middleware.d.ts +5 -5
- package/dist/middleware.mjs +4 -4
- package/dist/{nitro-3N4ZXRYM.mjs → nitro-CVZ36JM5.mjs} +4 -4
- package/dist/plugin.cjs +256 -105
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime-W3M0eNDV.d.mts → production-runtime-jcrTlRTb.d.mts} +1 -1
- package/dist/{production-runtime-BJh7o6Cr.d.ts → production-runtime-oKmC0WU-.d.ts} +1 -1
- package/dist/{render-plan-io7pvDNc.d.mts → render-plan-BLIfc4jt.d.mts} +1 -1
- package/dist/{render-plan-Be4ZGTJP.d.ts → render-plan-DOB9cV-h.d.ts} +1 -1
- package/dist/renderer-client.cjs +62 -28
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +3 -3
- package/dist/{request-DZkHYQ89.d.mts → request-Cr53NRHr.d.mts} +1 -1
- package/dist/{request-G8JhKr4F.d.ts → request-Dt2gNuQD.d.ts} +1 -1
- package/dist/request.d.mts +4 -4
- package/dist/request.d.ts +4 -4
- package/dist/{route-C_eLaFTZ.d.mts → route-B0XrsrFk.d.mts} +1 -1
- package/dist/{route-BxNJT447.d.ts → route-DOEpbyWZ.d.ts} +1 -1
- package/dist/{route-rendering-BcLLPJgN.d.ts → route-rendering-CWYd8Mv1.d.ts} +1 -1
- package/dist/{route-rendering-CbAKr1TY.d.mts → route-rendering-CeFBEAoZ.d.mts} +1 -1
- package/dist/routes.cjs +68 -31
- package/dist/routes.d.mts +4 -4
- package/dist/routes.d.ts +4 -4
- package/dist/routes.mjs +2 -2
- package/dist/server-fn-client.d.mts +3 -3
- package/dist/server-fn-client.d.ts +3 -3
- package/dist/server-fn.cjs +72 -30
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.d.mts +4 -4
- package/dist/server-plugins.d.ts +4 -4
- package/dist/server-query-client.cjs +62 -28
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query-client.mjs +4 -4
- package/dist/server-query.cjs +72 -30
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +239 -80
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +22 -22
- package/dist/{spa-router-BcS_4nqm.d.mts → spa-router-CQWiYGxS.d.mts} +2 -2
- package/dist/{spa-router-BzFBUJkn.d.ts → spa-router-Wjiw-8hB.d.ts} +2 -2
- package/dist/testing.cjs +73 -32
- package/dist/testing.d.mts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.mjs +11 -7
- package/dist/{utils-C4yrAhNc.d.ts → utils-B0XJmG_b.d.ts} +1 -1
- package/dist/{utils-5kQP1mFR.d.mts → utils-uUxF0K0P.d.mts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +260 -109
- package/dist/vite.d.mts +3 -3
- package/dist/vite.d.ts +3 -3
- package/dist/vite.mjs +19 -19
- package/dist/workflows.mjs +2 -2
- package/package.json +2 -2
- package/dist/{chunk-VO5SCWF5.mjs → chunk-BNGS6KJ6.mjs} +0 -0
- package/dist/{chunk-MUUZJLCI.mjs → chunk-EGJDUF4Q.mjs} +3 -3
- package/dist/{chunk-4L7SZOHZ.mjs → chunk-YHOCRI4H.mjs} +3 -3
package/dist/api/runtime.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(runtime_exports, {
|
|
|
26
26
|
createStaticAPIRouteMatcherAtBasePath: () => createStaticAPIRouteMatcherAtBasePath,
|
|
27
27
|
getAllowedAPIRouteMethods: () => getAllowedAPIRouteMethods,
|
|
28
28
|
invokeAPIRouteEndpoint: () => invokeAPIRouteEndpoint,
|
|
29
|
+
isEndpointFailure: () => isEndpointFailure,
|
|
29
30
|
isFarmAPIPathname: () => isFarmAPIPathname,
|
|
30
31
|
isWebResponse: () => isWebResponse,
|
|
31
32
|
matchAPIRoute: () => matchAPIRoute,
|
|
@@ -518,6 +519,8 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
518
519
|
constructor(config = {}) {
|
|
519
520
|
this.entries = /* @__PURE__ */ new Map();
|
|
520
521
|
this.inflight = /* @__PURE__ */ new Map();
|
|
522
|
+
/** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
|
|
523
|
+
this.entriesByTag = /* @__PURE__ */ new Map();
|
|
521
524
|
this.invalidatedTagVersions = /* @__PURE__ */ new Map();
|
|
522
525
|
this.activeGenerations = /* @__PURE__ */ new Set();
|
|
523
526
|
this.version = 0;
|
|
@@ -536,6 +539,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
536
539
|
configure(config = {}) {
|
|
537
540
|
this.generation++;
|
|
538
541
|
this.entries.clear();
|
|
542
|
+
this.entriesByTag.clear();
|
|
539
543
|
this.inflight.clear();
|
|
540
544
|
this.invalidatedTagVersions.clear();
|
|
541
545
|
this.activeGenerations.clear();
|
|
@@ -702,14 +706,12 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
702
706
|
return entry;
|
|
703
707
|
}
|
|
704
708
|
delete(key) {
|
|
705
|
-
const deleted = this.
|
|
706
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
709
|
+
const deleted = this.deleteLocalEntry(key);
|
|
707
710
|
emitFarmEvent({ type: "cache.delete", key, deleted });
|
|
708
711
|
return deleted;
|
|
709
712
|
}
|
|
710
713
|
async deleteAsync(key) {
|
|
711
|
-
const deleted = this.
|
|
712
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
714
|
+
const deleted = this.deleteLocalEntry(key);
|
|
713
715
|
if (this.adapter) {
|
|
714
716
|
await this.adapter.delete(this.createAdapterKey(key));
|
|
715
717
|
}
|
|
@@ -720,6 +722,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
720
722
|
const count = this.entries.size;
|
|
721
723
|
this.generation++;
|
|
722
724
|
this.entries.clear();
|
|
725
|
+
this.entriesByTag.clear();
|
|
723
726
|
this.inflight.clear();
|
|
724
727
|
this.invalidatedTagVersions.clear();
|
|
725
728
|
this.activeGenerations.clear();
|
|
@@ -805,23 +808,32 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
805
808
|
return cached.value;
|
|
806
809
|
}
|
|
807
810
|
const inflight = this.inflight.get(key);
|
|
808
|
-
if (inflight) {
|
|
811
|
+
if (inflight && !this.wasInvalidatedSince(inflight.tags, inflight.startVersion)) {
|
|
809
812
|
emitFarmEvent({ type: "cache.dedupe", key });
|
|
810
|
-
return inflight;
|
|
813
|
+
return inflight.promise;
|
|
811
814
|
}
|
|
812
815
|
const tags = Array.from(normalizeCacheOptionsTags(options));
|
|
813
816
|
const generation = this.generation;
|
|
817
|
+
const startVersion = this.version;
|
|
814
818
|
const promise = this.fillCacheEntry(key, producer, options, tags, generation).catch((error) => {
|
|
815
819
|
emitFarmEvent({ type: "cache.error", key, operation: "set", error });
|
|
816
820
|
throw error;
|
|
817
821
|
}).finally(() => {
|
|
818
|
-
if (this.inflight.get(key) === promise) {
|
|
822
|
+
if (this.inflight.get(key)?.promise === promise) {
|
|
819
823
|
this.inflight.delete(key);
|
|
820
824
|
}
|
|
821
825
|
});
|
|
822
|
-
this.inflight.set(key, promise);
|
|
826
|
+
this.inflight.set(key, { promise, tags, startVersion });
|
|
823
827
|
return promise;
|
|
824
828
|
}
|
|
829
|
+
/** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
|
|
830
|
+
wasInvalidatedSince(tags, version) {
|
|
831
|
+
for (const tag of tags) {
|
|
832
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
833
|
+
if (invalidatedVersion !== void 0 && invalidatedVersion > version) return true;
|
|
834
|
+
}
|
|
835
|
+
return false;
|
|
836
|
+
}
|
|
825
837
|
async fillCacheEntry(key, producer, options, tags, generation) {
|
|
826
838
|
const adapter = this.adapter;
|
|
827
839
|
const namespace = this.namespace;
|
|
@@ -862,7 +874,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
862
874
|
return value;
|
|
863
875
|
} finally {
|
|
864
876
|
this.activeGenerations.delete(activeGeneration);
|
|
865
|
-
this.pruneInvalidatedTagVersions();
|
|
877
|
+
this.pruneInvalidatedTagVersions(activeGeneration.tags);
|
|
866
878
|
if (leaseToken && adapter?.releaseLease) {
|
|
867
879
|
try {
|
|
868
880
|
await adapter.releaseLease(leaseKey, leaseToken);
|
|
@@ -907,18 +919,9 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
907
919
|
}
|
|
908
920
|
return void 0;
|
|
909
921
|
}
|
|
910
|
-
countEntriesForTag(tag) {
|
|
911
|
-
let count = 0;
|
|
912
|
-
for (const entry of this.entries.values()) {
|
|
913
|
-
if (entry.tags.has(tag)) {
|
|
914
|
-
count++;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
return count;
|
|
918
|
-
}
|
|
919
922
|
countEntriesForTags(tags) {
|
|
920
923
|
let count = 0;
|
|
921
|
-
for (const entry of this.
|
|
924
|
+
for (const entry of this.entriesByTag.get(tags[0]) ?? []) {
|
|
922
925
|
if (tags.every((tag) => entry.tags.has(tag))) {
|
|
923
926
|
count++;
|
|
924
927
|
}
|
|
@@ -926,10 +929,10 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
926
929
|
return count;
|
|
927
930
|
}
|
|
928
931
|
invalidateTag(normalizedTag) {
|
|
929
|
-
const count = this.
|
|
932
|
+
const count = this.entriesByTag.get(normalizedTag)?.size ?? 0;
|
|
930
933
|
this.invalidatedTagVersions.delete(normalizedTag);
|
|
931
934
|
this.invalidatedTagVersions.set(normalizedTag, ++this.version);
|
|
932
|
-
this.pruneInvalidatedTagVersions();
|
|
935
|
+
this.pruneInvalidatedTagVersions([normalizedTag]);
|
|
933
936
|
return count;
|
|
934
937
|
}
|
|
935
938
|
toPublicEntry(entry) {
|
|
@@ -959,19 +962,51 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
959
962
|
this.entries.set(key, entry);
|
|
960
963
|
}
|
|
961
964
|
storeLocalEntry(entry) {
|
|
962
|
-
|
|
965
|
+
const removed = [];
|
|
966
|
+
const replaced = this.detachLocalEntry(entry.key);
|
|
967
|
+
if (replaced) removed.push(replaced);
|
|
963
968
|
this.entries.set(entry.key, entry);
|
|
969
|
+
for (const tag of entry.tags) {
|
|
970
|
+
let tagged = this.entriesByTag.get(tag);
|
|
971
|
+
if (!tagged) this.entriesByTag.set(tag, tagged = /* @__PURE__ */ new Set());
|
|
972
|
+
tagged.add(entry);
|
|
973
|
+
}
|
|
964
974
|
while (this.entries.size > this.maxEntries) {
|
|
965
975
|
const oldestKey = this.entries.keys().next().value;
|
|
966
976
|
if (oldestKey === void 0) break;
|
|
967
|
-
this.
|
|
977
|
+
removed.push(this.detachLocalEntry(oldestKey));
|
|
968
978
|
}
|
|
969
|
-
this.pruneInvalidatedTagVersions();
|
|
979
|
+
for (const removedEntry of removed) this.pruneInvalidatedTagVersions(removedEntry.tags);
|
|
980
|
+
}
|
|
981
|
+
deleteLocalEntry(key) {
|
|
982
|
+
const entry = this.detachLocalEntry(key);
|
|
983
|
+
if (!entry) return false;
|
|
984
|
+
this.pruneInvalidatedTagVersions(entry.tags);
|
|
985
|
+
return true;
|
|
986
|
+
}
|
|
987
|
+
detachLocalEntry(key) {
|
|
988
|
+
const entry = this.entries.get(key);
|
|
989
|
+
if (!entry) return void 0;
|
|
990
|
+
this.entries.delete(key);
|
|
991
|
+
for (const tag of entry.tags) {
|
|
992
|
+
const tagged = this.entriesByTag.get(tag);
|
|
993
|
+
if (!tagged) continue;
|
|
994
|
+
tagged.delete(entry);
|
|
995
|
+
if (tagged.size === 0) this.entriesByTag.delete(tag);
|
|
996
|
+
}
|
|
997
|
+
return entry;
|
|
970
998
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
999
|
+
/**
|
|
1000
|
+
* Drop invalidation versions that no local entry or active fill can be stale against.
|
|
1001
|
+
* Callers pass only the tags whose dependents just changed, so the cost is bounded by
|
|
1002
|
+
* the entries sharing those tags rather than by the whole cache.
|
|
1003
|
+
*/
|
|
1004
|
+
pruneInvalidatedTagVersions(tags) {
|
|
1005
|
+
tags: for (const tag of tags) {
|
|
1006
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
1007
|
+
if (invalidatedVersion === void 0) continue;
|
|
1008
|
+
for (const entry of this.entriesByTag.get(tag) ?? []) {
|
|
1009
|
+
if (entry.createdVersion < invalidatedVersion) continue tags;
|
|
975
1010
|
}
|
|
976
1011
|
for (const generation of this.activeGenerations) {
|
|
977
1012
|
if (generation.tags.has(tag) && generation.createdVersion < invalidatedVersion)
|
|
@@ -1403,7 +1438,7 @@ function createEndpoint(pathOrOptions, optionsOrHandler, maybeHandler) {
|
|
|
1403
1438
|
wrappedHandler
|
|
1404
1439
|
);
|
|
1405
1440
|
endpoint.__path = path || void 0;
|
|
1406
|
-
endpoint.__method = options.method || "GET";
|
|
1441
|
+
endpoint.__method = options.method || (path ? "GET" : void 0);
|
|
1407
1442
|
endpoint.__autoPath = !path;
|
|
1408
1443
|
endpoint.__handler = wrappedHandler;
|
|
1409
1444
|
endpoint.__farmInvoke = (ctx) => runEndpointMiddleware(middleware, ctx, handler, error, options.invalidates);
|
|
@@ -2672,6 +2707,7 @@ __name(validateInput, "validateInput");
|
|
|
2672
2707
|
createStaticAPIRouteMatcherAtBasePath,
|
|
2673
2708
|
getAllowedAPIRouteMethods,
|
|
2674
2709
|
invokeAPIRouteEndpoint,
|
|
2710
|
+
isEndpointFailure,
|
|
2675
2711
|
isFarmAPIPathname,
|
|
2676
2712
|
isWebResponse,
|
|
2677
2713
|
matchAPIRoute,
|
package/dist/api/runtime.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as EndpointFailure } from '../endpoint-
|
|
2
|
-
export { p as parseRouteSchema } from '../endpoint-
|
|
3
|
-
import { P as PluginRoutesFactory } from '../route-
|
|
1
|
+
import { e as EndpointFailure } from '../endpoint-DAc96i93.mjs';
|
|
2
|
+
export { i as isEndpointFailure, p as parseRouteSchema } from '../endpoint-DAc96i93.mjs';
|
|
3
|
+
import { P as PluginRoutesFactory } from '../route-B0XrsrFk.mjs';
|
|
4
4
|
import { a as APIRouteParams, A as APIRouteMatch } from '../route-pattern-W-SsJGSp.mjs';
|
|
5
5
|
export { b as APIRouteParamValue, m as matchAPIRoute } from '../route-pattern-W-SsJGSp.mjs';
|
|
6
6
|
import '../cache.mjs';
|
package/dist/api/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as EndpointFailure } from '../endpoint-
|
|
2
|
-
export { p as parseRouteSchema } from '../endpoint-
|
|
3
|
-
import { P as PluginRoutesFactory } from '../route-
|
|
1
|
+
import { e as EndpointFailure } from '../endpoint-1zA994xL.js';
|
|
2
|
+
export { i as isEndpointFailure, p as parseRouteSchema } from '../endpoint-1zA994xL.js';
|
|
3
|
+
import { P as PluginRoutesFactory } from '../route-DOEpbyWZ.js';
|
|
4
4
|
import { a as APIRouteParams, A as APIRouteMatch } from '../route-pattern-W-SsJGSp.js';
|
|
5
5
|
export { b as APIRouteParamValue, m as matchAPIRoute } from '../route-pattern-W-SsJGSp.js';
|
|
6
6
|
import '../cache.js';
|
package/dist/api/runtime.mjs
CHANGED
|
@@ -11,9 +11,11 @@ import {
|
|
|
11
11
|
normalizeRouteResponse,
|
|
12
12
|
parseRouteSchema,
|
|
13
13
|
resolveAPIRouteEndpoint
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-XP777LRD.mjs";
|
|
15
15
|
import "../chunk-I6XDAKWQ.mjs";
|
|
16
|
-
import
|
|
16
|
+
import {
|
|
17
|
+
isEndpointFailure
|
|
18
|
+
} from "../chunk-SYGGPS4A.mjs";
|
|
17
19
|
import {
|
|
18
20
|
registerAPIRouteShape
|
|
19
21
|
} from "../chunk-W3B4PKAW.mjs";
|
|
@@ -24,7 +26,7 @@ import {
|
|
|
24
26
|
} from "../chunk-O7BH5O46.mjs";
|
|
25
27
|
import "../chunk-EMLAPBEM.mjs";
|
|
26
28
|
import "../chunk-7LTCDQRS.mjs";
|
|
27
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-F6SJAKFJ.mjs";
|
|
28
30
|
import "../chunk-4SIYUGRY.mjs";
|
|
29
31
|
import "../chunk-C4NCTZLM.mjs";
|
|
30
32
|
import "../chunk-FUZEBRP3.mjs";
|
|
@@ -38,6 +40,7 @@ export {
|
|
|
38
40
|
createStaticAPIRouteMatcherAtBasePath,
|
|
39
41
|
getAllowedAPIRouteMethods,
|
|
40
42
|
invokeAPIRouteEndpoint,
|
|
43
|
+
isEndpointFailure,
|
|
41
44
|
isFarmAPIPathname,
|
|
42
45
|
isWebResponse,
|
|
43
46
|
matchAPIRoute,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { F as FarmIntegrationAPI, f as FarmIntegrationAPIOperation } from './integration-api-BbaiokCC.mjs';
|
|
2
2
|
import { b as FarmClientCacheKey, a as FarmClientCacheEntry } from './client-cache-di_Nasxa.mjs';
|
|
3
3
|
import { DefinedCacheKey, RouteDataCacheKey, InferCacheKeyData } from './cache.mjs';
|
|
4
|
-
import { a as RoutePathParams } from './route-
|
|
5
|
-
import { K as FarmAPIStream } from './endpoint-
|
|
4
|
+
import { a as RoutePathParams } from './route-B0XrsrFk.mjs';
|
|
5
|
+
import { K as FarmAPIStream } from './endpoint-DAc96i93.mjs';
|
|
6
6
|
|
|
7
7
|
/** Instance defaults, resolved once per call before cache lookup or dispatch. */
|
|
8
8
|
type ClientHeaders = Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { F as FarmIntegrationAPI, f as FarmIntegrationAPIOperation } from './integration-api-BbaiokCC.js';
|
|
2
2
|
import { b as FarmClientCacheKey, a as FarmClientCacheEntry } from './client-cache-Deoqq-nM.js';
|
|
3
3
|
import { DefinedCacheKey, RouteDataCacheKey, InferCacheKeyData } from './cache.js';
|
|
4
|
-
import { a as RoutePathParams } from './route-
|
|
5
|
-
import { K as FarmAPIStream } from './endpoint-
|
|
4
|
+
import { a as RoutePathParams } from './route-DOEpbyWZ.js';
|
|
5
|
+
import { K as FarmAPIStream } from './endpoint-1zA994xL.js';
|
|
6
6
|
|
|
7
7
|
/** Instance defaults, resolved once per call before cache lookup or dispatch. */
|
|
8
8
|
type ClientHeaders = Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
package/dist/api.cjs
CHANGED
|
@@ -825,6 +825,8 @@ var init_cache = __esm({
|
|
|
825
825
|
constructor(config = {}) {
|
|
826
826
|
this.entries = /* @__PURE__ */ new Map();
|
|
827
827
|
this.inflight = /* @__PURE__ */ new Map();
|
|
828
|
+
/** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
|
|
829
|
+
this.entriesByTag = /* @__PURE__ */ new Map();
|
|
828
830
|
this.invalidatedTagVersions = /* @__PURE__ */ new Map();
|
|
829
831
|
this.activeGenerations = /* @__PURE__ */ new Set();
|
|
830
832
|
this.version = 0;
|
|
@@ -843,6 +845,7 @@ var init_cache = __esm({
|
|
|
843
845
|
configure(config = {}) {
|
|
844
846
|
this.generation++;
|
|
845
847
|
this.entries.clear();
|
|
848
|
+
this.entriesByTag.clear();
|
|
846
849
|
this.inflight.clear();
|
|
847
850
|
this.invalidatedTagVersions.clear();
|
|
848
851
|
this.activeGenerations.clear();
|
|
@@ -1009,14 +1012,12 @@ var init_cache = __esm({
|
|
|
1009
1012
|
return entry;
|
|
1010
1013
|
}
|
|
1011
1014
|
delete(key) {
|
|
1012
|
-
const deleted = this.
|
|
1013
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
1015
|
+
const deleted = this.deleteLocalEntry(key);
|
|
1014
1016
|
emitFarmEvent({ type: "cache.delete", key, deleted });
|
|
1015
1017
|
return deleted;
|
|
1016
1018
|
}
|
|
1017
1019
|
async deleteAsync(key) {
|
|
1018
|
-
const deleted = this.
|
|
1019
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
1020
|
+
const deleted = this.deleteLocalEntry(key);
|
|
1020
1021
|
if (this.adapter) {
|
|
1021
1022
|
await this.adapter.delete(this.createAdapterKey(key));
|
|
1022
1023
|
}
|
|
@@ -1027,6 +1028,7 @@ var init_cache = __esm({
|
|
|
1027
1028
|
const count = this.entries.size;
|
|
1028
1029
|
this.generation++;
|
|
1029
1030
|
this.entries.clear();
|
|
1031
|
+
this.entriesByTag.clear();
|
|
1030
1032
|
this.inflight.clear();
|
|
1031
1033
|
this.invalidatedTagVersions.clear();
|
|
1032
1034
|
this.activeGenerations.clear();
|
|
@@ -1112,23 +1114,32 @@ var init_cache = __esm({
|
|
|
1112
1114
|
return cached.value;
|
|
1113
1115
|
}
|
|
1114
1116
|
const inflight = this.inflight.get(key);
|
|
1115
|
-
if (inflight) {
|
|
1117
|
+
if (inflight && !this.wasInvalidatedSince(inflight.tags, inflight.startVersion)) {
|
|
1116
1118
|
emitFarmEvent({ type: "cache.dedupe", key });
|
|
1117
|
-
return inflight;
|
|
1119
|
+
return inflight.promise;
|
|
1118
1120
|
}
|
|
1119
1121
|
const tags = Array.from(normalizeCacheOptionsTags(options));
|
|
1120
1122
|
const generation = this.generation;
|
|
1123
|
+
const startVersion = this.version;
|
|
1121
1124
|
const promise = this.fillCacheEntry(key, producer, options, tags, generation).catch((error) => {
|
|
1122
1125
|
emitFarmEvent({ type: "cache.error", key, operation: "set", error });
|
|
1123
1126
|
throw error;
|
|
1124
1127
|
}).finally(() => {
|
|
1125
|
-
if (this.inflight.get(key) === promise) {
|
|
1128
|
+
if (this.inflight.get(key)?.promise === promise) {
|
|
1126
1129
|
this.inflight.delete(key);
|
|
1127
1130
|
}
|
|
1128
1131
|
});
|
|
1129
|
-
this.inflight.set(key, promise);
|
|
1132
|
+
this.inflight.set(key, { promise, tags, startVersion });
|
|
1130
1133
|
return promise;
|
|
1131
1134
|
}
|
|
1135
|
+
/** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
|
|
1136
|
+
wasInvalidatedSince(tags, version) {
|
|
1137
|
+
for (const tag of tags) {
|
|
1138
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
1139
|
+
if (invalidatedVersion !== void 0 && invalidatedVersion > version) return true;
|
|
1140
|
+
}
|
|
1141
|
+
return false;
|
|
1142
|
+
}
|
|
1132
1143
|
async fillCacheEntry(key, producer, options, tags, generation) {
|
|
1133
1144
|
const adapter = this.adapter;
|
|
1134
1145
|
const namespace = this.namespace;
|
|
@@ -1169,7 +1180,7 @@ var init_cache = __esm({
|
|
|
1169
1180
|
return value;
|
|
1170
1181
|
} finally {
|
|
1171
1182
|
this.activeGenerations.delete(activeGeneration);
|
|
1172
|
-
this.pruneInvalidatedTagVersions();
|
|
1183
|
+
this.pruneInvalidatedTagVersions(activeGeneration.tags);
|
|
1173
1184
|
if (leaseToken && adapter?.releaseLease) {
|
|
1174
1185
|
try {
|
|
1175
1186
|
await adapter.releaseLease(leaseKey, leaseToken);
|
|
@@ -1214,18 +1225,9 @@ var init_cache = __esm({
|
|
|
1214
1225
|
}
|
|
1215
1226
|
return void 0;
|
|
1216
1227
|
}
|
|
1217
|
-
countEntriesForTag(tag) {
|
|
1218
|
-
let count = 0;
|
|
1219
|
-
for (const entry of this.entries.values()) {
|
|
1220
|
-
if (entry.tags.has(tag)) {
|
|
1221
|
-
count++;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
return count;
|
|
1225
|
-
}
|
|
1226
1228
|
countEntriesForTags(tags) {
|
|
1227
1229
|
let count = 0;
|
|
1228
|
-
for (const entry of this.
|
|
1230
|
+
for (const entry of this.entriesByTag.get(tags[0]) ?? []) {
|
|
1229
1231
|
if (tags.every((tag) => entry.tags.has(tag))) {
|
|
1230
1232
|
count++;
|
|
1231
1233
|
}
|
|
@@ -1233,10 +1235,10 @@ var init_cache = __esm({
|
|
|
1233
1235
|
return count;
|
|
1234
1236
|
}
|
|
1235
1237
|
invalidateTag(normalizedTag) {
|
|
1236
|
-
const count = this.
|
|
1238
|
+
const count = this.entriesByTag.get(normalizedTag)?.size ?? 0;
|
|
1237
1239
|
this.invalidatedTagVersions.delete(normalizedTag);
|
|
1238
1240
|
this.invalidatedTagVersions.set(normalizedTag, ++this.version);
|
|
1239
|
-
this.pruneInvalidatedTagVersions();
|
|
1241
|
+
this.pruneInvalidatedTagVersions([normalizedTag]);
|
|
1240
1242
|
return count;
|
|
1241
1243
|
}
|
|
1242
1244
|
toPublicEntry(entry) {
|
|
@@ -1266,19 +1268,51 @@ var init_cache = __esm({
|
|
|
1266
1268
|
this.entries.set(key, entry);
|
|
1267
1269
|
}
|
|
1268
1270
|
storeLocalEntry(entry) {
|
|
1269
|
-
|
|
1271
|
+
const removed = [];
|
|
1272
|
+
const replaced = this.detachLocalEntry(entry.key);
|
|
1273
|
+
if (replaced) removed.push(replaced);
|
|
1270
1274
|
this.entries.set(entry.key, entry);
|
|
1275
|
+
for (const tag of entry.tags) {
|
|
1276
|
+
let tagged = this.entriesByTag.get(tag);
|
|
1277
|
+
if (!tagged) this.entriesByTag.set(tag, tagged = /* @__PURE__ */ new Set());
|
|
1278
|
+
tagged.add(entry);
|
|
1279
|
+
}
|
|
1271
1280
|
while (this.entries.size > this.maxEntries) {
|
|
1272
1281
|
const oldestKey = this.entries.keys().next().value;
|
|
1273
1282
|
if (oldestKey === void 0) break;
|
|
1274
|
-
this.
|
|
1283
|
+
removed.push(this.detachLocalEntry(oldestKey));
|
|
1275
1284
|
}
|
|
1276
|
-
this.pruneInvalidatedTagVersions();
|
|
1285
|
+
for (const removedEntry of removed) this.pruneInvalidatedTagVersions(removedEntry.tags);
|
|
1286
|
+
}
|
|
1287
|
+
deleteLocalEntry(key) {
|
|
1288
|
+
const entry = this.detachLocalEntry(key);
|
|
1289
|
+
if (!entry) return false;
|
|
1290
|
+
this.pruneInvalidatedTagVersions(entry.tags);
|
|
1291
|
+
return true;
|
|
1277
1292
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1293
|
+
detachLocalEntry(key) {
|
|
1294
|
+
const entry = this.entries.get(key);
|
|
1295
|
+
if (!entry) return void 0;
|
|
1296
|
+
this.entries.delete(key);
|
|
1297
|
+
for (const tag of entry.tags) {
|
|
1298
|
+
const tagged = this.entriesByTag.get(tag);
|
|
1299
|
+
if (!tagged) continue;
|
|
1300
|
+
tagged.delete(entry);
|
|
1301
|
+
if (tagged.size === 0) this.entriesByTag.delete(tag);
|
|
1302
|
+
}
|
|
1303
|
+
return entry;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Drop invalidation versions that no local entry or active fill can be stale against.
|
|
1307
|
+
* Callers pass only the tags whose dependents just changed, so the cost is bounded by
|
|
1308
|
+
* the entries sharing those tags rather than by the whole cache.
|
|
1309
|
+
*/
|
|
1310
|
+
pruneInvalidatedTagVersions(tags) {
|
|
1311
|
+
tags: for (const tag of tags) {
|
|
1312
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
1313
|
+
if (invalidatedVersion === void 0) continue;
|
|
1314
|
+
for (const entry of this.entriesByTag.get(tag) ?? []) {
|
|
1315
|
+
if (entry.createdVersion < invalidatedVersion) continue tags;
|
|
1282
1316
|
}
|
|
1283
1317
|
for (const generation of this.activeGenerations) {
|
|
1284
1318
|
if (generation.tags.has(tag) && generation.createdVersion < invalidatedVersion)
|
|
@@ -2294,6 +2328,7 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
2294
2328
|
}
|
|
2295
2329
|
return rendererRuntime.createElement(...args);
|
|
2296
2330
|
}, "createElement");
|
|
2331
|
+
const markFunctionComponent = /* @__PURE__ */ __name((component) => rendererRuntime?.markFunctionComponent?.(component) ?? component, "markFunctionComponent");
|
|
2297
2332
|
const Component = route.component;
|
|
2298
2333
|
if (route.pending) {
|
|
2299
2334
|
const PendingComponent = route.pending;
|
|
@@ -2315,7 +2350,9 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
2315
2350
|
throw error;
|
|
2316
2351
|
}
|
|
2317
2352
|
}, "FarmProgrammaticPageContent");
|
|
2318
|
-
const PageContent =
|
|
2353
|
+
const PageContent = markFunctionComponent(
|
|
2354
|
+
FarmProgrammaticPageContent2
|
|
2355
|
+
);
|
|
2319
2356
|
const FarmProgrammaticPage = /* @__PURE__ */ __name(function FarmProgrammaticPage2(props) {
|
|
2320
2357
|
return createElement(
|
|
2321
2358
|
rendererRuntime.Suspense,
|
|
@@ -2325,7 +2362,7 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
2325
2362
|
createElement(PageContent, props)
|
|
2326
2363
|
);
|
|
2327
2364
|
}, "FarmProgrammaticPage");
|
|
2328
|
-
return FarmProgrammaticPage;
|
|
2365
|
+
return markFunctionComponent(FarmProgrammaticPage);
|
|
2329
2366
|
}
|
|
2330
2367
|
const FarmProgrammaticPageContent = /* @__PURE__ */ __name(async function FarmProgrammaticPageContent2(props) {
|
|
2331
2368
|
try {
|
|
@@ -2344,7 +2381,7 @@ function createProgrammaticPageComponent(route, rendererRuntime) {
|
|
|
2344
2381
|
throw error;
|
|
2345
2382
|
}
|
|
2346
2383
|
}, "FarmProgrammaticPageContent");
|
|
2347
|
-
return FarmProgrammaticPageContent;
|
|
2384
|
+
return markFunctionComponent(FarmProgrammaticPageContent);
|
|
2348
2385
|
}
|
|
2349
2386
|
function readProgrammaticRouteProps(route, props, resources) {
|
|
2350
2387
|
if (isProgrammaticRoutePropsResolved(props)) {
|
|
@@ -3092,7 +3129,7 @@ function createEndpoint(pathOrOptions, optionsOrHandler, maybeHandler) {
|
|
|
3092
3129
|
wrappedHandler
|
|
3093
3130
|
);
|
|
3094
3131
|
endpoint.__path = path4 || void 0;
|
|
3095
|
-
endpoint.__method = options.method || "GET";
|
|
3132
|
+
endpoint.__method = options.method || (path4 ? "GET" : void 0);
|
|
3096
3133
|
endpoint.__autoPath = !path4;
|
|
3097
3134
|
endpoint.__handler = wrappedHandler;
|
|
3098
3135
|
endpoint.__farmInvoke = (ctx) => runEndpointMiddleware(middleware, ctx, handler, error, options.invalidates);
|
|
@@ -3468,6 +3505,42 @@ function getRequestStore() {
|
|
|
3468
3505
|
__name(getRequestStore, "getRequestStore");
|
|
3469
3506
|
var requestStore = getRequestStore();
|
|
3470
3507
|
_setCurrentRequestResolver(() => requestStore.getStore());
|
|
3508
|
+
function resolveFarmRequestURL(req, options = {}) {
|
|
3509
|
+
if (options.origin) {
|
|
3510
|
+
return new URL(req.url || "/", options.origin);
|
|
3511
|
+
}
|
|
3512
|
+
const forwardedHost = options.trustProxy ? firstForwardedHeaderValue(req.headers["x-forwarded-host"]) : void 0;
|
|
3513
|
+
const fallbackHost = firstForwardedHeaderValue(req.headers.host) || "localhost";
|
|
3514
|
+
const forwardedProto = options.trustProxy ? firstForwardedHeaderValue(req.headers["x-forwarded-proto"]) : void 0;
|
|
3515
|
+
const normalizedProto = forwardedProto?.toLowerCase();
|
|
3516
|
+
const proto = normalizedProto === "https" || normalizedProto === "http" ? normalizedProto : isEncryptedFarmRequest(req) ? "https" : "http";
|
|
3517
|
+
return new URL(req.url || "/", resolveRequestOrigin(proto, forwardedHost, fallbackHost));
|
|
3518
|
+
}
|
|
3519
|
+
__name(resolveFarmRequestURL, "resolveFarmRequestURL");
|
|
3520
|
+
function isEncryptedFarmRequest(req) {
|
|
3521
|
+
return Boolean(req.socket?.encrypted);
|
|
3522
|
+
}
|
|
3523
|
+
__name(isEncryptedFarmRequest, "isEncryptedFarmRequest");
|
|
3524
|
+
function firstForwardedHeaderValue(value) {
|
|
3525
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
3526
|
+
const token = first?.split(",", 1)[0]?.trim();
|
|
3527
|
+
return token || void 0;
|
|
3528
|
+
}
|
|
3529
|
+
__name(firstForwardedHeaderValue, "firstForwardedHeaderValue");
|
|
3530
|
+
function resolveRequestOrigin(proto, host, fallback) {
|
|
3531
|
+
for (const candidate of [host, fallback, "localhost"]) {
|
|
3532
|
+
if (!candidate) continue;
|
|
3533
|
+
if (/[\s/?#@\\]/u.test(candidate)) continue;
|
|
3534
|
+
try {
|
|
3535
|
+
const url = new URL(`${proto}://${candidate}`);
|
|
3536
|
+
if (url.username || url.password || url.pathname !== "/" || url.search || url.hash) continue;
|
|
3537
|
+
return url.origin;
|
|
3538
|
+
} catch {
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
return `${proto}://localhost`;
|
|
3542
|
+
}
|
|
3543
|
+
__name(resolveRequestOrigin, "resolveRequestOrigin");
|
|
3471
3544
|
async function _runWithCurrentRequest(request, fn) {
|
|
3472
3545
|
return requestStore.run(request, fn);
|
|
3473
3546
|
}
|
|
@@ -8221,7 +8294,7 @@ function farmApiPlugin(options = {}) {
|
|
|
8221
8294
|
if (currentPathname !== pathname && !matchAPIRouteAtBasePath(apiRoutesCache, currentPathname, basePath)) {
|
|
8222
8295
|
return next();
|
|
8223
8296
|
}
|
|
8224
|
-
const fullUrl =
|
|
8297
|
+
const fullUrl = resolveFarmRequestURL(req);
|
|
8225
8298
|
const headers = new Headers();
|
|
8226
8299
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
8227
8300
|
if (value) {
|
package/dist/api.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as AnyEndpointMiddleware, D as DELETE,
|
|
1
|
+
export { A as AnyEndpointMiddleware, D as DELETE, k as EndpointErrorContracts, h as EndpointErrorDefinition, j as EndpointErrorDefinitions, l as EndpointErrorHandler, g as EndpointErrorSchema, m as EndpointFail, e as EndpointFailure, w as EndpointHandler, t as EndpointInvalidationContext, s as EndpointInvalidationTarget, u as EndpointInvalidations, d as EndpointMCPMetadata, b as EndpointMCPOptions, r as EndpointMiddleware, q as EndpointMiddlewareContext, E as EndpointMiddlewareResult, f as EndpointOpenAPIMetadata, v as EndpointOptions, n as EndpointParamValue, o as EndpointParams, K as FarmAPIStream, J as FarmStreamResponse, G as GET, H as HEAD, I as InferEndpointMiddlewareContext, M as MultipartField, F as MultipartSchema, B as MultipartValues, O as OPTIONS, z as PATCH, P as POST, y as PUT, Q as QUERY, T as TypedEndpoint, C as TypedFormData, x as createEndpoint, i as isEndpointFailure, X as isFarmAPIStream, V as isJSONStreamResponse, N as isMultipartSchema, U as jsonStream, L as multipart, W as readJSONStream, S as toFormData } from './endpoint-DAc96i93.mjs';
|
|
2
2
|
export { APIRoute, APIRouteConflictError, APIRouteHandlerOptions, APIRouteManager, APIRouteManagerOptions } from './api/route-manager.mjs';
|
|
3
|
-
export { v as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, s as APIQueryPrimitive, t as APIQueryValue, g as APIResult, K as APIRouteManifest, A as APIRouteRefMetadata, x as ApiClients, C as CacheKey, n as CacheOptions, l as CachePolicy, m as CacheScope, r as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, p as InvalidateOptions, I as InvalidateTarget, q as OptimisticOptions, O as OptimisticUpdate, j as RequestEvent, k as ResponseEvent, o as RetryAttemptContext, R as RetryOptions, u as RouteAPIClient, w as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, G as applyServerFnOptimisticUpdates, z as createAPIClient, y as createApiClients, E as createServerAPIClient, D as getAPIRouteRefMetadata, B as isAPIRouteRef, J as resolveServerFnInvalidateTargets, H as settleServerFnOptimisticUpdates } from './api-client-
|
|
4
|
-
import { aq as ResolvedFarmAPIConfig } from './client-plugins-
|
|
5
|
-
export { ec as DEFAULT_FARM_API_BASE_PATH, ef as FarmAPIConfig, ed as FarmAPIConfigResolverContext, ee as FarmAPIConfigValue, ej as getFarmAPIBaseURL, ei as normalizeFarmAPIBasePath, eh as normalizeFarmAPIConfig, eg as resolveFarmAPIConfig, ek as resolveFarmAPIRequestURL } from './client-plugins-
|
|
3
|
+
export { v as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, s as APIQueryPrimitive, t as APIQueryValue, g as APIResult, K as APIRouteManifest, A as APIRouteRefMetadata, x as ApiClients, C as CacheKey, n as CacheOptions, l as CachePolicy, m as CacheScope, r as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, p as InvalidateOptions, I as InvalidateTarget, q as OptimisticOptions, O as OptimisticUpdate, j as RequestEvent, k as ResponseEvent, o as RetryAttemptContext, R as RetryOptions, u as RouteAPIClient, w as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, G as applyServerFnOptimisticUpdates, z as createAPIClient, y as createApiClients, E as createServerAPIClient, D as getAPIRouteRefMetadata, B as isAPIRouteRef, J as resolveServerFnInvalidateTargets, H as settleServerFnOptimisticUpdates } from './api-client-Cx54IR5g.mjs';
|
|
4
|
+
import { aq as ResolvedFarmAPIConfig } from './client-plugins-JXXmZliS.mjs';
|
|
5
|
+
export { ec as DEFAULT_FARM_API_BASE_PATH, ef as FarmAPIConfig, ed as FarmAPIConfigResolverContext, ee as FarmAPIConfigValue, ej as getFarmAPIBaseURL, ei as normalizeFarmAPIBasePath, eh as normalizeFarmAPIConfig, eg as resolveFarmAPIConfig, ek as resolveFarmAPIRequestURL } from './client-plugins-JXXmZliS.mjs';
|
|
6
6
|
import { Plugin } from 'vite';
|
|
7
|
-
export { k as PluginAPIRouter, i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, f as RouteFactory, b as RouteInputSchemas, c as RouteJSON, R as RouteMethod, e as RouteOptions, a as RoutePathParams, j as createRouteFactory, r as resolvePluginRoutes } from './route-
|
|
7
|
+
export { k as PluginAPIRouter, i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, f as RouteFactory, b as RouteInputSchemas, c as RouteJSON, R as RouteMethod, e as RouteOptions, a as RoutePathParams, j as createRouteFactory, r as resolvePluginRoutes } from './route-B0XrsrFk.mjs';
|
|
8
8
|
export { API_ROUTE_METHODS, getAllowedAPIRouteMethods, invokeAPIRouteEndpoint, isWebResponse, normalizeRouteResponse, resolveAPIRouteEndpoint } from './api/runtime.mjs';
|
|
9
9
|
export { A as APIRouteMatch, b as APIRouteParamValue, a as APIRouteParams, m as matchAPIRoute } from './route-pattern-W-SsJGSp.mjs';
|
|
10
10
|
import './cache.mjs';
|
package/dist/api.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as AnyEndpointMiddleware, D as DELETE,
|
|
1
|
+
export { A as AnyEndpointMiddleware, D as DELETE, k as EndpointErrorContracts, h as EndpointErrorDefinition, j as EndpointErrorDefinitions, l as EndpointErrorHandler, g as EndpointErrorSchema, m as EndpointFail, e as EndpointFailure, w as EndpointHandler, t as EndpointInvalidationContext, s as EndpointInvalidationTarget, u as EndpointInvalidations, d as EndpointMCPMetadata, b as EndpointMCPOptions, r as EndpointMiddleware, q as EndpointMiddlewareContext, E as EndpointMiddlewareResult, f as EndpointOpenAPIMetadata, v as EndpointOptions, n as EndpointParamValue, o as EndpointParams, K as FarmAPIStream, J as FarmStreamResponse, G as GET, H as HEAD, I as InferEndpointMiddlewareContext, M as MultipartField, F as MultipartSchema, B as MultipartValues, O as OPTIONS, z as PATCH, P as POST, y as PUT, Q as QUERY, T as TypedEndpoint, C as TypedFormData, x as createEndpoint, i as isEndpointFailure, X as isFarmAPIStream, V as isJSONStreamResponse, N as isMultipartSchema, U as jsonStream, L as multipart, W as readJSONStream, S as toFormData } from './endpoint-1zA994xL.js';
|
|
2
2
|
export { APIRoute, APIRouteConflictError, APIRouteHandlerOptions, APIRouteManager, APIRouteManagerOptions } from './api/route-manager.js';
|
|
3
|
-
export { v as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, s as APIQueryPrimitive, t as APIQueryValue, g as APIResult, K as APIRouteManifest, A as APIRouteRefMetadata, x as ApiClients, C as CacheKey, n as CacheOptions, l as CachePolicy, m as CacheScope, r as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, p as InvalidateOptions, I as InvalidateTarget, q as OptimisticOptions, O as OptimisticUpdate, j as RequestEvent, k as ResponseEvent, o as RetryAttemptContext, R as RetryOptions, u as RouteAPIClient, w as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, G as applyServerFnOptimisticUpdates, z as createAPIClient, y as createApiClients, E as createServerAPIClient, D as getAPIRouteRefMetadata, B as isAPIRouteRef, J as resolveServerFnInvalidateTargets, H as settleServerFnOptimisticUpdates } from './api-client-
|
|
4
|
-
import { aq as ResolvedFarmAPIConfig } from './client-plugins-
|
|
5
|
-
export { ec as DEFAULT_FARM_API_BASE_PATH, ef as FarmAPIConfig, ed as FarmAPIConfigResolverContext, ee as FarmAPIConfigValue, ej as getFarmAPIBaseURL, ei as normalizeFarmAPIBasePath, eh as normalizeFarmAPIConfig, eg as resolveFarmAPIConfig, ek as resolveFarmAPIRequestURL } from './client-plugins-
|
|
3
|
+
export { v as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, s as APIQueryPrimitive, t as APIQueryValue, g as APIResult, K as APIRouteManifest, A as APIRouteRefMetadata, x as ApiClients, C as CacheKey, n as CacheOptions, l as CachePolicy, m as CacheScope, r as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, p as InvalidateOptions, I as InvalidateTarget, q as OptimisticOptions, O as OptimisticUpdate, j as RequestEvent, k as ResponseEvent, o as RetryAttemptContext, R as RetryOptions, u as RouteAPIClient, w as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, G as applyServerFnOptimisticUpdates, z as createAPIClient, y as createApiClients, E as createServerAPIClient, D as getAPIRouteRefMetadata, B as isAPIRouteRef, J as resolveServerFnInvalidateTargets, H as settleServerFnOptimisticUpdates } from './api-client-DykpaKcY.js';
|
|
4
|
+
import { aq as ResolvedFarmAPIConfig } from './client-plugins-C089bQhN.js';
|
|
5
|
+
export { ec as DEFAULT_FARM_API_BASE_PATH, ef as FarmAPIConfig, ed as FarmAPIConfigResolverContext, ee as FarmAPIConfigValue, ej as getFarmAPIBaseURL, ei as normalizeFarmAPIBasePath, eh as normalizeFarmAPIConfig, eg as resolveFarmAPIConfig, ek as resolveFarmAPIRequestURL } from './client-plugins-C089bQhN.js';
|
|
6
6
|
import { Plugin } from 'vite';
|
|
7
|
-
export { k as PluginAPIRouter, i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, f as RouteFactory, b as RouteInputSchemas, c as RouteJSON, R as RouteMethod, e as RouteOptions, a as RoutePathParams, j as createRouteFactory, r as resolvePluginRoutes } from './route-
|
|
7
|
+
export { k as PluginAPIRouter, i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, f as RouteFactory, b as RouteInputSchemas, c as RouteJSON, R as RouteMethod, e as RouteOptions, a as RoutePathParams, j as createRouteFactory, r as resolvePluginRoutes } from './route-DOEpbyWZ.js';
|
|
8
8
|
export { API_ROUTE_METHODS, getAllowedAPIRouteMethods, invokeAPIRouteEndpoint, isWebResponse, normalizeRouteResponse, resolveAPIRouteEndpoint } from './api/runtime.js';
|
|
9
9
|
export { A as APIRouteMatch, b as APIRouteParamValue, a as APIRouteParams, m as matchAPIRoute } from './route-pattern-W-SsJGSp.js';
|
|
10
10
|
import './cache.js';
|
package/dist/api.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
farmApiPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UDBJCUPA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
APIClientError,
|
|
6
6
|
FARM_API_ROUTE_META_SYMBOL,
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
isAPIRouteRef,
|
|
14
14
|
resolveServerFnInvalidateTargets,
|
|
15
15
|
settleServerFnOptimisticUpdates
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-L6V3P73N.mjs";
|
|
17
17
|
import "./chunk-72AK62H5.mjs";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-5SPPCN5J.mjs";
|
|
19
19
|
import "./chunk-QVYLBY73.mjs";
|
|
20
20
|
import "./chunk-R3DS7A2T.mjs";
|
|
21
21
|
import "./chunk-IOEH4VWN.mjs";
|
|
22
22
|
import {
|
|
23
23
|
APIRouteConflictError,
|
|
24
24
|
APIRouteManager
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-ATERBVHQ.mjs";
|
|
26
|
+
import "./chunk-BNGS6KJ6.mjs";
|
|
27
27
|
import "./chunk-CU625VAY.mjs";
|
|
28
28
|
import "./chunk-JNGIWIY6.mjs";
|
|
29
29
|
import "./chunk-FV45CKBC.mjs";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isWebResponse,
|
|
35
35
|
normalizeRouteResponse,
|
|
36
36
|
resolveAPIRouteEndpoint
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-XP777LRD.mjs";
|
|
38
38
|
import {
|
|
39
39
|
resolveFarmAPIServerBasePath
|
|
40
40
|
} from "./chunk-I6XDAKWQ.mjs";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
createRouteFactory,
|
|
53
53
|
isEndpointFailure,
|
|
54
54
|
resolvePluginRoutes
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-SYGGPS4A.mjs";
|
|
56
56
|
import "./chunk-W3B4PKAW.mjs";
|
|
57
57
|
import "./chunk-5WI2S4CO.mjs";
|
|
58
58
|
import "./chunk-EA5K5BKU.mjs";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
resolveFarmAPIRequestURL
|
|
87
87
|
} from "./chunk-7LTCDQRS.mjs";
|
|
88
88
|
import "./chunk-IXUY2F5U.mjs";
|
|
89
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-F6SJAKFJ.mjs";
|
|
90
90
|
import "./chunk-4SIYUGRY.mjs";
|
|
91
91
|
import "./chunk-C4NCTZLM.mjs";
|
|
92
92
|
import "./chunk-FUZEBRP3.mjs";
|