@strifeapp/astro 1.0.24 → 1.0.26

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 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -262,29 +262,31 @@ function storeAs(name, value) {
262
262
 
263
263
  return result;
264
264
  }`, m = "strife:store", p = "\0" + m;
265
- function h(t) {
265
+ function h(e) {
266
266
  return {
267
267
  name: "strife:store",
268
- resolveId(l) {
269
- if (l === m)
268
+ resolveId(s) {
269
+ if (s === m)
270
270
  return p;
271
271
  },
272
- load(l) {
272
+ load(s) {
273
273
  var o;
274
- if (l === p)
274
+ if (s === p)
275
275
  return `
276
- import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
276
+ import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask } from "ravendb";
277
277
 
278
+ ${e.certificate && e.password ? `
278
279
  const authOptions = {
279
280
  type: 'pfx',
280
- certificate: Buffer.from(${d(t.certificate)}, 'base64'),
281
- password: ${d(t.password)},
281
+ certificate: Buffer.from(${d(e.certificate)}, 'base64'),
282
+ password: ${d(e.password)},
282
283
  };
284
+ ` : ""}
283
285
 
284
286
  const store = new DocumentStore(
285
- ${d(t.urls ? t.urls : [])},
286
- ${d(t.database || "")},
287
- authOptions
287
+ ${d(e.urls ? e.urls : [])},
288
+ ${d(e.database || "")}${e.certificate && e.password ? `,
289
+ authOptions` : ""}
288
290
  ).initialize()
289
291
 
290
292
  class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
@@ -293,7 +295,7 @@ function h(t) {
293
295
 
294
296
  this.additionalSources = {"Helper": ${d(y)}}
295
297
 
296
- ${(t.collections || ["Posts"]).map((e) => `this.map("${typeof e == "string" ? e : e.name}", (doc) => { return mapDocument(doc) });`).join(`
298
+ ${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
297
299
  `)}
298
300
 
299
301
  this.deploymentMode = 'Rolling';
@@ -307,8 +309,8 @@ function h(t) {
307
309
 
308
310
  const bulkInsert = store.bulkInsert();
309
311
 
310
- ${(o = t.collections) == null ? void 0 : o.map((e) => `
311
- await bulkInsert.store(${JSON.stringify(e)}, 'templates/${e.name}', { '@collection': 'Templates' });
312
+ ${(o = e.collections) == null ? void 0 : o.map((t) => `
313
+ await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
312
314
  `).join(`
313
315
  `)}
314
316
 
@@ -322,48 +324,44 @@ function h(t) {
322
324
  const T = {
323
325
  type: "pfx"
324
326
  };
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;
327
+ function R(e, s) {
328
+ let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, l = process.env.STRIFE_CERTIFICATE_PASSWORD;
329
+ if (!o || !t || !r || !l) {
330
+ const n = f(e, s ?? "", "");
331
+ o = o || n.STRIFE_DATABASE_URLS, t = t || n.STRIFE_DATABASE, r = r || n.STRIFE_CERTIFICATE, l = l || n.STRIFE_CERTIFICATE_PASSWORD;
330
332
  }
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]"}`), {
333
+ 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: ${l ? "[SET]" : "[NOT SET]"}`), {
332
334
  urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
333
- database: e || void 0,
335
+ database: t || void 0,
334
336
  certificate: r || void 0,
335
- password: a || void 0
337
+ password: l || void 0
336
338
  };
337
339
  }
338
- function E(t) {
340
+ function v(e) {
339
341
  return {
340
342
  name: "@strife/astro",
341
343
  hooks: {
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.");
345
- const n = {
344
+ "astro:config:setup": ({ command: s, config: o, updateConfig: t }) => {
345
+ const r = o.vite.envDir || process.cwd(), l = R(s, r), n = {
346
346
  ...T,
347
347
  ...Object.fromEntries(
348
- Object.entries(a).filter(([s, i]) => !!i)
348
+ Object.entries(l).filter(([a, i]) => !!i)
349
349
  ),
350
- ...t ? Object.fromEntries(
351
- Object.entries(t).filter(([s, i]) => !!i)
350
+ ...e ? Object.fromEntries(
351
+ Object.entries(e).filter(([a, i]) => !!i)
352
352
  ) : {}
353
- };
354
- console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
355
- const c = ["urls", "database", "certificate", "password"], u = c.filter(
356
- (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
353
+ }, c = ["urls", "database"], u = c.filter(
354
+ (a) => !n[a] || Array.isArray(n[a]) && n[a].length === 0
357
355
  );
358
356
  if (u.length > 0)
359
357
  throw new Error(
360
358
  `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
361
359
  Set them in your .env file (for local) or Vercel project settings (for deployment).
362
360
  Current values:
363
- ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
361
+ ` + c.map((a) => ` ${a}: ${JSON.stringify(n[a])}`).join(`
364
362
  `)
365
363
  );
366
- e({
364
+ t({
367
365
  vite: {
368
366
  plugins: [
369
367
  h(n)
@@ -375,5 +373,5 @@ Current values:
375
373
  };
376
374
  }
377
375
  export {
378
- E as default
376
+ v as default
379
377
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",