Permalink
Browse files

0.5.0 release.

  • Loading branch information...
0 parents commit 94ce5494b8b03a71297efcb295c9cb7df33dc5de Andre Rodrigues committed Dec 9, 2011
Showing with 19,088 additions and 0 deletions.
  1. +9 −0 .gitignore
  2. +1 −0 .npmignore
  3. +176 −0 LICENSE.txt
  4. +165 −0 README.md
  5. +10 −0 examples/blobuploader/helpers.js
  6. +10 −0 examples/blobuploader/package.json
  7. BIN examples/blobuploader/public/Images/delete.png
  8. BIN examples/blobuploader/public/Images/download.png
  9. +496 −0 examples/blobuploader/public/css/default.css
  10. +48 −0 examples/blobuploader/public/css/reset.css
  11. +129 −0 examples/blobuploader/server.js
  12. +39 −0 examples/blobuploader/views/display.ejs
  13. +4 −0 examples/blobuploader/views/error.ejs
  14. +4 −0 examples/blobuploader/views/index.ejs
  15. +30 −0 examples/blobuploader/views/layout.ejs
  16. +26 −0 examples/blobuploader/views/upload.ejs
  17. +85 −0 examples/blog/blog.js
  18. +11 −0 examples/blog/package.json
  19. +68 −0 examples/blog/public/stylesheets/style.css
  20. +66 −0 examples/blog/public/stylesheets/style.styl
  21. +79 −0 examples/blog/server.js
  22. +19 −0 examples/blog/views/blog_new.ejs
  23. +17 −0 examples/blog/views/blog_show.ejs
  24. +31 −0 examples/blog/views/index.ejs
  25. +8 −0 examples/blog/views/layout.ejs
  26. +220 −0 examples/samples/blobuploaddownloadsample.js
  27. +132 −0 examples/samples/continuationsample.js
  28. +111 −0 examples/samples/leaseblobsample.js
  29. +97 −0 examples/samples/retrypolicysample.js
  30. +188 −0 examples/samples/sassample.js
  31. +219 −0 examples/samples/snapshotsample.js
  32. +89 −0 examples/tasklist/home.js
  33. +11 −0 examples/tasklist/package.json
  34. +66 −0 examples/tasklist/server.js
  35. +60 −0 examples/tasklist/views/home.ejs
  36. +40 −0 examples/tasklist/views/home.jade
  37. +75 −0 lib/azure.js
  38. +137 −0 lib/common/exponentialretrypolicyfilter.js
  39. +117 −0 lib/common/linearretrypolicyfilter.js
  40. +94 −0 lib/diagnostics/logger.js
  41. +342 −0 lib/http/webresource.js
  42. +2,513 −0 lib/services/blob/blobservice.js
  43. +47 −0 lib/services/blob/hmacsha256sign.js
  44. +86 −0 lib/services/blob/models/blobresult.js
  45. +93 −0 lib/services/blob/models/blocklistresult.js
  46. +92 −0 lib/services/blob/models/containeraclresult.js
  47. +77 −0 lib/services/blob/models/containerresult.js
  48. +52 −0 lib/services/blob/models/leaseresult.js
  49. +58 −0 lib/services/blob/models/listblobsresultcontinuation.js
  50. +54 −0 lib/services/blob/models/listcontainersresultcontinuation.js
  51. +190 −0 lib/services/blob/models/servicepropertiesresult.js
  52. +173 −0 lib/services/blob/sharedaccesssignature.js
  53. +144 −0 lib/services/blob/sharedkey.js
  54. +118 −0 lib/services/blob/sharedkeylite.js
  55. +54 −0 lib/services/queue/models/listqueuesresultcontinuation.js
  56. +90 −0 lib/services/queue/models/queuemessageresult.js
  57. +52 −0 lib/services/queue/models/queueresult.js
  58. +180 −0 lib/services/queue/models/servicepropertiesresult.js
  59. +744 −0 lib/services/queue/queueservice.js
  60. +710 −0 lib/services/serviceclient.js
  61. +310 −0 lib/services/table/atomhandler.js
  62. +246 −0 lib/services/table/batchserviceclient.js
  63. +73 −0 lib/services/table/models/queryentitiesresultcontinuation.js
  64. +59 −0 lib/services/table/models/querytablesresultcontinuation.js
  65. +178 −0 lib/services/table/models/servicepropertiesresult.js
  66. +86 −0 lib/services/table/sharedkeylitetable.js
  67. +89 −0 lib/services/table/sharedkeytable.js
  68. +285 −0 lib/services/table/tablequery.js
  69. +892 −0 lib/services/table/tableservice.js
  70. +86 −0 lib/util/base64.js
  71. +1,823 −0 lib/util/constants.js
  72. +77 −0 lib/util/iso8061date.js
  73. +80 −0 lib/util/util.js
  74. +36 −0 package.json
  75. +376 −0 projects/VS/Azure.csproj
  76. +20 −0 projects/VS/Azure.sln
  77. +187 −0 test/azure-tests.js
  78. +143 −0 test/common/exponentialretrypolicyfilter-tests.js
  79. +143 −0 test/common/linearretrypolicyfilter-tests.js
  80. +24 −0 test/extendedtestlist.txt
  81. +44 −0 test/runextendedtests.js
  82. +63 −0 test/runjshint.js
  83. +44 −0 test/runtests.js
  84. +272 −0 test/services/blob/blobservice-longrunning-tests.js
  85. +1,222 −0 test/services/blob/blobservice-tests.js
  86. +142 −0 test/services/blob/filters-tests.js
  87. +157 −0 test/services/blob/sharedaccesssignature-tests.js
  88. +51 −0 test/services/blob/sharedkey-tests.js
  89. +105 −0 test/services/blob/sharedkeylite-tests.js
  90. +129 −0 test/services/queue/listqueuesresultcontinuation-tests.js
  91. +460 −0 test/services/queue/queueservice-tests.js
  92. +70 −0 test/services/table/atomhandler-tests.js
  93. +84 −0 test/services/table/batchserviceclient-tests.js
  94. +156 −0 test/services/table/queryentitiesresultcontinuation-tests.js
  95. +135 −0 test/services/table/querytablesresultcontinuation-tests.js
  96. +64 −0 test/services/table/sharedkeylitetable-tests.js
  97. +112 −0 test/services/table/sharedkeytable-tests.js
  98. +126 −0 test/services/table/tablequery-tests.js
  99. +377 −0 test/services/table/tableservice-batch-tests.js
  100. +138 −0 test/services/table/tableservice-tablequery-tests.js
  101. +689 −0 test/services/table/tableservice-tests.js
  102. +20 −0 test/testlist.txt
  103. +45 −0 test/util/base64-tests.js
  104. +46 −0 test/util/iso8061date-tests.js
  105. +30 −0 test/util/util-tests.js
  106. +38 −0 test/util/util.js
