primitive-app 3.0.4 → 3.0.5

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./lib-zKX4LVeH.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./lib-DjHuEFvC.js";
2
2
  import * as c from "vue";
3
3
  import { Comment as l, Fragment as u, Teleport as d, camelize as f, cloneVNode as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, customRef as x, defineComponent as S, getCurrentInstance as C, getCurrentScope as w, guardReactiveProps as T, h as E, inject as D, isRef as O, isVNode as k, markRaw as A, mergeDefaults as j, mergeProps as M, nextTick as N, normalizeClass as P, normalizeProps as ee, normalizeStyle as F, onBeforeUnmount as te, onMounted as I, onScopeDispose as ne, onUnmounted as L, onUpdated as R, openBlock as z, provide as re, reactive as B, ref as V, renderList as H, renderSlot as U, resolveDynamicComponent as ie, toDisplayString as W, toHandlerKey as ae, toRaw as oe, toRef as se, toRefs as ce, toValue as le, triggerRef as ue, unref as G, useAttrs as de, vModelSelect as fe, vModelText as pe, vShow as me, watch as K, watchEffect as he, watchPostEffect as ge, withCtx as q, withDirectives as _e, withKeys as ve, withMemo as ye, withModifiers as J } from "vue";
4
4
  import { defineStore as be } from "pinia";
