@strifeapp/astro 1.0.15 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +49 -40
  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 d from "serialize-javascript";
2
+ import l 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
@@ -261,29 +261,38 @@ function storeAs(name, value) {
261
261
  });
262
262
 
263
263
  return result;
264
- }`, m = "strife:store", p = "\0" + m;
265
- function h(e) {
266
- return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), {
264
+ }`, h = {}, m = "strife:store", p = "\0" + m;
265
+ function T(e) {
266
+ var i;
267
+ return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), h.get(((i = e.urls) == null ? void 0 : i[0]) || "", (t) => {
268
+ console.log("Test SSR fetch to RavenDB:", t.statusCode);
269
+ }).on("error", (t) => {
270
+ console.error("SSR network error to RavenDB:", t);
271
+ }), {
267
272
  name: "strife:store",
268
- resolveId(l) {
269
- if (l === m)
273
+ resolveId(t) {
274
+ if (t === m)
270
275
  return p;
271
276
  },
272
- load(l) {
273
- var o;
274
- if (l === p)
277
+ load(t) {
278
+ var r;
279
+ if (t === p)
275
280
  return `
276
281
  import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
277
282
 
278
283
  const authOptions = {
279
284
  type: 'pfx',
280
- certificate: Buffer.from(${d(e.certificate)}, 'base64'),
281
- password: ${d(e.password)},
285
+ certificate: Buffer.from(${l(e.certificate)}, 'base64'),
286
+ password: ${l(e.password)},
282
287
  };
283
288
 
289
+ console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${l(e.urls)});
290
+ console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
291
+ console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
292
+
284
293
  const store = new DocumentStore(
285
- ${d(e.urls ? e.urls : [])},
286
- ${d(e.database || "")},
294
+ ${l(e.urls ? e.urls : [])},
295
+ ${l(e.database || "")},
287
296
  authOptions
288
297
  ).initialize();
289
298
 
@@ -291,9 +300,9 @@ function h(e) {
291
300
  constructor() {
292
301
  super();
293
302
 
294
- this.additionalSources = {"Helper": ${d(y)}}
303
+ this.additionalSources = {"Helper": ${l(y)}}
295
304
 
296
- ${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
305
+ ${(e.collections || ["Posts"]).map((n) => `this.map("${typeof n == "string" ? n : n.name}", (doc) => { return mapDocument(doc) });`).join(`
297
306
  `)}
298
307
 
299
308
  this.deploymentMode = 'Rolling';
@@ -308,8 +317,8 @@ function h(e) {
308
317
 
309
318
  const bulkInsert = store.bulkInsert();
310
319
 
311
- ${(o = e.collections) == null ? void 0 : o.map((t) => `
312
- await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
320
+ ${(r = e.collections) == null ? void 0 : r.map((n) => `
321
+ await bulkInsert.store(${JSON.stringify(n)}, 'templates/${n.name}', { '@collection': 'Templates' });
313
322
  `).join(`
314
323
  `)}
315
324
 
@@ -320,54 +329,54 @@ function h(e) {
320
329
  }
321
330
  };
322
331
  }
323
- const T = {
332
+ const g = {
324
333
  type: "pfx"
325
334
  };
326
- function g(e, l) {
327
- let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
328
- if (!o || !t || !r || !a) {
329
- const n = f(e, l ?? "", "");
330
- o = o || n.STRIFE_DATABASE_URLS, t = t || n.STRIFE_DATABASE, r = r || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
335
+ function R(e, i) {
336
+ let t = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, n = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
337
+ if (!t || !r || !n || !a) {
338
+ const o = f(e, i ?? "", "");
339
+ t = t || o.STRIFE_DATABASE_URLS, r = r || o.STRIFE_DATABASE, n = n || o.STRIFE_CERTIFICATE, a = a || o.STRIFE_CERTIFICATE_PASSWORD;
331
340
  }
332
- return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${t || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${r ? `[SET, length=${r.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
333
- urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
334
- database: t || void 0,
335
- certificate: r || void 0,
341
+ return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${t ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${r || "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE: ${n ? `[SET, length=${n.length}]` : "[NOT SET]"}`), console.log(` STRIFE_CERTIFICATE_PASSWORD: ${a ? "[SET]" : "[NOT SET]"}`), {
342
+ urls: t ? t.split(",").map((o) => o.trim()).filter(Boolean) : void 0,
343
+ database: r || void 0,
344
+ certificate: n || void 0,
336
345
  password: a || void 0
337
346
  };
338
347
  }
339
- function E(e) {
348
+ function A(e) {
340
349
  return {
341
350
  name: "@strife/astro",
342
351
  hooks: {
343
- "astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
344
- const r = o.vite.envDir || process.cwd(), a = g(l, r);
352
+ "astro:config:setup": ({ command: i, config: t, updateConfig: r }) => {
353
+ const n = t.vite.envDir || process.cwd(), a = R(i, n);
345
354
  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.");
346
- const n = {
347
- ...T,
355
+ const o = {
356
+ ...g,
348
357
  ...Object.fromEntries(
349
- Object.entries(a).filter(([s, i]) => !!i)
358
+ Object.entries(a).filter(([s, d]) => !!d)
350
359
  ),
351
360
  ...e ? Object.fromEntries(
352
- Object.entries(e).filter(([s, i]) => !!i)
361
+ Object.entries(e).filter(([s, d]) => !!d)
353
362
  ) : {}
354
363
  };
355
- console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
364
+ console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(o, null, 2));
356
365
  const c = ["urls", "database", "certificate", "password"], u = c.filter(
357
- (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
366
+ (s) => !o[s] || Array.isArray(o[s]) && o[s].length === 0
358
367
  );
359
368
  if (u.length > 0)
360
369
  throw new Error(
361
370
  `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
362
371
  Set them in your .env file (for local) or Vercel project settings (for deployment).
363
372
  Current values:
364
- ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
373
+ ` + c.map((s) => ` ${s}: ${JSON.stringify(o[s])}`).join(`
365
374
  `)
366
375
  );
367
- t({
376
+ r({
368
377
  vite: {
369
378
  plugins: [
370
- h(n)
379
+ T(o)
371
380
  ]
372
381
  }
373
382
  });
@@ -376,5 +385,5 @@ Current values:
376
385
  };
377
386
  }
378
387
  export {
379
- E as default
388
+ A as default
380
389
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",