@@ -0,0 +1,9 @@
+node_modules/
+*.suo
+*.user
+projects/VS/*.XML
+projects/VS/_ReSharper*
+projects/VS/obj/
+projects/VS/bin/
+projects/Eclipse
+targets/*
@@ -0,0 +1 @@
+.git*
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
165 README.md
@@ -0,0 +1,165 @@
+<h1>Windows Azure SDK for Node.js</h1>
+<p>This project provides a set of Node.js packages that make it easy to access
+the Windows Azure storage and queue services. For documentation on how
+to host Node.js applications on Windows Azure, please see the
+<a href="http://www.windowsazure.com/en-us/develop/nodejs/">Windows Azure
+Node.js Developer Center</a>.</p>
+
+<h1>Features</h1>
+<ul>
+ <li>Tables
+ <ul>
+ <li>create and delete tables</li>
+ <li>create, query, insert, update, merge, and delete entities</li>
+ </li>
+ <li>Blobs
+ <ul>
+ <li>create, list, and delete containers, work with container metadata
+ and permissions, list blobs in container</li>
+ <li>create block and page blobs (from a stream, a file, or a string),
+ work with blob blocks and pages, delete blobs</li>
+ <li>work with blob properties, metadata, leases, snapshot a blob</li>
+ </li>
+ <li>Queues
+ <ul>
+ <li>create, list, and delete queues, and work with queue metadata</li>
+ <li>create, get, peek, update, delete messages</li>
+ </li>
+</ul>
+
+<h1>Getting Started</h1>
+<h2>Download Source Code</h2>
+<p>To get the source code of the SDK via <strong>git</strong> just type:<br/>
+<pre>git clone https://github.com/WindowsAzure/azure-sdk-for-node.git<br/>cd ./azure-sdk-for-node</pre>
+</p>
+
+<h2>Download Package</h2>
+<p>Alternatively, to get the source code via the Node Package Manager (npm), type<br/>
+<pre>npm install azure</pre>
+<p>You can use these packages against the cloud Windows Azure Services, or against
+the local Storage Emulator.</p>
+<ol>
+ <li>To use the cloud services, you need to first create an account with
+ Windows Azure. You need to set the AZURE_STORAGE_ACCOUNT and the AZURE_STORAGE_ACCESS_KEY
+ environment variables to the storage account name and primary access key you
+ obtain from the Azure Portal.</li>
+ <li>To use the Storage Emulator, make sure the latest version of the
+ Windows Azure SDK is installed on the machine, and set the EMULATED environment
+ variable to any value ("true", "1", etc.)</li>
+</ol>
+
+<h1>Usage</h1>
+<h2>Table Storage</h2>
+<p>To ensure a table exists, call <strong>createTableIfNotExists</strong>:</p>
+<pre>
+var tableService = azure.createTableService();
+tableService.createTableIfNotExists('tasktable', function(error){
+ if(!error){
+ // Table exists
+ }
+});
+</pre>
+<p>A new entity can be added by calling <strong>insertEntity</strong>:</p>
+<pre>
+var tableService = azure.createTableService(),
+ task1 = {
+ PartitionKey : 'tasksSeattle',
+ RowKey: '1',
+ Description: 'Take out the trash',
+ DueDate: new Date(2011, 12, 14, 12)
+ };
+tableService.insertEntity('tasktable', task1, function(error){
+ if(!error){
+ // Entity inserted
+ }
+});
+</pre>
+<p>The method <strong>queryEntity</strong> can then be used to fetch the entity that was just inserted:</p>
+<pre>
+var tableService = azure.createTableService();
+tableService.queryEntity('tasktable', 'tasksSeattle', '1', function(error, serverEntity){
+ if(!error){
+ // Entity available in serverEntity variable
+ }
+});
+</pre>
+<h2>Blob Storage</h2>
+<p>The <strong>createContainerIfNotExists</strong> method can be used to create a
+container in which to store a blob:</p>
+<pre>
+var blobService = azure.createBlobService();
+blobService.createContainerIfNotExists('taskcontainer', {publicAccessLevel : 'blob'}, function(error){
+ if(!error){
+ // Container exists and is public
+ }
+});
+</pre>
+<p>To upload a file (assuming it is called task1-upload.txt, it contains the exact text "hello world" (no quotation marks), and it is placed in the same folder as the script below), the method <strong>createBlockBlobFromStream</strong> can be used:</p>
+<pre>
+var blobService = azure.createBlobService();
+blobService.createBlockBlobFromStream('taskcontainer', 'task1', fs.createReadStream('task1-upload.txt'), 11, function(error){
+ if(!error){
+ // Blob uploaded
+ }
+});
+</pre>
+<p>To download the blob and write it to the file system, the <strong>getBlobToStream</strong> method can be used:</p>
+<pre>
+var blobService = azure.createBlobService();
+blobService.getBlobToStream('taskcontainer', 'task1', fs.createWriteStream('task1-download.txt'), function(error, serverBlob){
+ if(!error){
+ // Blob available in serverBlob.blob variable
+ }
+});
+</pre>
+<h2>Queues</h2>
+<p>The <strong>createQueueIfNotExists</strong> method can be used to ensure a queue exists:</p>
+<pre>
+var queueService = azure.createQueueService();
+queueService.createQueueIfNotExists('taskqueue', function(error){
+ if(!error){
+ // Queue exists
+ }
+});
+</pre>
+<p>The <strong>createMessage</strong> method can then be called to insert the message into the queue:</p>
+<pre>
+var queueService = azure.createQueueService();
+queueService.createMessage('taskqueue', "Hello world!", function(error){
+ if(!error){
+ // Message inserted
+ }
+});
+</pre>
+<p>It is then possible to call the <strong>getMessage</strong> method, process the message and then call <strong>deleteMessage</strong> inside the callback. This two-step process ensures messages don't get lost when they are removed from the queue.</p>
+<pre>
+var queueService = azure.createQueueService(),
+ queueName = 'taskqueue';
+queueService.getMessages(queueName, function(error, serverMessages){
+ if(!error){
+ // Process the message in less than 30 seconds, the message
+ // text is available in serverMessages[0].messagetext
+
+ queueService.deleteMessage(queueName, serverMessages[0].messageid, serverMessages[0].popreceipt, function(error){
+ if(!error){
+ // Message deleted
+ }
+ });
+ }
+});
+</pre>
+<p><strong>For more examples please see the <a href="http://www.windowsazure.com/en-us/develop/nodejs/">
+Windows Azure Node.js Developer Center</a>.</strong></p>
+
+<h1>Need Help?</h1>
+<p>Be sure to check out the Windows Azure <a href="http://go.microsoft.com/fwlink/?LinkId=234489">
+Developer Forums on Stack Overflow</a> if you have trouble with the provided code.</p>
+
+<h1>Feedback</h1>
+<p>For feedback related specifically to this SDK, please use the Issues
+section of the repository.</p>
+<p>For general suggestions about Windows Azure please use our
+<a href="http://www.mygreatwindowsazureidea.com/forums/34192-windows-azure-feature-voting">UserVoice forum</a>.</p>
+
+<h1>Learn More</h1>
+<a href="http://www.windowsazure.com/en-us/develop/nodejs/">Windows Azure Node.js Developer Center</a>
@@ -0,0 +1,10 @@
+//Helper functions
+var exports = module.exports;
+
+exports.renderError = function(response, message) {
+ response.render("error.ejs", {
+ locals: {
+ title: message ? message : "Error"
+ }
+ });
+};
@@ -0,0 +1,10 @@
+{
+ "name": "productmanager"
+ , "version": "0.0.1"
+ , "private": true
+ , "dependencies": {
+ "express": ">= 2.4.7"
+ , "ejs": ">= 0.4.3"
+ , "formidable": ">= 1.0.6"
+ }
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 94ce549

Please sign in to comment.