@strifeapp/astro 1.0.19 → 1.0.21
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 +43 -43
- 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 i 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
|
|
@@ -265,30 +265,29 @@ function storeAs(name, value) {
|
|
|
265
265
|
function h(e) {
|
|
266
266
|
return console.log("[vitePluginStrifeStore] Config received:", JSON.stringify(e, null, 2)), {
|
|
267
267
|
name: "strife:store",
|
|
268
|
-
resolveId(
|
|
269
|
-
if (
|
|
268
|
+
resolveId(l) {
|
|
269
|
+
if (l === m)
|
|
270
270
|
return p;
|
|
271
271
|
},
|
|
272
|
-
load(
|
|
273
|
-
var o
|
|
274
|
-
if (
|
|
272
|
+
load(l) {
|
|
273
|
+
var o;
|
|
274
|
+
if (l === p)
|
|
275
275
|
return `
|
|
276
276
|
import { DocumentStore, AbstractJavaScriptMultiMapIndexCreationTask, IndexCreation } from "ravendb";
|
|
277
|
-
import https from 'https';
|
|
278
277
|
|
|
279
278
|
const authOptions = {
|
|
280
279
|
type: 'pfx',
|
|
281
|
-
certificate: Buffer.from(${
|
|
282
|
-
password: ${
|
|
280
|
+
certificate: Buffer.from(${i(e.certificate)}, 'base64'),
|
|
281
|
+
password: ${i(e.password)},
|
|
283
282
|
};
|
|
284
283
|
|
|
285
|
-
console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${
|
|
286
|
-
console.log('[vitePluginStrifeStore] Using database:', ${
|
|
284
|
+
console.log('[vitePluginStrifeStore] Will attempt to connect to URLs:', ${i(e.urls)});
|
|
285
|
+
console.log('[vitePluginStrifeStore] Using database:', ${i(e.database)});
|
|
287
286
|
console.log('[vitePluginStrifeStore] Certificate length:', ${e.certificate ? e.certificate.length : 0});
|
|
288
287
|
|
|
289
288
|
const store = new DocumentStore(
|
|
290
|
-
${
|
|
291
|
-
${
|
|
289
|
+
${i(e.urls ? e.urls : [])},
|
|
290
|
+
${i(e.database || "")},
|
|
292
291
|
authOptions
|
|
293
292
|
).initialize();
|
|
294
293
|
|
|
@@ -296,7 +295,7 @@ function h(e) {
|
|
|
296
295
|
constructor() {
|
|
297
296
|
super();
|
|
298
297
|
|
|
299
|
-
this.additionalSources = {"Helper": ${
|
|
298
|
+
this.additionalSources = {"Helper": ${i(y)}}
|
|
300
299
|
|
|
301
300
|
${(e.collections || ["Posts"]).map((t) => `this.map("${typeof t == "string" ? t : t.name}", (doc) => { return mapDocument(doc) });`).join(`
|
|
302
301
|
`)}
|
|
@@ -308,18 +307,19 @@ function h(e) {
|
|
|
308
307
|
|
|
309
308
|
console.log('Deploying index...');
|
|
310
309
|
console.log('[vitePluginStrifeStore] Generating virtual module code with config:', ${JSON.stringify(e, null, 2)});
|
|
311
|
-
console.log('
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
317
|
|
|
318
|
-
await
|
|
318
|
+
await store.executeIndex(new Content_ByUrl());
|
|
319
319
|
|
|
320
320
|
const bulkInsert = store.bulkInsert();
|
|
321
321
|
|
|
322
|
-
${(
|
|
322
|
+
${(o = e.collections) == null ? void 0 : o.map((t) => `
|
|
323
323
|
await bulkInsert.store(${JSON.stringify(t)}, 'templates/${t.name}', { '@collection': 'Templates' });
|
|
324
324
|
`).join(`
|
|
325
325
|
`)}
|
|
@@ -331,51 +331,51 @@ function h(e) {
|
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const g = {
|
|
335
335
|
type: "pfx"
|
|
336
336
|
};
|
|
337
|
-
function
|
|
338
|
-
let o = process.env.STRIFE_DATABASE_URLS,
|
|
339
|
-
if (!o || !
|
|
340
|
-
const n = f(e,
|
|
341
|
-
o = o || n.STRIFE_DATABASE_URLS,
|
|
337
|
+
function T(e, l) {
|
|
338
|
+
let o = process.env.STRIFE_DATABASE_URLS, t = process.env.STRIFE_DATABASE, r = process.env.STRIFE_CERTIFICATE, a = process.env.STRIFE_CERTIFICATE_PASSWORD;
|
|
339
|
+
if (!o || !t || !r || !a) {
|
|
340
|
+
const n = f(e, l ?? "", "");
|
|
341
|
+
o = o || n.STRIFE_DATABASE_URLS, t = t || n.STRIFE_DATABASE, r = r || n.STRIFE_CERTIFICATE, a = a || n.STRIFE_CERTIFICATE_PASSWORD;
|
|
342
342
|
}
|
|
343
|
-
return console.log("[strifeIntegration] Loaded environment variables:"), console.log(` STRIFE_DATABASE_URLS: ${o ? "[SET]" : "[NOT SET]"}`), console.log(` STRIFE_DATABASE: ${
|
|
343
|
+
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: ${a ? "[SET]" : "[NOT SET]"}`), {
|
|
344
344
|
urls: o ? o.split(",").map((n) => n.trim()).filter(Boolean) : void 0,
|
|
345
|
-
database:
|
|
346
|
-
certificate:
|
|
347
|
-
password:
|
|
345
|
+
database: t || void 0,
|
|
346
|
+
certificate: r || void 0,
|
|
347
|
+
password: a || void 0
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function E(e) {
|
|
351
351
|
return {
|
|
352
352
|
name: "@strife/astro",
|
|
353
353
|
hooks: {
|
|
354
|
-
"astro:config:setup": ({ command:
|
|
355
|
-
const
|
|
356
|
-
console.log("[strifeIntegration] envOptions:", JSON.stringify(
|
|
354
|
+
"astro:config:setup": ({ command: l, config: o, updateConfig: t }) => {
|
|
355
|
+
const r = o.vite.envDir || process.cwd(), a = T(l, r);
|
|
356
|
+
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.");
|
|
357
357
|
const n = {
|
|
358
|
-
...
|
|
358
|
+
...g,
|
|
359
359
|
...Object.fromEntries(
|
|
360
|
-
Object.entries(
|
|
360
|
+
Object.entries(a).filter(([s, d]) => !!d)
|
|
361
361
|
),
|
|
362
362
|
...e ? Object.fromEntries(
|
|
363
|
-
Object.entries(e).filter(([
|
|
363
|
+
Object.entries(e).filter(([s, d]) => !!d)
|
|
364
364
|
) : {}
|
|
365
365
|
};
|
|
366
366
|
console.log("[strifeIntegration] Final mergedOptions:", JSON.stringify(n, null, 2));
|
|
367
367
|
const c = ["urls", "database", "certificate", "password"], u = c.filter(
|
|
368
|
-
(
|
|
368
|
+
(s) => !n[s] || Array.isArray(n[s]) && n[s].length === 0
|
|
369
369
|
);
|
|
370
370
|
if (u.length > 0)
|
|
371
371
|
throw new Error(
|
|
372
372
|
`[strifeIntegration] Missing required environment variables: ${u.join(", ")}.
|
|
373
373
|
Set them in your .env file (for local) or Vercel project settings (for deployment).
|
|
374
374
|
Current values:
|
|
375
|
-
` + c.map((
|
|
375
|
+
` + c.map((s) => ` ${s}: ${JSON.stringify(n[s])}`).join(`
|
|
376
376
|
`)
|
|
377
377
|
);
|
|
378
|
-
|
|
378
|
+
t({
|
|
379
379
|
vite: {
|
|
380
380
|
plugins: [
|
|
381
381
|
h(n)
|
|
@@ -387,5 +387,5 @@ Current values:
|
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
389
|
export {
|
|
390
|
-
|
|
390
|
+
E as default
|
|
391
391
|
};
|