@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.
- package/dist/index.js +40 -26
- 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(
|
|
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(
|
|
280
|
-
password: ${d(
|
|
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(
|
|
285
|
-
${d(
|
|
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
|
-
${(
|
|
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
|
|
312
|
-
let
|
|
313
|
-
if (!
|
|
314
|
-
const
|
|
315
|
-
|
|
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: ${
|
|
318
|
-
urls:
|
|
319
|
-
database:
|
|
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(
|
|
338
|
+
function E(t) {
|
|
325
339
|
return {
|
|
326
340
|
name: "@strife/astro",
|
|
327
341
|
hooks: {
|
|
328
|
-
"astro:config:setup": ({ command: l, config:
|
|
329
|
-
const r =
|
|
330
|
-
console.log("[strifeIntegration] envOptions:", JSON.stringify(a, null, 2)),
|
|
331
|
-
const
|
|
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
|
-
...
|
|
337
|
-
Object.entries(
|
|
350
|
+
...t ? Object.fromEntries(
|
|
351
|
+
Object.entries(t).filter(([s, i]) => !!i)
|
|
338
352
|
) : {}
|
|
339
353
|
};
|
|
340
|
-
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(
|
|
354
|
+
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
|
|
341
355
|
const c = ["urls", "database", "certificate", "password"], u = c.filter(
|
|
342
|
-
(s) => !
|
|
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(
|
|
363
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
350
364
|
`)
|
|
351
365
|
);
|
|
352
|
-
|
|
366
|
+
e({
|
|
353
367
|
vite: {
|
|
354
368
|
plugins: [
|
|
355
|
-
h(
|
|
369
|
+
h(n)
|
|
356
370
|
]
|
|
357
371
|
}
|
|
358
372
|
});
|