@strifeapp/astro 1.0.14 → 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 +40 -28
  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)
275
- return console.log("[vitePluginStrifeStore] Generating virtual module code with config:", JSON.stringify(e, null, 2)), `
272
+ load(i) {
273
+ var o, r;
274
+ if (i === p)
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
  `)}
@@ -302,11 +312,13 @@ function h(e) {
302
312
  }
303
313
 
304
314
  console.log('Deploying index...');
315
+ console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
316
+
305
317
  await IndexCreation.createIndexes([new Content_ByUrl()], store);
306
318
 
307
319
  const bulkInsert = store.bulkInsert();
308
320
 
309
- ${(o = e.collections) == null ? void 0 : o.map((t) => `
321
+ ${(r = e.collections) == null ? void 0 : r.map((t) => `
310
322
  await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
311
323
  `).join(`
312
324
  `)}
@@ -321,33 +333,33 @@ function h(e) {
321
333
  const T = {
322
334
  type: "pfx"
323
335
  };
324
- function g(e, l) {
325
- let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
326
- if (!o || !t || !r || !a) {
327
- const n = f(e, l ?? "", "");
328
- 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;
329
341
  }
330
- 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]"}`), {
331
343
  urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
332
- database: t || void 0,
333
- certificate: r || void 0,
344
+ database: r || void 0,
345
+ certificate: t || void 0,
334
346
  password: a || void 0
335
347
  };
336
348
  }
337
- function E(e) {
349
+ function A(e) {
338
350
  return {
339
351
  name: "@strife/astro",
340
352
  hooks: {
341
- "astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
342
- 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);
343
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.");
344
356
  const n = {
345
357
  ...T,
346
358
  ...Object.fromEntries(
347
- Object.entries(a).filter(([s, i]) => !!i)
359
+ Object.entries(a).filter(([s, d]) => !!d)
348
360
  ),
349
361
  ...e ? Object.fromEntries(
350
- Object.entries(e).filter(([s, i]) => !!i)
362
+ Object.entries(e).filter(([s, d]) => !!d)
351
363
  ) : {}
352
364
  };
353
365
  console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
@@ -362,7 +374,7 @@ Current values:
362
374
  ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
363
375
  `)
364
376
  );
365
- t({
377
+ r({
366
378
  vite: {
367
379
  plugins: [
368
380
  h(n)
@@ -374,5 +386,5 @@ Current values:
374
386
  };
375
387
  }
376
388
  export {
377
- E as default
389
+ A as default
378
390
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",