{"_id":"@brownpapertickets/surya-gql-demo","_rev":"4-1885cfeeb14b9eda67cc26736d685c37","name":"@brownpapertickets/surya-gql-demo","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.8":{"name":"@brownpapertickets/surya-gql-demo","version":"1.0.8","description":"A demonstration project for surya-gql","main":"src/index.js","scripts":{"start":"babel-node src/index.js","prod-start":"node dist/index.js","test":"","build":"rm -rf dist && babel src -d dist -s","deploy":"npm publish --access public"},"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/brownpapertickets/surya-gql-demo.git"},"keywords":["surya-gql"],"author":{"name":"Breanna Anderson","url":"glyphstone"},"license":"MIT","homepage":"https://bitbucket.org/breannaa-bpt/surya-gql-demo#readme","dependencies":{"@brownpapertickets/surya-gql-auth":"^0.1.3","@brownpapertickets/surya-gql-data":"^0.1.15","@brownpapertickets/surya-gql-data-mongodb":"^0.1.17","@brownpapertickets/surya-gql-data-pgsql":"^0.1.15","@brownpapertickets/surya-gql-scalar":"^0.1.6","@brownpapertickets/surya-gql-types":"^0.2.6","apollo-server":"^2.9.3","apollo-server-express":"^2.9.3","express":"^4.17.1","lodash":"^4.17.15"},"devDependencies":{"@babel/cli":"^7.7.0","@babel/core":"^7.5.5","@babel/node":"^7.5.5","@babel/preset-env":"^7.5.5","jest-cli":"^24.9.0"},"gitHead":"15daf948c21a619bc3da0316950bbd758ac00cbc","_id":"@brownpapertickets/surya-gql-demo@1.0.8","_nodeVersion":"10.17.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-XkpJAhzyE+Wo04h2ISXhH3ekxKnTcCSHTgK4h03s/vZyebkXwn5z53bQnMjgAuOam6pUZQGUB7zTaYsfwnZ7+A==","shasum":"084f95dc0296980eefa32e407acb51ba09ccdab6","tarball":"https://registry.npmjs.org/@brownpapertickets/surya-gql-demo/-/surya-gql-demo-1.0.8.tgz","fileCount":40,"unpackedSize":67674,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdwiIdCRA9TVsSAnZWagAAeTIP/2lfAw56dYs+31yVwx/a\nWocBeqtBFEquK/DC8+e4hXvXMQBMB9/ger6JV1aEmZbBTc2vTtVf345jrdZm\nFUMWZYDT8uAVc8/8LkWlUcbDhGyezlShTka+u8L8IpiwSel46Joeux4S8TEM\nQw9ZOD2l5+XXDnu8N6/XINX1vYAww4Od5D3Zsu8wHCM66mpUGw5dEGibnJcn\nd3ylA0wp+HYoWcL2Uo2vuD8ATZ1UN2gONZmWszqThdw81YUer3DAJ11yLfHQ\nwCxXUDlMqOvJ4hQy5Nx4XFieovapXeLmpv4UHMPJP5923NYFV8VEfLnrprGQ\nCttqkxZbL69Q0MEhAsZWRH3ImLSxQfPbavwmE1UzDdvgbD9spZRj9TEjRSpO\nvupCjFenOqSZ4yH5Tqr+OzKt9hERKvHD3KSEHNe8tnBB0jgPWhKQnKpdKhSJ\nwTnNJxEeF+606izFysghZamU1M/l3+eJiiIDVqdJwcC9LJk+RbEmbaRBh8sC\n70Inw0Kn2MGuRvdc11hfH2b3Mchr5sdCjRRCAVBmoJUJgh+yDyfi+rCF15+p\ngl23GmVNBdZo2HEsBtmIYL36K85PSZl8D5fEueAiejQySIBpqQBaESx6yk+0\njhYP3slVKs1iylApgu7nohI932b0by0c1pPU3A9hCYW26cotgvZ2RWYbNKvW\ndHsG\r\n=XBTa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFH1diqJoG9ASyXb8U84rEJgH0Q9ngcOLATg87aYRsjMAiAi0fmyD22n1iKUXOq+O+nhBmHsMXm9pYWr1rZGEf3qKw=="}]},"maintainers":[{"name":"jlyonsmith","email":"jlyonsmith@gmail.com"}],"_npmUser":{"name":"jlyonsmith","email":"jlyonsmith@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/surya-gql-demo_1.0.8_1573003804417_0.09231145553046716"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-06T01:30:04.171Z","1.0.8":"2019-11-06T01:30:04.683Z","modified":"2022-04-04T20:46:34.938Z"},"maintainers":[{"email":"brian.manderino@gmail.com","name":"bmanderino"},{"email":"breanna@glyphstone.net","name":"glyphstone"},{"email":"bengoldsteinmusic@gmail.com","name":"dellpaxton"},{"email":"jlyonsmith@gmail.com","name":"jlyonsmith"}],"description":"A demonstration project for surya-gql","homepage":"https://bitbucket.org/breannaa-bpt/surya-gql-demo#readme","keywords":["surya-gql"],"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/brownpapertickets/surya-gql-demo.git"},"author":{"name":"Breanna Anderson","url":"glyphstone"},"license":"MIT","readme":"# Surya GQL Demo\n\nA demonstration project that shows how to combine the surya-gql modules to create a powerful, flexible and scalable GraphQL service with back-end data support.\n\nThe service implemented in src/index.js is very rudumentary but shows how the various components interact. It does not include proper configuration management or logging or a functioning auth system but stubs are in place for each of these.\nThe Surya is an overlay on top of Apollo Graphql and utilizes it's front end logic.\n\nThe guts of the unique service api definition, data definition and business logic resides fully in the /types modules which follow a specific structure:\n\nData Type Definitions - in one or more .js files write one or more classes that define the data to be input, output and potentially stored in a data store\n  or forwarded on to another service.  These \"universal\" Type classes are not GraphQL or Database-specific but\n  are an intermediate and generalized system that allows you to define data once and have it accessible\n  and applied everywhere at the front, back, and middle ends.  There is no need to hand-maintain\n  cumbersome data conversion functions or data redaction logic for field-level security.\n  It's all defined in the model metadata.\nGraphQL Query, Mutation and Subscription definitions for those data structures.\nResolvers that are invoked when those queries, mutations or subscriptions are invoked by a client\nManagers - Business and procedural logic that does the heavy lifting for the Resolvers. Managers are build from powerful base classes that dramatically reduce the amount of code for common CRUD and business sceanrios but are fully extensible.\nAPIs - Back-end O/R-like logic for MongoDB, PostgreSQL and any other data store you want to add. The provided APIs use the universal Data Definitions.  The handshake between the standard Manager classes and the APIs provide tremendous power and\n  great consistency across data back ends including a standardized argument set for queries including a cross-platform filter and sort syntax with proper parsing rules and per-backend transformations.\n\nEach type module is contained in a subdirectory under /types.  The main server logic instantiates a TypesManager() and then calls\n```\nawait typesManager.loadTypeModules(__dirname + \"/types\")\n```\n\n## Type Manifest\nThis scans each directory that contains a \"manifiest.js\" file.\nThe manifest which looks something like this:\n```\nexport const Manifest = {\n  sysVersion: \"1.0.0\",\n  typeVersion: \"0.1.0\",\n  description: \"MongoDB Based Users storage\",\n  types: [\"User\", \"Address\", \"AuthToken\"],\n  queries: \"UserQueries\",\n  resolvers: \"UserResolvers\",\n  manager: \"UserManager\",\n  data: {\n    interface: \"MongoDB\",\n    api: \"UserAPI\",\n    config: { collection: \"demo-user\" },\n  },\n}\n```\n\nProvides information to the loader to help it understand the role of each the files in the module. A naming convention is also available so that a placeholder manifest can be used for routine structured modules.\n\n### Types: A list of the names of classes that are derived from BaseType and may be refrenced by queries or mutations.\nNote: for each defined type name. For example \"User\", the BaseType class will generate a set of related data structures automatically for registration with the GraphQL system:\n<CLASS>\t\t : The class as defined\n<CLASS>Input : For use as input structures for example for create and update calls. This structure will not include fields flagged as input: false or symbolic: true\n<CLASS>SetResponse:  A response from a call that returns a list of <CLASS> objects as:\n\tsuccess: boolean\t: true if the query succeeded\n\toffset: integer\t\t: the passed offset\n\ttotal: integer\t\t: Total number of objects returned by query before pagination.\n\titems: [ <CLASS> ]   : Array of <CLASS> objects\n\n<CLASS>MutationResponse: Returned by mutation operations create, update, delete, etc.\nsuccess: boolean\nmessage: string\ndata: <CLASS>\n\nDetails on writing Type classes are detailed <here>\n\n### Queries: A straight-forward representation of the graphql specification for the queries, mutations and subscriptions for these types\n\n### Resolvers:  A resolver is a map of simple functions that are called when a query, mutation or subscription is called by the client.\nThe function is passed arguments, possibly the relevant data object and a *context* object which you define when you intantiate the ApolloGraphQL server.  By convention for Surya, it contains a logger, the map of Managers for all of the Type modules keyed by the TypeName and the Authorization token or credentials\nThe \"Surya Way\" is to minimize code in the resolvers and look up the appropriate manager and call it's corresponding method passing through the arguments, context and options.  Some minor logic may be involved for individual field resolvers.\nNote:  The demo should add some resolver examples for single and multiple lookups and for symbolics.\n\n### Managers: Standardized classes that do the business logic heavy lifting for Type Modules.\nManagers are built from BaseClasses that provide basic functionality like authorization and authentication and possibly standardized CRUD logic.\nMethods can be added to managers where needed or standard methods can be sub-classed for replacement or for pre and/or post operations to the standard logic.\nFor most straight-forward cases where CRUD+ logic is called for, only a placeholder is needed as all of the basic functionality is built in.\n\n### Data APIs\nIf your Type Module is a standard CRUD data interface you can define your API in the data: section.\ninterface: defines what kind of database or data store you are using.\napi: is the class you defined, which is typically subclassed from a standard API base class\nconfig: is an API-specific configuration data object.  See the BaseAPI in each case.\n","readmeFilename":"README.md"}