1
0
Fork 0
Commit Graph

765 Commits (1aa51775f3d4b794b256574500c0d9aa708f4688)

Author SHA1 Message Date
Mike Gerwitz 248130400b bin/server.in: exec 2017-10-06 11:18:56 -04:00
Mike Gerwitz 38539ca80b Account for absolute paths in configuration
* bin/server.js: Resolve absolute paths as such.
  (_resolvePath): Add function.
2017-09-14 15:44:09 -04:00
Mike Gerwitz 4dda515821 Re-add pidfile
Configurable via the `pidfile' config option.

* bin/server.js: Accept `pidfile' config.  Include path in greeting.
  (writePidFile): Write to `pidfile' and unlink after exit.
* conf/vanilla-server.json (pidfile): Add configuration key.
2017-09-12 15:29:43 -04:00
Mike Gerwitz d1d2c4e5c9 Update package.json license to {=>A}GPLv3+
Server code is AGPLv3+, client/general is GPLv3+.

* package.json.in (license): Change license from GPL-3.0+ to AGPL-3.0+.
2017-09-08 14:23:34 -04:00
Mike Gerwitz 2baabf5e7e Output correct HTTP server port on start
Was outputting NaN, because the property that was being used no longer
existed after previous changes.

* src/server/daemon/Daemon.js (_initHttpServer): Use HTTP port number
  in output.
2017-09-08 14:19:58 -04:00
Mike Gerwitz ed7e5fc547 conf: Specify relative/absolute path to daemon
This isn't ideal, but will allow using daemons classes from anywhere
on disk.

* bin/server.js: Interpret daemon path as relative to conf file path.
* conf/vanilla-server.json: Use relative path to `DevDaemon'.
2017-09-08 14:18:16 -04:00
Mike Gerwitz 73354e39d0 Fix restoring of document metadata after clearing
Previous to this change, we'd write the clear to the database, but
then immediately after, the quote save would restore it.  Oops.

* src/server/Server.js (_monitorMetadataPromise): Clear data in
    metabucket rather than directly invoking a DB call.  This will be
    applied when the quote is saved.
2017-09-07 15:31:43 -04:00
Mike Gerwitz 7a16f8b295 Add information for invoking `make'
* README.md (Building): Add section.
* configure.ac: Output message after configuration instructing the
    user to invoke `make'.
2017-09-06 14:18:02 -04:00
Mike Gerwitz a786605635 [BC-BREAK] Bucket consistency fixes and non-terminating nulls 2017-09-06 14:08:11 -04:00
Mike Gerwitz d9aa7ef4ab Basic documentation for bucket diff
* doc/bucket.texi (Bucket Diff): Add documentation.
2017-09-06 09:04:27 -04:00
Mike Gerwitz 68649dfd9b [DEV-2692] [BC-BREAK] Bucket stability and consistency fixes and non-term nulls
This mixes in support for non-terminating nulls.  It would have been
nice to handle that in a separate commit for clarity, but the
refactoring came as a consequence of trying to provide a working
implementation.

Various inconsistencies and subtle bugs in unlikely situations have
been fixed by this, including modifying objects passed as arguments to
various methods, and inconsistent handling of diff data.

Changes are more consistently recognized.  Perhaps the most noticeable
consequence is that moving between steps no longer prompts to discard
changes---previously calculated values would trigger the dirty flag on
steps even if the user didn't actually change anything.  I (and
others) have wanted this fixed for many years.

This is a very dense commit that touches a core part of the
system.  Hopefully the Changelog below helps.

* src/bucket/Bucket.js
  (setValues): [BC-BREAK] Remove parameters `merge_index' and
    `merge_null' parameters.
