@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.
- package/dist/index.js +45 -35
- 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(
|
|
265
|
+
function h(t) {
|
|
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(
|
|
273
|
-
|
|
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(
|
|
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,47 @@ function h(e) {
|
|
|
308
322
|
const T = {
|
|
309
323
|
type: "pfx"
|
|
310
324
|
};
|
|
311
|
-
function R(
|
|
312
|
-
let
|
|
313
|
-
if (!
|
|
314
|
-
const
|
|
315
|
-
|
|
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: ${
|
|
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: ${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:
|
|
335
|
+
password: l || void 0
|
|
322
336
|
};
|
|
323
337
|
}
|
|
324
|
-
function
|
|
338
|
+
function v(t) {
|
|
325
339
|
return {
|
|
326
340
|
name: "@strife/astro",
|
|
327
341
|
hooks: {
|
|
328
|
-
"astro:config:setup": ({ command:
|
|
329
|
-
const 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(
|
|
346
|
+
Object.entries(l).filter(([a, i]) => !!i)
|
|
335
347
|
),
|
|
336
|
-
...
|
|
337
|
-
Object.entries(
|
|
348
|
+
...t ? Object.fromEntries(
|
|
349
|
+
Object.entries(t).filter(([a, i]) => !!i)
|
|
338
350
|
) : {}
|
|
339
|
-
}
|
|
340
|
-
|
|
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((
|
|
359
|
+
` + c.map((a) => ` ${a}: ${JSON.stringify(n[a])}`).join(`
|
|
350
360
|
`)
|
|
351
361
|
);
|
|
352
|
-
|
|
362
|
+
e({
|
|
353
363
|
vite: {
|
|
354
364
|
plugins: [
|
|
355
|
-
h(
|
|
365
|
+
h(n)
|
|
356
366
|
]
|
|
357
367
|
}
|
|
358
368
|
});
|
|
@@ -361,5 +371,5 @@ Current values:
|
|
|
361
371
|
};
|
|
362
372
|
}
|
|
363
373
|
export {
|
|
364
|
-
|
|
374
|
+
v as default
|
|
365
375
|
};
|