gina 0.1.1-alpha.99 → 0.1.2-alpha.2
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 +1 -1
- package/README-4Contributors.md +30 -0
- package/README.md +125 -39
- package/bin/cli +130 -41
- package/bin/cli-debug +46 -15
- package/bin/cmd +63 -41
- package/bin/gina +57 -49
- package/framework/{v0.1.1-alpha.99/lib/inherits → v0.1.2-alpha.2}/LICENSE +1 -1
- package/framework/v0.1.2-alpha.2/VERSION +1 -0
- package/framework/{v0.1.1-alpha.99/core/asset/js/plugin/readme.md → v0.1.2-alpha.2/core/asset/plugin/README.md} +34 -12
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
- package/framework/{v0.1.1-alpha.99/core/asset/js/plugin/dist → v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/js}/gina.js +4588 -3416
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/js/gina.min.js +765 -0
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +7 -0
- package/framework/v0.1.2-alpha.2/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/config.js +315 -131
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/index.js +460 -274
- package/framework/v0.1.2-alpha.2/core/connectors/couchbase/lib/connector.js +22 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/lib/connector.v2.js +51 -51
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/lib/connector.v3.js +51 -51
- package/framework/v0.1.2-alpha.2/core/connectors/couchbase/lib/connector.v4.js +384 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/lib/n1ql.js +3 -2
- package/framework/v0.1.2-alpha.2/core/connectors/couchbase/lib/session-store.js +22 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
- package/framework/v0.1.2-alpha.2/core/connectors/couchbase/lib/session-store.v4.js +361 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/controller/controller.js +1351 -902
- package/framework/v0.1.2-alpha.2/core/controller/index.js +23 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/dev/index.js +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/dev/lib/class.js +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/dev/lib/factory.js +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/gna.js +48 -24
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/README.md +5 -0
- package/framework/v0.1.2-alpha.2/core/locales/dist/region/en.json +5727 -0
- package/framework/v0.1.2-alpha.2/core/locales/dist/region/fr.json +11452 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/index.js +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/src/make.js +39 -41
- package/framework/v0.1.2-alpha.2/core/locales/src/resources/region.mapping.json +43 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/model/entity.js +87 -67
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/model/index.js +16 -16
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/model/template/entityFactory.js +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/model/template/index.js +17 -15
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/index.js +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/file/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/intl/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/intl/src/main.js +5 -5
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/storage/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/storage/src/main.js +6 -5
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/validator/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/validator/src/form-validator.js +404 -300
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/validator/src/main.js +1384 -1314
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/router.js +221 -122
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/server.express.js +69 -65
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/server.isaac.js +274 -180
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/server.js +710 -615
- package/framework/v0.1.2-alpha.2/core/template/boilerplate/bundle/config/settings.json +12 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/config/templates.json +4 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
- package/framework/v0.1.2-alpha.2/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/index.js +13 -1
- package/framework/v0.1.2-alpha.2/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
- package/framework/v0.1.2-alpha.2/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
- package/framework/v0.1.2-alpha.2/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
- package/framework/{v0.1.1-alpha.99/core/template/boilerplate/bundle_templates/html/layout → v0.1.2-alpha.2/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
- package/framework/v0.1.2-alpha.2/core/template/command/gina.bat.tpl +8 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/command/gina.tpl +4 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/conf/env.json +12 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/conf/manifest.json +2 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/conf/package.json +2 -2
- package/framework/v0.1.2-alpha.2/core/template/conf/statics.json +12 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/conf/templates.json +9 -9
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/console.js +3 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/context.js +233 -75
- package/framework/v0.1.2-alpha.2/helpers/data/LICENSE +9 -0
- package/framework/v0.1.2-alpha.2/helpers/data/README.md +12 -0
- package/framework/v0.1.2-alpha.2/helpers/data/package.json +20 -0
- package/framework/v0.1.2-alpha.2/helpers/data/src/main.js +295 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/dateFormat.js +9 -7
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/index.js +13 -8
- package/framework/v0.1.2-alpha.2/helpers/json/LICENSE +9 -0
- package/framework/v0.1.2-alpha.2/helpers/json/README.md +12 -0
- package/framework/{v0.1.1-alpha.99/helpers/plugins → v0.1.2-alpha.2/helpers/json}/package.json +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/json/src/main.js +33 -28
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/path.js +97 -22
- package/framework/{v0.1.1-alpha.99/helpers/json → v0.1.2-alpha.2/helpers/plugins}/package.json +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/plugins/src/api-error.js +23 -23
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/plugins/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/prototypes.js +46 -38
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/text.js +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/archiver/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/archiver/src/dep/jszip.min.js +3 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/archiver/src/main.js +183 -168
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/aliases.json +4 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/add.js +84 -28
- package/framework/v0.1.2-alpha.2/lib/cmd/bundle/arguments.json +8 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/help.txt +4 -2
- package/framework/v0.1.2-alpha.2/lib/cmd/bundle/list.js +175 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/remove.js +39 -27
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/restart.js +14 -8
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/start.js +283 -49
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/stop.js +93 -74
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/add.js +87 -49
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/list.js +26 -4
- package/framework/{v0.1.1-alpha.99/lib/cmd/scope → v0.1.2-alpha.2/lib/cmd/env}/remove.js +29 -24
- package/framework/v0.1.2-alpha.2/lib/cmd/env/use.js +106 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/build.js +93 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/init.js +932 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/link-node-modules.js +123 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/link.js +137 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/open.js +25 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/restart.js +78 -26
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/set.js +120 -40
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/start.js +49 -20
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/status.js +144 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/stop.js +64 -31
- package/framework/v0.1.2-alpha.2/lib/cmd/framework/tail.js +303 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/version.js +19 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/helper.js +357 -53
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/index.js +23 -23
- package/framework/v0.1.2-alpha.2/lib/cmd/port/inc/scan.js +142 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/port/list.js +464 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/port/reset.js +417 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/add.js +344 -157
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/arguments.json +2 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/build.js +28 -28
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/help.txt +7 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/list.js +22 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/remove.js +19 -17
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/rename.js +11 -11
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/protocol/set.js +260 -211
- package/framework/v0.1.2-alpha.2/lib/cmd/scope/add.js +129 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/scope/help.txt +4 -4
- package/framework/{v0.1.1-alpha.99/lib/cmd/env/use.js → v0.1.2-alpha.2/lib/cmd/scope/link-production.js} +22 -21
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/scope/list.js +34 -11
- package/framework/v0.1.2-alpha.2/lib/cmd/scope/remove.js +122 -0
- package/framework/v0.1.2-alpha.2/lib/cmd/scope/use.js +68 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/view/add.js +35 -10
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/collection/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/collection/src/main.js +247 -244
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/config.js +33 -31
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cron/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cron/src/main.js +16 -11
- package/framework/v0.1.2-alpha.2/lib/domain/LICENSE +9 -0
- package/framework/v0.1.2-alpha.2/lib/domain/README.md +46 -0
- package/framework/v0.1.2-alpha.2/lib/domain/dist/public_suffix_list.dat +14186 -0
- package/framework/v0.1.2-alpha.2/lib/domain/package.json +20 -0
- package/framework/v0.1.2-alpha.2/lib/domain/src/main.js +442 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/generator/index.js +5 -5
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/index.js +3 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2/lib/inherits}/LICENSE +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/README.md +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/package.json +3 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/package.json +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/default/index.js +15 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/file/index.js +109 -14
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/mq/index.js +12 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/mq/listener.js +29 -21
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/mq/speaker.js +33 -4
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/helper.js +22 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/main.js +36 -9
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/math/index.js +9 -9
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/README.md +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/src/main.js +118 -91
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/model.js +10 -10
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/proc.js +92 -49
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/routing/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/routing/src/main.js +377 -420
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/session-store.js +13 -7
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/shell.js +3 -3
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/swig-filters/package.json +1 -1
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/swig-filters/src/main.js +140 -119
- package/framework/v0.1.2-alpha.2/lib/url/README.md +0 -0
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/validator.js +2 -2
- package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/package.json +1 -1
- package/package.json +10 -10
- package/resources/home/main.json +39 -5
- package/resources/home/settings.json +8 -0
- package/resources/package.json.template +1 -1
- package/script/lib.js +0 -0
- package/script/post_install.js +179 -89
- package/script/pre_install.js +95 -12
- package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
- package/services/.gna/arch +1 -0
- package/services/.gna/locals.json +14 -0
- package/services/.gna/platform +1 -0
- package/services/configure +6 -0
- package/services/env.json +18 -0
- package/services/manifest.json +30 -0
- package/services/package.json +11 -0
- package/services/src/proxy/config/app.json +6 -0
- package/services/src/proxy/config/routing.json +11 -0
- package/services/src/proxy/config/settings.json +9 -0
- package/services/src/proxy/config/settings.server.json +31 -0
- package/services/src/proxy/config/statics.json +3 -0
- package/services/src/proxy/controllers/controller.content.js +58 -0
- package/services/src/proxy/controllers/controller.js +30 -0
- package/{framework/v0.1.1-alpha.99/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
- package/services/src/proxy/index.js +31 -0
- package/services/src/proxy/lib/domain/README.md +48 -0
- package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
- package/services/src/toolbar/config/app.json +6 -0
- package/services/src/toolbar/config/routing.json +11 -0
- package/{framework/v0.1.1-alpha.99/core/template/boilerplate/bundle → services/src/toolbar}/config/settings.json +0 -0
- package/services/src/toolbar/config/settings.server.json +30 -0
- package/services/src/toolbar/controllers/controller.content.js +39 -0
- package/services/src/toolbar/controllers/controller.js +30 -0
- package/services/src/toolbar/controllers/setup.js +111 -0
- package/services/src/toolbar/index.js +43 -0
- package/utils/helper.js +25 -156
- package/utils/prototypes.js +9 -9
- package/utils/prototypes.json_clone.js +70 -37
- package/framework/v0.1.1-alpha.99/VERSION +0 -1
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.js.map +0 -56
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.min.js +0 -736
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.min.js.map +0 -56
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
- package/framework/v0.1.1-alpha.99/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/framework/v0.1.1-alpha.99/core/connectors/couchbase/lib/connector.js +0 -20
- package/framework/v0.1.1-alpha.99/core/connectors/couchbase/lib/session-store.js +0 -21
- package/framework/v0.1.1-alpha.99/core/controller/index.js +0 -27
- package/framework/v0.1.1-alpha.99/core/locales/dist/region/en.json +0 -9492
- package/framework/v0.1.1-alpha.99/core/locales/dist/region/fr.json +0 -9492
- package/framework/v0.1.1-alpha.99/core/locales/src/resources/region.mapping.json +0 -28
- package/framework/v0.1.1-alpha.99/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
- package/framework/v0.1.1-alpha.99/core/template/conf/statics.json +0 -10
- package/framework/v0.1.1-alpha.99/lib/cmd/bundle/arguments.json +0 -4
- package/framework/v0.1.1-alpha.99/lib/cmd/bundle/list.js +0 -129
- package/framework/v0.1.1-alpha.99/lib/cmd/env/remove.js +0 -150
- package/framework/v0.1.1-alpha.99/lib/cmd/framework/init.js +0 -541
- package/framework/v0.1.1-alpha.99/lib/cmd/framework/status.js +0 -72
- package/framework/v0.1.1-alpha.99/lib/cmd/framework/tail.js +0 -184
- package/framework/v0.1.1-alpha.99/lib/cmd/port/inc/scan.js +0 -108
- package/framework/v0.1.1-alpha.99/lib/cmd/port/list.js +0 -176
- package/framework/v0.1.1-alpha.99/lib/cmd/scope/set.js +0 -57
- package/framework/v0.1.1-alpha.99/lib/cmd/scope/unset.js +0 -44
- package/framework/v0.1.1-alpha.99/lib/cmd/scope/use.js +0 -79
- package/script/post_publish.js +0 -185
- package/script/prepare_version.js +0 -552
- /package/{framework/v0.1.1-alpha.99/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/AUTHORS +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/html/nolayout.html +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/html/static.html +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/android-chrome-192x192.png +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/android-chrome-512x512.png +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/apple-touch-icon.png +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/favicon-16x16.png +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/favicon-32x32.png +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/asset/img/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.99/core/asset/js → v0.1.2-alpha.2/core/asset}/plugin/uuid.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/controller/controller.framework.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/.travis.yml +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/LICENSE +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/deps/encoding/encoding.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/lib/main.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/lib/types/multipart.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/lib/types/urlencoded.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/lib/utils.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/busboy/package.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/dev/lib/tools.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/currency.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/dist/language/en.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/dist/language/fr.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/src/resources/currency.csv +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/locales/src/resources/region.csv +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/mime.types +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/file/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/file/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/intl/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/intl/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/storage/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/storage/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/validator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/plugins/lib/validator/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/status.codes +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/config/app.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/config/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_public/css/default.css +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_public/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/conf/settings.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/client/json/401.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/client/json/403.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/client/json/404.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/server/html/50x.html +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/server/json/500.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/error/server/json/503.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/core/template/extensions/logger/config.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/helpers/task.js +0 -0
- /package/framework/{v0.1.1-alpha.99/helpers/json → v0.1.2-alpha.2/lib/archiver}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/archiver/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/copy.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/cp.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/rename.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/bundle/status.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/get.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/link-dev.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/set.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/env/unset.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/dot.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/get.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/framework/update.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/gina-dev.1.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/gina-framework.1.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/gina.1.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/port/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/port/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/port/set.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/import.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/move.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/restart.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/start.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/status.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/project/stop.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/protocol/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/protocol/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/protocol/list.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/scope/help.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/scope/link-local.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cmd/scope/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/collection/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/collection/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/cron/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99/lib/archiver/README.md → v0.1.2-alpha.2/lib/domain/exemples/backend.js} +0 -0
- /package/framework/{v0.1.1-alpha.99/lib/routing/README.md → v0.1.2-alpha.2/lib/domain/exemples/frontend.html} +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/example/protected_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/example/simple_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/example/merge.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/example/merge_2_literal objects.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/merge/example/merge_and_preserve_first.js +0 -0
- /package/framework/{v0.1.1-alpha.99/lib/swig-filters → v0.1.2-alpha.2/lib/routing}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/routing/build.json +0 -0
- /package/framework/{v0.1.1-alpha.99/lib/url → v0.1.2-alpha.2/lib/swig-filters}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/url/index.js +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/url/mocks.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/url/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.99 → v0.1.2-alpha.2}/lib/url/test.js +0 -0
|
@@ -15,7 +15,7 @@ if ( typeof(module) !== 'undefined' && module.exports ) {
|
|
|
15
15
|
* @param {object} [options]
|
|
16
16
|
*
|
|
17
17
|
* @returns {object} instance
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* Collection.length will return result length : dont't use .count() which is going to include functions to the count
|
|
20
20
|
*
|
|
21
21
|
* Collection::find
|
|
@@ -23,7 +23,7 @@ if ( typeof(module) !== 'undefined' && module.exports ) {
|
|
|
23
23
|
* eg.: { uid: 'someUID' }
|
|
24
24
|
* eg.: { type: 'not null', country: 'France' } // `AND` clause
|
|
25
25
|
* NB.: To filter `not empty`, use { type: '!=""' }
|
|
26
|
-
* eg.: { country: 'The Hashemite Kingdom of Jordan' }, { country: 'Libanon'} // `OR` clause
|
|
26
|
+
* eg.: { country: 'The Hashemite Kingdom of Jordan' }, { country: 'Libanon'} // `OR` clause
|
|
27
27
|
* eg.: { 'obj.prop': true }
|
|
28
28
|
* eg.: { 'contacts[*].name': 'Doe' } // `WITHIN` (array|collection) clause
|
|
29
29
|
* eg.: { lastUpdate: '>= 2016-12-01T00:00:00' } // also available for date comparison `=`, `<`, `>`
|
|
@@ -48,7 +48,7 @@ function Collection(content, options) {
|
|
|
48
48
|
|
|
49
49
|
var isGFFCtx = ( ( typeof(module) !== 'undefined' ) && module.exports ) ? false : true;
|
|
50
50
|
var uuid = (isGFFCtx) ? require('vendor/uuid') : require('uuid');
|
|
51
|
-
var merge = (isGFFCtx) ? require('
|
|
51
|
+
var merge = (isGFFCtx) ? require('lib/merge') : require('../../../lib/merge');
|
|
52
52
|
|
|
53
53
|
// defined search option rules
|
|
54
54
|
var searchOptionRules = {
|
|
@@ -64,17 +64,17 @@ function Collection(content, options) {
|
|
|
64
64
|
};
|
|
65
65
|
var withOrClause = false;
|
|
66
66
|
var notInSearchModeEnabled = false;
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
var localSearchOptions = null;
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
var defaultOptions = {
|
|
71
71
|
useLocalStorage: false,
|
|
72
72
|
locale: 'en', // TODO - get settigs.region, or user.region
|
|
73
73
|
searchOptionRules: searchOptionRules
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
78
|
options = (typeof(options) == 'object') ? merge(options, defaultOptions) : defaultOptions;
|
|
79
79
|
|
|
80
80
|
var keywords = ['not null']; // TODO - null, exists (`true` if property is defined)
|
|
@@ -93,7 +93,7 @@ function Collection(content, options) {
|
|
|
93
93
|
throw new Error('`new Collection([content] [, options] )`: `content` argument must be an Array !');
|
|
94
94
|
|
|
95
95
|
content = (content) ? JSON.clone(content) : []; // original content -> not to be touched
|
|
96
|
-
|
|
96
|
+
|
|
97
97
|
// Indexing : uuids are generated for each entry
|
|
98
98
|
var searchIndex = [], idx = 0;
|
|
99
99
|
for (var entry = 0, entryLen = content.length; entry < entryLen; ++entry) {
|
|
@@ -106,16 +106,16 @@ function Collection(content, options) {
|
|
|
106
106
|
++idx;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
var instance = content;
|
|
109
|
+
var instance = content;
|
|
110
110
|
/**
|
|
111
111
|
* Set local search option for the current collection method call
|
|
112
|
-
*
|
|
113
|
-
* eg.:
|
|
112
|
+
*
|
|
113
|
+
* eg.:
|
|
114
114
|
* var recCollection = new Collection(arrayCollection);
|
|
115
115
|
* var rec = recCollection
|
|
116
116
|
* .setSearchOption('name', 'isCaseSensitive', false)
|
|
117
117
|
* .find({ city: 'cap Town' });
|
|
118
|
-
*
|
|
118
|
+
*
|
|
119
119
|
* eg.:
|
|
120
120
|
* var recCollection = new Collection(arrayCollection);
|
|
121
121
|
* var searchOptions = {
|
|
@@ -125,64 +125,64 @@ function Collection(content, options) {
|
|
|
125
125
|
* };
|
|
126
126
|
* var rec = recCollection
|
|
127
127
|
* .setSearchOption(searchOptions)
|
|
128
|
-
* .find({ city: 'cap Town' }); *
|
|
129
|
-
*
|
|
128
|
+
* .find({ city: 'cap Town' }); *
|
|
129
|
+
*
|
|
130
130
|
* @param {object|string} searchOptionObject or searchOptionTargetedProperty
|
|
131
131
|
* @param {string} [searchRule]
|
|
132
132
|
* @param {boolean} [searchRuleValue] - true to enable, false to disabled
|
|
133
|
-
*
|
|
133
|
+
*
|
|
134
134
|
* @returns {object} instance with local search options
|
|
135
135
|
*/
|
|
136
136
|
instance['setSearchOption'] = function() {
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
if (!arguments.length)
|
|
139
139
|
throw new Error('searchOption cannot be left blank');
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
if (arguments.length > 3 || arguments.length < 3 && arguments.length > 1)
|
|
142
142
|
throw new Error('argument length mismatch');
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
var i = 0
|
|
145
145
|
, len = arguments.length
|
|
146
146
|
;
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
if (arguments.length == 1) {
|
|
149
149
|
if ( typeof(arguments[0]) != 'object' )
|
|
150
150
|
throw new Error('searchOption must be an object');
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
for (var prop in arguments[0]) {
|
|
153
153
|
if ( typeof(searchOptionRules[prop]) == 'undefined' )
|
|
154
154
|
throw new Error(arguments[1] + ' is not an allowed searchOption !');
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
|
|
157
157
|
localSearchOptions = arguments[0];
|
|
158
158
|
} else {
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
if ( !localSearchOptions )
|
|
161
161
|
localSearchOptions = {};
|
|
162
|
-
|
|
163
|
-
for (; i < len; ++i) {
|
|
162
|
+
|
|
163
|
+
for (; i < len; ++i) {
|
|
164
164
|
if ( typeof(searchOptionRules[arguments[1]]) == 'undefined' )
|
|
165
165
|
throw new Error(arguments[1] + ' is not an allowed searchOption !');
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
if (typeof(localSearchOptions[arguments[0]]) == 'undefined')
|
|
168
168
|
localSearchOptions[arguments[0]] = {};
|
|
169
|
-
|
|
169
|
+
|
|
170
170
|
if ( /true|false/i.test(arguments[2]) ) {
|
|
171
171
|
localSearchOptions[arguments[0]][arguments[1]] = /true/i.test(arguments[2]) ? true : false
|
|
172
172
|
} else {
|
|
173
173
|
localSearchOptions[arguments[0]][arguments[1]] = arguments[2]
|
|
174
|
-
}
|
|
174
|
+
}
|
|
175
175
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
176
|
+
}
|
|
177
|
+
|
|
178
178
|
return instance
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
instance['find'] = function() {
|
|
183
|
-
// reset
|
|
183
|
+
// reset
|
|
184
184
|
withOrClause = false;
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
187
187
|
withOrClause = arguments[arguments.length-1];
|
|
188
188
|
delete arguments[arguments.length-1];
|
|
@@ -197,13 +197,13 @@ function Collection(content, options) {
|
|
|
197
197
|
filters = JSON.parse(filtersStr);
|
|
198
198
|
filtersCount = filters.count();
|
|
199
199
|
} catch( filtersError) {
|
|
200
|
-
throw new Error('filter must be an object\n'+ filtersError.stack);
|
|
201
|
-
}
|
|
202
|
-
|
|
200
|
+
throw new Error('filter must be an object\n'+ filtersError.stack);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
203
|
if ( typeof(filters) != 'undefined' && filtersCount > 0 ) {
|
|
204
|
-
|
|
204
|
+
|
|
205
205
|
if (filtersCount > 1) {
|
|
206
|
-
withOrClause = true;
|
|
206
|
+
withOrClause = true;
|
|
207
207
|
}
|
|
208
208
|
// checking filter : this should be forbidden -> { type: 'red', type: 'orange'}
|
|
209
209
|
// var filtersFields = null;
|
|
@@ -216,7 +216,7 @@ function Collection(content, options) {
|
|
|
216
216
|
// filtersFields[ fField ] = true;
|
|
217
217
|
// }
|
|
218
218
|
// }
|
|
219
|
-
|
|
219
|
+
|
|
220
220
|
var filter = null
|
|
221
221
|
, condition = null
|
|
222
222
|
, i = 0
|
|
@@ -236,13 +236,13 @@ function Collection(content, options) {
|
|
|
236
236
|
var matched = null
|
|
237
237
|
, filterIsArray = null
|
|
238
238
|
, searchResult = [];
|
|
239
|
-
|
|
239
|
+
|
|
240
240
|
/**
|
|
241
241
|
* Regular Search
|
|
242
|
-
* @param {object} filter
|
|
243
|
-
* @param {string} field
|
|
244
|
-
* @param {strine|number|date} _content
|
|
245
|
-
* @param {number} matched
|
|
242
|
+
* @param {object} filter
|
|
243
|
+
* @param {string} field
|
|
244
|
+
* @param {strine|number|date} _content
|
|
245
|
+
* @param {number} matched
|
|
246
246
|
*/
|
|
247
247
|
var search = function(filter, field, _content, matched, searchOptionRules) {
|
|
248
248
|
var reValidCount = null, searchOptCount = null;
|
|
@@ -251,23 +251,23 @@ function Collection(content, options) {
|
|
|
251
251
|
++matched;
|
|
252
252
|
|
|
253
253
|
} else if (
|
|
254
|
-
filter
|
|
255
|
-
&& keywords.indexOf(localeLowerCase) > -1
|
|
256
|
-
&& localeLowerCase == 'not null'
|
|
257
|
-
&& typeof(_content) != 'undefined'
|
|
258
|
-
&& typeof(_content) !== 'object'
|
|
259
|
-
&& _content != 'null'
|
|
254
|
+
filter
|
|
255
|
+
&& keywords.indexOf(localeLowerCase) > -1
|
|
256
|
+
&& localeLowerCase == 'not null'
|
|
257
|
+
&& typeof(_content) != 'undefined'
|
|
258
|
+
&& typeof(_content) !== 'object'
|
|
259
|
+
&& _content != 'null'
|
|
260
260
|
&& _content != 'undefined'
|
|
261
261
|
) {
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
if (result.indexOf(_content) < 0) {
|
|
264
264
|
++matched;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
} else if (
|
|
268
|
-
typeof(_content) != 'undefined'
|
|
269
|
-
&& typeof(_content) !== 'object'
|
|
270
|
-
&& /(<|>|=)/.test(filter)
|
|
267
|
+
} else if (
|
|
268
|
+
typeof(_content) != 'undefined'
|
|
269
|
+
&& typeof(_content) !== 'object'
|
|
270
|
+
&& /(<|>|=)/.test(filter)
|
|
271
271
|
&& !/undefined|function/.test(typeof(_content))
|
|
272
272
|
) { // with operations
|
|
273
273
|
let originalFilter = filter;
|
|
@@ -281,7 +281,7 @@ function Collection(content, options) {
|
|
|
281
281
|
// restoring in case of datetime eval
|
|
282
282
|
filter = originalFilter;
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
|
|
285
285
|
// looking for a datetime ?
|
|
286
286
|
if (
|
|
287
287
|
/(\d{4})\-(\d{2})\-(\d{2})(\s+|T)(\d{2}):(\d{2}):(\d{2})/.test(_content)
|
|
@@ -296,44 +296,44 @@ function Collection(content, options) {
|
|
|
296
296
|
++matched;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
} else if (
|
|
300
|
-
typeof(_content) != 'undefined'
|
|
301
|
-
&& typeof(_content) !== 'object'
|
|
299
|
+
} else if (
|
|
300
|
+
typeof(_content) != 'undefined'
|
|
301
|
+
&& typeof(_content) !== 'object'
|
|
302
302
|
&& _content === filter
|
|
303
303
|
&& !searchOptions
|
|
304
304
|
||
|
|
305
|
-
typeof(_content) != 'undefined'
|
|
306
|
-
&& typeof(_content) !== 'object'
|
|
305
|
+
typeof(_content) != 'undefined'
|
|
306
|
+
&& typeof(_content) !== 'object'
|
|
307
307
|
&& _content === filter
|
|
308
308
|
&& typeof(searchOptions[field]) == 'undefined'
|
|
309
309
|
) {
|
|
310
310
|
|
|
311
311
|
++matched;
|
|
312
|
-
} else if (
|
|
313
|
-
typeof(_content) != 'undefined'
|
|
314
|
-
&& typeof(_content) !== 'object'
|
|
312
|
+
} else if (
|
|
313
|
+
typeof(_content) != 'undefined'
|
|
314
|
+
&& typeof(_content) !== 'object'
|
|
315
315
|
&& searchOptions
|
|
316
316
|
&& typeof(searchOptions[field]) != 'undefined'
|
|
317
317
|
) {
|
|
318
|
-
|
|
318
|
+
|
|
319
319
|
reValidCount = 0;
|
|
320
320
|
searchOptCount = searchOptions[field].count();
|
|
321
321
|
for ( var rule in searchOptions[field]) {
|
|
322
322
|
searchOptionRules[rule][searchOptions[field][rule]].re = searchOptionRules[rule][searchOptions[field][rule]].re.replace(/\%s/, filter);
|
|
323
|
-
|
|
323
|
+
|
|
324
324
|
if (searchOptionRules[rule][searchOptions[field][rule]].modifiers) {
|
|
325
|
-
re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re, searchOptionRules[rule][searchOptions[field][rule]].modifiers);
|
|
325
|
+
re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re, searchOptionRules[rule][searchOptions[field][rule]].modifiers);
|
|
326
326
|
} else {
|
|
327
327
|
re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re);
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
|
|
330
330
|
if ( re.test(_content) ) {
|
|
331
331
|
++reValidCount
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
|
|
335
335
|
if (reValidCount == searchOptCount) {
|
|
336
|
-
++matched;
|
|
336
|
+
++matched;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -347,26 +347,26 @@ function Collection(content, options) {
|
|
|
347
347
|
var field = f.split(/\./g);
|
|
348
348
|
field = field[field.length - 1];
|
|
349
349
|
re = new RegExp('("' + field + '":\\w+)');
|
|
350
|
-
|
|
350
|
+
|
|
351
351
|
var value = null;
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
try {
|
|
354
354
|
if ( _content )
|
|
355
355
|
value = eval('_content.'+f);
|
|
356
356
|
} catch (err) {
|
|
357
357
|
// Nothing to do
|
|
358
358
|
// means that the field is not available in the collection
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
362
|
|
|
363
363
|
if (value /** && value.length > 0*/) {
|
|
364
364
|
if ( Array.isArray(value) )
|
|
365
365
|
value = value[1].split(/:/)[1];
|
|
366
366
|
else if ( typeof(value) == 'string' && /\:/.test(value) )
|
|
367
367
|
value = value.split(/:/)[1];
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
|
|
369
|
+
|
|
370
370
|
if (/(<|>|=)/.test(filter)) {
|
|
371
371
|
|
|
372
372
|
// looking for a datetime ?
|
|
@@ -391,7 +391,7 @@ function Collection(content, options) {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
}
|
|
394
|
+
}
|
|
395
395
|
|
|
396
396
|
return {
|
|
397
397
|
matched: matched
|
|
@@ -400,25 +400,25 @@ function Collection(content, options) {
|
|
|
400
400
|
|
|
401
401
|
// if one of the entry matches the given filter, tag the whole entry as matched
|
|
402
402
|
var searchWithin = function(filter, f, _content, matched, i) {
|
|
403
|
-
|
|
403
|
+
|
|
404
404
|
var collectionName = null
|
|
405
405
|
, collection = null
|
|
406
406
|
, arr = null
|
|
407
407
|
, field = null;
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
|
|
410
410
|
arr = f.split(/\[\*\]/g);
|
|
411
411
|
collectionName = arr[0].replace(/\[\*\]/, '');// only take the first collection
|
|
412
412
|
collection = _content[ collectionName ];
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
|
|
414
|
+
|
|
415
415
|
field = arr[1];
|
|
416
416
|
if (/^\./.test(field) )
|
|
417
417
|
field = field.substr(1);
|
|
418
418
|
|
|
419
419
|
var subMatched = 0;
|
|
420
420
|
if (collection) {
|
|
421
|
-
|
|
421
|
+
|
|
422
422
|
for (var c = 0, cLen = collection.length; c < cLen; ++c) {
|
|
423
423
|
// cases with _filter.prop
|
|
424
424
|
if (/\./.test(field)) {
|
|
@@ -435,32 +435,32 @@ function Collection(content, options) {
|
|
|
435
435
|
if (subMatched > 0) break;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
|
|
438
|
+
|
|
439
439
|
return {
|
|
440
440
|
matched: (matched + subMatched)
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
|
|
444
|
+
|
|
445
445
|
for (var o in tmpContent) {
|
|
446
446
|
|
|
447
447
|
if (!tmpContent[o]) {
|
|
448
448
|
tmpContent[o] = {}
|
|
449
449
|
}
|
|
450
|
-
|
|
450
|
+
|
|
451
451
|
if (!/undefined|function/.test( typeof(tmpContent[o]))) {
|
|
452
|
-
|
|
452
|
+
|
|
453
453
|
for (let l = 0, lLen = filters.count(); l<lLen; ++l) {
|
|
454
454
|
filter = filters[l];
|
|
455
455
|
condition = filter.count();
|
|
456
|
-
// for each condition
|
|
456
|
+
// for each condition
|
|
457
457
|
matched = 0;
|
|
458
|
-
|
|
458
|
+
|
|
459
459
|
for (var f in filter) {
|
|
460
460
|
if ( typeof(filter[f]) == 'undefined' ) throw new Error('filter `'+f+'` cannot be left undefined');
|
|
461
461
|
|
|
462
462
|
localeLowerCase = ( filter[f] !== null && !/(boolean|number)/.test(typeof(filter[f])) ) ? filter[f].toLocaleLowerCase() : filter[f];
|
|
463
|
-
|
|
463
|
+
|
|
464
464
|
// cases with tmpContent.prop
|
|
465
465
|
if (/\./.test(f)) {
|
|
466
466
|
//JSON.stringify(tmpContent[o]).match(/("gross":\w+)/)[1].split(/:/)[1]
|
|
@@ -478,19 +478,19 @@ function Collection(content, options) {
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
} else { // normal case
|
|
481
|
-
|
|
482
|
-
searchResult = search(filter[f], f, tmpContent[o][f], matched, searchOptionRules);
|
|
481
|
+
|
|
482
|
+
searchResult = search(filter[f], f, tmpContent[o][f], matched, searchOptionRules);
|
|
483
483
|
matched = searchResult.matched;
|
|
484
|
-
}
|
|
484
|
+
}
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
if (matched == condition ) { // all conditions must be fulfilled to match
|
|
488
488
|
// `this` {Array} is the result of the previous search or the current content
|
|
489
|
-
// TODO - Add a switch
|
|
489
|
+
// TODO - Add a switch
|
|
490
490
|
if (
|
|
491
|
-
withOrClause
|
|
491
|
+
withOrClause
|
|
492
492
|
&& notInSearchModeEnabled
|
|
493
|
-
&& searchIndex.indexOf(tmpContent[o]._uuid) < 0
|
|
493
|
+
&& searchIndex.indexOf(tmpContent[o]._uuid) < 0
|
|
494
494
|
|| notInSearchModeEnabled
|
|
495
495
|
|| !withOrClause
|
|
496
496
|
) {
|
|
@@ -506,12 +506,12 @@ function Collection(content, options) {
|
|
|
506
506
|
if (result.indexOf(tmpContent[o]._uuid) < 0) {
|
|
507
507
|
result[i] = tmpContent[o];
|
|
508
508
|
++i;
|
|
509
|
-
}
|
|
509
|
+
}
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
}
|
|
514
|
-
|
|
514
|
+
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
} else {
|
|
@@ -520,7 +520,7 @@ function Collection(content, options) {
|
|
|
520
520
|
|
|
521
521
|
// reset localSearchOptions for nest calls
|
|
522
522
|
localSearchOptions = null;
|
|
523
|
-
|
|
523
|
+
|
|
524
524
|
// TODO - remove this
|
|
525
525
|
//if (withOrClause) {
|
|
526
526
|
// merging with previous result
|
|
@@ -530,13 +530,13 @@ function Collection(content, options) {
|
|
|
530
530
|
// }
|
|
531
531
|
// TODO - remove this part
|
|
532
532
|
// Removed this on 2021-01-21 because it was causing duplicate content
|
|
533
|
-
//result = merge(this, result, true)
|
|
533
|
+
//result = merge(this, result, true)
|
|
534
534
|
//}
|
|
535
535
|
|
|
536
536
|
// chaining
|
|
537
537
|
//result._options = instance._options;
|
|
538
538
|
//result.setSearchOption = instance.setSearchOption;
|
|
539
|
-
|
|
539
|
+
|
|
540
540
|
result.insert = instance.insert;
|
|
541
541
|
result.notIn = instance.notIn;
|
|
542
542
|
result.find = this.find;
|
|
@@ -552,24 +552,24 @@ function Collection(content, options) {
|
|
|
552
552
|
|
|
553
553
|
return result
|
|
554
554
|
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
557
|
* findOne
|
|
558
|
-
*
|
|
559
|
-
* E.g.:
|
|
558
|
+
*
|
|
559
|
+
* E.g.:
|
|
560
560
|
* - new Collection(projects).findOne({name: 'My Project'})
|
|
561
561
|
* - new Collection(projects)
|
|
562
562
|
* .setSearchOption({name: { isCaseSensitive: false }})
|
|
563
563
|
* .findOne({name: 'my project'})
|
|
564
|
-
*
|
|
565
|
-
*
|
|
564
|
+
*
|
|
565
|
+
*
|
|
566
566
|
* Available options :
|
|
567
567
|
* isCaseSensitive: [true|false] - set to true by default
|
|
568
|
-
*
|
|
568
|
+
*
|
|
569
569
|
* @param {object} filter
|
|
570
|
-
*
|
|
570
|
+
*
|
|
571
571
|
* @returns {object} result
|
|
572
|
-
*
|
|
572
|
+
*
|
|
573
573
|
*/
|
|
574
574
|
instance['findOne'] = function() {
|
|
575
575
|
var key = null // comparison key
|
|
@@ -583,17 +583,17 @@ function Collection(content, options) {
|
|
|
583
583
|
delete arguments[arguments.length - 1];
|
|
584
584
|
--arguments.length;
|
|
585
585
|
}
|
|
586
|
-
|
|
586
|
+
|
|
587
587
|
// if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
588
588
|
// uuidSearchModeEnabled = arguments[arguments.length - 1]
|
|
589
589
|
// delete arguments[arguments.length - 1];
|
|
590
590
|
// --arguments.length;
|
|
591
591
|
// }
|
|
592
|
-
|
|
592
|
+
|
|
593
593
|
if (arguments.length > 0) {
|
|
594
594
|
filters = arguments;
|
|
595
595
|
}
|
|
596
|
-
|
|
596
|
+
|
|
597
597
|
|
|
598
598
|
if ( typeof(filters) == 'undefined' || !filters || typeof(filters) != 'object' ) {
|
|
599
599
|
throw new Error('[ Collection ][ findOne ] `filters` argument must be defined: Array or Filter Object(s) expected');
|
|
@@ -608,9 +608,9 @@ function Collection(content, options) {
|
|
|
608
608
|
} else {
|
|
609
609
|
foundResults = instance.find.apply(this, arguments) || [];
|
|
610
610
|
}
|
|
611
|
-
|
|
611
|
+
|
|
612
612
|
if (foundResults.length > 0) {
|
|
613
|
-
currentResult = foundResults.limit(1).toRaw()[0];
|
|
613
|
+
currentResult = foundResults.limit(1).toRaw()[0];
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
result = currentResult;
|
|
@@ -649,31 +649,31 @@ function Collection(content, options) {
|
|
|
649
649
|
|
|
650
650
|
return result
|
|
651
651
|
}
|
|
652
|
-
|
|
653
|
-
/**
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
654
|
* notIn
|
|
655
655
|
* Works like a filter to match results by `excluding` through given `filters` !!
|
|
656
|
-
*
|
|
657
|
-
* filter can be like
|
|
656
|
+
*
|
|
657
|
+
* filter can be like
|
|
658
658
|
* { car: 'toyota' }
|
|
659
659
|
* { car: 'toyota', color: 'red' }
|
|
660
|
-
*
|
|
660
|
+
*
|
|
661
661
|
* You can pass more than one filter
|
|
662
662
|
* { car: 'toyota', color: 'red' }, { car: 'porche' }
|
|
663
|
-
*
|
|
663
|
+
*
|
|
664
664
|
* .notIn(filter) // AND syntax
|
|
665
665
|
* .notIn(filter1, filter2, filter3) // OR syntax
|
|
666
666
|
* .notIn(filter, 'id') where `id` is the uuid used for the DIFF - `_uuid
|
|
667
667
|
* .noIn(collectionObj, 'id')
|
|
668
|
-
*
|
|
668
|
+
*
|
|
669
669
|
* By default, Collection use its own internal `_uuid` to search and compare.
|
|
670
670
|
* This mode is called `uuidSearchModeEnabled`, and it is by default set to `true`.
|
|
671
671
|
* If you want to disable this mode in order to MATCH/DIFF by forcing check on every single filter
|
|
672
672
|
* of the resultset :
|
|
673
673
|
* .notIn(filter, false) where false must be a real boolean
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
674
|
+
*
|
|
675
|
+
*
|
|
676
|
+
*
|
|
677
677
|
* @param {object|array} filters|arrayToFilter - works like find filterss
|
|
678
678
|
* @param {string} [key] - unique id for comparison; faster when provided
|
|
679
679
|
*/
|
|
@@ -691,17 +691,17 @@ function Collection(content, options) {
|
|
|
691
691
|
delete arguments[arguments.length - 1];
|
|
692
692
|
--arguments.length;
|
|
693
693
|
}
|
|
694
|
-
|
|
694
|
+
|
|
695
695
|
if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
696
696
|
uuidSearchModeEnabled = arguments[arguments.length - 1]
|
|
697
697
|
delete arguments[arguments.length - 1];
|
|
698
698
|
--arguments.length;
|
|
699
699
|
}
|
|
700
|
-
|
|
700
|
+
|
|
701
701
|
if (arguments.length > 0) {
|
|
702
702
|
filters = arguments;
|
|
703
703
|
}
|
|
704
|
-
|
|
704
|
+
|
|
705
705
|
|
|
706
706
|
if ( typeof(filters) == 'undefined' || !filters || typeof(filters) != 'object' ) {
|
|
707
707
|
throw new Error('[ Collection ][ notIn ] `filters` argument must be defined: Array or Filter Object(s) expected');
|
|
@@ -709,7 +709,7 @@ function Collection(content, options) {
|
|
|
709
709
|
|
|
710
710
|
// If an operation (find, insert ...) has been executed, get the previous result; if not, get the whole collection
|
|
711
711
|
var currentResult = JSON.clone( (Array.isArray(this)) ? this : content );
|
|
712
|
-
|
|
712
|
+
|
|
713
713
|
var foundResults = null;
|
|
714
714
|
if ( Array.isArray(arguments[0]) ) {
|
|
715
715
|
foundResults = arguments[0];
|
|
@@ -718,16 +718,16 @@ function Collection(content, options) {
|
|
|
718
718
|
foundResults = instance.find.apply(this, arguments) || [];
|
|
719
719
|
notInSearchModeEnabled = false;
|
|
720
720
|
}
|
|
721
|
-
|
|
722
|
-
|
|
721
|
+
|
|
722
|
+
|
|
723
723
|
if (foundResults.length > 0) {
|
|
724
|
-
|
|
724
|
+
|
|
725
725
|
// check key
|
|
726
|
-
if (
|
|
726
|
+
if (
|
|
727
727
|
uuidSearchModeEnabled
|
|
728
|
-
&& key
|
|
729
|
-
&& typeof(foundResults[0]) == 'undefined'
|
|
730
|
-
&& typeof(foundResults[0][key]) == 'undefined'
|
|
728
|
+
&& key
|
|
729
|
+
&& typeof(foundResults[0]) == 'undefined'
|
|
730
|
+
&& typeof(foundResults[0][key]) == 'undefined'
|
|
731
731
|
) {
|
|
732
732
|
throw new Error('[ Collection ][ notIn ] `key` not valid');
|
|
733
733
|
} else if ( uuidSearchModeEnabled && !key && typeof(foundResults[0]['_uuid']) != 'undefined' ) {
|
|
@@ -735,10 +735,10 @@ function Collection(content, options) {
|
|
|
735
735
|
} else if ( typeof(foundResults[0]['id']) != 'undefined' ) {
|
|
736
736
|
key = 'id';
|
|
737
737
|
}
|
|
738
|
-
|
|
738
|
+
|
|
739
739
|
if ( !key || typeof(foundResults[0][key]) == 'undefined' ) {
|
|
740
740
|
throw new Error('No comparison key defined !')
|
|
741
|
-
}
|
|
741
|
+
}
|
|
742
742
|
|
|
743
743
|
// fast search with key
|
|
744
744
|
var r = 0
|
|
@@ -752,17 +752,17 @@ function Collection(content, options) {
|
|
|
752
752
|
, fullFiltersMatched = 0
|
|
753
753
|
;
|
|
754
754
|
if ( uuidSearchModeEnabled && typeof(currentResult[c]) != 'undefined' && currentResult[c].hasOwnProperty(key) ) {
|
|
755
|
-
// for every single result found
|
|
755
|
+
// for every single result found
|
|
756
756
|
for (; r < rLen; ++r) {
|
|
757
|
-
|
|
757
|
+
|
|
758
758
|
if (!currentResult.length) break;
|
|
759
|
-
|
|
759
|
+
|
|
760
760
|
c = 0; cLen = currentResult.length;
|
|
761
761
|
for (; c < cLen; ++c) {
|
|
762
762
|
if ( typeof(currentResult[c]) == 'undefined' || typeof(foundResults[r]) == 'undefined' ) {
|
|
763
763
|
continue
|
|
764
764
|
}
|
|
765
|
-
// when matched, we want to remove those not in current result
|
|
765
|
+
// when matched, we want to remove those not in current result
|
|
766
766
|
if (currentResult[c][key] === foundResults[r][key]) {
|
|
767
767
|
currentResult.splice(c,1);
|
|
768
768
|
break;
|
|
@@ -772,48 +772,48 @@ function Collection(content, options) {
|
|
|
772
772
|
} else if ( typeof(currentResult[c]) == 'undefined' ) { //empty source case
|
|
773
773
|
// means that since we don't have a source to compare, current === found
|
|
774
774
|
currentResult = JSON.clone(foundResults);
|
|
775
|
-
|
|
775
|
+
|
|
776
776
|
} else { // search based on provided filters
|
|
777
|
-
// for every single result found
|
|
777
|
+
// for every single result found
|
|
778
778
|
for (; r < rLen; ++r) {
|
|
779
|
-
if (!currentResult.length) break;
|
|
780
|
-
|
|
779
|
+
if (!currentResult.length) break;
|
|
780
|
+
|
|
781
781
|
//onRemoved:
|
|
782
782
|
c = 0; cLen = currentResult.length;
|
|
783
|
-
for (; c < cLen; ++c) { // current results
|
|
784
|
-
|
|
783
|
+
for (; c < cLen; ++c) { // current results
|
|
784
|
+
|
|
785
785
|
if ( typeof (currentResult[c]) != 'undefined' ) {
|
|
786
|
-
|
|
786
|
+
|
|
787
787
|
// for each filter
|
|
788
|
-
fullFiltersMatched = 0;
|
|
789
|
-
f = 0;
|
|
788
|
+
fullFiltersMatched = 0;
|
|
789
|
+
f = 0;
|
|
790
790
|
for (; f < fLen; ++f ) {
|
|
791
791
|
if ( typeof(filters[f]) == 'undefined' ) throw new Error('filter `'+f+'` cannot be left undefined');
|
|
792
|
-
|
|
792
|
+
|
|
793
793
|
keyLen = filters[f].count();
|
|
794
794
|
matched = 0;
|
|
795
795
|
for (key in filters[f]) {
|
|
796
796
|
if ( currentResult[c].hasOwnProperty(key) && currentResult[c][key] === foundResults[r][key] ) {
|
|
797
797
|
++matched;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
800
|
if (matched == keyLen) {
|
|
801
801
|
++fullFiltersMatched
|
|
802
|
-
}
|
|
802
|
+
}
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
|
|
805
805
|
if (fullFiltersMatched) {
|
|
806
806
|
currentResult.splice(c,1);
|
|
807
807
|
//break onRemoved;
|
|
808
808
|
break;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
}
|
|
817
817
|
|
|
818
818
|
result = currentResult;
|
|
819
819
|
result.notIn = instance.notIn;
|
|
@@ -866,12 +866,12 @@ function Collection(content, options) {
|
|
|
866
866
|
|
|
867
867
|
/**
|
|
868
868
|
* update
|
|
869
|
-
*
|
|
869
|
+
*
|
|
870
870
|
* @param {object} filter
|
|
871
871
|
* @param {object} set
|
|
872
|
-
*
|
|
872
|
+
*
|
|
873
873
|
* @returns {objet} instance
|
|
874
|
-
*/
|
|
874
|
+
*/
|
|
875
875
|
instance['update'] = function() {
|
|
876
876
|
var key = '_uuid' // comparison key is _uuid by default
|
|
877
877
|
, result = null
|
|
@@ -880,34 +880,34 @@ function Collection(content, options) {
|
|
|
880
880
|
//, uuidSearchModeEnabled = true
|
|
881
881
|
;
|
|
882
882
|
|
|
883
|
-
// comparison key : _uuid by default, but can be set to id
|
|
883
|
+
// comparison key : _uuid by default, but can be set to id
|
|
884
884
|
if ( typeof(arguments[arguments.length-1]) == 'string' ) {
|
|
885
885
|
key = arguments[arguments.length - 1];
|
|
886
886
|
delete arguments[arguments.length - 1];
|
|
887
887
|
--arguments.length;
|
|
888
|
-
}
|
|
889
|
-
|
|
888
|
+
}
|
|
889
|
+
|
|
890
890
|
if ( typeof(arguments[arguments.length-1]) == 'object' ) {
|
|
891
891
|
set = arguments[arguments.length - 1];
|
|
892
892
|
delete arguments[arguments.length - 1];
|
|
893
893
|
--arguments.length
|
|
894
894
|
}
|
|
895
|
-
|
|
895
|
+
|
|
896
896
|
// if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
897
897
|
// uuidSearchModeEnabled = arguments[arguments.length - 1]
|
|
898
898
|
// delete arguments[arguments.length - 1];
|
|
899
899
|
// --arguments.length;
|
|
900
900
|
// }
|
|
901
|
-
|
|
901
|
+
|
|
902
902
|
if (arguments.length > 0) {
|
|
903
903
|
filters = arguments;
|
|
904
904
|
}
|
|
905
|
-
|
|
905
|
+
|
|
906
906
|
|
|
907
907
|
if ( typeof(filters) == 'undefined' || !filters || typeof(filters) != 'object' ) {
|
|
908
908
|
throw new Error('[ Collection ][ update ] `filters` argument must be defined: Array or Filter Object(s) expected');
|
|
909
909
|
}
|
|
910
|
-
|
|
910
|
+
|
|
911
911
|
if ( typeof(set) == 'undefined' || !set || typeof(set) != 'object' ) {
|
|
912
912
|
throw new Error('[ Collection ][ update ] `set` argument must be defined: Object expected');
|
|
913
913
|
}
|
|
@@ -919,23 +919,24 @@ function Collection(content, options) {
|
|
|
919
919
|
} else {
|
|
920
920
|
foundResults = instance.find.apply(this, arguments) || [];
|
|
921
921
|
}
|
|
922
|
-
|
|
922
|
+
|
|
923
923
|
result = Array.isArray(this) ? this : JSON.clone(content);
|
|
924
|
-
if (foundResults.length > 0 ) {
|
|
924
|
+
if (foundResults.length > 0 ) {
|
|
925
925
|
var arr = foundResults.toRaw();
|
|
926
|
-
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
927
|
-
arr[a] = merge(
|
|
926
|
+
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
927
|
+
arr[a] = merge(JSON.clone(set), arr[a]);
|
|
928
|
+
// arr[a] = merge(set, arr[a]);
|
|
928
929
|
for (var r = 0, rLen = result.length; r < rLen; ++r) {
|
|
929
930
|
if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
|
|
930
931
|
key = 'id';
|
|
931
932
|
}
|
|
932
|
-
|
|
933
|
+
|
|
933
934
|
if ( result[r][key] == arr[a][key] ) {
|
|
934
935
|
result[r] = arr[a];
|
|
935
936
|
break;
|
|
936
937
|
}
|
|
937
938
|
}
|
|
938
|
-
}
|
|
939
|
+
}
|
|
939
940
|
}
|
|
940
941
|
|
|
941
942
|
// chaining
|
|
@@ -954,8 +955,8 @@ function Collection(content, options) {
|
|
|
954
955
|
|
|
955
956
|
return result
|
|
956
957
|
}
|
|
957
|
-
|
|
958
|
-
|
|
958
|
+
|
|
959
|
+
|
|
959
960
|
instance['replace'] = function() {
|
|
960
961
|
var key = '_uuid' // comparison key
|
|
961
962
|
, result = null
|
|
@@ -964,34 +965,34 @@ function Collection(content, options) {
|
|
|
964
965
|
//, uuidSearchModeEnabled = true
|
|
965
966
|
;
|
|
966
967
|
|
|
967
|
-
|
|
968
|
+
|
|
968
969
|
if ( typeof(arguments[arguments.length-1]) == 'string' ) {
|
|
969
970
|
key = arguments[arguments.length - 1];
|
|
970
971
|
delete arguments[arguments.length - 1];
|
|
971
972
|
--arguments.length;
|
|
972
|
-
}
|
|
973
|
-
|
|
973
|
+
}
|
|
974
|
+
|
|
974
975
|
if ( typeof(arguments[arguments.length-1]) == 'object' ) {
|
|
975
976
|
set = arguments[arguments.length - 1];
|
|
976
977
|
delete arguments[arguments.length - 1];
|
|
977
978
|
--arguments.length;
|
|
978
979
|
}
|
|
979
|
-
|
|
980
|
+
|
|
980
981
|
// if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
981
982
|
// uuidSearchModeEnabled = arguments[arguments.length - 1]
|
|
982
983
|
// delete arguments[arguments.length - 1];
|
|
983
984
|
// --arguments.length;
|
|
984
985
|
// }
|
|
985
|
-
|
|
986
|
+
|
|
986
987
|
if (arguments.length > 0) {
|
|
987
988
|
filters = arguments;
|
|
988
989
|
}
|
|
989
|
-
|
|
990
|
+
|
|
990
991
|
|
|
991
992
|
if ( typeof(filters) == 'undefined' || !filters || typeof(filters) != 'object' ) {
|
|
992
993
|
throw new Error('[ Collection ][ update ] `filters` argument must be defined: Array or Filter Object(s) expected');
|
|
993
994
|
}
|
|
994
|
-
|
|
995
|
+
|
|
995
996
|
if ( typeof(set) == 'undefined' || !set || typeof(set) != 'object' ) {
|
|
996
997
|
throw new Error('[ Collection ][ update ] `set` argument must be defined: Object expected');
|
|
997
998
|
}
|
|
@@ -1005,25 +1006,25 @@ function Collection(content, options) {
|
|
|
1005
1006
|
} else {
|
|
1006
1007
|
foundResults = instance.find.apply(this, arguments) || [];
|
|
1007
1008
|
}
|
|
1008
|
-
|
|
1009
|
+
|
|
1009
1010
|
result = Array.isArray(this) ? this : JSON.clone(content);
|
|
1010
|
-
if (foundResults.length > 0 ) {
|
|
1011
|
+
if (foundResults.length > 0 ) {
|
|
1011
1012
|
var arr = foundResults.toRaw();
|
|
1012
|
-
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
1013
|
+
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
1013
1014
|
arr[a] = JSON.clone(set);
|
|
1014
1015
|
for (var r = 0, rLen = result.length; r < rLen; ++r) {
|
|
1015
1016
|
if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
|
|
1016
1017
|
key = 'id';
|
|
1017
1018
|
} else if (typeof(result[r][key]) == 'undefined' && key == '_uuid') {
|
|
1018
1019
|
throw new Error('No comparison key defined !')
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1021
1022
|
if ( result[r][key] == arr[a][key] ) {
|
|
1022
1023
|
result[r] = arr[a];
|
|
1023
1024
|
break;
|
|
1024
1025
|
}
|
|
1025
1026
|
}
|
|
1026
|
-
}
|
|
1027
|
+
}
|
|
1027
1028
|
}
|
|
1028
1029
|
|
|
1029
1030
|
// chaining
|
|
@@ -1042,24 +1043,24 @@ function Collection(content, options) {
|
|
|
1042
1043
|
|
|
1043
1044
|
return result
|
|
1044
1045
|
}
|
|
1045
|
-
|
|
1046
|
+
|
|
1046
1047
|
/**
|
|
1047
1048
|
* .delete({ key: 2 })
|
|
1048
1049
|
* .delete({ name: 'Jordan' }, ''id) where id will be use as the `uuid` to compare records
|
|
1049
|
-
*
|
|
1050
|
+
*
|
|
1050
1051
|
* AND syntax
|
|
1051
1052
|
* .delete({ car: 'toyota', color: 'red' })
|
|
1052
|
-
*
|
|
1053
|
+
*
|
|
1053
1054
|
* OR syntax
|
|
1054
1055
|
* .delete({ car: 'toyota', color: red }, { car: 'ford' } ) // will delete all `toyota red cars` & all `ford cars`
|
|
1055
|
-
*
|
|
1056
|
+
*
|
|
1056
1057
|
* N.B.: will not affect current result - just returning the DIFF
|
|
1057
1058
|
* If you
|
|
1058
1059
|
* @param {object} filter - samme as `.find(filter)`
|
|
1059
1060
|
* @param {string|boolean} [ uuid | disabled ] - by default, Collection is using its internal _uuid
|
|
1060
1061
|
* If you want to delete without key comparison, disable `uuid` search mode
|
|
1061
1062
|
* .delete({ name: 'Jordan' }, false)
|
|
1062
|
-
*
|
|
1063
|
+
*
|
|
1063
1064
|
* @returns {array} result
|
|
1064
1065
|
*/
|
|
1065
1066
|
instance['delete'] = function() {
|
|
@@ -1090,10 +1091,10 @@ function Collection(content, options) {
|
|
|
1090
1091
|
* @param {object|array} filter
|
|
1091
1092
|
* */
|
|
1092
1093
|
instance['orderBy'] = function () {
|
|
1093
|
-
|
|
1094
|
+
|
|
1094
1095
|
if ( typeof(arguments) == 'undefined' || arguments.length < 1)
|
|
1095
1096
|
throw new Error('[ Collection->orderBy(filter) ] where `filter` must not be empty or null' );
|
|
1096
|
-
|
|
1097
|
+
|
|
1097
1098
|
var filter = null;
|
|
1098
1099
|
if ( arguments.length == 1 ) {
|
|
1099
1100
|
filter = arguments[0];
|
|
@@ -1108,27 +1109,27 @@ function Collection(content, options) {
|
|
|
1108
1109
|
var variableContent = (Array.isArray(this)) ? this : JSON.clone(content);
|
|
1109
1110
|
return sortResult(filter, variableContent.toRaw())
|
|
1110
1111
|
}
|
|
1111
|
-
|
|
1112
|
+
|
|
1112
1113
|
/**
|
|
1113
1114
|
* max
|
|
1114
|
-
* E.g:
|
|
1115
|
+
* E.g:
|
|
1115
1116
|
* myCollection.max({ order: 'not null'})
|
|
1116
1117
|
* => 5
|
|
1117
1118
|
* myCollection.max({ createAt: 'not null'})
|
|
1118
1119
|
* => '2021-12-31T23:59:59'
|
|
1119
1120
|
* myCollection.max({ firstName: 'not null'})
|
|
1120
1121
|
* => 'Zora'
|
|
1121
|
-
*
|
|
1122
|
+
*
|
|
1122
1123
|
* @param {object|array} filter
|
|
1123
|
-
*
|
|
1124
|
+
*
|
|
1124
1125
|
* @returns {number|date|string}
|
|
1125
1126
|
* */
|
|
1126
1127
|
instance['max'] = function () {
|
|
1127
1128
|
if ( typeof(arguments) == 'undefined' || arguments.length < 1)
|
|
1128
1129
|
throw new Error('[ Collection->max(filter) ] where `filter` must not be empty or null' );
|
|
1129
|
-
|
|
1130
|
+
|
|
1130
1131
|
var filter = null;
|
|
1131
|
-
if (
|
|
1132
|
+
if (
|
|
1132
1133
|
arguments.length > 1
|
|
1133
1134
|
|| Array.isArray(arguments[0])
|
|
1134
1135
|
|| typeof(arguments[0]) == 'object' && arguments[0].count() > 1
|
|
@@ -1157,11 +1158,11 @@ function Collection(content, options) {
|
|
|
1157
1158
|
*
|
|
1158
1159
|
* // overriding filters -> last filter is always right
|
|
1159
1160
|
* .orderBy([ { updatedAt : 'desc'}, { name: 'asc' } ])
|
|
1160
|
-
*
|
|
1161
|
-
* // sorting boolean
|
|
1161
|
+
*
|
|
1162
|
+
* // sorting boolean
|
|
1162
1163
|
* .orderBy({ isActive: 'desc'}) => will display all active(TRUE) first
|
|
1163
1164
|
* NB.: Boolean are 0 (FALSE) or 1 (TRUE)
|
|
1164
|
-
*
|
|
1165
|
+
*
|
|
1165
1166
|
* // combining filters -> the first one is always right
|
|
1166
1167
|
* .orderBy({ updatedAt : 'desc'}, { name: 'asc' })
|
|
1167
1168
|
*
|
|
@@ -1193,33 +1194,33 @@ function Collection(content, options) {
|
|
|
1193
1194
|
_m[prop] = obj[prop];
|
|
1194
1195
|
return _m;
|
|
1195
1196
|
});
|
|
1196
|
-
|
|
1197
|
-
mapped.sort(function onAscSort(a, b) {
|
|
1198
|
-
|
|
1199
|
-
|
|
1197
|
+
|
|
1198
|
+
mapped.sort(function onAscSort(a, b) {
|
|
1199
|
+
|
|
1200
|
+
|
|
1200
1201
|
var _compare = function(a, b) {
|
|
1201
1202
|
// handle booleans
|
|
1202
1203
|
if ( /^(true|false)$/i.test(a) ) {
|
|
1203
1204
|
a = ( /true/i.test(a) ) ? 1 : 0;
|
|
1204
1205
|
}
|
|
1205
|
-
|
|
1206
|
+
|
|
1206
1207
|
if ( /^(true|false)$/i.test(b) ) {
|
|
1207
1208
|
b = ( /true/i.test(b) ) ? 1 : 0;
|
|
1208
1209
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1210
|
+
|
|
1211
|
+
|
|
1211
1212
|
if ( typeof(a) == 'string' && a != '' || typeof(b) == 'string' ) {
|
|
1212
|
-
|
|
1213
|
+
|
|
1213
1214
|
if ( typeof(a) == 'number' ) {
|
|
1214
1215
|
a = ''+a; // cast to string
|
|
1215
|
-
}
|
|
1216
|
+
}
|
|
1216
1217
|
if ( typeof(b) == 'number' ) {
|
|
1217
1218
|
b = ''+b; // cast to string
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1220
1221
|
return a.localeCompare(b, undefined, {sensitivity: 'case', caseFirst: 'upper'})
|
|
1221
1222
|
}
|
|
1222
|
-
|
|
1223
|
+
|
|
1223
1224
|
if (a > b) {
|
|
1224
1225
|
return 1;
|
|
1225
1226
|
}
|
|
@@ -1227,18 +1228,18 @@ function Collection(content, options) {
|
|
|
1227
1228
|
return -1;
|
|
1228
1229
|
}
|
|
1229
1230
|
// a must be equal to b
|
|
1230
|
-
return 0;
|
|
1231
|
+
return 0;
|
|
1231
1232
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1233
|
+
|
|
1234
|
+
|
|
1234
1235
|
if ( typeof(a) == 'object' ) {
|
|
1235
1236
|
return _compare(a[prop], b[prop])
|
|
1236
1237
|
}
|
|
1237
|
-
|
|
1238
|
+
|
|
1238
1239
|
return _compare(a, b)
|
|
1239
|
-
|
|
1240
|
+
|
|
1240
1241
|
});
|
|
1241
|
-
|
|
1242
|
+
|
|
1242
1243
|
return mapped.map(function(m, index, result){
|
|
1243
1244
|
return content[m.index];
|
|
1244
1245
|
});
|
|
@@ -1250,24 +1251,24 @@ function Collection(content, options) {
|
|
|
1250
1251
|
}
|
|
1251
1252
|
|
|
1252
1253
|
multiSortOp = function(content, filter) {
|
|
1253
|
-
|
|
1254
|
+
|
|
1254
1255
|
var props = [], keys = [];
|
|
1255
|
-
|
|
1256
|
+
|
|
1256
1257
|
if ( Array.isArray(filter) ) {
|
|
1257
1258
|
for (var f = 0, fLen = filter.length; f < fLen; ++f) {
|
|
1258
1259
|
props[f] = Object.keys(filter[f])[0];
|
|
1259
|
-
keys[f] = filter[f][ props[f]] ;
|
|
1260
|
+
keys[f] = filter[f][ props[f]] ;
|
|
1260
1261
|
}
|
|
1261
1262
|
} else {
|
|
1262
1263
|
var f = 0;
|
|
1263
1264
|
for (var flt in filter) {
|
|
1264
1265
|
props[f] = flt;
|
|
1265
|
-
keys[f] = filter[flt] ;
|
|
1266
|
+
keys[f] = filter[flt] ;
|
|
1266
1267
|
++f;
|
|
1267
1268
|
}
|
|
1268
1269
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1270
|
+
|
|
1271
|
+
|
|
1271
1272
|
|
|
1272
1273
|
sortRecursive = function(a, b, columns, order_by, index) {
|
|
1273
1274
|
|
|
@@ -1284,7 +1285,7 @@ function Collection(content, options) {
|
|
|
1284
1285
|
} else if (res != 0) {
|
|
1285
1286
|
return res < 0 ? 1 : -1
|
|
1286
1287
|
}
|
|
1287
|
-
|
|
1288
|
+
|
|
1288
1289
|
// a must be equal to b
|
|
1289
1290
|
return columns.length - 1 > index ? sortRecursive(a, b, columns, order_by, index + 1) : 0;
|
|
1290
1291
|
|
|
@@ -1345,11 +1346,11 @@ function Collection(content, options) {
|
|
|
1345
1346
|
}
|
|
1346
1347
|
|
|
1347
1348
|
if ( Array.isArray(filter) || filter.count() > 1 ) {
|
|
1348
|
-
|
|
1349
|
+
|
|
1349
1350
|
result = multiSortOp(content, filter);
|
|
1350
|
-
|
|
1351
|
+
|
|
1351
1352
|
} else {
|
|
1352
|
-
|
|
1353
|
+
|
|
1353
1354
|
prop = Object.keys(filter)[0];
|
|
1354
1355
|
key = filter[prop];
|
|
1355
1356
|
|
|
@@ -1371,7 +1372,7 @@ function Collection(content, options) {
|
|
|
1371
1372
|
result.max = instance.max;
|
|
1372
1373
|
result.toRaw = instance.toRaw;
|
|
1373
1374
|
result.filter = instance.filter;
|
|
1374
|
-
|
|
1375
|
+
|
|
1375
1376
|
return result
|
|
1376
1377
|
};
|
|
1377
1378
|
|
|
@@ -1383,16 +1384,18 @@ function Collection(content, options) {
|
|
|
1383
1384
|
* */
|
|
1384
1385
|
instance['toRaw'] = function() {
|
|
1385
1386
|
|
|
1386
|
-
var result = ( Array.isArray(this) ) ? this : content;
|
|
1387
|
+
var result = ( Array.isArray(this) ) ? this.slice() : content.slice();
|
|
1387
1388
|
// cleanup
|
|
1388
1389
|
for (var i = 0, len = result.length; i < len; ++i) {
|
|
1389
1390
|
if (result[i]._uuid)
|
|
1390
1391
|
delete result[i]._uuid;
|
|
1392
|
+
|
|
1391
1393
|
}
|
|
1392
1394
|
|
|
1393
|
-
return JSON.clone(result);
|
|
1395
|
+
// return JSON.clone(result);
|
|
1396
|
+
return result
|
|
1394
1397
|
}
|
|
1395
|
-
|
|
1398
|
+
|
|
1396
1399
|
/**
|
|
1397
1400
|
* filter
|
|
1398
1401
|
* Reduce record propName
|
|
@@ -1403,7 +1406,7 @@ function Collection(content, options) {
|
|
|
1403
1406
|
* @returns {array} rawFilteredResult
|
|
1404
1407
|
* */
|
|
1405
1408
|
instance['filter'] = function(filter) {
|
|
1406
|
-
|
|
1409
|
+
|
|
1407
1410
|
if ( typeof(filter) == 'undefined' ) {
|
|
1408
1411
|
throw new Error('`filter` parametter must be a string or an array.');
|
|
1409
1412
|
}
|
|
@@ -1413,7 +1416,7 @@ function Collection(content, options) {
|
|
|
1413
1416
|
}
|
|
1414
1417
|
var i = 0, len = result.length;
|
|
1415
1418
|
var rawFilteredResult = [], fCount = 0;
|
|
1416
|
-
|
|
1419
|
+
|
|
1417
1420
|
if ( Array.isArray(filter) ) {
|
|
1418
1421
|
var f = null, fLen = filter.length, wrote = null;
|
|
1419
1422
|
for (; i < len; ++i) {
|
|
@@ -1441,12 +1444,12 @@ function Collection(content, options) {
|
|
|
1441
1444
|
++fCount;
|
|
1442
1445
|
}
|
|
1443
1446
|
}
|
|
1444
|
-
}
|
|
1447
|
+
}
|
|
1445
1448
|
|
|
1446
1449
|
return JSON.clone(rawFilteredResult);
|
|
1447
1450
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1451
|
+
|
|
1452
|
+
|
|
1450
1453
|
return instance;
|
|
1451
1454
|
};
|
|
1452
1455
|
|