* src/bucket/DelayedStagingBucket.js
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null
    parameters.  Remove distinction between `merge_index' and non-.
* src/bucket/QuoteDataBucket.js
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null
    parameters.  Remove respective arguments from `_mergeData' call.
  (_mergeData): Remove same parameters.  Remove handling of
    `merge_index' and `merge_null'.
  (overwriteValues): Append `null' to each vector.
* src/bucket/StagingBucket.js
  (_initState): Use `Object.create' instead of explicit prototype
    instantiation (functionally equivalent).
  (merge): Minor comment correction.
  (_hasChanged): Rename to `_parseChanges'.
  (_parseChanges): Rename from `_hasChanged'.  Remove `merge_index'
    parameter.  Generate new object rather than mutation original
    data (prevent dangerous and subtle bugs from side-effects).  Clone
    each vector rather than modifying/referencing directly (this was
    previously done during merge).  Remove `merge_index'
    distinction.  Handle non-terminating `null' values.
  (setValues): [BC-BREAK] Remove `merge_index' and `merge_null'
    parameters.  Use new object generated by `_parseChanges'.  Remove
    cloning of each vector (`_parseChanges' now does that).  Remove
    `merge_index' distinction.
  (overwriteValues): Remove argument to `setValues' call.
  (getFilledDiff): [BC-BREAK] Use `_staged' rather than `_curdata'.
  (commit): Remove second and third arguments of call to `setValues'
    of underlying bucket.
* src/client/Client.js
  (_initStepUi): Remove second argument of calls to quote `setData'.
* src/client/quote/ClientQuote.js
  (setData): [BC-BREAK] Remove `merge_nulls' parameter.  Remove second
    and third arguments of call to staging bucket `setValues'.  Add
    comment indicating a long-standing problem with committing the
    staging bucket contents before save has succeeded.
* src/server/request/DataProcessor.js
  (processDiff): Remove `permit_null' argument of `sanitizeDiff'
    call.
  (sanitizeDiff): Remove `permit_null' parameter.  Hard-code filter
    call's `permit_null' argument to `true'.
  (_determineDapiFields): Properly handle `null's (ignore) rather than
    inadvertently converting them into the string "null".
* test/bucket/StagingBucketTest.js: Modify test cases
    accordingly.  Add tests to verify that updates and diffs operate
    as expected, especially support for non-terminating `null's.
  (createStubBucket): Use `QuoteDataBucket'.  Ideally remove this
    coupling in the future, but this is a more realistic test case for
    the time being.
* test/server/request/DataProcessorTest.js: Update test to account for
    hard-coded `given_null' argument.
2017-09-06 09:03:45 -04:00
Mike Gerwitz 8a1ac4781c [DEV-2692] Store cleaned rate response data separately
I'm not sure if this has ever caused real problems, but this was
dangerous.

* src/server/service/RatingService.js (_performRating): Store cleaned
    rating data in separate variable to ensure cleaned data are not
    saved in place of the actual complete response.
2017-09-05 16:26:59 -04:00
Mike Gerwitz 2aac23aea7 package.json: postinstall ./configure
This is needed since whatever we publish may not generate the proper
options for node.  Especially since we're on an ancient version.

* package.json.in (scripts)[postinstall]: Add `./configure' call.
2017-09-01 16:20:20 -04:00
Mike Gerwitz d2c255536e Add missing bin/server.js to distribution
Wow...this is a rough day.

* Makefile.am (EXTRA_DIST): Add bin/server.js.
2017-09-01 16:11:22 -04:00
Mike Gerwitz 108e59718f Add missing bin/server to distribution
* Makefile.am (EXTRA_DIST): Add bin/server.
2017-09-01 15:51:48 -04:00
Mike Gerwitz f873d96cc7 configure.ac: Fix bin/server chmod (apply only to bin/server)
* configure.ac: Only attempt chmod for bin/server.
2017-09-01 15:38:13 -04:00
Mike Gerwitz 9cdc1088ca package.json: Add missing bin record for server
Gah.  I modified package.json instead of package.json.in and never
noticed!

* package.json (bin): Add `liza-server' binary.
2017-09-01 15:34:11 -04:00
Mike Gerwitz 5ddd2644f0 doc: Fix bin/server reference under Server
* doc/server.texi (Server): Fix bin/server reference, which was broken
    when SRCURI was set.
