@strifeapp/astro 1.0.23 → 1.0.25

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