@@ -13707,34 +13707,43 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13707
13707
  }, yv = {
13708
13708
  key: 3,
13709
13709
  class: "w-3.5 h-3.5 rounded-full bg-blue-500 text-white flex items-center justify-center text-[8px] font-bold"
13710
- }, bv = { class: "ml-1.5 text-xs flex-1 truncate" }, xv = {
13710
+ }, bv = {
13711
+ key: 4,
13712
+ class: "w-3.5 h-3.5 text-muted-foreground",
13713
+ fill: "none",
13714
+ stroke: "currentColor",
13715
+ viewBox: "0 0 24 24"
13716
+ }, xv = { class: "ml-1.5 text-xs flex-1 truncate" }, Sv = {
13711
13717
  key: 0,
13712
13718
  class: "px-1 py-0.5 text-[9px] bg-green-100 text-green-700 rounded"
13713
- }, Sv = {
13719
+ }, Cv = {
13714
13720
  key: 1,
13715
13721
  class: "px-1 py-0.5 text-[9px] bg-red-100 text-red-700 rounded"
13716
- }, Cv = {
13722
+ }, wv = {
13717
13723
  key: 2,
13724
+ class: "px-1 py-0.5 text-[9px] bg-muted text-muted-foreground rounded"
13725
+ }, Tv = {
13726
+ key: 3,
13718
13727
  class: "px-1 py-0.5 text-[9px] bg-blue-100 text-blue-700 rounded"
13719
- }, wv = {
13728
+ }, Ev = {
13720
13729
  key: 0,
13721
13730
  class: "text-center py-8 text-muted-foreground"
13722
- }, Tv = { class: "px-3 py-2 border-t border-border bg-muted/20 text-[10px] text-muted-foreground" }, Ev = { class: "flex items-center justify-between" }, Dv = { key: 0 }, Ov = {
13731
+ }, Dv = { class: "px-3 py-2 border-t border-border bg-muted/20 text-[10px] text-muted-foreground" }, Ov = { class: "flex items-center justify-between" }, kv = { key: 0 }, Av = {
13723
13732
  key: 0,
13724
13733
  class: "text-green-600"
13725
- }, kv = { key: 1 }, Av = {
13734
+ }, jv = { key: 1 }, Mv = {
13726
13735
  key: 2,
13727
13736
  class: "text-red-600"
13728
- }, jv = { class: "flex-1 flex flex-col min-w-0 bg-background" }, Mv = { class: "flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30" }, Nv = { class: "flex items-center gap-1" }, Pv = ["disabled"], Fv = ["disabled"], Iv = ["disabled"], Lv = {
13737
+ }, Nv = { key: 3 }, Pv = { key: 0 }, Fv = { class: "flex-1 flex flex-col min-w-0 bg-background" }, Iv = { class: "flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30" }, Lv = { class: "flex items-center gap-1" }, Rv = ["disabled"], zv = ["disabled"], Bv = ["disabled"], Vv = {
13729
13738
  key: 0,
13730
13739
  class: "text-muted-foreground"
13731
- }, Rv = {
13740
+ }, Hv = {
13732
13741
  key: 1,
13733
13742
  class: "space-y-0.5"
13734
- }, zv = ["data-test-id"], Bv = {
13743
+ }, Uv = ["data-test-id"], Wv = {
13735
13744
  key: 0,
13736
13745
  class: "px-3 py-2 border-t border-border bg-muted/20"
13737
- }, Vv = { class: "flex items-center justify-between text-[10px] mb-1" }, Hv = { class: "text-muted-foreground truncate pr-2" }, Uv = { class: "font-medium flex-shrink-0" }, Wv = { class: "h-1 bg-muted rounded-full overflow-hidden" }, Gv = /* @__PURE__ */ S({
13746
+ }, Gv = { class: "flex items-center justify-between text-[10px] mb-1" }, Kv = { class: "text-muted-foreground truncate pr-2" }, qv = { class: "font-medium flex-shrink-0" }, Jv = { class: "h-1 bg-muted rounded-full overflow-hidden" }, Yv = /* @__PURE__ */ S({
13738
13747
  __name: "TestRunner",
13739
13748
  props: {
13740
13749
  tests: {},
@@ -13756,7 +13765,8 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13756
13765
  }), Array.from(e.entries());
13757
13766
  }), S = m(() => Object.values(r.value).filter(Boolean).length), C = m(() => n.tests.length), w = m(() => ({
13758
13767
  passed: Array.from(l.values()).filter((e) => e.status === "passed" || e.status === "scored").length,
13759
- failed: Array.from(l.values()).filter((e) => e.status === "failed").length
13768
+ failed: Array.from(l.values()).filter((e) => e.status === "failed").length,
13769
+ skipped: Array.from(l.values()).filter((e) => e.status === "skipped").length
13760
13770
  })), T = (e) => l.get(e)?.status ?? "pending", E = (e) => e.every((e) => r.value[e.id]), D = (e) => {
13761
13771
  let t = e.some((e) => r.value[e.id]), n = e.every((e) => r.value[e.id]);
13762
13772
  return t && !n;
@@ -13775,6 +13785,13 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13775
13785
  try {
13776
13786
  for (let [e, t] of x.value) for (let n of t) {
13777
13787
  if (!r.value[n.id]) continue;
13788
+ if (n.environment === "node") {
13789
+ l.set(n.id, {
13790
+ status: "skipped",
13791
+ message: "node-only"
13792
+ }), j(`Skipped ${e} :: ${n.name} (node-only)`, "normal", n.id), h.value++;
13793
+ continue;
13794
+ }
13778
13795
  l.set(n.id, { status: "running" }), b.value = `${e} :: ${n.name}`, j(`Running ${e} :: ${n.name}`, "normal", n.id);
13779
13796
  let t = performance.now();
13780
13797
  try {
@@ -13948,22 +13965,28 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13948
13965
  "stroke-linejoin": "round",
13949
13966
  "stroke-width": "2",
13950
13967
  d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
13951
- }, null, -1)]])) : T(e.id) === "scored" ? (z(), _("div", yv, " % ")) : g("", !0)]),
13952
- v("span", bv, W(e.name), 1),
13953
- l.get(e.id)?.status === "passed" ? (z(), _("span", xv, " Passed ")) : l.get(e.id)?.status === "failed" ? (z(), _("span", Sv, " Failed ")) : l.get(e.id)?.status === "scored" && l.get(e.id)?.score ? (z(), _("span", Cv, W(l.get(e.id).score.passed) + "/" + W(l.get(e.id).score.total) + " (" + W(l.get(e.id).score.percentage) + "%) ", 1)) : g("", !0)
13954
- ], 10, pv))), 128))]))), 128)), x.value.length === 0 ? (z(), _("div", wv, [...t[6] ||= [v("p", { class: "text-xs" }, "No tests found.", -1), v("p", { class: "text-[10px] mt-1" }, " Create test files with the .primitive-test.ts extension. ", -1)]])) : g("", !0)]),
13955
- v("div", Tv, [v("div", Ev, [v("span", null, W(C.value) + " tests in " + W(x.value.length) + " groups", 1), w.value.passed > 0 || w.value.failed > 0 ? (z(), _("span", Dv, [
13956
- w.value.passed > 0 ? (z(), _("span", Ov, W(w.value.passed) + " passed ", 1)) : g("", !0),
13957
- w.value.passed > 0 && w.value.failed > 0 ? (z(), _("span", kv, ", ")) : g("", !0),
13958
- w.value.failed > 0 ? (z(), _("span", Av, W(w.value.failed) + " failed ", 1)) : g("", !0)
13968
+ }, null, -1)]])) : T(e.id) === "scored" ? (z(), _("div", yv, " % ")) : T(e.id) === "skipped" ? (z(), _("svg", bv, [...t[6] ||= [v("path", {
13969
+ "stroke-linecap": "round",
13970
+ "stroke-linejoin": "round",
13971
+ "stroke-width": "2",
13972
+ d: "M18.364 5.636a9 9 0 11-12.728 12.728 9 9 0 0112.728-12.728zM5.636 5.636l12.728 12.728"
13973
+ }, null, -1)]])) : g("", !0)]),
13974
+ v("span", xv, W(e.name), 1),
13975
+ l.get(e.id)?.status === "passed" ? (z(), _("span", Sv, " Passed ")) : l.get(e.id)?.status === "failed" ? (z(), _("span", Cv, " Failed ")) : l.get(e.id)?.status === "skipped" ? (z(), _("span", wv, " Skipped ")) : l.get(e.id)?.status === "scored" && l.get(e.id)?.score ? (z(), _("span", Tv, W(l.get(e.id).score.passed) + "/" + W(l.get(e.id).score.total) + " (" + W(l.get(e.id).score.percentage) + "%) ", 1)) : g("", !0)
13976
+ ], 10, pv))), 128))]))), 128)), x.value.length === 0 ? (z(), _("div", Ev, [...t[7] ||= [v("p", { class: "text-xs" }, "No tests found.", -1), v("p", { class: "text-[10px] mt-1" }, " Create test files with the .primitive-test.ts extension. ", -1)]])) : g("", !0)]),
13977
+ v("div", Dv, [v("div", Ov, [v("span", null, W(C.value) + " tests in " + W(x.value.length) + " groups", 1), w.value.passed > 0 || w.value.failed > 0 || w.value.skipped > 0 ? (z(), _("span", kv, [
13978
+ w.value.passed > 0 ? (z(), _("span", Av, W(w.value.passed) + " passed ", 1)) : g("", !0),
13979
+ w.value.passed > 0 && w.value.failed > 0 ? (z(), _("span", jv, ", ")) : g("", !0),
13980
+ w.value.failed > 0 ? (z(), _("span", Mv, W(w.value.failed) + " failed ", 1)) : g("", !0),
13981
+ w.value.skipped > 0 ? (z(), _("span", Nv, [w.value.passed > 0 || w.value.failed > 0 ? (z(), _("span", Pv, ", ")) : g("", !0), y(" " + W(w.value.skipped) + " skipped ", 1)])) : g("", !0)
13959
13982
  ])) : g("", !0)])])