2017-08-31 11:04:41 -04:00
Mike Gerwitz dd2c4505c0 Minor program initialization refactoring
Time ran out, but this is still some cleanup, so we may as well keep it.
2017-08-30 11:20:27 -04:00
Mike Gerwitz 3fa464bc3a Extract bucket init code into ProgramInit
This represents a portion of the refactoring that I had intended to do
until I realized that there was a simpler solution to the problem that
we were having (having proguic add stored calculated values to the
defaults object).

So ideally we'll continue extracting all quote init code out of
`Server' and into `ProgramInit' in the future.

* doc/server.texi (Liza Server): Mention `ProgramInit'.
* src/program/ProgramInit.js: Add class.
* src/server/DocumentServer.js: Use it.
* src/server/Server.js (_progInit): Add private field.
  (__construct): Accept ProgramInit instance and assign to field.
  (initQuote): Use promise returned by `_getDefaultBucket'.
  (_getDefaultBucket): Proxy to `ProgramInit#init', which returns a
    promise.
2017-08-30 11:20:19 -04:00
Mike Gerwitz 8d4439f16d Server configuration initial implementation
This doesn't fully replace the use of environment variables, but it is
a start.  I ran out of development time.
2017-08-30 11:12:16 -04:00
Mike Gerwitz 445783c256 [BC BREAK] DataApi config lookup
This was a bit involved because the system had to be made async all
the way up the stack.  No attempt was made to clean up the mess up the
stack---no time.

* src/dapi/DataApiFactory.js
  (fromType): [BC BREAK] Fix docblock.  Add `api_name' param.  Call
    `#descLookup' and return promise.
  (descLookup): Add method.  Return promise resolving to provided
    descriptor.  Intended to be overridden by subtype.
* src/dapi/DataApiManager.js
  (_dataApis): Update docblock to indicate that it now stores
    promises.
  (getApiData): Expect promise for `DataApiFactory#fromType' call.
* src/server/DocumentServer.js: (create): [BC BREAK] Accept
    configuration.  Look up dapi conf and pass to
    `ServerDataApiFactory' ctor.  Return promise.
* src/server/daemon/Daemon.js (_initRouters): Provide configuration.
* src/server/daemon/controller.js
  (init): Accept configuration.  Handle return of promise from
    `_createDocumentServer'.
  (_createDocumentServer): Accept configuration, providing to
    `DocumentServer#create'.  Because of aforementioned change to
    `#create', returns promise.
* src/server/request/ServerDataApiFactory.js: Add StoreMissError
    import.
  (_conf): Add property.
  (constructor): [BC BREAK] Accept configuration.
  (descLookup): Add override.  Look up configuration for provided
    dapi.
2017-08-29 15:11:28 -04:00
Mike Gerwitz 5f8fb2fcc5 doc: Server invocation and configuration
* doc/server.texi (Liza Server): Add information on starting the
    server.
  (Server Configuration): Add subsection.
