Skip to content

Commit fdb0746

Browse files
committed
Merge pull request #7 from SierraSoftworks/typescript
Iridium vNext
2 parents 9a250c3 + cab9a81 commit fdb0746

File tree

193 files changed

+18762
-3526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+18762
-3526
lines changed

.gitignore

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
Properties
2-
bin
3-
obj
1+
Properties/
2+
bin/
3+
obj/
44
*.suo
55
*.user
66
*.sublime*
7-
node_modules
7+
node_modules/
8+
.vs
9+
*.dat
10+
.idea
11+
dist/
12+
*.tmp
13+
coverage/

.jshintrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"bitwise": false,
3+
"curly": false,
4+
"eqeqeq": false,
5+
"forin": false,
6+
"freeze": true,
7+
"immed": false,
8+
"newcap": true,
9+
"noarg": true,
10+
"noempty": true,
11+
"plusplus": false,
12+
"undef": true,
13+
"unused": true,
14+
"maxcomplexity": 40,
15+
"asi": false,
16+
"boss": true,
17+
"debug": false,
18+
"eqnull": false,
19+
"evil": false,
20+
21+
"node": true
22+
}

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
language: node_js
22
node_js:
3-
- "0.8"
43
- "0.10"
5-
- "0.11"
64

75
services:
86
- mongodb
7+
98
env:
10-
- CI_SERVER=1
9+
- CI_SERVER=1
10+
11+
addons:
12+
code_climate:
13+
repo_token: 9c90177b42d39905ca635b1f6226580dab5799f87f172b66bab4e8df77b67a13
14+
15+
after_script:
16+
- coveralls < coverage/lcov.info
17+
- codeclimate < coverage/lcov.info

CHANGELOG

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# v4.0.0
2+
- Removed automatic schema extensions
3+
This was done for two reasons, firstly it simplifies the process of loading documents from the database a small amount.
4+
The bigger reason is pure performance. Not only do we cut down on the number of properties which need to be defined
5+
on new instances (if they aren't in the static schema) but by preventing modifications to the object structure we
6+
prevent V8 from de-optimizing the code.
7+
- Instance original object is no longer cloned
8+
This should result in a small performance boost and shouldn't break any existing code (unless it was doing weird stuff
9+
with the private API... you haven't been messing with the private API have you?)
10+
- Removed support for the event emitter implementation
11+
With the adoption of promises, its use has become less pronounced and its removal will further simplify the codebase
12+
and help boost performance.
13+
- All hook signatures have been changed
14+
The first argument has become the value which was previously `this`. This should enable more explicit code and support
15+
for TypeScript.
16+
- Model options `preprocessors` renamed to `transforms`
17+
Makes it a little bit more clear what these are to be used for
18+
- Caching infrastructure updated
19+
We've separated the cache implementations (get/set/clear) from the logic dictating how to cache something (can/key)
20+
to make implementing the two parts easier. The cache implementation is now set on the core while the model provides
21+
the cache controller dictating how caching is performed.

Iridium.njsproj

Lines changed: 108 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,141 @@
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<SchemaVersion>2.0</SchemaVersion>
6-
<ProjectGuid>{a2511e8c-33be-4b8d-8203-70d403aa446a}</ProjectGuid>
6+
<ProjectGuid>{e9a19872-d84f-418a-8332-3ded543fb1fa}</ProjectGuid>
77
<ProjectHome />
88
<ProjectView>ShowAllFiles</ProjectView>
9-
<StartupFile>index.js</StartupFile>
9+
<StartupFile>node_modules\mocha\bin\mocha</StartupFile>
1010
<WorkingDirectory>.</WorkingDirectory>
1111
<OutputPath>.</OutputPath>
1212
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
13+
<TypeScriptSourceMap>true</TypeScriptSourceMap>
14+
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
15+
<EnableTypeScript>true</EnableTypeScript>
1316
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
1417
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
18+
<NodeExePath>C:\Program Files\iojs\iojs.exe</NodeExePath>
19+
<StartWebBrowser>False</StartWebBrowser>
1520
</PropertyGroup>
1621
<PropertyGroup Condition="'$(Configuration)' == 'Debug'" />
1722
<PropertyGroup Condition="'$(Configuration)' == 'Release'" />
1823
<ItemGroup>
1924
<Content Include=".gitattributes" />
2025
<Content Include=".gitignore" />
2126
<Content Include=".travis.yml" />
27+
<Content Include="CHANGELOG" />
28+
<Content Include="doc\Migrating from 4.x to 5.x.md" />
2229
<Content Include="LICENCE" />
2330
<Content Include="package.json" />
31+
<Content Include="tsd.json" />
2432
<Content Include="README.md" />
25-
<Compile Include="index.js" />
26-
<Content Include=".git\ms-persist.xml" />
27-
<Compile Include="benchmarks\mongodb.js" />
28-
<Compile Include="example\LowercaseCollectionsPlugin.js" />
29-
<Compile Include="example\StringCaseValidationPlugin.js" />
30-
<Compile Include="example\UserModel.js" />
31-
<Compile Include="lib\Database.js" />
32-
<Compile Include="lib\Instance.js" />
33-
<Compile Include="lib\Model.js" />
34-
<Compile Include="lib\utils\Inherit.js" />
35-
<Compile Include="test\bugs.js" />
36-
<Compile Include="test\cache.js" />
37-
<Compile Include="test\config.js" />
38-
<Compile Include="test\diff.js" />
39-
<Compile Include="test\find.js" />
40-
<Compile Include="test\findOne.js" />
41-
<Compile Include="test\hooks.js" />
42-
<Compile Include="test\insertion.js" />
43-
<Compile Include="test\instance_db.js" />
44-
<Compile Include="test\instance_helpers.js" />
45-
<Compile Include="test\instance_setup.js" />
46-
<Compile Include="example\IntelliSense.js" />
47-
<Compile Include="test\model.js" />
48-
<Compile Include="test\plugins.js" />
49-
<Compile Include="lib\caches\NoOpCache.js" />
50-
<Compile Include="lib\utils\diff.js" />
51-
<Compile Include="lib\utils\String.js" />
33+
<Compile Include="index.ts" />
34+
<Compile Include="example\ModelHookPlugin.ts" />
35+
<Compile Include="example\ValidationPlugin.ts" />
36+
<Compile Include="example\UserModel.ts" />
37+
<TypeScriptCompile Include="benchmarks\mongodb.ts" />
38+
<TypeScriptCompile Include="example\IntelliSense.ts" />
39+
<TypeScriptCompile Include="lib\Cache.ts" />
40+
<TypeScriptCompile Include="lib\CacheDirector.ts" />
41+
<TypeScriptCompile Include="lib\Configuration.ts" />
42+
<TypeScriptCompile Include="lib\Core.ts" />
43+
<TypeScriptCompile Include="lib\Cursor.ts" />
44+
<TypeScriptCompile Include="lib\General.ts" />
45+
<TypeScriptCompile Include="lib\Hooks.ts" />
46+
<TypeScriptCompile Include="lib\Index.ts" />
47+
<TypeScriptCompile Include="lib\Instance.ts" />
48+
<TypeScriptCompile Include="lib\Middleware.ts" />
49+
<TypeScriptCompile Include="lib\Model.ts" />
50+
<TypeScriptCompile Include="lib\ModelCache.ts" />
51+
<TypeScriptCompile Include="lib\ModelHandlers.ts" />
52+
<TypeScriptCompile Include="lib\ModelHelpers.ts" />
53+
<TypeScriptCompile Include="lib\ModelInterfaces.ts" />
54+
<TypeScriptCompile Include="lib\ModelOptions.ts" />
55+
<TypeScriptCompile Include="lib\ModelSpecificInstance.ts" />
56+
<TypeScriptCompile Include="lib\Plugins.ts" />
57+
<TypeScriptCompile Include="lib\Schema.ts" />
58+
<Content Include="test\mocha.opts" />
59+
<TypeScriptCompile Include="test\Cache.ts">
60+
<SubType>Code</SubType>
61+
<TestFramework>Mocha</TestFramework>
62+
</TypeScriptCompile>
63+
<TypeScriptCompile Include="test\Core.ts">
64+
<SubType>Code</SubType>
65+
<TestFramework>Mocha</TestFramework>
66+
</TypeScriptCompile>
67+
<TypeScriptCompile Include="test\Hooks.ts">
68+
<SubType>Code</SubType>
69+
<TestFramework>Mocha</TestFramework>
70+
</TypeScriptCompile>
71+
<TypeScriptCompile Include="test\Instance.ts">
72+
<SubType>Code</SubType>
73+
<TestFramework>Mocha</TestFramework>
74+
</TypeScriptCompile>
75+
<TypeScriptCompile Include="test\Iridium.ts">
76+
<TestFramework>Mocha</TestFramework>
77+
</TypeScriptCompile>
78+
<TypeScriptCompile Include="test\Model.ts">
79+
<TestFramework>Mocha</TestFramework>
80+
</TypeScriptCompile>
81+
<TypeScriptCompile Include="test\Omnom.ts">
82+
<SubType>Code</SubType>
83+
<TestFramework>Mocha</TestFramework>
84+
</TypeScriptCompile>
85+
<TypeScriptCompile Include="test\Plugins.ts">
86+
<TestFramework>Mocha</TestFramework>
87+
</TypeScriptCompile>
88+
<TypeScriptCompile Include="test\support\chai.ts" />
89+
<TypeScriptCompile Include="test\Validation.ts">
90+
<TestFramework>Mocha</TestFramework>
91+
</TypeScriptCompile>
92+
<TypeScriptCompile Include="_references.d.ts" />
93+
<TypeScriptCompile Include="typings\chai-as-promised\chai-as-promised.d.ts" />
94+
<TypeScriptCompile Include="typings\chai-fuzzy\chai-fuzzy.d.ts" />
95+
<TypeScriptCompile Include="typings\chai\chai.d.ts" />
96+
<TypeScriptCompile Include="typings\mocha\mocha.d.ts" />
97+
<TypeScriptCompile Include="typings\tsd.d.ts" />
98+
<TypeScriptCompile Include="lib\cacheControllers\IDDirector.ts" />
99+
<TypeScriptCompile Include="lib\caches\MemoryCache.ts" />
100+
<TypeScriptCompile Include="lib\caches\NoOpCache.ts" />
101+
<TypeScriptCompile Include="lib\middleware\Express.ts" />
102+
<TypeScriptCompile Include="lib\utils\Omnom.ts" />
103+
<Content Include="test\support\config.json" />
104+
<Compile Include="test\support\config.ts" />
105+
<TypeScriptCompile Include="typings\bluebird\bluebird.d.ts" />
106+
<TypeScriptCompile Include="typings\concoction\concoction.d.ts" />
107+
<TypeScriptCompile Include="typings\lodash\lodash.d.ts" />
108+
<TypeScriptCompile Include="typings\mongodb\mongodb.d.ts" />
109+
<TypeScriptCompile Include="typings\node\node.d.ts" />
110+
<TypeScriptCompile Include="typings\skmatc\skmatc.d.ts" />
52111
</ItemGroup>
53112
<ItemGroup>
54-
<Folder Include=".git" />
55113
<Folder Include="benchmarks" />
56-
<Folder Include="doc\" />
114+
<Folder Include="doc" />
57115
<Folder Include="example" />
58116
<Folder Include="lib" />
117+
<Folder Include="lib\cacheControllers" />
59118
<Folder Include="lib\caches" />
119+
<Folder Include="lib\middleware" />
60120
<Folder Include="lib\utils" />
61121
<Folder Include="test" />
122+
<Folder Include="test\support" />
123+
<Folder Include="typings" />
124+
<Folder Include="typings\bluebird" />
125+
<Folder Include="typings\chai-as-promised\" />
126+
<Folder Include="typings\chai-fuzzy\" />
127+
<Folder Include="typings\chai\" />
128+
<Folder Include="typings\concoction" />
129+
<Folder Include="typings\lodash" />
130+
<Folder Include="typings\mocha\" />
131+
<Folder Include="typings\mongodb" />
132+
<Folder Include="typings\node" />
133+
<Folder Include="typings\skmatc" />
62134
</ItemGroup>
63135
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
136+
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
137+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
138+
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
139+
</PropertyGroup>
140+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
64141
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
65142
<ProjectExtensions>
66143
<VisualStudio>

Iridium.sln

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.21005.1
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.22609.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Iridium", "Iridium.njsproj", "{A2511E8C-33BE-4B8D-8203-70D403AA446A}"
6+
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Iridium", "Iridium.njsproj", "{E9A19872-D84F-418A-8332-3DED543FB1FA}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{A2511E8C-33BE-4B8D-8203-70D403AA446A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{A2511E8C-33BE-4B8D-8203-70D403AA446A}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{A2511E8C-33BE-4B8D-8203-70D403AA446A}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{A2511E8C-33BE-4B8D-8203-70D403AA446A}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{E9A19872-D84F-418A-8332-3DED543FB1FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E9A19872-D84F-418A-8332-3DED543FB1FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E9A19872-D84F-418A-8332-3DED543FB1FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E9A19872-D84F-418A-8332-3DED543FB1FA}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Iridium [![Build Status](https://travis-ci.org/SierraSoftworks/Iridium.png?branch=master)](https://travis-ci.org/SierraSoftworks/Iridium) [![](https://badge.fury.io/js/iridium.png)](https://npmjs.org/package/iridium)
2-
**A bare metal ORM for MongoDB**
1+
# Iridium [![Build Status](https://travis-ci.org/SierraSoftworks/Iridium.png?branch=master)](https://travis-ci.org/SierraSoftworks/Iridium) [![Coverage Status](https://coveralls.io/repos/SierraSoftworks/Iridium/badge.svg?branch=typescript)](https://coveralls.io/r/SierraSoftworks/Iridium?branch=typescript) [![](https://badge.fury.io/js/iridium.png)](https://npmjs.org/package/iridium) [![Code Climate](https://codeclimate.com/github/SierraSoftworks/Iridium/badges/gpa.svg)](https://codeclimate.com/github/SierraSoftworks/Iridium) [![Test Coverage](https://codeclimate.com/github/SierraSoftworks/Iridium/badges/coverage.svg)](https://codeclimate.com/github/SierraSoftworks/Iridium)
2+
**A bare metal ODM for MongoDB**
3+
4+
Iridium isn't your traditional JavaScript ORM, it's the ORM I've always wanted and I hope you'll enjoy using it as much
5+
as I do. With Iridium, your models are simply JavaScript classes (if you're using ES6 or TypeScript) which means that
6+
you don't need to learn a new DSL just to define your database structure and that your favourite editor will be able
7+
to understand your code and provide useful suggestions.
8+
9+
## NOT YET FINISHED
10+
The TypeScript implementation of Iridium is not yet finished - if you'd like to help out then please get in touch but **DO NOT START BUILDING APPS USING IT YET**. Seriously, it doesn't even have an official version number yet - everything is subject to change.
311

412
<script id='fb5ea3m'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//api.flattr.com/button/view/?uid=SierraSoftworks&button=compact&url='+encodeURIComponent(document.URL);f.title='Flattr';f.height=20;f.width=110;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fb5ea3m');</script>
513

_references.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference path="./typings/tsd.d.ts" />
2+
/// <reference path="./typings/skmatc/skmatc.d.ts" />
3+
/// <reference path="./typings/concoction/concoction.d.ts" />

0 commit comments

Comments
 (0)