@monkeyplus/flow 6.0.36 → 6.0.38

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.
Files changed (78) hide show
  1. package/cms/dist/assets/AuthForm-D9zqy79A.js +1 -0
  2. package/cms/dist/assets/Button-BxK__vWW.js +3 -0
  3. package/cms/dist/assets/Checkbox-ZAz-DF2K.js +1 -0
  4. package/cms/dist/assets/Cms-C6Sdowsy.js +1 -0
  5. package/cms/dist/assets/Cms-Dy96x5P5.js +1 -0
  6. package/cms/dist/assets/Cms.vue_vue_type_script_setup_true_lang-DibRYDhk.js +1 -0
  7. package/cms/dist/assets/Collection-CeT7sqBS.js +1 -0
  8. package/cms/dist/assets/Collection-CkmskhNr.js +1 -0
  9. package/cms/dist/assets/Collection.vue_vue_type_script_setup_true_lang-CLuwC8Uj.js +4 -0
  10. package/cms/dist/assets/DropdownMenu-D5x3rHhs.js +1 -0
  11. package/cms/dist/assets/Entry-C0oNgptm.js +1 -0
  12. package/cms/dist/assets/Entry-DK9arl_r.js +1 -0
  13. package/cms/dist/assets/Entry-DiaxpV9P.js +1 -0
  14. package/cms/dist/assets/Entry-DnIfmeOq.js +1 -0
  15. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-DQpUwjD1.js +1 -0
  16. package/cms/dist/assets/Entry.vue_vue_type_script_setup_true_lang-Lpiwz51b.js +1 -0
  17. package/cms/dist/assets/Fields-25hjY31I.js +210 -0
  18. package/cms/dist/assets/Fields-CnUfMg91.css +1 -0
  19. package/cms/dist/assets/FormField-j7eHJ9wN.js +1 -0
  20. package/cms/dist/assets/Input-1aJl-rMT.js +1 -0
  21. package/cms/dist/assets/Main-I4OsPHC_.js +1 -0
  22. package/cms/dist/assets/Media-BiUrdhiy.js +64 -0
  23. package/cms/dist/assets/Modal-CL4NZ42V.js +1 -0
  24. package/cms/dist/assets/Page-C2SS3gyg.js +1 -0
  25. package/cms/dist/assets/PageSideForm-BZD26RtU.js +1 -0
  26. package/cms/dist/assets/PageSideForm-CEDt6M5O.js +1 -0
  27. package/cms/dist/assets/Pages-BQ95j-9A.js +1 -0
  28. package/cms/dist/assets/Pages-Ci78caHB.js +1 -0
  29. package/cms/dist/assets/Preview-DV3zHCWR.js +1 -0
  30. package/cms/dist/assets/RovingFocusGroup-CnDWyi3J.js +1 -0
  31. package/cms/dist/assets/RovingFocusItem-VyijGu8z.js +1 -0
  32. package/cms/dist/assets/Settings-BygzRFRi.js +1 -0
  33. package/cms/dist/assets/Sidebar-RRp6XCg_.js +1 -0
  34. package/cms/dist/assets/TooltipProvider-B0Lr7v95.js +1 -0
  35. package/cms/dist/assets/app-DFMmXmuL.js +1 -0
  36. package/cms/dist/assets/app-DyuvC6pP.js +1 -0
  37. package/cms/dist/assets/app.vue_vue_type_script_setup_true_lang-a-0WngBC.js +13 -0
  38. package/cms/dist/assets/auth-DCLgP-Ce.js +3 -0
  39. package/cms/dist/assets/cms-BfAB9urh.js +1 -0
  40. package/cms/dist/assets/dist-gC8hGhMx.js +1 -0
  41. package/cms/dist/assets/index-B-MXuuNZ.css +2 -0
  42. package/cms/dist/assets/index.spa-_gVd6eNI.js +18 -0
  43. package/cms/dist/assets/index.vue_vue_type_script_setup_true_lang-mq8D_l8z.js +1 -0
  44. package/cms/dist/assets/not-found-DKsTsHpk.js +1 -0
  45. package/cms/dist/assets/not-found-DclK62tc.js +1 -0
  46. package/cms/dist/assets/pages-DLGXw_J5.js +1 -0
  47. package/cms/dist/assets/pages-DhCx_5RP.js +1 -0
  48. package/cms/dist/assets/preview-EralP1Qk.js +1 -0
  49. package/cms/dist/assets/useCmsBreadcrumb-Cvg0a25f.js +1 -0
  50. package/cms/dist/assets/useOverlay-42WuI5Jo.js +1 -0
  51. package/cms/dist/assets/usePortal-BkuxWRnT.js +1 -0
  52. package/cms/dist/assets/useToast-CDyjwefJ.js +1 -0
  53. package/cms/dist/assets/utils-DsgHgvSL.js +1 -0
  54. package/cms/dist/assets/virtualizer-IKP0IcQd.js +1 -0
  55. package/cms/dist/index.spa.html +13 -0
  56. package/cms/server/database/schema.d.ts +257 -261
  57. package/cms/server/database/schema.mjs +58 -38
  58. package/cms/server/middleware/auth.d.ts +2 -0
  59. package/cms/server/middleware/auth.mjs +18 -0
  60. package/cms/server/plugins/migrate.d.ts +2 -0
  61. package/cms/server/plugins/migrate.mjs +16 -0
  62. package/cms/server/routes/api/auth/init/index.get.d.ts +2 -0
  63. package/cms/server/routes/api/auth/init/index.get.mjs +8 -0
  64. package/cms/server/routes/api/auth/init/index.post.d.ts +2 -0
  65. package/cms/server/routes/api/auth/init/index.post.mjs +18 -0
  66. package/cms/server/routes/api/repos/remote/[repo]/files/[branch]/index.mjs +5 -1
  67. package/cms/server/utils/auth.d.ts +1139 -0
  68. package/cms/server/utils/auth.mjs +79 -8
  69. package/cms/server/utils/db.d.ts +4 -2
  70. package/cms/server/utils/db.mjs +7 -4
  71. package/cms/server/utils/github.d.ts +0 -1
  72. package/cms/server/utils/github.mjs +15 -25
  73. package/modules/cms/server/api/admin.mjs +2 -1
  74. package/modules/images/cli-pregenerate.mjs +1 -0
  75. package/modules/images/runtime/build.mjs +6 -4
  76. package/modules/images/runtime/image.mjs +2 -2
  77. package/modules/images/runtime/types.d.ts +1 -0
  78. package/package.json +2 -2
@@ -1,16 +1,87 @@
1
+ import process from "node:process";
1
2
  import { betterAuth } from "better-auth";
2
3
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
4
+ import { admin, username } from "better-auth/plugins";
5
+ import nodemailer from "nodemailer";
3
6
  import * as schema from "../database/schema.mjs";
4
7
  import { db } from "./db.mjs";
8
+ const transporter = nodemailer.createTransport({
9
+ host: process.env.SMTP_ADDRESS,
10
+ port: Number(process.env.SMTP_PORT) || 587,
11
+ // secure: true, // true for 465, false for other ports
12
+ auth: {
13
+ user: process.env.SMTP_USERNAME,
14
+ pass: process.env.SMTP_PASSWORD
15
+ }
16
+ });
5
17
  export const auth = betterAuth({
18
+ baseURL: process.env.URL,
6
19
  database: drizzleAdapter(db, {
7
- provider: "sqlite",
20
+ provider: "pg",
8
21
  schema
9
- })
10
- // socialProviders: {
11
- // github: {
12
- // clientId: process.env.GITHUB_CLIENT_ID as string,
13
- // clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
14
- // },
15
- // },
22
+ }),
23
+ // hooks: {
24
+ // before: createAuthMiddleware(async (ctx) => {
25
+ // if (ctx.path !== '/sign-up/email') {
26
+ // return;
27
+ // }
28
+ // const user = await db.query.users.findFirst({
29
+ // where: {
30
+ // email: ctx.body?.email,
31
+ // },
32
+ // });
33
+ // if (!user) {
34
+ // throw new APIError('BAD_REQUEST', {
35
+ // error: 'Usuario no invitado',
36
+ // });
37
+ // }
38
+ // }),
39
+ // },
40
+ emailVerification: {
41
+ sendOnSignUp: true,
42
+ sendOnSignIn: true,
43
+ async sendVerificationEmail({ url, user }) {
44
+ await transporter.sendMail({
45
+ from: process.env.EMAIL_FROM,
46
+ to: user.email,
47
+ subject: "Verify your email",
48
+ text: `Please verify your email by clicking the following link: ${url}`,
49
+ html: `<p>Please verify your email by clicking the following link:</p><a href="${url}">${url}</a>`
50
+ });
51
+ }
52
+ },
53
+ emailAndPassword: {
54
+ enabled: true,
55
+ requireEmailVerification: true,
56
+ async sendResetPassword({ url, user }) {
57
+ await transporter.sendMail({
58
+ from: process.env.EMAIL_FROM,
59
+ to: user.email,
60
+ subject: "Reset your password",
61
+ text: `You can reset your password by clicking the following link: ${url}`,
62
+ html: `<p>You can reset your password by clicking the following link:</p><a href="${url}">${url}</a>`
63
+ });
64
+ },
65
+ customSyntheticUser: ({ coreFields, additionalFields, id }) => ({
66
+ ...coreFields,
67
+ // Admin plugin fields (in schema order)
68
+ role: "user",
69
+ // or your configured defaultRole
70
+ banned: false,
71
+ banReason: null,
72
+ banExpires: null,
73
+ ...additionalFields,
74
+ id
75
+ })
76
+ },
77
+ session: {
78
+ cookieCache: {
79
+ enabled: true
80
+ }
81
+ },
82
+ plugins: [
83
+ admin({}),
84
+ username()
85
+ // bearer(),
86
+ ]
16
87
  });
