Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@croudtech/crn-url-remapper

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@croudtech/crn-url-remapper

Module to remap between CRNs to URLs

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

CC-Node-Utils-CRN

Installation

Install the scoped package via the command line

via Yarn

yarn add @croudtech/cc-v3-base

via NPM

npm install @croudtech/cc-v3-base

Methods

These methods depend on valid SYSTEM_ID, INTERNAL_ROUTING_FORMAT and SERVICE_MAP variables being available in the environment.

publicUrlFromCrn

Builds a public url from a CRN string

Usage: publicUrlFromCrn(crnString)

CRN

croud-system-id:workflow-service:tasks:0c6b08f8-ed05-47ea-93a4-0f171fa9effb

URL

https://workflow-service.croudcontrol.com/tasks/0c6b08f8-ed05-47ea-93a4-0f171fa9effb

internalUrlFromCrn

Builds an internal kubernetes url from a CRN string (the path structure is definable in INTERNAL_ROUTING_FORMAT).

Usage: internalUrlFromCrn(crnString)

croud-system-id:workflow-service:tasks:0c6b08f8-ed05-47ea-93a4-0f171fa9effb

URL

http://workflow-service-django.v3-staging.svc.cluster.local/tasks/0c6b08f8-ed05-47ea-93a4-0f171fa9effb

createCrn

Creates a CRN using the SYSTEM_ID defined in the env and the following object structure.

Usage: createCrn(entityObject)

Object

[
    {
        entity: "files",
        id: 12345
    }
]

this will output a CRN ID:

croud-system-id:workflow-service:files:12345

multiple objects can be provided to specify nesting:

[
    {
        entity: "tasks",
        id: "0c6b08f8-ed05-47ea-93a4-0f171fa9effb"
    },
    {
        entity: "files",
        id: 12345
    }
]

croud-system-id:workflow-service:tasks:0c6b08f8-ed05-47ea-93a4-0f171fa9effb:files:12345

this of course, can in turn be converted to URLs using the methods described earlier.

appendEntity

This will add a systemId, entityId and public link to an entity. This method can take three arguments

  1. The entity itself. This must have an id property
  2. A string to describe the entity type. A future development will allow the entity to be a sequalize model and identify the model type automatically.
  3. An optional array of parent entity values. This is to allow for nesting entities in the CRN/link

Usage: appendEntity(entity, entityType, parentEntities)

FAQs

Package last updated on 11 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc