Skip to content

Commit de5d759

Browse files
Erwan CarriouErwan Carriou
authored andcommitted
- send events on $db.update
- fix a bug on links API
1 parent e013fce commit de5d759

File tree

11 files changed

+240
-210
lines changed

11 files changed

+240
-210
lines changed

build/syrup.json

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,172 +1069,172 @@
10691069
"core": true,
10701070
"useCoreAPI": true
10711071
},
1072-
"1663c164fe1f544": {
1073-
"_id": "1663c164fe1f544",
1072+
"1cb7b125d61fdef": {
1073+
"_id": "1cb7b125d61fdef",
10741074
"component": "Syrup",
10751075
"state": "error",
10761076
"action": "function error(data) {\n console.error('syrup: ' + data.message, data.error);\n}",
10771077
"core": true
10781078
},
1079-
"117001257a17cc0": {
1080-
"_id": "117001257a17cc0",
1079+
"1811a1db08170f4": {
1080+
"_id": "1811a1db08170f4",
10811081
"component": "Syrup",
10821082
"state": "system",
10831083
"action": "function system(name) {\n var System = null,\n system = {},\n systemId = '',\n result = [],\n conf = {};\n \n if (name) {\n conf.master = true;\n conf.name = name;\n System = this.require('SyrupSystem');\n system = new System(conf);\n } else {\n result = $db.SyrupSystem.find({\n 'master': true\n });\n if (result.length) {\n systemId = result[0]._id;\n system = $component.get(systemId);\n }\n }\n return system;\n}",
10841084
"core": true,
10851085
"useCoreAPI": true
10861086
},
1087-
"124cf18d4415558": {
1088-
"_id": "124cf18d4415558",
1087+
"17d1a1fc3f1bf7c": {
1088+
"_id": "17d1a1fc3f1bf7c",
10891089
"component": "Syrup",
10901090
"state": "warning",
10911091
"action": "function warning(message) {\n console.warn('syrup: ' + message);\n}",
10921092
"core": true
10931093
},
1094-
"1e2ad1cbd01b1bc": {
1095-
"_id": "1e2ad1cbd01b1bc",
1094+
"174ad1a50411fd1": {
1095+
"_id": "174ad1a50411fd1",
10961096
"component": "SyrupClassInfo",
10971097
"state": "collection",
10981098
"action": "function collection(name) {\n var result = {};\n if (this.metamodel()[name] === 'collection') {\n result = this.model()[name];\n } \n \n return result; \n}",
10991099
"core": true
11001100
},
1101-
"1feda14e911ae6b": {
1102-
"_id": "1feda14e911ae6b",
1101+
"1ff341e9181fe85": {
1102+
"_id": "1ff341e9181fe85",
11031103
"component": "SyrupClassInfo",
11041104
"state": "collections",
11051105
"action": "function collections() {\n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n \n length = keys.length; \n \n for (i = 0; i < length; i++) { \n item = keys[i]; \n if (this.metamodel()[item] === 'collection') {\n result.push(item);\n }\n }\n \n return result;\n}",
11061106
"core": true
11071107
},
1108-
"14997118de177a3": {
1109-
"_id": "14997118de177a3",
1108+
"1fb4616219141df": {
1109+
"_id": "1fb4616219141df",
11101110
"component": "SyrupClassInfo",
11111111
"state": "event",
11121112
"action": "function event(name) {\n var result = {};\n \n if (this.metamodel()[name] === 'event') {\n result = this.model()[name];\n } \n \n return result;\n}",
11131113
"core": true
11141114
},
1115-
"100e1107981d38e": {
1116-
"_id": "100e1107981d38e",
1115+
"162cf121111f67d": {
1116+
"_id": "162cf121111f67d",
11171117
"component": "SyrupClassInfo",
11181118
"state": "events",
11191119
"action": "function events() {\n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n \n length = keys.length;\n \n for (i = 0; i < length; i++) {\n item = keys[i];\n if (this.metamodel()[item] === 'event') {\n result.push(item);\n }\n } \n return result;\n}",
11201120
"core": true
11211121
},
1122-
"1bd1a1975f138d8": {
1123-
"_id": "1bd1a1975f138d8",
1122+
"120ce1b0541c51e": {
1123+
"_id": "120ce1b0541c51e",
11241124
"component": "SyrupClassInfo",
11251125
"state": "link",
11261126
"action": "function link(name) {\n var result = {};\n \n if (this.metamodel()[name] === 'link') {\n result = this.model()[name];\n }\n return result;\n}",
11271127
"core": true
11281128
},
1129-
"1a675193e9171e9": {
1130-
"_id": "1a675193e9171e9",
1129+
"117661280f156e2": {
1130+
"_id": "117661280f156e2",
11311131
"component": "SyrupClassInfo",
11321132
"state": "links",
1133-
"action": "function links() { \n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n length = keys.length;\n \n for (i = 0; i < length; i++) {\n item = keys[i];\n if (this.metamodel()[item] === 'links') {\n result.push(item);\n }\n } return result;\n}",
1133+
"action": "function links() { \n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n length = keys.length;\n \n for (i = 0; i < length; i++) {\n item = keys[i];\n if (this.metamodel()[item] === 'link') {\n result.push(item);\n }\n } return result;\n}",
11341134
"core": true
11351135
},
1136-
"1d0cf1724810462": {
1137-
"_id": "1d0cf1724810462",
1136+
"12c211141516b2a": {
1137+
"_id": "12c211141516b2a",
11381138
"component": "SyrupClassInfo",
11391139
"state": "method",
11401140
"action": "function method(name) {\n var result = {};\n if (this.metamodel()[name] === 'method') {\n result = this.model()[name];\n \n }\n \n return result;\n}",
11411141
"core": true
11421142
},
1143-
"1cd8d1e1ca17958": {
1144-
"_id": "1cd8d1e1ca17958",
1143+
"18d921de371ac94": {
1144+
"_id": "18d921de371ac94",
11451145
"component": "SyrupClassInfo",
11461146
"state": "methods",
11471147
"action": "function methods() {\n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n length = keys.length;\n for (i = 0; i < length; i++) {\n item = keys[i];\n if (this.metamodel()[item] === 'method') {\n result.push(item);\n }\n } \n \n return result;\n}",
11481148
"core": true
11491149
},
1150-
"171ee129a6168ac": {
1151-
"_id": "171ee129a6168ac",
1150+
"1dcba1e3661d68d": {
1151+
"_id": "1dcba1e3661d68d",
11521152
"component": "SyrupClassInfo",
11531153
"state": "properties",
11541154
"action": "function properties() { \n var keys = Object.keys(this.metamodel()),\n item = '',\n result = [],\n i = 0,\n length = 0;\n length = keys.length;\n \n for (i = 0; i < length; i++) {\n item = keys[i];\n if (this.metamodel()[item] === 'property') {\n result.push(item);\n }\n } return result;\n}",
11551155
"core": true
11561156
},
1157-
"10d5d148c215309": {
1158-
"_id": "10d5d148c215309",
1157+
"1fd2511eec1170d": {
1158+
"_id": "1fd2511eec1170d",
11591159
"component": "SyrupClassInfo",
11601160
"state": "property",
11611161
"action": "function property(name) {\n var result = {};\n \n if (this.metamodel()[name] === 'property') {\n result = this.model()[name];\n }\n return result;\n}",
11621162
"core": true
11631163
},
1164-
"137e21e5f419637": {
1165-
"_id": "137e21e5f419637",
1164+
"17e181c4a714c72": {
1165+
"_id": "17e181c4a714c72",
11661166
"component": "SyrupComponent",
11671167
"state": "destroy",
11681168
"action": "function destroy() {\n $component.destroy(this.id());\n}",
11691169
"core": true,
11701170
"useCoreAPI": true
11711171
},
1172-
"1d4e5141b910e10": {
1173-
"_id": "1d4e5141b910e10",
1172+
"13b1617c7c17589": {
1173+
"_id": "13b1617c7c17589",
11741174
"component": "SyrupComponent",
11751175
"state": "off",
11761176
"action": "function off(state, behaviorId) {\n var args = [],\n i = 0,\n length = 0;\n length = arguments.length;\n \n for (i = 0; i < length - 6; i++) {\n args.push(arguments[i]);\n }\n \n if ($workflow.checkParams({\n \"component\": this, \n \"methodName\": \"off\", \n \"args\": args\n })) {\n \n if (state || behaviorId) {\n if ($metamodel.isValidState(state, this.constructor.name)) {\n $behavior.remove({\n \"behaviorId\": behaviorId, \n \"componentId\": this.id(), \n \"state\": state\n });\n } else { \n console.warn(\"syrup: invoke \\'off\\' method of component '\" + this.id() + \"' with an invalid state '\" + state + \"'\"); \n }\n } else {\n $behavior.remove({\n \"componentId\": this.id()\n });\n }\n }\n}",
11771177
"core": true,
11781178
"useCoreAPI": true
11791179
},
1180-
"17cf51b3241f3d8": {
1181-
"_id": "17cf51b3241f3d8",
1180+
"1191d1d8cc1f690": {
1181+
"_id": "1191d1d8cc1f690",
11821182
"component": "SyrupComponent",
11831183
"state": "require",
11841184
"action": "function require(id) {\n return $component.get(id);\n}",
11851185
"core": true,
11861186
"useCoreAPI": true
11871187
},
1188-
"1081814d661280e": {
1189-
"_id": "1081814d661280e",
1188+
"18d8412a8d1fd85": {
1189+
"_id": "18d8412a8d1fd85",
11901190
"component": "SyrupDatabase",
11911191
"state": "collections",
11921192
"action": "function collections() {\n var result = {},\n collectionName = '';\n \n for (collectionName in $db.store) {\n if ($db.store.hasOwnProperty(collectionName) && collectionName.indexOf('Syrup') !== 0) {\n result[collectionName] = $db[collectionName];\n \n }\n }\n return result;\n}",
11931193
"core": true,
11941194
"useCoreAPI": true
11951195
},
1196-
"11f4f118f714cbf": {
1197-
"_id": "11f4f118f714cbf",
1196+
"158da10f6b1fa6c": {
1197+
"_id": "158da10f6b1fa6c",
11981198
"component": "SyrupDatabase",
11991199
"state": "subsystem",
12001200
"action": "function subsystem(params) {\n return $db.subsystem(params);\n}",
12011201
"core": true,
12021202
"useCoreAPI": true
12031203
},
1204-
"13af01083d1486d": {
1205-
"_id": "13af01083d1486d",
1204+
"126a51fdcb199db": {
1205+
"_id": "126a51fdcb199db",
12061206
"component": "SyrupDatabase",
12071207
"state": "system",
12081208
"action": "function system(system) {\n return $db.system(system);\n}",
12091209
"core": true,
12101210
"useCoreAPI": true
12111211
},
1212-
"1ef1a1ed181b217": {
1213-
"_id": "1ef1a1ed181b217",
1212+
"143ec1e1bc17977": {
1213+
"_id": "143ec1e1bc17977",
12141214
"component": "SyrupMetamodel",
12151215
"state": "create",
12161216
"action": "function create() {\n $metamodel.create();\n}",
12171217
"core": true,
12181218
"useCoreAPI": true
12191219
},
1220-
"1111c133071dbb7": {
1221-
"_id": "1111c133071dbb7",
1220+
"1f93c1a1321340d": {
1221+
"_id": "1f93c1a1321340d",
12221222
"component": "SyrupMetamodel",
12231223
"state": "schema",
12241224
"action": "function schema(schema) {\n $metamodel.schema(schema);\n}",
12251225
"core": true,
12261226
"useCoreAPI": true
12271227
},
1228-
"180ab147ec192ce": {
1229-
"_id": "180ab147ec192ce",
1228+
"117ef1b10412e4d": {
1229+
"_id": "117ef1b10412e4d",
12301230
"component": "SyrupMetamodel",
12311231
"state": "type",
12321232
"action": "function type(type) {\n $metamodel.type(type);\n}",
12331233
"core": true,
12341234
"useCoreAPI": true
12351235
},
1236-
"17c4d19f791be30": {
1237-
"_id": "17c4d19f791be30",
1236+
"123c91631b10172": {
1237+
"_id": "123c91631b10172",
12381238
"component": "SyrupSystem",
12391239
"state": "sync",
12401240
"action": "function sync() {\n var system = JSON.parse($db.system());\n \n this.schemas(system.schemas);\n this.types(system.types);\n this.behaviors(system.behaviors);\n this.components(system.components);\n}",

0 commit comments

Comments
 (0)