@ind-rcg/backend 246.1008.0
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/LICENSE.md +37 -0
- package/README.md +7 -0
- package/bin/libsqliteExtension.dll +0 -0
- package/bin/libsqliteExtension.dylib +0 -0
- package/binding.gyp +21 -0
- package/configuration.template.json +24 -0
- package/log4js.json +11 -0
- package/nativeSrc/PriceEngineWrap.cc +157 -0
- package/nativeSrc/PriceEngineWrap.h +24 -0
- package/nativeSrc/common/DBAccess/SimpleDBConnection.cpp +800 -0
- package/nativeSrc/common/DBAccess/SimpleDBConnection.h +54 -0
- package/nativeSrc/common/Libs/cJSON/CHANGELOG.md +428 -0
- package/nativeSrc/common/Libs/cJSON/LICENSE +20 -0
- package/nativeSrc/common/Libs/cJSON/README.md +571 -0
- package/nativeSrc/common/Libs/cJSON/cJSON.c +3110 -0
- package/nativeSrc/common/Libs/cJSON/cJSON.h +293 -0
- package/nativeSrc/common/Libs/sqlcipher/sqlite3.c +241624 -0
- package/nativeSrc/common/Libs/sqlcipher/sqlite3.h +12836 -0
- package/nativeSrc/common/Libs/sqlcipher/sqlite3ext.h +701 -0
- package/nativeSrc/common/LogAdapter/LogAdapter.cpp +25 -0
- package/nativeSrc/common/LogAdapter/LogAdapter.h +20 -0
- package/nativeSrc/common/PriceEngine/PriceEngine.cpp +251 -0
- package/nativeSrc/common/PriceEngine/PriceEngine.h +67 -0
- package/nativeSrc/common/Utils/StringFormat.cpp +905 -0
- package/nativeSrc/common/Utils/StringFormat.h +116 -0
- package/nativeSrc/common/Utils/miniz/timer.cpp +165 -0
- package/nativeSrc/common/Utils/miniz/timer.h +40 -0
- package/nativeSrc/common/stdngm.h +92 -0
- package/nativeSrc/nativeWrapper.cc +15 -0
- package/package.json +70 -0
- package/src/argsParser.js +73 -0
- package/src/bootstrap.js +156 -0
- package/src/fsHelper.js +36 -0
- package/src/globalConfig.js +23 -0
- package/src/local.js +546 -0
- package/src/server.js +64 -0
- package/src/sfAttachmentsHandler.js +283 -0
- package/src/utils.js +91 -0
- package/src/zipHandler.js +153 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
//
|
|
2
|
+
// StringFormat.h
|
|
3
|
+
// NGM
|
|
4
|
+
//
|
|
5
|
+
// Created by RGS on 07/03/13.
|
|
6
|
+
/*
|
|
7
|
+
* FILE_HEADER
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Comment in to enable test of safe_ functions in StringFormat.cpp
|
|
11
|
+
//
|
|
12
|
+
//#define SAFE_TEST
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
#ifndef __NGM__StringFormat__
|
|
16
|
+
#define __NGM__StringFormat__
|
|
17
|
+
|
|
18
|
+
#define SAFE_DEFAULT_STRLEN 2147483647
|
|
19
|
+
#define SAFE_DEFAULT_BUFSIZE 512
|
|
20
|
+
|
|
21
|
+
#include "../stdngm.h"
|
|
22
|
+
|
|
23
|
+
char *trim_right( char *s );
|
|
24
|
+
char *trim_left( char *s );
|
|
25
|
+
char *trim( char *s );
|
|
26
|
+
|
|
27
|
+
void *safe_malloc(size_t size);
|
|
28
|
+
void safe_srand();
|
|
29
|
+
|
|
30
|
+
std::string safe_trim(const char *s);
|
|
31
|
+
std::string safe_string(const char *s);
|
|
32
|
+
|
|
33
|
+
FILE *safe_fopen(const char *filename, const char *mode);
|
|
34
|
+
int safe_stat(const char *filename, struct stat *buf);
|
|
35
|
+
|
|
36
|
+
const char *strreplace(char *s, char search, char replace );
|
|
37
|
+
|
|
38
|
+
std::string to_string( double d );
|
|
39
|
+
std::string to_string( size_t u);
|
|
40
|
+
std::string to_string( int i);
|
|
41
|
+
std::string to_string( INT64 ld );
|
|
42
|
+
|
|
43
|
+
std::string to_lower(const char *s);
|
|
44
|
+
std::string to_upper(const char *s);
|
|
45
|
+
|
|
46
|
+
bool to_boolean(const char *s);
|
|
47
|
+
|
|
48
|
+
std::string to_current_date();
|
|
49
|
+
std::string to_current_date_time();
|
|
50
|
+
std::string to_current_date_time_msecs();
|
|
51
|
+
size_t formatted_date_time(char *s, size_t maxsize, const char *format, const struct tm *t);
|
|
52
|
+
|
|
53
|
+
std::string StringFormat(const char *fmt, ...);
|
|
54
|
+
std::string StringFormat(int size, const char *fmt, ...);
|
|
55
|
+
|
|
56
|
+
void StringReplace(std::string& subject, const std::string& search, const std::string& replace);
|
|
57
|
+
void StringReplace(std::string& subject, const char *search, const char *replace);
|
|
58
|
+
|
|
59
|
+
void StringEscapeResponseXML(std::string& subject);
|
|
60
|
+
void StringEscapeXML(std::string& subject);
|
|
61
|
+
void StringDoubleEscapeXML(std::string& subject);
|
|
62
|
+
void StringEscapeJSON(std::string& subject);
|
|
63
|
+
|
|
64
|
+
std::vector<std::string> StringSplit(const std::string &s, char delim);
|
|
65
|
+
std::vector<std::string> StringSplit(const char *s, const char delim);
|
|
66
|
+
|
|
67
|
+
bool starts_with(const std::string& s1, const std::string& s2);
|
|
68
|
+
bool ends_with(const std::string& s1, const std::string& s2);
|
|
69
|
+
bool contains(const std::string& s1, const std::string& s2);
|
|
70
|
+
|
|
71
|
+
std::string ConvertWStringToString(const std::wstring& s);
|
|
72
|
+
std::string escapeJsonString(const std::string& inputStr);
|
|
73
|
+
|
|
74
|
+
class StringList {
|
|
75
|
+
private:
|
|
76
|
+
std::vector<std::string> lst; //no pointer
|
|
77
|
+
|
|
78
|
+
protected:
|
|
79
|
+
void _buildJSONString(std::string & ret, const char *s, bool comma);
|
|
80
|
+
|
|
81
|
+
public:
|
|
82
|
+
StringList() {}
|
|
83
|
+
virtual ~StringList() { clear(); }
|
|
84
|
+
|
|
85
|
+
size_t size() { return lst.size(); }
|
|
86
|
+
std::string & operator[](int i) { return lst[i]; }
|
|
87
|
+
|
|
88
|
+
void add(std::string & s) { lst.push_back(s); } //copy operator
|
|
89
|
+
void add(const char * s) { lst.push_back(s); } //new
|
|
90
|
+
|
|
91
|
+
void clear() { lst.clear(); }
|
|
92
|
+
|
|
93
|
+
void save(const char * file_name, const char * eol_mark = "\r\n");
|
|
94
|
+
|
|
95
|
+
std::string toJSON();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
typedef StringList * pStringList;
|
|
99
|
+
|
|
100
|
+
void * safe_memcpy(void *dst, const void *src, size_t count);
|
|
101
|
+
const void * safe_memchr(const void * ptr, int ch, size_t count);
|
|
102
|
+
|
|
103
|
+
size_t safe_strlen(const char *str);
|
|
104
|
+
size_t safe_strnlen(const char *str, size_t count);
|
|
105
|
+
char * safe_strcat(char * dst, const char * src);
|
|
106
|
+
char * safe_strcpy(char * dst, const char * src);
|
|
107
|
+
char * safe_strncpy(char * dst, const char * src, size_t count);
|
|
108
|
+
|
|
109
|
+
int safe_snprintf(char * str, size_t count, const char * fmt, ...);
|
|
110
|
+
int safe_vsnprintf(char * str, size_t count, const char * fmt, va_list arg);
|
|
111
|
+
|
|
112
|
+
#ifdef SAFE_TEST
|
|
113
|
+
void safe_test(const char *operating_system, const char *output_path_only_no_delimiter_no_filename, ...);
|
|
114
|
+
#endif
|
|
115
|
+
|
|
116
|
+
#endif /* defined(__NGM__StringFormat__) */
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// File: timer.cpp - Simple high-precision timer class. Supports Win32, X360, and POSIX/Linux
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <stdio.h>
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
#include <time.h>
|
|
6
|
+
|
|
7
|
+
#include "timer.h"
|
|
8
|
+
|
|
9
|
+
#if defined(WIN32)
|
|
10
|
+
#include <windows.h>
|
|
11
|
+
#elif defined(_XBOX)
|
|
12
|
+
#include <xtl.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
#ifdef WINAPI_FAMILY //WIN_PHONE
|
|
16
|
+
#include <time.h>
|
|
17
|
+
#include <windows.h>
|
|
18
|
+
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
|
|
19
|
+
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
|
|
20
|
+
#else
|
|
21
|
+
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#else //iOS
|
|
25
|
+
#include <sys/time.h>
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
unsigned long long timer::g_init_ticks;
|
|
29
|
+
unsigned long long timer::g_freq;
|
|
30
|
+
double timer::g_inv_freq;
|
|
31
|
+
|
|
32
|
+
#if defined(WIN32) || defined(_XBOX) || defined(WINAPI_FAMILY)
|
|
33
|
+
inline void query_counter(timer_ticks *pTicks)
|
|
34
|
+
{
|
|
35
|
+
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(pTicks));
|
|
36
|
+
}
|
|
37
|
+
inline void query_counter_frequency(timer_ticks *pTicks)
|
|
38
|
+
{
|
|
39
|
+
QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER*>(pTicks));
|
|
40
|
+
}
|
|
41
|
+
#elif defined(__GNUC__)
|
|
42
|
+
#include <sys/time.h>
|
|
43
|
+
inline void query_counter(timer_ticks *pTicks)
|
|
44
|
+
{
|
|
45
|
+
struct timeval cur_time;
|
|
46
|
+
gettimeofday(&cur_time, NULL);
|
|
47
|
+
*pTicks = static_cast<unsigned long long>(cur_time.tv_sec)*1000000ULL + static_cast<unsigned long long>(cur_time.tv_usec);
|
|
48
|
+
}
|
|
49
|
+
inline void query_counter_frequency(timer_ticks *pTicks)
|
|
50
|
+
{
|
|
51
|
+
*pTicks = 1000000;
|
|
52
|
+
}
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
timer::timer() :
|
|
56
|
+
m_start_time(0),
|
|
57
|
+
m_stop_time(0),
|
|
58
|
+
m_started(false),
|
|
59
|
+
m_stopped(false)
|
|
60
|
+
{
|
|
61
|
+
if (!g_inv_freq)
|
|
62
|
+
init();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
timer::timer(timer_ticks start_ticks)
|
|
66
|
+
{
|
|
67
|
+
if (!g_inv_freq)
|
|
68
|
+
init();
|
|
69
|
+
|
|
70
|
+
m_start_time = start_ticks;
|
|
71
|
+
|
|
72
|
+
m_started = true;
|
|
73
|
+
m_stopped = false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void timer::start(timer_ticks start_ticks)
|
|
77
|
+
{
|
|
78
|
+
m_start_time = start_ticks;
|
|
79
|
+
|
|
80
|
+
m_started = true;
|
|
81
|
+
m_stopped = false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void timer::start()
|
|
85
|
+
{
|
|
86
|
+
query_counter(&m_start_time);
|
|
87
|
+
|
|
88
|
+
m_started = true;
|
|
89
|
+
m_stopped = false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void timer::stop()
|
|
93
|
+
{
|
|
94
|
+
assert(m_started);
|
|
95
|
+
|
|
96
|
+
query_counter(&m_stop_time);
|
|
97
|
+
|
|
98
|
+
m_stopped = true;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
double timer::get_elapsed_secs() const
|
|
102
|
+
{
|
|
103
|
+
assert(m_started);
|
|
104
|
+
if (!m_started)
|
|
105
|
+
return 0;
|
|
106
|
+
|
|
107
|
+
timer_ticks stop_time = m_stop_time;
|
|
108
|
+
if (!m_stopped)
|
|
109
|
+
query_counter(&stop_time);
|
|
110
|
+
|
|
111
|
+
timer_ticks delta = stop_time - m_start_time;
|
|
112
|
+
return delta * g_inv_freq;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
timer_ticks timer::get_elapsed_us() const
|
|
116
|
+
{
|
|
117
|
+
assert(m_started);
|
|
118
|
+
if (!m_started)
|
|
119
|
+
return 0;
|
|
120
|
+
|
|
121
|
+
timer_ticks stop_time = m_stop_time;
|
|
122
|
+
if (!m_stopped)
|
|
123
|
+
query_counter(&stop_time);
|
|
124
|
+
|
|
125
|
+
timer_ticks delta = stop_time - m_start_time;
|
|
126
|
+
return (delta * 1000000ULL + (g_freq >> 1U)) / g_freq;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
void timer::init()
|
|
130
|
+
{
|
|
131
|
+
if (!g_inv_freq)
|
|
132
|
+
{
|
|
133
|
+
query_counter_frequency(&g_freq);
|
|
134
|
+
g_inv_freq = 1.0f / g_freq;
|
|
135
|
+
|
|
136
|
+
query_counter(&g_init_ticks);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
timer_ticks timer::get_init_ticks()
|
|
141
|
+
{
|
|
142
|
+
if (!g_inv_freq)
|
|
143
|
+
init();
|
|
144
|
+
|
|
145
|
+
return g_init_ticks;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
timer_ticks timer::get_ticks()
|
|
149
|
+
{
|
|
150
|
+
if (!g_inv_freq)
|
|
151
|
+
init();
|
|
152
|
+
|
|
153
|
+
timer_ticks ticks;
|
|
154
|
+
query_counter(&ticks);
|
|
155
|
+
return ticks - g_init_ticks;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
double timer::ticks_to_secs(timer_ticks ticks)
|
|
159
|
+
{
|
|
160
|
+
if (!g_inv_freq)
|
|
161
|
+
init();
|
|
162
|
+
|
|
163
|
+
return ticks * g_inv_freq;
|
|
164
|
+
}
|
|
165
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// File: timer.h
|
|
2
|
+
#pragma once
|
|
3
|
+
|
|
4
|
+
typedef unsigned long long timer_ticks;
|
|
5
|
+
|
|
6
|
+
class timer
|
|
7
|
+
{
|
|
8
|
+
public:
|
|
9
|
+
timer();
|
|
10
|
+
timer(timer_ticks start_ticks);
|
|
11
|
+
|
|
12
|
+
void start();
|
|
13
|
+
void start(timer_ticks start_ticks);
|
|
14
|
+
|
|
15
|
+
void stop();
|
|
16
|
+
|
|
17
|
+
double get_elapsed_secs() const;
|
|
18
|
+
inline double get_elapsed_ms() const { return get_elapsed_secs() * 1000.0f; }
|
|
19
|
+
timer_ticks get_elapsed_us() const;
|
|
20
|
+
|
|
21
|
+
static void init();
|
|
22
|
+
static inline timer_ticks get_ticks_per_sec() { return g_freq; }
|
|
23
|
+
static timer_ticks get_init_ticks();
|
|
24
|
+
static timer_ticks get_ticks();
|
|
25
|
+
static double ticks_to_secs(timer_ticks ticks);
|
|
26
|
+
static inline double ticks_to_ms(timer_ticks ticks) { return ticks_to_secs(ticks) * 1000.0f; }
|
|
27
|
+
static inline double get_secs() { return ticks_to_secs(get_ticks()); }
|
|
28
|
+
static inline double get_ms() { return ticks_to_ms(get_ticks()); }
|
|
29
|
+
|
|
30
|
+
private:
|
|
31
|
+
static timer_ticks g_init_ticks;
|
|
32
|
+
static timer_ticks g_freq;
|
|
33
|
+
static double g_inv_freq;
|
|
34
|
+
|
|
35
|
+
timer_ticks m_start_time;
|
|
36
|
+
timer_ticks m_stop_time;
|
|
37
|
+
|
|
38
|
+
bool m_started : 1;
|
|
39
|
+
bool m_stopped : 1;
|
|
40
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// standard include
|
|
2
|
+
// NGM
|
|
3
|
+
|
|
4
|
+
#ifndef __NGM__stdngm__
|
|
5
|
+
#define __NGM__stdngm__
|
|
6
|
+
|
|
7
|
+
// C include
|
|
8
|
+
#include <stdio.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
#include <stdarg.h>
|
|
11
|
+
#ifndef IOS
|
|
12
|
+
#include <cstdlib>
|
|
13
|
+
#include <cctype>
|
|
14
|
+
#endif
|
|
15
|
+
#include <math.h>
|
|
16
|
+
#include <ctype.h>
|
|
17
|
+
#include <string.h>
|
|
18
|
+
#include <time.h>
|
|
19
|
+
#include <sys/stat.h>
|
|
20
|
+
#ifndef WIN32
|
|
21
|
+
#ifndef WINAPI_FAMILY
|
|
22
|
+
#include <sys/time.h>
|
|
23
|
+
#endif
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#if defined(WIN32) || defined(WINAPI_FAMILY)
|
|
27
|
+
#include "io.h"
|
|
28
|
+
#include <direct.h>
|
|
29
|
+
#ifndef S_ISDIR
|
|
30
|
+
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
|
31
|
+
#endif
|
|
32
|
+
#ifndef S_ISREG
|
|
33
|
+
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
|
34
|
+
#endif
|
|
35
|
+
//#define snprintf sprintf_s
|
|
36
|
+
#else
|
|
37
|
+
#include <unistd.h>
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#if defined(WIN32) || defined(WINAPI_FAMILY)
|
|
41
|
+
//#include "Win32/dirent/dirent.h"
|
|
42
|
+
#else
|
|
43
|
+
#include <dirent.h>
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
// STD C++
|
|
47
|
+
#ifdef __cplusplus
|
|
48
|
+
//#include <exception>
|
|
49
|
+
#include <iostream>
|
|
50
|
+
#include <string>
|
|
51
|
+
#include <cstring>
|
|
52
|
+
#include <list>
|
|
53
|
+
#include <algorithm>
|
|
54
|
+
#include <vector>
|
|
55
|
+
#include <locale>
|
|
56
|
+
#include <map>
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#ifdef WINAPI_FAMILY //WIN_PHONE
|
|
60
|
+
#include <stdlib.h>
|
|
61
|
+
#include <windows.h>
|
|
62
|
+
#include <chrono>
|
|
63
|
+
#include <thread>
|
|
64
|
+
#define access _access
|
|
65
|
+
#define F_OK 0
|
|
66
|
+
#define unlink _unlink
|
|
67
|
+
#define strdup _strdup
|
|
68
|
+
#define umask _umask
|
|
69
|
+
#define stat _stat
|
|
70
|
+
#define chmod _chmod
|
|
71
|
+
#define usleep(x) std::this_thread::sleep_for(std::chrono::microseconds(x))
|
|
72
|
+
#define Sleep(x) std::this_thread::sleep_for(std::chrono::milliseconds(x))
|
|
73
|
+
#define mkdir(dir,x) _mkdir(dir)
|
|
74
|
+
#define rmdir _rmdir
|
|
75
|
+
#define np_mktemp(x) _mktemp(x)
|
|
76
|
+
#define strcasecmp _stricmp
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#ifndef INT64
|
|
80
|
+
#if defined(WIN32) || defined(WINAPI_FAMILY)
|
|
81
|
+
typedef __int64 INT64;
|
|
82
|
+
typedef unsigned __int64 UINT64;
|
|
83
|
+
#else
|
|
84
|
+
typedef long long int INT64;
|
|
85
|
+
typedef unsigned long long int UINT64;
|
|
86
|
+
#endif
|
|
87
|
+
#endif /*ifndef INT64*/
|
|
88
|
+
|
|
89
|
+
//Crypto - Key length used for encryption and decryption
|
|
90
|
+
#define AES_256 32
|
|
91
|
+
|
|
92
|
+
#endif /* defined(__NGM__stdngm__) */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FILE_HEADER
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include <napi.h>
|
|
6
|
+
#include "PriceEngineWrap.h"
|
|
7
|
+
|
|
8
|
+
namespace cgcloudNative {
|
|
9
|
+
|
|
10
|
+
Napi::Object RegisterModule(Napi::Env env, Napi::Object exports) {
|
|
11
|
+
return PriceEngineWrap::Init(env, exports);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
NODE_API_MODULE(NODE_GYP_MODULE_NAME, RegisterModule)
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ind-rcg/backend",
|
|
3
|
+
"version": "246.1008.0",
|
|
4
|
+
"author": "Salesforce",
|
|
5
|
+
"license": "BSD-3-Clause",
|
|
6
|
+
"description": "This backend module is required to simulate the application of Consumer Goods Mobile Application. This modules can only be used in modeler-sfdx-cli-plugin.",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"bindings": "1.5.0",
|
|
9
|
+
"body-parser": "1.20.1",
|
|
10
|
+
"client-oauth2": "4.3.3",
|
|
11
|
+
"copyfiles": "2.4.1",
|
|
12
|
+
"express": "4.18.2",
|
|
13
|
+
"lodash": "4.17.21",
|
|
14
|
+
"log4js": "6.7.1",
|
|
15
|
+
"md5": "2.3.0",
|
|
16
|
+
"mkdirp": "1.0.4",
|
|
17
|
+
"node-addon-api": "3.2.1",
|
|
18
|
+
"node-fetch": "3.3.0",
|
|
19
|
+
"pako": "2.0.4",
|
|
20
|
+
"rimraf": "3.0.2",
|
|
21
|
+
"sharp": "0.31.0",
|
|
22
|
+
"sqlite3": "5.1.6",
|
|
23
|
+
"sqlite3-transactions": "0.0.5",
|
|
24
|
+
"ssl-root-cas": "1.3.1",
|
|
25
|
+
"yargs": "17.5.1"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "mocha --recursive --timeout 2000 --retries 3",
|
|
29
|
+
"lint": "npx eslint *.js src/*.js src/**/*.js test/*.js test/**/*.js",
|
|
30
|
+
"start": "node src/server.js",
|
|
31
|
+
"nativeConfigure": "node-gyp configure",
|
|
32
|
+
"nativeBuild": "node-gyp build",
|
|
33
|
+
"nativeConfigureDev": "node-gyp configure --debug",
|
|
34
|
+
"nativeBuildDev": "node-gyp build --debug",
|
|
35
|
+
"prepareDirectory": "npm run clean && npm run createDirStructure && npm run copyFWFiles",
|
|
36
|
+
"build": "npm run nativeConfigure && npm run nativeBuild",
|
|
37
|
+
"buildDev": "npm run nativeConfigureDev && npm run nativeBuildDev",
|
|
38
|
+
"clean": "rimraf build && rimraf nativeSrc/common/PriceEngine && rimraf nativeSrc/common/Utils && rimraf nativeSrc/common/DBAccess && rimraf nativeSrc/common/stdngm.h && rimraf src/Attachments && rimraf src/ThemeImages",
|
|
39
|
+
"createDirStructure": "mkdirp nativeSrc/common/PriceEngine && mkdirp nativeSrc/common/Utils/miniz && mkdirp nativeSrc/common/DBAccess",
|
|
40
|
+
"copyFWFiles": "copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/DBAccess/SimpleDBConnection* nativeSrc/common/DBAccess/ && copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/PriceEngine/* nativeSrc/common/PriceEngine/ && copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/stdngm.h nativeSrc/common/ && copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/Utils/StringFormat* nativeSrc/common/Utils/ && copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/Utils/miniz/timer* nativeSrc/common/Utils/miniz/",
|
|
41
|
+
"prepublishOnly": "npm run prepareDirectory",
|
|
42
|
+
"pre": "npm run prepareDirectoryX",
|
|
43
|
+
"prepareDirectoryX": "npm run cleanX && npm run createDirStructureX && npm run copyFWFilesX",
|
|
44
|
+
"cleanX": "npx rimraf build && npx rimraf nativeSrc/common/PriceEngine && npx rimraf nativeSrc/common/Utils && npx rimraf nativeSrc/common/DBAccess && npx rimraf nativeSrc/common/stdngm.h && npx rimraf src/Attachments && npx rimraf src/ThemeImages",
|
|
45
|
+
"createDirStructureX": "npx mkdirp nativeSrc/common/PriceEngine && npx mkdirp nativeSrc/common/Utils/miniz && npx mkdirp nativeSrc/common/DBAccess",
|
|
46
|
+
"copyFWFilesX": "npx copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/DBAccess/SimpleDBConnection* nativeSrc/common/DBAccess/ && npx copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/PriceEngine/* nativeSrc/common/PriceEngine/ && npx copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/stdngm.h nativeSrc/common/ && npx copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/Utils/StringFormat* nativeSrc/common/Utils/ && npx copyfiles -f ../local_plugins/com-salesforce-industries-offlineapp-plugins-dba/src/common/Utils/miniz/timer* nativeSrc/common/Utils/miniz/",
|
|
47
|
+
"postinstall": "npm run build",
|
|
48
|
+
"coverage": "nyc npm run test",
|
|
49
|
+
"post": "npm run setupSqliteExtensionX",
|
|
50
|
+
"prepack": "npm run setupSqliteExtensionX",
|
|
51
|
+
"setupSqliteExtensionX": "npx rimraf bin && npx mkdirp bin && npx copyfiles -f node_modules/@ind-rcg/com-salesforce-rcg-sqlite-extensions/windows/* bin/ && npx copyfiles -f node_modules/@ind-rcg/com-salesforce-rcg-sqlite-extensions/macos/* bin/"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"nativeSrc/**/*",
|
|
55
|
+
"src/**/*",
|
|
56
|
+
"bin/**/*",
|
|
57
|
+
"binding.gyp",
|
|
58
|
+
"configuration.template.json",
|
|
59
|
+
"log4js.json"
|
|
60
|
+
],
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@ind-rcg/com-salesforce-rcg-sqlite-extensions": "^0.14.0",
|
|
63
|
+
"chai": "4.3.4",
|
|
64
|
+
"eslint": "8.40.0",
|
|
65
|
+
"jszip": "3.10.1",
|
|
66
|
+
"mocha": "9.1.3",
|
|
67
|
+
"nyc": "15.1.0",
|
|
68
|
+
"supertest": "6.2.4"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* FILE_HEADER
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const yargs = require('yargs/yargs');
|
|
10
|
+
const { hideBin } = require('yargs/helpers');
|
|
11
|
+
|
|
12
|
+
module.exports.run = (processArgv) => {
|
|
13
|
+
|
|
14
|
+
let success = false;
|
|
15
|
+
let settings = null;
|
|
16
|
+
let errorMessage = null;
|
|
17
|
+
|
|
18
|
+
const argv = yargs(hideBin(processArgv))
|
|
19
|
+
.options({
|
|
20
|
+
'log': {
|
|
21
|
+
alias: 'loggingConfig',
|
|
22
|
+
default: './log4js.json',
|
|
23
|
+
describe: 'logging configuration',
|
|
24
|
+
type: 'string'
|
|
25
|
+
},
|
|
26
|
+
'cfg': {
|
|
27
|
+
alias: 'webServerConfig',
|
|
28
|
+
default: './configuration.json',
|
|
29
|
+
describe: 'web server configuration',
|
|
30
|
+
type: 'string'
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
.argv;
|
|
34
|
+
|
|
35
|
+
if (argv) {
|
|
36
|
+
|
|
37
|
+
success = true;
|
|
38
|
+
|
|
39
|
+
// init settings
|
|
40
|
+
settings = {
|
|
41
|
+
loggingConfig: argv.loggingConfig,
|
|
42
|
+
webServerConfig: argv.webServerConfig
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// validate settings
|
|
46
|
+
if (settings.loggingConfig) {
|
|
47
|
+
if (!fs.existsSync(settings.loggingConfig)) {
|
|
48
|
+
success = false;
|
|
49
|
+
errorMessage = `logging configuration file not found (${settings.loggingConfig})`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (settings.webServerConfig) {
|
|
54
|
+
if (!fs.existsSync(settings.webServerConfig)) {
|
|
55
|
+
success = false;
|
|
56
|
+
errorMessage = `web server configuration file not found (${settings.webServerConfig})`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (success) {
|
|
63
|
+
return {
|
|
64
|
+
success : true,
|
|
65
|
+
data : settings
|
|
66
|
+
};
|
|
67
|
+
} else {
|
|
68
|
+
return {
|
|
69
|
+
success : false,
|
|
70
|
+
error : errorMessage
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|