13960
- ]), v("div", jv, [
13961
- v("div", Mv, [t[16] ||= v("span", { class: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide" }, " Test Output ", -1), v("div", Nv, [
13983
+ ]), v("div", Fv, [
13984
+ v("div", Iv, [t[17] ||= v("span", { class: "text-[10px] font-medium text-muted-foreground uppercase tracking-wide" }, " Test Output ", -1), v("div", Lv, [
13962
13985
  v("button", {
13963
13986
  class: "px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted rounded flex items-center gap-1 disabled:opacity-50",
13964
13987
  disabled: i.value.length === 0,
13965
13988
  onClick: L
13966
- }, [a.value ? (z(), _(u, { key: 0 }, [t[7] ||= v("svg", {
13989
+ }, [a.value ? (z(), _(u, { key: 0 }, [t[8] ||= v("svg", {
13967
13990
  class: "w-3 h-3 text-green-500",
13968
13991
  fill: "none",
13969
13992
  stroke: "currentColor",
@@ -13973,7 +13996,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13973
13996
  "stroke-linejoin": "round",
13974
13997
  "stroke-width": "2",
13975
13998
  d: "M5 13l4 4L19 7"
13976
- })], -1), t[8] ||= y(" Copied! ", -1)], 64)) : (z(), _(u, { key: 1 }, [t[9] ||= v("svg", {
13999
+ })], -1), t[9] ||= y(" Copied! ", -1)], 64)) : (z(), _(u, { key: 1 }, [t[10] ||= v("svg", {
13977
14000
  class: "w-3 h-3",
13978
14001
  fill: "none",
13979
14002
  stroke: "currentColor",
@@ -13983,12 +14006,12 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13983
14006
  "stroke-linejoin": "round",
13984
14007
  "stroke-width": "2",
13985
14008
  d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
13986
- })], -1), t[10] ||= y(" Copy ", -1)], 64))], 8, Pv),
14009
+ })], -1), t[11] ||= y(" Copy ", -1)], 64))], 8, Rv),
13987
14010
  v("button", {
13988
14011
  class: "px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted rounded flex items-center gap-1 disabled:opacity-50",
13989
14012
  disabled: !ie.value,
13990
14013
  onClick: R
13991
- }, [s.value ? (z(), _(u, { key: 0 }, [t[11] ||= v("svg", {
14014
+ }, [s.value ? (z(), _(u, { key: 0 }, [t[12] ||= v("svg", {
13992
14015
  class: "w-3 h-3 text-green-500",
13993
14016
  fill: "none",
13994
14017
  stroke: "currentColor",
@@ -13998,7 +14021,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
13998
14021
  "stroke-linejoin": "round",
13999
14022
  "stroke-width": "2",
14000
14023
  d: "M5 13l4 4L19 7"
14001
- })], -1), t[12] ||= y(" Copied! ", -1)], 64)) : (z(), _(u, { key: 1 }, [t[13] ||= v("svg", {
14024
+ })], -1), t[13] ||= y(" Copied! ", -1)], 64)) : (z(), _(u, { key: 1 }, [t[14] ||= v("svg", {
14002
14025
  class: "w-3 h-3",
14003
14026
  fill: "none",
14004
14027
  stroke: "currentColor",
@@ -14008,12 +14031,12 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14008
14031
  "stroke-linejoin": "round",
14009
14032
  "stroke-width": "2",
14010
14033
  d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
14011
- })], -1), t[14] ||= y(" Copy Failing Tests ", -1)], 64))], 8, Fv),
14034
+ })], -1), t[15] ||= y(" Copy Failing Tests ", -1)], 64))], 8, zv),
14012
14035
  v("button", {
14013
14036
  class: "px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted rounded flex items-center gap-1 disabled:opacity-50",
14014
14037
  disabled: i.value.length === 0,
14015
14038
  onClick: U
14016
- }, [...t[15] ||= [v("svg", {
14039
+ }, [...t[16] ||= [v("svg", {
14017
14040
  class: "w-3 h-3",
14018
14041
  fill: "none",
14019
14042
  stroke: "currentColor",
@@ -14023,13 +14046,13 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14023
14046
  "stroke-linejoin": "round",
14024
14047
  "stroke-width": "2",
14025
14048
  d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
14026
- })], -1), y(" Clear ", -1)]], 8, Iv)
14049
+ })], -1), y(" Clear ", -1)]], 8, Bv)
14027
14050
  ])]),
14028
14051
  v("div", {
14029
14052
  ref_key: "outputEl",
14030
14053
  ref: d,
14031
14054
  class: "flex-1 overflow-y-auto scrollbar-thin bg-muted/10 font-mono text-xs p-3"
14032
- }, [i.value.length === 0 ? (z(), _("div", Lv, " Select tests and click \"Run\" to see output... ")) : (z(), _("div", Rv, [(z(!0), _(u, null, H(i.value, (e, t) => (z(), _("div", {
14055
+ }, [i.value.length === 0 ? (z(), _("div", Vv, " Select tests and click \"Run\" to see output... ")) : (z(), _("div", Hv, [(z(!0), _(u, null, H(i.value, (e, t) => (z(), _("div", {
14033
14056
  key: t,
14034
14057
  "data-test-id": e.testId,
14035
14058
  class: P([
@@ -14037,29 +14060,29 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14037
14060
  f.value && e.testId !== f.value ? "opacity-20" : "",
14038
14061
  f.value && e.testId === f.value ? "bg-primary/5 -mx-1 px-1 rounded" : ""
14039
14062
  ])
14040
- }, W(e.text), 11, zv))), 128))]))], 512),
14041
- c.value ? (z(), _("div", Bv, [v("div", Vv, [v("span", Hv, " Running: " + W(b.value), 1), v("span", Uv, W(h.value) + "/" + W(p.value), 1)]), v("div", Wv, [v("div", {
14063
+ }, W(e.text), 11, Uv))), 128))]))], 512),
14064
+ c.value ? (z(), _("div", Wv, [v("div", Gv, [v("span", Kv, " Running: " + W(b.value), 1), v("span", qv, W(h.value) + "/" + W(p.value), 1)]), v("div", Jv, [v("div", {
14042
14065
  class: "h-full bg-primary transition-all duration-300",
14043
14066
  style: F({ width: `${ae.value}%` })
14044
14067
  }, null, 4)])])) : g("", !0)
14045
14068
  ])])]));
14046
14069
  }
14047
- }), Kv = { class: "fixed inset-0 z-40 bg-background flex flex-col overflow-hidden" }, qv = { class: "flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30" }, Jv = { class: "flex items-center gap-3 min-w-0 flex-1" }, Yv = { class: "text-sm font-semibold truncate" }, Xv = { class: "flex-1 flex overflow-hidden min-w-0" }, Zv = { class: "w-10 bg-muted/50 border-r border-border flex flex-col items-center py-2 gap-1" }, Qv = { class: "flex-1 flex flex-col overflow-hidden min-w-0" }, $v = {
14070
+ }), Xv = { class: "fixed inset-0 z-40 bg-background flex flex-col overflow-hidden" }, Zv = { class: "flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30" }, Qv = { class: "flex items-center gap-3 min-w-0 flex-1" }, $v = { class: "text-sm font-semibold truncate" }, ey = { class: "flex-1 flex overflow-hidden min-w-0" }, ty = { class: "w-10 bg-muted/50 border-r border-border flex flex-col items-center py-2 gap-1" }, ny = { class: "flex-1 flex flex-col overflow-hidden min-w-0" }, ry = {
14048
14071
  key: 0,
14049
14072
  class: "flex-1 flex items-center justify-center"
14050
- }, ey = { class: "text-center max-w-md" }, ty = { class: "text-xs text-muted-foreground mb-4" }, ny = {
14073
+ }, iy = { class: "text-center max-w-md" }, ay = { class: "text-xs text-muted-foreground mb-4" }, oy = {
14051
14074
  key: 1,
14052
14075
  class: "flex-1 flex items-center justify-center"
14053
- }, ry = { class: "text-center" }, iy = {
14076
+ }, sy = { class: "text-center" }, cy = {
14054
14077
  key: 0,
14055
14078
  class: "flex-1 overflow-hidden"
14056
- }, ay = {
14079
+ }, ly = {
14057
14080
  key: 1,
14058
14081
  class: "flex-1 overflow-hidden flex"
14059
- }, oy = {
14082
+ }, uy = {
14060
14083
  key: 2,
14061
14084
  class: "flex-1 overflow-hidden"
14062
- }, sy = /* @__PURE__ */ S({
14085
+ }, dy = /* @__PURE__ */ S({
14063
14086
  __name: "DevToolsOverlay",
14064
14087
  props: {
14065
14088
  testGroups: {},
@@ -14114,7 +14137,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14114
14137
  let e = w.currentDocumentTitle;
14115
14138
  return e ? `Document Explorer: ${e}` : "Document Explorer";
14116
14139
  });
14117
- return (e, t) => (z(), _("div", Kv, [v("div", qv, [v("div", Jv, [v("span", Yv, W(T.value), 1)]), v("button", {
14140
+ return (e, t) => (z(), _("div", Xv, [v("div", Zv, [v("div", Qv, [v("span", $v, W(T.value), 1)]), v("button", {
14118
14141
  class: "p-1 hover:bg-muted rounded",
14119
14142
  title: "Close",
14120
14143
  onClick: C
@@ -14128,7 +14151,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14128
14151
  "stroke-linejoin": "round",
14129
14152
  "stroke-width": "2",
14130
14153
  d: "M6 18L18 6M6 6l12 12"
14131
- })], -1)]])]), v("div", Xv, [v("div", Zv, [
14154
+ })], -1)]])]), v("div", ey, [v("div", ty, [
14132
14155
  v("button", {
14133
14156
  class: P(["p-2 rounded", c.value === "documents" ? "bg-primary/10 text-primary" : "hover:bg-muted text-muted-foreground"]),
14134
14157
  title: "Document Explorer",
@@ -14174,24 +14197,24 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14174
14197
  "stroke-width": "2",
14175
14198
  d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
14176
14199
  })], -1)]], 2)
14177
- ]), v("div", Qv, [d.value ? (z(), _("div", $v, [v("div", ey, [
14200
+ ]), v("div", ny, [d.value ? (z(), _("div", ry, [v("div", iy, [
14178
14201
  t[7] ||= v("h2", { class: "text-sm font-semibold text-destructive mb-2" }, " Initialization Failed ", -1),
14179
- v("p", ty, W(d.value), 1),
14202
+ v("p", ay, W(d.value), 1),
14180
14203
  v("button", {
14181
14204
  class: "px-3 py-1.5 text-xs bg-primary text-primary-foreground rounded hover:bg-primary/90",
14182
14205
  onClick: p
14183
14206
  }, " Retry ")
14184
14207
  ])])) : l.value ? (z(), _(u, { key: 2 }, [
14185
- c.value === "documents" ? (z(), _("div", iy, [b(q_)])) : g("", !0),
14186
- c.value === "blobs" ? (z(), _("div", ay, [b(qd)])) : g("", !0),
14187
- c.value === "tests" ? (z(), _("div", oy, [b(Gv, {
14208
+ c.value === "documents" ? (z(), _("div", cy, [b(q_)])) : g("", !0),
14209
+ c.value === "blobs" ? (z(), _("div", ly, [b(qd)])) : g("", !0),
14210
+ c.value === "tests" ? (z(), _("div", uy, [b(Yv, {
14188
14211
  tests: x.value,
14189
14212
  "test-load-errors": r.testLoadErrors,
14190
14213
  "on-tests-complete": S
14191
14214
  }, null, 8, ["tests", "test-load-errors"])])) : g("", !0)
14192
- ], 64)) : (z(), _("div", ny, [v("div", ry, [b(tt), t[8] ||= v("p", { class: "mt-4 text-xs text-muted-foreground" }, " Initializing dev tools... ", -1)])]))])])]));
14215
+ ], 64)) : (z(), _("div", oy, [v("div", sy, [b(tt), t[8] ||= v("p", { class: "mt-4 text-xs text-muted-foreground" }, " Initializing dev tools... ", -1)])]))])])]));
14193
14216
  }
