{"id":18510057,"url":"https://github.com/gitana/gitana-javascript-driver","last_synced_at":"2025-04-09T04:33:04.441Z","repository":{"id":57251125,"uuid":"985615","full_name":"gitana/gitana-javascript-driver","owner":"gitana","description":"Cloud CMS JavaScript Driver Library","archived":false,"fork":false,"pushed_at":"2025-01-23T02:37:28.000Z","size":46224,"stargazers_count":11,"open_issues_count":6,"forks_count":10,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-23T23:15:28.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gitana.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitana.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-10-14T00:50:26.000Z","updated_at":"2025-01-23T02:37:31.000Z","dependencies_parsed_at":"2024-11-06T15:32:34.415Z","dependency_job_id":null,"html_url":"https://github.com/gitana/gitana-javascript-driver","commit_stats":{"total_commits":772,"total_committers":14,"mean_commits":"55.142857142857146","dds":0.2759067357512953,"last_synced_commit":"bd9996bd2dd1bdaa0aa342110f17ce5eb7b42e11"},"previous_names":[],"tags_count":179,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fgitana-javascript-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fgitana-javascript-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fgitana-javascript-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitana%2Fgitana-javascript-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitana","download_url":"https://codeload.github.com/gitana/gitana-javascript-driver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980831,"owners_count":21027803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T15:20:33.266Z","updated_at":"2025-04-09T04:33:04.427Z","avatar_url":"https://github.com/gitana.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloud CMS JavaScript Driver\n\nThis driver provides connectivity between a JavaScript application and Cloud CMS.\n\nThe JavaScript application can be running within the browser or on the server.  The driver supports the browser,\nNode.js and other server-side / CommonJS runtimes.  \n\n## Web Browser\n\nTo use this driver within your browser application, you first download the driver and then pull into your page\nlike so:\n\n````\n\u003cscript type=\"text/javascript\" src=\"gitana.min.js\"\u003e\u003c/script\u003e\n````\n\nAnd then you connect to Cloud CMS by identifying your client key/secret and authentication username and password.\n\n````\nGitana.connect({\n    \"clientKey\": \"\u003cclientKey\u003e\",\n    \"clientSecret\": \"\u003cclientSecret\u003e\"\n    \"username\": \"\u003cusername\u003e\",\n    \"password\": \"\u003cpassword\u003e\"\n}, function(err) {\n\n    // this = platform\n\n});\n````\n\nWhere \u003cb\u003eclientKey\u003c/b\u003e and \u003cb\u003eclientSecret\u003c/b\u003e are used to identify your client application.  You can use the\nclient key/secret combination generated by default for your platform or you can create a new client.  Ideally, you\nwill have one client per JS/HTML5 or Node.js application running out in the wild.\n\nYou can provide the \u003cb\u003eusername\u003c/b\u003e and \u003cb\u003epassword\u003c/b\u003e for any valid user on your platform.  Make sure that this user\nhas sufficient CONNECT privileges to the platform and that they have sufficient rights to any resources you attempt\nto use (otherwise, you will see 401 authentication errors).\n\nYou may also opt to take advantage of Authentication Grants to generate private application user key/secret in lieu of\nusername/password credentials.\n\n\n## AMD\n\nThe driver also supports AMD.  If you're using a module loader like RequireJS, you can load the \u003ccode\u003egitana\u003c/code\u003e\nmodule and utilize it within your code.  Kind of like this:\n\n````\ndefine([\"gitana\"], function(Gitana) {\n\n    Gitana.connect({\n        \"clientKey\": \"\u003cclientKey\u003e\",\n        \"clientSecret\": \"\u003cclientSecret\u003e\"\n        \"username\": \"\u003cusername\u003e\",\n        \"password\": \"\u003cpassword\u003e\"\n    }, function(err) {\n\n        // this = platform\n\n    });\n\n});\n````\n\n\n## Node.js / CommonJS\n\nThis driver is available via the \u003ca href=\"https://npmjs.org/package/gitana\"\u003eNPM Registry as 'gitana'\u003c/a\u003e.\n\nUsing it in Node JS is pretty easy.  You can do something like the following:\n\n````\nvar Gitana = require(\"gitana\");\n\nGitana.connect({\n    \"clientKey\": \"\u003cclientKey\u003e\",\n    \"clientSecret\": \"\u003cclientSecret\u003e\"\n    \"username\": \"\u003cusername\u003e\",\n    \"password\": \"\u003cpassword\u003e\"\n}, function(err) {\n\n    // this = platform\n    \n});\n````\n\n## Driver API and Chaining\n\nThis driver makes it really simple to work with Cloud CMS data stores and objects as though they were local objects\nright within your JS application.  The driver lets you get at all of the runtime and authoring capabilities of the\nsystem.\n\nIn addition, this driver features asynchronous method chaining.  This lets you chain together commands that go over\nthe wire and avoid a lot of the headache of manually managing callbacks.  As a result, your code is smaller, there\nis less to manage and it's easier to read.\n\nHere is an example:\n\n````\nplatform.createRepository().readBranch(\"master\").createNode({\"title\": \"Hello World\"});\n````\n\n## Documentation\n\nWe've published our documentation for the JavaScript driver as well as other drivers to our\n\u003ca href=\"https://www.cloudcms.com/documentation.html\"\u003eDocumentation Site\u003c/a\u003e.\n\nIn addition, we've published \u003ca href=\"http://code.cloudcms.com/gitana-javascript-driver/latest/jsdoc/index.html\"\u003e\nJavaScript-level API documentation\u003c/a\u003e.\n\n## Developer Notes\n\nWe've collected a few developer notes here:\n\n### Custom XHR implementation\n\nThe driver relies on XHR under the hood for communication with Cloud CMS.  You can plug in your own XHR implementations\nby overriding the following:\n\n    Gitana.HTTP_XR_FACTORY = function() {    \n        ...\n    };\n\n### HTTP(S) Proxy Servers\n    \nThe driver supports HTTP and HTTPS proxy servers if you're running in Node.js.  Simply set the following variable in your\nenvironment:\n\n    HTTP_PROXY\n    \nFor example -\n\n    export HTTP_PROXY=http://proxyserver:proxyport\n    node app\n    \nThe `HTTP_PROXY` environment variable can point to an HTTP or HTTPS proxy server.\n    \n## Build\n\nTo build locally, you must first sync the code to your local GitHub repository and also install Node.js.\nThen, run the following:\n\n````\nnpm install\n````\n\nThis will install the latest versions of Grunt and all Grunt and Node.js dependencies for build and test.\nThen, to build, run the following:\n\n````\nant clean package\n````\n\nThis will produce the latest \u003ccode\u003egitana.js\u003c/code\u003e and \u003ccode\u003egitana.min.js\u003c/code\u003e files in your \u003ccode\u003edist\u003c/code\u003e\ndirectory.\n\nA Grunt file is provided with a number of useful tasks.  While Grunt is utilized, it does not provide the primary\nbuild mechanism.  This project uses Ant and makes calls out to Grunt when needed.\n\nOne useful option is to run JSHint over any customizations to the code base.\n\n````\ngrunt jshint\n````\n\nWherever possible, please try to follow the code conventions utilized by the project.  For the most part, these\ninclude spacing and line breaks that are generous so as to improve code readability.\n\n\n## Testing\n\nAfter you've performed a build, you can test it by doing the following:\n\n````\ngrunt web\n````\n\nThis starts up a local web server.  You can use this to run the tests locally by opening up a browser and going to:\n\n````\nhttp://localhost:8000/tests\n````\n\nYou can also run the tests headlessly using PhantomJS.  To do so, run the following commands:\n\n````\nnpm install phantomjs -g\ngrunt test\n````\n\nThis will launch PhantomJS and run the QUnit tests without the need for a browser.  This is good for functional\ntesting (but is not a replacement for browser variation testing).\n\n\n## Support\n\nYou can learn more about Cloud CMS by visiting our web site at\n\u003ca href=\"https://gitana.io\"\u003ehttp://gitana.io\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitana%2Fgitana-javascript-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitana%2Fgitana-javascript-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitana%2Fgitana-javascript-driver/lists"}