2017-08-29 14:56:13 -04:00
Mike Gerwitz c92e979000 Add bin/server to invoke server using configure'd node
* .gitignore (bin/server): Ignore generated file.
* bin/server.in: Add script.
* configure.ac: (NODE): Correct description (capitalize `Node').
  (NODE_FLAGS): Add arg var.
  (NODE_DESTRUCTURE): Use determined node path for test.
  (AUTOGENERATED): Add substitution.
  (AC_CONFIG_FILES): Add bin/server.  Make it executable.
2017-08-29 14:56:13 -04:00
Mike Gerwitz 985819c31b [BC BREAK] bin/server.js and associated changes
This is based (very) loosely on an internal script to start the
daemon.  It accepts a configuration and starts the daemon.

To accommodate the configuration, a number of miscellaneous changes
have been made.

The vanilla configuration shows the concept, but it has not yet been
fully implemented; that'll likely happen at a later date.  Until then,
the existing environment-variable-based configuration will be used.

* bin/server.js: Add file.
* conf/vanilla-server.json: Example configuration added.
* src/server/daemon/Daemon.js (_httpPort): Remove field.
  (_conf): Add field.
  (__construct): [BC BREAK] Accept conf instead of port and log
    priority.  Move initialization code into `start'.
  (start): [BC BREAK] Initialization code moved here.  Now returns
    promise for entire daemon, which will error in the event of an
    error starting.  Move existing code into `_startDaemon'.
  (_startDaemon): Old `start' code.  Invoked after `start'
    initialization.
  (_createDebugLog, _createAccessLog): Use configuration.  Return
    promise.
  (_initHttpServer): Use configuration.
  (_httpError): Add function to output error and exit.  Extracted from
    `_initHttpServer'.
* src/server/daemon/scripts.js: [BC BREAK] Append "program/" to
    `LV_LEGACY_PATH' so that it can be re-used for script lookups
    rather than using the cwd.  This removes the need of the cwd being
    the legacy src path.
2017-08-29 14:56:10 -04:00
Mike Gerwitz 464a46abf0 Add ConfStore
* src/conf/ConfStore.js: Add file.
2017-08-29 14:34:41 -04:00
Mike Gerwitz 24e8b51745 Add DelimitedKey Store trait
This will make life much easier and less verbose, especially
considering the verbosity of promises.

* src/store/DelimitedKey.js: Add trait.
* test/store/DelimitedKeyTest.js: Add test case.
2017-08-29 14:34:40 -04:00
Mike Gerwitz c857dcb056 Add ConfLoader
* src/conf/ConfLoader.js: Add class.
* test/conf/ConfLoaderTest.js: Respective test case.
2017-08-28 09:07:28 -04:00
Mike Gerwitz dfcca807de Add AutoObjectStore
* src/store/AutoObjectStore.js: Add class.
* test/store/AutoObjectStoreTest.js: Add test case.
2017-08-28 09:07:26 -04:00
Mike Gerwitz edce23f14b Add Store#populate
* src/store/DiffStore.js (populate): Add method.
* src/store/MemoryStore.js (populate): Add method.
* src/store/Store.js (populate): Add abstract method.
* test/store/DiffStoreTest.js: Add populate tests.
* test/store/MemoryStoreTest.js: Add populate tests.
2017-08-24 14:27:01 -04:00
Mike Gerwitz 2a9920cbb7 README.md: Add all compiled doc formats
* README.md (Documentation): List all available doc formats.
2017-08-23 15:35:03 -04:00
Mike Gerwitz 414c20e5c3 Only publish GitLab pages for tags
* .gitlab-ci.yml (pages): Only publish tags.
* README.md (Documentation): Update to indicate latest release.
2017-08-23 14:29:51 -04:00
Mike Gerwitz 6a777c3c51 Auto-reconnect to mongo database
I wish I knew this option existed ~7yr ago.  This should have been
done long ago, but we've had so few problems with it, that it had
never been explored.

This [version of this] mongo library is ancient and needs to be
upgraded.  Until then, this'll do.

* src/server/daemon/controller.js (init): Set `auto_reconnect'.
2017-08-22 16:46:47 -04:00
Mike Gerwitz ce11fe9428 README.md: Add reference to public-facing documentation 2017-08-18 13:08:24 -04:00
Mike Gerwitz eb8016364c DataProcessor: minor whitespace fix
* src/server/request/DataProcessor.js (_genClearMetaValues): Fix closing method brace indentation.
2017-08-16 08:52:46 -04:00
Mike Gerwitz 5867f263e2 Generate version number from git state
Copies script from GNU ease.js.

* .gitignore: Do not ignore `build-aux/vergen'.
* build-aux/vergen: Add file from GNU ease.js.
* configure.ac: Use `vergen' to generate version string.
2017-08-15 15:18:21 -04:00
Mike Gerwitz f27d504ea3 Update README.md to reflect that liza has been released
* README.md: Remove work-in-progress notices.
2017-08-15 15:13:24 -04:00
Mike Gerwitz 0e1cbe7c34 Clear metadata for pending dapi calls
* src/server/Server.js (_monitorMetadataPromise): Save metadata
  immediately after pending dapi requests (to clear in db).
  (handlePost): Pass clear update to _monitorMetadataPromise.

* src/server/request/DataProcessor.js (processDiff): Return meta clear
  update.
  (_triggerDapis): Call _genClearMetaValues and return results to
  caller.
  (_genClearMetaValues): Add method to calculate bucket update.

* test/server/request/DataProcessorTest.js: Update accordingly.
2017-08-15 15:13:22 -04:00
Mike Gerwitz b09d7ecd60 Don't corrupt PHP session if missing session data
`undefined' was inserted into the session if data could not be
retrieved.

* src/server/request/UserSession.js (_appendSessionData): Do not write
  session data if original data cannot be retrieved.
2017-08-15 12:00:41 -04:00
Mike Gerwitz c66b177aae Version bump 1.{2.5=>3.0} 2017-08-14 08:43:02 -04:00
Mike Gerwitz b7139bdc6a Better server-side change detection, QuoteDataApi 2017-08-14 08:42:12 -04:00
Mike Gerwitz 8cb23711ce Recognize non-changes in posted data server-side
This is a terrible kluge, but time doesn't permit modifying the
system.  All of this also touches old code that is untested, which is
difficult to modify with confidence.

* src/server/DocumentServer.js (DocumentServer#create): Use
  StagingBucket.
* src/server/Server.js: Remove logic now handled by DataProcessor.
* src/server/request/DataProcessor.js (processDiff): Wrap in
  StagingBucket to filter out values that do not result in changes.
* test/server/request/DataProcessorTest.js: Update failing cases.
2017-08-11 13:40:55 -04:00
Mike Gerwitz 1123bccf71 StagingBucket: Better consideration of nulls for change detection
`null` indicates a truncation.

* src/bucket/StagingBucket.js (_length, _deepEqual): Add methods.
  (_hasChanged): Better consider how nulls affect the bucket.
* test/bucket/StagingBucketTest.js: Modify tests accordingly.
2017-08-11 12:03:34 -04:00
Mike Gerwitz 5078c7d8d9 [DEV-2506] StagingBucket: Add ability to prevent bypass
This is a kluge until time can be spent better factoring this
system (using Traits).

* src/bucket/StagingBucket.js (_noStagingBypass): Add field.
  (forbidBypass): Add method to set field.
  (setCommittedValues): Use field.
2017-08-11 11:57:48 -04:00
Mike Gerwitz 12d3b5b8d0 Calc: Add `index' method
* src/calc/Calc.js (index): Add method.
2017-08-10 14:50:18 -04:00
Mike Gerwitz 874a638c43 Calc: Add repeat{,Concat}
* src/calc/Calc.js (repeat, repeatConcat): Add methods.
2017-08-10 14:49:59 -04:00
Mike Gerwitz 5d95d0eb80 Calc: 0-pad ISO dates as necessary
* src/calc/Calc.js (date, relativeDate): 0-pad output.
2017-08-10 14:46:41 -04:00
Mike Gerwitz 642dd8deb3 Calc: Handle null values
`null' is used to represent a truncation in a diff.

* src/calc/Calc.js (_each): Proper null handling.
2017-08-10 14:46:01 -04:00
Mike Gerwitz 9b3ca7a90a Server: Fix botched logging of metadata promise error
* src/server/Server.js (_monitorMetadataPromise): Fix/remove invalid
  references.
2017-08-10 09:52:07 -04:00
Mike Gerwitz c1b6f796fe Add `quote' Data API type
* src/dapi/DataApiFactory.js (_createDataApi): Add support for
  `quote'.
* src/dapi/http/HttpDataApi.js (__construct): New `enctype' argument.
  (_encodeData, _encodeKeys): Remove former, rename latter to former.
  (encodeData, _urlEncode): Encode based on enctype and method.
  (*): Strict mode, es6 style.
2017-08-10 09:52:07 -04:00