@warlock.js/core 2.8.7 → 2.8.8
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/cjs/aws/index.d.ts +3 -3
- package/cjs/aws/index.d.ts.map +1 -1
- package/cjs/aws/index.js +13 -3
- package/cjs/aws/index.js.map +1 -1
- package/cjs/config/index.d.ts +1 -0
- package/cjs/config/index.d.ts.map +1 -1
- package/cjs/config/utils.d.ts +8 -0
- package/cjs/config/utils.d.ts.map +1 -0
- package/cjs/config/utils.js +9 -0
- package/cjs/config/utils.js.map +1 -0
- package/cjs/index.js +1 -1
- package/cjs/modules/uploads/controllers/get-uploaded-file.d.ts +3 -0
- package/cjs/modules/uploads/controllers/get-uploaded-file.d.ts.map +1 -1
- package/cjs/modules/uploads/controllers/get-uploaded-file.js +82 -44
- package/cjs/modules/uploads/controllers/get-uploaded-file.js.map +1 -1
- package/cjs/modules/uploads/events/index.js +1 -1
- package/cjs/modules/uploads/output/upload-output.js +1 -1
- package/cjs/modules/uploads/output/upload-output.js.map +1 -1
- package/cjs/starters/start-cli-server.d.ts.map +1 -1
- package/cjs/starters/start-cli-server.js +1 -0
- package/cjs/starters/start-cli-server.js.map +1 -1
- package/cjs/validator/v/rules.d.ts.map +1 -1
- package/cjs/validator/v/rules.js +6 -6
- package/cjs/validator/v/rules.js.map +1 -1
- package/cjs/validator/v/schema.d.ts +12 -0
- package/cjs/validator/v/schema.d.ts.map +1 -1
- package/cjs/validator/v/schema.js +15 -0
- package/cjs/validator/v/schema.js.map +1 -1
- package/esm/aws/index.d.ts +3 -3
- package/esm/aws/index.d.ts.map +1 -1
- package/esm/aws/index.js +13 -3
- package/esm/aws/index.js.map +1 -1
- package/esm/config/index.d.ts +1 -0
- package/esm/config/index.d.ts.map +1 -1
- package/esm/config/utils.d.ts +8 -0
- package/esm/config/utils.d.ts.map +1 -0
- package/esm/config/utils.js +9 -0
- package/esm/config/utils.js.map +1 -0
- package/esm/index.js +1 -1
- package/esm/modules/uploads/controllers/get-uploaded-file.d.ts +3 -0
- package/esm/modules/uploads/controllers/get-uploaded-file.d.ts.map +1 -1
- package/esm/modules/uploads/controllers/get-uploaded-file.js +82 -44
- package/esm/modules/uploads/controllers/get-uploaded-file.js.map +1 -1
- package/esm/modules/uploads/events/index.js +1 -1
- package/esm/modules/uploads/output/upload-output.js +1 -1
- package/esm/modules/uploads/output/upload-output.js.map +1 -1
- package/esm/starters/start-cli-server.d.ts.map +1 -1
- package/esm/starters/start-cli-server.js +2 -1
- package/esm/starters/start-cli-server.js.map +1 -1
- package/esm/validator/v/rules.d.ts.map +1 -1
- package/esm/validator/v/rules.js +6 -6
- package/esm/validator/v/rules.js.map +1 -1
- package/esm/validator/v/schema.d.ts +12 -0
- package/esm/validator/v/schema.d.ts.map +1 -1
- package/esm/validator/v/schema.js +16 -1
- package/esm/validator/v/schema.js.map +1 -1
- package/package.json +3 -3
package/cjs/aws/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type AWSConnectionOptions = {
|
|
|
17
17
|
export type AWSConfigurations = {
|
|
18
18
|
parseFileName?: (options: {
|
|
19
19
|
fileName: string;
|
|
20
|
-
hash
|
|
20
|
+
hash?: string;
|
|
21
21
|
}) => string;
|
|
22
22
|
connectionOptions: AWSConnectionOptions | (() => Promise<AWSConnectionOptions>);
|
|
23
23
|
};
|
|
@@ -25,8 +25,8 @@ export type AWSUploadOptions = {
|
|
|
25
25
|
filePath?: string;
|
|
26
26
|
fileBuffer?: Buffer;
|
|
27
27
|
fileName: string;
|
|
28
|
-
hash
|
|
29
|
-
mimeType
|
|
28
|
+
hash?: string;
|
|
29
|
+
mimeType?: string;
|
|
30
30
|
isCachedFile?: boolean;
|
|
31
31
|
} & AWSConfigurations;
|
|
32
32
|
export declare function createAWSClient(connectionOptions: AWSConfigurations["connectionOptions"]): Promise<{
|
package/cjs/aws/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aws/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,cAAc,0BAA0B,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IACzE,iBAAiB,EACb,oBAAoB,GACpB,CAAC,MAAM,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,iBAAiB,CAAC;AAsBtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAAC;;;;;;GAoC1D;AAED,wBAAsB,WAAW,CAAC,EAChC,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,YAAoB,EACpB,aACoE,EACpE,iBAAiB,GAClB,EAAE,gBAAgB;;;;;;;GA2DlB;AAED,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,iBAAiB,GAClB,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CAC3D,iBA4BA;AAED,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,iBAAiB,GAClB,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CAC3D,gBA8BA;AAED,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,gBA+BA"}
|
package/cjs/aws/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
'use strict';var clientS3=require('@aws-sdk/client-s3'),logger=require('@warlock.js/logger'),fs=require('fs');require('@mongez/config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var fs__default=/*#__PURE__*/_interopDefault(fs);
|
|
1
|
+
'use strict';var clientS3=require('@aws-sdk/client-s3'),logger=require('@warlock.js/logger'),fs=require('fs'),path=require('path');require('@mongez/config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var fs__default=/*#__PURE__*/_interopDefault(fs);function getObjectUrl({ bucketName, fileName, providerUrl, providerName,
|
|
2
|
+
// connectionOptions,
|
|
3
|
+
}) {
|
|
4
|
+
return `https://${bucketName}.${providerUrl}/${fileName}`;
|
|
5
|
+
}
|
|
6
|
+
async function createAWSClient(connectionOptions) {
|
|
2
7
|
if (typeof connectionOptions === "function") {
|
|
3
8
|
connectionOptions = await connectionOptions();
|
|
4
9
|
}
|
|
@@ -23,7 +28,7 @@
|
|
|
23
28
|
region,
|
|
24
29
|
};
|
|
25
30
|
}
|
|
26
|
-
async function uploadToAWS({ filePath, fileBuffer, fileName, hash, mimeType, isCachedFile = false, parseFileName = ({ fileName, hash }) => hash + "
|
|
31
|
+
async function uploadToAWS({ filePath, fileBuffer, fileName, hash, mimeType, isCachedFile = false, parseFileName = ({ fileName, hash }) => (hash ? hash + "/" : "") + path.normalize(fileName).replace(/\\/g, "/"), connectionOptions, }) {
|
|
27
32
|
const finalFleName = (isCachedFile ? "cache/" : "") + parseFileName({ fileName, hash });
|
|
28
33
|
const { client, bucketName, endpointUrl, providerName, region } = await createAWSClient(connectionOptions);
|
|
29
34
|
const command = new clientS3.PutObjectCommand({
|
|
@@ -47,7 +52,12 @@ async function uploadToAWS({ filePath, fileBuffer, fileName, hash, mimeType, isC
|
|
|
47
52
|
bucket: bucketName,
|
|
48
53
|
region,
|
|
49
54
|
fileName: finalFleName,
|
|
50
|
-
url:
|
|
55
|
+
url: getObjectUrl({
|
|
56
|
+
bucketName,
|
|
57
|
+
fileName: finalFleName,
|
|
58
|
+
providerUrl,
|
|
59
|
+
providerName,
|
|
60
|
+
}),
|
|
51
61
|
};
|
|
52
62
|
}
|
|
53
63
|
catch (err) {
|
package/cjs/aws/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/aws/index.ts"],"sourcesContent":[null],"names":["S3Client","PutObjectCommand","fs","log","DeleteObjectCommand","GetObjectCommand"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/aws/index.ts"],"sourcesContent":[null],"names":["S3Client","normalize","PutObjectCommand","fs","log","DeleteObjectCommand","GetObjectCommand"],"mappings":"+QA0CA,SAAS,YAAY,CAAC,EACpB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,Y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AA,UAAG,CACD,KAAK,EACL,UAAU,EACV,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,EACtD,SAAS,CACV,CAAC;AAEF,QAAA,OAAO,OAAO,CAAC,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAC7C,KAAA;AAAC,IAAA,OAAO,GAAG,EAAE;AACZ,QAAA,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1BA,UAAG,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACvC,KAAA;AACH"}
|
package/cjs/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a config value
|
|
3
|
+
* @param key - The config key, it supports dot notation syntax
|
|
4
|
+
* @param defaultValue - The default value
|
|
5
|
+
* @returns The config value
|
|
6
|
+
*/
|
|
7
|
+
export declare function config<T = any>(key: string, defaultValue?: T): T;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/config/utils.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAEhE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';var config$1=require('@mongez/config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var config__default=/*#__PURE__*/_interopDefault(config$1);/**
|
|
2
|
+
* Get a config value
|
|
3
|
+
* @param key - The config key, it supports dot notation syntax
|
|
4
|
+
* @param defaultValue - The default value
|
|
5
|
+
* @returns The config value
|
|
6
|
+
*/
|
|
7
|
+
function config(key, defaultValue) {
|
|
8
|
+
return config__default.default.get(key, defaultValue);
|
|
9
|
+
}exports.config=config;//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/config/utils.ts"],"sourcesContent":[null],"names":["baseConfig"],"mappings":"gLAEA;;;;;AAKG;AACa,SAAA,MAAM,CAAU,GAAW,EAAE,YAAgB,EAAA;IAC3D,OAAOA,uBAAU,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;AAC3C"}
|
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var application=require('./application.js'),index=require('./aws/index.js'),bootstrap=require('./bootstrap.js'),setup=require('./bootstrap/setup.js'),appBuilder=require('./builder/app-builder.js'),buildCliApp=require('./builder/build-cli-app.js'),buildHttpApp=require('./builder/build-http-app.js'),configLoaderBuilder=require('./builder/config-loader-builder.js'),defineConfig=require('./config/define-config.js'),getWarlockConfig=require('./config/get-warlock-config.js'),commandBuilder=require('./console/command-builder.js'),commander=require('./console/commander.js'),index$1=require('./console/commands/index.js'),sluggable=require('./database/decorators/sluggable.js'),databaseLog=require('./database/models/database-log/database-log.js'),index$2=require('./esbuild/index.js'),UploadedFile=require('./http/UploadedFile.js'),config=require('./http/config.js'),createHttpApplication=require('./http/createHttpApplication.js'),RequestLog=require('./http/database/RequestLog.js'),events=require('./http/events.js'),requestController=require('./http/request-controller.js'),cacheResponseMiddleware=require('./http/middleware/cache-response-middleware.js'),injectRequestContext=require('./http/middleware/inject-request-context.js'),plugins$1=require('./http/plugins.js'),request=require('./http/request.js'),response=require('./http/response.js'),server=require('./http/server.js'),image=require('./image/image.js'),httpModulesLoader=require('./loaders/http-modules-loader.js'),logger=require('./logger/logger.js'),config$1=require('./mail/config.js'),reactMail=require('./mail/react-mail.js'),sendMail=require('./mail/sendMail.js'),deleteFile=require('./modules/uploads/controllers/delete-file.js'),downloadFileHandler=require('./modules/uploads/controllers/download-file-handler.js'),getUploadedFile=require('./modules/uploads/controllers/get-uploaded-file.js'),getUploadedFileWithHash=require('./modules/uploads/controllers/get-uploaded-file-with-hash.js'),uploadChunkedFiles=require('./modules/uploads/controllers/upload-chunked-files.js'),uploadFiles=require('./modules/uploads/controllers/upload-files.js');require('./modules/uploads/events/index.js');var upload=require('./modules/uploads/models/upload.js'),uploadOutput=require('./modules/uploads/output/upload-output.js'),file=require('./modules/uploads/utils/file.js'),getUploadsSize=require('./modules/uploads/utils/get-uploads-size.js'),uploadable=require('./modules/uploads/utils/uploadable.js'),output=require('./output/output.js'),index$3=require('./pool/index.js'),index$4=require('./postman/index.js'),index$5=require('./react/index.js'),baseRepositoryManager=require('./repositories/base-repository-manager.js'),repositoryDestroyerManager=require('./repositories/repository-destroyer-manager.js'),repositoryFillerManager=require('./repositories/repository-filler-manager.js'),repositoryListManager=require('./repositories/repository-list-manager.js'),repositoryManager=require('./repositories/repository-manager.js'),utils=require('./repositories/utils.js'),restful=require('./restful/restful.js'),utils$1=require('./restful/utils.js'),router=require('./router/router.js'),utils$2=require('./router/utils.js'),index$6=require('./store/index.js'),bootTesting=require('./tests/boot-testing.js'),createHttpTestApplication=require('./tests/create-http-test-application.js'),httpResponseOutputTest=require('./tests/http-response-output-test.js'),appLog=require('./utils/app-log.js'),dateOutput=require('./utils/date-output.js'),environment=require('./utils/environment.js'),getLocalized=require('./utils/get-localized.js'),paths=require('./utils/paths.js'),promiseAllObject=require('./utils/promise-all-object.js'),queue=require('./utils/queue.js'),sleep=require('./utils/sleep.js'),sluggable$1=require('./utils/sluggable.js'),toJson=require('./utils/to-json.js'),urls=require('./utils/urls.js');require('./validator/locales.js');var array=require('./validator/rules/array.js'),arrayOf=require('./validator/rules/array-of.js'),boolean=require('./validator/rules/boolean.js'),confirmed=require('./validator/rules/confirmed.js'),date=require('./validator/rules/date.js'),egyptionPhoneNumber=require('./validator/rules/egyption-phone-number.js'),email=require('./validator/rules/email.js'),exists=require('./validator/rules/exists.js'),file$1=require('./validator/rules/file.js'),float=require('./validator/rules/float.js'),image$1=require('./validator/rules/image.js'),_in=require('./validator/rules/in.js'),int=require('./validator/rules/int.js'),length=require('./validator/rules/length.js'),localized=require('./validator/rules/localized.js'),max=require('./validator/rules/max.js'),maxLength=require('./validator/rules/max-length.js'),min=require('./validator/rules/min.js'),minLength=require('./validator/rules/min-length.js'),missingIf=require('./validator/rules/missing-if.js'),number=require('./validator/rules/number.js'),object=require('./validator/rules/object.js'),pattern=require('./validator/rules/pattern.js'),required=require('./validator/rules/required.js'),requiredIf=require('./validator/rules/required-if.js'),requiredIfEmpty=require('./validator/rules/required-if-empty.js'),requiredWith=require('./validator/rules/required-with.js'),requiredWithAll=require('./validator/rules/required-with-all.js'),rule=require('./validator/rules/rule.js'),scalar=require('./validator/rules/scalar.js'),string=require('./validator/rules/string.js'),stringify=require('./validator/rules/stringify.js'),unique=require('./validator/rules/unique.js'),uploadable$1=require('./validator/rules/uploadable.js'),url=require('./validator/rules/url.js'),rulesList=require('./validator/rules-list.js'),utils$3=require('./validator/utils.js'),schema=require('./validator/v/schema.js'),validateAll=require('./validator/validateAll.js'),validationSchema=require('./validator/validation-schema.js'),validator=require('./validator/validator.js'),validatorEvents=require('./validator/validator-events.js'),getAwsConfigurations=require('./aws/get-aws-configurations.js'),seeder=require('./console/commands/database/seeder.js'),plugins=require('./esbuild/plugins.js'),executeTsFile=require('./esbuild/execute-ts-file.js'),compressUploadedFile=require('./modules/uploads/events/compress-uploaded-file.js'),removeFromAws=require('./modules/uploads/events/remove-from-aws.js'),syncWithAws=require('./modules/uploads/events/sync-with-aws.js'),uploadToAws=require('./modules/uploads/events/upload-to-aws.js'),postmanGenerator=require('./postman/postman-generator.js'),plugin=require('./react/plugin.js');exports.startHttpApplication=application.startHttpApplication;exports.createAWSClient=index.createAWSClient;exports.deleteFromAWS=index.deleteFromAWS;exports.downloadFromAWS=index.downloadFromAWS;exports.streamFromAWS=index.streamFromAWS;exports.uploadToAWS=index.uploadToAWS;exports.bootstrap=bootstrap.bootstrap;exports.disconnectCache=setup.disconnectCache;exports.disconnectDatabase=setup.disconnectDatabase;exports.displayEnvironmentMode=setup.displayEnvironmentMode;exports.executeDatabaseThenDisconnect=setup.executeDatabaseThenDisconnect;exports.setupCache=setup.setupCache;exports.setupDatabase=setup.setupDatabase;exports.createAppBuilder=appBuilder.createAppBuilder;exports.createBootstrapFile=appBuilder.createBootstrapFile;exports.createEnvironmentModeDisplayFile=appBuilder.createEnvironmentModeDisplayFile;exports.createWarlockFile=appBuilder.createWarlockFile;exports.ensureWarlockPath=appBuilder.ensureWarlockPath;exports.globModule=appBuilder.globModule;exports.globModuleDirectory=appBuilder.globModuleDirectory;exports.globModuleDirectoryPattern=appBuilder.globModuleDirectoryPattern;exports.loadEventFiles=appBuilder.loadEventFiles;exports.loadLocalesFiles=appBuilder.loadLocalesFiles;exports.loadMainFiles=appBuilder.loadMainFiles;exports.loadRoutesFiles=appBuilder.loadRoutesFiles;exports.buildCliApp=buildCliApp.buildCliApp;exports.createCliApplicationStarter=buildCliApp.createCliApplicationStarter;exports.loadCommandFiles=buildCliApp.loadCommandFiles;exports.buildHttpApp=buildHttpApp.buildHttpApp;exports.createHttpApplicationStarter=buildHttpApp.createHttpApplicationStarter;exports.configFileLoaderName=configLoaderBuilder.configFileLoaderName;exports.createConfigLoader=configLoaderBuilder.createConfigLoader;exports.defineConfig=defineConfig.defineConfig;exports.getWarlockConfig=getWarlockConfig.getWarlockConfig;exports.setWarlockConfig=getWarlockConfig.setWarlockConfig;exports.CommandBuilder=commandBuilder.CommandBuilder;exports.command=commandBuilder.command;exports.registerCommand=commander.registerCommand;exports.registerCommands=commander.registerCommands;exports.startConsoleApplication=commander.startConsoleApplication;exports.$registerBuiltInCommands=index$1.$registerBuiltInCommands;exports.Sluggable=sluggable.Sluggable;exports.DatabaseLogModel=databaseLog.DatabaseLogModel;exports.buildReporterPlugin=index$2.buildReporterPlugin;exports.injectImportPathPlugin=index$2.injectImportPathPlugin;exports.nativeNodeModulesPlugin=index$2.nativeNodeModulesPlugin;exports.UploadedFile=UploadedFile.UploadedFile;exports.defaultHttpConfigurations=config.defaultHttpConfigurations;exports.httpConfig=config.httpConfig;exports.createHttpApplication=createHttpApplication.createHttpApplication;exports.stopHttpApplication=createHttpApplication.stopHttpApplication;exports.RequestLog=RequestLog.RequestLog;exports.logResponse=events.logResponse;exports.wrapResponseInDataKey=events.wrapResponseInDataKey;exports.RequestController=requestController.RequestController;exports.cacheMiddleware=cacheResponseMiddleware.cacheMiddleware;exports.createRequestStore=injectRequestContext.createRequestStore;exports.currentRequest=injectRequestContext.currentRequest;exports.fromRequest=injectRequestContext.fromRequest;exports.requestContext=injectRequestContext.requestContext;exports.t=injectRequestContext.t;exports.useRequestStore=injectRequestContext.useRequestStore;exports.registerHttpPlugins=plugins$1.registerHttpPlugins;exports.Request=request.Request;exports.Response=response.Response;Object.defineProperty(exports,'ResponseStatus',{enumerable:true,get:function(){return response.ResponseStatus}});exports.getServer=server.getServer;exports.startServer=server.startServer;exports.Image=image.Image;exports.HttpModulesLoader=httpModulesLoader.HttpModulesLoader;exports.setLogConfigurations=logger.setLogConfigurations;exports.getMailConfigurations=config$1.getMailConfigurations;exports.setMailConfigurations=config$1.setMailConfigurations;exports.renderReactMail=reactMail.renderReactMail;exports.newMailer=sendMail.newMailer;exports.sendMail=sendMail.sendMail;exports.sendReactMail=sendMail.sendReactMail;exports.deleteFile=deleteFile.deleteFile;exports.downloadFileHandler=downloadFileHandler.downloadFileHandler;exports.getUploadedFile=getUploadedFile.getUploadedFile;exports.getUploadedFileUsingHash=getUploadedFileWithHash.getUploadedFileUsingHash;exports.responseFromAWS=getUploadedFileWithHash.responseFromAWS;exports.uploadChunkedFiles=uploadChunkedFiles.uploadChunkedFiles;exports.uploadFiles=uploadFiles.uploadFiles;exports.Upload=upload.Upload;exports.UploadBlueprint=upload.UploadBlueprint;exports.uploadsMigration=upload.uploadsMigration;exports.UploadOutput=uploadOutput.UploadOutput;exports.File=file.File;exports.getUploadsSize=getUploadsSize.getUploadsSize;exports.uploadFromFile=uploadable.uploadFromFile;exports.uploadFromUrl=uploadable.uploadFromUrl;exports.uploadable=uploadable.uploadable;exports.uploadableExtended=uploadable.uploadableExtended;exports.Output=output.Output;exports.output=output.output;exports.Pool=index$3.Pool;exports.pool=index$3.pool;exports.generatePostman=index$4.generatePostman;exports.generatePostmanApp=index$4.generatePostmanApp;exports.registerPostmanCommand=index$4.registerPostmanCommand;exports.render=index$5.render;exports.renderReact=index$5.renderReact;exports.BaseRepositoryManager=baseRepositoryManager.BaseRepositoryManager;exports.RepositoryDestroyManager=repositoryDestroyerManager.RepositoryDestroyManager;exports.RepositoryFillerManager=repositoryFillerManager.RepositoryFillerManager;exports.RepositoryListManager=repositoryListManager.RepositoryListManager;exports.RepositoryManager=repositoryManager.RepositoryManager;exports.defaultRepositoryOptions=utils.defaultRepositoryOptions;exports.Restful=restful.Restful;exports.createResource=utils$1.createResource;exports.deleteActiveResource=utils$1.deleteActiveResource;exports.deleteOwnedActiveResource=utils$1.deleteOwnedActiveResource;exports.deleteOwnedResource=utils$1.deleteOwnedResource;exports.deleteResource=utils$1.deleteResource;exports.getActiveCachedResource=utils$1.getActiveCachedResource;exports.getActiveResource=utils$1.getActiveResource;exports.getOwnedActiveResource=utils$1.getOwnedActiveResource;exports.getOwnedResource=utils$1.getOwnedResource;exports.getResource=utils$1.getResource;exports.listActiveCachedResources=utils$1.listActiveCachedResources;exports.listActiveResources=utils$1.listActiveResources;exports.listOwnedActiveResources=utils$1.listOwnedActiveResources;exports.listOwnedResources=utils$1.listOwnedResources;exports.listResources=utils$1.listResources;exports.updateActiveResource=utils$1.updateActiveResource;exports.updateResource=utils$1.updateResource;exports.Router=router.Router;exports.router=router.router;exports.route=utils$2.route;exports.createStore=index$6.createStore;exports.useStore=index$6.useStore;exports.bootHttpTestingServer=bootTesting.bootHttpTestingServer;exports.bootTesting=bootTesting.bootTesting;exports.terminateTesting=bootTesting.terminateTesting;exports.httpServerTest=createHttpTestApplication.httpServerTest;exports.terminateHttpServerTest=createHttpTestApplication.terminateHttpServerTest;exports.HttpResponseOutputTest=httpResponseOutputTest.HttpResponseOutputTest;exports.appLog=appLog.appLog;exports.dateOutput=dateOutput.dateOutput;exports.environment=environment.environment;exports.setEnvironment=environment.setEnvironment;exports.getLocalized=getLocalized.getLocalized;exports.appPath=paths.appPath;exports.cachePath=paths.cachePath;exports.configPath=paths.configPath;exports.consolePath=paths.consolePath;exports.publicPath=paths.publicPath;exports.rootPath=paths.rootPath;exports.sanitizePath=paths.sanitizePath;exports.srcPath=paths.srcPath;exports.storagePath=paths.storagePath;exports.tempPath=paths.tempPath;exports.uploadsPath=paths.uploadsPath;exports.warlockPath=paths.warlockPath;exports.promiseAllObject=promiseAllObject.promiseAllObject;exports.Queue=queue.Queue;exports.sleep=sleep.sleep;exports.sluggable=sluggable$1.sluggable;exports.toJson=toJson.toJson;exports.assetsUrl=urls.assetsUrl;exports.publicUrl=urls.publicUrl;exports.setBaseUrl=urls.setBaseUrl;exports.uploadsUrl=urls.uploadsUrl;exports.url=urls.url;exports.ArrayRule=array.ArrayRule;exports.ArrayOfRule=arrayOf.ArrayOfRule;exports.BooleanRule=boolean.BooleanRule;exports.ConfirmedRule=confirmed.ConfirmedRule;exports.DateRule=date.DateRule;exports.EgyptianPhoneNumberRule=egyptionPhoneNumber.EgyptianPhoneNumberRule;exports.EmailRule=email.EmailRule;exports.ExistsRule=exists.ExistsRule;exports.FileRule=file$1.FileRule;exports.FloatRule=float.FloatRule;exports.ImageRule=image$1.ImageRule;exports.InRule=_in.InRule;exports.IntRule=int.IntRule;exports.LengthRule=length.LengthRule;exports.LocalizedRule=localized.LocalizedRule;exports.MaxRule=max.MaxRule;exports.MaxLengthRule=maxLength.MaxLengthRule;exports.MinRule=min.MinRule;exports.MinLengthRule=minLength.MinLengthRule;exports.MissingIfRule=missingIf.MissingIfRule;exports.NumberRule=number.NumberRule;exports.ObjectRule=object.ObjectRule;exports.PatternRule=pattern.PatternRule;exports.RequiredRule=required.RequiredRule;exports.RequiredIfRule=requiredIf.RequiredIfRule;exports.RequiredIfEmptyRule=requiredIfEmpty.RequiredIfEmptyRule;exports.RequiredWithRule=requiredWith.RequiredWithRule;exports.RequiredWithAllRule=requiredWithAll.RequiredWithAllRule;exports.Rule=rule.Rule;exports.ScalarRule=scalar.ScalarRule;exports.StringRule=string.StringRule;exports.StringifyRule=stringify.StringifyRule;exports.UniqueRule=unique.UniqueRule;exports.UploadableRule=uploadable$1.UploadableRule;exports.UrlRule=url.UrlRule;exports.RulesList=rulesList.RulesList;exports.getRuleHandler=utils$3.getRuleHandler;exports.getValidationSchema=utils$3.getValidationSchema;exports.AnyValidator=schema.AnyValidator;exports.ArrayValidator=schema.ArrayValidator;exports.BaseValidator=schema.BaseValidator;exports.BooleanValidator=schema.BooleanValidator;exports.DateValidator=schema.DateValidator;exports.FileValidator=schema.FileValidator;exports.FloatValidator=schema.FloatValidator;exports.IntValidator=schema.IntValidator;exports.ObjectValidator=schema.ObjectValidator;exports.ScalarValidator=schema.ScalarValidator;exports.StringValidator=schema.StringValidator;exports.v=schema.v;exports.validate=schema.validate;exports.validateAll=validateAll.validateAll;exports.ArraySchema=validationSchema.ArraySchema;exports.ValidationSchema=validationSchema.ValidationSchema;exports.Validator=validator.Validator;exports.validatorEvents=validatorEvents.validatorEvents;exports.getAWSConfig=getAwsConfigurations.getAWSConfig;exports.getAWSConfigurations=getAwsConfigurations.getAWSConfigurations;exports.seed=seeder.seed;exports.startSeeding=seeder.startSeeding;exports.startServerPlugin=plugins.startServerPlugin;exports.executeTsFile=executeTsFile.executeTsFile;exports.compressImageWhileUploading=compressUploadedFile.compressImageWhileUploading;exports.compressUploadingFile=compressUploadedFile.compressUploadingFile;exports.removeFromAWSBucket=removeFromAws.removeFromAWSBucket;exports.syncFilesWithAWS=syncWithAws.syncFilesWithAWS;exports.uploadFileToAWS=uploadToAws.uploadFileToAWS;exports.uploadFileToAWSInBackground=uploadToAws.uploadFileToAWSInBackground;exports.Postman=postmanGenerator.Postman;exports.getJsonValidationSchema=postmanGenerator.getJsonValidationSchema;exports.namedMethodRoute=postmanGenerator.namedMethodRoute;exports.parseValidationSchema=postmanGenerator.parseValidationSchema;exports.renderGetMethodRoute=postmanGenerator.renderGetMethodRoute;exports.ReactPlugin=plugin.ReactPlugin;exports.useReact=plugin.useReact;//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var application=require('./application.js'),index=require('./aws/index.js'),bootstrap=require('./bootstrap.js'),setup=require('./bootstrap/setup.js'),appBuilder=require('./builder/app-builder.js'),buildCliApp=require('./builder/build-cli-app.js'),buildHttpApp=require('./builder/build-http-app.js'),configLoaderBuilder=require('./builder/config-loader-builder.js'),defineConfig=require('./config/define-config.js'),getWarlockConfig=require('./config/get-warlock-config.js'),utils=require('./config/utils.js'),commandBuilder=require('./console/command-builder.js'),commander=require('./console/commander.js'),index$1=require('./console/commands/index.js'),sluggable=require('./database/decorators/sluggable.js'),databaseLog=require('./database/models/database-log/database-log.js'),index$2=require('./esbuild/index.js'),UploadedFile=require('./http/UploadedFile.js'),config=require('./http/config.js'),createHttpApplication=require('./http/createHttpApplication.js'),RequestLog=require('./http/database/RequestLog.js'),events=require('./http/events.js'),requestController=require('./http/request-controller.js'),cacheResponseMiddleware=require('./http/middleware/cache-response-middleware.js'),injectRequestContext=require('./http/middleware/inject-request-context.js'),plugins$1=require('./http/plugins.js'),request=require('./http/request.js'),response=require('./http/response.js'),server=require('./http/server.js'),image=require('./image/image.js'),httpModulesLoader=require('./loaders/http-modules-loader.js'),logger=require('./logger/logger.js'),config$1=require('./mail/config.js'),reactMail=require('./mail/react-mail.js'),sendMail=require('./mail/sendMail.js'),deleteFile=require('./modules/uploads/controllers/delete-file.js'),downloadFileHandler=require('./modules/uploads/controllers/download-file-handler.js'),getUploadedFile=require('./modules/uploads/controllers/get-uploaded-file.js'),getUploadedFileWithHash=require('./modules/uploads/controllers/get-uploaded-file-with-hash.js'),uploadChunkedFiles=require('./modules/uploads/controllers/upload-chunked-files.js'),uploadFiles=require('./modules/uploads/controllers/upload-files.js');require('./modules/uploads/events/index.js');var upload=require('./modules/uploads/models/upload.js'),uploadOutput=require('./modules/uploads/output/upload-output.js'),file=require('./modules/uploads/utils/file.js'),getUploadsSize=require('./modules/uploads/utils/get-uploads-size.js'),uploadable=require('./modules/uploads/utils/uploadable.js'),output=require('./output/output.js'),index$3=require('./pool/index.js'),index$4=require('./postman/index.js'),index$5=require('./react/index.js'),baseRepositoryManager=require('./repositories/base-repository-manager.js'),repositoryDestroyerManager=require('./repositories/repository-destroyer-manager.js'),repositoryFillerManager=require('./repositories/repository-filler-manager.js'),repositoryListManager=require('./repositories/repository-list-manager.js'),repositoryManager=require('./repositories/repository-manager.js'),utils$1=require('./repositories/utils.js'),restful=require('./restful/restful.js'),utils$2=require('./restful/utils.js'),router=require('./router/router.js'),utils$3=require('./router/utils.js'),index$6=require('./store/index.js'),bootTesting=require('./tests/boot-testing.js'),createHttpTestApplication=require('./tests/create-http-test-application.js'),httpResponseOutputTest=require('./tests/http-response-output-test.js'),appLog=require('./utils/app-log.js'),dateOutput=require('./utils/date-output.js'),environment=require('./utils/environment.js'),getLocalized=require('./utils/get-localized.js'),paths=require('./utils/paths.js'),promiseAllObject=require('./utils/promise-all-object.js'),queue=require('./utils/queue.js'),sleep=require('./utils/sleep.js'),sluggable$1=require('./utils/sluggable.js'),toJson=require('./utils/to-json.js'),urls=require('./utils/urls.js');require('./validator/locales.js');var array=require('./validator/rules/array.js'),arrayOf=require('./validator/rules/array-of.js'),boolean=require('./validator/rules/boolean.js'),confirmed=require('./validator/rules/confirmed.js'),date=require('./validator/rules/date.js'),egyptionPhoneNumber=require('./validator/rules/egyption-phone-number.js'),email=require('./validator/rules/email.js'),exists=require('./validator/rules/exists.js'),file$1=require('./validator/rules/file.js'),float=require('./validator/rules/float.js'),image$1=require('./validator/rules/image.js'),_in=require('./validator/rules/in.js'),int=require('./validator/rules/int.js'),length=require('./validator/rules/length.js'),localized=require('./validator/rules/localized.js'),max=require('./validator/rules/max.js'),maxLength=require('./validator/rules/max-length.js'),min=require('./validator/rules/min.js'),minLength=require('./validator/rules/min-length.js'),missingIf=require('./validator/rules/missing-if.js'),number=require('./validator/rules/number.js'),object=require('./validator/rules/object.js'),pattern=require('./validator/rules/pattern.js'),required=require('./validator/rules/required.js'),requiredIf=require('./validator/rules/required-if.js'),requiredIfEmpty=require('./validator/rules/required-if-empty.js'),requiredWith=require('./validator/rules/required-with.js'),requiredWithAll=require('./validator/rules/required-with-all.js'),rule=require('./validator/rules/rule.js'),scalar=require('./validator/rules/scalar.js'),string=require('./validator/rules/string.js'),stringify=require('./validator/rules/stringify.js'),unique=require('./validator/rules/unique.js'),uploadable$1=require('./validator/rules/uploadable.js'),url=require('./validator/rules/url.js'),rulesList=require('./validator/rules-list.js'),utils$4=require('./validator/utils.js'),schema=require('./validator/v/schema.js'),validateAll=require('./validator/validateAll.js'),validationSchema=require('./validator/validation-schema.js'),validator=require('./validator/validator.js'),validatorEvents=require('./validator/validator-events.js'),getAwsConfigurations=require('./aws/get-aws-configurations.js'),seeder=require('./console/commands/database/seeder.js'),plugins=require('./esbuild/plugins.js'),executeTsFile=require('./esbuild/execute-ts-file.js'),compressUploadedFile=require('./modules/uploads/events/compress-uploaded-file.js'),removeFromAws=require('./modules/uploads/events/remove-from-aws.js'),syncWithAws=require('./modules/uploads/events/sync-with-aws.js'),uploadToAws=require('./modules/uploads/events/upload-to-aws.js'),postmanGenerator=require('./postman/postman-generator.js'),plugin=require('./react/plugin.js');exports.startHttpApplication=application.startHttpApplication;exports.createAWSClient=index.createAWSClient;exports.deleteFromAWS=index.deleteFromAWS;exports.downloadFromAWS=index.downloadFromAWS;exports.streamFromAWS=index.streamFromAWS;exports.uploadToAWS=index.uploadToAWS;exports.bootstrap=bootstrap.bootstrap;exports.disconnectCache=setup.disconnectCache;exports.disconnectDatabase=setup.disconnectDatabase;exports.displayEnvironmentMode=setup.displayEnvironmentMode;exports.executeDatabaseThenDisconnect=setup.executeDatabaseThenDisconnect;exports.setupCache=setup.setupCache;exports.setupDatabase=setup.setupDatabase;exports.createAppBuilder=appBuilder.createAppBuilder;exports.createBootstrapFile=appBuilder.createBootstrapFile;exports.createEnvironmentModeDisplayFile=appBuilder.createEnvironmentModeDisplayFile;exports.createWarlockFile=appBuilder.createWarlockFile;exports.ensureWarlockPath=appBuilder.ensureWarlockPath;exports.globModule=appBuilder.globModule;exports.globModuleDirectory=appBuilder.globModuleDirectory;exports.globModuleDirectoryPattern=appBuilder.globModuleDirectoryPattern;exports.loadEventFiles=appBuilder.loadEventFiles;exports.loadLocalesFiles=appBuilder.loadLocalesFiles;exports.loadMainFiles=appBuilder.loadMainFiles;exports.loadRoutesFiles=appBuilder.loadRoutesFiles;exports.buildCliApp=buildCliApp.buildCliApp;exports.createCliApplicationStarter=buildCliApp.createCliApplicationStarter;exports.loadCommandFiles=buildCliApp.loadCommandFiles;exports.buildHttpApp=buildHttpApp.buildHttpApp;exports.createHttpApplicationStarter=buildHttpApp.createHttpApplicationStarter;exports.configFileLoaderName=configLoaderBuilder.configFileLoaderName;exports.createConfigLoader=configLoaderBuilder.createConfigLoader;exports.defineConfig=defineConfig.defineConfig;exports.getWarlockConfig=getWarlockConfig.getWarlockConfig;exports.setWarlockConfig=getWarlockConfig.setWarlockConfig;exports.config=utils.config;exports.CommandBuilder=commandBuilder.CommandBuilder;exports.command=commandBuilder.command;exports.registerCommand=commander.registerCommand;exports.registerCommands=commander.registerCommands;exports.startConsoleApplication=commander.startConsoleApplication;exports.$registerBuiltInCommands=index$1.$registerBuiltInCommands;exports.Sluggable=sluggable.Sluggable;exports.DatabaseLogModel=databaseLog.DatabaseLogModel;exports.buildReporterPlugin=index$2.buildReporterPlugin;exports.injectImportPathPlugin=index$2.injectImportPathPlugin;exports.nativeNodeModulesPlugin=index$2.nativeNodeModulesPlugin;exports.UploadedFile=UploadedFile.UploadedFile;exports.defaultHttpConfigurations=config.defaultHttpConfigurations;exports.httpConfig=config.httpConfig;exports.createHttpApplication=createHttpApplication.createHttpApplication;exports.stopHttpApplication=createHttpApplication.stopHttpApplication;exports.RequestLog=RequestLog.RequestLog;exports.logResponse=events.logResponse;exports.wrapResponseInDataKey=events.wrapResponseInDataKey;exports.RequestController=requestController.RequestController;exports.cacheMiddleware=cacheResponseMiddleware.cacheMiddleware;exports.createRequestStore=injectRequestContext.createRequestStore;exports.currentRequest=injectRequestContext.currentRequest;exports.fromRequest=injectRequestContext.fromRequest;exports.requestContext=injectRequestContext.requestContext;exports.t=injectRequestContext.t;exports.useRequestStore=injectRequestContext.useRequestStore;exports.registerHttpPlugins=plugins$1.registerHttpPlugins;exports.Request=request.Request;exports.Response=response.Response;Object.defineProperty(exports,'ResponseStatus',{enumerable:true,get:function(){return response.ResponseStatus}});exports.getServer=server.getServer;exports.startServer=server.startServer;exports.Image=image.Image;exports.HttpModulesLoader=httpModulesLoader.HttpModulesLoader;exports.setLogConfigurations=logger.setLogConfigurations;exports.getMailConfigurations=config$1.getMailConfigurations;exports.setMailConfigurations=config$1.setMailConfigurations;exports.renderReactMail=reactMail.renderReactMail;exports.newMailer=sendMail.newMailer;exports.sendMail=sendMail.sendMail;exports.sendReactMail=sendMail.sendReactMail;exports.deleteFile=deleteFile.deleteFile;exports.downloadFileHandler=downloadFileHandler.downloadFileHandler;exports.getUploadedFile=getUploadedFile.getUploadedFile;exports.getUploadedFileUsingHash=getUploadedFileWithHash.getUploadedFileUsingHash;exports.responseFromAWS=getUploadedFileWithHash.responseFromAWS;exports.uploadChunkedFiles=uploadChunkedFiles.uploadChunkedFiles;exports.uploadFiles=uploadFiles.uploadFiles;exports.Upload=upload.Upload;exports.UploadBlueprint=upload.UploadBlueprint;exports.uploadsMigration=upload.uploadsMigration;exports.UploadOutput=uploadOutput.UploadOutput;exports.File=file.File;exports.getUploadsSize=getUploadsSize.getUploadsSize;exports.uploadFromFile=uploadable.uploadFromFile;exports.uploadFromUrl=uploadable.uploadFromUrl;exports.uploadable=uploadable.uploadable;exports.uploadableExtended=uploadable.uploadableExtended;exports.Output=output.Output;exports.output=output.output;exports.Pool=index$3.Pool;exports.pool=index$3.pool;exports.generatePostman=index$4.generatePostman;exports.generatePostmanApp=index$4.generatePostmanApp;exports.registerPostmanCommand=index$4.registerPostmanCommand;exports.render=index$5.render;exports.renderReact=index$5.renderReact;exports.BaseRepositoryManager=baseRepositoryManager.BaseRepositoryManager;exports.RepositoryDestroyManager=repositoryDestroyerManager.RepositoryDestroyManager;exports.RepositoryFillerManager=repositoryFillerManager.RepositoryFillerManager;exports.RepositoryListManager=repositoryListManager.RepositoryListManager;exports.RepositoryManager=repositoryManager.RepositoryManager;exports.defaultRepositoryOptions=utils$1.defaultRepositoryOptions;exports.Restful=restful.Restful;exports.createResource=utils$2.createResource;exports.deleteActiveResource=utils$2.deleteActiveResource;exports.deleteOwnedActiveResource=utils$2.deleteOwnedActiveResource;exports.deleteOwnedResource=utils$2.deleteOwnedResource;exports.deleteResource=utils$2.deleteResource;exports.getActiveCachedResource=utils$2.getActiveCachedResource;exports.getActiveResource=utils$2.getActiveResource;exports.getOwnedActiveResource=utils$2.getOwnedActiveResource;exports.getOwnedResource=utils$2.getOwnedResource;exports.getResource=utils$2.getResource;exports.listActiveCachedResources=utils$2.listActiveCachedResources;exports.listActiveResources=utils$2.listActiveResources;exports.listOwnedActiveResources=utils$2.listOwnedActiveResources;exports.listOwnedResources=utils$2.listOwnedResources;exports.listResources=utils$2.listResources;exports.updateActiveResource=utils$2.updateActiveResource;exports.updateResource=utils$2.updateResource;exports.Router=router.Router;exports.router=router.router;exports.route=utils$3.route;exports.createStore=index$6.createStore;exports.useStore=index$6.useStore;exports.bootHttpTestingServer=bootTesting.bootHttpTestingServer;exports.bootTesting=bootTesting.bootTesting;exports.terminateTesting=bootTesting.terminateTesting;exports.httpServerTest=createHttpTestApplication.httpServerTest;exports.terminateHttpServerTest=createHttpTestApplication.terminateHttpServerTest;exports.HttpResponseOutputTest=httpResponseOutputTest.HttpResponseOutputTest;exports.appLog=appLog.appLog;exports.dateOutput=dateOutput.dateOutput;exports.environment=environment.environment;exports.setEnvironment=environment.setEnvironment;exports.getLocalized=getLocalized.getLocalized;exports.appPath=paths.appPath;exports.cachePath=paths.cachePath;exports.configPath=paths.configPath;exports.consolePath=paths.consolePath;exports.publicPath=paths.publicPath;exports.rootPath=paths.rootPath;exports.sanitizePath=paths.sanitizePath;exports.srcPath=paths.srcPath;exports.storagePath=paths.storagePath;exports.tempPath=paths.tempPath;exports.uploadsPath=paths.uploadsPath;exports.warlockPath=paths.warlockPath;exports.promiseAllObject=promiseAllObject.promiseAllObject;exports.Queue=queue.Queue;exports.sleep=sleep.sleep;exports.sluggable=sluggable$1.sluggable;exports.toJson=toJson.toJson;exports.assetsUrl=urls.assetsUrl;exports.publicUrl=urls.publicUrl;exports.setBaseUrl=urls.setBaseUrl;exports.uploadsUrl=urls.uploadsUrl;exports.url=urls.url;exports.ArrayRule=array.ArrayRule;exports.ArrayOfRule=arrayOf.ArrayOfRule;exports.BooleanRule=boolean.BooleanRule;exports.ConfirmedRule=confirmed.ConfirmedRule;exports.DateRule=date.DateRule;exports.EgyptianPhoneNumberRule=egyptionPhoneNumber.EgyptianPhoneNumberRule;exports.EmailRule=email.EmailRule;exports.ExistsRule=exists.ExistsRule;exports.FileRule=file$1.FileRule;exports.FloatRule=float.FloatRule;exports.ImageRule=image$1.ImageRule;exports.InRule=_in.InRule;exports.IntRule=int.IntRule;exports.LengthRule=length.LengthRule;exports.LocalizedRule=localized.LocalizedRule;exports.MaxRule=max.MaxRule;exports.MaxLengthRule=maxLength.MaxLengthRule;exports.MinRule=min.MinRule;exports.MinLengthRule=minLength.MinLengthRule;exports.MissingIfRule=missingIf.MissingIfRule;exports.NumberRule=number.NumberRule;exports.ObjectRule=object.ObjectRule;exports.PatternRule=pattern.PatternRule;exports.RequiredRule=required.RequiredRule;exports.RequiredIfRule=requiredIf.RequiredIfRule;exports.RequiredIfEmptyRule=requiredIfEmpty.RequiredIfEmptyRule;exports.RequiredWithRule=requiredWith.RequiredWithRule;exports.RequiredWithAllRule=requiredWithAll.RequiredWithAllRule;exports.Rule=rule.Rule;exports.ScalarRule=scalar.ScalarRule;exports.StringRule=string.StringRule;exports.StringifyRule=stringify.StringifyRule;exports.UniqueRule=unique.UniqueRule;exports.UploadableRule=uploadable$1.UploadableRule;exports.UrlRule=url.UrlRule;exports.RulesList=rulesList.RulesList;exports.getRuleHandler=utils$4.getRuleHandler;exports.getValidationSchema=utils$4.getValidationSchema;exports.AnyValidator=schema.AnyValidator;exports.ArrayValidator=schema.ArrayValidator;exports.BaseValidator=schema.BaseValidator;exports.BooleanValidator=schema.BooleanValidator;exports.DateValidator=schema.DateValidator;exports.FileValidator=schema.FileValidator;exports.FloatValidator=schema.FloatValidator;exports.IntValidator=schema.IntValidator;exports.ObjectValidator=schema.ObjectValidator;exports.ScalarValidator=schema.ScalarValidator;exports.StringValidator=schema.StringValidator;exports.v=schema.v;exports.validate=schema.validate;exports.validateAll=validateAll.validateAll;exports.ArraySchema=validationSchema.ArraySchema;exports.ValidationSchema=validationSchema.ValidationSchema;exports.Validator=validator.Validator;exports.validatorEvents=validatorEvents.validatorEvents;exports.getAWSConfig=getAwsConfigurations.getAWSConfig;exports.getAWSConfigurations=getAwsConfigurations.getAWSConfigurations;exports.seed=seeder.seed;exports.startSeeding=seeder.startSeeding;exports.startServerPlugin=plugins.startServerPlugin;exports.executeTsFile=executeTsFile.executeTsFile;exports.compressImageWhileUploading=compressUploadedFile.compressImageWhileUploading;exports.compressUploadingFile=compressUploadedFile.compressUploadingFile;exports.removeFromAWSBucket=removeFromAws.removeFromAWSBucket;exports.syncFilesWithAWS=syncWithAws.syncFilesWithAWS;exports.uploadFileToAWS=uploadToAws.uploadFileToAWS;exports.uploadFileToAWSInBackground=uploadToAws.uploadFileToAWSInBackground;exports.Postman=postmanGenerator.Postman;exports.getJsonValidationSchema=postmanGenerator.getJsonValidationSchema;exports.namedMethodRoute=postmanGenerator.namedMethodRoute;exports.parseValidationSchema=postmanGenerator.parseValidationSchema;exports.renderGetMethodRoute=postmanGenerator.renderGetMethodRoute;exports.ReactPlugin=plugin.ReactPlugin;exports.useReact=plugin.useReact;//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-uploaded-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/uploads/controllers/get-uploaded-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"get-uploaded-file.d.ts","sourceRoot":"","sources":["../../../../src/modules/uploads/controllers/get-uploaded-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiFvD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,qBAwDzE"}
|
|
@@ -1,54 +1,92 @@
|
|
|
1
|
-
'use strict';var config=require('@mongez/config'),encryption=require('@mongez/encryption'),fs=require('@mongez/fs'),path=require('path'),image=require('../../../image/image.js');require('@warlock.js/logger'),require('../../../utils/date-output.js'),require('../../../http/middleware/inject-request-context.js');var paths=require('../../../utils/paths.js');require('@mongez/slug'),require('@mongez/supportive-is'),require('@mongez/reinforcements');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var config__default=/*#__PURE__*/_interopDefault(config);var path__default=/*#__PURE__*/_interopDefault(path);//
|
|
1
|
+
'use strict';var config=require('@mongez/config'),encryption=require('@mongez/encryption'),fs=require('@mongez/fs'),path=require('path'),image=require('../../../image/image.js');require('@warlock.js/logger'),require('../../../utils/date-output.js'),require('../../../http/middleware/inject-request-context.js');var paths=require('../../../utils/paths.js');require('@mongez/slug'),require('@mongez/supportive-is'),require('@mongez/reinforcements');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var config__default=/*#__PURE__*/_interopDefault(config);var path__default=/*#__PURE__*/_interopDefault(path);// Maximum dimensions to prevent memory issues
|
|
2
|
+
const MAX_DIMENSIONS = {
|
|
3
|
+
width: 4096,
|
|
4
|
+
height: 4096,
|
|
5
|
+
};
|
|
6
|
+
// Cache time in seconds (default is 1 year)
|
|
7
|
+
const DEFAULT_CACHE_TIME = 31536000;
|
|
8
|
+
/**
|
|
9
|
+
* Set cache headers for the response
|
|
10
|
+
*/
|
|
11
|
+
function setCacheHeaders(response, cacheTime) {
|
|
12
|
+
response.header("Cache-Control", `public, max-age=${cacheTime}`);
|
|
13
|
+
response.header("Expires", new Date(Date.now() + cacheTime * 1000).toUTCString());
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generate cache key for image options
|
|
17
|
+
*/
|
|
18
|
+
function generateCacheKey(path, imageOptions, format) {
|
|
19
|
+
return encryption.sha1(JSON.stringify({
|
|
20
|
+
imageOptions,
|
|
21
|
+
path,
|
|
22
|
+
format,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Process image with the given options
|
|
27
|
+
*/
|
|
28
|
+
async function processImage(fullPath, cacheFullPath, imageOptions, format, quality) {
|
|
29
|
+
try {
|
|
30
|
+
const image$1 = new image.Image(fullPath);
|
|
31
|
+
// Apply resize if dimensions are provided
|
|
32
|
+
if (imageOptions.width || imageOptions.height) {
|
|
33
|
+
image$1.resize(imageOptions);
|
|
34
|
+
}
|
|
35
|
+
// Apply format if specified
|
|
36
|
+
if (format) {
|
|
37
|
+
image$1.format(format);
|
|
38
|
+
}
|
|
39
|
+
// Apply quality if specified
|
|
40
|
+
if (quality) {
|
|
41
|
+
image$1.quality(quality);
|
|
42
|
+
}
|
|
43
|
+
await image$1.save(cacheFullPath);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error("Error processing image:", error);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get uploaded file with optional image processing
|
|
53
|
+
*/
|
|
2
54
|
async function getUploadedFile(request, response) {
|
|
3
55
|
const path = request.input("*");
|
|
4
56
|
const fullPath = paths.uploadsPath(path);
|
|
5
|
-
|
|
6
|
-
if (!(await fs.fileExistsAsync(fullPath))) {
|
|
7
|
-
return response.notFound({
|
|
8
|
-
error: "File not found",
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
// cache the file for 1 year
|
|
12
|
-
response.header("Cache-Control", `public, max-age=${cacheTime}`);
|
|
13
|
-
// set expires header to 1 year
|
|
14
|
-
response.header("Expires", new Date(Date.now() + cacheTime * 1000).toUTCString());
|
|
57
|
+
// Get image processing parameters
|
|
15
58
|
const height = request.int("h");
|
|
16
59
|
const width = request.int("w");
|
|
17
60
|
const quality = request.int("q", 100);
|
|
18
61
|
const format = request.input("f");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
console.log("Error", error);
|
|
50
|
-
return response.sendFile(fullPath);
|
|
51
|
-
}
|
|
62
|
+
// Set cache headers
|
|
63
|
+
const cacheTime = config__default.default.get("uploads.cacheTime", DEFAULT_CACHE_TIME);
|
|
64
|
+
setCacheHeaders(response, cacheTime);
|
|
65
|
+
// If no image processing is needed, return the original file
|
|
66
|
+
// Fastify will handle 404 if file doesn't exist
|
|
67
|
+
if (!height && !width && !quality && !format) {
|
|
68
|
+
return response.sendFile(fullPath);
|
|
69
|
+
}
|
|
70
|
+
// Apply dimension limits
|
|
71
|
+
const imageOptions = {
|
|
72
|
+
height: height ? Math.min(height, MAX_DIMENSIONS.height) : undefined,
|
|
73
|
+
width: width ? Math.min(width, MAX_DIMENSIONS.width) : undefined,
|
|
74
|
+
quality,
|
|
75
|
+
};
|
|
76
|
+
// Generate cache key and path
|
|
77
|
+
const fileCachePathKey = generateCacheKey(path, imageOptions, format);
|
|
78
|
+
const cacheFullPath = paths.cachePath(`images/${fileCachePathKey}${path__default.default.extname(path)}`);
|
|
79
|
+
// Set content disposition for inline display
|
|
80
|
+
response.header("Content-Disposition", "inline");
|
|
81
|
+
// First check if cached file exists - this is faster than checking original file
|
|
82
|
+
if (await fs.fileExistsAsync(cacheFullPath)) {
|
|
83
|
+
return response.sendFile(cacheFullPath);
|
|
84
|
+
}
|
|
85
|
+
// Process the image - Fastify will handle 404 if original file doesn't exist
|
|
86
|
+
const success = await processImage(fullPath, cacheFullPath, imageOptions, format, quality);
|
|
87
|
+
// Return processed file if successful, otherwise return original
|
|
88
|
+
if (success) {
|
|
89
|
+
return response.sendFile(cacheFullPath);
|
|
52
90
|
}
|
|
53
91
|
return response.sendFile(fullPath);
|
|
54
92
|
}exports.getUploadedFile=getUploadedFile;//# sourceMappingURL=get-uploaded-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-uploaded-file.js","sources":["../../../../src/modules/uploads/controllers/get-uploaded-file.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"get-uploaded-file.js","sources":["../../../../src/modules/uploads/controllers/get-uploaded-file.ts"],"sourcesContent":[null],"names":["sha1","image","Image","uploadsPath","config","cachePath","systemPath","fileExistsAsync"],"mappings":"8mBASA;AACA,MAAM,cAAc,GAAG;AACrB,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,MAAM,EAAE,IAAI;CACb,CAAC;AAKF;AACA,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC;;AAEG;AACH,SAAS,eAAe,CAAC,QAAkB,EAAE,SAAiB,EAAA;IAC5D,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,CAAmB,gBAAA,EAAA,SAAS,CAAE,CAAA,CAAC,CAAC;IACjE,QAAQ,CAAC,MAAM,CACb,SAAS,EACT,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CACtD,CAAC;AACJ,CAAC;AAED;;AAEG;AACH,SAAS,gBAAgB,CACvB,IAAY,EACZ,YAAiB,EACjB,MAAoB,EAAA;AAEpB,IAAA,OAAOA,eAAI,CACT,IAAI,CAAC,SAAS,CAAC;QACb,YAAY;QACZ,IAAI;QACJ,MAAM;AACP,KAAA,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;AAEG;AACH,eAAe,YAAY,CACzB,QAAgB,EAChB,aAAqB,EACrB,YAAiB,EACjB,MAAoB,EACpB,OAAgB,EAAA;IAEhB,IAAI;AACF,QAAA,MAAMC,OAAK,GAAG,IAAIC,WAAK,CAAC,QAAQ,CAAC,CAAC;;AAGlC,QAAA,IAAI,YAAY,CAAC,KAAK,IAAI,YAAY,CAAC,MAAM,EAAE;AAC7C,YAAAD,OAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AAC5B,SAAA;;AAGD,QAAA,IAAI,MAAM,EAAE;AACV,YAAAA,OAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtB,SAAA;;AAG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,CAAC,MAAM,CAAC,GAAG,SAAS;AACpE,QAAA,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,SAAS;QAChE,OAAO;KACR,CAAC;;IAGF,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACtE,IAAA,MAAM,aAAa,GAAGC,eAAS,CAC7B,UAAU,gBAAgB,CAAA,EAAGC,qBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CACxD,CAAC;;AAGF,IAAA,QAAQ,CAAC,MAAM,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;;AAGjD,IAAA,IAAI,MAAMC,kBAAe,CAAC,aAAa,CAAC,EAAE;AACxC,QAAA,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACzC,KAAA;;AAGD,IAAA,MAAM,OAAO,GAAG,MAAM,YAAY,CAChC,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,MAAM,EACN,OAAO,CACR,CAAC;;AAGF,IAAA,IAAI,OAAO,EAAE;AACX,QAAA,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACzC,KAAA;AAED,IAAA,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var compressUploadedFile=require('./compress-uploaded-file.js');require('./delete-file-from-disk.js'),require('@aws-sdk/client-s3'),require('@warlock.js/logger'),require('fs'),require('@mongez/config'),require('../models/upload.js'),require('@mongez/fs')
|
|
1
|
+
'use strict';var compressUploadedFile=require('./compress-uploaded-file.js');require('./delete-file-from-disk.js'),require('@aws-sdk/client-s3'),require('@warlock.js/logger'),require('fs'),require('path'),require('@mongez/config'),require('../models/upload.js'),require('@mongez/fs');compressUploadedFile.compressImageWhileUploading();exports.compressImageWhileUploading=compressUploadedFile.compressImageWhileUploading;exports.compressUploadingFile=compressUploadedFile.compressUploadingFile;//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var config=require('@mongez/config');require('@aws-sdk/client-s3'),require('@warlock.js/logger'),require('fs');var getAwsConfigurations=require('../../../aws/get-aws-configurations.js'),output=require('../../../output/output.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var config__default=/*#__PURE__*/_interopDefault(config);class UploadOutput extends output.Output {
|
|
1
|
+
'use strict';var config=require('@mongez/config');require('@aws-sdk/client-s3'),require('@warlock.js/logger'),require('fs'),require('path');var getAwsConfigurations=require('../../../aws/get-aws-configurations.js'),output=require('../../../output/output.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var config__default=/*#__PURE__*/_interopDefault(config);class UploadOutput extends output.Output {
|
|
2
2
|
/**
|
|
3
3
|
* Disabled keys from being returned in the final output
|
|
4
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-output.js","sources":["../../../../src/modules/uploads/output/upload-output.ts"],"sourcesContent":[null],"names":["Output","getAWSConfig","config"],"mappings":"
|
|
1
|
+
{"version":3,"file":"upload-output.js","sources":["../../../../src/modules/uploads/output/upload-output.ts"],"sourcesContent":[null],"names":["Output","getAWSConfig","config"],"mappings":"6XAKM,MAAO,YAAa,SAAQA,aAAM,CAAA;AACtC;;AAEG;AACO,IAAA,OAAO,YAAY,GAAa,EAAE,CAAC;AAE7C;;AAEG;AACO,IAAA,OAAO,WAAW,GAAa,EAAE,CAAC;AAE5C;;AAEG;AACO,IAAA,MAAM,GAAgB;AAC9B,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,QAAQ,EAAE,QAAQ;AAClB,QAAA,SAAS,EAAE,QAAQ;AACnB,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,GAAG,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;AAC3B,QAAA,EAAE,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;AACtB,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,IAAI,EAAE,QAAQ;KACf,CAAC;AAEF;;AAEG;IACO,QAAQ,GAAG,EAAE,CAAC;AAExB;;AAEG;AACO,IAAA,MAAM,MAAM,GAAA;AACpB,QAAA,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;AAC5B,YAAA,MAAM,UAAU,GAAG,MAAMC,iCAAY,CAAC,YAAY,CAAC,CAAC;AACpD,YAAA,IAAI,UAAU,EAAE;AACd,gBAAA,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACnE,aAAA;AAAM,iBAAA;AACL,gBAAA,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAC3C,aAAA;AACF,SAAA;AAED,QAAA,MAAMC,uBAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAK;;AAExC,SAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACV;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-cli-server.d.ts","sourceRoot":"","sources":["../../src/starters/start-cli-server.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,
|
|
1
|
+
{"version":3,"file":"start-cli-server.d.ts","sourceRoot":"","sources":["../../src/starters/start-cli-server.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,kBA4CnC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
async function startCliServer() {
|
|
3
3
|
const command = process.argv[2];
|
|
4
4
|
await fs.ensureDirectoryAsync(paths.warlockPath());
|
|
5
|
+
fs.ensureDirectoryAsync(paths.storagePath("cache/images"));
|
|
5
6
|
// make a special check for the development command
|
|
6
7
|
if (command === "dev") {
|
|
7
8
|
return startHttpServer.startHttpApp();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-cli-server.js","sources":["../../src/starters/start-cli-server.ts"],"sourcesContent":[null],"names":["ensureDirectoryAsync","warlockPath","startHttpApp","esbuild","srcPath","nativeNodeModulesPlugin","spawn"],"mappings":"8jBAAA;AAQO,eAAe,cAAc,GAAA;IAClC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhC,IAAA,MAAMA,uBAAoB,CAACC,iBAAW,EAAE,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"file":"start-cli-server.js","sources":["../../src/starters/start-cli-server.ts"],"sourcesContent":[null],"names":["ensureDirectoryAsync","warlockPath","storagePath","startHttpApp","esbuild","srcPath","nativeNodeModulesPlugin","spawn"],"mappings":"8jBAAA;AAQO,eAAe,cAAc,GAAA;IAClC,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhC,IAAA,MAAMA,uBAAoB,CAACC,iBAAW,EAAE,CAAC,CAAC;AAE1C,IAAAD,uBAAoB,CAACE,iBAAW,CAAC,cAAc,CAAC,CAAC,CAAC;;IAGlD,IAAI,OAAO,KAAK,KAAK,EAAE;QACrB,OAAOC,4BAAY,EAAE,CAAC;AACvB,KAAA;AAED,IAAA,MAAM,aAAa,GAAGF,iBAAW,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,iDAAO,6BAA0B,GAAC,CAAC;AAEjE,IAAA,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;IAEpC,MAAMG,wBAAO,CAAC,KAAK,CAAC;AAClB,QAAA,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,CAAC,OAAO,CAAC;AACtB,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,QAAQ,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AC;IAC9C,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,OAAO,GAAG,cAAc,GAAG,aAAa,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;CACzB,CAmBA,CAAC"}
|
package/cjs/validator/v/rules.js
CHANGED
|
@@ -263,7 +263,7 @@ const minWordsRule = {
|
|
|
263
263
|
name: "minWords",
|
|
264
264
|
defaultErrorMessage: `The :input must be at least :minWords words`,
|
|
265
265
|
async validate(value, context) {
|
|
266
|
-
if (value
|
|
266
|
+
if (String(value || "").split(" ").length >= this.context.options.minWords) {
|
|
267
267
|
return utils.VALID_RULE;
|
|
268
268
|
}
|
|
269
269
|
return utils.invalidRule(this, context);
|
|
@@ -273,7 +273,7 @@ const maxWordsRule = {
|
|
|
273
273
|
name: "maxWords",
|
|
274
274
|
defaultErrorMessage: `The :input must be at most :maxWords words`,
|
|
275
275
|
async validate(value, context) {
|
|
276
|
-
if (value
|
|
276
|
+
if (String(value || "").split(" ").length <= this.context.options.maxWords) {
|
|
277
277
|
return utils.VALID_RULE;
|
|
278
278
|
}
|
|
279
279
|
return utils.invalidRule(this, context);
|
|
@@ -283,7 +283,7 @@ const wordsRule = {
|
|
|
283
283
|
name: "words",
|
|
284
284
|
defaultErrorMessage: `The :input must be exactly :words words`,
|
|
285
285
|
async validate(value, context) {
|
|
286
|
-
if (value
|
|
286
|
+
if (String(value || "").split(" ").length === this.context.options.words) {
|
|
287
287
|
return utils.VALID_RULE;
|
|
288
288
|
}
|
|
289
289
|
return utils.invalidRule(this, context);
|
|
@@ -293,7 +293,7 @@ const minLengthRule = {
|
|
|
293
293
|
name: "minLength",
|
|
294
294
|
defaultErrorMessage: `The :input must be at least :minLength characters long`,
|
|
295
295
|
async validate(value, context) {
|
|
296
|
-
if (value
|
|
296
|
+
if (String(value || "").length >= this.context.options.minLength) {
|
|
297
297
|
return utils.VALID_RULE;
|
|
298
298
|
}
|
|
299
299
|
return utils.invalidRule(this, context);
|
|
@@ -303,7 +303,7 @@ const maxLengthRule = {
|
|
|
303
303
|
name: "maxLength",
|
|
304
304
|
defaultErrorMessage: `The :input must not exceed :maxLength characters`,
|
|
305
305
|
async validate(value, context) {
|
|
306
|
-
if (value
|
|
306
|
+
if (String(value || "").length <= this.context.options.maxLength) {
|
|
307
307
|
return utils.VALID_RULE;
|
|
308
308
|
}
|
|
309
309
|
return utils.invalidRule(this, context);
|
|
@@ -313,7 +313,7 @@ const lengthRule = {
|
|
|
313
313
|
name: "length",
|
|
314
314
|
defaultErrorMessage: `The :input must be exactly :length characters long`,
|
|
315
315
|
async validate(value, context) {
|
|
316
|
-
if (value
|
|
316
|
+
if (String(value || "").length === this.context.options.length) {
|
|
317
317
|
return utils.VALID_RULE;
|
|
318
318
|
}
|
|
319
319
|
return utils.invalidRule(this, context);
|