@strifeapp/astro 1.0.20 → 1.0.22

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