Giter Club home page Giter Club logo

abstract-sdk's Introduction

The Abstract SDK provides universal JavaScript bindings for both the Abstract API and the Abstract CLI.

build status npm version

Installation

The SDK is available as a Node.js module available via the public NPM registry. An underlying Node.js version of 10.0.0 or higher is required.

npm install abstract-sdk

Please see the installation guide for more information.

Documentation

Complete SDK documentation can be found at https://developer.abstract.com.

The following community resources are available to help you get started quickly with the SDK:

Contributing

This project is maintained by a team at Abstract. Outside contributions are highly encouraged, but please ensure that a relevant issue exists and that an approach has been discussed before beginning to write code. This makes it more likely that your contribution will be accepted and ensures that your time is not wasted.

Please see the contributors guide for more information.

License

MIT

abstract-sdk's People

Contributors

amccloud avatar anthony-j-castro avatar artplan1 avatar bitpshr avatar cjarguello avatar dependabot[bot] avatar enriquenov avatar huw avatar keithbhunter avatar kvnsmth avatar lukefinch avatar mascardoso avatar nalanj avatar nivl avatar pselle avatar rickharris avatar serggl avatar speric avatar tommoor avatar tylermarshall avatar zpnk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abstract-sdk's Issues

Not found error on preview export

I created a loop to save images of all my artboards on all pages. For some images I get a not found error. I looked inside Sketch but I couldn't identify why some artboards work and some won't.

(node:43291) UnhandledPromiseRejectionWarning: NotFoundError: Not found. at throwAPIError (/Users/Jonathan.Arnold/Desktop/_spikeweek_test/node_modules/abstract-sdk/lib/errors.js:143:13) at AbstractAPI.fetch (/Users/Jonathan.Arnold/Desktop/_spikeweek_test/node_modules/abstract-sdk/lib/AbstractAPI/index.js:509:39) at processTicksAndRejections (internal/process/next_tick.js:81:5) (node:43291) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:43291) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@tommoor my team at Freeletics want to use that feature for a very quick project that has to be completed till friday. I would really appreciate if you can look into that and provide some insights.

Thank you :-)

previews: Add method to retrieve preview url

previews.raw is great if you want a copy of the file to save in your own datastore, but it's an awkward interface for displaying in the web browser.

Lets add an additional method to grab a data-uri for the image using the bufferToUrl helper we have internally. This issue was triggered by confusion from a customer attempting to use the webUrl method…

Add rate limit handling

I'd suggest the following but am of course open to other things:

  • First pass: Add a custom error that is thrown when the rate limit is hit
  • Second pass: Internally handle the rate limit and wait for the appropriate amount of time based on the response headers before continuing.

Generate API documentation

The static SDK site includes reference guide documentation and API documentation, both of which are hand-curated. Manually updating API documentation in this manner can be tedious over time and lead to a divergence in documentation and implementation. We should investigate what solutions exist to generate API documentation.

