Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SequenceStore operations to ManagerClient #727

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

patuwwy
Copy link
Contributor

@patuwwy patuwwy commented Nov 2, 2022

Signed-off-by: patuwwy patuwwy@gmail.com

What?
Add SequenceStore operation to ManagerClient.

Usage:

const managerClient = getManagerClientSomehow();

const getStoredSequences = async () => (await managerClient.getStoreItems()).map(s => ({ id: s.id, name: s.name }));

console.log("Stored sequences", await getStoredSequences());
// output: 
// Stored sequences [{
//     id: '89ffb33f-5879-40ab-8122-1a7261f3824d',
//     name: '@scramjet/hello'
// }]

const uploadedSequence = await managerClient.putStoreItem(createReadStream("../../forever.tar.gz"));

console.log("uploaded", uploadedSequence);
// output:
// uploaded {
//   etag: '48dxxxxxxxxx',
//   versionId: null,
//   engines: { node: '>=10' },
//   entrypointPath: 'index',
//   version: '0.22.0',
//   name: '@scramjet/js-forever',
//   id: 'abcb0935-6982-4e5e-be9c-2cbf8da972f5',
//   author: 'Scramjet <open-source@scramjet.org>',
//   repository: {
//     type: 'git',
//     url: 'https://github.com/scramjetorg/transform-hub.git'
//   },
//   language: 'js'
// }

console.log("Stored sequences", await getStoredSequences());
// output: 
// Stored sequences [{
//     id: '89ffb33f-5879-40ab-8122-1a7261f3824d',
//     name: '@scramjet/hello'
// },
// {
//     id: '193a3e84-37a2-45b4-bd36-867ab38b258b',
//     name: '@scramjet/js-forever'
// }]

console.log(await managerClient.deleteStoreItem(uploadedSequence.id));
// output: 
// undefined

console.log("Stored sequences", await getStoredSequences());
// output: 
// Stored sequences [{
//     id: '89ffb33f-5879-40ab-8122-1a7261f3824d',
//     name: '@scramjet/hello'
// }]

How it works:

Review checks:

These aspects need to be checked by the reviewer:

  • Verify and confirm operation (please post a screenshot)
  • All STH tests pass
  • All Scramjet Cloud Platform tests pass
  • Documentation is updated or no changes

@patuwwy patuwwy marked this pull request as ready for review November 2, 2022 13:12
@patuwwy patuwwy force-pushed the feature/seq-store-client branch 2 times, most recently from aa29059 to 5e3f103 Compare November 2, 2022 17:13
Signed-off-by: patuwwy <patuwwy@gmail.com>
@patuwwy patuwwy force-pushed the feature/seq-store-client branch from 5e3f103 to 47bcf96 Compare November 2, 2022 17:19
Copy link
Contributor

@alicja-gruzdz alicja-gruzdz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent 👍

@patuwwy patuwwy merged commit 62f27ae into devel Nov 2, 2022
@patuwwy patuwwy deleted the feature/seq-store-client branch November 2, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants