mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
ab45b4aa3d
|
@ -18,26 +18,26 @@
|
|||
|
||||
CC=gcc
|
||||
|
||||
CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
|
||||
CFLAGS=-O3 -DHAVE_HIDDEN
|
||||
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
|
||||
#CFLAGS=-g -DDEBUG
|
||||
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
|
||||
# -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
|
||||
SFLAGS=-O3 -fPIC -DHAVE_HIDDEN
|
||||
LDFLAGS=
|
||||
TEST_LDFLAGS=-L. libz.a
|
||||
LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
|
||||
LDSHARED=gcc -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.7
|
||||
CPP=gcc -E
|
||||
|
||||
STATICLIB=libz.a
|
||||
SHAREDLIB=libz.so
|
||||
SHAREDLIBV=libz.so.1.2.7
|
||||
SHAREDLIBM=libz.so.1
|
||||
SHAREDLIB=libz.dylib
|
||||
SHAREDLIBV=libz.1.2.7.dylib
|
||||
SHAREDLIBM=libz.1.dylib
|
||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
||||
|
||||
AR=ar
|
||||
ARFLAGS=rc
|
||||
AR=/usr/bin/libtool
|
||||
ARFLAGS=-o
|
||||
RANLIB=ranlib
|
||||
LDCONFIG=ldconfig
|
||||
LDSHAREDLIBC=-lc
|
||||
|
@ -70,7 +70,7 @@ OBJS = $(OBJC) $(OBJA)
|
|||
|
||||
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
|
||||
|
||||
all: static shared all64
|
||||
all: static shared
|
||||
|
||||
static: example$(EXE) minigzip$(EXE)
|
||||
|
||||
|
@ -80,7 +80,7 @@ all64: example64$(EXE) minigzip64$(EXE)
|
|||
|
||||
check: test
|
||||
|
||||
test: all teststatic testshared test64
|
||||
test: all teststatic testshared
|
||||
|
||||
teststatic: static
|
||||
@TMPST=`mktemp fooXXXXXX`; \
|
||||
|
|
|
@ -118,16 +118,16 @@ Furthermore you can describe your API by chaining the following methods onto you
|
|||
#### Describing a queryParam
|
||||
@copydetails JSF_foxx_RequestContext_queryParam
|
||||
|
||||
### Documenting the nickname of a route
|
||||
#### Documenting the nickname of a route
|
||||
@copydetails JSF_foxx_RequestContext_nickname
|
||||
|
||||
### Documenting the summary of a route
|
||||
#### Documenting the summary of a route
|
||||
@copydetails JSF_foxx_RequestContext_summary
|
||||
|
||||
### Documenting the notes of a route
|
||||
#### Documenting the notes of a route
|
||||
@copydetails JSF_foxx_RequestContext_notes
|
||||
|
||||
### Documenting the error response of a route
|
||||
#### Documenting the error response of a route
|
||||
@copydetails JSF_foxx_RequestContext_errorResponse
|
||||
|
||||
### Before and After Hooks
|
||||
|
@ -218,10 +218,11 @@ A Foxx Model can be initialized with an object of attributes and their values.
|
|||
@copydetails JSF_foxx_model_has
|
||||
|
||||
#### Foxx.Model#attributes
|
||||
@copydetails JSF_foxx_model_attributes
|
||||
|
||||
The attributes property is the internal hash containing the model's state.
|
||||
|
||||
#### Foxx.Model#toJSON
|
||||
@copydetails JSF_foxx_model_toJSON
|
||||
@copydetails jsf_foxx_model_toJSON
|
||||
|
||||
## Foxx.Repository
|
||||
|
||||
|
@ -237,15 +238,17 @@ A repository is a gateway to the database. It gets data from the database, updat
|
|||
#### new Foxx.Repository
|
||||
@copydetails JSF_foxx_repository_initializer
|
||||
|
||||
|
||||
#### Foxx.Repository#collection
|
||||
@copydetails JSF_foxx_repository_collection
|
||||
|
||||
The collection object.
|
||||
|
||||
#### Foxx.Repository#prefix
|
||||
@copydetails JSF_foxx_repository_prefix
|
||||
|
||||
The prefix of the application.
|
||||
|
||||
#### Foxx.Repository#modelPrototype
|
||||
@copydetails JSF_foxx_repository_modelPrototype
|
||||
|
||||
The prototype of the according model.
|
||||
|
||||
#### Foxx.Repository#save
|
||||
|
||||
|
|
|
@ -1810,7 +1810,7 @@ yyreduce:
|
|||
}
|
||||
|
||||
node = TRI_CreateNodeForAql(context, (yyvsp[(2) - (4)].strval), (yyvsp[(4) - (4)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1826,7 +1826,7 @@ yyreduce:
|
|||
#line 225 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeFilterAql(context, (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ yyreduce:
|
|||
#line 238 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeLetAql(context, (yyvsp[(2) - (4)].strval), (yyvsp[(4) - (4)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1859,7 +1859,7 @@ yyreduce:
|
|||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeListAql(context);
|
||||
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1873,7 +1873,7 @@ yyreduce:
|
|||
#line 259 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeCollectAql(context, TRI_PopStackParseAql(context), (yyvsp[(4) - (4)].strval));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1905,7 +1905,7 @@ yyreduce:
|
|||
#line 279 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeAssignAql(context, (yyvsp[(1) - (3)].strval), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1940,7 +1940,7 @@ yyreduce:
|
|||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeListAql(context);
|
||||
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1955,7 +1955,7 @@ yyreduce:
|
|||
{
|
||||
TRI_aql_node_t* list = TRI_PopStackParseAql(context);
|
||||
TRI_aql_node_t* node = TRI_CreateNodeSortAql(context, list);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -1993,7 +1993,7 @@ yyreduce:
|
|||
#line 336 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeSortElementAql(context, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].boolval));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2034,7 +2034,7 @@ yyreduce:
|
|||
#line 359 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, TRI_CreateNodeValueIntAql(context, 0), (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2051,7 +2051,7 @@ yyreduce:
|
|||
#line 370 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeLimitAql(context, (yyvsp[(2) - (4)].node), (yyvsp[(4) - (4)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2067,7 +2067,7 @@ yyreduce:
|
|||
#line 383 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeReturnAql(context, (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ yyreduce:
|
|||
}
|
||||
|
||||
node = TRI_CreateNodeListAql(context);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2223,7 +2223,7 @@ yyreduce:
|
|||
{
|
||||
TRI_aql_node_t* list = TRI_PopStackParseAql(context);
|
||||
TRI_aql_node_t* node = TRI_CreateNodeFcallAql(context, TRI_PopStackParseAql(context), list);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2237,7 +2237,7 @@ yyreduce:
|
|||
#line 489 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryPlusAql(context, (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ yyreduce:
|
|||
#line 497 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryMinusAql(context, (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2265,7 +2265,7 @@ yyreduce:
|
|||
#line 505 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorUnaryNotAql(context, (yyvsp[(2) - (2)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2279,7 +2279,7 @@ yyreduce:
|
|||
#line 516 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryOrAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ yyreduce:
|
|||
#line 524 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryAndAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2307,7 +2307,7 @@ yyreduce:
|
|||
#line 532 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryPlusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ yyreduce:
|
|||
#line 540 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryMinusAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2335,7 +2335,7 @@ yyreduce:
|
|||
#line 548 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryTimesAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2349,7 +2349,7 @@ yyreduce:
|
|||
#line 556 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryDivAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2363,7 +2363,7 @@ yyreduce:
|
|||
#line 564 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryModAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2377,7 +2377,7 @@ yyreduce:
|
|||
#line 572 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryEqAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2391,7 +2391,7 @@ yyreduce:
|
|||
#line 580 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryNeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2405,7 +2405,7 @@ yyreduce:
|
|||
#line 588 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2419,7 +2419,7 @@ yyreduce:
|
|||
#line 596 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGtAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2433,7 +2433,7 @@ yyreduce:
|
|||
#line 604 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryLeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2447,7 +2447,7 @@ yyreduce:
|
|||
#line 612 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryGeAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2461,7 +2461,7 @@ yyreduce:
|
|||
#line 620 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorBinaryInAql(context, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2475,7 +2475,7 @@ yyreduce:
|
|||
#line 631 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeOperatorTernaryAql(context, (yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2541,7 +2541,7 @@ yyreduce:
|
|||
#line 667 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeListAql(context);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2602,7 +2602,7 @@ yyreduce:
|
|||
#line 700 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeArrayAql(context);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2694,7 +2694,7 @@ yyreduce:
|
|||
// create a temporary variable for the row iterator (will be popped by "expansion" rule")
|
||||
node = TRI_CreateNodeReferenceAql(context, varname);
|
||||
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2750,7 +2750,7 @@ yyreduce:
|
|||
node = TRI_CreateNodeCollectionAql(context, (yyvsp[(1) - (1)].strval));
|
||||
}
|
||||
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2881,7 +2881,7 @@ yyreduce:
|
|||
#line 881 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueStringAql(context, (yyvsp[(1) - (1)].strval));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2917,7 +2917,7 @@ yyreduce:
|
|||
}
|
||||
|
||||
node = TRI_CreateNodeValueDoubleAql(context, value);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2931,7 +2931,7 @@ yyreduce:
|
|||
#line 913 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueNullAql(context);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2945,7 +2945,7 @@ yyreduce:
|
|||
#line 921 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, true);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2959,7 +2959,7 @@ yyreduce:
|
|||
#line 929 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeValueBoolAql(context, false);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -2973,7 +2973,7 @@ yyreduce:
|
|||
#line 940 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
{
|
||||
TRI_aql_node_t* node = TRI_CreateNodeParameterAql(context, (yyvsp[(1) - (1)].strval));
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
@ -3031,7 +3031,7 @@ yyreduce:
|
|||
}
|
||||
|
||||
node = TRI_CreateNodeValueIntAql(context, value);
|
||||
if (! node) {
|
||||
if (node == NULL) {
|
||||
ABORT_OOM
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
window.FoxxCollection = Backbone.Collection.extend({
|
||||
model: window.Foxx,
|
||||
|
||||
url: "../../aardvark/foxxes"
|
||||
url: "../aardvark/foxxes"
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ window.Foxx = Backbone.Model.extend({
|
|||
},
|
||||
|
||||
url: function() {
|
||||
return "../../aardvark/foxxes/" + this.get("_key");
|
||||
return "../aardvark/foxxes/" + this.get("_key");
|
||||
},
|
||||
|
||||
isNew: function() {
|
||||
|
|
|
@ -5,7 +5,7 @@ window.AppDocumentationView = Backbone.View.extend({
|
|||
|
||||
initialize: function() {
|
||||
this.swaggerUi = new SwaggerUi({
|
||||
discoveryUrl:"../../aardvark/swagger",
|
||||
discoveryUrl:"../aardvark/swagger",
|
||||
apiKey: false,
|
||||
dom_id:"swagger-ui-container",
|
||||
supportHeaderParams: true,
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
// Define the Repository
|
||||
var Foxx = require("org/arangodb/foxx");
|
||||
|
||||
exports.repository = Foxx.Repository.extend({
|
||||
exports.Repository = Foxx.Repository.extend({
|
||||
// Define the functionality to create a new foxx
|
||||
store = function (content) {
|
||||
store: function (content) {
|
||||
throw {
|
||||
code: 501,
|
||||
message: "To be implemented."
|
||||
|
@ -75,6 +75,6 @@
|
|||
code: 501,
|
||||
message: "To be implemented."
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
// Define the functionality to receive the documentation.
|
||||
// And transform it into swagger format.
|
||||
exports.repository = Foxx.Repository.extend({
|
||||
exports.Repository = Foxx.Repository.extend({
|
||||
|
||||
// Get the overview of all installed foxxes.
|
||||
list: function() {
|
||||
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
|
||||
// Get details of one specific installed foxx.
|
||||
show = function(appname) {
|
||||
show: function(appname) {
|
||||
var result = {},
|
||||
apis = [],
|
||||
key,
|
||||
|
@ -88,4 +88,4 @@
|
|||
return result;
|
||||
}
|
||||
});
|
||||
}());
|
||||
}());
|
||||
|
|
|
@ -427,7 +427,16 @@ exports.uninstallApp = function (key) {
|
|||
exports.printInstalled = function (showPrefix) {
|
||||
var list = exports.listInstalled(showPrefix);
|
||||
|
||||
arangodb.printTable(list);
|
||||
if (showPrefix) {
|
||||
arangodb.printTable(
|
||||
list,
|
||||
["MountID", "AppID", "CollectionPrefix", "Active", "Devel"]);
|
||||
}
|
||||
else {
|
||||
arangodb.printTable(
|
||||
list,
|
||||
["MountID", "AppID", "Mount", "Active", "Devel"]);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -475,7 +484,9 @@ exports.listInstalled = function (showPrefix) {
|
|||
exports.printAvailable = function () {
|
||||
var list = exports.listAvailable();
|
||||
|
||||
arangodb.printTable(list);
|
||||
arangodb.printTable(
|
||||
list,
|
||||
["AppID", "Name", "Version", "Path"]);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -418,7 +418,6 @@ function require (path) {
|
|||
}
|
||||
|
||||
if (mp === null) {
|
||||
console.error("unknown application '%s'", appId);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1200,7 +1199,7 @@ function require (path) {
|
|||
/// @brief createAppModule
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ArangoApp.prototype.createAppModule = function (type, rootPackage) {
|
||||
ArangoApp.prototype.createAppModule = function (type) {
|
||||
'use strict';
|
||||
|
||||
if (type === undefined) {
|
||||
|
@ -1218,7 +1217,7 @@ function require (path) {
|
|||
|
||||
var pkg = new Package("application",
|
||||
{name: "application '" + this._name + "'"},
|
||||
rootPackage,
|
||||
undefined,
|
||||
[ libpath ]);
|
||||
|
||||
return new Module("application", 'application', pkg);
|
||||
|
|
|
@ -34,6 +34,7 @@ var fs = require("fs");
|
|||
var console = require("console");
|
||||
|
||||
var arangodb = require("org/arangodb");
|
||||
var foxx = require("org/arangodb/foxx");
|
||||
var foxxManager = require("org/arangodb/foxx-manager");
|
||||
|
||||
var moduleExists = function(name) { return module.exists; };
|
||||
|
@ -77,9 +78,11 @@ var ALL_METHODS = [ "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" ]
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function notImplementedFunction (route, message) {
|
||||
'use strict';
|
||||
|
||||
message += "\nThis error was triggered by the following route " + JSON.stringify(route);
|
||||
|
||||
console.error(message);
|
||||
console.error("%s", message);
|
||||
|
||||
return function (req, res, options, next) {
|
||||
res.responseCode = exports.HTTP_NOT_IMPLEMENTED;
|
||||
|
@ -93,9 +96,11 @@ function notImplementedFunction (route, message) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function errorFunction (route, message) {
|
||||
'use strict';
|
||||
|
||||
message += "\nThis error was triggered by the following route " + JSON.stringify(route);
|
||||
|
||||
console.error(message);
|
||||
console.error("%s", message);
|
||||
|
||||
return function (req, res, options, next) {
|
||||
res.responseCode = exports.HTTP_SERVER_ERROR;
|
||||
|
@ -109,6 +114,8 @@ function errorFunction (route, message) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function splitUrl (url) {
|
||||
'use strict';
|
||||
|
||||
var cleaned;
|
||||
var i;
|
||||
var parts;
|
||||
|
@ -159,6 +166,8 @@ function splitUrl (url) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupUrl (prefix, url) {
|
||||
'use strict';
|
||||
|
||||
if (url === undefined || url === '') {
|
||||
return null;
|
||||
}
|
||||
|
@ -187,6 +196,8 @@ function lookupUrl (prefix, url) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackStatic (content) {
|
||||
'use strict';
|
||||
|
||||
var type;
|
||||
var body;
|
||||
var methods;
|
||||
|
@ -221,91 +232,31 @@ function lookupCallbackStatic (content) {
|
|||
/// @brief looks up a callback for a callback action
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackActionCallback (route, action) {
|
||||
function lookupCallbackActionCallback (route, action, context) {
|
||||
'use strict';
|
||||
|
||||
var defn;
|
||||
var env;
|
||||
var func;
|
||||
var key;
|
||||
var app;
|
||||
var appModule;
|
||||
var modelModule;
|
||||
|
||||
defn = "func = (function() { var callback = " + action.callback + "; return callback;})();";
|
||||
env = {};
|
||||
|
||||
try {
|
||||
if (action.hasOwnProperty("context")) {
|
||||
app = module.createApp(action.context.appId);
|
||||
|
||||
if (app === null) {
|
||||
throw "cannot locate application '" + action.context.name + "'"
|
||||
+ " in version '" + action.context.version + "'";
|
||||
}
|
||||
|
||||
appModule = app.createAppModule();
|
||||
|
||||
if (action.hasOwnProperty("requiresModels")) {
|
||||
var cp = action.context.collectionPrefix;
|
||||
var me;
|
||||
|
||||
modelModule = app.createAppModule('models', appModule._package);
|
||||
me = modelModule._package._environment = {};
|
||||
|
||||
if (cp !== "") {
|
||||
me.appCollectionName = function (name) {
|
||||
return cp + "_" + name;
|
||||
};
|
||||
|
||||
me.appCollection = function (name) {
|
||||
return arangodb.db._collection(cp + "_" + name);
|
||||
};
|
||||
}
|
||||
else {
|
||||
me.appCollectionName = function (name) {
|
||||
return name;
|
||||
};
|
||||
|
||||
me.appCollection = function (name) {
|
||||
return arangodb.db._collection(name);
|
||||
};
|
||||
}
|
||||
|
||||
me.requireModel = function (path) {
|
||||
modelModule.require(path);
|
||||
};
|
||||
}
|
||||
else {
|
||||
modelModule = appModule;
|
||||
}
|
||||
}
|
||||
else {
|
||||
appModule = module.root;
|
||||
modelModule = appModule;
|
||||
}
|
||||
|
||||
if (action.hasOwnProperty("requiresLibs")) {
|
||||
var requires = action.requiresLibs;
|
||||
|
||||
for (key in requires) {
|
||||
if (requires.hasOwnProperty(key)) {
|
||||
env[key] = appModule.require(requires[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action.hasOwnProperty("requiresModels")) {
|
||||
var models = action.requiresModels;
|
||||
|
||||
for (key in models) {
|
||||
if (models.hasOwnProperty(key)) {
|
||||
env[key] = modelModule.require(models[key]);
|
||||
}
|
||||
for (key in context.requires) {
|
||||
if (context.requires.hasOwnProperty(key)) {
|
||||
env[key] = context.requires[key];
|
||||
}
|
||||
}
|
||||
|
||||
env.module = module.root;
|
||||
env.repositories = context.repositories;
|
||||
|
||||
env.require = function (path) {
|
||||
return appModule.require(path);
|
||||
return context.appModule.require(path);
|
||||
};
|
||||
|
||||
internal.executeScript(defn, env, route);
|
||||
|
@ -316,14 +267,14 @@ function lookupCallbackActionCallback (route, action) {
|
|||
else {
|
||||
func = notImplementedFunction(
|
||||
route,
|
||||
"could not define function '" + action.callback);
|
||||
"could not define function for '" + action.callback + "'");
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
func = errorFunction(
|
||||
route,
|
||||
"an error occurred while loading function '"
|
||||
+ action.callback + "': " + String(err));
|
||||
+ action.callback + "': " + String(err.stack || err));
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -338,6 +289,8 @@ function lookupCallbackActionCallback (route, action) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackActionDo (route, action) {
|
||||
'use strict';
|
||||
|
||||
var func;
|
||||
var joined;
|
||||
var name;
|
||||
|
@ -365,13 +318,13 @@ function lookupCallbackActionDo (route, action) {
|
|||
func = notImplementedFunction(
|
||||
route,
|
||||
"an error occurred while loading action named '" + name
|
||||
+ "' in module '" + joined + "': " + String(err));
|
||||
+ "' in module '" + joined + "': " + String(err.stack || err));
|
||||
}
|
||||
else {
|
||||
func = errorFunction(
|
||||
route,
|
||||
"an error occurred while loading action named '" + name
|
||||
+ "' in module '" + joined + "': " + String(err));
|
||||
+ "' in module '" + joined + "': " + String(err.stack || err));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,6 +347,8 @@ function lookupCallbackActionDo (route, action) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackActionController (route, action) {
|
||||
'use strict';
|
||||
|
||||
var func;
|
||||
var mdl;
|
||||
var httpMethods = {
|
||||
|
@ -450,13 +405,13 @@ function lookupCallbackActionController (route, action) {
|
|||
return notImplementedFunction(
|
||||
route,
|
||||
"cannot load/execute action controller module '"
|
||||
+ action.controller + ": " + String(err));
|
||||
+ action.controller + ": " + String(err.stack || err));
|
||||
}
|
||||
|
||||
return errorFunction(
|
||||
route,
|
||||
"cannot load/execute action controller module '"
|
||||
+ action.controller + ": " + String(err));
|
||||
+ action.controller + ": " + String(err.stack || err));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -465,6 +420,8 @@ function lookupCallbackActionController (route, action) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackActionPrefixController (route, action) {
|
||||
'use strict';
|
||||
|
||||
var prefixController = action.prefixController;
|
||||
var httpMethods = {
|
||||
'get': exports.GET,
|
||||
|
@ -503,7 +460,7 @@ function lookupCallbackActionPrefixController (route, action) {
|
|||
}
|
||||
|
||||
return efunc(route,
|
||||
"cannot load prefix controller: " + String(err1))(
|
||||
"cannot load prefix controller: " + String(err1.stack || err1))(
|
||||
req, res, options, next);
|
||||
}
|
||||
|
||||
|
@ -539,7 +496,7 @@ function lookupCallbackActionPrefixController (route, action) {
|
|||
return errorFunction(
|
||||
route,
|
||||
"Cannot load/execute prefix controller '"
|
||||
+ action.prefixController + "': " + String(err2))(
|
||||
+ action.prefixController + "': " + String(err2.stack || err2))(
|
||||
req, res, options, next);
|
||||
}
|
||||
|
||||
|
@ -554,7 +511,8 @@ function lookupCallbackActionPrefixController (route, action) {
|
|||
/// @brief looks up a callback for an action
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallbackAction (route, action) {
|
||||
function lookupCallbackAction (route, action, context) {
|
||||
'use strict';
|
||||
|
||||
// .............................................................................
|
||||
// short-cut for prefix controller
|
||||
|
@ -569,7 +527,7 @@ function lookupCallbackAction (route, action) {
|
|||
// .............................................................................
|
||||
|
||||
if (action.hasOwnProperty('callback')) {
|
||||
return lookupCallbackActionCallback(route, action);
|
||||
return lookupCallbackActionCallback(route, action, context);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
|
@ -603,14 +561,109 @@ function lookupCallbackAction (route, action) {
|
|||
/// @brief looks up a callback
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function lookupCallback (route) {
|
||||
function lookupCallback (route, context) {
|
||||
'use strict';
|
||||
|
||||
var result = null;
|
||||
|
||||
if (route.hasOwnProperty('content')) {
|
||||
result = lookupCallbackStatic(route.content);
|
||||
}
|
||||
else if (route.hasOwnProperty('action')) {
|
||||
result = lookupCallbackAction(route, route.action);
|
||||
result = lookupCallbackAction(route, route.action, context);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates all contexts
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function createContexts (appModule, appContext, desc) {
|
||||
'use strict';
|
||||
|
||||
var key;
|
||||
var c;
|
||||
|
||||
var result = {};
|
||||
|
||||
for (key in desc) {
|
||||
if (desc.hasOwnProperty(key)) {
|
||||
var d = desc[key];
|
||||
var collectionPrefix = appContext.connectionPrefix;
|
||||
|
||||
result[key] = {
|
||||
appModule: appModule,
|
||||
repositories: {},
|
||||
requires: {}
|
||||
};
|
||||
|
||||
// .............................................................................
|
||||
// requires
|
||||
// .............................................................................
|
||||
|
||||
if (d.hasOwnProperty('requires')) {
|
||||
for (c in d.requires) {
|
||||
if (d.requires.hasOwnProperty(c)) {
|
||||
var name = d.requires[c];
|
||||
var m = appModule.require(name);
|
||||
|
||||
result[key].requires[c] = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// repositories
|
||||
// .............................................................................
|
||||
|
||||
if (d.hasOwnProperty('repositories')) {
|
||||
for (c in d.repositories) {
|
||||
if (d.repositories.hasOwnProperty(c)) {
|
||||
var rep = d.repositories[c];
|
||||
var model;
|
||||
var Repo;
|
||||
|
||||
if (rep.hasOwnProperty('model')) {
|
||||
model = appModule.require(rep.model).Model;
|
||||
|
||||
if (model === undefined) {
|
||||
throw new Error("module '" + rep.model + "' does not define a model");
|
||||
}
|
||||
}
|
||||
else {
|
||||
model = foxx.Model;
|
||||
}
|
||||
|
||||
if (rep.hasOwnProperty('repository')) {
|
||||
Repo = appModule.require(rep.repository).Repository;
|
||||
|
||||
if (Repo === undefined) {
|
||||
throw new Error("module '" + rep.repository + "' does not define a repository");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Repo = foxx.Repository;
|
||||
}
|
||||
|
||||
var prefix = appContext.collectionPrefix;
|
||||
var cname;
|
||||
|
||||
if (prefix === "") {
|
||||
cname = c;
|
||||
}
|
||||
else {
|
||||
cname = prefix + "_" + c;
|
||||
}
|
||||
|
||||
var collection = arangodb.db._collection(cname);
|
||||
|
||||
result[key].repositories[c] = new Repo(prefix, collection, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -621,6 +674,8 @@ function lookupCallback (route) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function intersectMethods (a, b) {
|
||||
'use strict';
|
||||
|
||||
var d = {};
|
||||
var i;
|
||||
var j;
|
||||
|
@ -649,6 +704,8 @@ function intersectMethods (a, b) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function defineRoutePart (route, subwhere, parts, pos, constraint, callback) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
var p;
|
||||
var part;
|
||||
|
@ -738,6 +795,8 @@ function defineRoutePart (route, subwhere, parts, pos, constraint, callback) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function defineRoute (route, where, url, callback) {
|
||||
'use strict';
|
||||
|
||||
var methods;
|
||||
var branch;
|
||||
var i;
|
||||
|
@ -757,6 +816,8 @@ function defineRoute (route, where, url, callback) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function flattenRouting (routes, path, urlParameters, depth, prefix) {
|
||||
'use strict';
|
||||
|
||||
var cur;
|
||||
var i;
|
||||
var k;
|
||||
|
@ -927,6 +988,8 @@ function flattenRouting (routes, path, urlParameters, depth, prefix) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function defineHttp (options) {
|
||||
'use strict';
|
||||
|
||||
var url = options.url;
|
||||
var contexts = options.context;
|
||||
var callback = options.callback;
|
||||
|
@ -992,6 +1055,8 @@ function defineHttp (options) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getErrorMessage (code) {
|
||||
'use strict';
|
||||
|
||||
var key;
|
||||
|
||||
for (key in internal.errors) {
|
||||
|
@ -1010,6 +1075,8 @@ function getErrorMessage (code) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getJsonBody (req, res, code) {
|
||||
'use strict';
|
||||
|
||||
var body;
|
||||
var err;
|
||||
|
||||
|
@ -1052,6 +1119,8 @@ function getJsonBody (req, res, code) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultError (req, res, httpReturnCode, errorNum, errorMessage, headers, keyvals) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
var msg;
|
||||
|
||||
|
@ -1099,12 +1168,10 @@ function resultError (req, res, httpReturnCode, errorNum, errorMessage, headers,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function reloadRouting () {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
var j;
|
||||
var routes;
|
||||
var routing;
|
||||
var handleRoute;
|
||||
var handleMiddleware;
|
||||
var method;
|
||||
|
||||
// .............................................................................
|
||||
|
@ -1127,9 +1194,9 @@ function reloadRouting () {
|
|||
// lookup all routes
|
||||
// .............................................................................
|
||||
|
||||
routes = [];
|
||||
var routes = [];
|
||||
var routing = arangodb.db._collection("_routing");
|
||||
|
||||
routing = arangodb.db._collection("_routing");
|
||||
i = routing.all();
|
||||
|
||||
while (i.hasNext()) {
|
||||
|
@ -1144,15 +1211,14 @@ function reloadRouting () {
|
|||
|
||||
// check development routes
|
||||
if (internal.developmentMode) {
|
||||
i = foxxManager.developmentRoutes();
|
||||
routes = routes.concat(i);
|
||||
routes = routes.concat(foxxManager.developmentRoutes());
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// defines a new route
|
||||
// .............................................................................
|
||||
|
||||
handleRoute = function (storage, urlPrefix, modulePrefix, route) {
|
||||
var installRoute = function (storage, urlPrefix, modulePrefix, context, route) {
|
||||
var url;
|
||||
var callback;
|
||||
|
||||
|
@ -1163,7 +1229,7 @@ function reloadRouting () {
|
|||
return;
|
||||
}
|
||||
|
||||
callback = lookupCallback(route);
|
||||
callback = lookupCallback(route, context);
|
||||
|
||||
if (callback === null) {
|
||||
console.error("route '%s' has an unknown callback, ignoring", JSON.stringify(route));
|
||||
|
@ -1173,6 +1239,67 @@ function reloadRouting () {
|
|||
defineRoute(route, storage, url, callback);
|
||||
};
|
||||
|
||||
// .............................................................................
|
||||
// analyses a new route
|
||||
// .............................................................................
|
||||
|
||||
var analyseRoute = function (routes) {
|
||||
var urlPrefix = routes.urlPrefix || "";
|
||||
var modulePrefix = routes.modulePrefix || "";
|
||||
var keys = [ 'routes', 'middleware' ];
|
||||
var repositories = {};
|
||||
var j;
|
||||
|
||||
// create the application context
|
||||
var appModule = module.root;
|
||||
var appContext = {
|
||||
collectionPrefix: ""
|
||||
};
|
||||
|
||||
if (routes.hasOwnProperty('appContext')) {
|
||||
appContext = routes.appContext;
|
||||
|
||||
var appId = appContext.appId;
|
||||
var app = module.createApp(appId);
|
||||
|
||||
if (app === null) {
|
||||
throw new Error("unknown application '" + appId + "'");
|
||||
}
|
||||
|
||||
appModule = app.createAppModule();
|
||||
}
|
||||
|
||||
// create the route contexts
|
||||
var contexts = createContexts(appModule, appContext, routes.context || {});
|
||||
|
||||
// install the routes
|
||||
for (j = 0; j < keys.length; ++j) {
|
||||
var key = keys[j];
|
||||
|
||||
if (routes.hasOwnProperty(key)) {
|
||||
var r = routes[key];
|
||||
|
||||
for (i = 0; i < r.length; ++i) {
|
||||
var route = r[i];
|
||||
var context = {};
|
||||
|
||||
if (route.hasOwnProperty('context')) {
|
||||
var cn = route.context;
|
||||
|
||||
if (contexts.hasOwnProperty(cn)) {
|
||||
context = contexts[cn];
|
||||
}
|
||||
else {
|
||||
throw new Error("unknown context '" + cn + "'");
|
||||
}
|
||||
}
|
||||
|
||||
installRoute(RoutingCache[key], urlPrefix, modulePrefix, context, r[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// .............................................................................
|
||||
// loop over the routes or routes bundle
|
||||
// .............................................................................
|
||||
|
@ -1183,28 +1310,18 @@ function reloadRouting () {
|
|||
var route = routes[j];
|
||||
var r;
|
||||
|
||||
if (route.hasOwnProperty('routes') || route.hasOwnProperty('middleware')) {
|
||||
var urlPrefix = route.urlPrefix || "";
|
||||
var modulePrefix = route.modulePrefix || "";
|
||||
|
||||
if (route.hasOwnProperty('routes')) {
|
||||
r = route.routes;
|
||||
|
||||
for (i = 0; i < r.length; ++i) {
|
||||
handleRoute(RoutingCache.routes, urlPrefix, modulePrefix, r[i]);
|
||||
}
|
||||
try {
|
||||
if (route.hasOwnProperty('routes') || route.hasOwnProperty('middleware')) {
|
||||
analyseRoute(route);
|
||||
}
|
||||
|
||||
if (route.hasOwnProperty('middleware')) {
|
||||
r = route.middleware;
|
||||
|
||||
for (i = 0; i < r.length; ++i) {
|
||||
handleRoute(RoutingCache.middleware, urlPrefix, modulePrefix, r[i]);
|
||||
}
|
||||
else {
|
||||
installRoute(RoutingCache.routes, "", "", {}, route);
|
||||
}
|
||||
}
|
||||
else {
|
||||
handleRoute(RoutingCache.routes, "", "", route);
|
||||
catch (err) {
|
||||
console.error("cannot install route '%s': %s",
|
||||
route.toString(),
|
||||
String(err.stack || err));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1232,6 +1349,8 @@ function reloadRouting () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function nextRouting (state) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
var k;
|
||||
|
||||
|
@ -1279,6 +1398,8 @@ function nextRouting (state) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function firstRouting (type, parts) {
|
||||
'use strict';
|
||||
|
||||
var url = parts;
|
||||
|
||||
if (typeof url === 'string') {
|
||||
|
@ -1310,22 +1431,6 @@ function firstRouting (type, parts) {
|
|||
});
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks if development mode is allowed in general
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function developmentModeAllowed () {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief checks if development mode is activated for an application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function developmentModeActivated (application) {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1344,6 +1449,8 @@ function developmentModeActivated (application) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function badParameter (req, res, name) {
|
||||
'use strict';
|
||||
|
||||
resultError(req, res, exports.HTTP_BAD, exports.HTTP_BAD,
|
||||
"invalid value for parameter '" + name + "'");
|
||||
}
|
||||
|
@ -1361,6 +1468,8 @@ function badParameter (req, res, name) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultOk (req, res, httpReturnCode, result, headers) {
|
||||
'use strict';
|
||||
|
||||
res.responseCode = httpReturnCode;
|
||||
res.contentType = "application/json; charset=utf-8";
|
||||
|
||||
|
@ -1388,6 +1497,8 @@ function resultOk (req, res, httpReturnCode, result, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultBad (req, res, code, msg, headers) {
|
||||
'use strict';
|
||||
|
||||
resultError(req, res, exports.HTTP_BAD, code, msg, headers);
|
||||
}
|
||||
|
||||
|
@ -1400,6 +1511,8 @@ function resultBad (req, res, code, msg, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultNotFound (req, res, code, msg, headers) {
|
||||
'use strict';
|
||||
|
||||
resultError(req, res, exports.HTTP_NOT_FOUND, code, msg, headers);
|
||||
}
|
||||
|
||||
|
@ -1412,6 +1525,8 @@ function resultNotFound (req, res, code, msg, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultNotImplemented (req, res, msg, headers) {
|
||||
'use strict';
|
||||
|
||||
resultError(req,
|
||||
res,
|
||||
exports.HTTP_NOT_IMPLEMENTED,
|
||||
|
@ -1429,6 +1544,8 @@ function resultNotImplemented (req, res, msg, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultUnsupported (req, res, headers) {
|
||||
'use strict';
|
||||
|
||||
resultError(req, res,
|
||||
exports.HTTP_METHOD_NOT_ALLOWED,
|
||||
arangodb.ERROR_HTTP_METHOD_NOT_ALLOWED,
|
||||
|
@ -1445,6 +1562,8 @@ function resultUnsupported (req, res, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultPermanentRedirect (req, res, destination, headers) {
|
||||
'use strict';
|
||||
|
||||
res.responseCode = exports.HTTP_MOVED_PERMANENTLY;
|
||||
res.contentType = "text/html";
|
||||
|
||||
|
@ -1474,6 +1593,8 @@ function resultPermanentRedirect (req, res, destination, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultTemporaryRedirect (req, res, destination, headers) {
|
||||
'use strict';
|
||||
|
||||
res.responseCode = exports.HTTP_TEMPORARY_REDIRECT;
|
||||
res.contentType = "text/html";
|
||||
|
||||
|
@ -1512,6 +1633,8 @@ function resultTemporaryRedirect (req, res, destination, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultCursor (req, res, cursor, code, options) {
|
||||
'use strict';
|
||||
|
||||
var rows;
|
||||
var count;
|
||||
var hasCount;
|
||||
|
@ -1575,6 +1698,8 @@ function resultCursor (req, res, cursor, code, options) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function collectionNotFound (req, res, collection, headers) {
|
||||
'use strict';
|
||||
|
||||
if (collection === undefined) {
|
||||
resultError(req, res,
|
||||
exports.HTTP_BAD, arangodb.ERROR_HTTP_BAD_PARAMETER,
|
||||
|
@ -1597,6 +1722,8 @@ function collectionNotFound (req, res, collection, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function indexNotFound (req, res, collection, index, headers) {
|
||||
'use strict';
|
||||
|
||||
if (collection === undefined) {
|
||||
resultError(req, res,
|
||||
exports.HTTP_BAD, arangodb.ERROR_HTTP_BAD_PARAMETER,
|
||||
|
@ -1625,6 +1752,8 @@ function indexNotFound (req, res, collection, index, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function resultException (req, res, err, headers) {
|
||||
'use strict';
|
||||
|
||||
var code;
|
||||
var msg;
|
||||
var num;
|
||||
|
@ -1639,10 +1768,10 @@ function resultException (req, res, err, headers) {
|
|||
}
|
||||
|
||||
if (msg === "") {
|
||||
msg = String(err) + ": " + String(err.stack);
|
||||
msg = String(err.stack || err);
|
||||
}
|
||||
else {
|
||||
msg += ": " + String(err.stack);
|
||||
msg += ": " + String(err.stack || err);
|
||||
}
|
||||
|
||||
switch (num) {
|
||||
|
@ -1661,7 +1790,7 @@ function resultException (req, res, err, headers) {
|
|||
else if (err instanceof TypeError) {
|
||||
num = arangodb.ERROR_TYPE_ERROR;
|
||||
code = exports.HTTP_BAD;
|
||||
msg = String(err.message) + ": " + String(err.stack);
|
||||
msg = String(err.stack || err);
|
||||
|
||||
resultError(req, res, code, num, msg, headers);
|
||||
}
|
||||
|
@ -1669,7 +1798,7 @@ function resultException (req, res, err, headers) {
|
|||
else {
|
||||
resultError(req, res,
|
||||
exports.HTTP_SERVER_ERROR, arangodb.ERROR_HTTP_SERVER_ERROR,
|
||||
String(err) + " " + String(err.stack),
|
||||
String(err.stack || err),
|
||||
headers);
|
||||
}
|
||||
}
|
||||
|
@ -1692,6 +1821,8 @@ function resultException (req, res, err, headers) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function echoRequest (req, res, options, next) {
|
||||
'use strict';
|
||||
|
||||
var result;
|
||||
|
||||
result = { request : req, options : options };
|
||||
|
@ -1706,6 +1837,8 @@ function echoRequest (req, res, options, next) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function logRequest (req, res, options, next) {
|
||||
'use strict';
|
||||
|
||||
var log;
|
||||
var level;
|
||||
var token;
|
||||
|
@ -1753,6 +1886,8 @@ function logRequest (req, res, options, next) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function redirectRequest (req, res, options, next) {
|
||||
'use strict';
|
||||
|
||||
if (options.permanently) {
|
||||
resultPermanentRedirect(req, res, options.destination);
|
||||
}
|
||||
|
@ -1766,11 +1901,24 @@ function redirectRequest (req, res, options, next) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function pathHandler (req, res, options, next) {
|
||||
'use strict';
|
||||
|
||||
var filename;
|
||||
var result;
|
||||
|
||||
filename = fs.join(options.path, fs.join.apply(fs.join, req.suffix));
|
||||
|
||||
if (options.hasOwnProperty('root')) {
|
||||
var root = options.root;
|
||||
|
||||
if (root.substr(0, 4) === "app:") {
|
||||
filename = fs.join(module.appPath(), filename);
|
||||
}
|
||||
else if (root.substr(0, 4) === "dev:") {
|
||||
filename = fs.join(module.devAppPath(), filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (fs.exists(filename)) {
|
||||
res.responseCode = exports.HTTP_OK;
|
||||
res.contentType = arangodb.guessContentType(filename);
|
||||
|
@ -1805,8 +1953,6 @@ exports.reloadRouting = reloadRouting;
|
|||
exports.firstRouting = firstRouting;
|
||||
exports.nextRouting = nextRouting;
|
||||
exports.routingCache = function() { return RoutingCache; };
|
||||
exports.developmentModeAllowed = developmentModeAllowed;
|
||||
exports.developmentModeActivated = developmentModeActivated;
|
||||
|
||||
// standard HTTP responses
|
||||
exports.badParameter = badParameter;
|
||||
|
|
|
@ -161,6 +161,7 @@ function installAssets (app, routes) {
|
|||
action: {
|
||||
"do": "org/arangodb/actions/pathHandler",
|
||||
"options": {
|
||||
root: app._id,
|
||||
path: fs.join(app._path, directory)
|
||||
}
|
||||
}
|
||||
|
@ -332,11 +333,25 @@ function routingAalApp (app, mount, prefix) {
|
|||
throw "mount point must be absolute";
|
||||
}
|
||||
|
||||
// compute the collection prefix
|
||||
if (prefix === undefined) {
|
||||
prefix = mount.substr(1).replace(/\//g, "_");
|
||||
}
|
||||
|
||||
// setup the routes
|
||||
routes = {
|
||||
urlPrefix: mount,
|
||||
routes: [],
|
||||
middleware: []
|
||||
middleware: [],
|
||||
context: {},
|
||||
|
||||
appContext: {
|
||||
name: app._name, // app name
|
||||
version: app._version, // app version
|
||||
appId: app._id, // app identifier
|
||||
mount: mount, // global mount
|
||||
collectionPrefix: prefix // collection prefix
|
||||
}
|
||||
};
|
||||
|
||||
routes.routes.push({
|
||||
|
@ -350,11 +365,6 @@ function routingAalApp (app, mount, prefix) {
|
|||
}
|
||||
});
|
||||
|
||||
// compute the collection prefix
|
||||
if (prefix === undefined) {
|
||||
prefix = mount.substr(1).replace(/\//g, "_");
|
||||
}
|
||||
|
||||
// mount all applications
|
||||
apps = app._manifest.apps;
|
||||
|
||||
|
@ -362,51 +372,67 @@ function routingAalApp (app, mount, prefix) {
|
|||
if (apps.hasOwnProperty(i)) {
|
||||
var file = apps[i];
|
||||
|
||||
// set up a context for the applications
|
||||
|
||||
// set up a context for the routing table
|
||||
routes.context[i] = {
|
||||
repositories: {},
|
||||
requires: {}
|
||||
};
|
||||
|
||||
// set up a context for the application start function
|
||||
context = {
|
||||
prefix: arangodb.normalizeURL("/" + i), // app mount
|
||||
|
||||
context: {
|
||||
name: app._name, // app name
|
||||
version: app._version, // app version
|
||||
appId: app._id, // app identifier
|
||||
mount: mount, // global mount
|
||||
collectionPrefix: prefix // collection prefix
|
||||
}
|
||||
requires: {},
|
||||
routingInfo: {}
|
||||
};
|
||||
|
||||
app.loadAppScript(app.createAppModule(), file, context);
|
||||
|
||||
if (context.routingInfo !== undefined) {
|
||||
var ri = context.routingInfo;
|
||||
var p = ri.urlPrefix;
|
||||
var route;
|
||||
var j;
|
||||
// .............................................................................
|
||||
// routingInfo
|
||||
// .............................................................................
|
||||
|
||||
if (ri.hasOwnProperty("routes")) {
|
||||
for (j = 0; j < ri.routes.length; ++j) {
|
||||
route = ri.routes[j];
|
||||
var ri = context.routingInfo;
|
||||
var p = ri.urlPrefix;
|
||||
var route;
|
||||
var j;
|
||||
var k;
|
||||
|
||||
var rm = [ "routes", "middleware" ];
|
||||
|
||||
for (k = 0; k < rm.length; ++k) {
|
||||
var key = rm[k];
|
||||
|
||||
if (ri.hasOwnProperty(key)) {
|
||||
var rt = ri[key];
|
||||
|
||||
for (j = 0; j < rt.length; ++j) {
|
||||
route = rt[j];
|
||||
|
||||
if (route.hasOwnProperty("url")) {
|
||||
route.url.match = arangodb.normalizeURL(p + "/" + route.url.match);
|
||||
}
|
||||
|
||||
routes.routes.push(route);
|
||||
route.context = i;
|
||||
|
||||
routes[key].push(route);
|
||||
}
|
||||
}
|
||||
|
||||
if (ri.hasOwnProperty("middleware")) {
|
||||
for (j = 0; j < ri.middleware.length; ++j) {
|
||||
route = ri.middleware[j];
|
||||
// .............................................................................
|
||||
// repositories
|
||||
// .............................................................................
|
||||
|
||||
if (route.hasOwnProperty("url")) {
|
||||
route.url.match = arangodb.normalizeURL(p + "/" + route.url.match);
|
||||
}
|
||||
|
||||
routes.middleware.push(route);
|
||||
}
|
||||
if (ri.hasOwnProperty("repositories")) {
|
||||
routes.context[i].repositories = ri.repositories;
|
||||
}
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// requires
|
||||
// .............................................................................
|
||||
|
||||
routes.context[i].requires = context.requires;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,14 @@ var Application,
|
|||
/// @fn JSF_foxx_createUrlObject
|
||||
/// @brief create a new url object
|
||||
///
|
||||
/// This creates a new `UrlObject`.
|
||||
/// ArangoDB uses a certain structure we refer to as `UrlObject`.
|
||||
/// With the following function (which is only internal, and not
|
||||
/// exported) you can create an UrlObject with a given URL,
|
||||
/// a constraint and a method. For example:
|
||||
///
|
||||
/// @EXAMPLES
|
||||
/// internal.createUrlObject('/lecker/gans', null, 'get')
|
||||
/// internal.createUrlObject('/lecker/gans', null, 'get');
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.createUrlObject = function (url, constraint, method) {
|
||||
|
@ -83,8 +84,7 @@ internal.createUrlObject = function (url, constraint, method) {
|
|||
/// @fn JSF_foxx_application_initializer
|
||||
/// @brief Create a new Application
|
||||
///
|
||||
/// And that's Application. It's a constructor, so call it like this:
|
||||
/// It takes two optional arguments as displayed above:
|
||||
/// This creates a new Application. It takes two optional arguments as displayed above:
|
||||
/// * **The URL Prefix:** All routes you define within will be prefixed with it
|
||||
/// * **The Template Collection:** More information in the template section
|
||||
///
|
||||
|
@ -144,16 +144,11 @@ _.extend(Application.prototype, {
|
|||
|
||||
start: function (context) {
|
||||
'use strict';
|
||||
var requires = this.requires,
|
||||
prefix = context.prefix;
|
||||
var prefix = context.prefix;
|
||||
|
||||
this.routingInfo.urlPrefix = prefix + "/" + this.routingInfo.urlPrefix;
|
||||
|
||||
_.each(this.routingInfo.routes, function (route) {
|
||||
route.action.context = context.context;
|
||||
route.action.requiresLibs = requires;
|
||||
});
|
||||
|
||||
context.requires = this.requires;
|
||||
context.routingInfo = this.routingInfo;
|
||||
},
|
||||
|
||||
|
@ -289,7 +284,7 @@ _.extend(Application.prototype, {
|
|||
/// See above for the arguments you can give.
|
||||
/// **A word of warning:** Do not forget that `delete` is
|
||||
/// a reserved word in JavaScript and therefore needs to be
|
||||
/// called as `app['delete']`. There is also an alias `del`
|
||||
/// called as app['delete']. There is also an alias `del`
|
||||
/// for this very reason.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
|
@ -400,6 +395,7 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_accepts
|
||||
/// @brief Shortform for using the FormatMiddleware
|
||||
///
|
||||
/// Shortform for using the FormatMiddleware
|
||||
/// More information about the FormatMiddleware in the corresponding section.
|
||||
/// This is a shortcut to add the middleware to your application:
|
||||
///
|
||||
|
@ -440,6 +436,7 @@ _.extend(RequestContext.prototype, {
|
|||
/// @fn JSF_foxx_RequestContext_pathParam
|
||||
/// @brief Describe a Path Parameter
|
||||
///
|
||||
/// Describe a Path Paramter:
|
||||
/// If you defined a route "/foxx/:id", you can constrain which format the id
|
||||
/// can have by giving a type. We currently support the following types:
|
||||
///
|
||||
|
@ -480,6 +477,7 @@ _.extend(RequestContext.prototype, {
|
|||
/// @fn JSF_foxx_RequestContext_queryParam
|
||||
/// @brief Describe a Query Parameter
|
||||
///
|
||||
/// Describe a Query Parameter:
|
||||
/// If you defined a route "/foxx", you can constrain which format a query
|
||||
/// parameter (`/foxx?a=12`) can have by giving it a type.
|
||||
/// We currently support the following types:
|
||||
|
@ -517,7 +515,7 @@ _.extend(RequestContext.prototype, {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_RequestContext_nickname
|
||||
/// @brief Set the nickname for this route in the documentation
|
||||
/// Set the nickname for this route in the documentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nickname: function (nickname) {
|
||||
|
@ -533,6 +531,7 @@ _.extend(RequestContext.prototype, {
|
|||
/// @fn JSF_foxx_RequestContext_summary
|
||||
/// @brief Set the summary for this route in the documentation
|
||||
///
|
||||
/// Set the summary for this route in the documentation
|
||||
/// Can't be longer than 60 characters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -548,6 +547,8 @@ _.extend(RequestContext.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_RequestContext_notes
|
||||
/// @brief Set the notes for this route in the documentation
|
||||
///
|
||||
/// Set the notes for this route in the documentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
notes: function (notes) {
|
||||
|
@ -860,11 +861,6 @@ FormatMiddleware = function (allowedFormats, defaultFormat) {
|
|||
Model = function (attributes) {
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_model_attributes
|
||||
/// @brief The attributes property is the internal hash containing the model's state.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
this.attributes = attributes || {};
|
||||
};
|
||||
|
||||
|
@ -873,6 +869,7 @@ _.extend(Model.prototype, {
|
|||
/// @fn JSF_foxx_model_get
|
||||
/// @brief Get the value of an attribute
|
||||
///
|
||||
/// Get the value of an attribute
|
||||
/// @EXAMPLES
|
||||
/// instance = new Model({
|
||||
/// a: 1
|
||||
|
@ -889,6 +886,7 @@ _.extend(Model.prototype, {
|
|||
/// @fn JSF_foxx_model_set
|
||||
/// @brief Set the value of an attribute
|
||||
///
|
||||
/// Set the value of an attribute
|
||||
/// @EXAMPLES
|
||||
/// instance = new Model({
|
||||
/// a: 1
|
||||
|
@ -905,6 +903,7 @@ _.extend(Model.prototype, {
|
|||
/// @fn JSF_foxx_model_has
|
||||
/// @brief Returns true if the attribute is set to a non-null or non-undefined value.
|
||||
///
|
||||
/// Returns true if the attribute is set to a non-null or non-undefined value.
|
||||
/// @EXAMPLES
|
||||
/// instance = new Model({
|
||||
/// a: 1
|
||||
|
@ -921,7 +920,10 @@ _.extend(Model.prototype, {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_model_toJSON
|
||||
/// @brief Return a copy of the model which can be saved into ArangoDB (or send to the client).
|
||||
/// @brief Return a copy of the model which can be saved into ArangoDB
|
||||
///
|
||||
/// Return a copy of the model which can be saved into ArangoDB
|
||||
/// (or send to the client).
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
toJSON: function () {
|
||||
|
@ -932,6 +934,8 @@ _.extend(Model.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_model_extend
|
||||
/// @brief Extend the Model prototype to add or overwrite methods.
|
||||
///
|
||||
/// Extend the Model prototype to add or overwrite methods.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Model.extend = backbone_helpers.extend;
|
||||
|
@ -940,6 +944,7 @@ Model.extend = backbone_helpers.extend;
|
|||
/// @fn JSF_foxx_repository_initializer
|
||||
/// @brief Create a new instance of Repository
|
||||
///
|
||||
/// Create a new instance of Repository
|
||||
/// A Foxx Repository is always initialized with the prefix, the collection and the modelPrototype.
|
||||
/// If you initialize a model, you can give it initial data as an object.
|
||||
///
|
||||
|
@ -950,31 +955,16 @@ Model.extend = backbone_helpers.extend;
|
|||
Repository = function (prefix, collection, modelPrototype) {
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_repository_prefix
|
||||
/// @brief The prefix of the application.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
this.prefix = prefix;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_repository_collection
|
||||
/// @brief The collection object.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
this.collection = collection;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_repository_modelPrototype
|
||||
/// @brief The prototype of the according model.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
this.modelPrototype = modelPrototype;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_repository_extend
|
||||
/// @brief Extend the Repository prototype to add or overwrite methods.
|
||||
///
|
||||
/// Extend the Repository prototype to add or overwrite methods.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Repository.extend = backbone_helpers.extend;
|
||||
|
|
Loading…
Reference in New Issue