@twin.org/nft-service 0.0.3-next.8 → 0.0.3-next.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"INftServiceConfig.js","sourceRoot":"","sources":["../../../src/models/INftServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the NFT Service.\n */\nexport interface INftServiceConfig {\n\t/**\n\t * What is the default connector to use for NFT. If not provided the first connector from the factory will be used.\n\t */\n\tdefaultNamespace?: string;\n}\n"]}
1
+ {"version":3,"file":"INftServiceConfig.js","sourceRoot":"","sources":["../../../src/models/INftServiceConfig.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Configuration for the NFT Service.\n */\nexport interface INftServiceConfig {\n\t/**\n\t * The default connector namespace to use for NFT operations; defaults to the first registered connector.\n\t */\n\tdefaultNamespace?: string;\n}\n"]}
@@ -208,7 +208,7 @@ export function generateRestRoutesNft(baseRouteName, componentName) {
208
208
  * @param httpRequestContext The request context for the API.
209
209
  * @param componentName The name of the component to use in the routes.
210
210
  * @param request The request.
211
- * @returns The response object with additional http response properties.
211
+ * @returns A created response containing the location header with the new NFT id.
212
212
  */
213
213
  export async function nftMint(httpRequestContext, componentName, request) {
214
214
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -230,7 +230,7 @@ export async function nftMint(httpRequestContext, componentName, request) {
230
230
  * @param httpRequestContext The request context for the API.
231
231
  * @param componentName The name of the component to use in the routes.
232
232
  * @param request The request.
233
- * @returns The response object with additional http response properties.
233
+ * @returns A response containing the resolved NFT data.
234
234
  */
235
235
  export async function nftResolve(httpRequestContext, componentName, request) {
236
236
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -249,7 +249,7 @@ export async function nftResolve(httpRequestContext, componentName, request) {
249
249
  * @param httpRequestContext The request context for the API.
250
250
  * @param componentName The name of the component to use in the routes.
251
251
  * @param request The request.
252
- * @returns The response object with additional http response properties.
252
+ * @returns A no-content response indicating the NFT was burned successfully.
253
253
  */
254
254
  export async function nftBurn(httpRequestContext, componentName, request) {
255
255
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -268,7 +268,7 @@ export async function nftBurn(httpRequestContext, componentName, request) {
268
268
  * @param httpRequestContext The request context for the API.
269
269
  * @param componentName The name of the component to use in the routes.
270
270
  * @param request The request.
271
- * @returns The response object with additional http response properties.
271
+ * @returns A no-content response indicating the NFT was transferred successfully.
272
272
  */
273
273
  export async function nftTransfer(httpRequestContext, componentName, request) {
274
274
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -289,7 +289,7 @@ export async function nftTransfer(httpRequestContext, componentName, request) {
289
289
  * @param httpRequestContext The request context for the API.
290
290
  * @param componentName The name of the component to use in the routes.
291
291
  * @param request The request.
292
- * @returns The response object with additional http response properties.
292
+ * @returns A no-content response indicating the NFT metadata was updated successfully.
293
293
  */
294
294
  export async function nftUpdate(httpRequestContext, componentName, request) {
295
295
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -1 +1 @@
1
- {"version":3,"file":"nftRoutes.js","sourceRoot":"","sources":["../../src/nftRoutes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,yDAAyD;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U,CAClB,CAAC;IACF,MAAM,CAAC,WAAW,CAAC,aAAa,2BAAiC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IACxF,MAAM,CAAC,MAAM,CAA4B,aAAa,kBAAwB,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,MAAM,CAAC,aAAa,2BAAiC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnF,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;IACxD,eAAe,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAE9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAgB,aAAa,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,MAAM,CACrB,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,EACrB,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CACtC,CAAC;IAEF,OAAO;QACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tICreatedResponse,\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tINftBurnRequest,\n\tINftComponent,\n\tINftMintRequest,\n\tINftResolveRequest,\n\tINftResolveResponse,\n\tINftTransferRequest,\n\tINftUpdateRequest\n} from \"@twin.org/nft-models\";\nimport { HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"nftRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsNft: ITag[] = [\n\t{\n\t\tname: \"NFT\",\n\t\tdescription: \"Endpoints which are modelled to access an NFT contract.\"\n\t}\n];\n\n/**\n * The REST routes for NFT.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesNft(baseRouteName: string, componentName: string): IRestRoute[] {\n\tconst mintRoute: IRestRoute<INftMintRequest, ICreatedResponse> = {\n\t\toperationId: \"nftMint\",\n\t\tsummary: \"Mint an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftMint(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftMintRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftMintExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftMintResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst resolveRoute: IRestRoute<INftResolveRequest, INftResolveResponse> = {\n\t\toperationId: \"nftResolve\",\n\t\tsummary: \"Resolve an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftResolve(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftResolveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftResolveExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INftResolveResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftResolveResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tissuer: \"0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\t\tissuerIdentityId:\n\t\t\t\t\t\t\t\t\t\"0xa1d80bee7fdb4fd91ae45c6e539209f73cb743b7da9db3e21322ea75af1878c0\",\n\t\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst burnRoute: IRestRoute<INftBurnRequest, INoContentResponse> = {\n\t\toperationId: \"nftBurn\",\n\t\tsummary: \"Burn an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftBurn(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftBurnRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftBurnExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst transferRoute: IRestRoute<INftTransferRequest, INoContentResponse> = {\n\t\toperationId: \"nftTransfer\",\n\t\tsummary: \"Transfer an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/:id/transfer`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftTransfer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftTransferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftTransferExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\trecipientAddress: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst updateRoute: IRestRoute<INftUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"nftUpdate\",\n\t\tsummary: \"Update an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftUpdateExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [mintRoute, resolveRoute, burnRoute, transferRoute, updateRoute];\n}\n\n/**\n * Mint an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftMint(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftMintRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<INftMintRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftMintRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.body.tag), request.body.tag);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst id = await component.mint(\n\t\trequest.body.tag,\n\t\trequest.body.immutableMetadata,\n\t\trequest.body.metadata,\n\t\trequest.body.namespace,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Resolve an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftResolve(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftResolveRequest\n): Promise<INftResolveResponse> {\n\tGuards.object<INftResolveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftResolveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst result = await component.resolve(\n\t\trequest.pathParams.id,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Burn an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftBurn(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftBurnRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftBurnRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftBurnRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.burn(request.pathParams.id, contextIds[ContextIdKeys.Organization]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Transfer an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftTransfer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftTransferRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftTransferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftTransferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftTransferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body.recipientAddress),\n\t\trequest.body.recipientAddress\n\t);\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.transfer(\n\t\trequest.pathParams.id,\n\t\trequest.body.recipientAddress,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Update an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function nftUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftUpdateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body.metadata), request.body.metadata);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n"]}
1
+ {"version":3,"file":"nftRoutes.js","sourceRoot":"","sources":["../../src/nftRoutes.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAW1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,aAAa,GAAG,WAAW,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAW;IAC9B;QACC,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,yDAAyD;KACtE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAqB,EAAE,aAAqB;IACjF,MAAM,SAAS,GAAkD;QAChE,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,aAAa;QACtB,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QACpB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,GAAG,aAAa,GAAG;QACzB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,CAC9C,OAAO,CAAC,kBAAkB,EAAE,aAAa,EAAE,OAAO,CAAC;QACpD,WAAW,EAAE;YACZ,IAAI,mBAA2B;YAC/B,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,gBAAgB;o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S,CAAC,MAAM,CACrB,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,EACrB,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CACtC,CAAC;IAEF,OAAO;QACN,UAAU,EAAE,cAAc,CAAC,SAAS;KACpC,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tICreatedResponse,\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ContextIdHelper, ContextIdKeys, ContextIdStore } from \"@twin.org/context\";\nimport { ComponentFactory, Guards } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type {\n\tINftBurnRequest,\n\tINftComponent,\n\tINftMintRequest,\n\tINftResolveRequest,\n\tINftResolveResponse,\n\tINftTransferRequest,\n\tINftUpdateRequest\n} from \"@twin.org/nft-models\";\nimport { HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"nftRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsNft: ITag[] = [\n\t{\n\t\tname: \"NFT\",\n\t\tdescription: \"Endpoints which are modelled to access an NFT contract.\"\n\t}\n];\n\n/**\n * The REST routes for NFT.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesNft(baseRouteName: string, componentName: string): IRestRoute[] {\n\tconst mintRoute: IRestRoute<INftMintRequest, ICreatedResponse> = {\n\t\toperationId: \"nftMint\",\n\t\tsummary: \"Mint an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftMint(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftMintRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftMintExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ICreatedResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftMintResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tstatusCode: HttpStatusCode.created,\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\t[HeaderTypes.Location]:\n\t\t\t\t\t\t\t\t\t\"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst resolveRoute: IRestRoute<INftResolveRequest, INftResolveResponse> = {\n\t\toperationId: \"nftResolve\",\n\t\tsummary: \"Resolve an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftResolve(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftResolveRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftResolveExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INftResolveResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"nftResolveResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tissuer: \"0x85ef62ea94fc4eeeeeddf6acc3b566e988e613081d0b93cc54ed831ed4c18d44\",\n\t\t\t\t\t\t\t\tissuerIdentityId:\n\t\t\t\t\t\t\t\t\t\"0xa1d80bee7fdb4fd91ae45c6e539209f73cb743b7da9db3e21322ea75af1878c0\",\n\t\t\t\t\t\t\t\ttag: \"MY-NFT\",\n\t\t\t\t\t\t\t\timmutableMetadata: {\n\t\t\t\t\t\t\t\t\tdocName: \"bill-of-lading\",\n\t\t\t\t\t\t\t\t\tmimeType: \"application/pdf\",\n\t\t\t\t\t\t\t\t\tfingerprint: \"0xf0b95a98b3dbc5ce1c9ce59d70af95a97599f100a7296ecdd1eb108bebfa047f\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\tconst burnRoute: IRestRoute<INftBurnRequest, INoContentResponse> = {\n\t\toperationId: \"nftBurn\",\n\t\tsummary: \"Burn an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"DELETE\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftBurn(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftBurnRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftBurnExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst transferRoute: IRestRoute<INftTransferRequest, INoContentResponse> = {\n\t\toperationId: \"nftTransfer\",\n\t\tsummary: \"Transfer an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/:id/transfer`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftTransfer(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftTransferRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftTransferExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\trecipientAddress: \"tst1prctjk5ck0dutnsunnje6u90jk5htx03qznjjmkd6843pzltlgz87srjzzv\",\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst updateRoute: IRestRoute<INftUpdateRequest, INoContentResponse> = {\n\t\toperationId: \"nftUpdate\",\n\t\tsummary: \"Update an NFT\",\n\t\ttag: tagsNft[0].name,\n\t\tmethod: \"PUT\",\n\t\tpath: `${baseRouteName}/:id`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tnftUpdate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<INftUpdateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"nftUpdateExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tpathParams: {\n\t\t\t\t\t\t\tid: \"nft:iota:aW90YS1uZnQ6dHN0OjB4NzYyYjljNDllYTg2OWUwZWJkYTliYmZhNzY5Mzk0NDdhNDI4ZGNmMTc4YzVkMTVhYjQ0N2UyZDRmYmJiNGViMg==\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\tdata: \"AAAAA\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [mintRoute, resolveRoute, burnRoute, transferRoute, updateRoute];\n}\n\n/**\n * Mint an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A created response containing the location header with the new NFT id.\n */\nexport async function nftMint(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftMintRequest\n): Promise<ICreatedResponse> {\n\tGuards.object<INftMintRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftMintRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.body.tag), request.body.tag);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst id = await component.mint(\n\t\trequest.body.tag,\n\t\trequest.body.immutableMetadata,\n\t\trequest.body.metadata,\n\t\trequest.body.namespace,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tstatusCode: HttpStatusCode.created,\n\t\theaders: {\n\t\t\t[HeaderTypes.Location]: id\n\t\t}\n\t};\n}\n\n/**\n * Resolve an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A response containing the resolved NFT data.\n */\nexport async function nftResolve(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftResolveRequest\n): Promise<INftResolveResponse> {\n\tGuards.object<INftResolveRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftResolveRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tconst result = await component.resolve(\n\t\trequest.pathParams.id,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\treturn {\n\t\tbody: result\n\t};\n}\n\n/**\n * Burn an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A no-content response indicating the NFT was burned successfully.\n */\nexport async function nftBurn(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftBurnRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftBurnRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftBurnRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.burn(request.pathParams.id, contextIds[ContextIdKeys.Organization]);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Transfer an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A no-content response indicating the NFT was transferred successfully.\n */\nexport async function nftTransfer(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftTransferRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftTransferRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftTransferRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftTransferRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.stringValue(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.body.recipientAddress),\n\t\trequest.body.recipientAddress\n\t);\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.transfer(\n\t\trequest.pathParams.id,\n\t\trequest.body.recipientAddress,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Update an NFT.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A no-content response indicating the NFT metadata was updated successfully.\n */\nexport async function nftUpdate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: INftUpdateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<INftUpdateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<INftUpdateRequest[\"pathParams\"]>(\n\t\tROUTES_SOURCE,\n\t\tnameof(request.pathParams),\n\t\trequest.pathParams\n\t);\n\tGuards.stringValue(ROUTES_SOURCE, nameof(request.pathParams.id), request.pathParams.id);\n\tGuards.object<INftUpdateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tGuards.object(ROUTES_SOURCE, nameof(request.body.metadata), request.body.metadata);\n\n\tconst contextIds = await ContextIdStore.getContextIds();\n\tContextIdHelper.guard(contextIds, ContextIdKeys.Organization);\n\n\tconst component = ComponentFactory.get<INftComponent>(componentName);\n\tawait component.update(\n\t\trequest.pathParams.id,\n\t\trequest.body.metadata,\n\t\tcontextIds[ContextIdKeys.Organization]\n\t);\n\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n"]}
@@ -33,7 +33,7 @@ export class NftService {
33
33
  }
34
34
  /**
35
35
  * Returns the class name of the component.
36
- * @returns The class name of the component.
36
+ * @returns The class name.
37
37
  */
38
38
  className() {
39
39
  return NftService.CLASS_NAME;
@@ -81,7 +81,7 @@ export class NftService {
81
81
  * Burn an NFT.
82
82
  * @param id The id of the NFT to burn in urn format.
83
83
  * @param controllerIdentity The identity to perform the nft operation with.
84
- * @returns Nothing.
84
+ * @returns A promise that resolves when the NFT has been permanently destroyed.
85
85
  */
86
86
  async burn(id, controllerIdentity) {
87
87
  Urn.guard(NftService.CLASS_NAME, "id", id);
@@ -100,7 +100,7 @@ export class NftService {
100
100
  * @param recipientAddress The recipient address for the NFT.
101
101
  * @param metadata Optional mutable data to include during the transfer.
102
102
  * @param controllerIdentity The identity to perform the nft operation with.
103
- * @returns Nothing.
103
+ * @returns A promise that resolves when the NFT ownership has been transferred.
104
104
  */
105
105
  async transfer(id, recipientAddress, metadata, controllerIdentity) {
106
106
  Urn.guard(NftService.CLASS_NAME, "id", id);
@@ -115,11 +115,11 @@ export class NftService {
115
115
  }
116
116
  }
117
117
  /**
118
- * Update the data of the NFT.
118
+ * Update the mutable data of the NFT.
119
119
  * @param id The id of the NFT to update in urn format.
120
120
  * @param metadata The mutable data to update.
121
121
  * @param controllerIdentity The identity to perform the nft operation with.
122
- * @returns Nothing.
122
+ * @returns A promise that resolves when the NFT metadata has been updated.
123
123
  */
124
124
  async update(id, metadata, controllerIdentity) {
125
125
  Urn.guard(NftService.CLASS_NAME, "id", id);
@@ -1 +1 @@
1
- {"version":3,"file":"nftService.js","sourceRoot":"","sources":["../../src/nftService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAA0C,MAAM,sBAAsB,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,UAAU;IACtB;;OAEG;IACI,MAAM,CAAU,UAAU,gBAAgC;IAEjE;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,KAAK,CAAC;IAEnD;;;OAGG;IACc,iBAAiB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AmB,EAAE;gBAClE,SAAS,EAAE,UAAU,CAAC,UAAU;gBAChC,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,mBAAmB,CAAC,GAAG,CAAgB,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IACxE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { NftConnectorFactory, type INftComponent, type INftConnector } from \"@twin.org/nft-models\";\nimport type { INftServiceConstructorOptions } from \"./models/INftServiceConstructorOptions.js\";\n\n/**\n * Service for performing NFT operations to a connector.\n */\nexport class NftService implements INftComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NftService>();\n\n\t/**\n\t * The namespace supported by the nft service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"nft\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of NftService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: INftServiceConstructorOptions) {\n\t\tconst names = NftConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn NftService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Mint an NFT.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @param namespace The namespace of the connector to use for the NFT, defaults to service configured namespace.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tpublic async mint<T = unknown, U = unknown>(\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U,\n\t\tnamespace?: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<string> {\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(tag), tag);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst nftConnector = NftConnectorFactory.get<INftConnector>(connectorNamespace);\n\n\t\t\tconst nftUrn = await nftConnector.mint(controllerIdentity, tag, immutableMetadata, metadata);\n\n\t\t\treturn nftUrn;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"mintFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tpublic async resolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<{\n\t\tissuer: string;\n\t\tissuerIdentityId: string;\n\t\ttag: string;\n\t\timmutableMetadata?: T;\n\t\tmetadata?: U;\n\t}> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tconst result = await nftConnector.resolve<T, U>(id);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"resolveFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Burn an NFT.\n\t * @param id The id of the NFT to burn in urn format.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async burn(id: string, controllerIdentity?: string): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.burn(controllerIdentity, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"burnFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Transfer an NFT.\n\t * @param id The id of the NFT to transfer in urn format.\n\t * @param recipientAddress The recipient address for the NFT.\n\t * @param metadata Optional mutable data to include during the transfer.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async transfer<U = unknown>(\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(recipientAddress), recipientAddress);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.transfer(controllerIdentity, id, recipientAddress, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"transferFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update the data of the NFT.\n\t * @param id The id of the NFT to update in urn format.\n\t * @param metadata The mutable data to update.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns Nothing.\n\t */\n\tpublic async update<U = unknown>(\n\t\tid: string,\n\t\tmetadata: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(NftService.CLASS_NAME, nameof(metadata), metadata);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.update(controllerIdentity, id, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the NFT in urn format.\n\t * @returns The connector.\n\t * @throws GeneralError If the namespace does not match.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): INftConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: NftService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn NftConnectorFactory.get<INftConnector>(idUri.namespaceMethod());\n\t}\n}\n"]}
1
+ {"version":3,"file":"nftService.js","sourceRoot":"","sources":["../../src/nftService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAA0C,MAAM,sBAAsB,CAAC;AAGnG;;GAEG;AACH,MAAM,OAAO,UAAU;IACtB;;OAEG;IACI,MAAM,CAAU,UAAU,gBAAgC;IAEjE;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,KAAK,CAAC;IAEnD;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;OAGG;IACH,YAAY,OAAuC;QAClD,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,EAAE,CAAC;QAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACI,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;OAMG;IACI,KAAK,CAAC,MAAM,CAClB,EAAU,EACV,QAAW,EACX,kBAA2B;QAE3B,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QACjE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,wBAA8B,kBAAkB,CAAC,CAAC;QAE1F,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAC3C,MAAM,YAAY,CAAC,MAAM,CAAC,kBAAkB,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACjF,CAAC;IACF,CAAC;IAED;;;;;;OAMG;IACK,YAAY,CAAC,EAAU;QAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAEtC,IAAI,KAAK,CAAC,mBAAmB,EAAE,KAAK,UAAU,CAAC,UAAU,EAAE,CAAC;YAC3D,MAAM,IAAI,YAAY,CAAC,UAAU,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBAClE,SAAS,EAAE,UAAU,CAAC,UAAU;gBAChC,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,mBAAmB,CAAC,GAAG,CAAgB,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;IACxE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { NftConnectorFactory, type INftComponent, type INftConnector } from \"@twin.org/nft-models\";\nimport type { INftServiceConstructorOptions } from \"./models/INftServiceConstructorOptions.js\";\n\n/**\n * Service for performing NFT operations to a connector.\n */\nexport class NftService implements INftComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<NftService>();\n\n\t/**\n\t * The namespace supported by the nft service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"nft\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of NftService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: INftServiceConstructorOptions) {\n\t\tconst names = NftConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name.\n\t */\n\tpublic className(): string {\n\t\treturn NftService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Mint an NFT.\n\t * @param tag The tag for the NFT.\n\t * @param immutableMetadata The immutable metadata for the NFT.\n\t * @param metadata The metadata for the NFT.\n\t * @param namespace The namespace of the connector to use for the NFT, defaults to service configured namespace.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The id of the created NFT in urn format.\n\t */\n\tpublic async mint<T = unknown, U = unknown>(\n\t\ttag: string,\n\t\timmutableMetadata?: T,\n\t\tmetadata?: U,\n\t\tnamespace?: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<string> {\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(tag), tag);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst nftConnector = NftConnectorFactory.get<INftConnector>(connectorNamespace);\n\n\t\t\tconst nftUrn = await nftConnector.mint(controllerIdentity, tag, immutableMetadata, metadata);\n\n\t\t\treturn nftUrn;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"mintFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolve an NFT.\n\t * @param id The id of the NFT to resolve.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns The data for the NFT.\n\t */\n\tpublic async resolve<T = unknown, U = unknown>(\n\t\tid: string,\n\t\tcontrollerIdentity?: string\n\t): Promise<{\n\t\tissuer: string;\n\t\tissuerIdentityId: string;\n\t\ttag: string;\n\t\timmutableMetadata?: T;\n\t\tmetadata?: U;\n\t}> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tconst result = await nftConnector.resolve<T, U>(id);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"resolveFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Burn an NFT.\n\t * @param id The id of the NFT to burn in urn format.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns A promise that resolves when the NFT has been permanently destroyed.\n\t */\n\tpublic async burn(id: string, controllerIdentity?: string): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.burn(controllerIdentity, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"burnFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Transfer an NFT.\n\t * @param id The id of the NFT to transfer in urn format.\n\t * @param recipientAddress The recipient address for the NFT.\n\t * @param metadata Optional mutable data to include during the transfer.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns A promise that resolves when the NFT ownership has been transferred.\n\t */\n\tpublic async transfer<U = unknown>(\n\t\tid: string,\n\t\trecipientAddress: string,\n\t\tmetadata?: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(recipientAddress), recipientAddress);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.transfer(controllerIdentity, id, recipientAddress, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"transferFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update the mutable data of the NFT.\n\t * @param id The id of the NFT to update in urn format.\n\t * @param metadata The mutable data to update.\n\t * @param controllerIdentity The identity to perform the nft operation with.\n\t * @returns A promise that resolves when the NFT metadata has been updated.\n\t */\n\tpublic async update<U = unknown>(\n\t\tid: string,\n\t\tmetadata: U,\n\t\tcontrollerIdentity?: string\n\t): Promise<void> {\n\t\tUrn.guard(NftService.CLASS_NAME, nameof(id), id);\n\t\tGuards.object(NftService.CLASS_NAME, nameof(metadata), metadata);\n\t\tGuards.stringValue(NftService.CLASS_NAME, nameof(controllerIdentity), controllerIdentity);\n\n\t\ttry {\n\t\t\tconst nftConnector = this.getConnector(id);\n\t\t\tawait nftConnector.update(controllerIdentity, id, metadata);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the NFT in urn format.\n\t * @returns The connector.\n\t * @throws GeneralError If the namespace does not match.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): INftConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== NftService._NAMESPACE) {\n\t\t\tthrow new GeneralError(NftService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: NftService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn NftConnectorFactory.get<INftConnector>(idUri.namespaceMethod());\n\t}\n}\n"]}
@@ -1,4 +1,7 @@
1
1
  import { generateRestRoutesNft, tagsNft } from "./nftRoutes.js";
2
+ /**
3
+ * REST entry point definitions for the NFT service.
4
+ */
2
5
  export const restEntryPoints = [
3
6
  {
4
7
  name: "nft",
@@ -1 +1 @@
1
- {"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,KAAK;QACX,gBAAgB,EAAE,KAAK;QACvB,IAAI,EAAE,OAAO;QACb,cAAc,EAAE,qBAAqB;KACrC;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport { generateRestRoutesNft, tagsNft } from \"./nftRoutes.js\";\n\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"nft\",\n\t\tdefaultBaseRoute: \"nft\",\n\t\ttags: tagsNft,\n\t\tgenerateRoutes: generateRestRoutesNft\n\t}\n];\n"]}
1
+ {"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,KAAK;QACX,gBAAgB,EAAE,KAAK;QACvB,IAAI,EAAE,OAAO;QACb,cAAc,EAAE,qBAAqB;KACrC;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport { generateRestRoutesNft, tagsNft } from \"./nftRoutes.js\";\n\n/**\n * REST entry point definitions for the NFT service.\n */\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"nft\",\n\t\tdefaultBaseRoute: \"nft\",\n\t\ttags: tagsNft,\n\t\tgenerateRoutes: generateRestRoutesNft\n\t}\n];\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export interface INftServiceConfig {
5
5
  /**
6
- * What is the default connector to use for NFT. If not provided the first connector from the factory will be used.
6
+ * The default connector namespace to use for NFT operations; defaults to the first registered connector.
7
7
  */
8
8
  defaultNamespace?: string;
9
9
  }
@@ -16,7 +16,7 @@ export declare function generateRestRoutesNft(baseRouteName: string, componentNa
16
16
  * @param httpRequestContext The request context for the API.
17
17
  * @param componentName The name of the component to use in the routes.
18
18
  * @param request The request.
19
- * @returns The response object with additional http response properties.
19
+ * @returns A created response containing the location header with the new NFT id.
20
20
  */
21
21
  export declare function nftMint(httpRequestContext: IHttpRequestContext, componentName: string, request: INftMintRequest): Promise<ICreatedResponse>;
22
22
  /**
@@ -24,7 +24,7 @@ export declare function nftMint(httpRequestContext: IHttpRequestContext, compone
24
24
  * @param httpRequestContext The request context for the API.
25
25
  * @param componentName The name of the component to use in the routes.
26
26
  * @param request The request.
27
- * @returns The response object with additional http response properties.
27
+ * @returns A response containing the resolved NFT data.
28
28
  */
29
29
  export declare function nftResolve(httpRequestContext: IHttpRequestContext, componentName: string, request: INftResolveRequest): Promise<INftResolveResponse>;
30
30
  /**
@@ -32,7 +32,7 @@ export declare function nftResolve(httpRequestContext: IHttpRequestContext, comp
32
32
  * @param httpRequestContext The request context for the API.
33
33
  * @param componentName The name of the component to use in the routes.
34
34
  * @param request The request.
35
- * @returns The response object with additional http response properties.
35
+ * @returns A no-content response indicating the NFT was burned successfully.
36
36
  */
37
37
  export declare function nftBurn(httpRequestContext: IHttpRequestContext, componentName: string, request: INftBurnRequest): Promise<INoContentResponse>;
38
38
  /**
@@ -40,7 +40,7 @@ export declare function nftBurn(httpRequestContext: IHttpRequestContext, compone
40
40
  * @param httpRequestContext The request context for the API.
41
41
  * @param componentName The name of the component to use in the routes.
42
42
  * @param request The request.
43
- * @returns The response object with additional http response properties.
43
+ * @returns A no-content response indicating the NFT was transferred successfully.
44
44
  */
45
45
  export declare function nftTransfer(httpRequestContext: IHttpRequestContext, componentName: string, request: INftTransferRequest): Promise<INoContentResponse>;
46
46
  /**
@@ -48,6 +48,6 @@ export declare function nftTransfer(httpRequestContext: IHttpRequestContext, com
48
48
  * @param httpRequestContext The request context for the API.
49
49
  * @param componentName The name of the component to use in the routes.
50
50
  * @param request The request.
51
- * @returns The response object with additional http response properties.
51
+ * @returns A no-content response indicating the NFT metadata was updated successfully.
52
52
  */
53
53
  export declare function nftUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: INftUpdateRequest): Promise<INoContentResponse>;
@@ -15,7 +15,7 @@ export declare class NftService implements INftComponent {
15
15
  constructor(options?: INftServiceConstructorOptions);
16
16
  /**
17
17
  * Returns the class name of the component.
18
- * @returns The class name of the component.
18
+ * @returns The class name.
19
19
  */
20
20
  className(): string;
21
21
  /**
@@ -45,7 +45,7 @@ export declare class NftService implements INftComponent {
45
45
  * Burn an NFT.
46
46
  * @param id The id of the NFT to burn in urn format.
47
47
  * @param controllerIdentity The identity to perform the nft operation with.
48
- * @returns Nothing.
48
+ * @returns A promise that resolves when the NFT has been permanently destroyed.
49
49
  */
50
50
  burn(id: string, controllerIdentity?: string): Promise<void>;
51
51
  /**
@@ -54,15 +54,15 @@ export declare class NftService implements INftComponent {
54
54
  * @param recipientAddress The recipient address for the NFT.
55
55
  * @param metadata Optional mutable data to include during the transfer.
56
56
  * @param controllerIdentity The identity to perform the nft operation with.
57
- * @returns Nothing.
57
+ * @returns A promise that resolves when the NFT ownership has been transferred.
58
58
  */
59
59
  transfer<U = unknown>(id: string, recipientAddress: string, metadata?: U, controllerIdentity?: string): Promise<void>;
60
60
  /**
61
- * Update the data of the NFT.
61
+ * Update the mutable data of the NFT.
62
62
  * @param id The id of the NFT to update in urn format.
63
63
  * @param metadata The mutable data to update.
64
64
  * @param controllerIdentity The identity to perform the nft operation with.
65
- * @returns Nothing.
65
+ * @returns A promise that resolves when the NFT metadata has been updated.
66
66
  */
67
67
  update<U = unknown>(id: string, metadata: U, controllerIdentity?: string): Promise<void>;
68
68
  }
@@ -1,2 +1,5 @@
1
1
  import type { IRestRouteEntryPoint } from "@twin.org/api-models";
2
+ /**
3
+ * REST entry point definitions for the NFT service.
4
+ */
2
5
  export declare const restEntryPoints: IRestRouteEntryPoint[];
package/docs/changelog.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.8...nft-service-v0.0.3-next.9) (2026-06-17)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **nft-service:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nft-models bumped from 0.0.3-next.8 to 0.0.3-next.9
16
+ * devDependencies
17
+ * @twin.org/nft-connector-entity-storage bumped from 0.0.3-next.8 to 0.0.3-next.9
18
+
3
19
  ## [0.0.3-next.8](https://github.com/iotaledger/twin-nft/compare/nft-service-v0.0.3-next.7...nft-service-v0.0.3-next.8) (2026-06-11)
4
20
 
5
21
 
@@ -34,7 +34,7 @@
34
34
  }
35
35
  ],
36
36
  "requestBody": {
37
- "description": "Mint the data and return the NFT id.",
37
+ "description": "Request to mint a new NFT.",
38
38
  "required": true,
39
39
  "content": {
40
40
  "application/json": {
@@ -158,7 +158,7 @@
158
158
  ],
159
159
  "responses": {
160
160
  "200": {
161
- "description": "Response to resolving the NFT.",
161
+ "description": "Response returned after resolving an NFT.",
162
162
  "content": {
163
163
  "application/json": {
164
164
  "schema": {
@@ -339,7 +339,7 @@
339
339
  "parameters": [
340
340
  {
341
341
  "name": "id",
342
- "description": "The id of the NFT to transfer in urn format.",
342
+ "description": "The id of the NFT to update in urn format.",
343
343
  "in": "path",
344
344
  "required": true,
345
345
  "schema": {
@@ -355,7 +355,7 @@
355
355
  }
356
356
  ],
357
357
  "requestBody": {
358
- "description": "Update the mutable data for the NFT.",
358
+ "description": "Request to update the mutable metadata of an NFT.",
359
359
  "required": true,
360
360
  "content": {
361
361
  "application/json": {
@@ -464,7 +464,7 @@
464
464
  }
465
465
  ],
466
466
  "requestBody": {
467
- "description": "Transfer the NFT and update the metadata.",
467
+ "description": "Request to transfer an NFT to a new owner.",
468
468
  "required": true,
469
469
  "content": {
470
470
  "application/json": {
@@ -606,7 +606,7 @@
606
606
  "required": [
607
607
  "tag"
608
608
  ],
609
- "description": "The data to be used in the minting."
609
+ "description": "The request body containing minting parameters."
610
610
  },
611
611
  "NftResolveResponse": {
612
612
  "type": "object",
@@ -635,7 +635,7 @@
635
635
  "issuerIdentityId",
636
636
  "tag"
637
637
  ],
638
- "description": "The data that was resolved."
638
+ "description": "The resolved NFT data."
639
639
  },
640
640
  "NftTransferRequest": {
641
641
  "type": "object",
@@ -651,7 +651,7 @@
651
651
  "required": [
652
652
  "recipientAddress"
653
653
  ],
654
- "description": "The data to be used in the transfer."
654
+ "description": "The request body containing transfer parameters."
655
655
  },
656
656
  "NftUpdateRequest": {
657
657
  "type": "object",
@@ -660,7 +660,7 @@
660
660
  "description": "The metadata for the NFT."
661
661
  }
662
662
  },
663
- "description": "The data to be used in the update."
663
+ "description": "The request body containing update parameters."
664
664
  }
665
665
  },
666
666
  "securitySchemes": {
@@ -46,7 +46,7 @@ Returns the class name of the component.
46
46
 
47
47
  `string`
48
48
 
49
- The class name of the component.
49
+ The class name.
50
50
 
51
51
  #### Implementation of
52
52
 
@@ -180,7 +180,7 @@ The identity to perform the nft operation with.
180
180
 
181
181
  `Promise`\<`void`\>
182
182
 
183
- Nothing.
183
+ A promise that resolves when the NFT has been permanently destroyed.
184
184
 
185
185
  #### Implementation of
186
186
 
@@ -230,7 +230,7 @@ The identity to perform the nft operation with.
230
230
 
231
231
  `Promise`\<`void`\>
232
232
 
233
- Nothing.
233
+ A promise that resolves when the NFT ownership has been transferred.
234
234
 
235
235
  #### Implementation of
236
236
 
@@ -242,7 +242,7 @@ Nothing.
242
242
 
243
243
  > **update**\<`U`\>(`id`, `metadata`, `controllerIdentity?`): `Promise`\<`void`\>
244
244
 
245
- Update the data of the NFT.
245
+ Update the mutable data of the NFT.
246
246
 
247
247
  #### Type Parameters
248
248
 
@@ -274,7 +274,7 @@ The identity to perform the nft operation with.
274
274
 
275
275
  `Promise`\<`void`\>
276
276
 
277
- Nothing.
277
+ A promise that resolves when the NFT metadata has been updated.
278
278
 
279
279
  #### Implementation of
280
280
 
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`INoContentResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A no-content response indicating the NFT was burned successfully.
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`ICreatedResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A created response containing the location header with the new NFT id.
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`INftResolveResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A response containing the resolved NFT data.
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`INoContentResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A no-content response indicating the NFT was transferred successfully.
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`INoContentResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A no-content response indicating the NFT metadata was updated successfully.
@@ -8,4 +8,4 @@ Configuration for the NFT Service.
8
8
 
9
9
  > `optional` **defaultNamespace?**: `string`
10
10
 
11
- What is the default connector to use for NFT. If not provided the first connector from the factory will be used.
11
+ The default connector namespace to use for NFT operations; defaults to the first registered connector.
@@ -1,3 +1,5 @@
1
1
  # Variable: restEntryPoints
2
2
 
3
3
  > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
4
+
5
+ REST entry point definitions for the NFT service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/nft-service",
3
- "version": "0.0.3-next.8",
3
+ "version": "0.0.3-next.9",
4
4
  "description": "NFT service orchestration with REST route generation.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/entity": "next",
21
21
  "@twin.org/nameof": "next",
22
- "@twin.org/nft-models": "0.0.3-next.8",
22
+ "@twin.org/nft-models": "0.0.3-next.9",
23
23
  "@twin.org/web": "next"
24
24
  },
25
25
  "main": "./dist/es/index.js",