@3sixty/api-core 0.20.0-next.0 → 0.20.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/clients/baseRestClient.js.map +1 -1
- package/dist/es/clients/baseSocketClient.js.map +1 -1
- package/dist/es/index.js.map +1 -1
- package/docs/changelog.md +17 -0
- package/docs/reference/classes/BaseRestClient.md +2 -2
- package/docs/reference/classes/BaseSocketClient.md +2 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseRestClient.js","sourceRoot":"","sources":["../../../src/clients/baseRestClient.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACN,SAAS,EACT,MAAM,EACN,MAAM,EAEN,EAAE,EACF,YAAY,EAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EAET,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,OAAgB,cAAc;IACnC;;;OAGG;IACc,oBAAoB,CAAS;IAE9C;;;OAGG;IACc,eAAe,CAAS;IAEzC;;;OAGG;IACc,mBAAmB,CAAS;IAE7C;;;OAGG;IACc,WAAW,CAAS;IAErC;;;;;;OAMG;IACc,cAAc,CAAsB;IAErD;;;OAGG;IACc,QAAQ,CAAgB;IAEzC;;;OAGG;IACc,QAAQ,CAAU;IAEnC;;;OAGG;IACc,mBAAmB,CAAU;IAE9C;;;OAGG;IACc,cAAc,CAA+B;IAE9D;;;OAGG;IACc,iBAAiB,CAAyB;IAE3D;;;OAGG;IACc,WAAW,CAAyB;IAErD;;;OAGG;IACc,cAAc,CAAoC;IAEnE;;;;;OAKG;IACH,YAAY,mBAA2B,EAAE,MAA6B,EAAE,UAAkB;QACzF,MAAM,CAAC,WAAW,CAAC,mBAAmB,yBAA+B,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AE,KAAK,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACP,IAAI,GAAG,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QAED,OAAO,IAAI,EAAE,CAAC;IACf,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIBaseRestClientConfig,\n\tIHttpRequest,\n\tIHttpResponse,\n\tIRestClientProcessor,\n\tIRestClientProcessorContext\n} from \"@3sixty/api-models\";\nimport { HttpUrlHelper, RestClientProcessorFactory } from \"@3sixty/api-models\";\nimport {\n\tBaseError,\n\tCoerce,\n\tGuards,\n\ttype IError,\n\tIs,\n\tStringHelper,\n\ttype IKeyValue\n} from \"@3sixty/core\";\nimport { nameof, nameofCamelCase } from \"@3sixty/nameof\";\nimport {\n\tFetchError,\n\tFetchHelper,\n\tHeaderTypes,\n\tHttpMethod,\n\tHttpStatusCode,\n\tMimeTypes,\n\ttype IHttpHeaders\n} from \"@3sixty/web\";\n\n/**\n * Abstract client class for common REST processing.\n */\nexport abstract class BaseRestClient {\n\t/**\n\t * The name of the class implementation REST calls.\n\t * @internal\n\t */\n\tprivate readonly _restClientClassName: string;\n\n\t/**\n\t * The endpoint origin without prefix.\n\t * @internal\n\t */\n\tprivate readonly _endpointOrigin: string;\n\n\t/**\n\t * The endpoint with prefix to send the requests to.\n\t * @internal\n\t */\n\tprivate readonly _endpointWithPrefix: string;\n\n\t/**\n\t * The path prefix without origin, e.g. \"authentication/audit\".\n\t * @internal\n\t */\n\tprivate readonly _pathPrefix: string;\n\n\t/**\n\t * Query parameters parsed from the configured endpoint URL. Preserved on every\n\t * outbound request so that callers using endpoints like\n\t * `https://host?tenant-token=…` don't lose routing data when the route+query are\n\t * appended to the base URL.\n\t * @internal\n\t */\n\tprivate readonly _endpointQuery: IKeyValue<string>[];\n\n\t/**\n\t * The headers to include in requests.\n\t * @internal\n\t */\n\tprivate readonly _headers?: IHttpHeaders;\n\n\t/**\n\t * Timeout for requests in ms.\n\t * @internal\n\t */\n\tprivate readonly _timeout?: number;\n\n\t/**\n\t * Include credentials in the request, defaults to true.\n\t * @internal\n\t */\n\tprivate readonly _includeCredentials: boolean;\n\n\t/**\n\t * Hook to provide headers asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _customHeaders?: () => Promise<IHttpHeaders>;\n\n\t/**\n\t * Hook to provide auth header asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _customAuthHeader?: () => Promise<string>;\n\n\t/**\n\t * The resolved processors.\n\t * @internal\n\t */\n\tprivate readonly _processors: IRestClientProcessor[];\n\n\t/**\n\t * Hook to handle authorization failures asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _onAuthFailure?: (error: IError) => Promise<void>;\n\n\t/**\n\t * Create a new instance of BaseRestClient.\n\t * @param restClientClassName The name of the class implementation REST calls.\n\t * @param config The configuration for the client.\n\t * @param pathPrefix The default prefix to use if none in configuration.\n\t */\n\tconstructor(restClientClassName: string, config: IBaseRestClientConfig, pathPrefix: string) {\n\t\tGuards.stringValue(restClientClassName, nameof(restClientClassName), restClientClassName);\n\t\tGuards.object<IBaseRestClientConfig>(restClientClassName, nameof(config), config);\n\t\tGuards.stringValue(restClientClassName, nameof(config.endpoint), config.endpoint);\n\n\t\tthis._headers = config.headers;\n\t\tthis._timeout = config.timeout;\n\t\tthis._includeCredentials = config.includeCredentials ?? true;\n\n\t\tthis._restClientClassName = restClientClassName;\n\n\t\t// Parse the endpoint as a URL so any query string the caller embedded is preserved\n\t\t// rather than concatenated as part of the path.\n\t\tthis._endpointQuery = [];\n\t\tlet parsedEndpoint: URL | undefined;\n\t\ttry {\n\t\t\tparsedEndpoint = new URL(config.endpoint);\n\t\t} catch {}\n\n\t\tif (Is.empty(parsedEndpoint)) {\n\t\t\tthis._endpointOrigin = StringHelper.trimTrailingSlashes(config.endpoint);\n\t\t} else {\n\t\t\tfor (const [key, value] of parsedEndpoint.searchParams.entries()) {\n\t\t\t\tthis._endpointQuery.push({ key, value });\n\t\t\t}\n\t\t\tparsedEndpoint.search = \"\";\n\t\t\tthis._endpointOrigin = StringHelper.trimTrailingSlashes(parsedEndpoint.toString());\n\t\t}\n\n\t\tthis._endpointWithPrefix = this._endpointOrigin;\n\t\tconst finalPathPrefix = config.pathPrefix ?? pathPrefix;\n\t\tthis._pathPrefix = Is.stringValue(finalPathPrefix) ? finalPathPrefix : \"\";\n\t\tif (Is.stringValue(this._pathPrefix)) {\n\t\t\tthis._endpointWithPrefix += `/${this._pathPrefix}`;\n\t\t}\n\n\t\tthis._customAuthHeader = config.customAuthHeader;\n\t\tthis._customHeaders = config.customHeaders;\n\t\tthis._onAuthFailure = config.onAuthFailure;\n\t\tthis._processors = (config.processorTypes ?? []).map(processorType =>\n\t\t\tRestClientProcessorFactory.get(processorType)\n\t\t);\n\t}\n\n\t/**\n\t * Get the endpoint with the prefix for the namespace.\n\t * @returns The endpoint with namespace prefix attached.\n\t */\n\tpublic getEndpointWithPrefix(): string {\n\t\treturn this._endpointWithPrefix;\n\t}\n\n\t/**\n\t * Get the path prefix as a URL path string provided in the constructor.\n\t * @returns The path prefix.\n\t */\n\tpublic getPathPrefix(): string {\n\t\treturn this._pathPrefix;\n\t}\n\n\t/**\n\t * Perform a request in json format.\n\t * @param route The route of the request.\n\t * @param method The http method.\n\t * @param request Request to send to the endpoint.\n\t * @param options Optional override options for the request.\n\t * @param options.overridePrefix Optional override prefix to use for this request instead of the default prefix.\n\t * @returns The response.\n\t */\n\tpublic async fetch<T extends IHttpRequest, U extends IHttpResponse>(\n\t\troute: string,\n\t\tmethod: HttpMethod,\n\t\trequest?: T,\n\t\toptions?: { overridePrefix?: string }\n\t): Promise<U> {\n\t\tGuards.stringValue(this._restClientClassName, nameof(route), route);\n\t\tGuards.arrayOneOf(this._restClientClassName, nameof(method), method, Object.values(HttpMethod));\n\n\t\tconst routeParts = route.split(\"/\");\n\n\t\tfor (let i = 0; i < routeParts.length; i++) {\n\t\t\tif (routeParts[i].startsWith(\":\")) {\n\t\t\t\tconst routeProp = routeParts[i].slice(1);\n\t\t\t\tconst pathValue = request?.pathParams?.[routeProp];\n\t\t\t\tif (Is.notEmpty(pathValue)) {\n\t\t\t\t\trouteParts[i] = Coerce.string(pathValue) ?? \"\";\n\t\t\t\t\tdelete request?.pathParams?.[routeProp];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new FetchError(\n\t\t\t\t\t\tthis._restClientClassName,\n\t\t\t\t\t\t`${nameofCamelCase<BaseRestClient>()}.missingRouteProp`,\n\t\t\t\t\t\tHttpStatusCode.badRequest,\n\t\t\t\t\t\t{ route, routeProp }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Preserve endpoint-level query params (parsed once in the constructor)\n\t\t// alongside any per-request query params.\n\t\tconst queryKeyPairs: IKeyValue<string>[] = [...this._endpointQuery];\n\n\t\tconst isHttpRequest = Is.notEmpty(request);\n\n\t\tif (isHttpRequest) {\n\t\t\tconst query = request?.query;\n\t\t\tif (Is.object(query)) {\n\t\t\t\tfor (const qp in query) {\n\t\t\t\t\tconst propValue = query[qp];\n\t\t\t\t\tif (Is.string(propValue) || Is.number(propValue) || Is.boolean(propValue)) {\n\t\t\t\t\t\tconst ids = queryKeyPairs.findIndex(q => q.key === qp);\n\t\t\t\t\t\tif (ids !== -1) {\n\t\t\t\t\t\t\tqueryKeyPairs.splice(ids, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqueryKeyPairs.push({\n\t\t\t\t\t\t\tkey: qp,\n\t\t\t\t\t\t\tvalue: propValue.toString()\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdelete request?.query;\n\t\t\t}\n\t\t}\n\n\t\tlet finalRoute = routeParts.map(rp => HttpUrlHelper.encodeUriPathSegment(rp)).join(\"/\");\n\t\tif (finalRoute === \"/\") {\n\t\t\tfinalRoute = \"\";\n\t\t}\n\t\tif (queryKeyPairs.length > 0) {\n\t\t\tfinalRoute += `?${queryKeyPairs\n\t\t\t\t.map(qp => `${encodeURIComponent(qp.key)}=${encodeURIComponent(qp.value)}`)\n\t\t\t\t.join(\"&\")}`;\n\t\t}\n\n\t\tconst body = isHttpRequest && request?.body ? JSON.stringify(request?.body) : undefined;\n\n\t\tlet requestHeaders: IHttpHeaders = {};\n\n\t\tif (body) {\n\t\t\trequestHeaders[HeaderTypes.ContentType] = MimeTypes.Json;\n\t\t}\n\n\t\tif (Is.object(this._headers)) {\n\t\t\trequestHeaders = { ...requestHeaders, ...this._headers };\n\t\t}\n\n\t\tif (Is.object(request?.headers)) {\n\t\t\trequestHeaders = { ...requestHeaders, ...request.headers };\n\t\t}\n\n\t\tif (Is.function(this._customHeaders)) {\n\t\t\tconst customHeaders = await this._customHeaders();\n\t\t\tif (Is.object(customHeaders)) {\n\t\t\t\trequestHeaders = { ...requestHeaders, ...customHeaders };\n\t\t\t}\n\t\t}\n\n\t\tif (Is.function(this._customAuthHeader)) {\n\t\t\tconst authHeader = await this._customAuthHeader();\n\t\t\tif (Is.stringValue(authHeader)) {\n\t\t\t\trequestHeaders[HeaderTypes.Authorization] = authHeader;\n\t\t\t}\n\t\t}\n\n\t\tlet baseUrl;\n\n\t\tif (Is.string(options?.overridePrefix)) {\n\t\t\tbaseUrl =\n\t\t\t\toptions.overridePrefix.length > 0\n\t\t\t\t\t? `${this._endpointOrigin}/${options.overridePrefix}`\n\t\t\t\t\t: this._endpointOrigin;\n\t\t} else {\n\t\t\tbaseUrl = this._endpointWithPrefix;\n\t\t}\n\n\t\tconst context: IRestClientProcessorContext = {\n\t\t\trestClientClassName: this._restClientClassName,\n\t\t\tbaseUrl,\n\t\t\trouteTemplate: route,\n\t\t\troute: finalRoute,\n\t\t\tmethod,\n\t\t\theaders: requestHeaders,\n\t\t\ttimeout: this._timeout,\n\t\t\tincludeCredentials: this._includeCredentials,\n\t\t\tbody\n\t\t};\n\n\t\tconst rawResponse = await this.runProcessorsPre(context, async () =>\n\t\t\tFetchHelper.fetch(\n\t\t\t\tthis._restClientClassName,\n\t\t\t\t`${context.baseUrl}${context.route}`,\n\t\t\t\tcontext.method,\n\t\t\t\tcontext.body,\n\t\t\t\t{\n\t\t\t\t\theaders: context.headers,\n\t\t\t\t\ttimeoutMs: context.timeout,\n\t\t\t\t\tincludeCredentials: context.includeCredentials\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\tconst response = await this.runProcessorsPost(context, rawResponse);\n\n\t\tif (response.ok) {\n\t\t\ttry {\n\t\t\t\tconst httpResponse: IHttpResponse = {};\n\n\t\t\t\tconst contentType =\n\t\t\t\t\tresponse.headers.get(HeaderTypes.ContentType) ??\n\t\t\t\t\tresponse.headers.get(HeaderTypes.ContentType.toLowerCase()) ??\n\t\t\t\t\t\"\";\n\n\t\t\t\tif (response.status !== HttpStatusCode.noContent) {\n\t\t\t\t\tif (contentType.includes(MimeTypes.PlainText)) {\n\t\t\t\t\t\thttpResponse.body = await response.text();\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontentType.includes(MimeTypes.Json) ||\n\t\t\t\t\t\tcontentType.includes(MimeTypes.JsonLd)\n\t\t\t\t\t) {\n\t\t\t\t\t\thttpResponse.body = await response.json();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thttpResponse.body = new Uint8Array(await response.arrayBuffer());\n\t\t\t\t\t\tif (httpResponse.body.length === 0) {\n\t\t\t\t\t\t\tdelete httpResponse.body;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst responseHeaders: IHttpHeaders = {};\n\t\t\t\tfor (const header of response.headers.entries()) {\n\t\t\t\t\tresponseHeaders[header[0]] = header[1];\n\t\t\t\t}\n\n\t\t\t\tif (Object.keys(responseHeaders).length > 0) {\n\t\t\t\t\thttpResponse.headers = responseHeaders;\n\t\t\t\t}\n\n\t\t\t\tif (response.status !== HttpStatusCode.ok) {\n\t\t\t\t\thttpResponse.statusCode = response.status as HttpStatusCode;\n\t\t\t\t}\n\n\t\t\t\treturn httpResponse as U;\n\t\t\t} catch (err) {\n\t\t\t\tthrow new FetchError(\n\t\t\t\t\tthis._restClientClassName,\n\t\t\t\t\t`${nameofCamelCase<BaseRestClient>()}.decodingFailed`,\n\t\t\t\t\tresponse.status as HttpStatusCode,\n\t\t\t\t\t{\n\t\t\t\t\t\troute\n\t\t\t\t\t},\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst errResponse = await response.json();\n\t\tlet err: BaseError | undefined;\n\t\tif (\n\t\t\tresponse.status >= HttpStatusCode.badRequest &&\n\t\t\tIs.object(errResponse) &&\n\t\t\tIs.stringValue(errResponse.message)\n\t\t) {\n\t\t\terr = BaseError.fromError(errResponse);\n\t\t}\n\n\t\terr ??= new FetchError(\n\t\t\tthis._restClientClassName,\n\t\t\t`${nameofCamelCase<BaseRestClient>()}.failureStatusText`,\n\t\t\tresponse.status as HttpStatusCode,\n\t\t\t{\n\t\t\t\tstatusText: response.statusText ?? response.status,\n\t\t\t\troute: finalRoute,\n\t\t\t\tresponse: errResponse\n\t\t\t}\n\t\t);\n\n\t\tif (response.status === HttpStatusCode.unauthorized && Is.function(this._onAuthFailure)) {\n\t\t\ttry {\n\t\t\t\tawait this._onAuthFailure(err);\n\t\t\t} catch {\n\t\t\t\t// Silently ignore errors from the auth failure handler as we want to throw the original error\n\t\t\t\t// in this case to preserve the original failure context for logging and handling by callers\n\t\t\t}\n\t\t}\n\n\t\tthrow err;\n\t}\n\n\t/**\n\t * Run the pre operation for any processors.\n\t * @param context The processor context.\n\t * @param perform Performs the request.\n\t * @returns The response.\n\t * @internal\n\t */\n\tprivate async runProcessorsPre(\n\t\tcontext: IRestClientProcessorContext,\n\t\tperform: () => Promise<Response>\n\t): Promise<Response> {\n\t\tif (this._processors.length === 0) {\n\t\t\treturn perform();\n\t\t}\n\n\t\t// Built from the last processor backwards.\n\t\t// For [\"a\", \"b\"] that gives a.pre -> b.pre -> perform.\n\t\tlet next = perform;\n\t\tfor (let i = this._processors.length - 1; i >= 0; i--) {\n\t\t\tconst processor = this._processors[i];\n\t\t\tconst inner = next;\n\t\t\tconst preFuncBound = processor.pre?.bind(processor);\n\t\t\tif (Is.function(preFuncBound)) {\n\t\t\t\tnext = async () => preFuncBound(context, inner);\n\t\t\t} else {\n\t\t\t\tnext = inner;\n\t\t\t}\n\t\t}\n\n\t\treturn next();\n\t}\n\n\t/**\n\t * Run the post operation for any processors.\n\t * @param context The processor context.\n\t * @param response The response from the fetch.\n\t * @returns The response.\n\t * @internal\n\t */\n\tprivate async runProcessorsPost(\n\t\tcontext: IRestClientProcessorContext,\n\t\tresponse: Response\n\t): Promise<Response> {\n\t\tif (this._processors.length === 0) {\n\t\t\treturn response;\n\t\t}\n\n\t\t// Built from first to last so that the last processor is outermost.\n\t\t// For [\"a\", \"b\"] that gives b.post -> a.post -> response (reverse of pre).\n\t\tlet next = async (): Promise<Response> => response;\n\t\tfor (let i = 0; i < this._processors.length; i++) {\n\t\t\tconst processor = this._processors[i];\n\t\t\tconst inner = next;\n\t\t\tconst postFuncBound = processor.post?.bind(processor);\n\t\t\tif (Is.function(postFuncBound)) {\n\t\t\t\tnext = async () => postFuncBound(context, response, inner);\n\t\t\t} else {\n\t\t\t\tnext = inner;\n\t\t\t}\n\t\t}\n\n\t\treturn next();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"baseRestClient.js","sources":["../../../src/clients/baseRestClient.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACN,SAAS,EACT,MAAM,EACN,MAAM,EAEN,EAAE,EACF,YAAY,EAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EAET,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,OAAgB,cAAc;IACnC;;;OAGG;IACc,oBAAoB,CAAS;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Q,CAAC;QACjB,CAAC;QAED,oEAAoE;QACpE,2EAA2E;QAC3E,IAAI,IAAI,GAAG,KAAK,IAAuB,EAAE,CAAC,QAAQ,CAAC;QACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC;YACnB,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YACtD,IAAI,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;gBAChC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACP,IAAI,GAAG,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QAED,OAAO,IAAI,EAAE,CAAC;IACf,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIBaseRestClientConfig,\n\tIHttpRequest,\n\tIHttpResponse,\n\tIRestClientProcessor,\n\tIRestClientProcessorContext\n} from \"@3sixty/api-models\";\nimport { HttpUrlHelper, RestClientProcessorFactory } from \"@3sixty/api-models\";\nimport {\n\tBaseError,\n\tCoerce,\n\tGuards,\n\ttype IError,\n\tIs,\n\tStringHelper,\n\ttype IKeyValue\n} from \"@3sixty/core\";\n\nimport {\n\tFetchError,\n\tFetchHelper,\n\tHeaderTypes,\n\tHttpMethod,\n\tHttpStatusCode,\n\tMimeTypes,\n\ttype IHttpHeaders\n} from \"@3sixty/web\";\n\n/**\n * Abstract client class for common REST processing.\n */\nexport abstract class BaseRestClient {\n\t/**\n\t * The name of the class implementation REST calls.\n\t * @internal\n\t */\n\tprivate readonly _restClientClassName: string;\n\n\t/**\n\t * The endpoint origin without prefix.\n\t * @internal\n\t */\n\tprivate readonly _endpointOrigin: string;\n\n\t/**\n\t * The endpoint with prefix to send the requests to.\n\t * @internal\n\t */\n\tprivate readonly _endpointWithPrefix: string;\n\n\t/**\n\t * The path prefix without origin, e.g. \"authentication/audit\".\n\t * @internal\n\t */\n\tprivate readonly _pathPrefix: string;\n\n\t/**\n\t * Query parameters parsed from the configured endpoint URL. Preserved on every\n\t * outbound request so that callers using endpoints like\n\t * `https://host?tenant-token=…` don't lose routing data when the route+query are\n\t * appended to the base URL.\n\t * @internal\n\t */\n\tprivate readonly _endpointQuery: IKeyValue<string>[];\n\n\t/**\n\t * The headers to include in requests.\n\t * @internal\n\t */\n\tprivate readonly _headers?: IHttpHeaders;\n\n\t/**\n\t * Timeout for requests in ms.\n\t * @internal\n\t */\n\tprivate readonly _timeout?: number;\n\n\t/**\n\t * Include credentials in the request, defaults to true.\n\t * @internal\n\t */\n\tprivate readonly _includeCredentials: boolean;\n\n\t/**\n\t * Hook to provide headers asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _customHeaders?: () => Promise<IHttpHeaders>;\n\n\t/**\n\t * Hook to provide auth header asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _customAuthHeader?: () => Promise<string>;\n\n\t/**\n\t * The resolved processors.\n\t * @internal\n\t */\n\tprivate readonly _processors: IRestClientProcessor[];\n\n\t/**\n\t * Hook to handle authorization failures asynchronously.\n\t * @internal\n\t */\n\tprivate readonly _onAuthFailure?: (error: IError) => Promise<void>;\n\n\t/**\n\t * Create a new instance of BaseRestClient.\n\t * @param restClientClassName The name of the class implementation REST calls.\n\t * @param config The configuration for the client.\n\t * @param pathPrefix The default prefix to use if none in configuration.\n\t */\n\tconstructor(restClientClassName: string, config: IBaseRestClientConfig, pathPrefix: string) {\n\t\tGuards.stringValue(restClientClassName, \"restClientClassName\", restClientClassName);\n\t\tGuards.object<IBaseRestClientConfig>(restClientClassName, \"config\", config);\n\t\tGuards.stringValue(restClientClassName, \"config.endpoint\", config.endpoint);\n\n\t\tthis._headers = config.headers;\n\t\tthis._timeout = config.timeout;\n\t\tthis._includeCredentials = config.includeCredentials ?? true;\n\n\t\tthis._restClientClassName = restClientClassName;\n\n\t\t// Parse the endpoint as a URL so any query string the caller embedded is preserved\n\t\t// rather than concatenated as part of the path.\n\t\tthis._endpointQuery = [];\n\t\tlet parsedEndpoint: URL | undefined;\n\t\ttry {\n\t\t\tparsedEndpoint = new URL(config.endpoint);\n\t\t} catch {}\n\n\t\tif (Is.empty(parsedEndpoint)) {\n\t\t\tthis._endpointOrigin = StringHelper.trimTrailingSlashes(config.endpoint);\n\t\t} else {\n\t\t\tfor (const [key, value] of parsedEndpoint.searchParams.entries()) {\n\t\t\t\tthis._endpointQuery.push({ key, value });\n\t\t\t}\n\t\t\tparsedEndpoint.search = \"\";\n\t\t\tthis._endpointOrigin = StringHelper.trimTrailingSlashes(parsedEndpoint.toString());\n\t\t}\n\n\t\tthis._endpointWithPrefix = this._endpointOrigin;\n\t\tconst finalPathPrefix = config.pathPrefix ?? pathPrefix;\n\t\tthis._pathPrefix = Is.stringValue(finalPathPrefix) ? finalPathPrefix : \"\";\n\t\tif (Is.stringValue(this._pathPrefix)) {\n\t\t\tthis._endpointWithPrefix += `/${this._pathPrefix}`;\n\t\t}\n\n\t\tthis._customAuthHeader = config.customAuthHeader;\n\t\tthis._customHeaders = config.customHeaders;\n\t\tthis._onAuthFailure = config.onAuthFailure;\n\t\tthis._processors = (config.processorTypes ?? []).map(processorType =>\n\t\t\tRestClientProcessorFactory.get(processorType)\n\t\t);\n\t}\n\n\t/**\n\t * Get the endpoint with the prefix for the namespace.\n\t * @returns The endpoint with namespace prefix attached.\n\t */\n\tpublic getEndpointWithPrefix(): string {\n\t\treturn this._endpointWithPrefix;\n\t}\n\n\t/**\n\t * Get the path prefix as a URL path string provided in the constructor.\n\t * @returns The path prefix.\n\t */\n\tpublic getPathPrefix(): string {\n\t\treturn this._pathPrefix;\n\t}\n\n\t/**\n\t * Perform a request in json format.\n\t * @param route The route of the request.\n\t * @param method The http method.\n\t * @param request Request to send to the endpoint.\n\t * @param options Optional override options for the request.\n\t * @param options.overridePrefix Optional override prefix to use for this request instead of the default prefix.\n\t * @returns The response.\n\t */\n\tpublic async fetch<T extends IHttpRequest, U extends IHttpResponse>(\n\t\troute: string,\n\t\tmethod: HttpMethod,\n\t\trequest?: T,\n\t\toptions?: { overridePrefix?: string }\n\t): Promise<U> {\n\t\tGuards.stringValue(this._restClientClassName, \"route\", route);\n\t\tGuards.arrayOneOf(this._restClientClassName, \"method\", method, Object.values(HttpMethod));\n\n\t\tconst routeParts = route.split(\"/\");\n\n\t\tfor (let i = 0; i < routeParts.length; i++) {\n\t\t\tif (routeParts[i].startsWith(\":\")) {\n\t\t\t\tconst routeProp = routeParts[i].slice(1);\n\t\t\t\tconst pathValue = request?.pathParams?.[routeProp];\n\t\t\t\tif (Is.notEmpty(pathValue)) {\n\t\t\t\t\trouteParts[i] = Coerce.string(pathValue) ?? \"\";\n\t\t\t\t\tdelete request?.pathParams?.[routeProp];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new FetchError(\n\t\t\t\t\t\tthis._restClientClassName,\n\t\t\t\t\t\t`${\"baseRestClient\"}.missingRouteProp`,\n\t\t\t\t\t\tHttpStatusCode.badRequest,\n\t\t\t\t\t\t{ route, routeProp }\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Preserve endpoint-level query params (parsed once in the constructor)\n\t\t// alongside any per-request query params.\n\t\tconst queryKeyPairs: IKeyValue<string>[] = [...this._endpointQuery];\n\n\t\tconst isHttpRequest = Is.notEmpty(request);\n\n\t\tif (isHttpRequest) {\n\t\t\tconst query = request?.query;\n\t\t\tif (Is.object(query)) {\n\t\t\t\tfor (const qp in query) {\n\t\t\t\t\tconst propValue = query[qp];\n\t\t\t\t\tif (Is.string(propValue) || Is.number(propValue) || Is.boolean(propValue)) {\n\t\t\t\t\t\tconst ids = queryKeyPairs.findIndex(q => q.key === qp);\n\t\t\t\t\t\tif (ids !== -1) {\n\t\t\t\t\t\t\tqueryKeyPairs.splice(ids, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqueryKeyPairs.push({\n\t\t\t\t\t\t\tkey: qp,\n\t\t\t\t\t\t\tvalue: propValue.toString()\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdelete request?.query;\n\t\t\t}\n\t\t}\n\n\t\tlet finalRoute = routeParts.map(rp => HttpUrlHelper.encodeUriPathSegment(rp)).join(\"/\");\n\t\tif (finalRoute === \"/\") {\n\t\t\tfinalRoute = \"\";\n\t\t}\n\t\tif (queryKeyPairs.length > 0) {\n\t\t\tfinalRoute += `?${queryKeyPairs\n\t\t\t\t.map(qp => `${encodeURIComponent(qp.key)}=${encodeURIComponent(qp.value)}`)\n\t\t\t\t.join(\"&\")}`;\n\t\t}\n\n\t\tconst body = isHttpRequest && request?.body ? JSON.stringify(request?.body) : undefined;\n\n\t\tlet requestHeaders: IHttpHeaders = {};\n\n\t\tif (body) {\n\t\t\trequestHeaders[HeaderTypes.ContentType] = MimeTypes.Json;\n\t\t}\n\n\t\tif (Is.object(this._headers)) {\n\t\t\trequestHeaders = { ...requestHeaders, ...this._headers };\n\t\t}\n\n\t\tif (Is.object(request?.headers)) {\n\t\t\trequestHeaders = { ...requestHeaders, ...request.headers };\n\t\t}\n\n\t\tif (Is.function(this._customHeaders)) {\n\t\t\tconst customHeaders = await this._customHeaders();\n\t\t\tif (Is.object(customHeaders)) {\n\t\t\t\trequestHeaders = { ...requestHeaders, ...customHeaders };\n\t\t\t}\n\t\t}\n\n\t\tif (Is.function(this._customAuthHeader)) {\n\t\t\tconst authHeader = await this._customAuthHeader();\n\t\t\tif (Is.stringValue(authHeader)) {\n\t\t\t\trequestHeaders[HeaderTypes.Authorization] = authHeader;\n\t\t\t}\n\t\t}\n\n\t\tlet baseUrl;\n\n\t\tif (Is.string(options?.overridePrefix)) {\n\t\t\tbaseUrl =\n\t\t\t\toptions.overridePrefix.length > 0\n\t\t\t\t\t? `${this._endpointOrigin}/${options.overridePrefix}`\n\t\t\t\t\t: this._endpointOrigin;\n\t\t} else {\n\t\t\tbaseUrl = this._endpointWithPrefix;\n\t\t}\n\n\t\tconst context: IRestClientProcessorContext = {\n\t\t\trestClientClassName: this._restClientClassName,\n\t\t\tbaseUrl,\n\t\t\trouteTemplate: route,\n\t\t\troute: finalRoute,\n\t\t\tmethod,\n\t\t\theaders: requestHeaders,\n\t\t\ttimeout: this._timeout,\n\t\t\tincludeCredentials: this._includeCredentials,\n\t\t\tbody\n\t\t};\n\n\t\tconst rawResponse = await this.runProcessorsPre(context, async () =>\n\t\t\tFetchHelper.fetch(\n\t\t\t\tthis._restClientClassName,\n\t\t\t\t`${context.baseUrl}${context.route}`,\n\t\t\t\tcontext.method,\n\t\t\t\tcontext.body,\n\t\t\t\t{\n\t\t\t\t\theaders: context.headers,\n\t\t\t\t\ttimeoutMs: context.timeout,\n\t\t\t\t\tincludeCredentials: context.includeCredentials\n\t\t\t\t}\n\t\t\t)\n\t\t);\n\n\t\tconst response = await this.runProcessorsPost(context, rawResponse);\n\n\t\tif (response.ok) {\n\t\t\ttry {\n\t\t\t\tconst httpResponse: IHttpResponse = {};\n\n\t\t\t\tconst contentType =\n\t\t\t\t\tresponse.headers.get(HeaderTypes.ContentType) ??\n\t\t\t\t\tresponse.headers.get(HeaderTypes.ContentType.toLowerCase()) ??\n\t\t\t\t\t\"\";\n\n\t\t\t\tif (response.status !== HttpStatusCode.noContent) {\n\t\t\t\t\tif (contentType.includes(MimeTypes.PlainText)) {\n\t\t\t\t\t\thttpResponse.body = await response.text();\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontentType.includes(MimeTypes.Json) ||\n\t\t\t\t\t\tcontentType.includes(MimeTypes.JsonLd)\n\t\t\t\t\t) {\n\t\t\t\t\t\thttpResponse.body = await response.json();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thttpResponse.body = new Uint8Array(await response.arrayBuffer());\n\t\t\t\t\t\tif (httpResponse.body.length === 0) {\n\t\t\t\t\t\t\tdelete httpResponse.body;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst responseHeaders: IHttpHeaders = {};\n\t\t\t\tfor (const header of response.headers.entries()) {\n\t\t\t\t\tresponseHeaders[header[0]] = header[1];\n\t\t\t\t}\n\n\t\t\t\tif (Object.keys(responseHeaders).length > 0) {\n\t\t\t\t\thttpResponse.headers = responseHeaders;\n\t\t\t\t}\n\n\t\t\t\tif (response.status !== HttpStatusCode.ok) {\n\t\t\t\t\thttpResponse.statusCode = response.status as HttpStatusCode;\n\t\t\t\t}\n\n\t\t\t\treturn httpResponse as U;\n\t\t\t} catch (err) {\n\t\t\t\tthrow new FetchError(\n\t\t\t\t\tthis._restClientClassName,\n\t\t\t\t\t`${\"baseRestClient\"}.decodingFailed`,\n\t\t\t\t\tresponse.status as HttpStatusCode,\n\t\t\t\t\t{\n\t\t\t\t\t\troute\n\t\t\t\t\t},\n\t\t\t\t\terr\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst errResponse = await response.json();\n\t\tlet err: BaseError | undefined;\n\t\tif (\n\t\t\tresponse.status >= HttpStatusCode.badRequest &&\n\t\t\tIs.object(errResponse) &&\n\t\t\tIs.stringValue(errResponse.message)\n\t\t) {\n\t\t\terr = BaseError.fromError(errResponse);\n\t\t}\n\n\t\terr ??= new FetchError(\n\t\t\tthis._restClientClassName,\n\t\t\t`${\"baseRestClient\"}.failureStatusText`,\n\t\t\tresponse.status as HttpStatusCode,\n\t\t\t{\n\t\t\t\tstatusText: response.statusText ?? response.status,\n\t\t\t\troute: finalRoute,\n\t\t\t\tresponse: errResponse\n\t\t\t}\n\t\t);\n\n\t\tif (response.status === HttpStatusCode.unauthorized && Is.function(this._onAuthFailure)) {\n\t\t\ttry {\n\t\t\t\tawait this._onAuthFailure(err);\n\t\t\t} catch {\n\t\t\t\t// Silently ignore errors from the auth failure handler as we want to throw the original error\n\t\t\t\t// in this case to preserve the original failure context for logging and handling by callers\n\t\t\t}\n\t\t}\n\n\t\tthrow err;\n\t}\n\n\t/**\n\t * Run the pre operation for any processors.\n\t * @param context The processor context.\n\t * @param perform Performs the request.\n\t * @returns The response.\n\t * @internal\n\t */\n\tprivate async runProcessorsPre(\n\t\tcontext: IRestClientProcessorContext,\n\t\tperform: () => Promise<Response>\n\t): Promise<Response> {\n\t\tif (this._processors.length === 0) {\n\t\t\treturn perform();\n\t\t}\n\n\t\t// Built from the last processor backwards.\n\t\t// For [\"a\", \"b\"] that gives a.pre -> b.pre -> perform.\n\t\tlet next = perform;\n\t\tfor (let i = this._processors.length - 1; i >= 0; i--) {\n\t\t\tconst processor = this._processors[i];\n\t\t\tconst inner = next;\n\t\t\tconst preFuncBound = processor.pre?.bind(processor);\n\t\t\tif (Is.function(preFuncBound)) {\n\t\t\t\tnext = async () => preFuncBound(context, inner);\n\t\t\t} else {\n\t\t\t\tnext = inner;\n\t\t\t}\n\t\t}\n\n\t\treturn next();\n\t}\n\n\t/**\n\t * Run the post operation for any processors.\n\t * @param context The processor context.\n\t * @param response The response from the fetch.\n\t * @returns The response.\n\t * @internal\n\t */\n\tprivate async runProcessorsPost(\n\t\tcontext: IRestClientProcessorContext,\n\t\tresponse: Response\n\t): Promise<Response> {\n\t\tif (this._processors.length === 0) {\n\t\t\treturn response;\n\t\t}\n\n\t\t// Built from first to last so that the last processor is outermost.\n\t\t// For [\"a\", \"b\"] that gives b.post -> a.post -> response (reverse of pre).\n\t\tlet next = async (): Promise<Response> => response;\n\t\tfor (let i = 0; i < this._processors.length; i++) {\n\t\t\tconst processor = this._processors[i];\n\t\t\tconst inner = next;\n\t\t\tconst postFuncBound = processor.post?.bind(processor);\n\t\t\tif (Is.function(postFuncBound)) {\n\t\t\t\tnext = async () => postFuncBound(context, response, inner);\n\t\t\t} else {\n\t\t\t\tnext = inner;\n\t\t\t}\n\t\t}\n\n\t\treturn next();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseSocketClient.js","
|
|
1
|
+
{"version":3,"file":"baseSocketClient.js","sources":["../../../src/clients/baseSocketClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,MAAuB,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAgB,gBAAgB;IACrC;;;OAGG;IACH,8EAA8E;IAC7D,oBAAoB,CAAS;IAE9C;;;OAGG;IACc,mBAAmB,CAAS;IAE7C;;;OAGG;IACc,OAAO,CAAS;IAEjC;;;;;OAKG;IACH,YAAY,mBAA2B,EAAE,MAA+B,EAAE,UAAkB;QAC3F,MAAM,CAAC,WAAW,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;QACpF,MAAM,CAAC,MAAM,CAA0B,mBAAmB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9E,MAAM,CAAC,WAAW,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE5E,IAAI,CAAC,oBAAoB,GAAG,mBAAmB,CAAC;QAChD,IAAI,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE7E,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,IAAI,UAAU,CAAC;QACxD,IAAI,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,mBAAmB,IAAI,IAAI,eAAe,EAAE,CAAC;QACnD,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC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,KAAa;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACO,SAAS,CAAyB,KAAa,EAAE,IAAO;QACjE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACO,aAAa;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACO,gBAAgB;QACzB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACO,WAAW;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;IAC/B,CAAC;CAYD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseSocketClientConfig, IHttpRequest, IHttpResponse } from \"@3sixty/api-models\";\nimport { BaseError, Guards, Is, StringHelper, type IError } from \"@3sixty/core\";\n\nimport { HttpStatusCode } from \"@3sixty/web\";\nimport lookup, { type Socket } from \"socket.io-client\";\n\n/**\n * Event bus which publishes using web-sockets.\n */\nexport abstract class BaseSocketClient {\n\t/**\n\t * The name of the class implementation socket calls.\n\t * @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-private-class-members\n\tprivate readonly _restClientClassName: string;\n\n\t/**\n\t * The endpoint with prefix to send the requests to.\n\t * @internal\n\t */\n\tprivate readonly _endpointWithPrefix: string;\n\n\t/**\n\t * The web socket to communicate on.\n\t * @internal\n\t */\n\tprivate readonly _socket: Socket;\n\n\t/**\n\t * Create a new instance of BaseSocketClient.\n\t * @param restClientClassName The name of the class implementation socket calls.\n\t * @param config The configuration for the client.\n\t * @param pathPrefix The default prefix to use if none in configuration.\n\t */\n\tconstructor(restClientClassName: string, config: IBaseSocketClientConfig, pathPrefix: string) {\n\t\tGuards.stringValue(restClientClassName, \"restClientClassName\", restClientClassName);\n\t\tGuards.object<IBaseSocketClientConfig>(restClientClassName, \"config\", config);\n\t\tGuards.stringValue(restClientClassName, \"config.endpoint\", config.endpoint);\n\n\t\tthis._restClientClassName = restClientClassName;\n\t\tthis._endpointWithPrefix = StringHelper.trimTrailingSlashes(config.endpoint);\n\n\t\tconst finalPathPrefix = config.pathPrefix ?? pathPrefix;\n\t\tif (Is.stringValue(finalPathPrefix)) {\n\t\t\tthis._endpointWithPrefix += `/${finalPathPrefix}`;\n\t\t}\n\n\t\tthis._socket = lookup(this._endpointWithPrefix, {\n\t\t\tpath: config.basePath ?? \"/socket\",\n\t\t\tupgrade: true,\n\t\t\ttransports: [\"websocket\"],\n\t\t\tautoConnect: false,\n\t\t\tquery: config.headers\n\t\t});\n\n\t\tthis._socket.on(\"reconnect_attempt\", () => {\n\t\t\tthis._socket.io.opts.transports = [\"polling\", \"websocket\"];\n\t\t});\n\n\t\tthis._socket.on(\"connect_error\", async err => {\n\t\t\tawait this.handleError(BaseError.fromError(err));\n\t\t});\n\n\t\tthis._socket.on(\"connect\", async () => {\n\t\t\tawait this.handleConnected();\n\t\t});\n\t}\n\n\t/**\n\t * Setup a handler for an event from the socket.\n\t * @param event The event to look for.\n\t * @param callback The method to call when the event arrives.\n\t */\n\tprotected onEvent<T extends IHttpResponse>(\n\t\tevent: string,\n\t\tcallback: (response: T) => Promise<void>\n\t): void {\n\t\tthis._socket.on(event, async (response: T) => {\n\t\t\tif ((response.statusCode ?? HttpStatusCode.ok) >= HttpStatusCode.badRequest) {\n\t\t\t\tawait this.handleError(BaseError.fromError(response.body));\n\t\t\t} else {\n\t\t\t\tawait callback(response);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Remove a handler for a event from the socket.\n\t * @param event The event to look for.\n\t */\n\tprotected offEvent(event: string): void {\n\t\tthis._socket.off(event);\n\t}\n\n\t/**\n\t * Send a event on the socket.\n\t * @param event The event to send.\n\t * @param data The data to send with the event.\n\t */\n\tprotected sendEvent<T extends IHttpRequest>(event: string, data: T): void {\n\t\tthis._socket.emit(event, data);\n\t}\n\n\t/**\n\t * Connect the socket if its not already connected.\n\t * @returns True if the socket is already connected.\n\t */\n\tprotected socketConnect(): boolean {\n\t\tif (!this._socket.connected) {\n\t\t\tthis._socket.connect();\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Disconnect the socket if its connected.\n\t */\n\tprotected socketDisconnect(): void {\n\t\tthis._socket.disconnect();\n\t}\n\n\t/**\n\t * Is the socket connected.\n\t * @returns True if the socket is connected.\n\t */\n\tprotected isConnected(): boolean {\n\t\treturn this._socket.connected;\n\t}\n\n\t/**\n\t * Handle the socket connection.\n\t */\n\tprotected abstract handleConnected(): Promise<void>;\n\n\t/**\n\t * Handle an error.\n\t * @param err The error to handle.\n\t */\n\tprotected abstract handleError(err: IError): Promise<void>;\n}\n"]}
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./clients/baseRestClient.js\";\nexport * from \"./clients/baseSocketClient.js\";\n"]}
|
package/docs/changelog.md
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.20.0-next.1](https://github.com/3sixtyglobal/api/compare/api-core-v0.20.0-next.0...api-core-v0.20.0-next.1) (2026-10-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* authorization ([#51](https://github.com/3sixtyglobal/api/issues/51)) ([023ef94](https://github.com/3sixtyglobal/api/commit/023ef94925114e88522cbe6f703d9b05a202bc6d))
|
|
9
|
+
* publish packages under the [@3sixty](https://github.com/3sixty) namespace ([91b1822](https://github.com/3sixtyglobal/api/commit/91b1822dba38f70692087ad4643572531d6634dc))
|
|
10
|
+
* updated ts compile ([d9a5c86](https://github.com/3sixtyglobal/api/commit/d9a5c86ec7dd1faf3045b5cd1e0d38a4b331313d))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Dependencies
|
|
14
|
+
|
|
15
|
+
* The following workspace dependencies were updated
|
|
16
|
+
* dependencies
|
|
17
|
+
* @3sixty/api-models bumped from 0.20.0-next.0 to 0.20.0-next.1
|
|
@@ -44,7 +44,7 @@ Setup a handler for an event from the socket.
|
|
|
44
44
|
|
|
45
45
|
#### Type Parameters
|
|
46
46
|
|
|
47
|
-
##### T
|
|
47
|
+
##### T {#t}
|
|
48
48
|
|
|
49
49
|
`T` *extends* `IHttpResponse`\<`any`\>
|
|
50
50
|
|
|
@@ -96,7 +96,7 @@ Send a event on the socket.
|
|
|
96
96
|
|
|
97
97
|
#### Type Parameters
|
|
98
98
|
|
|
99
|
-
##### T
|
|
99
|
+
##### T {#t-1}
|
|
100
100
|
|
|
101
101
|
`T` *extends* `IHttpRequest`\<`any`\>
|
|
102
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3sixty/api-core",
|
|
3
|
-
"version": "0.20.0-next.
|
|
3
|
+
"version": "0.20.0-next.1",
|
|
4
4
|
"description": "Base client classes and common helpers for building HTTP and socket integrations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@3sixty/api-models": "0.20.0-next.
|
|
17
|
+
"@3sixty/api-models": "0.20.0-next.1",
|
|
18
18
|
"@3sixty/core": "next",
|
|
19
19
|
"@3sixty/nameof": "next",
|
|
20
20
|
"@3sixty/web": "next",
|
|
21
|
-
"socket.io-client": "4.8.
|
|
21
|
+
"socket.io-client": "4.8.4"
|
|
22
22
|
},
|
|
23
23
|
"main": "./dist/es/index.js",
|
|
24
24
|
"types": "./dist/types/index.d.ts",
|