@strifeapp/astro 1.0.23 → 1.0.24

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 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -262,7 +262,7 @@ 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
268
  resolveId(l) {
@@ -270,19 +270,20 @@ function h(e) {
270
270
  return p;
271
271
  },
272
272
  load(l) {
273
+ var o;
273
274
  if (l === 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,51 @@ 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 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;
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: ${a ? "[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
335
  password: a || void 0
322
336
  };
323
337
  }
324
- function E(e) {
338
+ function E(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: 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 = {
332
346
  ...T,
333
347
  ...Object.fromEntries(
334
348
  Object.entries(a).filter(([s, i]) => !!i)
335
349
  ),
336
- ...e ? Object.fromEntries(
337
- Object.entries(e).filter(([s, i]) => !!i)
350
+ ...t ? Object.fromEntries(
351
+ Object.entries(t).filter(([s, i]) => !!i)
338
352
  ) : {}
339
353
  };
340
- console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(t, null, 2));
354
+ console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
341
355
  const c = ["urls", "database", "certificate", "password"], u = c.filter(
342
- (s) => !t[s] || Array.isArray(t[s]) && t[s].length === 0
356
+ (s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
343
357
  );
344
358
  if (u.length > 0)
345
359
  throw new Error(
346
360
  `[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
347
361
  Set them in your .env file (for local) or Vercel project settings (for deployment).
348
362
  Current values:
349
- ` + c.map((s) => ` ${s}: ${JSON.stringify(t[s])}`).join(`
363
+ ` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
350
364
  `)
351
365
  );
352
- o({
366
+ e({
353
367
  vite: {
354
368
  plugins: [
355
- h(t)
369
+ h(n)
356
370
  ]
357
371
  }
358
372
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strifeapp/astro",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Official Strife Astro integration",
5
5
  "keywords": [
6
6
  "astro-integration",