{"bugs":{"url":"https://github.com/jupyterlab/jupyterlab/issues"},"dist":{"shasum":"0fe3d85b34d85a0b748d5153250e3c1ebf593021","tarball":"https://registry.npmjs.org/@s524797336/jupyter-service/-/jupyter-service-2.0.2-alpha.tgz","fileCount":56,"integrity":"sha512-ajkFn+MCUtXKHY67SUwL45eDkF1gNVyg5XMFaQ7sscaygHPGGya0tD6XAen4ANksie+wIXpjOq/e2BxS9VxwvQ==","signatures":[{"sig":"MEYCIQCAZc7J7t2kweYcfQndYGj1HC9Wh5MMmkJp6OGJVeu8/gIhAJVzLe8BunKpYDy6VEqCZw+RGzCXg0bLO+vFtzpMQZyC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":373696,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbI1uqCRA9TVsSAnZWagAAdCcP/08uuUHJMKuP57V+XOR8\nrf/tRpOKUekCS2s2rDkp5dlLuG71c8ky3y2wJd0QVPFbT/Iyhq4wRFbzcleU\nJaSaNvWJa3Pi8eh5f0wBJdHOCeXGa0PHJe/Ei9MAlE4cHNOmzcJKg5PxdyGF\nyk+cPHqwDubQKP4FuJidSmMPrZqMWGA0ShS7ImgIp2unOoc+Y10PzefM3XVC\nq1A6Uu1DL6bsH8dUXHIEGX95JzAlzeQsEXVI1YYE2n01aPjlToMZon7625EA\nMYGxakjrg/pZVS2V8nsIrQuiQiREx3UcqhjZvB0B1nvw/VpE+zV75ENVVsPh\nE8glhyy3nj1Lh4B3SeJVaiCmlG+vtzFYuIC+JouhvBkZG1rIy+9OfHiyqbDI\nNhhXYT9CbmgJp2C6tve/eUFC1DXCs3cpdNAFK2WW/nsFK8ahoRvqcDW57gI9\nEAjOSohQb3lWw0zFsZnDpo/a6eNPvCI6UYSBTPDcqqSXjrVJg/pZbJk5xBv3\nYOM4sGabHNpsEVpc6Te8HSWd97pfIolzYEwEbNTRFw6szwdA74VtAzX+hRXi\naCl+njQfNiRa5uYTJEXsA2jiWnWPDDjRYq6xzlP+/a/0pILkuj1Eu3NsO0Jm\n4SRCqdoKKDs4GMuaWBdzdGnUj4DKDlkDhtqcGY3Bm4S7osKwd/Zxc5qo/fH8\nZEue\r\n=c7YZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","name":"@s524797336/jupyter-service","files":["lib/**/*.js","lib/*.js.map","lib/**/*.d.ts","lib/**/*.js.map","lib/*.js","lib/*.d.ts","dist/*.js","dist/**/*.js"],"author":{"name":"Project Jupyter"},"readme":"JupyterLab Services\n===================\n\nJavascript client for the Jupyter services REST APIs\n\n[API Docs](http://jupyterlab.github.io/jupyterlab/)\n\n[REST API Docs](http://petstore.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/master/notebook/services/api/api.yaml)\n\nNote: All functions and classes using the REST API allow a `serverSettings` \nparameter to configure requests.\nRequests are made using the `fetch` API, which is available in modern browsers\nor via `npm install fetch` for node users.  The `whatwg-fetch` npm package\ncan be used to polyfill browsers that do not support the `fetch` API.\n\n\nPackage Install\n---------------\n\n**Prerequisites**\n- [node](http://nodejs.org/)\n- [python](https://www.anaconda.com/download)\n\n```bash\nnpm install --save @jupyterlab/services\nconda install notebook  # notebook 4.3+ required\n```\n\n\nSource Build\n------------\n\n**Prerequisites**\n- [git](http://git-scm.com/)\n- [node 0.12+](http://nodejs.org/)\n- [python](https://www.anaconda.com/download)\n\n```bash\ngit clone https://github.com/jupyterlab/jupyterlab.git\ncd packages/services\nnpm install\nnpm run build\nconda install notebook  # notebook 4.3+ required\n```\n\n**Rebuild**\n```bash\nnpm run clean\nnpm run build\n```\n\n\nRun Tests\n---------\n\nFollow the source build instructions first.\n\n```bash\nnpm test\n```\n\n\nBuild Docs\n----------\n\nFollow the source build instructions first.\n\n```bash\nnpm run docs\n```\n\nNavigate to `docs/index.html`.\n\n\nSupported Runtimes\n------------------\n\nThe runtime versions which are currently *known to work* are listed below.\nEarlier versions may also work, but come with no guarantees.\n\n- Node 0.12.7+\n- IE 11+\n- Firefox 32+\n- Chrome 38+\n\nNote: \"requirejs\" may need be included in a global context for `Comm` targets\nusing the a `target_module` (in the classic Notebook).\nThis can be as a `<script>` tag in the browser or by using the `requirejs`\npackage in node (`npm install requirejs` and setting \n`global.requirejs = require('requirejs');`).\n\n\nStarting the Notebook Server\n----------------------------\n\nFollow the package install instructions first.\n\nThe library requires a running Jupyter Notebook server, launched as:\n\n```bash\njupyter notebook\n```\n\n\nBundling for the Browser\n------------------------\n\nFollow the package install instructions first.\n\nSee `examples/browser` for an example of using Webpack to bundle the library.\n\nNote: Some browsers (such as IE11), require a polyfill for Promises.\nThe example demonstrates the use of the polyfill.  See also notes about\nthe `fetch` API polyfill above.\n\n\nUsage from Node.js\n------------------\n\nFollow the package install instructions first.\n\nSee `examples/node` for an example of using an ES5 node script.\n\n\nUsage Examples\n--------------\n\n**Note:** This module is fully compatible with Node/Babel/ES6/ES5. The\nexamples below are written in TypeScript using ES6 syntax.  Simply\nomit the type declarations when using a language other than TypeScript.\nA translator such as Babel can be used to convert from ES6 -> ES5.\n\n**Kernel**\n\n```typescript\nimport {\n  KernelMessage, Kernel\n} from '@jupyterlab/services';\n\n\n// Get a list of available kernels and connect to one.\nKernel.listRunning().then(kernelModels => {\n  Kernel.connectTo(kernelModels[0]).then((kernel) => {\n    console.log(kernel.name);\n  });\n});\n\n\n// Get info about the available kernels and start a new one.\nKernel.getSpecs().then(kernelSpecs => {\n  console.log('Default spec:', kernelSpecs.default);\n  console.log('Available specs', Object.keys(kernelSpecs.kernelspecs));\n  // use the default name\n  let options: Kernel.IOptions = {\n    name: kernelSpecs.default\n  };\n  Kernel.startNew(options).then(kernel => {\n    // Execute and handle replies.\n    let future = kernel.requestExecute({ code: 'a = 1' } );\n    future.done.then(() => {\n      console.log('Future is fulfilled');\n    });\n    future.onIOPub = (msg) => {\n      console.log(msg.content);  // Print rich output data.\n    };\n\n    // Restart the kernel and then send an inspect message.\n    kernel.restart().then(() => {\n      let request: KernelMessage.IInspectRequest = {\n        code: 'hello', cursor_pos: 4, detail_level: 0\n      };\n      kernel.requestInspect(request).then(reply => {\n        console.log(reply.content.data);\n      });\n    });\n\n    // Interrupt the kernel and then send a complete message.\n    kernel.interrupt().then(() => {\n      kernel.requestComplete({ code: 'impor', cursor_pos: 4 } ).then((reply) => {\n        console.log(reply.content.matches);\n      });\n    });\n\n    // Register a callback for when the kernel changes state.\n    kernel.statusChanged.connect((status) => {\n      console.log('status', status);\n    });\n\n    // Kill the kernel.\n    kernel.shutdown().then(() => {\n      console.log('Kernel shut down');\n    });\n  });\n});\n\n```\n\n**Session**\n\n```typescript\nimport {\n  Session\n} from '@jupyterlab/services';\n\n\n// Get a list of available sessions and connect to one.\nSession.listRunning().then(sessionModels => {\n  Session.connectTo(sessionModels[0]).then((session) => {\n    console.log(session.kernel.name);\n  });\n});\n\n// Start a new session.\nlet options = {\n  kernelName: 'python',\n  path: '/tmp/foo.ipynb'\n};\n\nSession.startNew(options).then(session => {\n  // Execute and handle replies on the kernel.\n  let future = session.kernel.requestExecute({ code: 'a = 1' });\n  future.done.then(() => {\n    console.log('Future is fulfilled');\n  });\n\n  // Rename the session.\n  session.setPath('/local/bar.ipynb').then(() => {\n    console.log('Session renamed to', session.path);\n  });\n\n  // Register a callback for when the session dies.\n  session.terminated.connect(() => {\n    console.log('session died');\n  });\n\n  // Kill the session.\n  session.shutdown().then(() => {\n    console.log('session closed');\n  });\n\n});\n\n```\n\n**Comm**\n\n```typescript\n\nimport {\n  Kernel\n} from '@jupyterlab/services';\n\n// Create a comm from the server side.\n//\n// Get info about the available kernels and connect to one.\nKernel.getSpecs().then(kernelSpecs => {\n  return Kernel.startNew({\n    name: kernelSpecs.default,\n  });\n}).then(kernel => {\n  let comm = kernel.connectToComm('test').then(comm => {\n    comm.open('initial state');\n    comm.send('test');\n    comm.close('bye');\n  });\n});\n\n// Create a comm from the client side.\nKernel.getSpecs().then(kernelSpecs => {\n  return Kernel.startNew({\n    name: kernelSpecs.default,\n  });\n}).then(kernel => {\n  kernel.registerCommTarget('test2', (comm, commMsg) => {\n    if (commMsg.content.target_name !== 'test2') {\n       return;\n    }\n    comm.onMsg = (msg) => {\n      console.log(msg);  // 'hello'\n    };\n    comm.onClose = (msg) => {\n      console.log(msg);  // 'bye'\n    };\n  });\n\n  let code = [\n    'from ipykernel.comm import Comm',\n    'comm = Comm(target_name=\"test2\")',\n    'comm.send(data=\"hello\")',\n    'comm.close(data=\"bye\")'\n  ].join('\\n');\n  kernel.requestExecute({ code: code });\n});\n```\n\n**Contents**\n\n```typescript\nimport {\n  ContentsManager\n} from '@jupyterlab/services';\n\nlet contents = new ContentsManager();\n\n// Create a new python file.\ncontents.newUntitled({ path: '/foo', type: 'file', ext: 'py' }).then(\n  (model) => {\n    console.log('new file:', model.path);\n  }\n);\n\n// Get the contents of a directory.\ncontents.get('/foo/bar').then(\n  (model) => {\n    console.log('files:', model.content);\n  }\n);\n\n// Rename a file.\ncontents.rename('/foo/bar.txt', '/foo/baz.txt');\n\n// Save a file.\ncontents.save('/foo/test.ipynb');\n\n// Delete a file.\ncontents.delete('/foo/bar.txt');\n\n// Copy a file.\ncontents.copy('/foo/bar.txt', '/baz').then((model) => {\n    console.log('new path', model.path);\n});\n\n// Create a checkpoint.\ncontents.createCheckpoint('/foo/bar.ipynb').then((model) => {\n  let checkpoint = model;\n\n  // Restore a checkpoint.\n  contents.restoreCheckpoint('/foo/bar.ipynb', checkpoint.id);\n\n  // Delete a checkpoint.\n  contents.deleteCheckpoint('/foo/bar.ipynb', checkpoint.id);\n});\n\n// List checkpoints for a file.\ncontents.listCheckpoints('/foo/bar.txt').then((models) => {\n    console.log(models[0].id);\n});\n```\n\n**Configuration**\n\n```typescript\nimport {\n  ConfigWithDefaults, ConfigSection\n} from '@jupyterlab/services';\n\n// The base url of the Jupyter server.\n\nConfigSection.create({ name: 'notebook' }).then(section => {\n  let config = new ConfigWithDefaults({\n    section,\n    defaults: { default_cell_type: 'code' },\n    className: 'Notebook'\n  });\n  console.log(config.get('default_cell_type'));   // 'code'\n  config.set('foo', 'bar').then(data => {\n     console.log(data); // \"{ 'foo': 'bar' }\"\n  });\n});\n```\n\n**Terminals**\n\n```typescript\nimport {\n  TerminalSession\n} from '@jupyterlab/services';\n\n\n// Create a named terminal session and send some data.\nTerminalSession.startNew().then(session => {\n  session.send({ type: 'stdin', content: ['foo'] });\n});\n```\n","license":"BSD-3-Clause","scripts":{"test":"python test/run-test.py","build":"npm run build:src","clean":"rimraf docs && rimraf lib && rimraf test/build && rimraf test/coverage","watch":"tsc -w --listEmittedFiles","build:src":"tsc ","watch:all":"npm-run-all -p watch watch:test","build:test":"tsc --project test","test:debug":"python test/run_test.py --debug","watch:test":"tsc -w --listEmittedFiles --project test","test:devtool":"python test/run_test.py --TestApp.devtool==True","test:coverage":"python test/run_test.py --TestApp.coverage==True","prepublishOnly":"npm run build:src"},"typings":"lib/index.d.ts","_npmUser":{"name":"s524797336","email":"491522457@qq.com"},"homepage":"https://github.com/jupyterlab/jupyterlab","keywords":["jupyter","notebook","services"],"repository":{"url":"git+https://github.com/jupyterlab/jupyterlab.git","type":"git"},"_npmVersion":"6.1.0","description":"Client APIs for the Jupyter services REST APIs","directories":{},"maintainers":[{"name":"s524797336","email":"491522457@qq.com"}],"_nodeVersion":"10.2.1","dependencies":{"ws":"~5.2.0","node-fetch":"~2.1.2","@phosphor/algorithm":"^1.1.2","@phosphor/coreutils":"^1.3.0","@phosphor/signaling":"^1.2.2","@phosphor/disposable":"^1.1.2","@jupyterlab/coreutils":"^1.1.3","@jupyterlab/observables":"^1.0.10"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"mocha":"^5.2.0","rimraf":"~2.6.2","webpack":"~4.12.0","istanbul":"^0.4.5","@types/ws":"~5.1.2","expect.js":"~0.3.1","typescript":"~2.9.2","npm-run-all":"~4.1.3","webpack-cli":"^3.0.6","@types/mocha":"~5.2.2","text-encoding":"~0.6.4","@types/expect.js":"~0.3.29","@types/node-fetch":"~2.1.1"},"_npmOperationalInternal":{"tmp":"tmp/jupyter-service_2.0.2-alpha_1529043881746_0.3952585618247433","host":"s3://npm-registry-packages"},"_id":"@s524797336/jupyter-service@2.0.2-alpha","version":"2.0.2-alpha"}