[
	{
		"id": "279b35cc.5bd67a",
		"type": "subflow",
		"name": "Translate and Wait",
		"info": "\n\n### Parameters\n\n* **urn**: The design URN; returned when uploading the file to Forge. The URN needs to be safe base64 encoded.\n\n* **region** [optional, string]: Region in which to store outputs. Possible values: ```US```, ```EMEA```. By default, it is set to ```US```.\n\n* **xAdsForce** [optional, boolean]: ```true```: the endpoint replaces previously translated output file types with the newly generated derivatives\n  ```false``` (default): previously created derivatives are not replaced\n\n* **type** [optional, string]: The requested output type (default is ```svf```)\n\n* **views** [optional, string[]]: Required for ```svf``` and ```svf2``` output\n\n* **advanced** [optional: object]: A set of special options depending of the chosen format. See documentation for more details\n\n## Outputs\n\n* **response**: the final manifest\n\n* **progress**: an object containing a status and progress field.\n  * status: Overall status for translation jobs in the “manifest”. Possible values: pending, ```success```, ```inprogress```, ```failed```, ```timeout```\n  * progress: Overall progress for all translation jobs in the “manifest”. Possible values: ```complete```, ```##% complete```\n\n* **error**: an error occured\n",
		"category": "forge",
		"in": [
			{
				"x": 80,
				"y": 180,
				"wires": [
					{
						"id": "ec1ff16b.974e7"
					}
				]
			}
		],
		"out": [
			{
				"x": 920,
				"y": 520,
				"wires": [
					{
						"id": "12fb1468.5d5d8c",
						"port": 0
					}
				]
			},
			{
				"x": 920,
				"y": 660,
				"wires": [
					{
						"id": "30271f6c.8fb83",
						"port": 0
					}
				]
			},
			{
				"x": 920,
				"y": 360,
				"wires": [
					{
						"id": "12fb1468.5d5d8c",
						"port": 1
					},
					{
						"id": "779c29a9.5eaee8",
						"port": 1
					},
					{
						"id": "9f6ff471.0ae0f8",
						"port": 1
					},
					{
						"id": "230af144.090c9e",
						"port": 1
					}
				]
			}
		],
		"env": [],
		"meta": {},
		"color": "#DDAA99",
		"outputLabels": [
			"response",
			"progress",
			"error"
		],
		"icon": "node-red-node-forge/forge.png",
		"status": {
			"x": 340,
			"y": 40,
			"wires": [
				{
					"id": "4b257ec1.1b9e8",
					"port": 0
				}
			]
		}
	},
	{
		"id": "fca7e07e.5ad71",
		"type": "change",
		"z": "279b35cc.5bd67a",
		"name": "Inject",
		"rules": [
			{
				"t": "delete",
				"p": "err",
				"pt": "msg"
			},
			{
				"t": "delete",
				"p": "payload",
				"pt": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 190,
		"y": 340,
		"wires": [
			[
				"230af144.090c9e"
			]
		]
	},
	{
		"id": "230af144.090c9e",
		"type": "forge-model-derivative",
		"z": "279b35cc.5bd67a",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "Translate",
		"raw": false,
		"all": false,
		"urn": "",
		"derivativeurn": "",
		"guid": "autodesk",
		"objectid": "",
		"xAdsForce": false,
		"forceget": false,
		"rootFilename": "",
		"range": "",
		"width": 200,
		"height": 200,
		"jobs": [
			{
				"type": "svf",
				"views": [
					"2d",
					"3d"
				],
				"advanced": {
					"switchLoader": false
				}
			}
		],
		"checkReferences": false,
		"references": "[]",
		"noerr": 0,
		"ifModifiedSince": "",
		"acceptEncoding": "",
		"region": "US",
		"x": 330,
		"y": 340,
		"wires": [
			[
				"80fdacbf.20a7",
				"4db03c7e.3251b4"
			],
			[]
		]
	},
	{
		"id": "80fdacbf.20a7",
		"type": "delay",
		"z": "279b35cc.5bd67a",
		"name": "",
		"pauseType": "delay",
		"timeout": "30",
		"timeoutUnits": "seconds",
		"rate": "1",
		"nbRateUnits": "1",
		"rateUnits": "second",
		"randomFirst": "1",
		"randomLast": "5",
		"randomUnits": "seconds",
		"drop": false,
		"outputs": 1,
		"x": 500,
		"y": 400,
		"wires": [
			[
				"779c29a9.5eaee8"
			]
		]
	},
	{
		"id": "779c29a9.5eaee8",
		"type": "forge-model-derivative",
		"z": "279b35cc.5bd67a",
		"name": "Manifest",
		"topic": "",
		"forge": "",
		"operation": "GetManifest",
		"raw": false,
		"all": false,
		"urn": "",
		"derivativeurn": "",
		"guid": "autodesk",
		"objectid": "",
		"xAdsForce": false,
		"forceget": false,
		"rootFilename": "",
		"range": "",
		"width": 200,
		"height": 200,
		"jobs": [
			{
				"type": "svf",
				"views": [
					"2d",
					"3d"
				],
				"advanced": {
					"switchLoader": false
				}
			}
		],
		"checkReferences": false,
		"references": "[]",
		"noerr": 0,
		"ifModifiedSince": "",
		"acceptEncoding": "",
		"region": "US",
		"x": 680,
		"y": 420,
		"wires": [
			[
				"b40ea287.2aa9d"
			],
			[]
		]
	},
	{
		"id": "b40ea287.2aa9d",
		"type": "while-loop",
		"z": "279b35cc.5bd67a",
		"name": "Wait for Translation",
		"condi": "!['success' , 'failed', 'timeout'].includes (msg.payload.status)",
		"x": 510,
		"y": 600,
		"wires": [
			[
				"12fb1468.5d5d8c"
			],
			[
				"18ae35b7.6110ba",
				"30271f6c.8fb83"
			]
		]
	},
	{
		"id": "18ae35b7.6110ba",
		"type": "delay",
		"z": "279b35cc.5bd67a",
		"name": "",
		"pauseType": "delay",
		"timeout": "1",
		"timeoutUnits": "minutes",
		"rate": "1",
		"nbRateUnits": "1",
		"rateUnits": "second",
		"randomFirst": "1",
		"randomLast": "5",
		"randomUnits": "seconds",
		"drop": false,
		"outputs": 1,
		"x": 500,
		"y": 440,
		"wires": [
			[
				"779c29a9.5eaee8"
			]
		]
	},
	{
		"id": "12fb1468.5d5d8c",
		"type": "switch",
		"z": "279b35cc.5bd67a",
		"name": "Ready?",
		"property": "payload.status",
		"propertyType": "msg",
		"rules": [
			{
				"t": "eq",
				"v": "success",
				"vt": "str"
			},
			{
				"t": "else"
			}
		],
		"checkall": "true",
		"repair": false,
		"outputs": 2,
		"x": 760,
		"y": 520,
		"wires": [
			[
				"30271f6c.8fb83"
			],
			[]
		]
	},
	{
		"id": "4b257ec1.1b9e8",
		"type": "status",
		"z": "279b35cc.5bd67a",
		"name": "",
		"scope": null,
		"x": 180,
		"y": 40,
		"wires": [
			[]
		]
	},
	{
		"id": "ec1ff16b.974e7",
		"type": "function",
		"z": "279b35cc.5bd67a",
		"name": "Inject",
		"func": "if ( msg.err )\n    delete msg.err;\n    \n//context.set / .get\n\n// Priority: payload, msg, env, default\nmsg.urn = (msg.payload && msg.payload.urn) || msg.urn || env.get('urn');\nmsg.region = (msg.payload && msg.payload.region) || msg.region || env.get('region') || 'US';\nmsg.xAdsForce = (msg.payload && msg.payload.xAdsForce) || msg.xAdsForce || false;\nmsg.xAdsForce = msg.xAdsForce === true || msg.xAdsForce === 'true'|| msg.xAdsForce === 1 || msg.xAdsForce === '1';\nmsg.type = (msg.payload && msg.payload.type) || msg.type || env.get('type') || 'svf';\nmsg.views = (msg.payload && msg.payload.views) || msg.views || env.get('views') || [];\nmsg.advanced = (msg.payload && msg.payload.advanced) || msg.advanced || env.get('advanced') || {};\n\nnode.status ({});\nif ( !msg.urn || msg.urn === '' ) {\n    node.status ({\n        fill: 'red',\n        shape: 'dot',\n        text: 'Invalid urn!'});\n    node.error('Provide a urn!');\n    delete msg.payload;\n    msg.err ={\n        reason: \"The parameter 'urn' should be a nonempty string.\"\n    };\n}\n    \nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"initialize": "",
		"finalize": "",
		"libs": [],
		"x": 190,
		"y": 180,
		"wires": [
			[
				"9f6ff471.0ae0f8"
			]
		]
	},
	{
		"id": "9f6ff471.0ae0f8",
		"type": "switch",
		"z": "279b35cc.5bd67a",
		"name": "Params Ok?",
		"property": "err",
		"propertyType": "msg",
		"rules": [
			{
				"t": "null"
			},
			{
				"t": "else"
			}
		],
		"checkall": "true",
		"repair": false,
		"outputs": 2,
		"x": 330,
		"y": 180,
		"wires": [
			[
				"fca7e07e.5ad71"
			],
			[]
		]
	},
	{
		"id": "4db03c7e.3251b4",
		"type": "function",
		"z": "279b35cc.5bd67a",
		"name": "Requested",
		"func": "msg.payload ={\n    status: 'pending',\n    progress: '0% complete'\n};\nreturn msg;",
		"outputs": 1,
		"noerr": 0,
		"x": 550,
		"y": 300,
		"wires": [
			[
				"30271f6c.8fb83"
			]
		]
	},
	{
		"id": "30271f6c.8fb83",
		"type": "function",
		"z": "279b35cc.5bd67a",
		"name": "",
		"func": "node.status ({\n    fill: 'yellow',\n    shape: 'square',\n    text: msg.payload.progress\n});\n\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 770,
		"y": 660,
		"wires": [
			[]
		]
	},
	{
		"id": "2150cfdf.c426",
		"type": "forge-default-credentials",
		"z": "edf2853a7bab3bb6",
		"name": "Dev Credentials",
		"forge": "",
		"x": 120,
		"y": 40,
		"wires": []
	},
	{
		"id": "5ba63921.9656b8",
		"type": "forge-oss",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "CreateBucket",
		"raw": false,
		"all": false,
		"bucket": "",
		"policyKey": "persistent",
		"key": "",
		"contentType": "application/octet-stream",
		"contentDisposition": "",
		"copy": "",
		"localFilename": "",
		"limit": 10,
		"startAt": "",
		"beginsWith": "",
		"with": [],
		"ifMatch": "",
		"ifNoneMatch": "",
		"ifModifiedSince": "",
		"range": "",
		"access": "read",
		"singleUse": false,
		"minutesExpiration": 60,
		"acceptEncoding": "",
		"guid": "autodesk",
		"region": "US",
		"x": 450,
		"y": 160,
		"wires": [
			[],
			[]
		]
	},
	{
		"id": "9149a63c.ac2f98",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg = msg.payload;\nreturn msg;",
		"outputs": 1,
		"noerr": 0,
		"x": 270,
		"y": 160,
		"wires": [
			[
				"5ba63921.9656b8",
				"3d9f18a9.16fdb8"
			]
		]
	},
	{
		"id": "4fa843d2.13915c",
		"type": "debug",
		"z": "edf2853a7bab3bb6",
		"name": "Flow",
		"active": true,
		"tosidebar": true,
		"console": false,
		"tostatus": false,
		"complete": "payload",
		"targetType": "msg",
		"x": 410,
		"y": 260,
		"wires": []
	},
	{
		"id": "4ae27d7f.72cbe4",
		"type": "comment",
		"z": "edf2853a7bab3bb6",
		"name": "Setup - Readme",
		"info": "\nThe node below contains information to setup your environment.\n\n{\n    \"bucket\": \"your bucket name, should be unique\",\n    \"region\": \"US or EMEA - defines the region where you want to post the file\"\n}\n",
		"x": 120,
		"y": 120,
		"wires": []
	},
	{
		"id": "9a301ad5.f2e938",
		"type": "inject",
		"z": "edf2853a7bab3bb6",
		"name": "Settings",
		"repeat": "",
		"crontab": "",
		"once": true,
		"onceDelay": 0.1,
		"topic": "",
		"payload": "{\"bucket\":\"cyrille-models\",\"region\":\"US\"}",
		"payloadType": "json",
		"x": 120,
		"y": 160,
		"wires": [
			[
				"9149a63c.ac2f98"
			]
		]
	},
	{
		"id": "ee6d100e.76e82",
		"type": "comment",
		"z": "edf2853a7bab3bb6",
		"name": "View my file",
		"info": "",
		"x": 110,
		"y": 820,
		"wires": []
	},
	{
		"id": "e214cc43.ab46a",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "200",
		"headers": {
			"content-type": "text/html"
		},
		"x": 940,
		"y": 860,
		"wires": []
	},
	{
		"id": "c6417a14.0f41d8",
		"type": "template",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"field": "payload",
		"fieldType": "msg",
		"format": "handlebars",
		"syntax": "mustache",
		"template": "<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>Sample</title>\n\t<meta charset=\"utf-8\" />\n\n\t<!-- Autodesk Forge Viewer files -->\n\t<link rel=\"stylesheet\" href=\"https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css\"\n\t\ttype=\"text/css\">\n\t<script src=\"https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js\"></script>\n\n\t<script>\n\t\tvar viewer = null;\n\n\t\tfunction launchViewer() {\n\t\t\tconst options = {\n\t\t\t\tenv: 'AutodeskProduction',\n\t\t\t\tgetAccessToken: getForgeToken\n\t\t\t};\n\n\t\t\tAutodesk.Viewing.Initializer(options, () => {\n\t\t\t\tviewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'));\n\t\t\t\tviewer.start();\n\t\t\t\tconst documentId = 'urn:{{payload.urn}}';\n\t\t\t\tAutodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);\n\t\t\t});\n\t\t}\n\n\t\tfunction onDocumentLoadSuccess(doc) {\n\t\t\tconst viewables = doc.getRoot().getDefaultGeometry();\n\t\t\tviewer.loadDocumentNode(doc, viewables).then(i => {\n\t\t\t\t// documented loaded, any action?\n\t\t\t});\n\t\t}\n\n\t\tfunction onDocumentLoadFailure(viewerErrorCode) {\n\t\t\tconsole.error('onDocumentLoadFailure() - errorCode:' + viewerErrorCode);\n\t\t}\n\n\t\tfunction getForgeToken(callback) {\n\t\t\tfetch('/api/forge/oauth/token').then(res => {\n\t\t\t\tres.json().then(data => {\n\t\t\t\t    console.log (JSON.stringify(data));\n\t\t\t\t\tcallback(data.access_token, data.expires_in);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t</script>\n</head>\n\n<body onload=\"launchViewer()\">\n\t<div id=\"forgeViewer\"></div>\n</body>\n\n</html>",
		"output": "str",
		"x": 560,
		"y": 860,
		"wires": [
			[
				"e214cc43.ab46a"
			]
		]
	},
	{
		"id": "caea75dd.b4b8a8",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "Get Token",
		"url": "/api/forge/oauth/token",
		"method": "get",
		"upload": false,
		"swaggerDoc": "",
		"x": 100,
		"y": 900,
		"wires": [
			[
				"8d4166be.e9b458"
			]
		]
	},
	{
		"id": "a80f3d49.a05a8",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "200",
		"headers": {
			"content-type": "application/json"
		},
		"x": 940,
		"y": 900,
		"wires": []
	},
	{
		"id": "7a754831.a5eea8",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg.payload = msg.payload.token;\nreturn msg;",
		"outputs": 1,
		"noerr": 0,
		"x": 550,
		"y": 900,
		"wires": [
			[
				"a80f3d49.a05a8"
			]
		]
	},
	{
		"id": "8d4166be.e9b458",
		"type": "forge-get-token",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"topic": "",
		"forge": "",
		"x": 350,
		"y": 900,
		"wires": [
			[
				"7a754831.a5eea8"
			]
		]
	},
	{
		"id": "c6973fc2.b4f91",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "/index.html",
		"url": "/index.html",
		"method": "get",
		"upload": false,
		"swaggerDoc": "",
		"x": 100,
		"y": 860,
		"wires": [
			[
				"dbc4cb7.f1d7e38"
			]
		]
	},
	{
		"id": "69c34066.d49f9",
		"type": "comment",
		"z": "edf2853a7bab3bb6",
		"name": "Upload & Translate",
		"info": "",
		"x": 130,
		"y": 320,
		"wires": []
	},
	{
		"id": "6d04a6dc.41f4f8",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "/select.html",
		"url": "/select.html",
		"method": "get",
		"upload": false,
		"swaggerDoc": "",
		"x": 110,
		"y": 360,
		"wires": [
			[
				"3bc77a60.9a9936"
			]
		]
	},
	{
		"id": "3bc77a60.9a9936",
		"type": "template",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"field": "payload",
		"fieldType": "msg",
		"format": "handlebars",
		"syntax": "mustache",
		"template": "<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>Sample</title>\n\t<meta charset=\"utf-8\" />\n</head>\n\n<body>\n\t<form action=\"/upload2bucket\" method=\"post\" enctype=\"multipart/form-data\">\n\t    <label for=\"uploadfile\">Choose file to upload</label>\n\t    <input type=\"file\" name=\"uploadfile\" id=\"uploadfile\" /><br />\n\t    <input type=\"submit\" value=\"Upload File\" />\n\t</form>\n</body>\n\n</html>",
		"output": "str",
		"x": 500,
		"y": 360,
		"wires": [
			[
				"a106e42c.13e3c8"
			]
		]
	},
	{
		"id": "a106e42c.13e3c8",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "200",
		"headers": {
			"content-type": "text/html"
		},
		"x": 940,
		"y": 360,
		"wires": []
	},
	{
		"id": "86e4fa86.8959c8",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "/upload2bucket",
		"url": "/upload2bucket",
		"method": "post",
		"upload": true,
		"swaggerDoc": "",
		"x": 120,
		"y": 420,
		"wires": [
			[
				"6b1b3b63.ad5374",
				"678f8559.3c040c"
			]
		]
	},
	{
		"id": "6b1b3b63.ad5374",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg.payload = {\n    key: msg.req.files[0].originalname,\n    buffer: msg.req.files[0].buffer\n}\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 290,
		"y": 420,
		"wires": [
			[
				"9680e0fa.5329f"
			]
		]
	},
	{
		"id": "8db8f256.0fe12",
		"type": "forge-oss",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"topic": "",
		"forge": "",
		"operation": "PutObject",
		"raw": false,
		"all": false,
		"bucket": "",
		"policyKey": "transient",
		"key": "",
		"contentType": "application/octet-stream",
		"contentDisposition": "",
		"copy": "",
		"localFilename": "",
		"limit": 10,
		"startAt": "",
		"beginsWith": "",
		"with": null,
		"ifMatch": "",
		"ifNoneMatch": "",
		"ifModifiedSince": "",
		"range": "",
		"access": "read",
		"singleUse": false,
		"minutesExpiration": 60,
		"acceptEncoding": "",
		"guid": "autodesk",
		"region": "US",
		"x": 660,
		"y": 420,
		"wires": [
			[
				"c5971cb2.5f33c"
			],
			[
				"9477967a.d48508"
			]
		]
	},
	{
		"id": "678f8559.3c040c",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "301",
		"headers": {
			"location": "/wait.html"
		},
		"x": 300,
		"y": 480,
		"wires": []
	},
	{
		"id": "1839787b.71e508",
		"type": "subflow:279b35cc.5bd67a",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"env": [],
		"x": 630,
		"y": 540,
		"wires": [
			[
				"43fbddb9.5cdd94"
			],
			[
				"f09eeea7.ff8a8"
			],
			[
				"9477967a.d48508"
			]
		]
	},
	{
		"id": "18673a30.b074d6",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg.payload = {\n    urn: msg.payload.urn,\n    region: msg.payload.region,\n    xAdsForce: true\n}\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 310,
		"y": 540,
		"wires": [
			[
				"662aa1c3.19634"
			]
		]
	},
	{
		"id": "a3b42681.af93c8",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "Progress",
		"rules": [
			{
				"t": "set",
				"p": "progress",
				"pt": "flow",
				"to": "payload.progress",
				"tot": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 600,
		"y": 600,
		"wires": [
			[]
		]
	},
	{
		"id": "f09eeea7.ff8a8",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "if ( msg.payload.status === 'success' )\n    return ({\n        payload: {\n            progress: 100\n        }\n    });\n    \nif ( msg.payload.status === 'pending' )\n    return ({\n        payload: {\n            progress: 0\n        }\n    });\n    \n    \nif ( msg.payload.status === 'inprogress' )\n    return ({\n        payload: {   \n            progress: parseInt(msg.payload.progress)\n        }\n    });\n\nreturn ({\n    payload: {   \n        progress: -1,\n        status: msg.payload.status\n    }\n});\n",
		"outputs": 1,
		"noerr": 0,
		"x": 450,
		"y": 600,
		"wires": [
			[
				"a3b42681.af93c8"
			]
		]
	},
	{
		"id": "3d9f18a9.16fdb8",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "bucket/region on Flow",
		"rules": [
			{
				"t": "set",
				"p": "bucket",
				"pt": "flow",
				"to": "bucket",
				"tot": "msg"
			},
			{
				"t": "set",
				"p": "region",
				"pt": "flow",
				"to": "region",
				"tot": "msg"
			},
			{
				"t": "set",
				"p": "progress",
				"pt": "flow",
				"to": "0",
				"tot": "num"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 460,
		"y": 200,
		"wires": [
			[]
		]
	},
	{
		"id": "5013ad27.d539c4",
		"type": "comment",
		"z": "edf2853a7bab3bb6",
		"name": "We can ignore responses here",
		"info": "",
		"x": 700,
		"y": 160,
		"wires": []
	},
	{
		"id": "9680e0fa.5329f",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"rules": [
			{
				"t": "set",
				"p": "payload.region",
				"pt": "msg",
				"to": "region",
				"tot": "flow"
			},
			{
				"t": "set",
				"p": "payload.bucket",
				"pt": "msg",
				"to": "bucket",
				"tot": "flow"
			},
			{
				"t": "set",
				"p": "key",
				"pt": "flow",
				"to": "payload.key",
				"tot": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 460,
		"y": 420,
		"wires": [
			[
				"8db8f256.0fe12"
			]
		]
	},
	{
		"id": "c5971cb2.5f33c",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"rules": [
			{
				"t": "set",
				"p": "payload.region",
				"pt": "msg",
				"to": "region",
				"tot": "flow"
			},
			{
				"t": "set",
				"p": "urn",
				"pt": "flow",
				"to": "payload.urn",
				"tot": "msg"
			},
			{
				"t": "set",
				"p": "progress",
				"pt": "flow",
				"to": "0",
				"tot": "num"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 520,
		"y": 480,
		"wires": [
			[
				"18673a30.b074d6"
			]
		]
	},
	{
		"id": "662aa1c3.19634",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg.payload.urn = msg.payload.urn\n    .replace(/\\+/g, '-') // Convert '+' to '-'\n\t.replace(/\\//g, '_') // Convert '/' to '_'\n\t.replace(/=+$/, '')\nreturn msg;",
		"outputs": 1,
		"noerr": 0,
		"x": 450,
		"y": 540,
		"wires": [
			[
				"1839787b.71e508"
			]
		]
	},
	{
		"id": "cc7b1f4.ccc95e",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "/wait.html",
		"url": "/wait.html",
		"method": "get",
		"upload": true,
		"swaggerDoc": "",
		"x": 100,
		"y": 700,
		"wires": [
			[
				"d001296c.028b18"
			]
		]
	},
	{
		"id": "d001296c.028b18",
		"type": "template",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"field": "payload",
		"fieldType": "msg",
		"format": "handlebars",
		"syntax": "mustache",
		"template": "<!DOCTYPE html>\n<html>\n\n<head>\n\t<title>Sample</title>\n\t<meta charset=\"utf-8\" />\n\t<script>\n\t    async function wait() {\n\t        var result = await fetch('/wait');\n\t        if ( result )\n\t            result = await result.json();\n\t        else\n\t            result = { progress: -1 };\n\t        if ( !result || result.progress === -1 )\n\t            result = 'failed';\n\t        else\n\t            result = result.progress + ' %';\n\t        document.getElementById('wait').innerHTML = result;\n\t        if ( result === '100 %' )\n\t            window.location = \"/index.html\";\n\t    }\n\t    \n\t    setInterval(wait, 1000);\n\t</script>\n</head>\n\n<body>\n\t<div id=\"wait\">Waiting</div>\n</body>\n\n</html>",
		"output": "str",
		"x": 560,
		"y": 700,
		"wires": [
			[
				"b5625b21.350f48"
			]
		]
	},
	{
		"id": "b5625b21.350f48",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "200",
		"headers": {
			"content-type": "text/html"
		},
		"x": 940,
		"y": 700,
		"wires": []
	},
	{
		"id": "45ac44ae.feccdc",
		"type": "inject",
		"z": "edf2853a7bab3bb6",
		"name": "Print Flow",
		"repeat": "",
		"crontab": "",
		"once": false,
		"onceDelay": 0.1,
		"topic": "",
		"payload": "",
		"payloadType": "date",
		"x": 120,
		"y": 260,
		"wires": [
			[
				"a146d25.4c6de3"
			]
		]
	},
	{
		"id": "a146d25.4c6de3",
		"type": "function",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"func": "msg.payload = flow.get([\"bucket\", \"key\", \"region\", \"progress\", \"urn\"]);\nreturn (msg);",
		"outputs": 1,
		"noerr": 0,
		"x": 270,
		"y": 260,
		"wires": [
			[
				"4fa843d2.13915c"
			]
		]
	},
	{
		"id": "43fbddb9.5cdd94",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "Success",
		"rules": [
			{
				"t": "set",
				"p": "progress",
				"pt": "flow",
				"to": "100",
				"tot": "num"
			},
			{
				"t": "set",
				"p": "urn",
				"pt": "flow",
				"to": "payload.urn",
				"tot": "msg"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 940,
		"y": 540,
		"wires": [
			[]
		]
	},
	{
		"id": "9477967a.d48508",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "Failed",
		"rules": [
			{
				"t": "set",
				"p": "progress",
				"pt": "flow",
				"to": "-1",
				"tot": "num"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 930,
		"y": 580,
		"wires": [
			[]
		]
	},
	{
		"id": "f0a8c7fc.5ac6c8",
		"type": "http in",
		"z": "edf2853a7bab3bb6",
		"name": "/wait",
		"url": "/wait",
		"method": "get",
		"upload": true,
		"swaggerDoc": "",
		"x": 90,
		"y": 740,
		"wires": [
			[
				"bb7afe44.213e4"
			]
		]
	},
	{
		"id": "b990606b.0a031",
		"type": "http response",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"statusCode": "200",
		"headers": {
			"content-type": "application/json"
		},
		"x": 940,
		"y": 740,
		"wires": []
	},
	{
		"id": "f86cd4eb.524f08",
		"type": "template",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"field": "payload",
		"fieldType": "msg",
		"format": "handlebars",
		"syntax": "mustache",
		"template": "{ \"progress\": {{payload.progress}} }",
		"output": "str",
		"x": 560,
		"y": 740,
		"wires": [
			[
				"b990606b.0a031"
			]
		]
	},
	{
		"id": "bb7afe44.213e4",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "",
		"rules": [
			{
				"t": "set",
				"p": "payload.progress",
				"pt": "msg",
				"to": "progress",
				"tot": "flow"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 310,
		"y": 740,
		"wires": [
			[
				"f86cd4eb.524f08"
			]
		]
	},
	{
		"id": "dbc4cb7.f1d7e38",
		"type": "change",
		"z": "edf2853a7bab3bb6",
		"name": "Progress",
		"rules": [
			{
				"t": "set",
				"p": "payload.urn",
				"pt": "msg",
				"to": "urn",
				"tot": "flow"
			}
		],
		"action": "",
		"property": "",
		"from": "",
		"to": "",
		"reg": false,
		"x": 360,
		"y": 860,
		"wires": [
			[
				"c6417a14.0f41d8"
			]
		]
	}
]