diff --git a/src/Core/Compiler/Compiler/ExpressionBuilder.cs b/src/Core/Compiler/Compiler/ExpressionBuilder.cs index 9d1d38c46..7faed834a 100644 --- a/src/Core/Compiler/Compiler/ExpressionBuilder.cs +++ b/src/Core/Compiler/Compiler/ExpressionBuilder.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Linq; using ScriptSharp; using ScriptSharp.CodeModel; @@ -317,13 +318,27 @@ private Expression ProcessBinaryExpressionNode(BinaryExpressionNode node) { if (leftExpression.Type == ExpressionType.Member) { leftExpression = TransformMemberExpression((MemberExpression)leftExpression, - /* getOrAdd */ (node.Operator != TokenType.Equal)); + /* getOrAdd */ (node.Operator != TokenType.Equal)); } if (rightExpression.Type == ExpressionType.Member) { rightExpression = TransformMemberExpression((MemberExpression)rightExpression); } + if (node.Operator == TokenType.Coalesce) { + TypeSymbol scriptType = _symbolSet.ResolveIntrinsicType(IntrinsicType.Script); + MethodSymbol valueMethod = (MethodSymbol)scriptType.GetMember("Value"); + + TypeExpression scriptExpression = new TypeExpression(scriptType, SymbolFilter.Public | SymbolFilter.StaticMembers); + MethodExpression valueExpression = new MethodExpression(scriptExpression, valueMethod); + + valueExpression.AddParameterValue(leftExpression); + valueExpression.AddParameterValue(rightExpression); + valueExpression.Reevaluate(rightExpression.EvaluatedType); + + return valueExpression; + } + TypeSymbol resultType = null; Operator operatorType = OperatorConverter.OperatorFromToken(node.Operator); @@ -540,12 +555,7 @@ private Expression ProcessDotExpressionNode(BinaryExpressionNode node, SymbolFil } if (objectExpression is LiteralExpression) { - object literalValue = ((LiteralExpression)objectExpression).Value; - if (!((literalValue is Boolean) || (literalValue is String))) { - // Numeric literals need to be paranthesized in script when followed by a - // dot member access. - objectExpression.AddParenthesisHint(); - } + objectExpression.AddParenthesisHint(); } Debug.Assert(objectExpression.EvaluatedType is ISymbolTable); @@ -1105,6 +1115,19 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { return new InlineScriptExpression("", objectType); } + if (args.Count > 1) { + // Check whether the script is a valid string format string + try { + object[] argValues = new object[args.Count - 1]; + String.Format(CultureInfo.InvariantCulture, script, argValues); + } + catch { + _errorHandler.ReportError("The argument to Script.Literal must be a valid String.Format string.", + argNodes.Expressions[0].Token.Location); + return new InlineScriptExpression("", objectType); + } + } + InlineScriptExpression scriptExpression = new InlineScriptExpression(script, objectType); for (int i = 1; i < args.Count; i++) { scriptExpression.AddParameterValue(args[i]); @@ -1115,9 +1138,22 @@ private Expression ProcessOpenParenExpressionNode(BinaryExpressionNode node) { else if (method.Name.Equals("Boolean", StringComparison.Ordinal)) { Debug.Assert(args.Count == 1); + args[0].AddParenthesisHint(); return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); } - else if (method.Name.Equals("Value", StringComparison.Ordinal)) { + else if (method.Name.Equals("IsTruthy", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); + + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, new UnaryExpression(Operator.LogicalNot, args[0])); + } + else if (method.Name.Equals("IsFalsey", StringComparison.Ordinal)) { + Debug.Assert(args.Count == 1); + + args[0].AddParenthesisHint(); + return new UnaryExpression(Operator.LogicalNot, args[0]); + } + else if (method.Name.Equals("Or", StringComparison.Ordinal)) { Debug.Assert(args.Count >= 2); Expression expr = args[0]; diff --git a/src/Core/Compiler/Generator/ExpressionGenerator.cs b/src/Core/Compiler/Generator/ExpressionGenerator.cs index fe6e5ac3d..f05d70f36 100644 --- a/src/Core/Compiler/Generator/ExpressionGenerator.cs +++ b/src/Core/Compiler/Generator/ExpressionGenerator.cs @@ -43,11 +43,10 @@ private static void GenerateBinaryExpression(ScriptGenerator generator, MemberSy Debug.Assert(propExpression.Type == ExpressionType.PropertySet); if (propExpression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'set_"); + writer.Write(((BaseExpression)propExpression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.set_"); writer.Write(propExpression.Property.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpression(generator, symbol, expression.RightOperand); @@ -71,11 +70,10 @@ private static void GenerateBinaryExpression(ScriptGenerator generator, MemberSy Debug.Assert(indexExpression.Type == ExpressionType.Indexer); if (indexExpression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'set_"); + writer.Write(((BaseExpression)indexExpression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.set_"); writer.Write(indexExpression.Indexer.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpressionList(generator, symbol, indexExpression.Indices); @@ -478,11 +476,10 @@ private static void GenerateIndexerExpression(ScriptGenerator generator, MemberS writer.Write("]"); } else if (expression.ObjectReference is BaseExpression) { - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", 'get_"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype.get_"); writer.Write(expression.Indexer.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); writer.Write(", "); GenerateExpressionList(generator, symbol, expression.Indices); @@ -525,7 +522,7 @@ private static void GenerateInlineScriptExpression(ScriptGenerator generator, Me } } - script = String.Format(script, parameterScripts); + script = String.Format(CultureInfo.InvariantCulture, script, parameterScripts); } writer.Write(script); @@ -707,11 +704,10 @@ private static void GenerateMethodExpression(ScriptGenerator generator, MemberSy if (expression.ObjectReference is BaseExpression) { Debug.Assert(expression.Method.IsExtension == false); - writer.Write("ss.base("); - writer.Write(generator.CurrentImplementation.ThisIdentifier); - writer.Write(", '"); + writer.Write(((BaseExpression)expression.ObjectReference).EvaluatedType.FullGeneratedName); + writer.Write(".prototype."); writer.Write(expression.Method.GeneratedName); - writer.Write("').call("); + writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); if ((expression.Parameters != null) && (expression.Parameters.Count != 0)) { writer.Write(", "); @@ -860,13 +856,7 @@ private static void GeneratePropertyExpression(ScriptGenerator generator, Member Debug.Assert(baseClass != null); writer.Write(baseClass.FullGeneratedName); - if (baseClass.IsApplicationType) { - writer.Write("$."); - } - else { - writer.Write(".prototype."); - } - writer.Write("get_"); + writer.Write(".prototype.get_"); writer.Write(expression.Property.GeneratedName); writer.Write(".call("); writer.Write(generator.CurrentImplementation.ThisIdentifier); diff --git a/src/Core/Compiler/ScriptCompiler.cs b/src/Core/Compiler/ScriptCompiler.cs index 50045e229..b2700fbb4 100644 --- a/src/Core/Compiler/ScriptCompiler.cs +++ b/src/Core/Compiler/ScriptCompiler.cs @@ -314,11 +314,20 @@ private string GenerateScriptWithTemplate() { depLookupBuilder.Append(",\r\n "); } + string name = dependency.Name; + if (name == "ss") { + // TODO: This is a hack... to make generated node.js scripts + // be able to reference the 'scriptsharp' node module. + // Fix this in a better/1st class manner by allowing + // script assemblies to declare such things. + name = "scriptsharp"; + } + requiresBuilder.Append("'" + dependency.Path + "'"); dependenciesBuilder.Append(dependency.Identifier); depLookupBuilder.Append(dependency.Identifier); - depLookupBuilder.Append(" = require('" + dependency.Name + "')"); + depLookupBuilder.Append(" = require('" + name + "')"); firstDependency = false; } diff --git a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs index 26baf48d7..0df7088b5 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/LiteralExpression.cs @@ -23,6 +23,9 @@ public LiteralExpression(TypeSymbol valueType, object value) protected override bool IsParenthesisRedundant { get { + // Numeric literals need to be paranthesized in script when followed by a + // dot member access, so it is not redundant for numbers. + if ((_value is String) || (_value is Boolean)) { return true; } diff --git a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs index d6620bab4..ff9fdffe6 100644 --- a/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs +++ b/src/Core/Compiler/ScriptModel/Expressions/OperatorConverter.cs @@ -48,7 +48,6 @@ public static Operator OperatorFromToken(TokenType token) { case TokenType.LogAnd: return Operator.LogicalAnd; case TokenType.LogOr: - case TokenType.Coalesce: return Operator.LogicalOr; case TokenType.EqualEqual: return Operator.EqualEqualEqual; diff --git a/src/Core/CoreLib/Script.cs b/src/Core/CoreLib/Script.cs index ecb78904b..3e25f586a 100644 --- a/src/Core/CoreLib/Script.cs +++ b/src/Core/CoreLib/Script.cs @@ -131,6 +131,16 @@ public static T InvokeMethod(Type type, string name, params object[] args) { return default(T); } + /// + /// Checks if the specified object has a falsey value, i.e. it is null or + /// undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a falsey value; false otherwise. + public static bool IsFalsey(object o) { + return false; + } + [ScriptAlias("isFinite")] public static bool IsFinite(object o) { return false; @@ -186,6 +196,16 @@ public static bool IsValue(object o) { return false; } + /// + /// Checks if the specified object has a truthy value, i.e. it is not + /// null or undefined or empty string or false or zero. + /// + /// The object to test. + /// true if the object represents a truthy value; false otherwise. + public static bool IsTruthy(object o) { + return false; + } + /// /// Enables you to generate an arbitrary (literal) script expression. /// The script can contain simple String.Format style tokens (such as @@ -198,6 +218,18 @@ public static object Literal(string script, params object[] args) { return null; } + /// + /// Gets the first truthy (true, non-null, non-undefined, non-empty, non-zero) value. + /// + /// The type of the value. + /// The value to check for validity. + /// The alternate value to use if the first is invalid. + /// Additional alternative values to use if the first is invalid. + /// The first valid value. + public static TValue Or(TValue value, TValue alternateValue, params TValue[] alternateValues) { + return default(TValue); + } + public static void SetField(object instance, string name, object value) { } @@ -255,13 +287,14 @@ public static int SetTimeout(Delegate d, int milliseconds, params object[] args) } /// - /// Gets the first valid (non-null, non-undefined, non-empty) value. + /// Gets the first non-null and non-undefined value. /// /// The type of the value. /// The value to check for validity. /// The alternate value to use if the first is invalid. /// Additional alternative values to use if the first is invalid. /// The first valid value. + [ScriptAlias("ss.value")] public static TValue Value(TValue value, TValue alternateValue, params TValue[] alternateValues) { return default(TValue); } diff --git a/src/Core/CoreLib/String.cs b/src/Core/CoreLib/String.cs index 6939d8088..e445f6acc 100644 --- a/src/Core/CoreLib/String.cs +++ b/src/Core/CoreLib/String.cs @@ -379,20 +379,36 @@ public string ToUpperCase() { return null; } + [ScriptAlias("ss.trim")] public string Trim() { return null; } + [ScriptAlias("ss.trim")] + public string Trim(char[] trimCharacters) { + return null; + } + [ScriptAlias("ss.trimEnd")] public string TrimEnd() { return null; } + [ScriptAlias("ss.trimEnd")] + public string TrimEnd(char[] trimCharacters) { + return null; + } + [ScriptAlias("ss.trimStart")] public string TrimStart() { return null; } + [ScriptAlias("ss.trimStart")] + public string TrimStart(char[] trimCharacters) { + return null; + } + /// /// Decodes a string by replacing escaped parts with their equivalent textual representation. /// diff --git a/src/Core/CoreLib/Threading/Task.cs b/src/Core/CoreLib/Threading/Task.cs index 14e0080e7..2ab3bce7f 100644 --- a/src/Core/CoreLib/Threading/Task.cs +++ b/src/Core/CoreLib/Threading/Task.cs @@ -50,6 +50,10 @@ public static Task Any(int timeout, params Task[] tasks) { return null; } + public Task ChangeWith(Func continuation) { + return null; + } + public Task ContinueWith(Action continuation) { return null; } @@ -85,6 +89,10 @@ public T Result { } } + public Task ChangeWith(Func, TResult> continuation) { + return null; + } + public Task ContinueWith(Action> continuation) { return null; } diff --git a/src/Core/Scripts/Package/package.json b/src/Core/Scripts/Package/package.json new file mode 100644 index 000000000..80826f7d6 --- /dev/null +++ b/src/Core/Scripts/Package/package.json @@ -0,0 +1,17 @@ +{ + "name": "scriptsharp", + "version": "0.8.0", + "description": "Script# Runtime", + "keywords": [ "scriptsharp", "script#" ], + "author": "Nikhil Kothari", + "license": "Apache 2.0", + "repository": { + "type": "git", + "url": "https://github.com/nikhilk/scriptsharp" + }, + "main": "ss.js", + "dependencies": {}, + "engines": { + "node": "*" + } +} diff --git a/src/Core/Scripts/Package/readme.md b/src/Core/Scripts/Package/readme.md new file mode 100644 index 000000000..b71dace71 --- /dev/null +++ b/src/Core/Scripts/Package/readme.md @@ -0,0 +1,4 @@ +Script# Runtime + +This packages the script# runtime as a node module for node.js applications written using c# and compiled into javascript using the script# compiler. +More information is at [http://scriptsharp.com](http://scriptsharp.com). diff --git a/src/Core/Scripts/Runtime.js b/src/Core/Scripts/Runtime.js index 6244ce646..beba55767 100644 --- a/src/Core/Scripts/Runtime.js +++ b/src/Core/Scripts/Runtime.js @@ -44,6 +44,7 @@ version: '0.8', isValue: isValue, + value: value, extend: extend, keys: keys, keyCount: keyCount, @@ -70,6 +71,7 @@ endsWith: endsWith, padLeft: padLeft, padRight: padRight, + trim: trim, trimStart: trimStart, trimEnd: trimEnd, insertString: insertString, @@ -93,7 +95,6 @@ safeCast: safeCast, canAssign: canAssign, instanceOf: instanceOf, - base: base, culture: { neutral: neutralCulture, diff --git a/src/Core/Scripts/Runtime/Misc.js b/src/Core/Scripts/Runtime/Misc.js index 6fa583819..9275e4d8b 100644 --- a/src/Core/Scripts/Runtime/Misc.js +++ b/src/Core/Scripts/Runtime/Misc.js @@ -7,6 +7,18 @@ function isValue(o) { return (o !== null) && (o !== undefined); } +function _value(args) { + for (var i = 2, l = args.length; i < l; i++) { + if (isValue(args[i])) { + return args[i]; + } + } + return null; +} +function value(a, b) { + return isValue(a) ? a : isValue(b) ? b : _value(arguments); +} + function extend(o, items) { for (var n in items) { o[n] = items[n]; diff --git a/src/Core/Scripts/Runtime/String.js b/src/Core/Scripts/Runtime/String.js index ca3467230..6b864a922 100644 --- a/src/Core/Scripts/Runtime/String.js +++ b/src/Core/Scripts/Runtime/String.js @@ -58,11 +58,21 @@ function format(cultureOrFormat) { }); } -function trimStart(s) { - return s.replace(/^\s*/, ''); +function trim(s, tc) { + if (tc || !String.prototype.trim) { + tc = tc ? tc.join('') : null; + var r = tc ? new RegExp('^[' + tc + ']+|[' + tc + ']+$', 'g') : /^\s+|\s+$/g; + return s.replace(r, ''); + } + return s.trim(); +} +function trimStart(s, tc) { + var r = tc ? new RegExp('^[' + tc.join('') + ']+') : /^\s+/; + return s.replace(r, ''); } -function trimEnd(s) { - return s.replace(/\s*$/, ''); +function trimEnd(s, tc) { + var r = tc ? new RegExp('[' + tc.join('') + ']+$') : /\s+$/; + return s.replace(r, ''); } function startsWith(s, prefix) { if (emptyString(prefix)) { diff --git a/src/Core/Scripts/Runtime/Task.js b/src/Core/Scripts/Runtime/Task.js index c308d00d6..40dd9f3b3 100644 --- a/src/Core/Scripts/Runtime/Task.js +++ b/src/Core/Scripts/Runtime/Task.js @@ -1,7 +1,7 @@ // Task function Task(result) { - this._continuations = isValue(result) ? + this._continuations = result !== undefined ? (this.status = 'done', null) : (this.status = 'pending', []); this.result = result; @@ -11,6 +11,23 @@ var Task$ = { get_completed: function() { return this.status != 'pending'; }, + changeWith: function(continuation) { + var task = new Task(); + this.continueWith(function(t) { + var error = t.error; + var result; + if (!error) { + try { + result = continuation(t); + } + catch (e) { + error = e; + } + } + _updateTask(task, result, error); + }); + return task; + }, continueWith: function(continuation) { if (this._continuations) { this._continuations.push(continuation); @@ -73,6 +90,10 @@ function _joinTasks(tasks, any) { tasks = tasks.slice(1); count--; } + if (Array.isArray(tasks[0])) { + tasks = tasks[0]; + count = tasks.length; + } var joinTask = new Task(); var seen = 0; diff --git a/src/Core/Scripts/Runtime/TypeSystem.js b/src/Core/Scripts/Runtime/TypeSystem.js index c478b92ff..5bf79bcfc 100644 --- a/src/Core/Scripts/Runtime/TypeSystem.js +++ b/src/Core/Scripts/Runtime/TypeSystem.js @@ -153,12 +153,6 @@ function safeCast(instance, type) { return instanceOf(type, instance) ? instance : null; } -function base(instanceOrType, method) { - var baseType = instanceOrType.constructor.$base || instanceOrType.$base; - var m = baseType.prototype[method]; - return m !== instanceOrType[method] ? m : base(baseType, method); -} - function module(name, implementation, exports) { var registry = _modules[name] = { $name: name }; diff --git a/src/Core/Scripts/Scripts.csproj b/src/Core/Scripts/Scripts.csproj index e8894387f..a9323d886 100644 --- a/src/Core/Scripts/Scripts.csproj +++ b/src/Core/Scripts/Scripts.csproj @@ -32,11 +32,17 @@ + + + + + + diff --git a/src/Libraries/Node/Node.Azure/Azure.cs b/src/Libraries/Node/Node.Azure/Azure.cs new file mode 100644 index 000000000..7b6a58b4d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Azure.cs @@ -0,0 +1,53 @@ +// Azure.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; +using NodeApi.WindowsAzure.Runtime; +using NodeApi.WindowsAzure.Storage; + +namespace NodeApi.WindowsAzure { + + /// + /// The root Azure services API. + /// + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure")] + public static class Azure { + + [ScriptField] + [ScriptName(PreserveCase = true)] + public static RoleEnvironment RoleEnvironment { + get { + return null; + } + } + + public static CloudBlobService CreateBlobService() { + return null; + } + + public static CloudBlobService CreateBlobService(string storageAccount, string accessKey) { + return null; + } + + public static CloudQueueService CreateQueueService() { + return null; + } + + public static CloudQueueService CreateQueueService(string storageAccount, string accessKey) { + return null; + } + + public static CloudTableService CreateTableService() { + return null; + } + + public static CloudTableService CreateTableService(string storageAccount, string accessKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Node.Azure.csproj b/src/Libraries/Node/Node.Azure/Node.Azure.csproj new file mode 100644 index 000000000..a9296cadd --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Node.Azure.csproj @@ -0,0 +1,88 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} + Library + Properties + NodeApi.WindowsAzure + Script.Node.Azure + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Azure.xml + 1591, 0661, 0660, 1684 + true + + + + + + + + + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + {36D4B098-A21C-4725-ACD3-400922885F38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..653672513 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/AssemblyInfo.cs @@ -0,0 +1,12 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Script.Node.Azure")] +[assembly: AssemblyDescription("Script# NodeJS Azure Module API")] +[assembly: ScriptAssembly("azure")] diff --git a/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt new file mode 100644 index 000000000..a0e3513f9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Azure Module +=============================================================================== + +This assembly provides access to Azure Cloud APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against Azure APIs. + +More information is on http://www.windowsazure.com/en-us/develop/nodejs/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Azure/Runtime/Role.cs b/src/Libraries/Node/Node.Azure/Runtime/Role.cs new file mode 100644 index 000000000..2841fc2c5 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/Role.cs @@ -0,0 +1,18 @@ +// Role.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class Role { + + private Role() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs new file mode 100644 index 000000000..87e1320c8 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEnvironment.cs @@ -0,0 +1,63 @@ +// RoleEnvironment.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEnvironment { + + private RoleEnvironment() { + } + + [ScriptEvent("on", "removeListener")] + public event Action Changed { + add { + } + remove { + } + } + + [ScriptEvent("on", "removeListener")] + public event Action Changing { + add { + } + remove { + } + } + + public void ClearStatus(AsyncCallback callback) { + } + + public void GetConfigurationSettings(AsyncResultCallback> callback) { + } + + public void GetCurrentRoleInstance(AsyncResultCallback callback) { + } + + [ScriptName("getDeploymentId")] + public void GetDeploymentID(AsyncResultCallback callback) { + } + + public void GetRoles(AsyncResultCallback callback) { + } + + public void IsAvailable(AsyncResultCallback callback) { + } + + public void IsEmulated(AsyncResultCallback callback) { + } + + public void RequestRecycle(AsyncCallback callback) { + } + + public void SetStatus(RoleStatus status, Date expirationDate, AsyncCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs new file mode 100644 index 000000000..ac2834823 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEvent.cs @@ -0,0 +1,32 @@ +// RoleEvent.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleEvent { + + private RoleEvent() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + + [ScriptField] + public RoleEventType Type { + get { + return RoleEventType.ConfigurationSettingChange; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs new file mode 100644 index 000000000..e7403960e --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleEventType.cs @@ -0,0 +1,20 @@ +// RoleEventType.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleEventType { + + TopologyChange = 0, + + ConfigurationSettingChange = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs new file mode 100644 index 000000000..272d094e9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleInstance.cs @@ -0,0 +1,18 @@ +// RoleInstance.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RoleInstance { + + private RoleInstance() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs new file mode 100644 index 000000000..47f37368d --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Runtime/RoleStatus.cs @@ -0,0 +1,20 @@ +// RoleStatus.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Runtime { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptConstants(UseNames = true)] + public enum RoleStatus { + + Busy = 0, + + Ready = 1 + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs new file mode 100644 index 000000000..35caef469 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlob.cs @@ -0,0 +1,26 @@ +// CloudBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlob { + + internal CloudBlob() { + } + + [ScriptField] + [ScriptName("blob")] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs new file mode 100644 index 000000000..374a1cd31 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainer.cs @@ -0,0 +1,25 @@ +// CloudBlobContainer.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainer { + + private CloudBlobContainer() { + } + + [ScriptField] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs new file mode 100644 index 000000000..3bec7f8c9 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobContainerListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobContainerListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobContainerListContinuation { + + private CloudBlobContainerListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs new file mode 100644 index 000000000..725507961 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobLease.cs @@ -0,0 +1,25 @@ +// CloudBlobLease.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public abstract class CloudBlobLease { + + internal CloudBlobLease() { + } + + [ScriptField] + public string ID { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs new file mode 100644 index 000000000..31065d9db --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobListContinuation.cs @@ -0,0 +1,33 @@ +// CloudBlobListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobListContinuation { + + private CloudBlobListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs new file mode 100644 index 000000000..04ad65b8b --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlobService.cs @@ -0,0 +1,145 @@ +// CloudBlobService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.IO; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: ACLs + // TODO: Page blobs + // TODO: Shared access signatures + // TODO: Metadata/properties + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlobService { + + private CloudBlobService() { + } + + public void AcquireLease(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void AcquireLease(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void BreakLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, AsyncResultCallback callback) { + } + + public void CopyBlob(string sourceContainerName, string sourceBlobName, string targetContainerName, string targetBlobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, AsyncResultCallback callback) { + } + + public void CreateBlobSnapshot(string containerName, string blobName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromStream(string containerName, string blobName, ReadableStream stream, object options, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void CreateBlockBlobFromText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void CreateContainer(string containerName, AsyncCallback callback) { + } + + public void CreateContainer(string containerName, object options, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, AsyncCallback callback) { + } + + public void CreateContainerIfNotExists(string containerName, object options, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, AsyncCallback callback) { + } + + public void DeleteBlob(string containerName, string blobName, object options, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, AsyncCallback callback) { + } + + public void DeleteContainer(string containerName, object options, AsyncCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, AsyncResultCallback callback) { + } + + public void GetBlobToFile(string containerName, string blobName, string fileName, object options, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, AsyncResultCallback callback) { + } + + public void GetBlobToStream(string containerName, string blobName, WritableStream stream, object options, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, AsyncResultCallback callback) { + } + + public void GetBlobToText(string containerName, string blobName, string text, object options, AsyncResultCallback callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback> callback) { + } + + public void ListBlobs(string containerName, object options, AsyncResultCallback, CloudBlobListContinuation> callback) { + } + + public void ListContainers(AsyncResultCallback> callback) { + } + + public void ListContainers(AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ListContainers(object options, AsyncResultCallback> callback) { + } + + public void ListContainers(object options, AsyncResultCallback, CloudBlobContainerListContinuation> callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void ReleaseLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, AsyncResultCallback callback) { + } + + public void RenewLease(string containerName, string blobName, string leaseID, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs new file mode 100644 index 000000000..b7457ae05 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudBlockBlob.cs @@ -0,0 +1,18 @@ +// CloudBlockBlob.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudBlockBlob : CloudBlob { + + private CloudBlockBlob() { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs new file mode 100644 index 000000000..949eede12 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueue.cs @@ -0,0 +1,26 @@ +// CloudQueue.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueue { + + private CloudQueue() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string Name { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs new file mode 100644 index 000000000..2d32e5418 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueListContinuation.cs @@ -0,0 +1,33 @@ +// CloudQueueListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueListContinuation { + + private CloudQueueListContinuation() { + } + + [ScriptField] + public string NextMarker { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudQueueListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs new file mode 100644 index 000000000..42d075201 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueMessage.cs @@ -0,0 +1,42 @@ +// CloudQueueMessage.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueMessage { + + private CloudQueueMessage() { + } + + [ScriptField] + [ScriptName("messageid")] + public string MessageID { + get { + return null; + } + } + + [ScriptField] + [ScriptName("messagetext")] + public string MessageText { + get { + return null; + } + } + + [ScriptField] + [ScriptName("popreceipt")] + public string PopReceipt { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs new file mode 100644 index 000000000..f3826a8d3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudQueueService.cs @@ -0,0 +1,82 @@ +// CloudQueueService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudQueueService { + + private CloudQueueService() { + } + + public void ClearMessages(string queueName, AsyncCallback callback) { + } + + public void ClearMessages(string queueName, object options, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, AsyncCallback callback) { + } + + public void CreateMessage(string queueName, string message, object options, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, AsyncCallback callback) { + } + + public void CreateQueue(string queueName, object options, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, AsyncCallback callback) { + } + + public void CreateQueueIfNotExists(string queueName, object options, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, AsyncCallback callback) { + } + + public void DeleteMessage(string queueName, string messageID, string popReceipt, object options, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, AsyncCallback callback) { + } + + public void DeleteQueue(string queueName, object options, AsyncCallback callback) { + } + + public void GetMessages(string queueName, AsyncResultCallback> callback) { + } + + public void GetMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void ListQueues(AsyncResultCallback> callback) { + } + + public void ListQueues(object options, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, AsyncResultCallback> callback) { + } + + public void PeekMessages(string queueName, object options, AsyncResultCallback> callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, AsyncResultCallback callback) { + } + + public void UpdateMessage(string queueName, string messageID, string popReceipt, int visibilityTimeout, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs new file mode 100644 index 000000000..0c83c1f85 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTable.cs @@ -0,0 +1,26 @@ +// CloudTable.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTable { + + private CloudTable() { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string TableName { + get { + return null; + } + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs new file mode 100644 index 000000000..536c61764 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableEntity.cs @@ -0,0 +1,60 @@ +// CloudTableEntity.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class CloudTableEntity { + + public CloudTableEntity() { + } + + public CloudTableEntity(params object[] nameValuePairs) { + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string PartitionKey { + get { + return null; + } + set { + } + } + + [ScriptField] + [ScriptName(PreserveCase = true)] + public string RowKey { + get { + return null; + } + set { + } + } + + [ScriptField] + public object this[string key] { + get { + return null; + } + set { + } + } + + public static implicit operator Dictionary(CloudTableEntity entity) { + return null; + } + + public static implicit operator CloudTableEntity(Dictionary data) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs new file mode 100644 index 000000000..10214c048 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableListContinuation.cs @@ -0,0 +1,33 @@ +// CloudTableListContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableListContinuation { + + private CloudTableListContinuation() { + } + + [ScriptField] + public string NextTableName { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs new file mode 100644 index 000000000..a54c06903 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQuery.cs @@ -0,0 +1,57 @@ +// CloudTableQuery.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("azure.TableQuery")] + public sealed class CloudTableQuery { + + public CloudTableQuery And(string filter, object[] values) { + return null; + } + + public CloudTableQuery From(string tableName) { + return null; + } + + public CloudTableQuery Or(string filter, object[] values) { + return null; + } + + public CloudTableQuery Select() { + return null; + } + + public CloudTableQuery Select(string[] fields) { + return null; + } + + public CloudTableQuery Top(int count) { + return null; + } + + public CloudTableQuery Where(string filter, string value) { + return null; + } + + public CloudTableQuery Where(string filter, object[] values) { + return null; + } + + public CloudTableQuery WhereKeys(string partitionKey, string rowKey) { + return null; + } + + public CloudTableQuery WhereNextKeys(string partitionKey, string rowKey) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs new file mode 100644 index 000000000..9c613bac3 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableQueryContinuation.cs @@ -0,0 +1,40 @@ +// CloudTableQueryContinuation.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableQueryContinuation { + + private CloudTableQueryContinuation() { + } + + [ScriptField] + public string NextPartitionKey { + get { + return null; + } + } + + [ScriptField] + public string NextRowKey { + get { + return null; + } + } + + public void GetNextPage(AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public bool HasNextPage() { + return false; + } + } +} diff --git a/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs new file mode 100644 index 000000000..1360191c6 --- /dev/null +++ b/src/Libraries/Node/Node.Azure/Storage/CloudTableService.cs @@ -0,0 +1,130 @@ +// CloudTableService.cs +// Script#/Libraries/Node/Azure +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.WindowsAzure.Storage { + + // TODO: Properties, metadata related APIs + // TODO: Does azure sdk support shared access signature functionality for tables? + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class CloudTableService { + + private CloudTableService() { + } + + public void BeginBatch() { + } + + public void CommitBatch(AsyncCallback callback) { + } + + public void CommitBatch(object options, AsyncCallback callback) { + } + + public void CreateTable(string tableName, AsyncCallback callback) { + } + + public void CreateTable(string tableName, object options, AsyncCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, AsyncResultCallback callback) { + } + + public void CreateTableIfNotExists(string tableName, object options, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void DeleteEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, AsyncResultCallback callback) { + } + + public void DeleteTable(string tableName, object options, AsyncResultCallback callback) { + } + + public bool HasOperations() { + return false; + } + + public void InsertEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrMergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void InsertOrReplaceEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public bool IsInBatch() { + return false; + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(AsyncResultCallback, CloudTableListContinuation> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback> callback) { + } + + [ScriptName("queryTables")] + public void ListTables(object options, AsyncResultCallback, CloudTableListContinuation> callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void MergeEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback> callback) { + } + + public void QueryEntities(CloudTableQuery query, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntities(CloudTableQuery query, object options, AsyncResultCallback, CloudTableQueryContinuation> callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, AsyncResultCallback callback) { + } + + public void QueryEntity(string tableName, string partitionKey, string rowKey, object options, AsyncResultCallback callback) { + } + + public void Rollback() { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, AsyncResultCallback callback) { + } + + public void UpdateEntity(string tableName, CloudTableEntity entity, object options, AsyncResultCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Core/IO/Buffer.cs b/src/Libraries/Node/Node.Core/IO/Buffer.cs index b2c81f3ae..3b8c1de6a 100644 --- a/src/Libraries/Node/Node.Core/IO/Buffer.cs +++ b/src/Libraries/Node/Node.Core/IO/Buffer.cs @@ -24,6 +24,7 @@ public Buffer(string data) { public Buffer(string data, Encoding encoding) { } + [ScriptField] public int Length { get { return 0; diff --git a/src/Libraries/Node/Node.Core/IO/Path.cs b/src/Libraries/Node/Node.Core/IO/Path.cs index 8b07b34f7..725e7052b 100644 --- a/src/Libraries/Node/Node.Core/IO/Path.cs +++ b/src/Libraries/Node/Node.Core/IO/Path.cs @@ -11,6 +11,7 @@ namespace NodeApi.IO { [ScriptImport] [ScriptIgnoreNamespace] [ScriptDependency("path")] + [ScriptName("path")] public static class Path { [ScriptName("sep")] diff --git a/src/Libraries/Node/Node.Core/Network/HttpVerb.cs b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs index 01198d564..b7d9c3a44 100644 --- a/src/Libraries/Node/Node.Core/Network/HttpVerb.cs +++ b/src/Libraries/Node/Node.Core/Network/HttpVerb.cs @@ -23,6 +23,8 @@ public enum HttpVerb { HEAD, - OPTIONS + OPTIONS, + + PATCH } } diff --git a/src/Libraries/Node/Node.Restify/Node.Restify.csproj b/src/Libraries/Node/Node.Restify/Node.Restify.csproj new file mode 100644 index 000000000..fbfbea917 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Node.Restify.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} + Library + Properties + NodeApi.Restify + Script.Node.Restify + True + true + ..\..\..\ScriptSharp.snk + v2.0 + 512 + + + + ..\..\..\..\bin\Debug\ + false + DEBUG + prompt + 4 + ..\..\..\..\bin\Debug\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + none + false + true + ..\..\..\..\bin\Release\ + TRACE + prompt + 4 + ..\..\..\..\bin\Release\Script.Node.Restify.xml + 1591, 0661, 0660, 1684 + true + + + + Properties\ScriptSharp.cs + + + + + + + + + + + + + + + + + + + + + + + + {36d4b098-a21c-4725-acd3-400922885f38} + CoreLib + + + {4a9f7ce9-5a45-4b28-ad01-05528709b6e4} + Node.Core + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d1497e2e9 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// AssemblyInfo.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Reflection; + +[assembly: AssemblyTitle("Script.Node.Restify")] +[assembly: AssemblyDescription("Script# NodeJS Restify Module API")] +[assembly: ScriptAssembly("restify")] diff --git a/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt new file mode 100644 index 000000000..afd792f38 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/Properties/ScriptInfo.txt @@ -0,0 +1,10 @@ +Node Restify Module +=============================================================================== + +This assembly provides access to Restify Module APIs for NodeJS applications. +This is only meant for use at development time, so you can reference and compile +your c# code against restify APIs. + +More information is on http://mcavage.github.com/node-restify/. + +------------------------------------------------------------------------------- diff --git a/src/Libraries/Node/Node.Restify/RestifyApplication.cs b/src/Libraries/Node/Node.Restify/RestifyApplication.cs new file mode 100644 index 000000000..101757d08 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyApplication.cs @@ -0,0 +1,80 @@ +// Restify.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("restify")] + public static class RestifyApplication { + + public static RestifyChainedHandler[] AcceptParser(string[] serverAcceptable) { + return null; + } + + public static RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public static RestifyChainedHandler[] BodyParser() { + return null; + } + + public static RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public static RestifyHttpClient CreateHttpClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient() { + return null; + } + + public static RestifyJsonClient CreateJsonClient(RestifyJsonClientOptions options) { + return null; + } + + public static RestifyServer CreateServer() { + return null; + } + + public static RestifyServer CreateServer(RestifyServerOptions rs) { + return null; + } + + public static RestifyStringClient CreateStringClient() { + return null; + } + + public static RestifyChainedHandler[] DateParser() { + return null; + } + + public static RestifyChainedHandler[] GZipResponse() { + return null; + } + + public static RestifyChainedHandler[] JsonBodyParser() { + return null; + } + + public static RestifyChainedHandler[] Jsonp() { + return null; + } + + public static RestifyChainedHandler QueryParser() { + return null; + } + + public static RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyCallback.cs b/src/Libraries/Node/Node.Restify/RestifyCallback.cs new file mode 100644 index 000000000..5bc17aadd --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyCallback.cs @@ -0,0 +1,9 @@ +// RestifyCallback.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +namespace NodeApi.Restify { + + public delegate void RestifyCallback(RestifyError error, RestifyRequest request, RestifyResponse response, object content); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyChain.cs b/src/Libraries/Node/Node.Restify/RestifyChain.cs new file mode 100644 index 000000000..0c61351ad --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyChain.cs @@ -0,0 +1,26 @@ +// RestifyChain.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyChain { + + private RestifyChain() { + } + + [ScriptSkip] + public void Continue() { + } + + [ScriptSkip] + public void Error(Exception error) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyError.cs b/src/Libraries/Node/Node.Restify/RestifyError.cs new file mode 100644 index 000000000..6d5f6cec5 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyError.cs @@ -0,0 +1,17 @@ +// RestifyError.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyError { + + internal RestifyError() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHandler.cs b/src/Libraries/Node/Node.Restify/RestifyHandler.cs new file mode 100644 index 000000000..111182019 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHandler.cs @@ -0,0 +1,18 @@ +// RestifyHandler.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate void RestifyHandler(RestifyRequest request, RestifyResponse response); + + [ScriptImport] + [ScriptIgnoreNamespace] + public delegate RestifyChainedHandler RestifyChainedHandler(RestifyRequest request, RestifyResponse response, Func next); +} diff --git a/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs new file mode 100644 index 000000000..6e71a5b40 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyHttpClient.cs @@ -0,0 +1,17 @@ +// RestifyHttpClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyHttpClient : RestifyStringClient { + + private RestifyHttpClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs new file mode 100644 index 000000000..f97c0f957 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClient.cs @@ -0,0 +1,21 @@ +// RestifyJsonClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + /// + /// sends and expects application/json + /// + [ScriptImport] + [ScriptIgnoreNamespace] + public sealed class RestifyJsonClient : RestifyStringClient { + + private RestifyJsonClient() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs new file mode 100644 index 000000000..082f1e5ba --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyJsonClientOptions.cs @@ -0,0 +1,78 @@ +// RestifyJsonClientOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyJsonClientOptions { + + public RestifyJsonClientOptions() { + } + + public RestifyJsonClientOptions(params object[] nameValuePairs) { + } + + /// + /// Accept header to send + /// + public string Accept; + + /// + /// Amount of time to wait for a socket + /// + public int ConnectTimeout; + + /// + /// node-dtrace-provider handle + /// + [ScriptName("dtrace")] + public object DTrace; + + /// + /// Will compress data when sent using content-encoding: gzip + /// + public object Gzip; + + /// + /// HTTP headers to set in all requests + /// + public object Headers; + + /// + /// bunyan instance + /// + public object Log; + + /// + /// options to provide to node-retry; defaults to 3 retries + /// + public object Retry; + + /// + /// synchronous callback for interposing headers before request is sent + /// + public Action SignRequest; + + /// + /// Fully-qualified URL to connect to + /// + public string Url; + + /// + /// user-agent string to use; restify inserts one, but you can override it + /// + public string UserAgent; + + /// + /// semver string to set the accept-version + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyLogger.cs b/src/Libraries/Node/Node.Restify/RestifyLogger.cs new file mode 100644 index 000000000..f98dc8245 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyLogger.cs @@ -0,0 +1,23 @@ +// BunyanLogger.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyLogger { + + private RestifyLogger() { + } + + public void Debug(object options, string format, params string[] formatArguments) { + } + } +} \ No newline at end of file diff --git a/src/Libraries/Node/Node.Restify/RestifyRequest.cs b/src/Libraries/Node/Node.Restify/RestifyRequest.cs new file mode 100644 index 000000000..a982abe2f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRequest.cs @@ -0,0 +1,210 @@ +// RestifyRequest.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRequest { + + private RestifyRequest() { + } + + [ScriptField] + public Socket Connection { + get { + return null; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + [ScriptField] + public object Headers { + get { + return null; + } + } + + /// + /// url.parse(req.url) href + /// + [ScriptField] + public string Href { + get { + return String.Empty; + } + } + + [ScriptField] + public string HttpVersion { + get { + return null; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + /// + /// bunyan logger you can piggyback on + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + [ScriptField] + public HttpVerb Method { + get { + return HttpVerb.GET; + } + } + + [ScriptField] + [ScriptName("params")] + public Dictionary Parameters { + get { + return null; + } + } + + /// + /// cleaned up URL path + /// + [ScriptField] + public string Path { + get { + return String.Empty; + } + } + + /// + /// the query string only + /// + [ScriptField] + public string Query { + get { + return String.Empty; + } + } + + /// + /// Whether this was an SSL request + /// + [ScriptField] + public bool Secure { + get { + return true; + } + } + + /// + /// the time when this request arrived (ms since epoch) + /// + [ScriptField] + [ScriptName("time")] + public int TimeInMilliseconds { + get { + return 0; + } + } + + [ScriptField] + public object Trailers { + get { + return null; + } + } + + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// Check if the Accept header is present, and includes the given type. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string type) { + return true; + } + + /// + /// Check if the Accept header is present, and includes the given types. + /// + /// + /// + [ScriptName("accepts")] + public bool AcceptsContentType(string[] types) { + return true; + } + + [ScriptName("header")] + public string GetHeader(string name) { + return String.Empty; + } + + [ScriptName("header")] + public string GetHeader(string key, string defaultValue) { + return String.Empty; + } + + /// + /// Shorthand to grab a new bunyan instance that is a child component of the one restify has: + /// + /// + /// + public RestifyLogger GetLogger(string name) { + return null; + } + + /// + /// Check if the incoming request contains the Content-Type header field, and it contains the give mime type. + /// + /// + /// + [ScriptName("is")] + public bool IsContentType(string type) { + return true; + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyResponse.cs b/src/Libraries/Node/Node.Restify/RestifyResponse.cs new file mode 100644 index 000000000..ddb2bb85b --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyResponse.cs @@ -0,0 +1,159 @@ +// RestifyResponse.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using NodeApi.Network; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyResponse { + + private RestifyResponse() { + } + + /// + /// In conjunction with contentType, you can explicitly set the charSet to be written in the content-type header + /// + [ScriptField] + public string CharSet { + get { + return String.Empty; + } + } + + /// + /// short hand for the header content-length + /// + [ScriptField] + public int ContentLength { + get { + return 0; + } + } + + /// + /// short hand for the header content-type + /// + [ScriptField] + public string ContentType { + get { + return String.Empty; + } + } + + /// + /// response headers + /// + [ScriptField] + public Dictionary Headers { + get { + return null; + } + } + + /// + /// HTTP status code + /// + [ScriptName("code")] + [ScriptField] + public int HttpStatusCode { + get { + return 0; + } + } + + /// + /// A unique request id (x-request-id) + /// + [ScriptField] + public string Id { + get { + return String.Empty; + } + } + + [ScriptField] + public int StatusCode { + get; + set; + } + + public void AddTrailers(Dictionary headers) { + } + + public string GetHeader(string name) { + return null; + } + + /// + /// Short-hand for: + /// res.contentType = 'json'; + /// res.send({hello: 'world'}); + /// + /// Status code + /// content + public void Json(HttpStatusCode code, object body) { + } + + public void RemoveHeader(string name) { + } + + + public void Send(object message) { + } + + public void Send(int errorCode, RestifyError message) { + } + + public void SendDate() { + } + + /// + /// Sets the cache-control header. + /// + /// type defaults to _public_ + /// options currently only takes maxAge. + public void SetCache(string type, Dictionary options) { + } + + public void SetHeader(string name, string value) { + } + + /// + /// Sets the response statusCode. + /// + /// Status code + public void Status(HttpStatusCode code) { + } + + /// + /// You can use send() to wrap up all the usual writeHead(), write(), end() calls on the HTTP API of node. + /// When you call send(), restify figures out how to format the response (see content-negotiation, above), and does that. + /// + /// Status Code + /// body can be an Object, a Buffer, or an Error. + public void Status(HttpStatusCode code, object body) { + } + + public void WriteContinue() { + } + + public void WriteHead(HttpStatusCode statusCode) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase) { + } + + public void WriteHead(HttpStatusCode statusCode, Dictionary headers) { + } + + public void WriteHead(HttpStatusCode statusCode, string reasonPhrase, Dictionary headers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyRoute.cs b/src/Libraries/Node/Node.Restify/RestifyRoute.cs new file mode 100644 index 000000000..7b28b1e03 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyRoute.cs @@ -0,0 +1,17 @@ +// RestifyRoute.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyRoute { + + private RestifyRoute() { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServer.cs b/src/Libraries/Node/Node.Restify/RestifyServer.cs new file mode 100644 index 000000000..f7043678f --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServer.cs @@ -0,0 +1,315 @@ + // RestifyServer.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + public sealed class RestifyServer { + + private RestifyServer() { + } + + /// + /// list of content-types this server can respond with + /// + [ScriptField] + public String[] Acceptable { + get { + return null; + } + } + + /// + /// bunyan instance + /// + [ScriptField] + public RestifyLogger Log { + get { + return null; + } + } + + /// + /// name of the server + /// + [ScriptField] + public string Name { + get { + return null; + } + } + + /// + /// Once listen() is called, this will be filled in with where the server is running + /// + [ScriptField] + public string Url { + get { + return null; + } + } + + /// + /// default version to use in all routes + /// + [ScriptField] + public string Version { + get { + return null; + } + } + + /// + /// Emitted after a route has finished all the handlers you registered. + /// You can use this to write audit logs, etc. The route parameter will be the Route object that ran. + /// Note that when you are using the default 404/405/BadVersion handlers, this event will still be fired, + /// but route will be null. If you have registered your own listeners for those, this event will not be fired + /// unless you invoke the cb argument that is provided with them. + /// + [ScriptEvent("on", "removeListener")] + public event Action After { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does exist, but you have not registered a route for that HTTP verb, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 405 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("MethodNotAllowed")] + public event Action MethodNotAllowed { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a URL that does not exist, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 404 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("NotFound")] + public event Action NotFound { + add { + } + remove { + } + } + + /// + /// Emitted when some handler throws an uncaughtException somewhere in the chain. + /// The default behavior is to just call res.send(error), and let the built-ins in restify handle transforming, + /// but you can override to whatever you want here. + /// + [ScriptEvent("on", "removeListener")] + public event Action UncaughtException { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exist, but has a content-type mismatch, restify will emit this event. + /// Note that restify checks for listeners on this event, and if there are none, responds with a default 415 handler. + /// It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("UnsupportedMediaType")] + public event Action UnsupportedMediaType { + add { + } + remove { + } + } + + /// + /// When a client request is sent for a route that exists, but does not match the version(s) on those routes, + /// restify will emit this event. Note that restify checks for listeners on this event, and if there are none, + /// responds with a default 400 handler. It is expected that if you listen for this event, you respond to the client. + /// + [ScriptEvent("on", "removeListener")] + [ScriptName("VersionNotAllowed")] + public event Action VersionNotAllowed { + add { + } + remove { + } + } + + public RestifyChainedHandler[] AcceptParser(string[] acceptable) { + return null; + } + + public Dictionary Address() { + return null; + } + + public RestifyChainedHandler[] AuditLogger(object options) { + return null; + } + + public RestifyChainedHandler[] AuthorizationParser() { + return null; + } + + public RestifyChainedHandler[] BodyParser() { + return null; + } + + public void Close(Action callback) { + } + + public RestifyChainedHandler[] ConditionalRequest() { + return null; + } + + public RestifyServer CreateServer() { + return null; + } + + public RestifyServer CreateServer(object options) { + return null; + } + + public RestifyServer CreateServer(RestifyServerOptions options) { + return null; + } + + public RestifyChainedHandler[] DateParser() { + return null; + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(string path, RestifyChainedHandler[] handlers) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler handler) { + } + + [ScriptName("del")] + public void Delete(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(string path, RestifyChainedHandler handler) { + } + + public void Get(string path, RestifyChainedHandler[] handlers) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler handler) { + } + + public void Get(RestifyServerGetOptions options, RestifyChainedHandler[] handlers) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Get(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Get(object options, RestifyChainedHandler handler) { + } + + public void Get(object options, RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] GzipResponse() { + return null; + } + + public void Head(string path, RestifyChainedHandler handler) { + } + + public void Head(string path, RestifyChainedHandler[] handlers) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Head(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Listen(int port, Action callback) { + } + + public void Listen(object handle, Action callback) { + } + + public void Listen(string path, Action callback) { + } + + public void Post(string path, RestifyChainedHandler handler) { + } + + public void Post(string path, RestifyChainedHandler[] handlers) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler handler) { + } + + public void Post(RegExp pathPattern, RestifyChainedHandler[] handlers) { + } + + public void Pre(RestifyChainedHandler handler) { + } + + public void Pre(RestifyChainedHandler[] handlers) { + } + + public RestifyChainedHandler[] QueryParser() { + return null; + } + + public RestifyChainedHandler[] RequestLogger() { + return null; + } + + public RestifyChainedHandler[] RequestLogger(object options) { + return null; + } + + public RestifyChainedHandler[] ServeStatic(object options) { + return null; + } + + public RestifyChainedHandler[] Throttle(RestifyThrottleOptions options) { + return null; + } + + public RestifyChainedHandler[] Throttle(Dictionary options) { + return null; + } + + /// + /// Restify runs handlers in the order they are registered on a server, + /// so if you want some common handlers to run before any of your routes, + /// issue calls to use() before defining routes. + /// + public void Use(RestifyChainedHandler handlers) { + } + + public void Use(RestifyChainedHandler[] handlers) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs new file mode 100644 index 000000000..70f4edbf2 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerGetOptions.cs @@ -0,0 +1,26 @@ +// RestifyServerGetOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + [ScriptName("Object")] + public sealed class RestifyServerGetOptions { + + public RestifyServerGetOptions() { + } + + public RestifyServerGetOptions(params object[] nameValuePairs) { + } + + public string Path; + + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs new file mode 100644 index 000000000..e25086916 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyServerOptions.cs @@ -0,0 +1,79 @@ +// RestifyServerOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyServerOptions { + + public RestifyServerOptions() { + } + + public RestifyServerOptions(params object[] nameValuePairs) { + } + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Certificate; + + /// + /// Custom response formatters for res.send() + /// + public object Formatters; + + /// + /// If you want to create an HTTPS server, pass in the PEM-encoded certificate and key + /// + public string Key; + + /// + /// You can optionally pass in a bunyan (https://github.com/trentm/node-bunyan) instance; not required + /// + public object Log; + + /// + /// By default, this will be set in the Server response header, default is restify + /// + public string Name; + + /// + /// Any options accepted by node-spdy (https://github.com/indutny/node-spdy) + /// + public string Spdy; + + /// + /// Allows you to apply formatting to the value of the header. + /// The duration is passed as an argument in number of milliseconds to execute. + /// + /// + /// + /// app = module.exports = restify.createServer({ + /// name: 'restify', + /// version: '1.0.0', + /// responseTimeHeader: 'X-Runtime', + /// responseTimeFormatter: function(durationInMilliseconds) { + /// return durationInMilliseconds / 1000; + /// } + /// }); + /// + public Func ResponseTimeFormatter; + + /// + /// By default, this will be X-Response-Time + /// + public string ResponseTimeHeader; + + /// + /// A default version to set for all routes + /// + public string Version; + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyStringClient.cs b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs new file mode 100644 index 000000000..94c687b64 --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyStringClient.cs @@ -0,0 +1,57 @@ +// RestifyStringClient.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptImport] + [ScriptIgnoreNamespace] + public class RestifyStringClient { + + protected RestifyStringClient() { + } + + public void BasicAuth(string login, string password) { + } + + /// + /// del doesn't take content, since you know, it should't: + /// + public void Del(string path, object content, RestifyCallback callback) { + } + + /// + /// Performs an HTTP get; if no payload was returned, obj defaults to {} for you (so you don't get a bunch of null pointer errors). + /// + /// + /// + public void Get(string path, RestifyCallback callback) { + } + + /// + /// Just like get, but without obj: + /// + /// + /// + public void Head(string path, RestifyCallback callback) { + } + + /// + /// Takes a complete object to serialize and send to the server. + /// + /// + /// + /// + public void Post(string path, object content, RestifyCallback callback) { + } + + /// + /// Just like post: + /// + public void Put(string path, object content, RestifyCallback callback) { + } + } +} diff --git a/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs new file mode 100644 index 000000000..5d312cb7c --- /dev/null +++ b/src/Libraries/Node/Node.Restify/RestifyThrottleOptions.cs @@ -0,0 +1,91 @@ +// RestifyThrottleOptions.cs +// Script#/Libraries/Node/Restify +// This source code is subject to terms and conditions of the Apache License, Version 2.0. +// + +using System; +using System.Runtime.CompilerServices; + +namespace NodeApi.Restify { + + [ScriptIgnoreNamespace] + [ScriptImport] + [ScriptName("Object")] + public sealed class RestifyThrottleOptions { + + public RestifyThrottleOptions() { + } + + public RestifyThrottleOptions(params object[] nameValuePairs) { + } + + /// + /// If available, the amount of requests to burst to + /// + [ScriptField] + public int Burst { + set { + } + } + + /// + /// Do throttling on a /32 (source IP) + /// + [ScriptField] + public bool Ip { + set { + } + } + + /// + /// If using the built-in storage table, the maximum distinct throttling keys to allow at a time + /// + [ScriptField] + public int MaxKeys { + set { + } + } + + /// + /// Per "key" overrides + /// + [ScriptField] + public object Overrides { + set { + } + } + + [ScriptField] + public int Rate { + set { + } + } + + /// + /// Storage engine; must support put/get + /// + [ScriptField] + public object TokensTable { + set { + } + } + + /// + /// Do throttling on req.username + /// + [ScriptField] + public bool Username { + set { + } + } + + /// + /// Do throttling on a /32 (X-Forwarded-For) + /// + [ScriptField] + public bool Xff { + set { + } + } + } +} diff --git a/src/Libraries/Web/Html/Document.cs b/src/Libraries/Web/Html/Document.cs index b4790206e..957266017 100644 --- a/src/Libraries/Web/Html/Document.cs +++ b/src/Libraries/Web/Html/Document.cs @@ -148,18 +148,53 @@ public static void AddEventListener(string eventName, ElementEventListener liste public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Creates an Attr of the given name. Note that the Attr instance can then be set on an + /// Element using the setAttributeNode method. To create an attribute with a qualified name + /// and namespace URI, use the CreateAttributeNS method. + /// + /// The name of the attribute. + /// A new Attr object with the nodeName attribute set to name, and localName, prefix, + /// and namespaceURI set to null. The value of the attribute is the empty string. public static ElementAttribute CreateAttribute(string name) { return null; } + /// + /// Creates an attribute of the given qualified name and namespace URI. + /// + /// The namespace URI of the attribute to create. + /// The qualified name of the attribute to instantiate. + /// A new Attr object with the given namespace and qualified name. + public static ElementAttribute CreateAttributeNS(string namespaceURI, string qualifiedName) { + return null; + } + public static DocumentFragment CreateDocumentFragment() { return null; } + /// + /// Creates an element of the type specified. + /// To create an element with a qualified name and namespace URI, use the CreateElementNS method. + /// + /// The name of the element type to instantiate. + /// A new Element object with the nodeName attribute set to tagName, and localName, + /// prefix, and namespaceURI set to null. public static Element CreateElement(string tagName) { return null; } + /// + /// Creates an element of the given qualified name and namespace URI. + /// + /// The namespace URI of the element to create. + /// The qualified name of the element type to instantiate. + /// A new Element object with the given namespace and qualified name. + public static Element CreateElementNS(string namespaceURI, string qualifiedName) { + return null; + } + public static MutableEvent CreateEvent(string eventType) { return null; } @@ -168,6 +203,10 @@ public static Element CreateTextNode(string data) { return null; } + public static Element ImportNode(Element imporedNode, bool deep) { + return null; + } + public static void DetachEvent(string eventName, ElementEventHandler handler) { } @@ -206,6 +245,16 @@ public static ElementCollection GetElementsByTagName(string tagName) { return null; } + /// + /// Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. + /// + /// The namespace URI of the elements to match on. The special value "*" matches all namespaces. + /// The local name of the elements to match on. The special value "*" matches all local names. + /// A new NodeList object containing all the matched Elements. + public static ElementCollection GetElementsByTagNameNS(string namespaceURI, string localName) { + return null; + } + public static bool HasFocus() { return false; } diff --git a/src/Libraries/Web/Html/Window.cs b/src/Libraries/Web/Html/Window.cs index 2a111fb81..6fab1367e 100644 --- a/src/Libraries/Web/Html/Window.cs +++ b/src/Libraries/Web/Html/Window.cs @@ -324,6 +324,28 @@ public static void Alert(object o) { public static void AttachEvent(string eventName, ElementEventHandler handler) { } + /// + /// Decodes a string of data which has been encoded using base-64 encoding. + /// For use with Unicode or UTF-8 strings. + /// + /// Base64 encoded string + /// String of Binary data + [ScriptName("atob")] + public static string Base64ToBinary(string base64EncodedData) { + return null; + } + + /// + /// Creates a base-64 encoded ASCII string from a "string" of binary data. + /// Please note that this is not suitable for raw Unicode strings! + /// + /// String of binary data + /// Base64 string + [ScriptName("btoa")] + public static string BinaryToBase64(string stringToEncode) { + return null; + } + public static void Close() { } diff --git a/src/Libraries/Web/Xml/XmlDocument.cs b/src/Libraries/Web/Xml/XmlDocument.cs index d196825f3..2629072e9 100644 --- a/src/Libraries/Web/Xml/XmlDocument.cs +++ b/src/Libraries/Web/Xml/XmlDocument.cs @@ -59,5 +59,9 @@ public XmlNode CreateProcessingInstruction(string target, string data) { public XmlText CreateTextNode(string text) { return null; } + + public XmlNode ImportNode(XmlNode externalNode, bool deep) { + return null; + } } } diff --git a/src/Libraries/Web/Xml/XmlNode.cs b/src/Libraries/Web/Xml/XmlNode.cs index ed6189b80..e1fb1a90e 100644 --- a/src/Libraries/Web/Xml/XmlNode.cs +++ b/src/Libraries/Web/Xml/XmlNode.cs @@ -137,31 +137,31 @@ public XmlNodeList GetElementsByTagName(string tagName) { return null; } - public bool HasChildNodes() { + public bool HasAttributes() { return false; } - public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { - return null; + public bool HasChildNodes() { + return false; } - public XmlNode RemoveChild(XmlNode child) { + public XmlNode InsertBefore(XmlNode child, XmlNode refChild) { return null; } - public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { + public XmlNode QuerySelector(string selector) { return null; } - public XmlNodeList SelectNodes(string xpath) { + public XmlNodeList QuerySelectorAll(string selector) { return null; } - public XmlNode SelectSingleNode(string xpath) { + public XmlNode RemoveChild(XmlNode child) { return null; } - public string TransformNode(XmlDocument stylesheet) { + public XmlNode ReplaceChild(XmlNode child, XmlNode oldChild) { return null; } } diff --git a/src/ScriptSharp.sln b/src/ScriptSharp.sln index 04fe50e77..fef45edef 100644 --- a/src/ScriptSharp.sln +++ b/src/ScriptSharp.sln @@ -73,6 +73,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Neo4j", "Libraries\Nod EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Deployment", "Tools\Deployment\Deployment.csproj", "{9D59077D-1A05-4D6C-A1A4-FB748D200578}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Restify", "Libraries\Node\Node.Restify\Node.Restify.csproj", "{1ECC689C-2542-4EE8-8A86-7627E63F44F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Node.Azure", "Libraries\Node\Node.Azure\Node.Azure.csproj", "{4A9F7CE9-5B55-4B28-AD01-05528709B6E4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|.NET = Debug|.NET @@ -336,6 +340,30 @@ Global {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|Mixed Platforms.Build.0 = Release|Any CPU {9D59077D-1A05-4D6C-A1A4-FB748D200578}.Release|x86.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|.NET.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Debug|x86.ActiveCfg = Debug|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|.NET.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Any CPU.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1ECC689C-2542-4EE8-8A86-7627E63F44F8}.Release|x86.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|.NET.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|.NET.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -353,6 +381,8 @@ Global {4A9F7CE9-5B45-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {4A9F7CE9-5B45-4B28-AD01-05529709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {232445FF-22AA-46F7-BA12-4590C670F2B1} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {1ECC689C-2542-4EE8-8A86-7627E63F44F8} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} + {4A9F7CE9-5B55-4B28-AD01-05528709B6E4} = {5D0FD0F6-498E-4126-A297-97B7763DD0AB} {1772A38C-7204-42DC-B81D-6C74D17A4F66} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {BE1E0A21-F6C0-4698-B405-66FC2BB289F4} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} {36D4B098-A21C-4725-ACD3-400922885F38} = {D1DF352A-45B6-4130-9A8B-A24C20257B7D} diff --git a/src/ZipX/Packages/Lib.Node.Azure.nuspec b/src/ZipX/Packages/Lib.Node.Azure.nuspec new file mode 100644 index 000000000..ee7cee95b --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Azure.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Azure + 0.8 + Script# Azure for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Azure APIs in node.js Script# projects. + + This package contains contains the Script.Node.Azure assembly that allows you to reference and program against the Windows Azure APIs when creating Node.js based applications and modules with Script#. + + script azure windowsazure node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/Packages/Lib.Node.Restify.nuspec b/src/ZipX/Packages/Lib.Node.Restify.nuspec new file mode 100644 index 000000000..d62e0c784 --- /dev/null +++ b/src/ZipX/Packages/Lib.Node.Restify.nuspec @@ -0,0 +1,29 @@ + + + + ScriptSharp.Lib.Node.Restify + 0.8 + Script# Restify for Node.js Reference Assembly + Nikhil Kothari + Copyright (c) 2012, Nikhil Kothari + http://scriptsharp.com + http://scriptsharp.com/nuget/PackageLib.png + http://scriptsharp.com/nuget/License.txt + Allows you to reference and use Restify APIs in node.js Script# projects. + + This package contains contains the Script.Node.Restify assembly that allows you to reference and program against the Restify APIs when creating Node.js based applications and modules with Script#. + + script restify node nodejs javascript server scriptsharp thescriptsharp + en-US + false + + + + + + + + + + + diff --git a/src/ZipX/VSIX/Extension.vsixmanifest b/src/ZipX/VSIX/Extension.vsixmanifest index d8ed80ae0..459fd8d27 100644 --- a/src/ZipX/VSIX/Extension.vsixmanifest +++ b/src/ZipX/VSIX/Extension.vsixmanifest @@ -29,6 +29,13 @@ VCSExpress VWDExpress + + Ultimate + Premium + Pro + VCSExpress + VWDExpress + diff --git a/src/ZipX/ZipX.csproj b/src/ZipX/ZipX.csproj index c042ef9f6..faa70ac0b 100644 --- a/src/ZipX/ZipX.csproj +++ b/src/ZipX/ZipX.csproj @@ -28,8 +28,10 @@ + + @@ -81,8 +83,10 @@ + + diff --git a/tests/Core/BrowserTest.cs b/tests/Core/BrowserTest.cs index 5b450750a..2dc75d4ab 100644 --- a/tests/Core/BrowserTest.cs +++ b/tests/Core/BrowserTest.cs @@ -22,6 +22,7 @@ public abstract class BrowserTest { private static readonly string[] _codeFiles = new string[] { "OOP.cs" }; + private static string _compilationFailures; private const int _port = 3976; @@ -40,16 +41,24 @@ static BrowserTest() { File.Copy(Path.Combine(binDirectory, script), Path.Combine(scriptsDirectory, script), overwrite: true); } + List codeFailures = new List(); + string mscorlibPath = Path.Combine(binDirectory, "mscorlib.dll"); foreach (string codeFile in _codeFiles) { string script = Path.GetFileNameWithoutExtension(codeFile) + Path.ChangeExtension(".cs", ".js"); SimpleCompilation compilation = new SimpleCompilation(Path.Combine(scriptsDirectory, script)); - compilation.AddReference(mscorlibPath) - .AddSource(Path.Combine(codeDirectory, codeFile)) - .Execute(); + bool result = compilation.AddReference(mscorlibPath) + .AddSource(Path.Combine(codeDirectory, codeFile)) + .Execute(); + + if (result == false) { + codeFailures.Add(codeFile); + } } + _compilationFailures = (codeFailures.Count == 0) ? null : String.Join(", ", codeFailures); + _webTest = new WebTest(); _webTest.StartWebServer(_port, webRoot); } @@ -64,6 +73,11 @@ public TestContext TestContext { } protected void RunTest(string url) { + if (_compilationFailures != null) { + Assert.Fail("Could not run test due to compilation failure of " + _compilationFailures + "."); + return; + } + Uri testUri = _webTest.GetTestUri(url); WebTestResult result = _webTest.RunTest(testUri, WebBrowser.Chrome); diff --git a/tests/ScriptTests.cs b/tests/ScriptTests.cs index e64325083..6ea00bfb1 100644 --- a/tests/ScriptTests.cs +++ b/tests/ScriptTests.cs @@ -22,6 +22,11 @@ public void TestTypeSystem() { RunTest("/TypeSystem.htm"); } + [TestMethod] + public void TestBases() { + RunTest("/Bases.htm"); + } + #region Loader Tests [TestMethod] public void TestLoader() { diff --git a/tests/TestCases/Basic/Metadata/Baseline.txt b/tests/TestCases/Basic/Metadata/Baseline.txt index 12ad10fbb..dac4adc20 100644 --- a/tests/TestCases/Basic/Metadata/Baseline.txt +++ b/tests/TestCases/Basic/Metadata/Baseline.txt @@ -1513,6 +1513,11 @@ Types: Visibility: Public, Static Generated Name: invokeMethod Abstract: False + Method: IsFalsey + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isFalsey + Abstract: False Method: IsFinite AssociatedType: Boolean Visibility: Public, Static @@ -1543,11 +1548,21 @@ Types: Visibility: Public, Static Generated Name: ss.isValue Abstract: False + Method: IsTruthy + AssociatedType: Boolean + Visibility: Public, Static + Generated Name: isTruthy + Abstract: False Method: Literal AssociatedType: Object Visibility: Public, Static Generated Name: literal Abstract: False + Method: Or + AssociatedType: TValue + Visibility: Public, Static + Generated Name: or + Abstract: False Method: SetField AssociatedType: Void Visibility: Public, Static @@ -1566,7 +1581,7 @@ Types: Method: Value AssociatedType: TValue Visibility: Public, Static - Generated Name: value + Generated Name: ss.value Abstract: False Method: Enumerate AssociatedType: Object @@ -1821,7 +1836,7 @@ Types: Method: Trim AssociatedType: String Visibility: Public - Generated Name: trim + Generated Name: ss.trim Abstract: False Method: TrimEnd AssociatedType: String @@ -3654,6 +3669,11 @@ Types: Visibility: Public, Static Generated Name: any Abstract: False + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith AssociatedType: Task Visibility: Public @@ -3691,6 +3711,11 @@ Types: AssociatedType: T Visibility: Public Generated Name: result + Method: ChangeWith + AssociatedType: Task`1 + Visibility: Public + Generated Name: changeWith + Abstract: False Method: ContinueWith AssociatedType: Task`1 Visibility: Public diff --git a/tests/TestCases/Basic/Minimization/Baseline.txt b/tests/TestCases/Basic/Minimization/Baseline.txt index cf463a71c..daf9da6f6 100644 --- a/tests/TestCases/Basic/Minimization/Baseline.txt +++ b/tests/TestCases/Basic/Minimization/Baseline.txt @@ -173,7 +173,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { }, $0: function() { this.$2(); - ss.base(this, '$0').call(this); + Bar2.prototype.$0.call(this); var d = MyData('a', 'b'); d.$0 = d.$1; }, @@ -273,7 +273,7 @@ define('test', ['ss', 'lib'], function(ss, lib) { }, dispose: function() { this.c$0 = 0; - ss.base(this, 'dispose').call(this); + lib.Behavior.prototype.dispose.call(this); }, c$6: function() { }, diff --git a/tests/TestCases/Basic/Simple/SimpleBaseline.txt b/tests/TestCases/Basic/Simple/SimpleBaseline.txt index 1cecbaec5..68ee0124f 100644 --- a/tests/TestCases/Basic/Simple/SimpleBaseline.txt +++ b/tests/TestCases/Basic/Simple/SimpleBaseline.txt @@ -3,7 +3,7 @@ "use strict"; (function($global) { - var ss = require('ss'); + var ss = require('scriptsharp'); // Basic.EventArgs diff --git a/tests/TestCases/Expression/Base/Baseline.txt b/tests/TestCases/Expression/Base/Baseline.txt index 60080165b..8c8ee0fd1 100644 --- a/tests/TestCases/Expression/Base/Baseline.txt +++ b/tests/TestCases/Expression/Base/Baseline.txt @@ -24,10 +24,10 @@ define('test', ['ss'], function(ss) { } var Bar$ = { sum: function() { - return ss.base(this, 'sum').call(this, 1) + 1; + return Foo.prototype.sum.call(this, 1) + 1; }, toString: function() { - return ss.base(this, 'toString').call(this) + ' -> Bar'; + return Foo.prototype.toString.call(this) + ' -> Bar'; } }; diff --git a/tests/TestCases/Expression/Binary/Baseline.txt b/tests/TestCases/Expression/Binary/Baseline.txt index ff3b9e1ea..262b6ad85 100644 --- a/tests/TestCases/Expression/Binary/Baseline.txt +++ b/tests/TestCases/Expression/Binary/Baseline.txt @@ -85,7 +85,7 @@ define('test', ['ss'], function(ss) { var d = new Data(); d.set_value(d.get_value() + 5); d.set_flag((d.get_flag() | true) === 1); - var o1 = null || {}; + var o1 = ss.value(null, {}); var s2 = (10).toString(); s2 = (100).toString(); s2 = true.toString(); diff --git a/tests/TestCases/Expression/Generics/Baseline.txt b/tests/TestCases/Expression/Generics/Baseline.txt index d227986bf..a4864a0d8 100644 --- a/tests/TestCases/Expression/Generics/Baseline.txt +++ b/tests/TestCases/Expression/Generics/Baseline.txt @@ -14,7 +14,7 @@ define('test', ['ss', 'jquery'], function(ss, $) { }, 0).toString(10); var s4 = encodeURIComponent(this._func(10)); var f2 = this._func; - f2(11).trim(); + ss.trim(f2(11)); var d = {}; var s5 = $.extend(d, d)['abc'].toString(10); var keys = ss.keyCount(d); diff --git a/tests/TestCases/Expression/Members/Baseline.txt b/tests/TestCases/Expression/Members/Baseline.txt index 609890cbb..322c8d28e 100644 --- a/tests/TestCases/Expression/Members/Baseline.txt +++ b/tests/TestCases/Expression/Members/Baseline.txt @@ -67,10 +67,10 @@ define('test', ['ss'], function(ss) { test2: function() { var n = this.get_XYZ(); n = this.get_XYZ(); - n = App$.get_XYZ.call(this); + n = App.prototype.get_XYZ.call(this); this.set_XYZ(n); this.set_XYZ(n); - ss.base(this, 'set_XYZ').call(this, n); + App.prototype.set_XYZ.call(this, n); this._value2 = n; this._value2 = n; this._value2 = n; diff --git a/tests/TestCases/Expression/Script/Baseline.txt b/tests/TestCases/Expression/Script/Baseline.txt index a31779477..05f51928e 100644 --- a/tests/TestCases/Expression/Script/Baseline.txt +++ b/tests/TestCases/Expression/Script/Baseline.txt @@ -27,6 +27,11 @@ define('test', ['ss'], function(ss) { b = ss.isValue(i); b = isNaN(0); b = isFinite(3); + b = !!(0); + b = !!b; + b = !!(b && b); + b = !(1); + b = !(b && b); var addition = eval('2 + 2'); addition = 2 + 2; addition = 2 + 3; diff --git a/tests/TestCases/Expression/Script/Code.cs b/tests/TestCases/Expression/Script/Code.cs index f7cd615fa..6e7ca1502 100644 --- a/tests/TestCases/Expression/Script/Code.cs +++ b/tests/TestCases/Expression/Script/Code.cs @@ -8,9 +8,9 @@ namespace ExpressionTests { public class App { public void Test(int arg) { - arg = Script.Value(arg, 10); - arg = Script.Value(arg, 10, 100); - string s = Script.Value(arg, 10).ToString(10); + arg = Script.Or(arg, 10); + arg = Script.Or(arg, 10, 100); + string s = Script.Or(arg, 10).ToString(10); bool b = Script.Boolean(arg); StringBuilder sb = (StringBuilder)Script.CreateInstance(typeof(StringBuilder)); @@ -29,6 +29,11 @@ public void Test(int arg) { b = Script.IsValue(i); b = Script.IsNaN(0); b = Script.IsFinite(3); + b = Script.IsTruthy(0); + b = Script.IsTruthy(b); + b = Script.IsTruthy(b && b); + b = Script.IsFalsey(1); + b = Script.IsFalsey(b && b); int addition = (int)Script.Eval("2 + 2"); diff --git a/tests/TestCases/Library/Node/Baseline.txt b/tests/TestCases/Library/Node/Baseline.txt index e2be2db2b..f53bbd167 100644 --- a/tests/TestCases/Library/Node/Baseline.txt +++ b/tests/TestCases/Library/Node/Baseline.txt @@ -1,7 +1,7 @@ // app.js // -var ss = require('ss'), +var ss = require('scriptsharp'), http = require('http'); var $global = this; diff --git a/tests/TestCases/Library/Node/Code.cs b/tests/TestCases/Library/Node/Code.cs index 635421889..3a1b8641a 100644 --- a/tests/TestCases/Library/Node/Code.cs +++ b/tests/TestCases/Library/Node/Code.cs @@ -23,6 +23,6 @@ static App() { response.WriteHead(HttpStatusCode.OK, new Dictionary("Content-Type", "text/html")); response.End("Hello Node World, from Script#!"); - }).Listen(Script.Value(Node.Process.Environment["port"], 8888)); + }).Listen(Script.Or(Node.Process.Environment["port"], 8888)); } } diff --git a/tests/TestCases/Library/jQuery/Baseline.txt b/tests/TestCases/Library/jQuery/Baseline.txt index c28be011f..76ddc570f 100644 --- a/tests/TestCases/Library/jQuery/Baseline.txt +++ b/tests/TestCases/Library/jQuery/Baseline.txt @@ -17,8 +17,8 @@ define('test', ['ss', 'jquery'], function(ss, $) { } }); }; MyApp.postData = function(url, data, succesCallback, errorCallback, returnType, requestType) { - returnType = returnType || 'text'; - requestType = requestType || 'POST'; + returnType = (returnType || 'text'); + requestType = (requestType || 'POST'); $.ajax({ cache: false, data: data, dataType: returnType, error: function(req, textStatus, error) { if (ss.isValue(errorCallback)) { errorCallback(req, textStatus, error); diff --git a/tests/TestCases/Library/jQuery/Code.cs b/tests/TestCases/Library/jQuery/Code.cs index e64103c26..46395d620 100644 --- a/tests/TestCases/Library/jQuery/Code.cs +++ b/tests/TestCases/Library/jQuery/Code.cs @@ -43,8 +43,8 @@ private static void AlertData(string url) { } public static void PostData(string url, object data, AjaxRequestCallback succesCallback, AjaxErrorCallback errorCallback, string returnType, string requestType) { - returnType = returnType ?? "text"; - requestType = requestType ?? "POST"; + returnType = Script.Or(returnType, "text"); + requestType = Script.Or(requestType, "POST"); jQuery.Ajax(new jQueryAjaxOptions( "cache", false, diff --git a/tests/TestCases/Member/Indexers/Baseline.txt b/tests/TestCases/Member/Indexers/Baseline.txt index a4db55dd7..3c2065171 100644 --- a/tests/TestCases/Member/Indexers/Baseline.txt +++ b/tests/TestCases/Member/Indexers/Baseline.txt @@ -133,15 +133,15 @@ define('test', ['ss'], function(ss) { VirtualIndexer.call(this); var i = this.get_item('name'); this.set_item('name', i + 1); - var j = ss.base(this, 'get_item').call(this, 'name'); - ss.base(this, 'set_item').call(this, 'name', 43); + var j = VirtualIndexer.prototype.get_item.call(this, 'name'); + VirtualIndexer.prototype.set_item.call(this, 'name', 43); } var OverriddenIndexer$ = { get_item: function(name) { - return ss.base(this, 'get_item').call(this, name) + 1; + return VirtualIndexer.prototype.get_item.call(this, name) + 1; }, set_item: function(name, value) { - ss.base(this, 'set_item').call(this, name, value - 1); + VirtualIndexer.prototype.set_item.call(this, name, value - 1); return value; } }; diff --git a/tests/TestCases/Member/Properties/Baseline.txt b/tests/TestCases/Member/Properties/Baseline.txt index 9c8678a95..88c797959 100644 --- a/tests/TestCases/Member/Properties/Baseline.txt +++ b/tests/TestCases/Member/Properties/Baseline.txt @@ -41,7 +41,7 @@ define('test', ['ss'], function(ss) { function Test2() { Test.call(this); - var n = Test$.get_XYZ.call(this); + var n = Test.prototype.get_XYZ.call(this); if (n === this.get_XYZ()) { } if (this.get_XYZ() === n) { diff --git a/tests/TestCases/Type/Partials/Baseline.txt b/tests/TestCases/Type/Partials/Baseline.txt index 968a6db33..11d256e6c 100644 --- a/tests/TestCases/Type/Partials/Baseline.txt +++ b/tests/TestCases/Type/Partials/Baseline.txt @@ -112,7 +112,7 @@ define('test', ['ss'], function(ss) { var e1 = document.getElementById(this.bar); var e2 = document.getElementById(this.name); var e3 = document.getElementById(this.bar); - var s = this.testMethod() + ss.base(this, 'testMethod').call(this); + var s = this.testMethod() + MergedMembersClass.prototype.testMethod.call(this); }, get_item: function(s) { return s; diff --git a/tests/TestCases/Validation/InlineScript/Code.cs b/tests/TestCases/Validation/InlineScript/Code.cs index 28de5655f..5ee3257a6 100644 --- a/tests/TestCases/Validation/InlineScript/Code.cs +++ b/tests/TestCases/Validation/InlineScript/Code.cs @@ -13,6 +13,7 @@ public void Test(int arg) { string scriptTemplate = "alert({0} + {1})"; Script.Literal(scriptTemplate, a, a); + Script.Literal("alert({name:{0}})", "aaa"); } } } diff --git a/tests/TestSite/Bases.htm b/tests/TestSite/Bases.htm new file mode 100644 index 000000000..a90ed09b5 --- /dev/null +++ b/tests/TestSite/Bases.htm @@ -0,0 +1,45 @@ + + + + Bases + + + + + +

Test Results

+

+

+
    +
    + + + + + + + + + diff --git a/tests/TestSite/Code/OOP.cs b/tests/TestSite/Code/OOP.cs index 1b5d7b415..7891e84ef 100644 --- a/tests/TestSite/Code/OOP.cs +++ b/tests/TestSite/Code/OOP.cs @@ -121,3 +121,140 @@ public interface IObject { public class Zoo { } } + + +namespace Test.Bases { + + // A series of classes with different combinations of overrides at different + // levels in the class hierarchy. Tests issues #379, #384 as applied to properties, + // methods, and index operators. + + public class C1 { + private string _valueA = "A"; + + public virtual string PropertyA { + get { + return _valueA + "-PC1"; + } + set { + _valueA = value + "+PC1"; + } + } + + public virtual string MethodA() { + return _valueA + "-MC1"; + } + + public virtual string this[int key] { + get { + return _valueA + "-" + key.ToString() + "IC1"; + } + set { + _valueA = value + "+" + key.ToString() + "IC1"; + } + } + } + + public class C2 : C1 { + public override string PropertyA { + get { + return base.PropertyA + "-PC2"; + } + set { + base.PropertyA = value + "+PC2"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC2"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC2"; + } + set { + base[key] = value + "+" + key.ToString() + "IC2"; + } + } + } + + public class C3 : C2 { + public override string PropertyA { + get { + return base.PropertyA + "-PC3"; + } + set { + base.PropertyA = value + "+PC3"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC3"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC3"; + } + set { + base[key] = value + "+" + key.ToString() + "IC3"; + } + } + } + + public class C4 : C3 { + // intentionally skip this generation of overrides + } + + public class C5 : C4 { + public override string PropertyA { + get { + return base.PropertyA + "-PC5"; + } + set { + base.PropertyA = value + "+PC5"; + } + } + + public override string MethodA() { + return base.MethodA() + "-MC5"; + } + + public override string this[int key] { + get { + return base[key] + "-" + key.ToString() + "IC5"; + } + set { + base[key] = value + "+" + key.ToString() + "IC5"; + } + } + } + + public class TestCase { + + public static string RunTest(C1 x) { + string output = ""; + string delim = ","; + + // Test getter, method, and index (should accumulate outward through bases) + output = x.PropertyA + + delim + x.MethodA() + + delim + x[99]; + + // Test property setter (should accumulate inward and outward through bases) + + x.PropertyA = "X"; + output += delim + x.PropertyA; + + // Test index setter (should accumulate inward and outward through bases) + + x[88] = "Y"; + output += delim + x[99]; + + return output; + } + + } + +} diff --git a/tests/TestSite/String.htm b/tests/TestSite/String.htm index dc0422059..7adba8c55 100644 --- a/tests/TestSite/String.htm +++ b/tests/TestSite/String.htm @@ -22,11 +22,32 @@

    test('trim', function() { QUnit.equal(ss.trimStart('Hello'), 'Hello'); QUnit.equal(ss.trimStart(' Hello'), 'Hello'); - QUnit.equal(ss.trimEnd(' Hello'), ' Hello'); + QUnit.equal(ss.trimStart(' Hello '), 'Hello '); + + QUnit.equal(ss.trimEnd('Hello'), 'Hello'); QUnit.equal(ss.trimEnd('Hello '), 'Hello'); - QUnit.equal(ss.trimStart('Hello'), 'Hello'); + QUnit.equal(ss.trimEnd(' Hello '), ' Hello'); + QUnit.equal(ss.trimEnd(ss.trimStart(' Hello ')), 'Hello'); QUnit.equal(ss.trimEnd(ss.trimStart('\tHello ')), 'Hello'); + + QUnit.equal(ss.trim('Hello'), 'Hello'); + QUnit.equal(ss.trim(' Hello '), 'Hello'); + QUnit.equal(ss.trim('\tHello '), 'Hello'); + QUnit.equal(ss.trim('\t Hello World '), 'Hello World'); + + QUnit.equal(ss.trimStart('00word00', ['0']), 'word00'); + QUnit.equal(ss.trimStart('10word01', ['0', '1']), 'word01'); + QUnit.equal(ss.trimStart('10 0word0 01', ['0', '1']), ' 0word0 01'); + + QUnit.equal(ss.trimEnd('00word00', ['0']), '00word'); + QUnit.equal(ss.trimEnd('10word01', ['0', '1']), '10word'); + QUnit.equal(ss.trimEnd('10 0word0 01', ['0', '1']), '10 0word0 '); + + QUnit.equal(ss.trim('00word00', ['0']), 'word'); + QUnit.equal(ss.trim('10word01', ['0', '1']), 'word'); + QUnit.equal(ss.trim('10 0word0 01', ['0', '1']), ' 0word0 '); + QUnit.equal(ss.trim(' word ', []), 'word'); }); test('padLeft', function() { diff --git a/tests/ValidationTests.cs b/tests/ValidationTests.cs index ff598d290..1d608b69e 100644 --- a/tests/ValidationTests.cs +++ b/tests/ValidationTests.cs @@ -114,7 +114,8 @@ public void TestImplicitEnums() { [TestMethod] public void TestInlineScript() { string expectedErrors = - "The argument to Script.Literal must be a constant string. Code.cs(15, 28)"; + "The argument to Script.Literal must be a constant string. Code.cs(15, 28)" + Environment.NewLine + + "The argument to Script.Literal must be a valid String.Format string. Code.cs(16, 28)"; Compilation compilation = CreateCompilation(); compilation.AddSource("Code.cs");