@strifeapp/astro 1.0.22 → 1.0.23
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 +26 -40
- 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(e) {
|
|
266
266
|
return {
|
|
267
267
|
name: "strife:store",
|
|
268
268
|
resolveId(l) {
|
|
@@ -270,20 +270,19 @@ function h(t) {
|
|
|
270
270
|
return p;
|
|
271
271
|
},
|
|
272
272
|
load(l) {
|
|
273
|
-
var o;
|
|
274
273
|
if (l === p)
|
|
275
274
|
return `
|
|
276
275
|
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
|
|
277
276
|
|
|
278
277
|
const authOptions = {
|
|
279
278
|
type: 'pfx',
|
|
280
|
-
certificate: Buffer.from(${d(
|
|
281
|
-
password: ${d(
|
|
279
|
+
certificate: Buffer.from(${d(e.certificate)}, 'base64'),
|
|
280
|
+
password: ${d(e.password)},
|
|
282
281
|
};
|
|
283
282
|
|
|
284
283
|
const store = new DocumentStore(
|
|
285
|
-
${d(
|
|
286
|
-
${d(
|
|
284
|
+
${d(e.urls ? e.urls : [])},
|
|
285
|
+
${d(e.database || "")},
|
|
287
286
|
authOptions
|
|
288
287
|
).initialize()
|
|
289
288
|
|
|
@@ -293,7 +292,7 @@ function h(t) {
|
|
|
293
292
|
|
|
294
293
|
this.additionalSources = {"Helper": ${d(y)}}
|
|
295
294
|
|
|
296
|
-
${(
|
|
295
|
+
${(e.collections || ["Posts"]).map((n) => `this.map("${typeof n == "string" ? n : n.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
297
296
|
`)}
|
|
298
297
|
|
|
299
298
|
this.deploymentMode = 'Rolling';
|
|
@@ -301,19 +300,6 @@ function h(t) {
|
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
302
|
|
|
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
|
-
|
|
317
303
|
export { store };
|
|
318
304
|
`;
|
|
319
305
|
}
|
|
@@ -322,51 +308,51 @@ function h(t) {
|
|
|
322
308
|
const T = {
|
|
323
309
|
type: "pfx"
|
|
324
310
|
};
|
|
325
|
-
function
|
|
326
|
-
let
|
|
327
|
-
if (!
|
|
328
|
-
const
|
|
329
|
-
|
|
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;
|
|
330
316
|
}
|
|
331
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${
|
|
332
|
-
urls:
|
|
333
|
-
database:
|
|
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,
|
|
334
320
|
certificate: r || void 0,
|
|
335
321
|
password: a || void 0
|
|
336
322
|
};
|
|
337
323
|
}
|
|
338
|
-
function E(
|
|
324
|
+
function E(e) {
|
|
339
325
|
return {
|
|
340
326
|
name: "@strife/astro",
|
|
341
327
|
hooks: {
|
|
342
|
-
"astro:config:setup": ({ command: l, config:
|
|
343
|
-
const r =
|
|
344
|
-
console.log("[strifeIntegration] envOptions:", JSON.stringify(a, null, 2)),
|
|
345
|
-
const
|
|
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 = {
|
|
346
332
|
...T,
|
|
347
333
|
...Object.fromEntries(
|
|
348
334
|
Object.entries(a).filter(([s, i]) => !!i)
|
|
349
335
|
),
|
|
350
|
-
...
|
|
351
|
-
Object.entries(
|
|
336
|
+
...e ? Object.fromEntries(
|
|
337
|
+
Object.entries(e).filter(([s, i]) => !!i)
|
|
352
338
|
) : {}
|
|
353
339
|
};
|
|
354
|
-
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(
|
|
340
|
+
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(t, null, 2));
|
|
355
341
|
const c = ["urls", "database", "certificate", "password"], u = c.filter(
|
|
356
|
-
(s) => !
|
|
342
|
+
(s) => !t[s] || Array.isArray(t[s]) && t[s].length === 0
|
|
357
343
|
);
|
|
358
344
|
if (u.length > 0)
|
|
359
345
|
throw new Error(
|
|
360
346
|
`[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
|
|
361
347
|
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
362
348
|
Current values:
|
|
363
|
-
` + c.map((s) => ` ${s}: ${JSON.stringify(
|
|
349
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(t[s])}`).join(`
|
|
364
350
|
`)
|
|
365
351
|
);
|
|
366
|
-
|
|
352
|
+
o({
|
|
367
353
|
vite: {
|
|
368
354
|
plugins: [
|
|
369
|
-
h(
|
|
355
|
+
h(t)
|
|
370
356
|
]
|
|
371
357
|
}
|
|
372
358
|
});
|