npm.io
3.0.0 • Published 2d ago

@carto/ps-services

Licence
MIT
Version
3.0.0
Deps
1
Size
470 kB
Vulns
0
Weekly
0

The CARTO PS Services Library

Introduction

This package includes api functions for JavaScript and TypeScript.

The following APIs are available:

To_develop

Consumption tracking — the client label

Every CARTO-calling runner requires a client built with resolveTrackingClient({ project, env, status?, event? }). The label is a positional _-delimited string, and its segments follow a fixed parsing contract:

<project>_<env>_<test|live>_<event>
  • project and env are sanitized to canonical kebab-case slugs ([a-z0-9-]).
  • status is the literal test or live.
  • event is sanitized to [a-zA-Z0-9-] preserving letter case (since 2.9.0): consumers may structure it as dash-separated sub-fields, encoding word boundaries inside each field with case (e.g. PascalCase: MyOrg-Main-AssetsPerformance) — and parse it back by splitting on -. The casing convention is the consuming project's to define; the library only guarantees case survives.
  • _ never survives inside a segment (it collapses to -), so client.split('_') always yields exactly the 4 fields above.
  • CARTO enforces charset [a-zA-Z0-9_-] and max 100 chars (labels outside that are coerced to other); resolveTrackingClient warns — but does not truncate — so consumers trimming the event to fit should treat its last sub-field as best-effort when parsing.

See the tracking docs for the full model and examples.

Contributing

Please read our contributing guide before creating a pull request.

Keywords