Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fetch-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
fetch-api
Commits
66d1a76e
Commit
66d1a76e
authored
May 25, 2021
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sourcemap
parent
dcfdbde2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
90 deletions
+80
-90
.npmignore
.npmignore
+1
-1
index.js
out/index.js
+72
-81
index.js.map
out/index.js.map
+1
-1
object-assign-polyfill.js
out/object-assign-polyfill.js
+2
-2
package.json
package.json
+1
-1
index.ts
src/index.ts
+0
-1
tsconfig.json
tsconfig.json
+3
-3
No files found.
.npmignore
View file @
66d1a76e
# Created by .ignore support plugin (hsz.mobi)
# Created by .ignore support plugin (hsz.mobi)
/src/
/fetch-api.iml
/fetch-api.iml
out/index.js
View file @
66d1a76e
"use strict"
;
"use strict"
;
var
__createBinding
=
(
this
&&
this
.
__createBinding
)
||
(
Object
.
create
?
(
function
(
o
,
m
,
k
,
k2
)
{
if
(
k2
===
undefined
)
k2
=
k
;
Object
.
defineProperty
(
o
,
k2
,
{
enumerable
:
true
,
get
:
function
()
{
return
m
[
k
];
}
});
})
:
(
function
(
o
,
m
,
k
,
k2
)
{
if
(
k2
===
undefined
)
k2
=
k
;
o
[
k2
]
=
m
[
k
];
}));
var
__exportStar
=
(
this
&&
this
.
__exportStar
)
||
function
(
m
,
exports
)
{
for
(
var
p
in
m
)
if
(
p
!==
"default"
&&
!
Object
.
prototype
.
hasOwnProperty
.
call
(
exports
,
p
))
__createBinding
(
exports
,
m
,
p
);
};
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
fetchApi
=
exports
.
setup
=
void
0
;
exports
.
fetchApi
=
exports
.
setup
=
void
0
;
require
(
"./object-assign-polyfill"
);
require
(
"./object-assign-polyfill"
);
var
querystringify_1
=
require
(
"querystringify"
);
const
querystringify_1
=
require
(
"querystringify"
);
var
builtin_successfully_judges_1
=
require
(
"./builtin-successfully-judges"
);
const
builtin_successfully_judges_1
=
require
(
"./builtin-successfully-judges"
);
__exportStar
(
require
(
"./builtin-successfully-judges"
),
exports
);
__exportStar
(
require
(
"./builtin-successfully-judges"
),
exports
);
var
ApiError
=
(
function
(
_super
)
{
class
ApiError
extends
Error
{
__extends
(
ApiError
,
_super
);
constructor
(
name
,
code
,
message
)
{
function
ApiError
(
name
,
code
,
message
)
{
super
();
var
_this
=
_super
.
call
(
this
)
||
this
;
this
.
code
=
0
;
_this
.
code
=
0
;
this
.
details
=
''
;
_this
.
details
=
''
;
if
(
name
)
{
if
(
name
)
{
_
this
.
name
=
name
;
this
.
name
=
name
;
}
}
if
(
code
)
{
if
(
code
)
{
_
this
.
code
=
code
;
this
.
code
=
code
;
}
}
if
(
message
)
{
if
(
message
)
{
_
this
.
message
=
message
;
this
.
message
=
message
;
}
}
return
_this
;
}
}
return
ApiError
;
}
}(
Error
));
let
_options
=
{
var
_options
=
{
apiHost
:
''
,
apiHost
:
''
,
fetch
:
fetch
,
successfullyJudge
:
builtin_successfully_judges_1
.
codeOnlyMode
,
successfullyJudge
:
builtin_successfully_judges_1
.
codeOnlyMode
,
messageField
:
'msg'
,
messageField
:
'msg'
,
};
};
...
@@ -34,76 +40,61 @@ function setup(options) {
...
@@ -34,76 +40,61 @@ function setup(options) {
Object
.
assign
(
_options
,
options
);
Object
.
assign
(
_options
,
options
);
}
}
exports
.
setup
=
setup
;
exports
.
setup
=
setup
;
function
fetchApi
(
uri
,
_a
)
{
async
function
fetchApi
(
uri
,
{
host
=
''
,
params
,
headers
=
{},
method
=
'get'
,
credentials
=
'include'
,
contentType
=
'json'
,
errMessage
,
}
=
{})
{
var
_b
=
_a
===
void
0
?
{}
:
_a
,
_c
=
_b
.
host
,
host
=
_c
===
void
0
?
''
:
_c
,
params
=
_b
.
params
,
_d
=
_b
.
headers
,
headers
=
_d
===
void
0
?
{}
:
_d
,
_e
=
_b
.
method
,
method
=
_e
===
void
0
?
'get'
:
_e
,
_f
=
_b
.
credentials
,
credentials
=
_f
===
void
0
?
'include'
:
_f
,
_g
=
_b
.
contentType
,
contentType
=
_g
===
void
0
?
'json'
:
_g
,
errMessage
=
_b
.
errMessage
;
let
url
=
host
+
return
__awaiter
(
this
,
void
0
,
void
0
,
function
()
{
(
uri
.
startsWith
(
'http'
)
||
uri
.
startsWith
(
'//'
)
?
uri
:
_options
.
apiHost
+
uri
);
var
url
,
options
,
formData
,
key
,
value
,
fetchMethod
,
response
,
respText
,
jsonObj
,
e_1
;
const
options
=
{
return
__generator
(
this
,
function
(
_h
)
{
method
,
switch
(
_h
.
label
)
{
headers
:
Object
.
assign
({},
headers
),
case
0
:
credentials
,
url
=
host
+
};
(
uri
.
startsWith
(
'http'
)
||
uri
.
startsWith
(
'//'
)
?
uri
:
_options
.
apiHost
+
uri
);
if
(
params
)
{
options
=
{
if
(
method
.
toLowerCase
()
===
'post'
)
{
method
:
method
,
switch
(
contentType
)
{
headers
:
__assign
({},
headers
),
case
'form-data'
:
credentials
:
credentials
,
let
formData
=
new
FormData
();
};
for
(
let
key
in
params
)
{
if
(
params
)
{
let
value
=
params
[
key
];
if
(
method
.
toLowerCase
()
===
'post'
)
{
if
(
value
instanceof
File
)
{
switch
(
contentType
)
{
formData
.
append
(
key
,
value
,
value
.
name
);
case
'form-data'
:
formData
=
new
FormData
();
for
(
key
in
params
)
{
value
=
params
[
key
];
if
(
value
instanceof
File
)
{
formData
.
append
(
key
,
value
,
value
.
name
);
}
else
{
formData
.
append
(
key
,
value
);
}
}
options
.
body
=
formData
;
break
;
case
'form'
:
options
.
headers
[
'Content-Type'
]
=
'application/x-www-form-urlencoded'
;
options
.
body
=
querystringify_1
.
stringify
(
params
);
break
;
case
'json'
:
options
.
headers
[
'Content-Type'
]
=
'application/json'
;
options
.
body
=
JSON
.
stringify
(
params
);
break
;
}
}
}
else
{
else
{
url
+=
url
.
indexOf
(
'?'
)
<
0
?
'?'
:
''
;
formData
.
append
(
key
,
value
);
url
+=
(
url
.
endsWith
(
'?'
)
?
''
:
'&'
)
+
querystringify_1
.
stringify
(
params
);
}
}
}
}
_h
.
label
=
1
;
options
.
body
=
formData
;
case
1
:
break
;
_h
.
trys
.
push
([
1
,
4
,
,
5
]);
case
'form'
:
fetchMethod
=
_options
.
fetch
;
options
.
headers
[
'Content-Type'
]
=
'application/x-www-form-urlencoded'
;
return
[
4
,
fetchMethod
(
url
,
options
)];
options
.
body
=
querystringify_1
.
stringify
(
params
);
case
2
:
break
;
response
=
_h
.
sent
();
case
'json'
:
return
[
4
,
response
.
text
()];
options
.
headers
[
'Content-Type'
]
=
'application/json'
;
case
3
:
options
.
body
=
JSON
.
stringify
(
params
);
respText
=
_h
.
sent
();
break
;
if
(
response
.
status
===
310
)
{
location
.
href
=
respText
;
}
jsonObj
=
JSON
.
parse
(
respText
);
if
(
_options
.
successfullyJudge
(
jsonObj
))
{
return
[
2
,
jsonObj
.
data
];
}
return
[
2
,
Promise
.
reject
(
new
ApiError
(
'call api failed'
,
jsonObj
.
code
,
errMessage
||
jsonObj
[
_options
.
messageField
]))];
case
4
:
e_1
=
_h
.
sent
();
return
[
2
,
Promise
.
reject
(
e_1
)];
case
5
:
return
[
2
];
}
}
});
}
});
else
{
url
+=
url
.
indexOf
(
'?'
)
<
0
?
'?'
:
''
;
url
+=
(
url
.
endsWith
(
'?'
)
?
''
:
'&'
)
+
querystringify_1
.
stringify
(
params
);
}
}
try
{
let
fetchMethod
=
_options
.
fetch
;
const
response
=
await
fetchMethod
(
url
,
options
);
const
respText
=
await
response
.
text
();
if
(
response
.
status
===
310
)
{
location
.
href
=
respText
;
}
let
jsonObj
=
JSON
.
parse
(
respText
);
if
(
_options
.
successfullyJudge
(
jsonObj
))
{
return
jsonObj
.
data
;
}
return
Promise
.
reject
(
new
ApiError
(
'call api failed'
,
jsonObj
.
code
,
errMessage
||
jsonObj
[
_options
.
messageField
]));
}
catch
(
e
)
{
return
Promise
.
reject
(
e
);
}
}
}
exports
.
fetchApi
=
fetchApi
;
exports
.
fetchApi
=
fetchApi
;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
\ No newline at end of file
out/index.js.map
View file @
66d1a76e
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAMA,oCAAiC;AACjC,iDAAyC;AACzC,6EAA0D;AAE1D,gEAA8C;AAK9C;IAAuB,4BAAK;IAI3B,kBAAY,IAAY,EAAE,IAAa,EAAE,OAAgB;QAAzD,YACC,iBAAO,SAWP;QAfD,UAAI,GAAW,CAAC,CAAC;QACjB,aAAO,GAAW,EAAE,CAAC;QAKpB,IAAI,IAAI,EAAE;YACT,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACjB;QACD,IAAI,IAAI,EAAE;YACT,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SACjB;QACD,IAAI,OAAO,EAAE;YACZ,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;SACvB;;IACF,CAAC;IACF,eAAC;AAAD,CAAC,AAjBD,CAAuB,KAAK,GAiB3B;AAqDD,IAAI,QAAQ,GAAiB;IAC5B,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;IACZ,iBAAiB,EAAE,0CAAY;IAC/B,YAAY,EAAE,KAAK;CACnB,CAAC;AAMF,SAAgB,KAAK,CAAC,OAAqB;IAC1C,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,C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G,0BAAS,CAAC,MAAM,CAAC,CAAC;SAC1D;KACD;IAED,IAAI;QACH,IAAI,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC;QACjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEvC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAE5B,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;SACzB;QAED,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE;YACxC,OAAO,OAAO,CAAC,IAAI,CAAC;SACpB;QAED,OAAO,OAAO,CAAC,MAAM,CACpB,IAAI,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC,IAAI,EAAE,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAC3F,CAAC;KACF;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACzB;AACF,CAAC;AAxED,4BAwEC"}
\ No newline at end of file
\ No newline at end of file
out/object-assign-polyfill.js
View file @
66d1a76e
...
@@ -5,11 +5,11 @@ if (typeof Object.assign != 'function') {
...
@@ -5,11 +5,11 @@ if (typeof Object.assign != 'function') {
if
(
target
==
null
)
{
if
(
target
==
null
)
{
throw
new
TypeError
(
'Cannot convert undefined or null to object'
);
throw
new
TypeError
(
'Cannot convert undefined or null to object'
);
}
}
var
to
=
Object
(
target
);
let
to
=
Object
(
target
);
for
(
var
index
=
1
;
index
<
arguments
.
length
;
index
++
)
{
for
(
var
index
=
1
;
index
<
arguments
.
length
;
index
++
)
{
var
nextSource
=
arguments
[
index
];
var
nextSource
=
arguments
[
index
];
if
(
nextSource
!=
null
)
{
if
(
nextSource
!=
null
)
{
for
(
var
nextKey
in
nextSource
)
{
for
(
let
nextKey
in
nextSource
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
nextSource
,
nextKey
))
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
nextSource
,
nextKey
))
{
to
[
nextKey
]
=
nextSource
[
nextKey
];
to
[
nextKey
]
=
nextSource
[
nextKey
];
}
}
...
...
package.json
View file @
66d1a76e
{
{
"name"
:
"fetch-api"
,
"name"
:
"fetch-api"
,
"version"
:
"1.0.
2
"
,
"version"
:
"1.0.
5
"
,
"main"
:
"out/index.js"
,
"main"
:
"out/index.js"
,
"types"
:
"out/index.d.ts"
,
"types"
:
"out/index.d.ts"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/index.ts
View file @
66d1a76e
...
@@ -85,7 +85,6 @@ interface FetchApiOptions {
...
@@ -85,7 +85,6 @@ interface FetchApiOptions {
let
_options
:
SetupOptions
=
{
let
_options
:
SetupOptions
=
{
apiHost
:
''
,
apiHost
:
''
,
fetch
:
fetch
,
successfullyJudge
:
codeOnlyMode
,
successfullyJudge
:
codeOnlyMode
,
messageField
:
'msg'
,
messageField
:
'msg'
,
};
};
...
...
tsconfig.json
View file @
66d1a76e
{
{
"compilerOptions"
:
{
"compilerOptions"
:
{
"target"
:
"ES
5
"
,
"target"
:
"ES
2017
"
,
"noImplicitAny"
:
false
,
"noImplicitAny"
:
false
,
"removeComments"
:
true
,
"removeComments"
:
true
,
"noEmitOnError"
:
true
,
"noEmitOnError"
:
true
,
"noEmitHelpers"
:
tru
e
,
"noEmitHelpers"
:
fals
e
,
"module"
:
"
commonjs
"
,
"module"
:
"
CommonJS
"
,
"experimentalDecorators"
:
true
,
"experimentalDecorators"
:
true
,
"sourceMap"
:
true
,
"sourceMap"
:
true
,
"outDir"
:
"out/"
,
"outDir"
:
"out/"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment