create-warlock 4.1.7 → 4.1.9
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/esm/commands/create-new-app/get-app-path.mjs +1 -1
- package/esm/commands/create-new-app/index.mjs +1 -1
- package/esm/commands/create-new-app/types.d.mts +1 -1
- package/esm/commands/create-warlock-app/index.mjs +1 -1
- package/esm/features/database-drivers.mjs +1 -1
- package/esm/features/features-map.mjs +1 -1
- package/esm/helpers/app.mjs +1 -1
- package/esm/helpers/exec.mjs +1 -1
- package/esm/helpers/package-manager.mjs +1 -1
- package/esm/helpers/paths.mjs +1 -1
- package/esm/helpers/project-builder-helpers.mjs +1 -1
- package/esm/index.d.mts +1 -1
- package/esm/index.mjs +1 -1
- package/esm/ui/banner.mjs +1 -1
- package/esm/ui/spinners.mjs +1 -1
- package/package.json +2 -2
- package/templates/warlock/package.json +2 -1
- package/templates/warlock/src/app/auth/controllers/forgot-password.controller.ts +1 -1
- package/templates/warlock/src/app/auth/controllers/refresh-token.controller.ts +1 -1
- package/templates/warlock/src/app/auth/models/otp/otp.model.ts +3 -3
- package/templates/warlock/src/app/auth/schema/login.schema.ts +1 -1
- package/templates/warlock/src/app/auth/schema/reset-password.schema.ts +1 -1
- package/templates/warlock/src/app/auth/services/otp.service.ts +10 -1
- package/templates/warlock/src/app/posts/controllers/update-post.controller.ts +7 -1
- package/templates/warlock/src/app/uploads/controllers/fetch-uploaded-file.controller.ts +2 -1
- package/templates/warlock/tsconfig.json +1 -1
|
@@ -2,7 +2,7 @@ import { colors } from "@mongez/copper";
|
|
|
2
2
|
import { directoryExists } from "@warlock.js/fs";
|
|
3
3
|
import * as path$1 from "path";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/create-warlock/src/commands/create-new-app/get-app-path.ts
|
|
6
6
|
function getAppPath(appName) {
|
|
7
7
|
const appPath = path$1.resolve(process.cwd(), appName);
|
|
8
8
|
if (directoryExists(appPath)) {
|
|
@@ -10,7 +10,7 @@ import { cancel, confirm, isCancel, multiselect, select, text } from "@clack/pro
|
|
|
10
10
|
import { colors } from "@mongez/copper";
|
|
11
11
|
import { getJsonFile } from "@warlock.js/fs";
|
|
12
12
|
|
|
13
|
-
//#region
|
|
13
|
+
//#region ../@warlock.js/create-warlock/src/commands/create-new-app/index.ts
|
|
14
14
|
async function createNewApp(cli = {}) {
|
|
15
15
|
const pmDetectionPromise = detectPackageManagers();
|
|
16
16
|
const createWarlockVersion = getJsonFile(packageRoot("package.json")).version;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region ../@warlock.js/create-warlock/src/commands/create-new-app/types.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* Flags parsed from the command line for non-interactive scaffolding
|
|
4
4
|
* (`create-warlock my-app --db=postgres --features=test,herald --ai=openai --yes`).
|
|
@@ -3,7 +3,7 @@ import { showSuccessScreen } from "../../ui/banner.mjs";
|
|
|
3
3
|
import { spinnerMessages } from "../../ui/spinners.mjs";
|
|
4
4
|
import { spinner } from "@clack/prompts";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/create-warlock/src/commands/create-warlock-app/index.ts
|
|
7
7
|
async function createWarlockApp(application) {
|
|
8
8
|
const { useGit, useJWT, features, aiProviders, databaseDriver } = application.options;
|
|
9
9
|
const templateSpinner = spinner();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region ../@warlock.js/create-warlock/src/features/features-map.ts
|
|
2
2
|
/**
|
|
3
3
|
* Optional features offered in the general multiselect step. The database
|
|
4
4
|
* driver (its own select) and AI providers (their own step) are intentionally
|
package/esm/helpers/app.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { packageRoot, template } from "./paths.mjs";
|
|
|
5
5
|
import { copyDirectory, copyFile, fileExists, getFile, getJsonFile, putFile, putJsonFile, renameFile } from "@warlock.js/fs";
|
|
6
6
|
import path from "path";
|
|
7
7
|
|
|
8
|
-
//#region
|
|
8
|
+
//#region ../@warlock.js/create-warlock/src/helpers/app.ts
|
|
9
9
|
var App = class {
|
|
10
10
|
constructor(app) {
|
|
11
11
|
this.app = app;
|
package/esm/helpers/exec.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { log } from "@clack/prompts";
|
|
|
2
2
|
import { colors } from "@mongez/copper";
|
|
3
3
|
import childProcess from "cross-spawn";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/create-warlock/src/helpers/exec.ts
|
|
6
6
|
/**
|
|
7
7
|
* This function directly executes a command
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@ import { exec, execSync } from "child_process";
|
|
|
2
2
|
import { promisify } from "util";
|
|
3
3
|
import detectPackageManager from "which-pm-runs";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/create-warlock/src/helpers/package-manager.ts
|
|
6
6
|
const execAsync = promisify(exec);
|
|
7
7
|
let detectedPackageManager;
|
|
8
8
|
let cachedSystemManagers;
|
package/esm/helpers/paths.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/create-warlock/src/helpers/paths.ts
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
function template(templateName) {
|
|
@@ -6,7 +6,7 @@ import { colors } from "@mongez/copper";
|
|
|
6
6
|
import { copyDirectory, getFile, getJsonFile, putFile, putJsonFile, renameFile } from "@warlock.js/fs";
|
|
7
7
|
import path from "path";
|
|
8
8
|
|
|
9
|
-
//#region
|
|
9
|
+
//#region ../@warlock.js/create-warlock/src/helpers/project-builder-helpers.ts
|
|
10
10
|
async function initializeGitRepository(appPath) {
|
|
11
11
|
await executeCommand(`git`, ["init"], appPath);
|
|
12
12
|
await executeCommand(`git`, [
|
package/esm/index.d.mts
CHANGED
package/esm/index.mjs
CHANGED
package/esm/ui/banner.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colors } from "@mongez/copper";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/create-warlock/src/ui/banner.ts
|
|
4
4
|
const warlockTextAnsi = `
|
|
5
5
|
\x1b[49m
|
|
6
6
|
\x1b[49m \x1b[38;2;252;238;36m██╗ ██╗ █████╗ ██████╗ ██╗ ██████╗ ██████╗██╗ ██╗ \x1b[38;2;252;238;36m ██╗ ███████╗\x1b[m
|
package/esm/ui/spinners.mjs
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@clack/prompts": "^0.7.0",
|
|
11
11
|
"@mongez/copper": "^2.1.2",
|
|
12
|
-
"@warlock.js/fs": "
|
|
12
|
+
"@warlock.js/fs": "*",
|
|
13
13
|
"@mongez/reinforcements": "^3.2.0",
|
|
14
14
|
"cross-spawn": "^7.0.3",
|
|
15
15
|
"rimraf": "^6.0.1",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"bin": {
|
|
19
19
|
"create-warlock": "bin/create-app.js"
|
|
20
20
|
},
|
|
21
|
-
"version": "4.1.
|
|
21
|
+
"version": "4.1.9",
|
|
22
22
|
"type": "module",
|
|
23
23
|
"main": "./esm/index.mjs",
|
|
24
24
|
"module": "./esm/index.mjs",
|
|
@@ -34,7 +34,7 @@ export class OTP extends Model<OTPSchema> {
|
|
|
34
34
|
*/
|
|
35
35
|
public get isValid(): boolean {
|
|
36
36
|
if (this.get("usedAt")) return false;
|
|
37
|
-
if (this.get("attempts") >= this.get("maxAttempts")) return false;
|
|
37
|
+
if ((this.get("attempts") ?? 0) >= (this.get("maxAttempts") ?? 0)) return false;
|
|
38
38
|
if (new Date() > new Date(this.get("expiresAt"))) return false;
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
@@ -50,7 +50,7 @@ export class OTP extends Model<OTPSchema> {
|
|
|
50
50
|
* Check if max attempts exceeded
|
|
51
51
|
*/
|
|
52
52
|
public get isMaxAttemptsExceeded(): boolean {
|
|
53
|
-
return this.get("attempts") >= this.get("maxAttempts");
|
|
53
|
+
return (this.get("attempts") ?? 0) >= (this.get("maxAttempts") ?? 0);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -64,6 +64,6 @@ export class OTP extends Model<OTPSchema> {
|
|
|
64
64
|
* Increment failed attempt
|
|
65
65
|
*/
|
|
66
66
|
public async incrementAttempt(): Promise<this> {
|
|
67
|
-
return this.set("attempts", this.get("attempts") + 1).save();
|
|
67
|
+
return this.set("attempts", (this.get("attempts") ?? 0) + 1).save();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import type { Duration } from "@warlock.js/auth";
|
|
2
1
|
import { ForbiddenError, t } from "@warlock.js/core";
|
|
3
2
|
import { OTP } from "../models/otp";
|
|
4
3
|
import { AuthErrorCode } from "../utils/auth-error-code";
|
|
5
4
|
import type { OTPChannel, OTPType } from "../utils/types";
|
|
6
5
|
|
|
6
|
+
/** Human-friendly duration parts, summed to milliseconds by `parseDurationToMs`. */
|
|
7
|
+
type Duration = {
|
|
8
|
+
milliseconds?: number;
|
|
9
|
+
seconds?: number;
|
|
10
|
+
minutes?: number;
|
|
11
|
+
hours?: number;
|
|
12
|
+
days?: number;
|
|
13
|
+
weeks?: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
7
16
|
// Default OTP expiration
|
|
8
17
|
const DEFAULT_OTP_EXPIRATION: Duration = { minutes: 15 };
|
|
9
18
|
|
|
@@ -6,7 +6,13 @@ export const updatePostController: GuardedRequestHandler<UpdatePostSchema> = asy
|
|
|
6
6
|
request,
|
|
7
7
|
response,
|
|
8
8
|
) => {
|
|
9
|
-
const
|
|
9
|
+
const id = request.int("id");
|
|
10
|
+
|
|
11
|
+
if (!id) {
|
|
12
|
+
return response.notFound();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const post = await Post.find(id);
|
|
10
16
|
|
|
11
17
|
if (!post) {
|
|
12
18
|
return response.notFound();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fileExistsAsync } from "@warlock.js/fs";
|
|
2
2
|
import { CACHE_FOR } from "@warlock.js/cache";
|
|
3
|
-
import { Image, type RequestHandler, storage
|
|
3
|
+
import { Image, type RequestHandler, storage } from "@warlock.js/core";
|
|
4
|
+
import { v } from "@warlock.js/seal";
|
|
4
5
|
|
|
5
6
|
export const fetchUploadedFileController: RequestHandler = async (
|
|
6
7
|
request,
|