aurelia-json
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -7,4 +7,5 @@ import { FrameworkConfiguration } from "aurelia-framework"; | ||
import { JsonDecoder } from "./json-decoder"; | ||
import { JsonMapper } from "./json-mapper"; | ||
import { JsonMessageInterceptor } from "./message-interceptor"; | ||
export declare function configure(frameworkConfiguration: FrameworkConfiguration, pluginConfiguration: Function): void; | ||
export { JsonSchema, JsonPatch, JsonPointer, JsonEncoder, JsonDecoder, JsonMessageInterceptor }; | ||
export { JsonSchema, JsonPatch, JsonPointer, JsonEncoder, JsonDecoder, JsonMapper, JsonMessageInterceptor }; |
@@ -13,2 +13,4 @@ "use strict"; | ||
exports.JsonDecoder = json_decoder_1.JsonDecoder; | ||
var json_mapper_1 = require("./json-mapper"); | ||
exports.JsonMapper = json_mapper_1.JsonMapper; | ||
var message_interceptor_1 = require("./message-interceptor"); | ||
@@ -30,2 +32,1 @@ exports.JsonMessageInterceptor = message_interceptor_1.JsonMessageInterceptor; | ||
exports.configure = configure; | ||
//# sourceMappingURL=index.js.map |
@@ -41,22 +41,27 @@ "use strict"; | ||
var sourceArray = source[property]; | ||
for (var _a = 0, sourceArray_1 = sourceArray; _a < sourceArray_1.length; _a++) { | ||
var item = sourceArray_1[_a]; | ||
var targetIndex = targetArray.indexOf(item); | ||
var sourceIndex = sourceArray.indexOf(item); | ||
if (targetIndex < 0) { | ||
patch.remove(prefix + property, sourceIndex); | ||
} | ||
if (!Array.isArray(sourceArray)) { | ||
patch.replace(prefix + property, targetArray); | ||
} | ||
for (var _b = 0, targetArray_1 = targetArray; _b < targetArray_1.length; _b++) { | ||
var item = targetArray_1[_b]; | ||
var targetIndex = targetArray.indexOf(item); | ||
var sourceIndex = sourceArray.indexOf(item); | ||
if (sourceIndex < 0) { | ||
patch.add(prefix + property, item); | ||
else { | ||
for (var _a = 0, sourceArray_1 = sourceArray; _a < sourceArray_1.length; _a++) { | ||
var item = sourceArray_1[_a]; | ||
var targetIndex = targetArray.indexOf(item); | ||
var sourceIndex = sourceArray.indexOf(item); | ||
if (targetIndex < 0) { | ||
patch.remove(prefix + property, sourceIndex); | ||
} | ||
} | ||
else { | ||
if (targetIndex !== sourceIndex) { | ||
for (var _b = 0, targetArray_1 = targetArray; _b < targetArray_1.length; _b++) { | ||
var item = targetArray_1[_b]; | ||
var targetIndex = targetArray.indexOf(item); | ||
var sourceIndex = sourceArray.indexOf(item); | ||
if (sourceIndex < 0) { | ||
patch.add(prefix + property, item); | ||
} | ||
if (!seen.has(item) && this.rev.has(item)) { | ||
this.diff(item, [], patch, (prefix + property) + "/" + targetIndex + "/", seen); | ||
else { | ||
if (targetIndex !== sourceIndex) { | ||
} | ||
if (!seen.has(item) && this.rev.has(item)) { | ||
this.diff(item, [], patch, (prefix + property) + "/" + targetIndex + "/", seen); | ||
} | ||
} | ||
@@ -128,3 +133,3 @@ } | ||
} | ||
else | ||
else { | ||
for (var _i = 0, sourceValue_1 = sourceValue; _i < sourceValue_1.length; _i++) { | ||
@@ -137,2 +142,4 @@ var item = sourceValue_1[_i]; | ||
} | ||
targetValue.splice(sourceValue.length); | ||
} | ||
} | ||
@@ -161,2 +168,1 @@ else { | ||
exports.JsonDecoder = JsonDecoder; | ||
//# sourceMappingURL=json-decoder.js.map |
@@ -35,2 +35,1 @@ "use strict"; | ||
exports.JsonEncoder = JsonEncoder; | ||
//# sourceMappingURL=json-encoder.js.map |
@@ -50,2 +50,1 @@ "use strict"; | ||
exports.JsonMessageInterceptor = JsonMessageInterceptor; | ||
//# sourceMappingURL=message-interceptor.js.map |
@@ -76,2 +76,1 @@ "use strict"; | ||
exports.JsonPatch = JsonPatch; | ||
//# sourceMappingURL=patch.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
exports.JsonPointer = JsonPointer; | ||
//# sourceMappingURL=pointer.js.map |
@@ -30,2 +30,1 @@ "use strict"; | ||
exports.JsonSchema = JsonSchema; | ||
//# sourceMappingURL=schema.js.map |
import gulp from "gulp"; | ||
import path from "path"; | ||
import exists from "path-exists"; | ||
import paths from "vinyl-paths"; | ||
@@ -7,14 +9,54 @@ import del from "del"; | ||
import reporters from "jasmine-reporters"; | ||
import tsb from "gulp-tsb"; | ||
import typescript from "typescript"; | ||
import gts from "gulp-typescript"; | ||
import sass from "gulp-sass"; | ||
import merge from "merge2"; | ||
import tsconfig from "./tsconfig.json"; | ||
import pkconfig from "./package.json"; | ||
import child from "child_process"; | ||
const tsc = tsb.create(tsconfig.compilerOptions); | ||
const dependencies = Object.keys(pkconfig.dependencies).filter(dep => exists.sync("../" + dep)); | ||
const sassOptions = { | ||
importer: url => ({ file: url.startsWith("~") ? path.resolve("node_modules", url.substr(1)) : url }) | ||
}; | ||
const tsc = gts(Object.assign({ typescript: typescript }, tsconfig.compilerOptions)); | ||
const typescriptSources = [ tsconfig.compilerOptions.rootDir + "/**/*.ts" ]; | ||
const typescriptOutput = tsconfig.compilerOptions.outDir; | ||
const htmlSources = [ tsconfig.compilerOptions.rootDir + "/**/*.html" ]; | ||
const scssSources = [ tsconfig.compilerOptions.rootDir + "/**/*.scss" ]; | ||
const output = tsconfig.compilerOptions.outDir; | ||
const testSuites = [ "test/**/*.js" ]; | ||
const clean = [ typescriptOutput ]; | ||
const clean = [ output ]; | ||
gulp.task("clean", done => gulp.src(clean).pipe(paths(del))); | ||
gulp.task("build", [ "clean" ], done => gulp.src(typescriptSources).pipe(tsc()).pipe(gulp.dest(typescriptOutput))); | ||
gulp.task("build-typescript", done => { | ||
let stream = gulp.src(typescriptSources).pipe(tsc); | ||
return merge([ | ||
stream.js.pipe(gulp.dest(output)), | ||
stream.dts.pipe(gulp.dest(output)) | ||
]); | ||
}); | ||
gulp.task("build-scss", done => gulp.src(scssSources).pipe(sass(sassOptions)).pipe(gulp.dest(output))); | ||
gulp.task("build-html", done => gulp.src(htmlSources).pipe(gulp.dest(output))); | ||
gulp.task("build", done => run("clean", [ "build-typescript", "build-scss", "build-html" ], done)); | ||
dependencies.forEach(dependency => { | ||
const dependencyPath = "../" + dependency; | ||
const dependencyDist = dependencyPath + "/dist/**/*"; | ||
const dependencyModule = "node_modules/" + dependency + "/dist"; | ||
gulp.task("spawn-" + dependency, done => { | ||
const spawnLock = "../.spawn-" + dependency; | ||
exists.sync(spawnLock) || child.spawn("gulp", [ "watch" ], { cwd: dependencyPath }); | ||
child.spawn("touch", [ spawnLock ]); | ||
return done(); | ||
}); | ||
gulp.task("sync-" + dependency, done => gulp.src(dependencyDist).pipe(gulp.dest(dependencyModule))); | ||
gulp.task("watch-" + dependency, [ "spawn-" + dependency ], done => gulp.watch(dependencyDist, ["sync-" + dependency])); | ||
}); | ||
gulp.task("watch-dependencies", dependencies.map(dependency => "watch-" + dependency)); | ||
gulp.task("watch-typescript", done => gulp.watch(typescriptSources, [ "build-typescript" ])); | ||
gulp.task("watch-scss", done => gulp.watch(scssSources, [ "build-scss" ])); | ||
gulp.task("watch-html", done => gulp.watch(htmlSources, [ "build-html" ])); | ||
gulp.task("watch", [ "watch-dependencies", "watch-typescript", "watch-scss", "watch-html" ]); | ||
gulp.task("test", [ "build" ], done => gulp.src(testSuites).pipe(jasmine())); | ||
gulp.task("default", () => run("build", "test")); |
{ | ||
"name": "aurelia-json", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A JSON plugin for Aurelia based projects.", | ||
@@ -26,20 +26,23 @@ "keywords": [ | ||
"dependencies": { | ||
"aurelia-dependency-injection": "^1.0.0-rc.1.0.0", | ||
"aurelia-framework": "^1.0.0-rc.1.0.0", | ||
"aurelia-http-client": "^1.0.0-rc.1.0.0", | ||
"aurelia-http-utils": "^0.2.0" | ||
"aurelia-dependency-injection": "^1.0.0", | ||
"aurelia-framework": "^1.0.1", | ||
"aurelia-http-client": "^1.0.0", | ||
"aurelia-http-utils": "^0.2.1" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-register": "^6.9.0", | ||
"babel-preset-es2015": "^6.13.2", | ||
"babel-register": "^6.11.6", | ||
"del": "^2.2.1", | ||
"gulp": "^3.9.1", | ||
"gulp-jasmine": "^2.4.0", | ||
"gulp-tsb": "^1.10.4", | ||
"gulp-sass": "^2.3.2", | ||
"gulp-typescript": "^2.13.6", | ||
"jasmine": "^2.4.1", | ||
"jasmine-reporters": "^2.2.0", | ||
"run-sequence": "^1.2.1", | ||
"typescript": "^1.8.10", | ||
"merge2": "^1.0.2", | ||
"path-exists": "^3.0.0", | ||
"run-sequence": "^1.2.2", | ||
"typescript": "^2.0.0", | ||
"vinyl-paths": "^2.1.0" | ||
} | ||
} |
@@ -9,2 +9,3 @@ import {FrameworkConfiguration} from "aurelia-framework"; | ||
import {JsonDecoder} from "./json-decoder"; | ||
import {JsonMapper} from "./json-mapper"; | ||
import {JsonMessageInterceptor} from "./message-interceptor"; | ||
@@ -26,2 +27,2 @@ | ||
export {JsonSchema, JsonPatch, JsonPointer, JsonEncoder, JsonDecoder, JsonMessageInterceptor}; | ||
export {JsonSchema, JsonPatch, JsonPointer, JsonEncoder, JsonDecoder, JsonMapper, JsonMessageInterceptor}; |
@@ -48,21 +48,25 @@ import {JsonPatch} from "./patch"; | ||
let sourceArray = source[property]; | ||
for (let item of sourceArray) { | ||
let targetIndex = targetArray.indexOf(item); | ||
let sourceIndex = sourceArray.indexOf(item); | ||
if (targetIndex < 0) { | ||
patch.remove(prefix + property, sourceIndex); | ||
if (!Array.isArray(sourceArray)) { | ||
patch.replace(prefix + property, targetArray); | ||
} else { | ||
for (let item of sourceArray) { | ||
let targetIndex = targetArray.indexOf(item); | ||
let sourceIndex = sourceArray.indexOf(item); | ||
if (targetIndex < 0) { | ||
patch.remove(prefix + property, sourceIndex); | ||
} | ||
} | ||
} | ||
for (let item of targetArray) { | ||
let targetIndex = targetArray.indexOf(item); | ||
let sourceIndex = sourceArray.indexOf(item); | ||
if (sourceIndex < 0) { | ||
patch.add(prefix + property, item); | ||
} else { | ||
if (targetIndex !== sourceIndex) { | ||
//patch.move(`${prefix + property}/${sourceIndex}`, `${prefix + property}/${targetIndex}`); | ||
for (let item of targetArray) { | ||
let targetIndex = targetArray.indexOf(item); | ||
let sourceIndex = sourceArray.indexOf(item); | ||
if (sourceIndex < 0) { | ||
patch.add(prefix + property, item); | ||
} else { | ||
if (targetIndex !== sourceIndex) { | ||
//patch.move(`${prefix + property}/${sourceIndex}`, `${prefix + property}/${targetIndex}`); | ||
} | ||
if (!seen.has(item) && this.rev.has(item)) { | ||
this.diff(item, [], patch, `${prefix + property}/${targetIndex}/`, seen); | ||
} | ||
} | ||
if (!seen.has(item) && this.rev.has(item)) { | ||
this.diff(item, [], patch, `${prefix + property}/${targetIndex}/`, seen); | ||
} | ||
} | ||
@@ -127,7 +131,10 @@ } | ||
target[property] = sourceValue; | ||
} else for (let item of sourceValue) { | ||
let sourceIndex = sourceValue.indexOf(item); | ||
if (item !== targetValue[sourceIndex]) { | ||
targetValue.splice(sourceIndex, 1, item); | ||
} else { | ||
for (let item of sourceValue) { | ||
let sourceIndex = sourceValue.indexOf(item); | ||
if (item !== targetValue[sourceIndex]) { | ||
targetValue.splice(sourceIndex, 1, item); | ||
} | ||
} | ||
targetValue.splice(sourceValue.length); | ||
} | ||
@@ -134,0 +141,0 @@ } else { |
@@ -8,3 +8,2 @@ { | ||
"noImplicitAny": false, | ||
"sourceMap": true, | ||
"declaration": true, | ||
@@ -11,0 +10,0 @@ "experimentalDecorators": true, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
880
43997
14
32
1
Updatedaurelia-framework@^1.0.1
Updatedaurelia-http-client@^1.0.0
Updatedaurelia-http-utils@^0.2.1