@nextsparkjs/core 0.1.0-beta.152 → 0.1.0-beta.154

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generic-handler.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/entity/generic-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAyhBvD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CA+fnF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CA+WrF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAmMpJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAmXtJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAoJtJ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,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAEtF"}
@@ -739,7 +739,9 @@ async function handleGenericCreate(request) {
739
739
  values.push(relationId);
740
740
  } else if (field.type === "relation-multi") {
741
741
  placeholders.push(`$${paramCount++}::jsonb`);
742
- values.push(value);
742
+ values.push(
743
+ typeof value === "string" ? value : JSON.stringify(Array.isArray(value) ? value : [])
744
+ );
743
745
  } else if (field.type === "tags") {
744
746
  placeholders.push(`$${paramCount++}::jsonb`);
745
747
  values.push(JSON.stringify(Array.isArray(value) ? value : []));
@@ -1144,7 +1146,9 @@ async function handleGenericUpdate(request, { params }) {
1144
1146
  values.push(relationId);
1145
1147
  } else if (field.type === "relation-multi") {
1146
1148
  updates.push(`${columnName} = $${paramCount++}::jsonb`);
1147
- values.push(value);
1149
+ values.push(
1150
+ typeof value === "string" ? value : JSON.stringify(Array.isArray(value) ? value : [])
1151
+ );
1148
1152
  } else if (field.type === "tags") {
1149
1153
  updates.push(`${columnName} = $${paramCount++}::jsonb`);
1150
1154
  values.push(JSON.stringify(Array.isArray(value) ? value : []));
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2026-05-26T19:28:10.299Z",
2
+ "generated": "2026-05-27T00:35:24.358Z",
3
3
  "totalClasses": 1080,
4
4
  "classes": [
5
5
  "!text-2xl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/core",
3
- "version": "0.1.0-beta.152",
3
+ "version": "0.1.0-beta.154",
4
4
  "description": "NextSpark - The complete SaaS framework for Next.js",
5
5
  "license": "MIT",
6
6
  "author": "NextSpark <hello@nextspark.dev>",
@@ -467,7 +467,7 @@
467
467
  "tailwind-merge": "^3.3.1",
468
468
  "uuid": "^13.0.0",
469
469
  "zod": "^4.1.5",
470
- "@nextsparkjs/testing": "0.1.0-beta.152"
470
+ "@nextsparkjs/testing": "0.1.0-beta.154"
471
471
  },
472
472
  "scripts": {
473
473
  "postinstall": "node scripts/postinstall.mjs || true",
@@ -40,13 +40,22 @@ function slugToIdentifier(slug) {
40
40
  }
41
41
 
42
42
  /**
43
- * Walk a directory and return its email entries (one per .ts/.tsx file at the
43
+ * Walk a directory and return its email entries (one per template file at the
44
44
  * top level — emails are not nested).
45
45
  *
46
+ * Source files are `.ts`/`.tsx` (monorepo mode + theme overrides). Compiled
47
+ * npm distributions ship `.js` + `.d.ts` only — the `.d.ts` carries the
48
+ * canonical slug list (one per template, paired with the `.js` runtime),
49
+ * so we accept `.d.ts` files as slug markers when `acceptCompiled` is true.
50
+ * The generator's import path stays the same (`@nextsparkjs/core/emails/<slug>`)
51
+ * and the bundler resolves to the `.js` runtime at build time.
52
+ *
46
53
  * @param {string} dir
54
+ * @param {{ acceptCompiled?: boolean }} [options]
47
55
  * @returns {Promise<Array<{ slug: string, fileName: string }>>}
48
56
  */
49
- async function listEmailFiles(dir) {
57
+ async function listEmailFiles(dir, options = {}) {
58
+ const { acceptCompiled = false } = options
50
59
  let entries
51
60
  try {
52
61
  entries = await readdir(dir, { withFileTypes: true })
@@ -55,17 +64,30 @@ async function listEmailFiles(dir) {
55
64
  return []
56
65
  }
57
66
 
67
+ const seen = new Set()
58
68
  const out = []
59
69
  for (const entry of entries) {
60
70
  if (!entry.isFile()) continue
61
- if (!entry.name.endsWith('.ts') && !entry.name.endsWith('.tsx')) continue
62
71
  // Skip barrel files and underscore-prefixed (README/notes)
63
- if (entry.name === 'index.ts' || entry.name === 'index.tsx') continue
64
72
  if (entry.name.startsWith('_')) continue
65
- if (entry.name.endsWith('.d.ts')) continue
73
+ if (entry.name === 'index.ts' || entry.name === 'index.tsx') continue
74
+ if (entry.name === 'index.js' || entry.name === 'index.d.ts') continue
66
75
  if (entry.name.endsWith('.test.ts') || entry.name.endsWith('.test.tsx')) continue
67
-
68
- const slug = entry.name.replace(/\.(tsx|ts)$/, '')
76
+ if (entry.name.endsWith('.d.ts.map')) continue
77
+
78
+ let slug = null
79
+ if (entry.name.endsWith('.tsx')) {
80
+ slug = entry.name.slice(0, -4)
81
+ } else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {
82
+ slug = entry.name.slice(0, -3)
83
+ } else if (acceptCompiled && entry.name.endsWith('.d.ts')) {
84
+ // Compiled dist directory — the .d.ts is the slug marker for the
85
+ // matching .js runtime that the bundler will resolve via the package
86
+ // exports field at consumer build time.
87
+ slug = entry.name.slice(0, -5)
88
+ }
89
+ if (!slug || seen.has(slug)) continue
90
+ seen.add(slug)
69
91
  out.push({ slug, fileName: entry.name })
70
92
  }
71
93
  return out
@@ -98,8 +120,12 @@ export async function discoverEmails(config = DEFAULT_CONFIG) {
98
120
  /** @type {Map<string, DiscoveredEmail>} */
99
121
  const merged = new Map()
100
122
 
101
- // Core defaults
102
- const coreFiles = await listEmailFiles(coreEmailsDir)
123
+ // Core defaults — in npm mode the package ships `.d.ts` + `.js` only, so
124
+ // accept `.d.ts` as slug markers there. Monorepo mode keeps the original
125
+ // `.ts`-only contract since the source tree has the uncompiled files.
126
+ const coreFiles = await listEmailFiles(coreEmailsDir, {
127
+ acceptCompiled: !!config.isNpmMode,
128
+ })
103
129
  if (coreFiles.length > 0) {
104
130
  verbose(`Found ${coreFiles.length} core email template(s) in: ${coreEmailsDir}`)
105
131
  for (const { slug } of coreFiles) {