234 attempt to fix js error Uncaught SyntaxError: Unexpected identifier 'hidden'

This commit is contained in:
2026-04-27 17:57:24 +03:00
parent 8a32a0d5f0
commit 74c073bd7e
149 changed files with 14361 additions and 8886 deletions
+22 -22
View File
@@ -12,7 +12,7 @@ The REST Web Service framework for ColdFusion and Railo
**Application.cfc:**
```js
```cfscript
component extends="taffy.core.api" {}
```
@@ -24,7 +24,7 @@ component extends="taffy.core.api" {}
**/resources/hello.cfc:**
```js
```cfscript
component extends="taffy.core.resource" taffy_uri="/hello" {
function get(){
@@ -77,13 +77,13 @@ You can see that the taffy folder is a sibling to Application.cfc. This allows A
Next, if your Application.cfc and `/resources/` folder aren't in the web-root (e.g. they're inside something like `/api/`) then you'll need to add an [application-specific mapping](http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=appFramework_04.html) for `/resources` so that Taffy can find your resources to initialize the routes.
```js
```cfscript
this.mappings["/resources"] = expandPath("./resources");
```
You'll also need to add a mapping for `/taffy` so that the resources can extend `taffy.core.resource` (since the taffy folder isn't a child of the resources folder):
```js
```cfscript
this.mappings["/taffy"] = expandPath("./taffy");
```
@@ -132,7 +132,7 @@ In the xml above you can see that I only have 1 wildcard, but to compensate I've
Taffy allows for setting the HTTP status message using [.withStatus()](#withstatus), such as:
```js
```cfscript
return representationOf({...}).withStatus(403, "Not Authorized");
```
@@ -200,7 +200,7 @@ The **taffy:uri** property applies to the `<cfcomponent>` tag or the `component{
or
```js
```cfscript
component taffy_uri="/artist/{artistId}" {
}
```
@@ -231,7 +231,7 @@ By convention, resources will automatically map the 4 primary HTTP REST verbs --
or
```js
```cfscript
function getUser( numeric userId ) taffy_verb="get" {
}
```
@@ -251,7 +251,7 @@ By convention, the mime-types supported by your API are determined by the method
or
```js
```cfscript
function getAsJson() taffy_mime="application/json" {
}
```
@@ -270,7 +270,7 @@ When your API supports more than one data format (i.e. json and xml), you must s
or
```js
```cfscript
function getAsJson() taffy_mime="application/json" taffy_default="true" {}
function getAsXml() taffy_mime="application/xml" {}
@@ -280,7 +280,7 @@ function getAsXml() taffy_mime="application/xml" {}
Default values:
```js
```cfscript
variables.framework = {
reloadKey = "reload",
reloadPassword = "true",
@@ -500,7 +500,7 @@ Taffy calls this method during initialization to determine in which configured e
The returned value will be used to load environment-specific configuration. For example, if you have the following code in your Application.cfc, then the dashboard will be disabled in production:
```js
```cfscript
variables.framework = {
disableDashboard = false
@@ -542,13 +542,13 @@ This method is optional, and allows you to inspect and potentially abort an API
If you do not return TRUE, allowing the request to continue as normal, then Taffy expects you to return a **[representation](#custom-representation-classes)** (either the default class, or a custom one) that it should immediately return to the consumer, serialized to the appropriate format. If you simply want to return with a status code of 403 (which indicates "Not Allowed"), you could do this:
```js
```cfscript
return newRepresentation().noData().withStatus(403);
```
Alternately, you could return some data to indicate that they owe you money or something:
```js
```cfscript
return newRepresentation()
.setData({error="Your account is past due. Please email accounts payable."})
.withStatus(403);
@@ -558,7 +558,7 @@ The options here are limited only by your imagination.
You can add data to the **requestArguments** structure and this will be passed on to any resource that handles the request. Simply add a key to the structure:
```js
```cfscript
function onTaffyRequest(verb, cfc, requestArguments, mimeExt, headers) {
arguments.requestArguments.myData = "myvalue";
return true;
@@ -567,7 +567,7 @@ function onTaffyRequest(verb, cfc, requestArguments, mimeExt, headers) {
In your resource:
```js
```cfscript
function get(myData) {
//arguments.myData => "myValue"
}
@@ -575,13 +575,13 @@ function get(myData) {
You can use the method metadata for anything you see fit; but the original use case was for role-based security. Consider the following resource method:
```js
```cfscript
public function getData( id ) taffy_method="get" role="datareader" { ... }
```
Taffy doesn't do anything with the **role** metadata on this method other than expose it to you in onTaffyRequest. So let's use the user's API key to find out what roles they have, and verify that the method's required role is among them. This is a snippet from your Application.cfc:
```js
```cfscript
function onTaffyRequest(verb, cfc, requestArgs, mime, head, methodMetadata){
local.user = (...); //get user from api key...
@@ -611,7 +611,7 @@ Resource CFCs extend `taffy.core.resource`. The following methods are available
This method allows you to specify that there is no data to be returned for the current request. Generally, you would use it in conjunction with the **withStatus** method to set a specific return status for the request. For example, if the requested resource doesn't exist, you could return a 404 error like so:
```js
```cfscript
return noData().withStatus(404);
```
@@ -671,7 +671,7 @@ Use this method in place of `representationOf()` to return a stream of binary da
Use this method in place of `representationOf()` to stream a file from disk (or VFS). Optionally append `.andDelete( true )` to delete the file once streaming is complete.
```js
```cfscript
return streamFile("/foo.txt").andDelete(true);
```
@@ -693,7 +693,7 @@ Use this method in place of `representationOf()` to stream an image from disk (o
This special method _**requires**_ the use of either **noData** or **representationOf**. It adds custom headers to the return. Additional use of **withStatus** optional.
```js
```cfscript
return representationOf(myData).withHeaders({"X-POWERED-BY"="Taffy 2.0!"});
```
@@ -706,7 +706,7 @@ return representationOf(myData).withHeaders({"X-POWERED-BY"="Taffy 2.0!"});
This special method _**requires**_ the use of either **streamFile** or **streamBinary**. It overrides the default mime type header for the return.
```js
```cfscript
return streamFile("kittens/cuteness.pdf").withMime("application/pdf");
```
@@ -722,7 +722,7 @@ This special method _**requires**_ the use of either **noData** or **representat
_If you do not specify a return status code, Taffy will always return status code 200 (OK) by default._
```js
```cfscript
return noData().withStatus(404, "Not Found");
```