gina 0.1.1-alpha.18 → 0.1.1-alpha.180
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/AUTHORS +2 -1
- package/LICENSE +1 -1
- package/README-4Contributors.md +30 -0
- package/README.md +208 -32
- package/bin/cli +165 -68
- package/bin/cli-debug +49 -18
- package/bin/cmd +40 -18
- package/bin/gina +48 -37
- package/framework/{v0.1.1-alpha.18/lib/inherits → v0.1.1-alpha.180}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.180/VERSION +1 -0
- package/framework/{v0.1.1-alpha.18/core/asset/js/plugin/readme.md → v0.1.1-alpha.180/core/asset/plugin/README.md} +31 -9
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
- package/framework/{v0.1.1-alpha.18/core/asset/js/plugin/dist → v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/js}/gina.js +3958 -3170
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/js/gina.min.js +759 -0
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.180/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/config.js +123 -54
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/index.js +373 -259
- package/framework/v0.1.1-alpha.180/core/connectors/couchbase/lib/connector.js +22 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/lib/connector.v2.js +51 -51
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/lib/connector.v3.js +51 -51
- package/framework/v0.1.1-alpha.180/core/connectors/couchbase/lib/connector.v4.js +384 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/lib/n1ql.js +3 -2
- package/framework/v0.1.1-alpha.180/core/connectors/couchbase/lib/session-store.js +22 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
- package/framework/v0.1.1-alpha.180/core/connectors/couchbase/lib/session-store.v4.js +361 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/controller/controller.js +900 -767
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/dev/index.js +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/dev/lib/class.js +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/dev/lib/factory.js +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/gna.js +13 -9
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/README.md +5 -0
- package/framework/v0.1.1-alpha.180/core/locales/dist/region/en.json +5727 -0
- package/framework/v0.1.1-alpha.180/core/locales/dist/region/fr.json +11452 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/index.js +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/src/make.js +39 -41
- package/framework/v0.1.1-alpha.180/core/locales/src/resources/region.mapping.json +43 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/model/entity.js +87 -67
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/model/index.js +16 -16
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/model/template/entityFactory.js +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/model/template/index.js +15 -14
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/index.js +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/file/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/intl/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/intl/src/main.js +5 -5
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/storage/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/storage/src/main.js +4 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/validator/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/validator/src/form-validator.js +399 -298
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/validator/src/main.js +1292 -1258
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/router.js +96 -90
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/server.isaac.js +184 -179
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/server.js +245 -67
- package/framework/v0.1.1-alpha.180/core/template/boilerplate/bundle/config/settings.json +12 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/config/templates.json +4 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
- package/framework/v0.1.1-alpha.180/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/index.js +13 -1
- package/framework/v0.1.1-alpha.180/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
- package/framework/v0.1.1-alpha.180/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
- package/framework/v0.1.1-alpha.180/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
- package/framework/{v0.1.1-alpha.18/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.180/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
- package/framework/v0.1.1-alpha.180/core/template/command/gina.bat.tpl +8 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/command/gina.tpl +4 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/conf/env.json +11 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/conf/package.json +1 -1
- package/framework/v0.1.1-alpha.180/core/template/conf/statics.json +12 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/conf/templates.json +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/console.js +3 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/context.js +146 -6
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/dateFormat.js +9 -7
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/index.js +13 -8
- package/framework/v0.1.1-alpha.180/helpers/json/LICENSE +9 -0
- package/framework/{v0.1.1-alpha.18/helpers/plugins → v0.1.1-alpha.180/helpers/json}/package.json +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/json/src/main.js +51 -25
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/path.js +163 -96
- package/framework/{v0.1.1-alpha.18/helpers/json → v0.1.1-alpha.180/helpers/plugins}/package.json +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/plugins/src/api-error.js +23 -23
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/plugins/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/prototypes.js +46 -38
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/task.js +21 -14
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/text.js +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/archiver/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/archiver/src/dep/jszip.min.js +3 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/archiver/src/main.js +168 -168
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/aliases.json +4 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/add.js +79 -22
- package/framework/v0.1.1-alpha.180/lib/cmd/bundle/arguments.json +7 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/help.txt +4 -2
- package/framework/v0.1.1-alpha.180/lib/cmd/bundle/list.js +176 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/remove.js +22 -22
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/start.js +264 -46
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/stop.js +93 -74
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/list.js +20 -4
- package/framework/{v0.1.1-alpha.18/lib/cmd/scope → v0.1.1-alpha.180/lib/cmd/env}/use.js +21 -1
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/build.js +85 -0
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/init.js +798 -0
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/link-node-modules.js +86 -0
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/link.js +109 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/open.js +15 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/restart.js +58 -26
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/set.js +273 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/start.js +43 -20
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/status.js +138 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/stop.js +44 -28
- package/framework/v0.1.1-alpha.180/lib/cmd/framework/tail.js +299 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/version.js +12 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/helper.js +74 -5
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/index.js +23 -23
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/port/inc/scan.js +32 -16
- package/framework/v0.1.1-alpha.180/lib/cmd/port/list.js +459 -0
- package/framework/v0.1.1-alpha.180/lib/cmd/port/reset.js +426 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/add.js +146 -122
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/arguments.json +2 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/list.js +16 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/remove.js +17 -17
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/protocol/set.js +239 -201
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/list.js +24 -8
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/view/add.js +34 -9
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/collection/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/collection/src/main.js +241 -241
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/config.js +31 -30
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cron/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cron/src/main.js +10 -9
- package/framework/v0.1.1-alpha.180/lib/domain/LICENSE +9 -0
- package/framework/v0.1.1-alpha.180/lib/domain/README.md +46 -0
- package/framework/v0.1.1-alpha.180/lib/domain/dist/public_suffix_list.dat +14186 -0
- package/framework/v0.1.1-alpha.180/lib/domain/package.json +20 -0
- package/framework/v0.1.1-alpha.180/lib/domain/src/main.js +442 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/generator/index.js +4 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/index.js +3 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180/lib/inherits}/LICENSE +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/README.md +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/package.json +3 -4
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/package.json +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/default/index.js +13 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/file/index.js +109 -14
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/mq/index.js +12 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/mq/listener.js +16 -14
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/mq/speaker.js +32 -3
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/helper.js +21 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/main.js +34 -9
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/math/index.js +9 -9
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/README.md +2 -2
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/src/main.js +76 -88
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/model.js +10 -10
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/proc.js +87 -49
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/routing/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/routing/src/main.js +280 -274
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/session-store.js +6 -6
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/shell.js +3 -3
- package/framework/v0.1.1-alpha.180/lib/swig-filters/README.md +0 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/swig-filters/package.json +1 -1
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/swig-filters/src/main.js +140 -119
- package/framework/v0.1.1-alpha.180/lib/url/README.md +0 -0
- package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/validator.js +2 -2
- package/framework/v0.1.1-alpha.180/package.json +14 -0
- package/package.json +33 -24
- package/resources/home/main.json +53 -4
- package/resources/home/settings.json +9 -0
- package/resources/home/user/extensions/logger/default/config.json +1 -1
- package/resources/package.json.template +29 -18
- package/script/post_install.js +411 -126
- package/script/post_publish.js +186 -0
- package/script/pre_install.js +425 -77
- package/script/prepare_version.js +275 -98
- 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.18/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.18/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 +236 -185
- package/utils/prototypes.js +9 -9
- package/utils/prototypes.json_clone.js +36 -35
- package/doc/framework/cli/doc.json +0 -9
- package/doc/framework/index.md +0 -60
- package/framework/v0.1.1-alpha.18/VERSION +0 -1
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.js.map +0 -56
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.js +0 -736
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.js.map +0 -56
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
- package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/framework/v0.1.1-alpha.18/core/connectors/couchbase/lib/connector.js +0 -20
- package/framework/v0.1.1-alpha.18/core/connectors/couchbase/lib/session-store.js +0 -21
- package/framework/v0.1.1-alpha.18/core/locales/dist/region/en.json +0 -9492
- package/framework/v0.1.1-alpha.18/core/locales/dist/region/fr.json +0 -9492
- package/framework/v0.1.1-alpha.18/core/locales/src/resources/region.mapping.json +0 -28
- package/framework/v0.1.1-alpha.18/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
- package/framework/v0.1.1-alpha.18/core/template/conf/statics.json +0 -10
- package/framework/v0.1.1-alpha.18/lib/cmd/bundle/arguments.json +0 -4
- package/framework/v0.1.1-alpha.18/lib/cmd/bundle/list.js +0 -129
- package/framework/v0.1.1-alpha.18/lib/cmd/framework/init.js +0 -514
- package/framework/v0.1.1-alpha.18/lib/cmd/framework/set.js +0 -161
- package/framework/v0.1.1-alpha.18/lib/cmd/framework/status.js +0 -72
- package/framework/v0.1.1-alpha.18/lib/cmd/framework/tail.js +0 -183
- package/framework/v0.1.1-alpha.18/lib/cmd/port/list.js +0 -176
- package/framework/v0.1.1-alpha.18/package.json +0 -14
- /package/{framework/v0.1.1-alpha.18/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/AUTHORS +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/html/nolayout.html +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/html/static.html +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/android-chrome-192x192.png +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/android-chrome-512x512.png +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/apple-touch-icon.png +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/favicon-16x16.png +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/favicon-32x32.png +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/asset/img/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.18/core/asset/js → v0.1.1-alpha.180/core/asset}/plugin/uuid.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/controller/controller.framework.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/controller/index.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/.travis.yml +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/LICENSE +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/deps/encoding/encoding.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/lib/main.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/lib/types/multipart.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/lib/types/urlencoded.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/lib/utils.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/busboy/package.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/dev/lib/tools.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/currency.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/dist/language/en.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/dist/language/fr.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/src/resources/currency.csv +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/locales/src/resources/region.csv +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/mime.types +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/file/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/file/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/intl/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/intl/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/storage/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/storage/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/validator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/plugins/lib/validator/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/server.express.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/status.codes +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/config/app.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/config/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_public/css/default.css +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_public/readme.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/conf/manifest.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/conf/settings.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/client/json/401.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/client/json/403.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/client/json/404.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/server/html/50x.html +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/server/json/500.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/error/server/json/503.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/core/template/extensions/logger/config.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/json/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/helpers/plugins/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/archiver/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/archiver/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/copy.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/cp.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/rename.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/restart.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/bundle/status.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/add.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/get.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/link-dev.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/remove.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/set.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/env/unset.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/dot.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/get.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/framework/update.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/gina-dev.1.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/gina-framework.1.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/gina.1.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/msg.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/port/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/port/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/port/set.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/build.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/import.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/move.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/rename.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/restart.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/start.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/status.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/project/stop.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/protocol/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/protocol/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/protocol/list.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/help.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/help.txt +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/link-local.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/remove.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/rm.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/set.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cmd/scope/unset.js +0 -0
- /package/framework/{v0.1.1-alpha.18/lib/cmd/env → v0.1.1-alpha.180/lib/cmd/scope}/use.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/collection/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/collection/build.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/cron/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18/lib/routing/README.md → v0.1.1-alpha.180/lib/domain/exemples/backend.js} +0 -0
- /package/framework/{v0.1.1-alpha.18/lib/routing/build.json → v0.1.1-alpha.180/lib/domain/exemples/frontend.html} +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/example/protected_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/example/simple_inheritance.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/example/merge.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/example/merge_2_literal objects.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/merge/example/merge_and_preserve_first.js +0 -0
- /package/framework/{v0.1.1-alpha.18/lib/swig-filters → v0.1.1-alpha.180/lib/routing}/README.md +0 -0
- /package/framework/{v0.1.1-alpha.18/lib/url/README.md → v0.1.1-alpha.180/lib/routing/build.json} +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/url/index.js +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/url/mocks.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/lib/url/routing.json +0 -0
- /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.180}/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,23 @@ 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) {
|
|
926
|
+
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
927
927
|
arr[a] = merge( JSON.clone(set), arr[a]);
|
|
928
928
|
for (var r = 0, rLen = result.length; r < rLen; ++r) {
|
|
929
929
|
if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
|
|
930
930
|
key = 'id';
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
|
|
933
933
|
if ( result[r][key] == arr[a][key] ) {
|
|
934
934
|
result[r] = arr[a];
|
|
935
935
|
break;
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
}
|
|
938
|
+
}
|
|
939
939
|
}
|
|
940
940
|
|
|
941
941
|
// chaining
|
|
@@ -954,8 +954,8 @@ function Collection(content, options) {
|
|
|
954
954
|
|
|
955
955
|
return result
|
|
956
956
|
}
|
|
957
|
-
|
|
958
|
-
|
|
957
|
+
|
|
958
|
+
|
|
959
959
|
instance['replace'] = function() {
|
|
960
960
|
var key = '_uuid' // comparison key
|
|
961
961
|
, result = null
|
|
@@ -964,34 +964,34 @@ function Collection(content, options) {
|
|
|
964
964
|
//, uuidSearchModeEnabled = true
|
|
965
965
|
;
|
|
966
966
|
|
|
967
|
-
|
|
967
|
+
|
|
968
968
|
if ( typeof(arguments[arguments.length-1]) == 'string' ) {
|
|
969
969
|
key = arguments[arguments.length - 1];
|
|
970
970
|
delete arguments[arguments.length - 1];
|
|
971
971
|
--arguments.length;
|
|
972
|
-
}
|
|
973
|
-
|
|
972
|
+
}
|
|
973
|
+
|
|
974
974
|
if ( typeof(arguments[arguments.length-1]) == 'object' ) {
|
|
975
975
|
set = arguments[arguments.length - 1];
|
|
976
976
|
delete arguments[arguments.length - 1];
|
|
977
977
|
--arguments.length;
|
|
978
978
|
}
|
|
979
|
-
|
|
979
|
+
|
|
980
980
|
// if ( typeof(arguments[arguments.length-1]) == 'boolean' ) {
|
|
981
981
|
// uuidSearchModeEnabled = arguments[arguments.length - 1]
|
|
982
982
|
// delete arguments[arguments.length - 1];
|
|
983
983
|
// --arguments.length;
|
|
984
984
|
// }
|
|
985
|
-
|
|
985
|
+
|
|
986
986
|
if (arguments.length > 0) {
|
|
987
987
|
filters = arguments;
|
|
988
988
|
}
|
|
989
|
-
|
|
989
|
+
|
|
990
990
|
|
|
991
991
|
if ( typeof(filters) == 'undefined' || !filters || typeof(filters) != 'object' ) {
|
|
992
992
|
throw new Error('[ Collection ][ update ] `filters` argument must be defined: Array or Filter Object(s) expected');
|
|
993
993
|
}
|
|
994
|
-
|
|
994
|
+
|
|
995
995
|
if ( typeof(set) == 'undefined' || !set || typeof(set) != 'object' ) {
|
|
996
996
|
throw new Error('[ Collection ][ update ] `set` argument must be defined: Object expected');
|
|
997
997
|
}
|
|
@@ -1005,25 +1005,25 @@ function Collection(content, options) {
|
|
|
1005
1005
|
} else {
|
|
1006
1006
|
foundResults = instance.find.apply(this, arguments) || [];
|
|
1007
1007
|
}
|
|
1008
|
-
|
|
1008
|
+
|
|
1009
1009
|
result = Array.isArray(this) ? this : JSON.clone(content);
|
|
1010
|
-
if (foundResults.length > 0 ) {
|
|
1010
|
+
if (foundResults.length > 0 ) {
|
|
1011
1011
|
var arr = foundResults.toRaw();
|
|
1012
|
-
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
1012
|
+
for (var a = 0, aLen = arr.length; a < aLen; ++a) {
|
|
1013
1013
|
arr[a] = JSON.clone(set);
|
|
1014
1014
|
for (var r = 0, rLen = result.length; r < rLen; ++r) {
|
|
1015
1015
|
if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
|
|
1016
1016
|
key = 'id';
|
|
1017
1017
|
} else if (typeof(result[r][key]) == 'undefined' && key == '_uuid') {
|
|
1018
1018
|
throw new Error('No comparison key defined !')
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
1021
|
if ( result[r][key] == arr[a][key] ) {
|
|
1022
1022
|
result[r] = arr[a];
|
|
1023
1023
|
break;
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
}
|
|
1026
|
+
}
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
// chaining
|
|
@@ -1042,24 +1042,24 @@ function Collection(content, options) {
|
|
|
1042
1042
|
|
|
1043
1043
|
return result
|
|
1044
1044
|
}
|
|
1045
|
-
|
|
1045
|
+
|
|
1046
1046
|
/**
|
|
1047
1047
|
* .delete({ key: 2 })
|
|
1048
1048
|
* .delete({ name: 'Jordan' }, ''id) where id will be use as the `uuid` to compare records
|
|
1049
|
-
*
|
|
1049
|
+
*
|
|
1050
1050
|
* AND syntax
|
|
1051
1051
|
* .delete({ car: 'toyota', color: 'red' })
|
|
1052
|
-
*
|
|
1052
|
+
*
|
|
1053
1053
|
* OR syntax
|
|
1054
1054
|
* .delete({ car: 'toyota', color: red }, { car: 'ford' } ) // will delete all `toyota red cars` & all `ford cars`
|
|
1055
|
-
*
|
|
1055
|
+
*
|
|
1056
1056
|
* N.B.: will not affect current result - just returning the DIFF
|
|
1057
1057
|
* If you
|
|
1058
1058
|
* @param {object} filter - samme as `.find(filter)`
|
|
1059
1059
|
* @param {string|boolean} [ uuid | disabled ] - by default, Collection is using its internal _uuid
|
|
1060
1060
|
* If you want to delete without key comparison, disable `uuid` search mode
|
|
1061
1061
|
* .delete({ name: 'Jordan' }, false)
|
|
1062
|
-
*
|
|
1062
|
+
*
|
|
1063
1063
|
* @returns {array} result
|
|
1064
1064
|
*/
|
|
1065
1065
|
instance['delete'] = function() {
|
|
@@ -1090,10 +1090,10 @@ function Collection(content, options) {
|
|
|
1090
1090
|
* @param {object|array} filter
|
|
1091
1091
|
* */
|
|
1092
1092
|
instance['orderBy'] = function () {
|
|
1093
|
-
|
|
1093
|
+
|
|
1094
1094
|
if ( typeof(arguments) == 'undefined' || arguments.length < 1)
|
|
1095
1095
|
throw new Error('[ Collection->orderBy(filter) ] where `filter` must not be empty or null' );
|
|
1096
|
-
|
|
1096
|
+
|
|
1097
1097
|
var filter = null;
|
|
1098
1098
|
if ( arguments.length == 1 ) {
|
|
1099
1099
|
filter = arguments[0];
|
|
@@ -1108,27 +1108,27 @@ function Collection(content, options) {
|
|
|
1108
1108
|
var variableContent = (Array.isArray(this)) ? this : JSON.clone(content);
|
|
1109
1109
|
return sortResult(filter, variableContent.toRaw())
|
|
1110
1110
|
}
|
|
1111
|
-
|
|
1111
|
+
|
|
1112
1112
|
/**
|
|
1113
1113
|
* max
|
|
1114
|
-
* E.g:
|
|
1114
|
+
* E.g:
|
|
1115
1115
|
* myCollection.max({ order: 'not null'})
|
|
1116
1116
|
* => 5
|
|
1117
1117
|
* myCollection.max({ createAt: 'not null'})
|
|
1118
1118
|
* => '2021-12-31T23:59:59'
|
|
1119
1119
|
* myCollection.max({ firstName: 'not null'})
|
|
1120
1120
|
* => 'Zora'
|
|
1121
|
-
*
|
|
1121
|
+
*
|
|
1122
1122
|
* @param {object|array} filter
|
|
1123
|
-
*
|
|
1123
|
+
*
|
|
1124
1124
|
* @returns {number|date|string}
|
|
1125
1125
|
* */
|
|
1126
1126
|
instance['max'] = function () {
|
|
1127
1127
|
if ( typeof(arguments) == 'undefined' || arguments.length < 1)
|
|
1128
1128
|
throw new Error('[ Collection->max(filter) ] where `filter` must not be empty or null' );
|
|
1129
|
-
|
|
1129
|
+
|
|
1130
1130
|
var filter = null;
|
|
1131
|
-
if (
|
|
1131
|
+
if (
|
|
1132
1132
|
arguments.length > 1
|
|
1133
1133
|
|| Array.isArray(arguments[0])
|
|
1134
1134
|
|| typeof(arguments[0]) == 'object' && arguments[0].count() > 1
|
|
@@ -1157,11 +1157,11 @@ function Collection(content, options) {
|
|
|
1157
1157
|
*
|
|
1158
1158
|
* // overriding filters -> last filter is always right
|
|
1159
1159
|
* .orderBy([ { updatedAt : 'desc'}, { name: 'asc' } ])
|
|
1160
|
-
*
|
|
1161
|
-
* // sorting boolean
|
|
1160
|
+
*
|
|
1161
|
+
* // sorting boolean
|
|
1162
1162
|
* .orderBy({ isActive: 'desc'}) => will display all active(TRUE) first
|
|
1163
1163
|
* NB.: Boolean are 0 (FALSE) or 1 (TRUE)
|
|
1164
|
-
*
|
|
1164
|
+
*
|
|
1165
1165
|
* // combining filters -> the first one is always right
|
|
1166
1166
|
* .orderBy({ updatedAt : 'desc'}, { name: 'asc' })
|
|
1167
1167
|
*
|
|
@@ -1193,33 +1193,33 @@ function Collection(content, options) {
|
|
|
1193
1193
|
_m[prop] = obj[prop];
|
|
1194
1194
|
return _m;
|
|
1195
1195
|
});
|
|
1196
|
-
|
|
1197
|
-
mapped.sort(function onAscSort(a, b) {
|
|
1198
|
-
|
|
1199
|
-
|
|
1196
|
+
|
|
1197
|
+
mapped.sort(function onAscSort(a, b) {
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
1200
|
var _compare = function(a, b) {
|
|
1201
1201
|
// handle booleans
|
|
1202
1202
|
if ( /^(true|false)$/i.test(a) ) {
|
|
1203
1203
|
a = ( /true/i.test(a) ) ? 1 : 0;
|
|
1204
1204
|
}
|
|
1205
|
-
|
|
1205
|
+
|
|
1206
1206
|
if ( /^(true|false)$/i.test(b) ) {
|
|
1207
1207
|
b = ( /true/i.test(b) ) ? 1 : 0;
|
|
1208
1208
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
1211
|
if ( typeof(a) == 'string' && a != '' || typeof(b) == 'string' ) {
|
|
1212
|
-
|
|
1212
|
+
|
|
1213
1213
|
if ( typeof(a) == 'number' ) {
|
|
1214
1214
|
a = ''+a; // cast to string
|
|
1215
|
-
}
|
|
1215
|
+
}
|
|
1216
1216
|
if ( typeof(b) == 'number' ) {
|
|
1217
1217
|
b = ''+b; // cast to string
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
1220
|
return a.localeCompare(b, undefined, {sensitivity: 'case', caseFirst: 'upper'})
|
|
1221
1221
|
}
|
|
1222
|
-
|
|
1222
|
+
|
|
1223
1223
|
if (a > b) {
|
|
1224
1224
|
return 1;
|
|
1225
1225
|
}
|
|
@@ -1227,18 +1227,18 @@ function Collection(content, options) {
|
|
|
1227
1227
|
return -1;
|
|
1228
1228
|
}
|
|
1229
1229
|
// a must be equal to b
|
|
1230
|
-
return 0;
|
|
1230
|
+
return 0;
|
|
1231
1231
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
1234
|
if ( typeof(a) == 'object' ) {
|
|
1235
1235
|
return _compare(a[prop], b[prop])
|
|
1236
1236
|
}
|
|
1237
|
-
|
|
1237
|
+
|
|
1238
1238
|
return _compare(a, b)
|
|
1239
|
-
|
|
1239
|
+
|
|
1240
1240
|
});
|
|
1241
|
-
|
|
1241
|
+
|
|
1242
1242
|
return mapped.map(function(m, index, result){
|
|
1243
1243
|
return content[m.index];
|
|
1244
1244
|
});
|
|
@@ -1250,24 +1250,24 @@ function Collection(content, options) {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
|
|
1252
1252
|
multiSortOp = function(content, filter) {
|
|
1253
|
-
|
|
1253
|
+
|
|
1254
1254
|
var props = [], keys = [];
|
|
1255
|
-
|
|
1255
|
+
|
|
1256
1256
|
if ( Array.isArray(filter) ) {
|
|
1257
1257
|
for (var f = 0, fLen = filter.length; f < fLen; ++f) {
|
|
1258
1258
|
props[f] = Object.keys(filter[f])[0];
|
|
1259
|
-
keys[f] = filter[f][ props[f]] ;
|
|
1259
|
+
keys[f] = filter[f][ props[f]] ;
|
|
1260
1260
|
}
|
|
1261
1261
|
} else {
|
|
1262
1262
|
var f = 0;
|
|
1263
1263
|
for (var flt in filter) {
|
|
1264
1264
|
props[f] = flt;
|
|
1265
|
-
keys[f] = filter[flt] ;
|
|
1265
|
+
keys[f] = filter[flt] ;
|
|
1266
1266
|
++f;
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
1271
|
|
|
1272
1272
|
sortRecursive = function(a, b, columns, order_by, index) {
|
|
1273
1273
|
|
|
@@ -1284,7 +1284,7 @@ function Collection(content, options) {
|
|
|
1284
1284
|
} else if (res != 0) {
|
|
1285
1285
|
return res < 0 ? 1 : -1
|
|
1286
1286
|
}
|
|
1287
|
-
|
|
1287
|
+
|
|
1288
1288
|
// a must be equal to b
|
|
1289
1289
|
return columns.length - 1 > index ? sortRecursive(a, b, columns, order_by, index + 1) : 0;
|
|
1290
1290
|
|
|
@@ -1345,11 +1345,11 @@ function Collection(content, options) {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
1347
|
if ( Array.isArray(filter) || filter.count() > 1 ) {
|
|
1348
|
-
|
|
1348
|
+
|
|
1349
1349
|
result = multiSortOp(content, filter);
|
|
1350
|
-
|
|
1350
|
+
|
|
1351
1351
|
} else {
|
|
1352
|
-
|
|
1352
|
+
|
|
1353
1353
|
prop = Object.keys(filter)[0];
|
|
1354
1354
|
key = filter[prop];
|
|
1355
1355
|
|
|
@@ -1371,7 +1371,7 @@ function Collection(content, options) {
|
|
|
1371
1371
|
result.max = instance.max;
|
|
1372
1372
|
result.toRaw = instance.toRaw;
|
|
1373
1373
|
result.filter = instance.filter;
|
|
1374
|
-
|
|
1374
|
+
|
|
1375
1375
|
return result
|
|
1376
1376
|
};
|
|
1377
1377
|
|
|
@@ -1392,7 +1392,7 @@ function Collection(content, options) {
|
|
|
1392
1392
|
|
|
1393
1393
|
return JSON.clone(result);
|
|
1394
1394
|
}
|
|
1395
|
-
|
|
1395
|
+
|
|
1396
1396
|
/**
|
|
1397
1397
|
* filter
|
|
1398
1398
|
* Reduce record propName
|
|
@@ -1403,7 +1403,7 @@ function Collection(content, options) {
|
|
|
1403
1403
|
* @returns {array} rawFilteredResult
|
|
1404
1404
|
* */
|
|
1405
1405
|
instance['filter'] = function(filter) {
|
|
1406
|
-
|
|
1406
|
+
|
|
1407
1407
|
if ( typeof(filter) == 'undefined' ) {
|
|
1408
1408
|
throw new Error('`filter` parametter must be a string or an array.');
|
|
1409
1409
|
}
|
|
@@ -1413,7 +1413,7 @@ function Collection(content, options) {
|
|
|
1413
1413
|
}
|
|
1414
1414
|
var i = 0, len = result.length;
|
|
1415
1415
|
var rawFilteredResult = [], fCount = 0;
|
|
1416
|
-
|
|
1416
|
+
|
|
1417
1417
|
if ( Array.isArray(filter) ) {
|
|
1418
1418
|
var f = null, fLen = filter.length, wrote = null;
|
|
1419
1419
|
for (; i < len; ++i) {
|
|
@@ -1441,12 +1441,12 @@ function Collection(content, options) {
|
|
|
1441
1441
|
++fCount;
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
}
|
|
1444
|
+
}
|
|
1445
1445
|
|
|
1446
1446
|
return JSON.clone(rawFilteredResult);
|
|
1447
1447
|
}
|
|
1448
|
-
|
|
1449
|
-
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
1450
|
return instance;
|
|
1451
1451
|
};
|
|
1452
1452
|
|