14194
- }), cy = "#devtools", ly = /* @__PURE__ */ S({
14217
+ }), fy = "#devtools", py = /* @__PURE__ */ S({
14195
14218
  __name: "DevToolsRoot",
14196
14219
  props: {
14197
14220
  testGroups: {},
@@ -14220,7 +14243,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14220
14243
  }
14221
14244
  let _ = !1, v = null;
14222
14245
  function y() {
14223
- !r.value && s.value && window.location.hash === cy && (r.value = !0);
14246
+ !r.value && s.value && window.location.hash === fy && (r.value = !0);
14224
14247
  }
14225
14248
  async function b() {
14226
14249
  try {
@@ -14243,7 +14266,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14243
14266
  }
14244
14267
  }
14245
14268
  function x() {
14246
- let e = window.location.hash === cy;
14269
+ let e = window.location.hash === fy;
14247
14270
  r.value && !e ? (r.value = !1, _ = !1) : !r.value && e && s.value && (r.value = !0);
14248
14271
  }
14249
14272
  I(() => {
@@ -14252,10 +14275,10 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14252
14275
  window.removeEventListener("popstate", x), document.removeEventListener("keydown", p), v?.(), v = null;
14253
14276
  });
14254
14277
  function S() {
14255
- r.value || (r.value = !0, _ = !0, history.pushState({ primitiveDevtools: !0 }, "", cy));
14278
+ r.value || (r.value = !0, _ = !0, history.pushState({ primitiveDevtools: !0 }, "", fy));
14256
14279
  }
14257
14280
  function C() {
14258
- r.value && (r.value = !1, window.location.hash === cy && (_ ? (_ = !1, history.back()) : history.replaceState(null, "", window.location.pathname + window.location.search)));
14281
+ r.value && (r.value = !1, window.location.hash === fy && (_ ? (_ = !1, history.back()) : history.replaceState(null, "", window.location.pathname + window.location.search)));
14259
14282
  }
14260
14283
  function w() {
14261
14284
  r.value ? C() : S();
@@ -14265,7 +14288,7 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14265
14288
  "is-open": r.value,
14266
14289
  "shortcut-hint": u.value,
14267
14290
  onClick: w
14268
- }, null, 8, ["is-open", "shortcut-hint"])) : g("", !0), r.value ? (z(), h(sy, {
14291
+ }, null, 8, ["is-open", "shortcut-hint"])) : g("", !0), r.value ? (z(), h(dy, {
14269
14292
  key: 1,
14270
14293
  "test-groups": n.testGroups,
14271
14294
  "test-load-errors": n.testLoadErrors,
@@ -14279,4 +14302,4 @@ var E_ = { class: "h-full flex flex-col min-w-0" }, D_ = {
14279
14302
  }
14280
14303
  });
14281
14304
  //#endregion
14282
- export { ly as DevToolsRoot, r as createTestDocument, n as destroyTestDocument, e as initializeJsBao, i as jsBaoClientService, t as setPrimitiveAppLogLevel };
14305
+ export { py as DevToolsRoot, r as createTestDocument, n as destroyTestDocument, e as initializeJsBao, i as jsBaoClientService, t as setPrimitiveAppLogLevel };
@@ -1 +1 @@
1
- let e=require("js-bao-wss-client");var t={debug:0,info:1,warn:2,error:3,none:4},n=`warn`,r=class e{#e;scope;constructor(e,t){this.#e=e,this.scope=t}get level(){return this.#e.level}set level(e){this.setLevel(e)}debug(...e){this.#t(`debug`,e)}log(...e){this.#t(`info`,e,`log`)}warn(...e){this.#t(`warn`,e)}error(...e){this.#t(`error`,e)}shouldLog(e){return t[e]>=t[this.level]}getLevel(){return this.level}setLevel(e){e in t&&(this.#e.level=e)}forScope(t){let n=t.trim(),r=n?[...this.scope,n]:this.scope;return new e(this.#e,r)}#t(e,t,n){if(!this.shouldLog(e))return;let r=n??(e===`info`?`log`:e),i=this.scope.length?`[${this.scope.join(`:`)}]`:void 0,a=i?[i,...t]:t;console[r](...a)}},i={level:n},a=new r(i,[]).forScope(`PrimitiveApp`);function o(e){i.level=e}var s=a.forScope(`JsBaoClientService`);function c(){if(typeof window>`u`)return!1;let e=window.location.hostname;return e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e.endsWith(`.localhost`)||e.endsWith(`.local`)}var l=new class{client=null;clientInitializationPromise=null;config=null;initialize(e){s.debug(`Initializing with config:`,{appId:e.appId?`${e.appId.substring(0,10)}...`:`MISSING`,apiUrl:e.apiUrl,wsUrl:e.wsUrl,oauthRedirectUri:e.oauthRedirectUri});let t=[];(!e.appId||e.appId===`MISSING_APP_ID`)&&t.push(`appId`),(!e.apiUrl||e.apiUrl===`MISSING_API_URL`)&&t.push(`apiUrl`),(!e.wsUrl||e.wsUrl===`MISSING_WS_URL`)&&t.push(`wsUrl`),(!e.oauthRedirectUri||e.oauthRedirectUri===`MISSING_OAUTH_REDIRECT_URI`)&&t.push(`oauthRedirectUri`),t.length>0&&(s.error(`❌ Configuration validation failed!`),s.error(`Missing or invalid fields:`,t),s.error(`This will cause OAuth and API calls to fail.`),s.error(`Please check your .env file configuration.`)),this.config=e}getConfig(){return this.config}async getClientAsync(){if(s.debug(`Getting client async`),this.clientInitializationPromise)return this.clientInitializationPromise;if(!this.config)throw Error(`JsBaoClientService not initialized. Call initialize() first.`);return this.clientInitializationPromise=(async()=>{s.debug(`=== INITIALIZING CLIENT ===`),s.debug(`Configuration:`,this.config);let t=await(0,e.initializeClient)(this.config);if(t.on(`status`,e=>{s.debug(`Client status changed:`,e)}),t.on(`error`,e=>{s.error(`Client error:`,e)}),this.client=t,c()&&(window.__primitiveAppClient=t,this.config?.models&&Array.isArray(this.config.models))){let e={};for(let t of this.config.models){let n=t.schema?.name;if(n){let r=n.charAt(0).toUpperCase()+n.slice(1);e[r]=t}}window.__primitiveAppModels=e,s.debug(`Registered models on window:`,Object.keys(e))}return s.debug(`=== CLIENT INITIALIZATION COMPLETE ===`),t})(),this.clientInitializationPromise}setExternalClient(e){s.debug(`Setting external client from host app`),this.client=e,this.clientInitializationPromise=Promise.resolve(e)}async clearClient(){s.debug(`Clearing client singleton...`),this.client&&(this.client.disconnect().catch(e=>{s.warn(`Background disconnect failed (this is usually harmless):`,e)}),this.client=null,this.clientInitializationPromise=null,c()&&(window.__primitiveAppClient=void 0,window.__primitiveAppModels=void 0))}};function u(e){l.initialize(e)}var d=a.forScope(`TestHarness`),f=`===TEST===`;async function p(e={}){let{networkSync:t=!1}=e,n=await l.getClientAsync(),r=`${f} ${`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}`;if(t){let{metadata:e}=await n.documents.create({title:r}),t=e.documentId,{doc:i}=await n.documents.open(t);if(!i)throw Error(`[TestHarness] Failed to open synced test document`);return n.setDefaultDocumentId(t),d.debug(`Created synced test document`,{docId:t}),m.set(t,{client:n,docId:t,networkSync:!0}),{docId:t}}let{metadata:i}=await n.documents.create({title:r,localOnly:!0}),a=i.documentId,{doc:o}=await n.documents.open(a,{waitForLoad:`local`,enableNetworkSync:!1});if(!o)throw Error(`[TestHarness] Failed to open test document`);return n.setDefaultDocumentId(a),d.debug(`Created test document`,{docId:a}),m.set(a,{client:n,docId:a,networkSync:!1}),{docId:a}}var m=new Map;async function h(e){let t=m.get(e.docId);if(!t){d.warn(`destroyTestDocument called with unknown handle`,{docId:e.docId});return}m.delete(e.docId);try{t.networkSync?await t.client.documents.delete(t.docId,{forceCloseIfOpen:!0}):(await t.client.documents.close(t.docId),await t.client.documents.evict(t.docId,{force:!0}))}catch(e){d.error(`Failed to destroy test document`,{docId:t.docId,err:e})}}async function g(){try{let e=await l.getClientAsync();d.debug(`[deleteAllTestDocuments] Starting cleanup...`),await e.syncMetadata({scope:`all`});let t=(await e.me.ownedDocuments()).filter(e=>e.title?.startsWith(f));if(t.length===0)return 0;d.debug(`[deleteAllTestDocuments] Found test documents to delete`,{count:t.length});let n=0;for(let r of t)try{e.documents.isOpen(r.documentId)&&await e.documents.close(r.documentId),await e.documents.evict(r.documentId,{force:!0}),n++}catch(e){d.error(`[deleteAllTestDocuments] Failed to delete test document`,{documentId:r.documentId,err:e})}return d.debug(`[deleteAllTestDocuments] Cleanup complete`,{evictedCount:n}),n}catch(e){return d.error(`[deleteAllTestDocuments] Top-level error during cleanup`,{err:e}),0}}function _(e){return e.flatMap(e=>e.tests.map(t=>({id:t.id,name:t.name,group:e.name,run:t.run})))}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
1
+ let e=require("js-bao-wss-client");var t={debug:0,info:1,warn:2,error:3,none:4},n=`warn`,r=class e{#e;scope;constructor(e,t){this.#e=e,this.scope=t}get level(){return this.#e.level}set level(e){this.setLevel(e)}debug(...e){this.#t(`debug`,e)}log(...e){this.#t(`info`,e,`log`)}warn(...e){this.#t(`warn`,e)}error(...e){this.#t(`error`,e)}shouldLog(e){return t[e]>=t[this.level]}getLevel(){return this.level}setLevel(e){e in t&&(this.#e.level=e)}forScope(t){let n=t.trim(),r=n?[...this.scope,n]:this.scope;return new e(this.#e,r)}#t(e,t,n){if(!this.shouldLog(e))return;let r=n??(e===`info`?`log`:e),i=this.scope.length?`[${this.scope.join(`:`)}]`:void 0,a=i?[i,...t]:t;console[r](...a)}},i={level:n},a=new r(i,[]).forScope(`PrimitiveApp`);function o(e){i.level=e}var s=a.forScope(`JsBaoClientService`);function c(){if(typeof window>`u`)return!1;let e=window.location.hostname;return e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e.endsWith(`.localhost`)||e.endsWith(`.local`)}var l=new class{client=null;clientInitializationPromise=null;config=null;initialize(e){s.debug(`Initializing with config:`,{appId:e.appId?`${e.appId.substring(0,10)}...`:`MISSING`,apiUrl:e.apiUrl,wsUrl:e.wsUrl,oauthRedirectUri:e.oauthRedirectUri});let t=[];(!e.appId||e.appId===`MISSING_APP_ID`)&&t.push(`appId`),(!e.apiUrl||e.apiUrl===`MISSING_API_URL`)&&t.push(`apiUrl`),(!e.wsUrl||e.wsUrl===`MISSING_WS_URL`)&&t.push(`wsUrl`),(!e.oauthRedirectUri||e.oauthRedirectUri===`MISSING_OAUTH_REDIRECT_URI`)&&t.push(`oauthRedirectUri`),t.length>0&&(s.error(`❌ Configuration validation failed!`),s.error(`Missing or invalid fields:`,t),s.error(`This will cause OAuth and API calls to fail.`),s.error(`Please check your .env file configuration.`)),this.config=e}getConfig(){return this.config}async getClientAsync(){if(s.debug(`Getting client async`),this.clientInitializationPromise)return this.clientInitializationPromise;if(!this.config)throw Error(`JsBaoClientService not initialized. Call initialize() first.`);return this.clientInitializationPromise=(async()=>{s.debug(`=== INITIALIZING CLIENT ===`),s.debug(`Configuration:`,this.config);let t=await(0,e.initializeClient)(this.config);if(t.on(`status`,e=>{s.debug(`Client status changed:`,e)}),t.on(`error`,e=>{s.error(`Client error:`,e)}),this.client=t,c()&&(window.__primitiveAppClient=t,this.config?.models&&Array.isArray(this.config.models))){let e={};for(let t of this.config.models){let n=t.schema?.name;if(n){let r=n.charAt(0).toUpperCase()+n.slice(1);e[r]=t}}window.__primitiveAppModels=e,s.debug(`Registered models on window:`,Object.keys(e))}return s.debug(`=== CLIENT INITIALIZATION COMPLETE ===`),t})(),this.clientInitializationPromise}setExternalClient(e){s.debug(`Setting external client from host app`),this.client=e,this.clientInitializationPromise=Promise.resolve(e)}async clearClient(){s.debug(`Clearing client singleton...`),this.client&&(this.client.disconnect().catch(e=>{s.warn(`Background disconnect failed (this is usually harmless):`,e)}),this.client=null,this.clientInitializationPromise=null,c()&&(window.__primitiveAppClient=void 0,window.__primitiveAppModels=void 0))}};function u(e){l.initialize(e)}var d=a.forScope(`TestHarness`),f=`===TEST===`;async function p(e={}){let{networkSync:t=!1}=e,n=await l.getClientAsync(),r=`${f} ${`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}`;if(t){let{metadata:e}=await n.documents.create({title:r}),t=e.documentId,{doc:i}=await n.documents.open(t);if(!i)throw Error(`[TestHarness] Failed to open synced test document`);return n.setDefaultDocumentId(t),d.debug(`Created synced test document`,{docId:t}),m.set(t,{client:n,docId:t,networkSync:!0}),{docId:t}}let{metadata:i}=await n.documents.create({title:r,localOnly:!0}),a=i.documentId,{doc:o}=await n.documents.open(a,{waitForLoad:`local`,enableNetworkSync:!1});if(!o)throw Error(`[TestHarness] Failed to open test document`);return n.setDefaultDocumentId(a),d.debug(`Created test document`,{docId:a}),m.set(a,{client:n,docId:a,networkSync:!1}),{docId:a}}var m=new Map;async function h(e){let t=m.get(e.docId);if(!t){d.warn(`destroyTestDocument called with unknown handle`,{docId:e.docId});return}m.delete(e.docId);try{t.networkSync?await t.client.documents.delete(t.docId,{forceCloseIfOpen:!0}):(await t.client.documents.close(t.docId),await t.client.documents.evict(t.docId,{force:!0}))}catch(e){d.error(`Failed to destroy test document`,{docId:t.docId,err:e})}}async function g(){try{let e=await l.getClientAsync();d.debug(`[deleteAllTestDocuments] Starting cleanup...`),await e.syncMetadata({scope:`all`});let t=(await e.me.ownedDocuments()).filter(e=>e.title?.startsWith(f));if(t.length===0)return 0;d.debug(`[deleteAllTestDocuments] Found test documents to delete`,{count:t.length});let n=0;for(let r of t)try{e.documents.isOpen(r.documentId)&&await e.documents.close(r.documentId),await e.documents.evict(r.documentId,{force:!0}),n++}catch(e){d.error(`[deleteAllTestDocuments] Failed to delete test document`,{documentId:r.documentId,err:e})}return d.debug(`[deleteAllTestDocuments] Cleanup complete`,{evictedCount:n}),n}catch(e){return d.error(`[deleteAllTestDocuments] Top-level error during cleanup`,{err:e}),0}}function _(e){return e.flatMap(e=>e.tests.map(t=>({id:t.id,name:t.name,group:e.name,environment:t.environment??e.environment,run:t.run})))}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
@@ -184,6 +184,7 @@ function _(e) {
184
184
  id: t.id,
185
185
  name: t.name,
186
186
  group: e.name,
187
+ environment: t.environment ?? e.environment,
187
188
  run: t.run
188
189
  })));
