重构了云函数

This commit is contained in:
2025-10-19 20:10:19 +08:00
parent cfb6819bc7
commit 1c40c10210
1942 changed files with 363888 additions and 435 deletions

View File

@@ -0,0 +1,13 @@
Copyright (c) 2015, Ahmad Nassri <ahmad@ahmadnassri.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,49 @@
# HAR Schema [![version][npm-version]][npm-url] [![License][npm-license]][license-url]
> JSON Schema for HTTP Archive ([HAR][spec]).
[![Build Status][travis-image]][travis-url]
[![Downloads][npm-downloads]][npm-url]
[![Code Climate][codeclimate-quality]][codeclimate-url]
[![Coverage Status][codeclimate-coverage]][codeclimate-url]
[![Dependency Status][dependencyci-image]][dependencyci-url]
[![Dependencies][david-image]][david-url]
## Install
```bash
npm install --only=production --save har-schema
```
## Usage
Compatible with any [JSON Schema validation tool][validator].
----
> :copyright: [ahmadnassri.com](https://www.ahmadnassri.com/) &nbsp;&middot;&nbsp;
> License: [ISC][license-url] &nbsp;&middot;&nbsp;
> Github: [@ahmadnassri](https://github.com/ahmadnassri) &nbsp;&middot;&nbsp;
> Twitter: [@ahmadnassri](https://twitter.com/ahmadnassri)
[license-url]: http://choosealicense.com/licenses/isc/
[travis-url]: https://travis-ci.org/ahmadnassri/har-schema
[travis-image]: https://img.shields.io/travis/ahmadnassri/har-schema.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/har-schema
[npm-license]: https://img.shields.io/npm/l/har-schema.svg?style=flat-square
[npm-version]: https://img.shields.io/npm/v/har-schema.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/har-schema.svg?style=flat-square
[codeclimate-url]: https://codeclimate.com/github/ahmadnassri/har-schema
[codeclimate-quality]: https://img.shields.io/codeclimate/github/ahmadnassri/har-schema.svg?style=flat-square
[codeclimate-coverage]: https://img.shields.io/codeclimate/coverage/github/ahmadnassri/har-schema.svg?style=flat-square
[david-url]: https://david-dm.org/ahmadnassri/har-schema
[david-image]: https://img.shields.io/david/ahmadnassri/har-schema.svg?style=flat-square
[dependencyci-url]: https://dependencyci.com/github/ahmadnassri/har-schema
[dependencyci-image]: https://dependencyci.com/github/ahmadnassri/har-schema/badge?style=flat-square
[spec]: https://github.com/ahmadnassri/har-spec/blob/master/versions/1.2.md
[validator]: https://github.com/ahmadnassri/har-validator

View File

@@ -0,0 +1,30 @@
{
"$id": "afterRequest.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"optional": true,
"required": [
"lastAccess",
"eTag",
"hitCount"
],
"properties": {
"expires": {
"type": "string",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?"
},
"lastAccess": {
"type": "string",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?"
},
"eTag": {
"type": "string"
},
"hitCount": {
"type": "integer"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,30 @@
{
"$id": "beforeRequest.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"optional": true,
"required": [
"lastAccess",
"eTag",
"hitCount"
],
"properties": {
"expires": {
"type": "string",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?"
},
"lastAccess": {
"type": "string",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))?"
},
"eTag": {
"type": "string"
},
"hitCount": {
"type": "integer"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,20 @@
{
"$id": "browser.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"name",
"version"
],
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,21 @@
{
"$id": "cache.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"properties": {
"beforeRequest": {
"oneOf": [
{ "type": "null" },
{ "$ref": "beforeRequest.json#" }
]
},
"afterRequest": {
"oneOf": [
{ "type": "null" },
{ "$ref": "afterRequest.json#" }
]
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,29 @@
{
"$id": "content.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"size",
"mimeType"
],
"properties": {
"size": {
"type": "integer"
},
"compression": {
"type": "integer"
},
"mimeType": {
"type": "string"
},
"text": {
"type": "string"
},
"encoding": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,36 @@
{
"$id": "cookie.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"name",
"value"
],
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"path": {
"type": "string"
},
"domain": {
"type": "string"
},
"expires": {
"type": ["string", "null"],
"format": "date-time"
},
"httpOnly": {
"type": "boolean"
},
"secure": {
"type": "boolean"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,20 @@
{
"$id": "creator.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"name",
"version"
],
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,53 @@
{
"$id": "entry.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"optional": true,
"required": [
"startedDateTime",
"time",
"request",
"response",
"cache",
"timings"
],
"properties": {
"pageref": {
"type": "string"
},
"startedDateTime": {
"type": "string",
"format": "date-time",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))"
},
"time": {
"type": "number",
"min": 0
},
"request": {
"$ref": "request.json#"
},
"response": {
"$ref": "response.json#"
},
"cache": {
"$ref": "cache.json#"
},
"timings": {
"$ref": "timings.json#"
},
"serverIPAddress": {
"type": "string",
"oneOf": [
{ "format": "ipv4" },
{ "format": "ipv6" }
]
},
"connection": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,13 @@
{
"$id": "har.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"log"
],
"properties": {
"log": {
"$ref": "log.json#"
}
}
}

View File

@@ -0,0 +1,20 @@
{
"$id": "header.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"name",
"value"
],
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,22 @@
'use strict'
module.exports = {
afterRequest: require('./afterRequest.json'),
beforeRequest: require('./beforeRequest.json'),
browser: require('./browser.json'),
cache: require('./cache.json'),
content: require('./content.json'),
cookie: require('./cookie.json'),
creator: require('./creator.json'),
entry: require('./entry.json'),
har: require('./har.json'),
header: require('./header.json'),
log: require('./log.json'),
page: require('./page.json'),
pageTimings: require('./pageTimings.json'),
postData: require('./postData.json'),
query: require('./query.json'),
request: require('./request.json'),
response: require('./response.json'),
timings: require('./timings.json')
}

View File

@@ -0,0 +1,36 @@
{
"$id": "log.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"version",
"creator",
"entries"
],
"properties": {
"version": {
"type": "string"
},
"creator": {
"$ref": "creator.json#"
},
"browser": {
"$ref": "browser.json#"
},
"pages": {
"type": "array",
"items": {
"$ref": "page.json#"
}
},
"entries": {
"type": "array",
"items": {
"$ref": "entry.json#"
}
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,32 @@
{
"$id": "page.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"optional": true,
"required": [
"startedDateTime",
"id",
"title",
"pageTimings"
],
"properties": {
"startedDateTime": {
"type": "string",
"format": "date-time",
"pattern": "^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))"
},
"id": {
"type": "string",
"unique": true
},
"title": {
"type": "string"
},
"pageTimings": {
"$ref": "pageTimings.json#"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,18 @@
{
"$id": "pageTimings.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"properties": {
"onContentLoad": {
"type": "number",
"min": -1
},
"onLoad": {
"type": "number",
"min": -1
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,43 @@
{
"$id": "postData.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"optional": true,
"required": [
"mimeType"
],
"properties": {
"mimeType": {
"type": "string"
},
"text": {
"type": "string"
},
"params": {
"type": "array",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"fileName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"comment": {
"type": "string"
}
}
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,20 @@
{
"$id": "query.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"name",
"value"
],
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,57 @@
{
"$id": "request.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"method",
"url",
"httpVersion",
"cookies",
"headers",
"queryString",
"headersSize",
"bodySize"
],
"properties": {
"method": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"httpVersion": {
"type": "string"
},
"cookies": {
"type": "array",
"items": {
"$ref": "cookie.json#"
}
},
"headers": {
"type": "array",
"items": {
"$ref": "header.json#"
}
},
"queryString": {
"type": "array",
"items": {
"$ref": "query.json#"
}
},
"postData": {
"$ref": "postData.json#"
},
"headersSize": {
"type": "integer"
},
"bodySize": {
"type": "integer"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,54 @@
{
"$id": "response.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "object",
"required": [
"status",
"statusText",
"httpVersion",
"cookies",
"headers",
"content",
"redirectURL",
"headersSize",
"bodySize"
],
"properties": {
"status": {
"type": "integer"
},
"statusText": {
"type": "string"
},
"httpVersion": {
"type": "string"
},
"cookies": {
"type": "array",
"items": {
"$ref": "cookie.json#"
}
},
"headers": {
"type": "array",
"items": {
"$ref": "header.json#"
}
},
"content": {
"$ref": "content.json#"
},
"redirectURL": {
"type": "string"
},
"headersSize": {
"type": "integer"
},
"bodySize": {
"type": "integer"
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,42 @@
{
"$id": "timings.json#",
"$schema": "http://json-schema.org/draft-06/schema#",
"required": [
"send",
"wait",
"receive"
],
"properties": {
"dns": {
"type": "number",
"min": -1
},
"connect": {
"type": "number",
"min": -1
},
"blocked": {
"type": "number",
"min": -1
},
"send": {
"type": "number",
"min": -1
},
"wait": {
"type": "number",
"min": -1
},
"receive": {
"type": "number",
"min": -1
},
"ssl": {
"type": "number",
"min": -1
},
"comment": {
"type": "string"
}
}
}

View File

@@ -0,0 +1,54 @@
{
"version": "2.0.0",
"name": "har-schema",
"description": "JSON Schema for HTTP Archive (HAR)",
"author": "Ahmad Nassri <ahmad@ahmadnassri.com> (https://www.ahmadnassri.com/)",
"contributors": [
"Evgeny Poberezkin <e.poberezkin@me.com>"
],
"homepage": "https://github.com/ahmadnassri/har-schema",
"repository": {
"type": "git",
"url": "https://github.com/ahmadnassri/har-schema.git"
},
"license": "ISC",
"main": "lib/index.js",
"keywords": [
"har",
"http",
"archive",
"JSON",
"schema",
"JSON-schema"
],
"engines": {
"node": ">=4"
},
"files": [
"lib"
],
"bugs": {
"url": "https://github.com/ahmadnassri/har-schema/issues"
},
"scripts": {
"test": "tap test --reporter spec",
"pretest": "snazzy && echint",
"coverage": "tap test --reporter silent --coverage",
"codeclimate": "tap --coverage-report=text-lcov | codeclimate-test-reporter",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"devDependencies": {
"ajv": "^5.0.0",
"codeclimate-test-reporter": "^0.4.0",
"cz-conventional-changelog": "^1.2.0",
"echint": "^2.1.0",
"semantic-release": "^6.3.2",
"snazzy": "^5.0.0",
"tap": "^8.0.1"
}
}