JSDoc is a viable option, but it doesn't infer types from Flow type annotations. This means we'd have to document types in two places: in the actual JS code for Flow, and also in comments for JSDoc. The TypeScript community created versions of JSDoc that infer types from TS type annotations (see typedoc, but no similar tools yet exist for Flow.

Unable to include [email protected]

When including [email protected] (failed to install a more recent version as per #101)

Seems like abstract has undeclared dependencies on core-js and regenerator-runtime packages. But even when manually installing these, the simplest-possible inclusion of the abstract sdk fails with a ReferenceError.

Abstract.app Version 77.0.1 (77.0.1.12639)
node v11.10.1
macOS 10.14.3 (18D109)

Steps to reproduyce:

index.js:

const Abstract = require("abstract-sdk");
> yarn add [email protected]
[…]
> node index.js
internal/modules/cjs/loader.js:615
    throw err;
    ^

Error: Cannot find module 'core-js/modules/es6.object.define-property'
[…]

> yarn add core-js
[…]
> node index.js

internal/modules/cjs/loader.js:615
    throw err;
    ^

Error: Cannot find module 'regenerator-runtime/runtime'
[…]

> yarn add regenerator-runtime
[…]
> node index.js
/Users/gerrit/spotify/abstracttest/node_modules/abstract-sdk/lib/AbstractCLI/index.js:576
      regeneratorRuntime.mark(function _callee14(args) {
      ^

ReferenceError: regeneratorRuntime is not defined
    at /Users/gerrit/spotify/abstracttest/node_modules/abstract-sdk/lib/AbstractCLI/index.js:576:7
    at /Users/gerrit/spotify/abstracttest/node_modules/abstract-sdk/lib/AbstractCLI/index.js:646:6
    at Object.<anonymous> (/Users/gerrit/spotify/abstracttest/node_modules/abstract-sdk/lib/AbstractCLI/index.js:698:2)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
    at Module.load (internal/modules/cjs/loader.js:630:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
    at Function.Module._load (internal/modules/cjs/loader.js:562:3)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)

Get data for multiple layers

We are currently investigating using the Abstract SDK to extract values from the design files for use by developers, and we have reached a bottleneck with the current approach. Each value we want to extract is in a separate layer object, which requires a separate API call via abstract.data.info. We have hit rate limiting issues with only a few dozen items. Is there any way to batch data requests for multiple layers into one request?

Add asynchronous iteration support

We should add asynchronous iteration support for paginated list methods using an external function that leverages the cursor-based pagination we have in place.

Access "role" via the user object

I'd love the ability to filter data by user role, i.e Admin vs Contributor vs Viewer. I can make some educated guess by analyzing each users Activity by type, but since we are already able to sort by these fields in app via the People tab, I figured I would inquire about the feasibility of getting this added to the API first. 😎

API: activities.list

Hey, I'm currently getting UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'list' of undefined on activities.list.

is this part of the API not implemented yet? or am I doing something wrong?

Java SDK

It would be cool to download a Java SDK of the Abstract SDK that can make these HTTPS calls to any Abstract information you're looking for. The CLI environment is nice to find layers and files locally, but i would like to accessing my Abstract information when my program is being executed on an AWS remote server.

For example, Amazon Web Services provide and CLI interface and a Java SDK library to access my AWS information.

Not sure if this is in the plan for the Abstract team, but I think this feature would be handy.

Change documentation deployment to not happen on master

We often have work sat on master that hasn't yet been published to NPM as we're working towards a release. As it stands right now documentation updates related to this work get auto-deployed with master.

We've discussed:

  • Deploying docs when a release is tagged. This one is great in that it requires no thinking but prevents us from updating docs outside of the release cycle.
  • Deploying docs by pushing to a branch. This requires manual deployment but we can do so at any time.

Currently swaying towards the branch approach.

Document web hook support

Many of the SDK use cases identified so far rely on the ability to take programmatic action in response to different events within the Abstract application.

Once web hook support lands (which is prioritized very highly), we should document using them with the SDK. It would be nice to both document usage and to show a tutorial that walks through a real-world web hook-powered SDK script, like one that extracts assets from new commits.

API: preview.info

Hey,

I'm trying to get the preview to work - to get an png of a layer.

I'm using preview.info

Getting https://previews.goabstract.com/projects/eda68300-e1d0-11e8-8133-0b70a3eae7f0/commits/51bf03f17a6234d6f703b86d2309fe5ae4a28034/files/D06C3330-664C-4F89-B8E6-AC27B93AF4DC/layers/4DF3A97D-3F66-48A1-9459-B42B3154391C

then when i try to access it I get {"error":"forbidden"}

maybe the documentation is unclear or I got something wrong.

Thanks in advance!

Add activity endpoints

  • activities.list (see project, org and more filters available in API controller)
  • activities.info

unmet `abstract-cli` dependency

Running yarn add abstract-sdk (as per https://sdk.goabstract.com/docs/installation/) fails with this error message: error Couldn't find package "@elasticprojects/abstract-cli@^1.0.0" required by "abstract-sdk@^1.0.0-beta.8" on the "npm" registry.

manually pinning to 0.7.4 downgrades this to a warning (`warning " > [email protected]" has unmet peer dependency "@elasticprojects/abstract-cli@^1.0.0".)

Seems like the public abstract-sdks packages are depending on a private NPM package?

Intermittent errors when using the SDK

I intermitently get InternalServerErrors when requesting layer data using the SDK. Retrying the same request will, most of the time, return correct data.

I realise this is an issue with the infrastructure behind it rather than the SDK itself, but the SDK is the entry point and I wasn't sure where else to raise this as an issue.

Implement a request cache

We should cache requests where possible to improve perceived performance and to reduce load on our servers.

layers.list: Add ability to filter by layer type

Ideally implemented at the server level. This request came directly from a customer using the SDK, that it would be helpful to limit the data returned to, for example just symbols, or just artboards.

Add files.raw CLI and API endpoints

We should add a new endpoint to both the CLI transport and the API transport to support retrieving the raw data for a single file. This will involve a new API and CLI command to support each respective operation.

Add users endpoints to API transport

We're currently missing endpoints for users.list and users.info – as we don't send this information back with branch data (#45) it's important that it can be loaded separately.

Add file export to CLI transport

Hi Everyone,

Sadly the issue under #73 was closed without any notice or updates in the meantime. We are still waiting for some way to extract the raw sketch files from Abstract via the API. Is there any roadmap/plan to allow this in the future? Is there any way I could support in getting this feature done?

Enable CORS for API endpoints

While the SDK will work in both a browser and a node context from a JavaScript perspective, the backing API that the SDK uses by default at https://api.goabstract.com still has CORS enabled and can't be accessed by external domains at this time.

We should enable CORS for SDK-supported endpoints and document any necessary configuration.

Add shares.create API endpoint

We should add a new endpoint to the API transport to support the creation of share links. The required API route for this already exists, so it should just be a matter of adding this call to the SDK.

Javascript error, module not found

I want to start using the Abastract API but after using it in my project I get the following error:

Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '/Users/developer/review-tracker-2019/node_modules/abstract-sdk/lib'

I googled the issue and solutions like installing core-js doesn't seem to work. Any idea on how tho fix this? Using the latest Abstract verison 1.0.0-beta.11.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.