diff --git a/libantosdk/README.md b/libantosdk/README.md index dacd21a..55d3543 100644 --- a/libantosdk/README.md +++ b/libantosdk/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.0.15: App name differ from libname, update AntOS API - 0.0.14: vfs-rm can be configured to be silent when the target does not exist - 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description - 0.0.12: TS worker now allows user specific compile options (defined un build file) diff --git a/libantosdk/build/debug/README.md b/libantosdk/build/debug/README.md index dacd21a..55d3543 100644 --- a/libantosdk/build/debug/README.md +++ b/libantosdk/build/debug/README.md @@ -2,6 +2,7 @@ AntOSDK: development API for AntOS based applications/projects ## Change logs +- 0.0.15: App name differ from libname, update AntOS API - 0.0.14: vfs-rm can be configured to be silent when the target does not exist - 0.0.13: allow linux-job handle to set defaut pwd if it is not specified in job description - 0.0.12: TS worker now allows user specific compile options (defined un build file) diff --git a/libantosdk/build/debug/core/ts/antos.d.ts b/libantosdk/build/debug/core/ts/antos.d.ts index 8daae6b..8c3a58c 100644 --- a/libantosdk/build/debug/core/ts/antos.d.ts +++ b/libantosdk/build/debug/core/ts/antos.d.ts @@ -1140,7 +1140,7 @@ declare namespace OS { * @export * @param {string} app */ - function unloadApp(app: string): void; + function unloadApp(app: string, save?: boolean): void; /** * Create a service process. * @@ -1559,13 +1559,14 @@ declare namespace OS { * AntOS version number is in the following format: * * ``` - * [major_number].[minor_number].[patch]-[branch] + * [major_number].[minor_number].[patch]-[branch]-[build ID]) * - * e.g.: 1.2.3-r means that: + * e.g.: 1.2.3-r-b means that: * - version major number is 1 * - version minor number is 2 * - patch version is 3 * - the current branch is release `r` + * - build ID (optional) * ``` * * @export @@ -1575,10 +1576,11 @@ declare namespace OS { /** * The version string * + * @private * @type {string} * @memberof Version */ - string: string; + private string; /** * The current branch * - 1: `a` - alpha branch @@ -1611,12 +1613,27 @@ declare namespace OS { * @memberof Version */ patch: number; + /** + * Version build ID (optional): usually the current git commit hash + * + * @type {number} + * @memberof Version + */ + build_id: string; /** *Creates an instance of Version. + * * @param {string} string string represents the version * @memberof Version */ constructor(string: string); + /** + * Setter/getter to set the version string to the object + * + * @memberof Version + */ + set version_string(v: string); + get version_string(): string; /** * Compare the current version with another version. * @@ -1670,6 +1687,11 @@ declare namespace OS { * is an instance of [[Version]] */ const VERSION: Version; + /** + * Variable represents the current AntOS source code repository + * is an instance of [[string]] + */ + const REPOSITORY: string; /** * Register a model prototype to the system namespace. * There are two types of model to be registered, if the model diff --git a/libantosdk/build/debug/core/ts/jquery.d.ts b/libantosdk/build/debug/core/ts/jquery.d.ts index a203a70..d24038b 100644 --- a/libantosdk/build/debug/core/ts/jquery.d.ts +++ b/libantosdk/build/debug/core/ts/jquery.d.ts @@ -1,4 +1,7 @@ +export as namespace Sizzle; + declare const Sizzle: SizzleStatic; +export = Sizzle; interface SizzleStatic { selectors: Sizzle.Selectors; @@ -81,7 +84,6 @@ declare namespace Sizzle { } } } - // tslint:disable:jsdoc-format // tslint:disable:max-line-length // tslint:disable:no-irregular-whitespace diff --git a/libantosdk/build/debug/main.js b/libantosdk/build/debug/main.js index f807405..4f34b07 100644 --- a/libantosdk/build/debug/main.js +++ b/libantosdk/build/debug/main.js @@ -1 +1 @@ -var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const s=t.setting.system.packages[e];i[e]={path:s.path,name:s.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,s,r){const o=this.newJobID(),n={id:o,cmd:t,data:e,root:i};this.jobs[o]={callback:s,logger:r},this.worker.postMessage(n)}submit(t,e,i,s){return new Promise((r,o)=>{this.exectue_job(t,e,i,t=>{if(t.error)return o(t.error);r(t.result)},s)})}terminate(){this.worker.terminate()}}class s{constructor(t,e){this.root=e,this.logger=t,s.worker||(s.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,s)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){s(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,s)=>{try{let s=i;1==s.split("://").length&&(s=`${this.root}/${i}`);const r=await(s+"/package.json").asFileHandle().read("json");return r.text=r.name,r.path=s,r.filename=r.pkgname,r.type="app",r.mime="antos/app",r.icon&&(r.icon=`${r.path}/${r.icon}`),r.iconclass||r.icon||(r.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[r.pkgname]=r,r.app?(this.logger.info(__("Running {0}...",r.app)),t.GUI.forceLaunch(r.app,[])):this.logger.error(__("{0} is not an application",r.pkgname)),e(void 0)}catch(t){s(t)}}):s.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,s)=>{try{e.targets||s("No target found");for(const i of t){const t=e.targets[i];if(!t)return s(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){s(t)}})}}let r;e.AntOSDKBuilder=s,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(r=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let s=$("
").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();s.text(`[${i}]: ${e.__()}`)}else s.text(e.__());$(this.target).append(s),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class s extends e.BaseApplication{constructor(t){super("libantosdk",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text]))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.libantosdk=s}(e=t.application||(t.application={}))}(OS||(OS={})); \ No newline at end of file +var OS;!function(t){let e;!function(e){class i{constructor(e){this.worker=new Worker(e.asFileHandle().getlink()),this.jobs={},this.worker.onmessage=t=>{let e=t.data,i=this.jobs[e.id];i?"log"===e.type?i.logger&&(e.error?i.logger.error(e.result):!1===e.show_time&&i.logger.print?i.logger.print(e.result):i.logger.info(e.result)):(i.callback(e),delete this.jobs[e.id]):console.log("Unable to identify result of job",e.id,e)};const i={};for(const e in t.setting.system.packages){const s=t.setting.system.packages[e];i[e]={path:s.path,name:s.pkgname}}this.submit("sdk-setup",{REST:t.API.REST,pkgs:i})}newJobID(){return"job_"+Math.random().toString(36).replace(".","")}exectue_job(t,e,i,s,r){const o=this.newJobID(),n={id:o,cmd:t,data:e,root:i};this.jobs[o]={callback:s,logger:r},this.worker.postMessage(n)}submit(t,e,i,s){return new Promise((r,o)=>{this.exectue_job(t,e,i,t=>{if(t.error)return o(t.error);r(t.result)},s)})}terminate(){this.worker.terminate()}}class s{constructor(t,e){this.root=e,this.logger=t,s.worker||(s.worker=new i("pkg://libantosdk/core/worker.js"))}require(t){return this.run("sdk-import",t.map(t=>t+".worker.js"))}compile(t,e){return new Promise(async(i,s)=>{try{await this.require([t]),i(await this.run(t+"-compile",e))}catch(t){s(__e(t))}})}run(e,i){return"sdk-run-app"===e?new Promise(async(e,s)=>{try{let s=i;1==s.split("://").length&&(s=`${this.root}/${i}`);const r=await(s+"/package.json").asFileHandle().read("json");return r.text=r.name,r.path=s,r.filename=r.pkgname,r.type="app",r.mime="antos/app",r.icon&&(r.icon=`${r.path}/${r.icon}`),r.iconclass||r.icon||(r.iconclass="fa fa-adn"),this.logger.info(__("Installing...")),t.setting.system.packages[r.pkgname]=r,r.app?(this.logger.info(__("Running {0}...",r.app)),t.GUI.forceLaunch(r.app,[])):this.logger.error(__("{0} is not an application",r.pkgname)),e(void 0)}catch(t){s(t)}}):s.worker.submit(e,i,this.root,this.logger)}batch(t,e){return e.root&&(this.root=e.root),new Promise(async(i,s)=>{try{e.targets||s("No target found");for(const i of t){const t=e.targets[i];if(!t)return s(__("No target: {0}",i));if(t.depend&&await this.batch(t.depend,e),t.require&&await this.require(t.require),this.logger&&this.logger.info(__("### RUNNING STAGE: {0}###",i).__()),t.jobs)for(const e of t.jobs)await this.run(e.name,e.data)}i(void 0)}catch(t){s(t)}})}}let r;e.AntOSDKBuilder=s,function(t){class e extends t.RemoteFileHandle{constructor(t){super(t);const e="pkg://libantosdk/"+this.genealogy.join("/");this.setPath(e.asFileHandle().path)}}t.SDKFileHandle=e,t.register("^sdk$",e)}(r=e.VFS||(e.VFS={}))}(e=t.API||(t.API={}))}(OS||(OS={})),function(t){let e;!function(e){class i{constructor(t){this.target=t}info(t){this.log("info",t,!0)}warn(t){this.log("warn",t,!0)}error(t){this.log("error",t,!0)}log(t,e,i){let s=$("").attr("class","sdk-log-"+t);if(i){let t=new Date,i=t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();s.text(`[${i}]: ${e.__()}`)}else s.text(e.__());$(this.target).append(s),$(this.target).scrollTop($(this.target)[0].scrollHeight)}print(t){t.match(/warn/i)?this.log("warn",t,!1):t.match(/error/i)?this.log("error",t,!1):this.log("info",t,!1)}clear(){$(this.target).empty()}}class s extends e.BaseApplication{constructor(t){super("SDKBuilder",t)}main(){this.logger=new i(this.find("container")),this.sdk=new t.API.AntOSDKBuilder(this.logger,""),this.filehandle=void 0,this.options=void 0,this.targets=this.find("target-list"),this.args&&this.args.length>0&&(this.filehandle=this.args[0].path.asFileHandle()),this.find("btnbuild").onbtclick=t=>{const e=this.targets.selectedItem;e&&this.load(this.compile([e.data.text]))},this.find("btnclear").onbtclick=t=>{this.logger.clear()},this.find("btnrefresh").onbtclick=t=>{this.open()},this.find("btnopen").onbtclick=async t=>{try{const t=await this.openDialog("FileDialog",{title:__("Select build file"),mimes:this.meta().mimes});this.filehandle=t.file.path.asFileHandle(),this.open()}catch(t){this.logger.error(t.toString())}},this.open()}open(){void 0!==this.filehandle&&this.filehandle.read("json").then(t=>{if(!t.targets)return this.logger.error(__("Invalid build file: {0}",this.filehandle.path));const e=Object.keys(t.targets).map(t=>({text:t}));this.scheme.apptitle=this.filehandle.path,this.options=t,this.options.root=this.filehandle.parent().path,this.targets.data=e,this.logger.info(__("Loaded: {0}",this.filehandle.path))}).catch(t=>this.logger.error(__("Unable to load build file: {0}: {1}",this.filehandle.path,t.toString())))}compile(t){return new Promise(async(e,i)=>{try{this.logger.clear(),await this.sdk.batch(t,this.options),e("OK")}catch(t){i(__e(t))}})}}e.SDKBuilder=s}(e=t.application||(t.application={}))}(OS||(OS={})); \ No newline at end of file diff --git a/libantosdk/build/debug/package.json b/libantosdk/build/debug/package.json index 6d40a6f..b04bf6a 100644 --- a/libantosdk/build/debug/package.json +++ b/libantosdk/build/debug/package.json @@ -1,13 +1,13 @@ { "pkgname": "libantosdk", "name": "AntOS SDK builder", - "app": "libantosdk", + "app": "SDKBuilder", "description": "AntOS Software Development Kit", "info": { "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.0.14-a", + "version": "0.0.15-a", "category": "Development", "iconclass": "fa fa-cog", "mimes": [ diff --git a/libantosdk/build/release/libantosdk.zip b/libantosdk/build/release/libantosdk.zip index d2adbbb..f637f3f 100644 Binary files a/libantosdk/build/release/libantosdk.zip and b/libantosdk/build/release/libantosdk.zip differ diff --git a/libantosdk/core/ts/antos.d.ts b/libantosdk/core/ts/antos.d.ts index 8daae6b..8c3a58c 100644 --- a/libantosdk/core/ts/antos.d.ts +++ b/libantosdk/core/ts/antos.d.ts @@ -1140,7 +1140,7 @@ declare namespace OS { * @export * @param {string} app */ - function unloadApp(app: string): void; + function unloadApp(app: string, save?: boolean): void; /** * Create a service process. * @@ -1559,13 +1559,14 @@ declare namespace OS { * AntOS version number is in the following format: * * ``` - * [major_number].[minor_number].[patch]-[branch] + * [major_number].[minor_number].[patch]-[branch]-[build ID]) * - * e.g.: 1.2.3-r means that: + * e.g.: 1.2.3-r-b means that: * - version major number is 1 * - version minor number is 2 * - patch version is 3 * - the current branch is release `r` + * - build ID (optional) * ``` * * @export @@ -1575,10 +1576,11 @@ declare namespace OS { /** * The version string * + * @private * @type {string} * @memberof Version */ - string: string; + private string; /** * The current branch * - 1: `a` - alpha branch @@ -1611,12 +1613,27 @@ declare namespace OS { * @memberof Version */ patch: number; + /** + * Version build ID (optional): usually the current git commit hash + * + * @type {number} + * @memberof Version + */ + build_id: string; /** *Creates an instance of Version. + * * @param {string} string string represents the version * @memberof Version */ constructor(string: string); + /** + * Setter/getter to set the version string to the object + * + * @memberof Version + */ + set version_string(v: string); + get version_string(): string; /** * Compare the current version with another version. * @@ -1670,6 +1687,11 @@ declare namespace OS { * is an instance of [[Version]] */ const VERSION: Version; + /** + * Variable represents the current AntOS source code repository + * is an instance of [[string]] + */ + const REPOSITORY: string; /** * Register a model prototype to the system namespace. * There are two types of model to be registered, if the model diff --git a/libantosdk/core/ts/jquery.d.ts b/libantosdk/core/ts/jquery.d.ts index a203a70..d24038b 100644 --- a/libantosdk/core/ts/jquery.d.ts +++ b/libantosdk/core/ts/jquery.d.ts @@ -1,4 +1,7 @@ +export as namespace Sizzle; + declare const Sizzle: SizzleStatic; +export = Sizzle; interface SizzleStatic { selectors: Sizzle.Selectors; @@ -81,7 +84,6 @@ declare namespace Sizzle { } } } - // tslint:disable:jsdoc-format // tslint:disable:max-line-length // tslint:disable:no-irregular-whitespace diff --git a/libantosdk/package.json b/libantosdk/package.json index 6d40a6f..b04bf6a 100644 --- a/libantosdk/package.json +++ b/libantosdk/package.json @@ -1,13 +1,13 @@ { "pkgname": "libantosdk", "name": "AntOS SDK builder", - "app": "libantosdk", + "app": "SDKBuilder", "description": "AntOS Software Development Kit", "info": { "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version": "0.0.14-a", + "version": "0.0.15-a", "category": "Development", "iconclass": "fa fa-cog", "mimes": [ diff --git a/libantosdk/ts/app.ts b/libantosdk/ts/app.ts index f2cf41e..42524dc 100644 --- a/libantosdk/ts/app.ts +++ b/libantosdk/ts/app.ts @@ -114,17 +114,17 @@ namespace OS { } /** * - * @class libantosdk + * @class SDKBuilder * @extends {BaseApplication} */ - export class libantosdk extends BaseApplication { + export class SDKBuilder extends BaseApplication { private sdk: API.AntOSDKBuilder; private logger: Logger; private filehandle: OS.API.VFS.BaseFileHandle; private options: GenericObject