189
190
  }
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BNMv73og.cjs"),t=require("../lib-C53EcrFg.cjs");let n=require("js-bao-wss-client"),r=require("node:fs"),i=require("node:path");i=e.i(i,1);let a=require("vitest");var o=`000000`;function s(e,t,n){if(e)return e;throw Error(`[primitive-app/testing] Missing ${t}: pass it to registerPrimitiveTests() or set the ${n} environment variable.`)}function c(){let e=i.default.resolve(process.cwd(),`public/sql-wasm.wasm`);if(!(0,r.existsSync)(e)){console.warn(`[primitive-app/testing] ${e} not found — using the client's default database config. If client init fails to load sql-wasm.wasm, pass clientOptions.databaseConfig explicitly.`);return}return{type:`sqljs`,options:{locateFile:()=>e}}}async function l(e){let t=[],n=[];for(let[r,i]of Object.entries(e))try{let e=(await i())?.default;Array.isArray(e)?t.push(...e):e&&typeof e==`object`&&`tests`in e?t.push(e):n.push({file:r,error:Error(`Default export is not a TestGroup (expected { name, tests }).`)})}catch(e){n.push({file:r,error:e})}return{groups:t,failures:n}}async function u(e){let{models:r,testModules:i,otpCode:u=o,testTimeoutMs:d=6e4,clientOptions:f,cleanupTestDocuments:p=!0,failBelowFullScore:m=!0}=e,h=s(e.appId??process.env.VITE_APP_ID,`appId`,`VITE_APP_ID`),g=s(e.apiUrl??process.env.VITE_API_URL,`apiUrl`,`VITE_API_URL`),_=s(e.wsUrl??process.env.VITE_WS_URL,`wsUrl`,`VITE_WS_URL`),v=s(e.email??process.env.PRIMITIVE_TEST_EMAIL,`email`,`PRIMITIVE_TEST_EMAIL`),{groups:y,failures:b}=await l(i);for(let e of b)(0,a.describe)(e.file,()=>{(0,a.it)(`loads without errors`,()=>{throw e.error instanceof Error?e.error:Error(String(e.error))})});if(y.length===0){b.length===0&&console.warn(`[primitive-app/testing] No *.primitive-test.ts groups found — nothing to register.`);return}let x;(0,a.beforeAll)(async()=>{x=await(0,n.initializeClient)({apiUrl:g,wsUrl:_,appId:h,models:r,storageConfig:{type:`auto`},databaseConfig:c(),...f});try{await x.otpVerify(v,u)}catch(e){throw Error(`[primitive-app/testing] OTP sign-in failed for ${v}. The test bypass requires the app's testAccountBaseEmails whitelist to cover this address (and invite-only/domain/waitlist apps reject provisioning like any signup). Underlying error: ${e instanceof Error?e.message:String(e)}`)}t.o.initialize({apiUrl:g,wsUrl:_,appId:h,models:r,oauthRedirectUri:f?.oauthRedirectUri??process.env.VITE_OAUTH_REDIRECT_URI??`http://localhost/oauth/callback-unused-in-node-tests`,...f}),t.o.setExternalClient(x)},12e4),(0,a.afterAll)(async()=>{if(x){if(p)try{await t.r()}catch(e){console.warn(`[primitive-app/testing] Test-document cleanup failed:`,e)}await x.disconnect()}},6e4);for(let e of y)(0,a.describe)(e.name,()=>{for(let t of e.tests)(0,a.it)(t.name,async()=>{let e=await t.run(e=>console.log(`[${t.id}] ${e}`));e&&console.log(`[${t.id}] ${e}`);let n=e?.match(/^(\d+)\/(\d+)\s*\((\d+(?:\.\d+)?)%\)/);if(m&&n&&Number(n[1])!==Number(n[2]))throw Error(`Scored below full marks: ${e}`)},d)})}exports.PRIMITIVE_TEST_OTP_CODE=o,exports.registerPrimitiveTests=u;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BNMv73og.cjs"),t=require("../lib-CgtC-xno.cjs");let n=require("js-bao-wss-client"),r=require("node:fs"),i=require("node:path");i=e.i(i,1);let a=require("vitest");var o=`000000`;function s(e,t,n){if(e)return e;throw Error(`[primitive-app/testing] Missing ${t}: pass it to registerPrimitiveTests() or set the ${n} environment variable.`)}function c(){let e=i.default.resolve(process.cwd(),`public/sql-wasm.wasm`);if(!(0,r.existsSync)(e)){console.warn(`[primitive-app/testing] ${e} not found — using the client's default database config. If client init fails to load sql-wasm.wasm, pass clientOptions.databaseConfig explicitly.`);return}return{type:`sqljs`,options:{locateFile:()=>e}}}async function l(e){let t=[],n=[];for(let[r,i]of Object.entries(e))try{let e=(await i())?.default;Array.isArray(e)?t.push(...e):e&&typeof e==`object`&&`tests`in e?t.push(e):n.push({file:r,error:Error(`Default export is not a TestGroup (expected { name, tests }).`)})}catch(e){n.push({file:r,error:e})}return{groups:t,failures:n}}async function u(e){let{models:r,testModules:i,otpCode:u=o,testTimeoutMs:d=6e4,clientOptions:f,cleanupTestDocuments:p=!0,failBelowFullScore:m=!0}=e,h=s(e.appId??process.env.VITE_APP_ID,`appId`,`VITE_APP_ID`),g=s(e.apiUrl??process.env.VITE_API_URL,`apiUrl`,`VITE_API_URL`),_=s(e.wsUrl??process.env.VITE_WS_URL,`wsUrl`,`VITE_WS_URL`),v=s(e.email??process.env.PRIMITIVE_TEST_EMAIL,`email`,`PRIMITIVE_TEST_EMAIL`),{groups:y,failures:b}=await l(i);for(let e of b)(0,a.describe)(e.file,()=>{(0,a.it)(`loads without errors`,()=>{throw e.error instanceof Error?e.error:Error(String(e.error))})});if(y.length===0){b.length===0&&console.warn(`[primitive-app/testing] No *.primitive-test.ts groups found — nothing to register.`);return}let x;(0,a.beforeAll)(async()=>{x=await(0,n.initializeClient)({apiUrl:g,wsUrl:_,appId:h,models:r,storageConfig:{type:`auto`},databaseConfig:c(),...f});try{await x.otpVerify(v,u)}catch(e){throw Error(`[primitive-app/testing] OTP sign-in failed for ${v}. The test bypass requires the app's testAccountBaseEmails whitelist to cover this address (and invite-only/domain/waitlist apps reject provisioning like any signup). Underlying error: ${e instanceof Error?e.message:String(e)}`)}t.o.initialize({apiUrl:g,wsUrl:_,appId:h,models:r,oauthRedirectUri:f?.oauthRedirectUri??process.env.VITE_OAUTH_REDIRECT_URI??`http://localhost/oauth/callback-unused-in-node-tests`,...f}),t.o.setExternalClient(x)},12e4),(0,a.afterAll)(async()=>{if(x){if(p)try{await t.r()}catch(e){console.warn(`[primitive-app/testing] Test-document cleanup failed:`,e)}await x.disconnect()}},6e4);for(let e of y)(0,a.describe)(e.name,()=>{for(let t of e.tests){if((t.environment??e.environment)===`browser`){a.it.skip(t.name,()=>{});continue}(0,a.it)(t.name,async()=>{let e=await t.run(e=>console.log(`[${t.id}] ${e}`));e&&console.log(`[${t.id}] ${e}`);let n=e?.match(/^(\d+)\/(\d+)\s*\((\d+(?:\.\d+)?)%\)/);if(m&&n&&Number(n[1])!==Number(n[2]))throw Error(`Scored below full marks: ${e}`)},d)}})}exports.PRIMITIVE_TEST_OTP_CODE=o,exports.registerPrimitiveTests=u;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAO3B;;;GAGG;AACH,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAEhD,MAAM,WAAW,6BAA6B;IAC5C,uEAAuE;IACvE,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAErC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEpD,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE5C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAkED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CA8If"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAO3B;;;GAGG;AACH,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAEhD,MAAM,WAAW,6BAA6B;IAC5C,uEAAuE;IACvE,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAErC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAEpD,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE5C;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAkED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAqJf"}
@@ -1,4 +1,4 @@
1
- import { o as e, r as t } from "../lib-zKX4LVeH.js";
1
+ import { o as e, r as t } from "../lib-DjHuEFvC.js";
2
2
  import { initializeClient as n } from "js-bao-wss-client";
3
3
  import { existsSync as r } from "node:fs";
4
4
  import i from "node:path";
@@ -85,12 +85,18 @@ async function p(r) {
85
85
  }
86
86
  }, 6e4);
87
87
  for (let e of C) s(e.name, () => {
88
- for (let t of e.tests) c(t.name, async () => {
89
- let e = await t.run((e) => console.log(`[${t.id}] ${e}`));
90
- e && console.log(`[${t.id}] ${e}`);
91
- let n = e?.match(/^(\d+)\/(\d+)\s*\((\d+(?:\.\d+)?)%\)/);
92
- if (v && n && Number(n[1]) !== Number(n[2])) throw Error(`Scored below full marks: ${e}`);
93
- }, h);
88
+ for (let t of e.tests) {
89
+ if ((t.environment ?? e.environment) === "browser") {
90
+ c.skip(t.name, () => {});
91
+ continue;
92
+ }
93
+ c(t.name, async () => {
94
+ let e = await t.run((e) => console.log(`[${t.id}] ${e}`));
95
+ e && console.log(`[${t.id}] ${e}`);
96
+ let n = e?.match(/^(\d+)\/(\d+)\s*\((\d+(?:\.\d+)?)%\)/);
97
+ if (v && n && Number(n[1]) !== Number(n[2])) throw Error(`Scored below full marks: ${e}`);
98
+ }, h);
99
+ }
94
100
  });
95
101
  }
96
102
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primitive-app",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Primitive LLC",
6
6
  "type": "module",