<commit_before>.h1 Link Spec

Link is a simple specification and framework for building web applications in the node.js engine.  node.js is deliberately simple and does not attempt to over specify how an application must function logically other than the mechanism it should use.

Link specifies a chain like structure for applications, based purley on events to move from one application component to another.  This has the benefit of minimising call-stack dependent applicaitons, and allowing a consitent way to call applition components from other application components, thereby maximising re-usability.

.h2 Applications

A Link compatible appliction has the following characteristics

* Each application piece MUST listen to itself for a "request" event, the first argument of which must be THE Link.Environment instance for the request.
* The Link.Environment instance MUST be passed on.  An applicaiton may not recieve an instance of the Link.Environment and pass a different instance to the next applciation
* If an application component repsonds to the client, they MUST call the _compolete_ method on the Link.Environment instance before ending the method.

.h2 Link.Environment

The Link.Environment instance is the common thread throughout the request.  The Link.Environment MUST include the following with the following meanings. (Link.Environment instance is called _env_ in the following list)

* env.request           - The raw server request object from node.js
* env.response          - The raw server response object fromnode.js
* env.callBack          - Add a callback to run after the request is considered "done" by an application.
* env.ensuredCallback   - Add a callback that MUST be run at the end of every request (after the response.finish() call)
* env.done      - The trigger to fire the callBack collection.  Also use inside the callback to trigger the next callback.
* env.complete  - MUST be called at the end of every request.  This fires the env.ensuredCallbacks collection.
* env.params - A method that provides access to an object consiting of the URI parameters + the POST body parameters

.h2 Global Components

Link may store global level components.  These are made available so that all applications may access them.  You may add an appliation to the collection if it is to act in a global capacity.  These are available at

Link.components

Examples may be
Link.compoents.Errors
Link.components.Layouts
Link.components.Auditing
Link.components.Logging

.h2 Link Events

Link is an event emitter and will emit events as a central message dispatch.  This allows a central message publishing facility to be used.  Link will emit events on various stages of the build.  The event should be a generic event type followed by a specified type.

Link.broadcast("major_event_type", "specific_event"[, any, other, args])

Link emits the following Events.

* "start", "http" - emitted when the http server starts.
* IS THERE ANY OTHER EVENTS WE WANT TO EMIT?

<commit_msg>Updates to spec<commit_after>.h1 Link Spec

Link is a simple specification and framework for building web applications in the node.js engine.  node.js is deliberately simple and does not attempt to over specify how an application must function logically other than the mechanism it should use.

Link specifies a chain like structure for applications, based purley on events to move from one application component to another.  This has the benefit of minimising call-stack dependent applicaitons, and allowing a consitent way to call applition components from other application components, thereby maximising re-usability.

.h2 Applications

A Link compatible appliction has the following characteristics

* Each application piece MUST listen to itself for a "request" event, the first argument of which must be THE Link.Environment instance for the request.
* The Link.Environment instance MUST be passed on.  An applicaiton may not recieve an instance of the Link.Environment and pass a different instance to the next applciation
* If an application component repsonds to the client, they MUST call the _complete_ method on the Link.Environment instance before ending the method.

.h2 Link.Environment

The Link.Environment instance is the common thread throughout the request.  The Link.Environment MUST include the following with the following meanings. (Link.Environment instance is called _env_ in the following list)

* env.request           - The raw server request object from node.js
* env.response          - The raw server response object fromnode.js
* env.callBack          - Add a callback to run after the request is considered "done" by an application.
* env.ensuredCallback   - Add a callback that MUST be run at the end of every request (after the response.finish() call)
* env.done      - The trigger to fire the callBack collection.  Also use inside the callback to trigger the next callback.
* env.complete  - MUST be called at the end of every request.  This fires the env.ensuredCallbacks collection.
* env.params - A method that provides access to an object consiting of the URI parameters + the POST body parameters
* env.headers
* env.status
* env.body

.h2 Global Components

Link may store global level components.  These are made available so that all applications may access them.  You may add an appliation to the collection if it is to act in a global capacity.  These are available at

Link.components

Examples may be
Link.compoents.Errors
Link.components.Layouts
Link.components.Auditing
Link.components.Logging

.h2 Link Events

Link is an event emitter and will emit events as a central message dispatch.  This allows a central message publishing facility to be used.  Link will emit events on various stages of the build.  The event should be a generic event type followed by a specified type.

Link.broadcast("major_event_type", "specific_event"[, any, other, args])

Link emits the following Events.

* "start", "http" - emitted when the http server starts.


{'fraction_non_alphanumeric': 0.039986671109630126, 'fraction_numerical': 0.0016661112962345886, 'mean_word_length': 4.157216494845361, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2790196', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1393, 'n_words': 846}