fix(core): update
This commit is contained in:
		| @@ -12,6 +12,9 @@ stages: | |||||||
|   - release |   - release | ||||||
|   - metadata |   - metadata | ||||||
|  |  | ||||||
|  | before_script: | ||||||
|  |   - npm install -g @shipzone/npmci | ||||||
|  |  | ||||||
| # ==================== | # ==================== | ||||||
| # security stage | # security stage | ||||||
| # ==================== | # ==================== | ||||||
| @@ -36,6 +39,7 @@ auditProductionDependencies: | |||||||
|     - npmci command npm audit --audit-level=high --only=prod --production |     - npmci command npm audit --audit-level=high --only=prod --production | ||||||
|   tags: |   tags: | ||||||
|     - docker |     - docker | ||||||
|  |   allow_failure: true | ||||||
|  |  | ||||||
| auditDevDependencies: | auditDevDependencies: | ||||||
|   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci |   image: registry.gitlab.com/hosttoday/ht-docker-node:npmci | ||||||
| @@ -96,10 +100,9 @@ codequality: | |||||||
|   only: |   only: | ||||||
|     - tags |     - tags | ||||||
|   script: |   script: | ||||||
|     - npmci command npm install -g tslint typescript |     - npmci command npm install -g typescript | ||||||
|     - npmci npm prepare |     - npmci npm prepare | ||||||
|     - npmci npm install |     - npmci npm install | ||||||
|     - npmci command "tslint -c tslint.json ./ts/**/*.ts" |  | ||||||
|   tags: |   tags: | ||||||
|     - lossless |     - lossless | ||||||
|     - docker |     - docker | ||||||
| @@ -119,11 +122,10 @@ trigger: | |||||||
| pages: | pages: | ||||||
|   stage: metadata |   stage: metadata | ||||||
|   script: |   script: | ||||||
|     - npmci node install lts |     - npmci node install stable  | ||||||
|     - npmci command npm install -g @gitzone/tsdoc |  | ||||||
|     - npmci npm prepare |     - npmci npm prepare | ||||||
|     - npmci npm install |     - npmci npm install | ||||||
|     - npmci command tsdoc |     - npmci command npm run buildDocs | ||||||
|   tags: |   tags: | ||||||
|     - lossless |     - lossless | ||||||
|     - docker |     - docker | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @@ -2,28 +2,10 @@ | |||||||
|   "version": "0.2.0", |   "version": "0.2.0", | ||||||
|   "configurations": [ |   "configurations": [ | ||||||
|     { |     { | ||||||
|       "name": "current file", |       "command": "npm test", | ||||||
|       "type": "node", |       "name": "Run npm test", | ||||||
|       "request": "launch", |       "request": "launch", | ||||||
|       "args": [ |       "type": "node-terminal" | ||||||
|         "${relativeFile}" |  | ||||||
|       ], |  | ||||||
|       "runtimeArgs": ["-r", "@gitzone/tsrun"], |  | ||||||
|       "cwd": "${workspaceRoot}", |  | ||||||
|       "protocol": "inspector", |  | ||||||
|       "internalConsoleOptions": "openOnSessionStart" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "name": "test.ts", |  | ||||||
|       "type": "node", |  | ||||||
|       "request": "launch", |  | ||||||
|       "args": [ |  | ||||||
|         "test/test.ts" |  | ||||||
|       ], |  | ||||||
|       "runtimeArgs": ["-r", "@gitzone/tsrun"], |  | ||||||
|       "cwd": "${workspaceRoot}", |  | ||||||
|       "protocol": "inspector", |  | ||||||
|       "internalConsoleOptions": "openOnSessionStart" |  | ||||||
|     } |     } | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|       "githost": "gitlab.com", |       "githost": "gitlab.com", | ||||||
|       "gitscope": "pushrocks", |       "gitscope": "pushrocks", | ||||||
|       "gitrepo": "smartjson", |       "gitrepo": "smartjson", | ||||||
|       "shortDescription": "typed json handlers", |       "description": "typed json handlers", | ||||||
|       "npmPackagename": "@pushrocks/smartjson", |       "npmPackagename": "@pushrocks/smartjson", | ||||||
|       "license": "MIT" |       "license": "MIT" | ||||||
|     } |     } | ||||||
|   | |||||||
							
								
								
									
										17130
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17130
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							| @@ -7,7 +7,8 @@ | |||||||
|   "typings": "dist_ts/index.d.ts", |   "typings": "dist_ts/index.d.ts", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "test": "(tstest test/ --web)", |     "test": "(tstest test/ --web)", | ||||||
|     "build": "(tsbuild --web)" |     "build": "(tsbuild --web --allowimplicitany)", | ||||||
|  |     "buildDocs": "tsdoc" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
| @@ -20,17 +21,17 @@ | |||||||
|   }, |   }, | ||||||
|   "homepage": "https://gitlab.com/pushrocks/smartjson#README", |   "homepage": "https://gitlab.com/pushrocks/smartjson#README", | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@gitzone/tsbuild": "^2.1.25", |     "@gitzone/tsbuild": "^2.1.63", | ||||||
|     "@gitzone/tsrun": "^1.2.12", |     "@gitzone/tsrun": "^1.2.35", | ||||||
|     "@gitzone/tstest": "^1.0.52", |     "@gitzone/tstest": "^1.0.71", | ||||||
|     "@pushrocks/tapbundle": "^3.2.10", |     "@pushrocks/tapbundle": "^5.0.3", | ||||||
|     "@types/node": "^14.14.22", |     "@types/node": "^17.0.41", | ||||||
|     "tslint": "^6.1.3", |     "tslint": "^6.1.3", | ||||||
|     "tslint-config-prettier": "^1.18.0" |     "tslint-config-prettier": "^1.18.0" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@types/buffer-json": "^2.0.0", |     "@types/buffer-json": "^2.0.1", | ||||||
|     "@types/fast-json-stable-stringify": "^2.0.0", |     "@types/fast-json-stable-stringify": "^2.1.0", | ||||||
|     "buffer-json": "^2.0.0", |     "buffer-json": "^2.0.0", | ||||||
|     "fast-json-stable-stringify": "^2.1.0", |     "fast-json-stable-stringify": "^2.1.0", | ||||||
|     "lodash.clonedeep": "^4.5.0" |     "lodash.clonedeep": "^4.5.0" | ||||||
| @@ -49,5 +50,6 @@ | |||||||
|   ], |   ], | ||||||
|   "browserslist": [ |   "browserslist": [ | ||||||
|     "last 1 chrome versions" |     "last 1 chrome versions" | ||||||
|   ] |   ], | ||||||
|  |   "type": "module" | ||||||
| } | } | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| import { tap, expect } from '@pushrocks/tapbundle'; | import { tap, expect } from '@pushrocks/tapbundle'; | ||||||
|  |  | ||||||
| import { Smartjson, foldDec } from '../ts/index'; | import * as smartjson from '../ts/index.js'; | ||||||
|  |  | ||||||
| class SomeClass extends Smartjson { | class SomeClass extends smartjson.Smartjson { | ||||||
|   @foldDec() thisis: string = 'test'; |   @smartjson.foldDec() thisis: string = 'test'; | ||||||
|   constructor() { |   constructor() { | ||||||
|     super(); |     super(); | ||||||
|     console.log(this.saveableProperties); |     console.log(this.saveableProperties); | ||||||
| @@ -14,18 +14,30 @@ let mySomeClass: SomeClass; | |||||||
|  |  | ||||||
| tap.test('should create a Foldable extended instance', async () => { | tap.test('should create a Foldable extended instance', async () => { | ||||||
|   mySomeClass = new SomeClass(); |   mySomeClass = new SomeClass(); | ||||||
|   expect(mySomeClass).to.be.instanceof(SomeClass); |   expect(mySomeClass).toBeInstanceOf(SomeClass); | ||||||
|   expect(mySomeClass).to.be.instanceof(Smartjson); |   expect(mySomeClass).toBeInstanceOf(smartjson.Smartjson); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should create a folded object', async () => { | tap.test('should create a folded object', async () => { | ||||||
|   let foldedObject = mySomeClass.foldToObject(); |   let foldedObject = mySomeClass.foldToObject(); | ||||||
|   expect(foldedObject).property('thisis').to.equal('test'); |   expect(foldedObject).property('thisis').toEqual('test'); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.test('should enfold from object', async () => { | tap.test('should enfold from object', async () => { | ||||||
|   const mySomeClass2 = SomeClass.enfoldFromObject({ thisis: 'test2' }); |   const mySomeClass2 = SomeClass.enfoldFromObject({ thisis: 'test2' }); | ||||||
|   expect(mySomeClass2).property('thisis').to.equal('test2'); |   expect(mySomeClass2).property('thisis').toEqual('test2'); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | tap.test('should products stable jsons', async () => { | ||||||
|  |   const jsonString = smartjson.stringify({ | ||||||
|  |     a: 1, | ||||||
|  |     f: 6, | ||||||
|  |     b: 3, | ||||||
|  |     c: 3, | ||||||
|  |     e: 5, | ||||||
|  |     d: 4, | ||||||
|  |   }); | ||||||
|  |   console.log(jsonString); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| tap.start(); | tap.start(); | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | /** | ||||||
|  |  * autocreated commitinfo by @pushrocks/commitinfo | ||||||
|  |  */ | ||||||
|  | export const commitinfo = { | ||||||
|  |   name: '@pushrocks/smartjson', | ||||||
|  |   version: '4.0.7', | ||||||
|  |   description: 'typed json handlers' | ||||||
|  | } | ||||||
							
								
								
									
										15
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ts/index.ts
									
									
									
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| import * as plugins from './smartjson.plugins'; | import * as plugins from './smartjson.plugins.js'; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * allows you to parse a json |  * allows you to parse a json | ||||||
| @@ -10,10 +10,15 @@ export const parse = plugins.bufferJson.parse; | |||||||
|  * @param objArg |  * @param objArg | ||||||
|  * @param optionsArg |  * @param optionsArg | ||||||
|  */ |  */ | ||||||
| export const stringify = (objArg: any, optionsArg: plugins.IStableJsonTypes['Options'] = {}): string => { | export const stringify = ( | ||||||
|  |   objArg: any, | ||||||
|  |   simpleOrderArray?: string[], | ||||||
|  |   optionsArg: plugins.IStableJsonTypes['Options'] = {} | ||||||
|  | ): string => { | ||||||
|   const bufferedJson = plugins.bufferJson.stringify(objArg); |   const bufferedJson = plugins.bufferJson.stringify(objArg); | ||||||
|   objArg = JSON.parse(bufferedJson); |   objArg = JSON.parse(bufferedJson); | ||||||
|   return plugins.stableJson(objArg, optionsArg); |   let returnJson = plugins.stableJson(objArg, optionsArg); | ||||||
|  |   return returnJson; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| export class Smartjson { | export class Smartjson { | ||||||
| @@ -69,7 +74,7 @@ export class Smartjson { | |||||||
|    */ |    */ | ||||||
|   public foldToJson() { |   public foldToJson() { | ||||||
|     const foldedObject = this.foldToObject(); |     const foldedObject = this.foldToObject(); | ||||||
|     return stringify(foldedObject, {}); |     return stringify(foldedObject); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -89,4 +94,4 @@ export const deepEqualObjects = (object1: any, object2: any): boolean => { | |||||||
|   const object1String = stringify(object1); |   const object1String = stringify(object1); | ||||||
|   const object2String = stringify(object2); |   const object2String = stringify(object2); | ||||||
|   return object1String === object2String; |   return object1String === object2String; | ||||||
| } | }; | ||||||
|   | |||||||
| @@ -1,8 +1,9 @@ | |||||||
| { | { | ||||||
|     "compilerOptions": { |   "compilerOptions": { | ||||||
|         "experimentalDecorators": true, |     "experimentalDecorators": true, | ||||||
|         "esModuleInterop": true, |     "useDefineForClassFields": false, | ||||||
|         "target": "es2017", |     "target": "ES2022", | ||||||
|         "module": "commonjs" |     "module": "ES2022", | ||||||
|     } |     "moduleResolution": "nodenext" | ||||||
|  |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user