@@ -1,3 +1,5 @@
1
- export declare const db: import("drizzle-orm/libsql").LibSQLDatabase<Record<string, never>> & {
2
- $client: import("@libsql/client/.").Client;
1
+ import process from 'node:process';
2
+ import * as schema from '../database/schema';
3
+ export declare const db: import("drizzle-orm/node-postgres").NodePgDatabase<import("drizzle-orm").ExtractTablesWithRelations<{}, import("drizzle-orm").ExtractTablesFromSchema<typeof schema>>> & {
4
+ $client: import("drizzle-orm/node-postgres").NodePgClient extends TClient ? process : TClient;
3
5
  };
@@ -1,5 +1,8 @@
1
1
  import process from "node:process";
2
- import { createClient } from "@libsql/client";
3
- import { drizzle } from "drizzle-orm/libsql";
4
- const client = createClient({ url: process.env.DATABASE_URL || "file:local.db" });
5
- export const db = drizzle(client);
2
+ import { defineRelations } from "drizzle-orm";
3
+ import { drizzle } from "drizzle-orm/node-postgres";
4
+ import * as schema from "../database/schema.mjs";
5
+ const relations = defineRelations(schema, (_r) => ({}));
6
+ export const db = drizzle(process.env.DATABASE_URL, {
7
+ relations
8
+ });
@@ -7,7 +7,6 @@ export declare const ghRepoContributors: any;
7
7
  export declare const ghRepoFiles: any;
8
8
  export declare const ghRepoFile: any;
9
9
  export declare const ghRepoBlob: any;
10
- export declare const ghMarkdown: any;
11
10
  export declare function ghCreateBlob(repo: string, body: any): Promise<any>;
12
11
  export declare function ghCreateTree(repo: string, body: any): Promise<any>;
13
12
  export declare function ghCreateCommit(repo: string, body: any): Promise<any>;
@@ -64,7 +64,8 @@ export const ghFetch = defineCachedFunction(
64
64
  return false;
65
65
  }
66
66
  return true;
67
- }
67
+ },
68
+ getKey: (url) => url
68
69
  }
69
70
  );
70
71
  export async function ghFetchNoCache(url, opts = {}) {
@@ -106,35 +107,24 @@ export const ghRepoFiles = defineCachedFunction((repo, ref) => {
106
107
  repo = joinURL(OWNER, repo);
107
108
  return ghFetch(`/repos/${repo}/git/trees/${ref}?recursive=1`);
108
109
  }, cacheOptions("files"));
109
- export const ghRepoFile = defineCachedFunction((repo, ref, branch) => {
110
+ export const ghRepoFile = defineCachedFunction((repo, ref, branch, invalidate = false) => {
110
111
  repo = joinURL(OWNER, repo);
111
- return ghFetch(`/repos/${repo}/contents/${ref}?branch=${branch}`);
112
- }, cacheOptions("file"));
112
+ const url = `/repos/${repo}/contents/${ref}?branch=${branch}`;
113
+ if (invalidate) {
114
+ ghFetch.invalidate(url);
115
+ }
116
+ return ghFetch(url);
117
+ }, {
118
+ ...cacheOptions("file"),
119
+ getKey: (repo, ref, branch, _invalidate) => {
120
+ const key = `${repo}/${ref}/${branch}`;
121
+ return key;
122
+ }
123
+ });
113
124
  export const ghRepoBlob = defineCachedFunction((repo, sha) => {
114
125
  repo = joinURL(OWNER, repo);
115
126
  return ghFetch(`/repos/${repo}/git/blobs/${sha}`);
116
127
  }, cacheOptions("blobs"));
117
- export const ghMarkdown = defineCachedFunction(
118
- (markdown, repo, _id) => {
119
- if (!markdown) {
120
- return "";
121
- }
122
- return ghFetch("/markdown", {
123
- method: "POST",
124
- headers: {
125
- accept: "application/vnd.github+json"
126
- },
127
- body: JSON.stringify({
128
- text: markdown,
129
- context: repo
130
- })
131
- });
132
- },
133
- {
134
- ...cacheOptions("markdown"),
135
- getKey: (_markdown, repo, id) => `${repo}/${id}`
136
- }
137
- );
138
128
  function isEmptyArray(val) {
139
129
  return Array.isArray(val) && val.length === 0;
140
130
  }
@@ -5,7 +5,8 @@ const adminHtml = `<!DOCTYPE html>
5
5
  <meta charset="UTF-8" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>CMS</title>
8
- <script type="module" crossorigin src="/cms/v3/assets/index-BIKzIEd2.js"><\/script>
8
+ <script type="module" crossorigin src="/cms/v3/assets/index.spa-_gVd6eNI.js"><\/script>
9
+ <link rel="stylesheet" crossorigin href="/cms/v3/assets/index-B-MXuuNZ.css">
9
10
  </head>
10
11
  <body>
11
12
  <div id="app"></div>
@@ -70,6 +70,7 @@ async function run() {
70
70
  outputDir,
71
71
  generatedManifestPath,
72
72
  generate: true,
73
+ useIpxPath: true,
73
74
  netlifyCache: false,
74
75
  options
75
76
  };
@@ -146,14 +146,16 @@ export async function materializeGeneratedImages(config) {
146
146
  ...image,
147
147
  signature
148
148
  };
149
- const outputPath = outputFilePath(config.outputDir, image.generate);
150
- const cacheRelativePath = normalizeOutputPath(image.generate);
149
+ const outputPath = outputFilePath(config.outputDir, config.useIpxPath ? image.url : image.generate);
150
+ const cacheRelativePath = normalizeOutputPath(config.useIpxPath ? image.url : image.generate);
151
151
  const cachePath = config.generatedCacheDir ? outputFilePath(config.generatedCacheDir, cacheRelativePath) : void 0;
152
152
  activeCacheFiles.add(cacheRelativePath);
153
153
  await ensureParentDir(outputPath);
154
- const publicPreGeneratedPath = outputFilePath(config.publicDir, image.generate);
154
+ const publicPreGeneratedPath = outputFilePath(config.publicDir, image.url);
155
155
  if (existsSync(publicPreGeneratedPath)) {
156
- await copyFile(publicPreGeneratedPath, outputPath);
156
+ if (publicPreGeneratedPath !== outputPath) {
157
+ await copyFile(publicPreGeneratedPath, outputPath);
158
+ }
157
159
  return { cacheHit: 1, generated: 0 };
158
160
  }
159
161
  if (config.netlifyCache && cachePath && previousManifest[imageKey]?.signature === signature && existsSync(cachePath)) {
@@ -168,8 +168,8 @@ export function createImageResolver(imagesOptions, stateImages, runtime = {}) {
168
168
  baseDir = getBaseDir(replacedPath, imagesOptions.dirImages);
169
169
  }
170
170
  const modifierSegment = getModifierSegment(image.modifiers);
171
- const baseURL = imagesOptions.baseURL || "/_ipx";
172
- image.generate = joinURL(baseURL, modifierSegment === "_" ? "" : modifierSegment, replacedPath);
171
+ const relativePath = getRelativePath(replacedPath, baseDir);
172
+ image.generate = joinURL(`/${baseDir}`, modifierSegment === "_" ? "" : modifierSegment, relativePath);
173
173
  if (originalExt) {
174
174
  image.generate = image.generate.replace(originalExt, image.ext);
175
175
  } else if (!image.generate.includes(".") && image.ext) {
@@ -93,6 +93,7 @@ export interface FlowImagesRuntimeConfig {
93
93
  generatedCacheDir?: string;
94
94
  generatedCacheManifestPath?: string;
95
95
  generate: boolean;
96
+ useIpxPath?: boolean;
96
97
  netlifyCache: boolean;
97
98
  options: FlowImageOptions;
98
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkeyplus/flow",
3
- "version": "6.0.36",
3
+ "version": "6.0.38",
4
4
  "description": "@monkeyplus/flow package-first runtime with Vite, Nitro, Vue and a workspace playground.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -88,7 +88,7 @@
88
88
  "@vitejs/plugin-vue": "^6.0.5",
89
89
  "@vue/server-renderer": "^3.5.13",
90
90
  "ipx": "^3.1.1",
91
- "nitro": "3.0.260429-beta",
91
+ "nitro": "3.0.260610-beta",
92
92
  "std-env": "^4.0.0",
93
93
  "ufo": "^1.6.1",
94
94
  "unhead": "^3.1.0",