@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.
- package/dist/index.js +35 -37
- 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(
|
|
265
|
+
function h(e) {
|
|
266
266
|
return {
|
|
267
267
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
268
|
+
resolveId(s) {
|
|
269
|
+
if (s === m)
|
|
270
270
|
return p;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
272
|
+
load(s) {
|
|
273
273
|
var o;
|
|
274
|
-
if (
|
|
274
|
+
if (s === p)
|
|
275
275
|
return `
|
|
276
|
-
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask
|
|
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(
|
|
281
|
-
password: ${d(
|
|
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(
|
|
286
|
-
${d(
|
|
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
|
-
${(
|
|
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 =
|
|
311
|
-
await bulkInsert.store(${JSON.stringify(
|
|
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
|
|
326
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
327
|
-
if (!o || !
|
|
328
|
-
const n = f(
|
|
329
|
-
o = o || n.STRIFE_DATABASE_URLS,
|
|
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: ${
|
|
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:
|
|
335
|
+
database: t || void 0,
|
|
334
336
|
certificate: r || void 0,
|
|
335
|
-
password:
|
|
337
|
+
password: l || void 0
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
|
-
function
|
|
340
|
+
function v(e) {
|
|
339
341
|
return {
|
|
340
342
|
name: "@strife/astro",
|
|
341
343
|
hooks: {
|
|
342
|
-
"astro:config:setup": ({ command:
|
|
343
|
-
const r = o.vite.envDir || process.cwd(),
|
|
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(
|
|
348
|
+
Object.entries(l).filter(([a, i]) => !!i)
|
|
349
349
|
),
|
|
350
|
-
...
|
|
351
|
-
Object.entries(
|
|
350
|
+
...e ? Object.fromEntries(
|
|
351
|
+
Object.entries(e).filter(([a, i]) => !!i)
|
|
352
352
|
) : {}
|
|
353
|
-
}
|
|
354
|
-
|
|
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((
|
|
361
|
+
` + c.map((a) => ` ${a}: ${JSON.stringify(n[a])}`).join(`
|
|
364
362
|
`)
|
|
365
363
|
);
|
|
366
|
-
|
|
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
|
-
|
|
376
|
+
v as default
|
|
379
377
|
};
|