@granito/ngx-hal-client
Version:
A HAL client to be used in Angular projects
1 lines • 30.7 kB
Source Map (JSON)
{"version":3,"file":"granito-ngx-hal-client.mjs","sources":["../../../src/lib/hal-error.ts","../../../src/lib/hal-base.ts","../../../src/lib/resource.ts","../../../src/lib/collection.ts","../../../src/lib/utils.ts","../../../src/lib/rxjs.ts","../../../src/lib/accessor.ts","../../../src/public-api.ts","../../../src/granito-ngx-hal-client.ts"],"sourcesContent":["/**\n * This class represents errors thrown by _Angular HAL Client_. It\n * unifies errors produced by _Angular HTTP Client_ and errors originating\n * in the API.\n */\nexport class HalError extends Error {\n /**\n * The URI path where the error originated.\n */\n path?: string;\n\n /**\n * The HTTP status code of the error.\n */\n status?: number;\n\n /**\n * The description of the HTTP status.\n */\n error?: string;\n\n /**\n * Free form error properties.\n */\n [key: string]: any;\n\n /**\n * @param err the object used to set properties\n */\n constructor(err: any) {\n super();\n Object.assign(this, err);\n this.name = 'HalError';\n }\n}\n","import { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { Type } from '@angular/core';\nimport { Observable, catchError, map, throwError } from 'rxjs';\nimport { Accessor, HalError, objectFrom } from './internal';\n\nconst self = 'self';\n\ninterface Link {\n readonly href: string;\n\n readonly templated?: boolean;\n\n readonly methods?: string[];\n}\n\n/**\n * The common base for resource and accessor.\n */\nexport abstract class HalBase {\n protected readonly _client!: HttpClient;\n\n protected readonly _links: Readonly<Record<string, Link>> = {};\n\n protected readonly _embedded: Readonly<Record<string, Object>> = {};\n\n /**\n * The URI of `self` link.\n */\n get self(): string {\n return this._links[self]?.href;\n }\n\n /**\n * This property is `true` when the `self` link exists and either\n * `methods` array does not exist in the `self` link or the array\n * exists and contains `POST` string. It is `false` otherwise.\n */\n get canCreate(): boolean {\n return !!this.uriFor('POST');\n }\n\n /**\n * This property is `true` when the `self` link exists and either\n * `methods` array does not exist in the `self` link or the array\n * exists and contains `GET` string. It is `false` otherwise.\n */\n get canRead(): boolean {\n return !!this.uriFor('GET');\n }\n\n /**\n * This property is `true` when the `self` link exists and either\n * `methods` array does not exist in the `self` link or the array\n * exists and contains `DELETE` string. It is `false` otherwise.\n */\n get canDelete(): boolean {\n return !!this.uriFor('DELETE');\n }\n\n /**\n * @param obj the object used to assign the properties\n */\n constructor(obj: Object) {\n Object.assign(this, obj);\n }\n\n /**\n * Create a new resource in the collection identified by `self` link.\n * It makes a `POST` call to the URI in `self` link and returns an\n * observable for the call. The observable emits an accessor for\n * the newly created resource. The `self` link in the accessor\n * may be set to `undefined` if `Location` header is not returned by\n * the call.\n *\n * @param obj the payload for the `POST` method call\n * @returns an observable of the resource's accessor\n */\n create(obj: any): Observable<Accessor> {\n return this.withUriFor('POST',\n uri => this._client.post(uri, objectFrom(obj), {\n observe: 'response'\n }).pipe(\n map(response => response.headers.get('Location') || undefined),\n map(location => this.accessor(location)),\n catchError(this.handleError)\n ));\n }\n\n /**\n * Delete the resource identified by `self` link.\n *\n * @returns an observable that emits next signal on successful delete\n */\n delete(): Observable<void> {\n return this.withUriFor('DELETE',\n uri => this._client.delete(uri).pipe(\n map(() => undefined),\n catchError(this.handleError)\n ));\n }\n\n protected withUriFor<T>(method: string,\n func: (x: string) => Observable<T>): Observable<T> {\n const uri = this.uriFor(method);\n\n if (!uri)\n return throwError(() => new HalError({\n message: `no \"self\" relation supporting \"${method}\" method`\n }));\n\n return func(uri);\n }\n\n protected accessor(href?: string, methods?: string[]): Accessor {\n return this.instanceOf(Accessor, {\n _links: !href ? {} : {\n self: {\n href,\n methods\n }\n }\n });\n }\n\n protected instanceOf<T>(type: Type<T>, obj: Object): T {\n return new type({ ...obj, _client: this._client });\n }\n\n protected roInstanceOf<T>(type: Type<T>, obj: Object): T {\n return Object.freeze(this.instanceOf(type, obj));\n }\n\n protected handleError(err: HttpErrorResponse): Observable<never> {\n if (err.error instanceof Event)\n return throwError(() => new HalError({\n message: err.message,\n path: err.url\n }));\n\n return throwError(() => new HalError({\n message: err.message,\n status: err.status,\n error: err.statusText,\n path: err.url,\n ...err.error\n }));\n }\n\n protected uriFor(method: string): string | undefined {\n const selfRel = this._links[self];\n\n if (!selfRel || !selfRel.href)\n return undefined;\n\n const methods = selfRel.methods;\n\n if (!Array.isArray(methods))\n return selfRel.href;\n\n return methods.find(m => typeof m === 'string' &&\n m.toUpperCase() === method) && selfRel.href || undefined;\n }\n}\n","import { Type } from '@angular/core';\nimport { catchError, map, Observable } from 'rxjs';\nimport * as URI from 'uri-template';\nimport { Accessor, HalBase, objectFrom } from './internal';\n\n/**\n * This type represent parameters for templated links.\n */\nexport type Params = Record<string, string | number | boolean>;\n\n/**\n * This class represents an in-memory instance of a HAL resource.\n */\nexport class Resource extends HalBase {\n /**\n * This property is `true` when the `self` link exists and either\n * `methods` array does not exist in the `self` link or the array\n * exists and contains `PUT` string. It is `false` otherwise.\n */\n get canUpdate(): boolean {\n return !!this.uriFor('PUT');\n }\n\n /**\n * Follow the relation link. Returns an accessor for the resource.\n * The `self` link in the accessor is set to `undefined` if no such\n * relation exists.\n *\n * @param rel the name of the relation link\n * @param params parameters for a templated link\n * @returns an accessor for the linked resource\n */\n follow(rel: string, params: Params = {}): Accessor {\n const link = this._links[rel];\n\n if (!link)\n return this.accessor();\n\n const uri = link.href;\n\n return this.accessor(!link.templated ? uri :\n URI.parse(uri).expand(params), link.methods);\n }\n\n /**\n * Refresh the resource. In other words, read the resource\n * identified by `self` link.\n *\n * @returns an observable of the refreshed resource instance\n */\n read(): Observable<this> {\n const type = this.constructor as Type<this>;\n\n return this.withUriFor('GET', uri => this._client.get(uri).pipe(\n map(obj => this.roInstanceOf(type, obj)),\n catchError(this.handleError)\n ));\n }\n\n /**\n * Persist the resource. Uses `PUT` request to send the new resource\n * state.\n *\n * @returns an observable of the resource instance\n */\n update(): Observable<this> {\n return this.withUriFor('PUT', uri => this._client.put(uri, objectFrom(this)).pipe(\n map(() => this),\n catchError(this.handleError)\n ));\n }\n\n /**\n * Returns a single embedded resource or `undefined` if no such\n * embedded exists. If the named resource is an array it returns\n * the first element.\n *\n * @param type the resource type\n * @param rel the name of the embedded resource\n * @returns the resource or `undefined`\n */\n get<T extends Resource>(type: Type<T>, rel: string): T | undefined {\n const obj = this._embedded[rel];\n\n if (Array.isArray(obj)) {\n const objs = obj as Object[];\n const first = objs[0];\n\n return first && this.roInstanceOf(type, first);\n }\n\n return obj && this.roInstanceOf(type, obj);\n }\n\n /**\n * Returns an embedded array of resources or `undefined` if the named\n * embedded does not exist. If the named resource is not an array it\n * wraps the resource in an array.\n *\n * @param type the element resource type\n * @param rel the name of the embedded resource array\n * @returns the resource array or `undefined`\n */\n getArray<T extends Resource>(type: Type<T>, rel: string):\n T[] | undefined {\n const obj = this._embedded[rel];\n\n return Array.isArray(obj) ? this.roArrayOf(type, obj) :\n obj && this.roArrayOf(type, [obj]);\n\n }\n\n /**\n * Clones the resource instance and allows to modify the clone's\n * properties using the provided function.\n *\n * @param update the update function to apply to the clone\n * @returns the updated clone of the resource\n */\n mutate(update: (x: this) => void): this {\n const type = this.constructor as Type<this>;\n const mutable = new type(this);\n\n update(mutable);\n\n return Object.freeze(mutable);\n }\n\n protected roArrayOf<T extends Resource>(type: Type<T>,\n values: Object[]): T[] {\n return values.map(obj => this.roInstanceOf(type, obj));\n }\n}\n","import { Type } from '@angular/core';\nimport { Observable, catchError, map } from 'rxjs';\nimport { Accessor, Resource } from './internal';\n\nconst next = 'next';\n\nconst prev = 'prev';\n\n/**\n * This class represents an in-memory collection of resources.\n */\nexport class Collection<T extends Resource> extends Resource {\n /**\n * Zero-based offset of the first element of the `values` array in\n * the collection.\n */\n readonly start: number;\n\n /**\n * A page of values of the collection starting with `start` offset.\n */\n readonly values: T[];\n\n /**\n * @param type the element resource type\n * @param obj the object used to assign the properties\n */\n constructor(private readonly type: Type<T>, obj: any) {\n super(obj);\n\n this.start = obj.start > 0 ? Math.trunc(obj.start) : 0;\n\n for (const rel in this._embedded) {\n const values = this._embedded[rel];\n\n if (Array.isArray(values)) {\n this.values = this.roArrayOf(type, values);\n\n return;\n }\n }\n\n this.values = this.roArrayOf(type, []);\n }\n\n /**\n * Follow the `next` link. If the link does not exist, the accessor\n * will have the `self` link set to `undefined`.\n *\n * @returns the accessor for the link\n */\n next(): Accessor {\n return this.follow(next);\n }\n\n /**\n * Follow the `prev` link. If the link does not exist, the accessor\n * will have the `self` link set to `undefined`.\n *\n * @returns the accessor for the link\n */\n prev(): Accessor {\n return this.follow(prev);\n }\n\n /**\n * Refresh the resource collection. In other words, read\n * the resource collection identified by `self` link.\n *\n * @returns an observable of the refreshed resource collection\n * instance\n */\n override read(): Observable<this> {\n return this.withUriFor('GET', self => this._client.get(self).pipe(\n map(obj => new Collection(this.type, {\n ...obj,\n _client: this._client\n }) as this),\n catchError(this.handleError)\n ));\n }\n}\n","import { Collection } from './internal';\n\n/**\n * Convert any item to {@link Object} or {@link Array}. On conversion\n * HAL-related properties (`_client`, `_links`, `_embedded`)\n * are not included in the resulting object. Primitive types\n * as well as `null` or `undefined` are returned unchanged.\n * If the argument is an array, every item of the returned array\n * is converted recursively. For {@link Collection} it returns\n * the array of values where each item is converted recursively.\n *\n * @param item the item to convert\n * @returns an object, array, primitive value, `undefined` or `null`\n */\nexport function objectFrom(item: any): any {\n if (typeof item !== 'object' || item === null)\n return item;\n\n if (item instanceof Collection)\n return objectFrom(item.values);\n\n if (Array.isArray(item))\n return item.map(x => objectFrom(x));\n\n const { _client, _links, _embedded, ...object } = item;\n\n return object;\n}\n\n/**\n * @param arg argument to test\n * @returns `false` if the argument is `null` or `undefined` and `true`\n * otherwise\n */\nexport function isDefined<T>(arg: T | null | undefined):\n arg is T extends null | undefined ? never : T {\n return arg !== undefined && arg !== null;\n}\n","import { Type } from '@angular/core';\nimport { filter, map, Observable, OperatorFunction, pipe, switchMap,\n takeUntil } from 'rxjs';\nimport { Accessor, Collection, isDefined, Params,\n Resource } from './internal';\n\n/**\n * Returns an RxJS operator that makes the source {@link Observable}\n * complete at the same time as the lifetime {@link Observable}.\n *\n * @param lifetime the lifetime observable\n * @returns a function that transforms the source {@link Observable}\n */\nexport function completeWith<T>(lifetime: Observable<any>):\n OperatorFunction<T, T> {\n const terminator$ = new Observable<void>(subscriber =>\n lifetime.subscribe().add(() => subscriber.next()));\n\n return pipe(takeUntil(terminator$));\n}\n\n/**\n * Returns an RxJS operator to follow a link on a {@link Resource}. It is\n * equivalent to\n * ```ts\n * map(resource => resource.follow(rel, params))\n * ```\n *\n * @param rel the relation to follow\n * @param params the parameters to expand the link\n * @returns a function that transforms the source {@link Observable}\n */\nexport function follow(rel: string, params?: Params):\n OperatorFunction<Resource, Accessor> {\n return pipe(map(resource => resource.follow(rel, params)));\n}\n\n/**\n * Returns an RxJS operator to create a new resource identified by\n * an {@link Accessor} or a {@link Resource}. It is equivalent to\n * ```ts\n * switchMap(x => x.create(obj))\n * ```\n *\n * @param obj the value for the resource\n * @returns a function that transforms the source {@link Observable}\n */\nexport function create(obj: any):\n OperatorFunction<Accessor | Resource, Accessor> {\n return pipe(switchMap(base => base.create(obj)));\n}\n\n/**\n * Returns an RxJS operator to read a {@link Resource} using an\n * {@link Accessor}. It is equivalent to\n * ```ts\n * switchMap(accessor => accessor.read(type))\n * ```\n *\n * @param type the resource type\n * @returns a function that transforms the source {@link Observable}\n */\nexport function read<T extends Resource>(type: Type<T>):\n OperatorFunction<Accessor, T> {\n return pipe(switchMap(accessor => accessor.read(type)));\n}\n\n/**\n * Returns an RxJS operator to read a {@link Collection} of resources\n * using an {@link Accessor}. It is equivalent to\n * ```ts\n * switchMap(accessor => accessor.readCollection(type))\n * ```\n *\n * @param type the collection element type\n * @returns a function that transforms the source {@link Observable}\n */\nexport function readCollection<T extends Resource>(type: Type<T>):\n OperatorFunction<Accessor, Collection<T>> {\n return pipe(switchMap(accessor => accessor.readCollection(type)));\n}\n\n/**\n * Returns an RxJS operator to refresh a {@link Resource} or\n * {@link Collection} of resources. It is equivalent to\n * ```ts\n * switchMap(resource => resource.read())\n * ```\n *\n * @returns a function that transforms the source {@link Observable}\n */\nexport function refresh<T extends Resource>(): OperatorFunction<T, T> {\n return pipe(switchMap(resource => resource.read()));\n}\n\n/**\n * Returns an RxJS operator to clone a {@link Resource} and modify\n * the cloned instance using the provided update function. It is\n * equivalent to\n * ```ts\n * map(resource => resource.mutate(update))\n * ```\n *\n * @param update the update function to apply\n * @returns a function that transforms the source {@link Observable}\n */\nexport function mutate<T extends Resource>(update: (x: T) => void):\n OperatorFunction<T, T> {\n return pipe(map(resource => resource.mutate(update)));\n}\n\n/**\n * Returns an RxJS operator to update a {@link Resource}.\n * It is equivalent to\n * ```ts\n * switchMap(resource => resource.update())\n * ```\n *\n * @returns a function that transforms the source {@link Observable}\n */\nexport function update<T extends Resource>(): OperatorFunction<T, T> {\n return pipe(switchMap(resource => resource.update()));\n}\n\n/**\n * Returns an RxJS operator to delete a resource identified by\n * an {@link Accessor} or a {@link Resource}. It is equivalent to\n * ```ts\n * switchMap(x => x.delete())\n * ```\n *\n * @returns a function that transforms the source {@link Observable}\n */\nexport function del(): OperatorFunction<Accessor | Resource, void> {\n return pipe(switchMap(base => base.delete()));\n}\n\n/**\n * Returns an RxJS operator to filter out `null` and `undefined` items\n * from the source {@link Observable}.\n *\n * @returns a function that transforms the source {@link Observable}\n */\nexport function defined<T>():\n OperatorFunction<T | null | undefined, T extends null | undefined ? never : T> {\n return pipe(filter(isDefined));\n}\n","import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders,\n Type } from '@angular/core';\nimport { catchError, map, Observable } from 'rxjs';\nimport { Collection, HalBase, Resource } from './internal';\nimport { HttpClient } from \"@angular/common/http\";\n\n/**\n * This class provides a way to execute operations on HAL resources\n * without reading them first. Accessors are obtained either by following\n * resource links or by getting the root entry point for the API.\n */\nexport class Accessor extends HalBase {\n /**\n * Read the resource identified by `self` link.\n *\n * @param type the resource type\n * @returns an observable of the resource instance\n */\n read<T extends Resource>(type: Type<T>): Observable<T> {\n return this.withUriFor('GET',\n uri => this._client.get(uri).pipe(\n map(obj => this.roInstanceOf(type, obj)),\n catchError(this.handleError)\n ));\n }\n\n /**\n * Read the resource collection identified by `self` link.\n *\n * @param type the collection element type\n * @returns an observable of the collection instance\n */\n readCollection<T extends Resource>(type: Type<T>):\n Observable<Collection<T>> {\n return this.withUriFor('GET',\n uri => this._client.get(uri).pipe(\n map(obj => {\n const collection = new Collection(type, {\n ...obj,\n _client: this._client\n });\n\n Object.freeze(collection);\n\n return collection;\n }),\n catchError(this.handleError)\n )\n );\n }\n}\n\n/**\n * The injection token for HAL root URL.\n */\nexport const HAL_ROOT = new InjectionToken<Accessor>('hal.root');\n\n/**\n * Configure HAL client using the provided the root URL for the API.\n *\n * @param url the root URL\n * @return an array of environment providers with a single factory\n * provider for the {@link Accessor} for the API root\n */\nexport function provideHalRoot(url: string): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: HAL_ROOT,\n deps: [HttpClient],\n useFactory: (httpClient: HttpClient) => new Accessor({\n _client: httpClient,\n _links: {\n self: { href: url }\n }\n })\n }\n ]);\n}\n","/*\n * Public API Surface of ngx-hal-client\n */\n\nexport * from './lib/hal-error';\nexport * from './lib/accessor';\nexport * from './lib/resource';\nexport * from './lib/collection';\nexport * from './lib/utils';\nexport * from './lib/rxjs';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;AAIG;AACG,MAAO,QAAS,SAAQ,KAAK,CAAA;AAqB/B;;AAEG;AACH,IAAA,WAAA,CAAY,GAAQ,EAAA;AAChB,QAAA,KAAK,EAAE;AACP,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG,UAAU;IAC1B;AACH;;AC7BD,MAAM,IAAI,GAAG,MAAM;AAUnB;;AAEG;MACmB,OAAO,CAAA;AAOzB;;AAEG;AACH,IAAA,IAAI,IAAI,GAAA;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI;IAClC;AAEA;;;;AA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