@strifeapp/astro 1.0.15 → 1.0.16

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 +37 -27
  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
@@ -265,25 +265,35 @@ function storeAs(name, value) {
265
265
  function h(e) {
266
266
  return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), {
267
267
  name: "strife:store",
268
- resolveId(l) {
269
- if (l === m)
268
+ resolveId(i) {
269
+ if (i === m)
270
270
  return p;
271
271
  },
272
- load(l) {
273
- var o;
274
- if (l === p)
272
+ load(i) {
273
+ var o, r;
274
+ if (i === p)
275
275
  return `
276
276
  import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
277
277
 
278
278
  const authOptions = {
279
279
  type: 'pfx',
280
- certificate: Buffer.from(${d(e.certificate)}, 'base64'),
281
- password: ${d(e.password)},
280
+ certificate: Buffer.from(${l(e.certificate)}, 'base64'),
281
+ password: ${l(e.password)},
282
282
  };
283
283
 
284
+ console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${l(e.urls)});
285
+ console.log('[vitePluginStrifeStore] Using database:', ${l(e.database)});
286
+ console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
287
+
288
+ https.get(${l(((o = e.urls) == null ? void 0 : o[0]) || "")}, (res) => {
289
+ console.log('Test fetch to RavenDB:', res.statusCode);
290
+ }).on('error', (e) => {
291
+ console.error('Network error to RavenDB:', e);
292
+ });
293
+
284
294
  const store = new DocumentStore(
285
- ${d(e.urls ? e.urls : [])},
286
- ${d(e.database || "")},
295
+ ${l(e.urls ? e.urls : [])},
296
+ ${l(e.database || "")},
287
297
  authOptions
288
298
  ).initialize();
289
299
 
@@ -291,7 +301,7 @@ function h(e) {
291
301
  constructor() {
292
302
  super();
293
303
 
294
- this.additionalSources = {"Helper": ${d(y)}}
304
+ this.additionalSources = {"Helper": ${l(y)}}
295
305
 
296
306
  ${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
297
307
  `)}
@@ -308,7 +318,7 @@ function h(e) {
308
318
 
309
319
  const bulkInsert = store.bulkInsert();
310
320
 
311
- ${(o = e.collections) == null ? void 0 : o.map((t) => `
321
+ ${(r = e.collections) == null ? void 0 : r.map((t) => `
312
322
  await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
313
323
  `).join(`
314
324
  `)}
@@ -323,33 +333,33 @@ function h(e) {
323
333
  const T = {
324
334
  type: "pfx"
325
335
  };
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;
336
+ function g(e, i) {
337
+ let o = process.env.STRIFE_DATABASE_URLS, r = process.env.STRIFE_DATABASE, t = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
338
+ if (!o || !r || !t || !a) {
339
+ const n = f(e, i ?? "", "");
340
+ o = o || n.STRIFE_DATABASE_URLS, r = r || n.STRIFE_DATABASE, t = t || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
331
341
  }
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]"}`), {
342
+ 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]"}`), {
333
343
  urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
334
- database: t || void 0,
335
- certificate: r || void 0,
344
+ database: r || void 0,
345
+ certificate: t || void 0,
336
346
  password: a || void 0
337
347
  };
338
348
  }
339
- function E(e) {
349
+ function A(e) {
340
350
  return {
341
351
  name: "@strife/astro",
342
352
  hooks: {
343
- "astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
344
- const r = o.vite.envDir || process.cwd(), a = g(l, r);
353
+ "astro:config:setup": ({ command: i, config: o, updateConfig: r }) => {
354
+ const t = o.vite.envDir || process.cwd(), a = g(i, t);
345
355
  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
356
  const n = {
347
357
  ...T,
348
358
  ...Object.fromEntries(
349
- Object.entries(a).filter(([s, i]) => !!i)
359
+ Object.entries(a).filter(([s, d]) => !!d)
350
360
  ),
351
361
  ...e ? Object.fromEntries(
352
- Object.entries(e).filter(([s, i]) => !!i)
362
+ Object.entries(e).filter(([s, d]) => !!d)
353
363
  ) : {}
354
364
  };
355
365
  console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
@@ -364,7 +374,7 @@ Current values:
364
374
  ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
365
375
  `)
366
376
  );
367
- t({
377
+ r({
368
378
  vite: {
369
379
  plugins: [
370
380
  h(n)
@@ -376,5 +386,5 @@ Current values:
376
386
  };
377
387
  }
378
388
  export {
379
- E as default
389
+ A as default
380
390
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",