@on-belay/sdk 1.0.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.
@@ -0,0 +1,25 @@
1
+ import {
2
+ prisma
3
+ } from "./chunk-OIJRSJJE.mjs";
4
+
5
+ // src/internal/fieldset-cache.ts
6
+ var fieldsetIdCache = /* @__PURE__ */ new Map();
7
+ async function resolveFieldsetId(fieldsetSlug) {
8
+ const cached = fieldsetIdCache.get(fieldsetSlug);
9
+ if (cached) return cached;
10
+ const fieldset = await prisma.fieldset.findUnique({
11
+ where: { slug: fieldsetSlug },
12
+ select: { id: true }
13
+ });
14
+ if (!fieldset) {
15
+ throw new Error(
16
+ `[onbelay/sdk] Fieldset '${fieldsetSlug}' not found in catalog. Register it in the Fieldset table before using the SDK. See docs/fieldset-team/specs/sdk-architecture-spec.md Section 5.`
17
+ );
18
+ }
19
+ fieldsetIdCache.set(fieldsetSlug, fieldset.id);
20
+ return fieldset.id;
21
+ }
22
+
23
+ export {
24
+ resolveFieldsetId
25
+ };