New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

smartclient-enterprise

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartclient-enterprise - npm Package Compare versions

Comparing version 0.6.1 to 0.8.2

21

Const.js

@@ -30,2 +30,4 @@ /*

const path = require("path");
/**

@@ -78,3 +80,3 @@ * Class holds various contants.

static get SMARTCLIENT_CONF() {
return "config.json";
return path.join("..", "..", "isc-config.json");
}

@@ -169,3 +171,3 @@

static get RELEASE_MODULES() {
return "system/modules";
return path.join("system", "modules");
}

@@ -179,3 +181,3 @@

static get DEBUG_MODULES() {
return "system/modules-debug";
return path.join("system", "modules-debug");
}

@@ -284,2 +286,10 @@

/**
* Legal npm module command line options.
*/
static get CONFIG_OPTIONS() {
return ["location", "branch", "date", "runtime", "reference", "skins", "yes",
"username", "password", "analytics", "rtm"];
}
/**
* List of SmartClient modules to import. Doesn't include optional modules that are

@@ -291,4 +301,5 @@ * licensed separately from the SmartClient edition (in the case of Power/Enterprise).

static get SMARTCLIENT_MODULES() {
return ["Core", "Foundation", "Containers", "Grids", "Forms",
"RichTextEditor", "DataBinding", "Calendar", "Drawing", "Charts", "Tools"];
return ["Core", "Foundation", "Containers", "Grids", "Forms", "RichTextEditor",
"DataBinding", "Calendar", "PluginBridges", "Drawing", "Charts", "Workflow",
"Tools"];
}

@@ -295,0 +306,0 @@

@@ -34,5 +34,6 @@ {

"uninstall": "node uninstall.js",
"help": "npm run update --showUsage",
"update": "node update.js"
},
"version": "0.6.1"
"version": "0.8.2"
}

@@ -10,37 +10,39 @@ Provides access to

npm install smartclient-enterprise [flags]
npm install smartclient-enterprise [flags]
Update/reconfigure SmartClient runtime(s) (must be run from package directory):
npm run update [flags]
npm run update [flags]
where the supported flags are:
--location=<directory> where to install the SmartClient runtime(s);
default is to place runtime root (isomorphic)
in the parent of the node_modules directory
containing the smartclient-enterprise package
--location=<directory> where to install the SmartClient runtime(s);
default is to place runtime root (isomorphic)
in the dependent module directory
--branch=<number> desired branch (e.g. 11.1); default is release
branch
--branch=<number> desired branch (e.g. 11.1); default is release
branch
--date=<date>|latest desired build date, in format YYYY-MM-DD,
or 'latest'; default is 'latest'
--date=<date>|latest desired build date, in format YYYY-MM-DD,
or 'latest'; default is 'latest'
--runtime=release|debug|both
which runtime(s) to install; default is 'both'
--runtime=release|debug|both
which runtime(s) to install; default is 'both'
--skins[=<boolean>] whether to install all skins or not;
default is to only install Tahoe
--reference[=<boolean>] whether to keep the framework reference directory;
default is to not install it to save disk space
--yes[=<boolean>] assume answer 'yes' to prompts with default
--skins=Tahoe|all|none which skins (if any) to install;
default is to only install Tahoe
--username=<string> username for account on www.smartclient.com
--yes[=<boolean>] assume answer 'yes' to prompts with default
--password=<string> password for account on www.smartclient.com
--username=<string> username for account on www.smartclient.com
--analytics[=<boolean>] install the optional Analytics module
--password=<string> password for account on www.smartclient.com
--rtm[=<boolean>] install the optional RealtimeMessaging module
--analytics[=<boolean>] install the optional Analytics module
--rtm[=<boolean>] install the optional RealtimeMessaging module
After installation, command-line configuration is persisted, so command-line arguments only

@@ -61,11 +63,11 @@ need to be supplied when updating if the desired configuration has changed. If a username

npm install smartclient-enterprise --branch=11.1 --date=2018-12-30
npm install smartclient-enterprise --branch=11.1 --date=2018-12-30
Update to latest nighlty build (run from package directory):
npm run update --date=latest
npm run update --date=latest
Update to SmartClient 12.1 branch, installing all skins:
npm run update --branch=12.1 --skins
npm run update --branch=12.1 --skins=all

@@ -79,7 +81,7 @@ ## Importing

import 'smartclient-enterprise/debug';
import 'smartclient-enterprise/debug';
or
import 'smartclient-enterprise/release';
import 'smartclient-enterprise/release';

@@ -89,11 +91,11 @@ to import the debug or release framework, respectively. To import a skin, such

import 'smartclient-enterprise/skins/Tahoe';
import 'smartclient-enterprise/skins/Tahoe';
To import one of the optional modules, you can write something like:
import 'smartclient-enterprise/debug/rtm';
import 'smartclient-enterprise/debug/rtm';
or
import 'smartclient-enterprise/release/analytics';
import 'smartclient-enterprise/release/analytics';

@@ -106,6 +108,18 @@ to import the debug version of RealtimeMessaging or the release version of the

const ISC: typeof isc = window['isc'];
const ISC: typeof isc = window['isc'];
after importing this package.
### Importing skins in Angular
In [Angular](https://en.wikipedia.org/wiki/Angular_(web_framework)),
you may need to manually add the path to the skin_styles.css file
for your skin to the src/styles.css file (or requivalent) for your app, in
addition to importing the skin as described above.
For example, if you've installed the SmartClient runtime in the default location,
and are importing Tahoe, you'd add the following to src/style.css in your app:
@import '../isomorphic/skins/Tahoe/skin_styles.css';
## TypeScript

@@ -120,3 +134,3 @@

import 'smartclient.d.ts';
import 'smartclient.d.ts';

@@ -71,11 +71,8 @@ #!/usr/bin/env node

// remove installed Framework from configured location
let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
let isomorphicPath = path.resolve("..", "..", location, Const.ISOMORPHIC_DIR);
rl.question("Uninstalling SmartClient " + config.branch + ", build " + config.date +
" runtime(s) installed at " + isomorphicPath + ". Note that if " +
"you're seeing this during (re)installation, the new installation " +
"won't be aware of the old Framework files even if you decide to " +
"keep them. Remove existing installation? [yes]: ",
" runtime(s) installed at " + isomorphicPath +
". Remove existing installation? [yes]: ",
function (answer) {
if (answer.trim() === "" || answer.match(/^y(es)?$/i)) {
let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
if (fs.existsSync(isomorphicPath)) {

@@ -82,0 +79,0 @@ rl.write("Removing SmartClient...");

@@ -59,4 +59,4 @@ #!/usr/bin/env node

// for update, show details of current installation
if (config.date) {
let isomorphicPath = path.join(config.location, Const.ISOMORPHIC_DIR);
if (config.date && this._hasIscDir(config.location)) {
let isomorphicPath = this._getIscDir(config.location);
console.log("SmartClient " + config.branch + ", build " + config.date +

@@ -69,2 +69,7 @@ ", runtime(s) are currently installed at " + isomorphicPath +

// show usage help documentation
if (env.npm_config_showUsage) {
this.usage(); return;
}
if (Const.REQUIRES_ACCOUNT) {

@@ -103,4 +108,4 @@ console.log("SmartClient " + Const.SMARTCLIENT_NAME +

// installation directory
let location = env.npm_config_location || config.location || path.resolve(__dirname);
// installation directory; default is directory of dependent module
let location = env.npm_config_location || config.location || ".";

@@ -136,5 +141,14 @@ // date

// reference
let reference = env.npm_config_reference != null ? env.npm_config_reference :
config.reference;
// skins
let skins = env.npm_config_skins != null ? env.npm_config_skins : config.skins;
let skins = env.npm_config_skins || config.skins || Const.DEFAULT_SKIN;
if (skins != Const.DEFAULT_SKIN && skins != "all" && skins != "none") {
console.log("*** Invalid skins: " + skins + "!\n");
this.usage(); process.exitCode = 6;
return;
}
// yes (skip prompt where default is "yes")

@@ -144,22 +158,36 @@ let yes = env.npm_config_yes != null ? env.npm_config_yes : config.yes;

// prompt for install/update
let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR),
let isomorphicPath = this._getIscDir(location),
prompt = "Install SmartClient " + branch + " runtime, build date " +
date + ", at " + isomorphicPath;
if (fs.existsSync(isomorphicPath) && (!config.location || config.location != location))
{
prompt += " (removing the directory currently present at install path)"
if (fs.existsSync(isomorphicPath)) {
if (!config.location || config.location != location) {
prompt += " (removing the directory currently present at install path)"
} else if (config.location && config.location == location) {
prompt += " (replacing the existing SmartClient installation there)";
}
}
let query = Const.REQUIRES_ACCOUNT ? "?USERNAME=" + username +
"&PASSWORD=" + encodeURIComponent(password) : "";
let answer = Update._prompt(prompt + "? [yes]: ", yes);
if (answer != null && (answer.trim() === "" || answer.match(/^y(es)?$/i))) {
let query = Const.REQUIRES_ACCOUNT ?
"?USERNAME=" + username + "&PASSWORD=" + encodeURIComponent(password) : "";
Update._getSmartClientLink(branch, date, query, Const.DOWNLOAD_DIR,
function (link) {
Update._updateRuntimeCore(location, link, query, branch, date, runtime,
skins, username, yes);
skins, reference, username, yes);
}
);
}
// user doesn't want to download a new SDK; see if we can reuse existing installation
if (fs.existsSync(isomorphicPath) && config.location && config.location == location) {
let isomorphicPath = this._getIscDir(config.location);
console.log("Attempting to reuse the installation at " + isomorphicPath);
Update._createImportScripts(location, query, branch, date, runtime, yes);
} else {
console.log("No valid installation detected. Skipping script generation.");
console.log("To create scripts, run 'npm run update' in the module directory.");
}
}

@@ -178,8 +206,9 @@

* @param {string} runtime - "release", "debug", or "both"
* @param {boolean} skins - install all skins
* @param {string} skins - which skins to install
* @param {boolean} reference - install reference dir
* @param {string} username - account username
* @param {boolean} yes - answer "yes" to prompt
*/
static _updateRuntimeCore(location, link, query, branch, date, runtime, skins, username,
yes)
static _updateRuntimeCore(location, link, query, branch, date, runtime, skins, reference,
username, yes)
{

@@ -199,7 +228,9 @@ // if not present, create destination directory with user RWX access

// ask user to skip if there's no newer build and no configuration has changed
if (location == config.location &&
if (Update._hasIscDir(location) &&
location == config.location &&
branch == config.branch &&
realDate == config.date &&
runtime == config.runtime &&
!skins == !config.skins)
skins == config.skins &&
!reference == !config.reference)
{

@@ -289,3 +320,3 @@ let skip = Update._prompt(

if (config.location) { // remove existing installation, if any
let oldPath = path.join(config.location, Const.ISOMORPHIC_DIR);
let oldPath = Update._getIscDir(config.location);
console.log("Removing old SmartClient runtime(s) at " + oldPath);

@@ -295,3 +326,3 @@ fs.removeSync(oldPath);

let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
let isomorphicPath = Update._getIscDir(location);
console.log("Copying SmartClient runtime(s) to " + isomorphicPath);

@@ -308,3 +339,2 @@

filter: function (src, dest) {
dest = Update._canonicalizePath(dest);
// exclude unwanted runtimes

@@ -318,5 +348,14 @@ if (runtime == "release" &&

}
dest = Update._canonicalizePath(dest);
// exclude reference dir unless configured to keep it
if (!reference && dest.match(/system\/reference$/)) {
return false;
}
// exclude unwanted skins
if (!skins && dest.match(/skins\/[a-z]+$/i) &&
!dest.endsWith("skins/" + Const.DEFAULT_SKIN))
if (skins != "all" && dest.match(/skins\/[a-z]+$/i) &&
(skins == "none" ||
!dest.endsWith("skins/" + Const.DEFAULT_SKIN)))
{

@@ -339,6 +378,13 @@ return false;

if (skins) {
console.log("Installed all skins.");
if (reference) {
console.log("Installing the reference directory.");
} else {
console.log("Not installing the reference directory.");
}
if (skins == Const.DEFAULT_SKIN) {
console.log("Installed " + Const.DEFAULT_SKIN + " skin.");
} else {
let whichSkins = skins == "none" ? "no" : skins;
console.log("Installed " + whichSkins + " skins.");
}

@@ -355,2 +401,3 @@

config.date = realDate;
config.skins = skins;

@@ -360,4 +407,4 @@ if (date == Const.LATEST_BUILD) config.latest = true;

if (skins) config.skins = true;
else delete config.skins;
if (reference) config.reference = true;
else delete config.reference;

@@ -382,13 +429,3 @@ if (yes) config.yes = true;

console.log("Setting up import scripts...");
Update._createImportScripts(isomorphicPath);
Update._injectTypeScript(yes);
if (Const.SUPPORTS_MODULES) {
console.log("Installation of runtime core complete.\n");
Update._startOptionalModulesUpdate(location, query, branch, date,
runtime);
} else {
console.log("Installation complete.");
}
Update._createImportScripts(location, query, branch, date, runtime, yes);
});

@@ -401,2 +438,48 @@ });

/**
* (Internal) return the isomorphic dir from the location
*
* @param {string} location - isomorphic dir location
* @return (string) absolute path to the isomorphid dir
*/
static _getIscDir(location) {
return path.resolve("..", "..", location, Const.ISOMORPHIC_DIR);
}
/**
* (Internal) whether the location specifies a valid isomorphic dir
*
* @param {string} location - isomorphic dir location
* @return (string) whether location specifies a valid isomorphic dir
*/
static _hasIscDir(location) {
return fs.existsSync(this._getIscDir(location));
}
/**
* (Internal) generate import scripts for framework, skins, and optional modules
*
* @param {string} location - destination path
* @param {string} query - download credentials
* @param {number} branch - SmartClient branch
* @param {string} date - build date
* @param {string} runtime - "release", "debug", or "both"
* @param {boolean} yes - answer "yes" to prompt
* @param {function} callback
*/
static _createImportScripts(location, query, branch, date, runtime, yes) {
let isomorphicPath = this._getIscDir(location);
console.log("Setting up import scripts...");
Update.__createImportScripts(isomorphicPath);
Update._injectTypeScript(isomorphicPath, yes);
if (Const.SUPPORTS_MODULES) {
console.log("Installation of runtime core complete.\n");
Update._startOptionalModulesUpdate(location, query, branch, date, runtime);
} else {
console.log("Installation complete.");
}
}
/**
* (Internal) Start install/update of optional modules.

@@ -429,3 +512,3 @@ * Updates configuration file.

console.log("Setting up optional module import scripts...");
const isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
const isomorphicPath = this._getIscDir(location);
Update._createOptionalModuleScripts(isomorphicPath, "analytics", "Analytics");

@@ -568,3 +651,3 @@ Update._createOptionalModuleScripts(isomorphicPath, "rtm", "RealtimeMessaging");

let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
let isomorphicPath = Update._getIscDir(location);
console.log("Installing " + moduleName + " module to " + isomorphicPath);

@@ -605,3 +688,3 @@

static _removeModule(location, moduleName, moduleFile) {
let isomorphicPath = path.join(location, Const.ISOMORPHIC_DIR);
let isomorphicPath = this._getIscDir(location);
fs.removeSync(path.join(isomorphicPath, Const.RELEASE_MODULES, moduleFile))

@@ -664,3 +747,3 @@ fs.removeSync(path.join(isomorphicPath, Const.RELEASE_MODULES, moduleFile + ".gz"))

*/
static _createImportScripts(isomorphicPath) {
static __createImportScripts(isomorphicPath) {
var dirname = path.resolve(__dirname);

@@ -705,11 +788,19 @@

static _createRuntimeLoader(loaderPath, dirname, modulesDir) {
const modules = Const.SMARTCLIENT_MODULES;
if (modulesDir.startsWith(dirname)) {
modulesDir = ".." + modulesDir.substring(dirname.length);
const modules = Const.SMARTCLIENT_MODULES,
dependentPath = path.resolve("..", "..")
;
if (modulesDir.startsWith(dependentPath)) {
modulesDir = "../../.." + Update._canonicalizePath(
modulesDir.substring(dependentPath.length));
} else {
modulesDir = Update._canonicalizePath(modulesDir);
}
let contents =
"const Const = require('../Const');\n\n" +
"if (global != global.window) throw new Error(Const.ILLEGAL_USAGE_TEXT);\n\n" +
let contents =
"if (!window || !window.Window || !(window instanceof window.Window) ||\n" +
" !window.Navigator || !(window.navigator instanceof window.Navigator) ||\n" +
" !window.Document || !(window.document instanceof window.Document))\n" +
"{\n" +
" throw new Error('" + Const.ILLEGAL_USAGE_TEXT + "');\n" +
"}\n\n" +
"window.isc = {};\n"

@@ -720,3 +811,3 @@ ;

const moduleFile = "ISC_" + modules[i] + ".js";
contents += "require('" + path.join(modulesDir, moduleFile) + "');\n";
contents += "require('" + modulesDir + "/" + moduleFile + "');\n";
}

@@ -740,4 +831,3 @@

const modulesRegExp = this._getPathSegmentRegExp("node_modules"),
dependentPath = dirname.match(modulesRegExp)[0];
const dependentPath = path.resolve("..", "..");
if (!skinDir.startsWith(dependentPath)) {

@@ -749,8 +839,9 @@ console.error("ERROR! Can't generate a skin loader for path " + skinDir +

const isomorphicRegExp = this._getPathSegmentRegExp(Const.ISOMORPHIC_DIR),
contextPath = skinDir.substring(dependentPath.length).match(isomorphicRegExp)[0];
const isomorphicRegExp = this._getPathSegmentRegExp(Const.ISOMORPHIC_DIR);
let contextPath = skinDir.substring(dependentPath.length + 1)
.match(isomorphicRegExp)[0];
if (skinDir.startsWith(dirname)) {
skinDir = "../.." + skinDir.substring(dirname.length);
}
skinDir = "../../../.." + Update._canonicalizePath(
skinDir.substring(dependentPath.length));
contextPath = Update._canonicalizePath(contextPath);

@@ -766,5 +857,5 @@ let contents = "require.context(\n" +

"isc.Page.manualStyleSheets = true;\n" +
"window.isc_currentScriptSrc = 'isomorphic/skins/" + skinName + "/';\n" +
"require('" + path.join(skinDir, "skin_styles.css") + "');\n" +
"require('" + path.join(skinDir, "load_skin.js") + "');\n"
"window.isc_currentScriptSrc = '/isomorphic/skins/" + skinName + "/';\n" +
"require('" + skinDir + "/skin_styles.css');\n" +
"require('" + skinDir + "/load_skin.js');\n"
;

@@ -780,9 +871,23 @@

*/
static _injectTypeScript(yes) {
const modulePath = path.resolve(__dirname),
tsConfigName = Const.TYPESCRIPT_CONF,
modulesRegExp = this._getPathSegmentRegExp("node_modules"),
dependentPath = modulePath.match(modulesRegExp)[0],
tsIncludePath = path.join("node_modules", Const.MODULE_NAME, "**", "*.d.ts")
static _injectTypeScript(isomorphicPath, yes) {
const tsConfigName = Const.TYPESCRIPT_CONF,
dependentPath = path.resolve("..", ".."),
tsFilePath = path.join(isomorphicPath, "system", "development")
;
if (isomorphicPath.startsWith(dependentPath)) {
isomorphicPath = isomorphicPath.substring(dependentPath.length + 1);
}
const tsIncludePath = path.join(isomorphicPath, "**", "*.d.ts"),
failureMessage = "Assuming your typescript file is in the top-level directory " +
"of your module with isc-config.json, you can manually add the path '" +
tsIncludePath + "' to the list of include paths in your typescript file " +
"with a block like this:\n" +
" \"include\": [\n" +
" // other, existing paths...\n" +
" \"" + tsIncludePath + "\"\n" +
" ]\n" +
"(If your typescript is elsewhere, the path may need adjustment.) " +
"Or you can copy smartclient.d.ts from '" + tsFilePath + "' to your app's " +
"source directory and manually import it from your app.\n"
;
// if we can find the dependent module's tsconfig.json, offer/try to update it

@@ -792,5 +897,12 @@ if (dependentPath) {

if (fs.existsSync(tsPath)) {
let tsConfig = fs.readJsonSync(tsPath),
includedDirs = tsConfig.include
;
let tsConfig;
try {
tsConfig = fs.readJsonSync(tsPath);
} catch (e) {
console.warn("WARNING! Unable to parse the file " + tsPath +
" for your app. (Bad syntax? JS-style comments?) " +
failureMessage);
return;
}
let includedDirs = tsConfig.include;
if (includedDirs && includedDirs.indexOf(tsIncludePath) >= 0) {

@@ -812,3 +924,3 @@ console.log("Your app already has the right typescript include path in " +

console.log("To import SmartClient's typescript file, add the path '" +
tIncludePath + " to the include paths in your app's" +
tsIncludePath + " to the include paths in your app's" +
tsConfigName + " file");

@@ -820,7 +932,4 @@ }

}
console.warn("WARNING! Unable to find " + tsConfigName + " for your app. You can " +
"manually add the path '" + tsIncludePath + "' to the list of include " +
"paths in your typescript config. Or you can copy smartclient.d.ts " +
"from '" + path.join(modulePath, "isomorphic", "system", "development") +
"' to your app's source directory and manually import it from your app.");
console.warn("WARNING! Unable to find " + tsConfigName + " for your app. " +
failureMessage);
}

@@ -862,5 +971,11 @@

static _createModuleLoader(loaderPath, dirname, modulePath) {
if (modulePath.startsWith(dirname)) {
modulePath = ".." + modulePath.substring(dirname.length);
const dependentPath = path.resolve("..", "..");
if (modulesPath.startsWith(dependentPath)) {
modulesPath = "../../.." + Update._canonicalizePath(
modulesPath.substring(dependentPath.length));
} else {
modulesPath = Update._canonicalizePath(modulesPath);
}
const contents = "require('" + modulePath + "');\n";

@@ -932,3 +1047,3 @@ fs.outputFileSync(loaderPath, contents);

static _getPathSegmentRegExp(segment) {
new RegExp(".*\\" + path.sep + "(?=" + segment + "\\" + path.sep + ")");
return new RegExp("(?:^|.*\\" + path.sep + ")(?=" + segment + "\\" + path.sep + ")");
}

@@ -953,10 +1068,11 @@

" default is to place runtime root (" + Const.ISOMORPHIC_DIR + ")\n" +
" in the parent of the node_modules directory\n" +
" containing the " + package_name + " package\n\n" +
" in the dependent module directory\n\n" +
" --branch=<number> desired branch (e.g. 11.1); default is " + default_branch + "\n\n" +
" --date=<date|'latest'> desired build date, in format YYYY-MM-DD,\n" +
" --date=<date>|latest desired build date, in format YYYY-MM-DD,\n" +
" or 'latest'; default is 'latest'\n\n" +
" --runtime=<'release'|'debug'|'both'>\n" +
" --runtime=release|debug|both\n" +
" which runtime(s) to install; default is 'both'\n\n" +
" --skins[=<boolean>] whether to install all skins or not;\n" +
" --reference[=<boolean>] whether to keep the framework reference directory;\n" +
" default is to not install it to save disk space\n\n" +
" --skins=" + default_skin + "|all|none which skins (if any) to install;\n" +
" default is to only install " + default_skin + "\n\n" +

@@ -990,3 +1106,3 @@ " --yes[=<boolean>] assume answer 'yes' to prompts with default\n\n" +

"Update to SmartClient 12.0 branch, installing all skins:\n\n" +
" npm run update --branch=12.0 --skins\n";
" npm run update --branch=12.0 --skins=all\n";

@@ -993,0 +1109,0 @@ console.log(usage);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc