@strifeapp/astro 1.0.21 → 1.0.22
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 +30 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { loadEnv as f } from "vite";
|
|
2
|
-
import
|
|
2
|
+
import d from "serialize-javascript";
|
|
3
3
|
const y = `/**
|
|
4
4
|
* Creates an indexed item that will be stored in the index.
|
|
5
5
|
* @param {string} name - Name of property to index
|
|
@@ -262,8 +262,8 @@ function storeAs(name, value) {
|
|
|
262
262
|
|
|
263
263
|
return result;
|
|
264
264
|
}`, m = "strife:store", p = "\0" + m;
|
|
265
|
-
function h(
|
|
266
|
-
return
|
|
265
|
+
function h(t) {
|
|
266
|
+
return {
|
|
267
267
|
name: "strife:store",
|
|
268
268
|
resolveId(l) {
|
|
269
269
|
if (l === m)
|
|
@@ -277,27 +277,23 @@ function h(e) {
|
|
|
277
277
|
|
|
278
278
|
const authOptions = {
|
|
279
279
|
type: 'pfx',
|
|
280
|
-
certificate: Buffer.from(${
|
|
281
|
-
password: ${
|
|
280
|
+
certificate: Buffer.from(${d(t.certificate)}, 'base64'),
|
|
281
|
+
password: ${d(t.password)},
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
-
console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${i(e.urls)});
|
|
285
|
-
console.log('[vitePluginStrifeStore] Using database:', ${i(e.database)});
|
|
286
|
-
console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
|
|
287
|
-
|
|
288
284
|
const store = new DocumentStore(
|
|
289
|
-
${
|
|
290
|
-
${
|
|
285
|
+
${d(t.urls ? t.urls : [])},
|
|
286
|
+
${d(t.database || "")},
|
|
291
287
|
authOptions
|
|
292
|
-
).initialize()
|
|
288
|
+
).initialize()
|
|
293
289
|
|
|
294
290
|
class Content_ByUrl extends AbstractJavaScriptMultiMapIndexCreationTask {
|
|
295
291
|
constructor() {
|
|
296
292
|
super();
|
|
297
293
|
|
|
298
|
-
this.additionalSources = {"Helper": ${
|
|
294
|
+
this.additionalSources = {"Helper": ${d(y)}}
|
|
299
295
|
|
|
300
|
-
${(
|
|
296
|
+
${(t.collections || ["Posts"]).map((e) => `this.map("${typeof e == "string" ? e : e.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
301
297
|
`)}
|
|
302
298
|
|
|
303
299
|
this.deploymentMode = 'Rolling';
|
|
@@ -306,21 +302,13 @@ function h(e) {
|
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
console.log('Deploying index...');
|
|
309
|
-
console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
|
|
310
|
-
console.log('Pinging RavenDB server before connecting...');
|
|
311
|
-
try {
|
|
312
|
-
const res = await fetch('http://live-test.ravendb.net/databases/demo/docs?pagesize=1', { method: 'GET' });
|
|
313
|
-
console.log('Ping result status:', res.status);
|
|
314
|
-
} catch (err) {
|
|
315
|
-
console.error('Ping failed:', err);
|
|
316
|
-
}
|
|
317
305
|
|
|
318
|
-
await store.executeIndex(new Content_ByUrl());
|
|
306
|
+
//await store.executeIndex(new Content_ByUrl());
|
|
319
307
|
|
|
320
308
|
const bulkInsert = store.bulkInsert();
|
|
321
309
|
|
|
322
|
-
${(o =
|
|
323
|
-
await bulkInsert.store(${JSON.stringify(
|
|
310
|
+
${(o = t.collections) == null ? void 0 : o.map((e) => `
|
|
311
|
+
await bulkInsert.store(${JSON.stringify(e)}, 'templates/${e.name}', { '@collection': 'Templates' });
|
|
324
312
|
`).join(`
|
|
325
313
|
`)}
|
|
326
314
|
|
|
@@ -331,36 +319,36 @@ function h(e) {
|
|
|
331
319
|
}
|
|
332
320
|
};
|
|
333
321
|
}
|
|
334
|
-
const
|
|
322
|
+
const T = {
|
|
335
323
|
type: "pfx"
|
|
336
324
|
};
|
|
337
|
-
function
|
|
338
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
339
|
-
if (!o || !
|
|
340
|
-
const n = f(
|
|
341
|
-
o = o || n.STRIFE_DATABASE_URLS,
|
|
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;
|
|
342
330
|
}
|
|
343
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_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]"}`), {
|
|
344
332
|
urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
|
|
345
|
-
database:
|
|
333
|
+
database: e || void 0,
|
|
346
334
|
certificate: r || void 0,
|
|
347
335
|
password: a || void 0
|
|
348
336
|
};
|
|
349
337
|
}
|
|
350
|
-
function E(
|
|
338
|
+
function E(t) {
|
|
351
339
|
return {
|
|
352
340
|
name: "@strife/astro",
|
|
353
341
|
hooks: {
|
|
354
|
-
"astro:config:setup": ({ command: l, config: o, updateConfig:
|
|
355
|
-
const r = o.vite.envDir || process.cwd(), a =
|
|
356
|
-
console.log("[strifeIntegration] envOptions:", JSON.stringify(a, null, 2)),
|
|
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.");
|
|
357
345
|
const n = {
|
|
358
|
-
...
|
|
346
|
+
...T,
|
|
359
347
|
...Object.fromEntries(
|
|
360
|
-
Object.entries(a).filter(([s,
|
|
348
|
+
Object.entries(a).filter(([s, i]) => !!i)
|
|
361
349
|
),
|
|
362
|
-
...
|
|
363
|
-
Object.entries(
|
|
350
|
+
...t ? Object.fromEntries(
|
|
351
|
+
Object.entries(t).filter(([s, i]) => !!i)
|
|
364
352
|
) : {}
|
|
365
353
|
};
|
|
366
354
|
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
|
|
@@ -375,7 +363,7 @@ Current values:
|
|
|
375
363
|
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
376
364
|
`)
|
|
377
365
|
);
|
|
378
|
-
|
|
366
|
+
e({
|
|
379
367
|
vite: {
|
|
380
368
|
plugins: [
|
|
381
369
|
h(n)
|