Git Product home page Git Product logo

umbraco.headless.client.nodejs's People

Contributors

askilada avatar dependabot[bot] avatar fjellvang avatar rasmusjp avatar sitereactor avatar

Stargazers

 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

umbraco.headless.client.nodejs's Issues

Do the client library work with angular?

Hi, I’m trying to use the client library for the current latest angular v8.2.14 with no prevail. Is it supposed to work with angular?

I tried the koa sample app and there it works fine with calling my demo headless account, for an example with this method "client.management.content.root()".

Angular Project: Very basic project from angular setup guide with only 1 route configured for the home page.

The problem which occurs:

GET https://cdn.umbraco.io/content 400
core.js:4002 ERROR Error: Uncaught (in promise): APIRequestError
APIRequestError
at new APIRequestError (APIRequestError.js:19)
at ApiRequest. (ApiRequest.js:122)
at step (ApiRequest.js:33)
at Object.throw (ApiRequest.js:14)
at rejected (ApiRequest.js:6)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
at Object.onInvoke (core.js:26256)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
at zone.js:910
at resolvePromise (zone.js:852)
at resolvePromise (zone.js:809)
at zone.js:913
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:26247)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
at invokeTask (zone.js:1693)

Missing documentation on NodeJS Client?

Hey there,

I've been using the NodeJS client to manage content in my Heartcore Umbraco and I've been struggling with some of the methods; in particular, the create() method (either from client.management.media or client.management.content).

When a FormData is used in create() (because we are uploading a file with the request) there is only way of doing the request (as far as I've tested it), which is using FileSystem.createReadStream(). That means that you must have the file you are uploading in the file system.

I was, however, trying to get the file from an url and send it with the request. The media or content node was created, but whenever I opened the node I would get the following error

error

which was related to this exception

exception

I've tried appending the file in many different ways, to see if I could get it to work, but the only solution I got was to download the file locally and then using the FileSystem to attach it.

The important thing: in this process, I've felt that some documentation was missing on how we "communicate" with Umbraco Heartcore using the client. The several ways (if there are more than one) of uploading a file; the proper way to relate existing media/content nodes, etc.

I am available to improve this issue as I know this can be a little confusing xD

Thanks,
Pedro

Is this safe to use?

It seems this is rarely updated, and the 43 Pull Requests from dependabot that have not been merged kinda puts me off using this. Can this safely be used, or is there a better alternative?

Support for TypeScript (typings)

I can't seem to find TypeScript typings for the Node client. Are there any available?

I was hoping for a @types/@umbraco/headless-client package, but alas - no dice. :)

Lack of Documentation

No offense but guys you don't have any documentation. List of method signatures on the README file are nearly pointless without actual examples or at least method definitions.

TypeError: Cannot read property 'data' of undefined

When using client.management.media.create I get the following error:
TypeError: Cannot read property 'data' of undefined at ApiRequest.<anonymous> (/home/lukas/dev/umbraco_migrate/node_modules/@umbraco/headless-client/dist/ApiRequest.js:124:118) at step (/home/lukas/dev/umbraco_migrate/node_modules/@umbraco/headless-client/dist/ApiRequest.js:33:23) at Object.throw (/home/lukas/dev/umbraco_migrate/node_modules/@umbraco/headless-client/dist/ApiRequest.js:14:53) at rejected (/home/lukas/dev/umbraco_migrate/node_modules/@umbraco/headless-client/dist/ApiRequest.js:6:65)

It seems that it comes from this snippet in ApiRequest.ts file, line 84
image

I tried to investigate what data is supposed to be. It always declared as any.

Due to lack of docs, it is unclear what is expected to be passed into the function. But inspired by this https://our.umbraco.com/documentation/Umbraco-Heartcore/API-Documentation/Content-Management/media/#create-media

image

I currently create new FormData and try to append content data with a picture. I provide to the function.

EDIT: change to describe the real problem. The original was cause by me by misreading the original error.

Possible error with pageSize and page options, when using client.delivery.content.children

Hi Umbraco,

I stumbled upon a possible error when using options with client.delivery.content.children.
It seems to ignore pageSize and page options.

const children = await client.delivery.content.children(pageId, { pageSize: "20", page: "1" });

In the above example pageSize is specified to 20 and should return 15 as there is a total for 15 children. However it only returns 10, even after setting it up in the options.

Video of the error : https://drive.google.com/file/d/1us2l65apApGPj3EFGYQeApGvz2EzoR99/view

Is this an error or am i doing something wrong ?

Support for varying URL configuration

Issue description

Hi Devs!

For a new Umbraco Heartcore project we are interested in using this client library to get our development process up-to-speed in no time. Within the entire software architecture & landscape of this project, we make use of Azure API Management to control any & all API's connected to all applications (including the frontend of our new application).
Sadly the various urls used by the Umbraco api (cdn., api. & preview. urls) are hardcoded into this library right now.
Would it be possible to have these URLs be configurable, just like projectAlias, apiKey etc. are configurable in the client?

Kind regards,
Corné Hoskam
iO Digital

Axios dependancy IE11 issue

Hi,

Having an issue in ie11

'URLSearchParams' is undefined in IE 11

i believe it's to do with the Axios dependancy.

Do you have any workarounds?

@umbraco/headless-client requires allowSyntheticDefaultImports to be true

Issue description

Would it be possible to change so that allowSyntheticDefaultImports dont need to be set to true in the tsconfig.json?

Default tsconfig on a angular project:
image

Error message:

Error: node_modules/@umbraco/headless-client/Clients/Management/ContentManagementClient.d.ts:1:8 - error TS1259: Module '"C:/Test/heartcore/node_modules/@umbraco/headless-client/node_modules/form-data/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import FormData from 'form-data';
         ~~~~~~~~

  node_modules/@umbraco/headless-client/node_modules/form-data/index.d.ts:10:1
    10 export = FormData;
       ~~~~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.


Error: node_modules/@umbraco/headless-client/Clients/Management/MediaManagementClient.d.ts:1:8 - error TS1259: Module '"C:/Test/heartcore/node_modules/@umbraco/headless-client/node_modules/form-data/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import FormData from 'form-data';
         ~~~~~~~~

  node_modules/@umbraco/headless-client/node_modules/form-data/index.d.ts:10:1
    10 export = FormData;
       ~~~~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.


Error: node_modules/@umbraco/headless-client/Clients/Management/MemberManagementClient.d.ts:1:8 - error TS1259: Module '"C:/Test/heartcore/node_modules/@umbraco/headless-client/node_modules/form-data/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag

1 import FormData from 'form-data';
         ~~~~~~~~

  node_modules/@umbraco/headless-client/node_modules/form-data/index.d.ts:10:1
    10 export = FormData;
       ~~~~~~~~~~~~~~~~~~
    This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

Descendants call should be a PagedResponse in 0.8.0

Version
0.8.0

Description
The Client.delivery.content.descendants() function seems to have the wrong typing in its return type. Typescript infers that it returns the type Promise<Content[] | undefined> but when invoking the function and debugging its actual output, you seem to get a PagedResponse instead. The return type should then have been inferred as Promise<PagedResponse<Content> | undefined> resembling that of the children function.

Reference

* @returns a `Promise` that resolves to an array of {@link Content} if found, otherwise `undefined`.
*/
async descendants (id: string, options?: ContentDeliveryDescendantsOptions) {

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.