@strifeapp/astro 1.0.18 → 1.0.20

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { loadEnv as f } from "vite";
2
- import l from "serialize-javascript";
2
+ import s from "serialize-javascript";
3
3
  const y = `/**
4
4
  * Creates an indexed item that will be stored in the index.
5
5
  * @param {string} name - Name of property to index
@@ -270,32 +270,24 @@ function h(e) {
270
270
  return p;
271
271
  },
272
272
  load(i) {
273
- var o, r;
273
+ var o, r, a;
274
274
  if (i === p)
275
275
  return `
276
276
  import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
277
- import https from 'https';
278
-
279
- https.get(${l(((o = e.urls) == null ? void 0 : o[0]) || "")}, (res) => {
280
- console.log('Test SSR fetch to RavenDB:', res.statusCode);
281
- }).on('error', (e) => {
282
- console.error('SSR network error to RavenDB:', e);
283
- });
284
-
285
277
 
286
278
  const authOptions = {
287
279
  type: 'pfx',
288
- certificate: Buffer.from(${l(e.certificate)}, 'base64'),
289
- password: ${l(e.password)},
280
+ certificate: Buffer.from(${s(e.certificate)}, 'base64'),
281
+ password: ${s(e.password)},
290
282
  };
291
283
 
292
- console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${l(e.urls)});
293
- console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
284
+ console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${s(e.urls)});
285
+ console.log('[vitePluginStrifeStore] Using database:', ${s(e.database)});
294
286
  console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
295
287
 
296
288
  const store = new DocumentStore(
297
- ${l(e.urls ? e.urls : [])},
298
- ${l(e.database || "")},
289
+ ${s(e.urls ? e.urls : [])},
290
+ ${s(e.database || "")},
299
291
  authOptions
300
292
  ).initialize();
301
293
 
@@ -303,7 +295,7 @@ function h(e) {
303
295
  constructor() {
304
296
  super();
305
297
 
306
- this.additionalSources = {"Helper": ${l(y)}}
298
+ this.additionalSources = {"Helper": ${s(y)}}
307
299
 
308
300
  ${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
309
301
  `)}
@@ -315,12 +307,20 @@ function h(e) {
315
307
 
316
308
  console.log('Deploying index...');
317
309
  console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
310
+ console.log('Test SSR fetch to RavenDB:', ${s(((o = e.urls) == null ? void 0 : o[0]) || "")});
311
+ console.log('Pinging RavenDB server before connecting...');
312
+ try {
313
+ const res = await fetch(${s((r = e.urls) == null ? void 0 : r[0])}, { method: 'GET' });
314
+ console.log('Ping result status:', res.status);
315
+ } catch (err) {
316
+ console.error('Ping failed:', err);
317
+ }
318
318
 
319
319
  await IndexCreation.createIndexes([new Content_ByUrl()], store);
320
320
 
321
321
  const bulkInsert = store.bulkInsert();
322
322
 
323
- ${(r = e.collections) == null ? void 0 : r.map((t) => `
323
+ ${(a = e.collections) == null ? void 0 : a.map((t) => `
324
324
  await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
325
325
  `).join(`
326
326
  `)}
@@ -332,48 +332,48 @@ function h(e) {
332
332
  }
333
333
  };
334
334
  }
335
- const T = {
335
+ const g = {
336
336
  type: "pfx"
337
337
  };
338
- function g(e, i) {
339
- let o = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, t = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
340
- if (!o || !r || !t || !a) {
338
+ function T(e, i) {
339
+ let o = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, a = process.env.STRIFE_CERTIFICATE, t = process.env.STRIFE_CERTIFICATE_PASSWORD;
340
+ if (!o || !r || !a || !t) {
341
341
  const n = f(e, i ?? "", "");
342
- o = o || n.STRIFE_DATABASE_URLS, r = r || n.STRIFE_DATABASE, t = t || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
342
+ o = o || n.STRIFE_DATABASE_URLS, r = r || n.STRIFE_DATABASE, a = a || n.STRIFE_CERTIFICATE, t = t || n.STRIFE_CERTIFICATE_PASSWORD;
343
343
  }
344
- return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${r || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${t ? `[SET, length=${t.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
344
+ return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${r || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${a ? `[SET, length=${a.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${t ? "[SET]" : "[NOT SET]"}`), {
345
345
  urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
346
346
  database: r || void 0,
347
- certificate: t || void 0,
348
- password: a || void 0
347
+ certificate: a || void 0,
348
+ password: t || void 0
349
349
  };
350
350
  }
351
- function v(e) {
351
+ function E(e) {
352
352
  return {
353
353
  name: "@strife/astro",
354
354
  hooks: {
355
355
  "astro:config:setup": ({ command: i, config: o, updateConfig: r }) => {
356
- const t = o.vite.envDir || process.cwd(), a = g(i, t);
357
- console.log("[strifeIntegration] envOptions:", JSON.stringify(a, null, 2)), e ? console.log("[strifeIntegration] options passed by user:", JSON.stringify(e, null, 2)) : console.log("[strifeIntegration] No options explicitly passed.");
356
+ const a = o.vite.envDir || process.cwd(), t = T(i, a);
357
+ console.log("[strifeIntegration] envOptions:", JSON.stringify(t, null, 2)), e ? console.log("[strifeIntegration] options passed by user:", JSON.stringify(e, null, 2)) : console.log("[strifeIntegration] No options explicitly passed.");
358
358
  const n = {
359
- ...T,
359
+ ...g,
360
360
  ...Object.fromEntries(
361
- Object.entries(a).filter(([s, d]) => !!d)
361
+ Object.entries(t).filter(([l, d]) => !!d)
362
362
  ),
363
363
  ...e ? Object.fromEntries(
364
- Object.entries(e).filter(([s, d]) => !!d)
364
+ Object.entries(e).filter(([l, d]) => !!d)
365
365
  ) : {}
366
366
  };
367
367
  console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
368
368
  const c = ["urls", "database", "certificate", "password"], u = c.filter(
369
- (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
369
+ (l) => !n[l] || Array.isArray(n[l]) && n[l].length === 0
370
370
  );
371
371
  if (u.length > 0)
372
372
  throw new Error(
373
373
  `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
374
374
  Set them in your .env file (for local) or Vercel project settings (for deployment).
375
375
  Current values:
376
- ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
376
+ ` + c.map((l) => ` ${l}: ${JSON.stringify(n[l])}`).join(`
377
377
  `)
378
378
  );
379
379
  r({
@@ -388,5 +388,5 @@ Current values:
388
388
  };
389
389
  }
390
390
  export {
391
- v as default
391
+ E as default
392
392
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",