@atxp/client 0.2.21 → 0.3.0
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.
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/ajv.js +8 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/cache.js +4 -0
- package/dist/_virtual/cache.js.map +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/uri.all.js +4 -0
- package/dist/_virtual/uri.all.js.map +1 -0
- package/dist/atxpAccount.js +4 -2
- package/dist/atxpAccount.js.map +1 -1
- package/dist/atxpClient.js +12 -10
- package/dist/atxpClient.js.map +1 -1
- package/dist/atxpFetcher.js +10 -8
- package/dist/atxpFetcher.js.map +1 -1
- package/dist/baseAccount.js +5 -3
- package/dist/baseAccount.js.map +1 -1
- package/dist/baseConstants.js +4 -0
- package/dist/baseConstants.js.map +1 -0
- package/dist/basePaymentMaker.js +15 -12
- package/dist/basePaymentMaker.js.map +1 -1
- package/dist/index.cjs +15595 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +250 -10
- package/dist/index.js +15558 -10
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +398 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +273 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +378 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js +46 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +120 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +380 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1254 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/ajv/lib/ajv.js +531 -0
- package/dist/node_modules/ajv/lib/ajv.js.map +1 -0
- package/dist/node_modules/ajv/lib/cache.js +37 -0
- package/dist/node_modules/ajv/lib/cache.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/async.js +102 -0
- package/dist/node_modules/ajv/lib/compile/async.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/error_classes.js +46 -0
- package/dist/node_modules/ajv/lib/compile/error_classes.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/formats.js +154 -0
- package/dist/node_modules/ajv/lib/compile/formats.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/index.js +404 -0
- package/dist/node_modules/ajv/lib/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/resolve.js +286 -0
- package/dist/node_modules/ajv/lib/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/rules.js +79 -0
- package/dist/node_modules/ajv/lib/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/schema_obj.js +21 -0
- package/dist/node_modules/ajv/lib/compile/schema_obj.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/ucs2length.js +30 -0
- package/dist/node_modules/ajv/lib/compile/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/lib/compile/util.js +252 -0
- package/dist/node_modules/ajv/lib/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/lib/data.js +59 -0
- package/dist/node_modules/ajv/lib/data.js.map +1 -0
- package/dist/node_modules/ajv/lib/definition_schema.js +49 -0
- package/dist/node_modules/ajv/lib/definition_schema.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limit.js +173 -0
- package/dist/node_modules/ajv/lib/dotjs/_limit.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitItems.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +95 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitLength.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/allOf.js +52 -0
- package/dist/node_modules/ajv/lib/dotjs/allOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/anyOf.js +83 -0
- package/dist/node_modules/ajv/lib/dotjs/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/comment.js +24 -0
- package/dist/node_modules/ajv/lib/dotjs/comment.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/const.js +62 -0
- package/dist/node_modules/ajv/lib/dotjs/const.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/contains.js +91 -0
- package/dist/node_modules/ajv/lib/dotjs/contains.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/custom.js +238 -0
- package/dist/node_modules/ajv/lib/dotjs/custom.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/dependencies.js +178 -0
- package/dist/node_modules/ajv/lib/dotjs/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/enum.js +72 -0
- package/dist/node_modules/ajv/lib/dotjs/enum.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/format.js +160 -0
- package/dist/node_modules/ajv/lib/dotjs/format.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/if.js +113 -0
- package/dist/node_modules/ajv/lib/dotjs/if.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/index.js +68 -0
- package/dist/node_modules/ajv/lib/dotjs/index.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/items.js +150 -0
- package/dist/node_modules/ajv/lib/dotjs/items.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +90 -0
- package/dist/node_modules/ajv/lib/dotjs/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/not.js +94 -0
- package/dist/node_modules/ajv/lib/dotjs/not.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/oneOf.js +83 -0
- package/dist/node_modules/ajv/lib/dotjs/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/pattern.js +85 -0
- package/dist/node_modules/ajv/lib/dotjs/pattern.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/properties.js +345 -0
- package/dist/node_modules/ajv/lib/dotjs/properties.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +91 -0
- package/dist/node_modules/ajv/lib/dotjs/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/ref.js +134 -0
- package/dist/node_modules/ajv/lib/dotjs/ref.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/required.js +276 -0
- package/dist/node_modules/ajv/lib/dotjs/required.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +96 -0
- package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv/lib/dotjs/validate.js +492 -0
- package/dist/node_modules/ajv/lib/dotjs/validate.js.map +1 -0
- package/dist/node_modules/ajv/lib/keyword.js +159 -0
- package/dist/node_modules/ajv/lib/keyword.js.map +1 -0
- package/dist/node_modules/ajv/lib/refs/data.json.js +33 -0
- package/dist/node_modules/ajv/lib/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js +254 -0
- package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/eventsource-parser/dist/index.js +104 -0
- package/dist/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/dist/node_modules/eventsource-parser/dist/stream.js +28 -0
- package/dist/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +56 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-json-stable-stringify/index.js +69 -0
- package/dist/node_modules/fast-json-stable-stringify/index.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +100 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/pkce-challenge/dist/index.browser.js +66 -0
- package/dist/node_modules/pkce-challenge/dist/index.browser.js.map +1 -0
- package/dist/node_modules/uri-js/dist/es5/uri.all.js +1418 -0
- package/dist/node_modules/uri-js/dist/es5/uri.all.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/ZodError.js +132 -0
- package/dist/node_modules/zod/dist/esm/v3/ZodError.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/errors.js +9 -0
- package/dist/node_modules/zod/dist/esm/v3/errors.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/errorUtil.js +9 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/parseUtil.js +112 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/util.js +136 -0
- package/dist/node_modules/zod/dist/esm/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/locales/en.js +110 -0
- package/dist/node_modules/zod/dist/esm/v3/locales/en.js.map +1 -0
- package/dist/node_modules/zod/dist/esm/v3/types.js +3488 -0
- package/dist/node_modules/zod/dist/esm/v3/types.js.map +1 -0
- package/dist/oAuth.js +7 -6
- package/dist/oAuth.js.map +1 -1
- package/dist/solanaAccount.js +7 -4
- package/dist/solanaAccount.js.map +1 -1
- package/dist/solanaPaymentMaker.js +15 -12
- package/dist/solanaPaymentMaker.js.map +1 -1
- package/dist/types.js +5 -3
- package/dist/types.js.map +1 -1
- package/package.json +26 -10
- package/dist/atxpAccount.d.ts +0 -13
- package/dist/atxpAccount.d.ts.map +0 -1
- package/dist/atxpClient.d.ts +0 -14
- package/dist/atxpClient.d.ts.map +0 -1
- package/dist/atxpFetcher.d.ts +0 -72
- package/dist/atxpFetcher.d.ts.map +0 -1
- package/dist/baseAccount.d.ts +0 -10
- package/dist/baseAccount.d.ts.map +0 -1
- package/dist/basePaymentMaker.d.ts +0 -16
- package/dist/basePaymentMaker.d.ts.map +0 -1
- package/dist/clientTestHelpers.d.ts +0 -6
- package/dist/clientTestHelpers.d.ts.map +0 -1
- package/dist/clientTestHelpers.js +0 -94
- package/dist/clientTestHelpers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/oAuth.d.ts +0 -44
- package/dist/oAuth.d.ts.map +0 -1
- package/dist/setup.expo.d.ts +0 -2
- package/dist/setup.expo.d.ts.map +0 -1
- package/dist/setup.expo.js +0 -30
- package/dist/setup.expo.js.map +0 -1
- package/dist/solanaAccount.d.ts +0 -9
- package/dist/solanaAccount.d.ts.map +0 -1
- package/dist/solanaPaymentMaker.d.ts +0 -18
- package/dist/solanaPaymentMaker.d.ts.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { __require as requireCustom } from './dotjs/custom.js';
|
|
2
|
+
import { __require as requireDefinition_schema } from './definition_schema.js';
|
|
3
|
+
|
|
4
|
+
var keyword;
|
|
5
|
+
var hasRequiredKeyword;
|
|
6
|
+
|
|
7
|
+
function requireKeyword () {
|
|
8
|
+
if (hasRequiredKeyword) return keyword;
|
|
9
|
+
hasRequiredKeyword = 1;
|
|
10
|
+
|
|
11
|
+
var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
|
|
12
|
+
var customRuleCode = requireCustom();
|
|
13
|
+
var definitionSchema = requireDefinition_schema();
|
|
14
|
+
|
|
15
|
+
keyword = {
|
|
16
|
+
add: addKeyword,
|
|
17
|
+
get: getKeyword,
|
|
18
|
+
remove: removeKeyword,
|
|
19
|
+
validate: validateKeyword
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Define custom keyword
|
|
25
|
+
* @this Ajv
|
|
26
|
+
* @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).
|
|
27
|
+
* @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
|
|
28
|
+
* @return {Ajv} this for method chaining
|
|
29
|
+
*/
|
|
30
|
+
function addKeyword(keyword, definition) {
|
|
31
|
+
/* jshint validthis: true */
|
|
32
|
+
/* eslint no-shadow: 0 */
|
|
33
|
+
var RULES = this.RULES;
|
|
34
|
+
if (RULES.keywords[keyword])
|
|
35
|
+
throw new Error('Keyword ' + keyword + ' is already defined');
|
|
36
|
+
|
|
37
|
+
if (!IDENTIFIER.test(keyword))
|
|
38
|
+
throw new Error('Keyword ' + keyword + ' is not a valid identifier');
|
|
39
|
+
|
|
40
|
+
if (definition) {
|
|
41
|
+
this.validateKeyword(definition, true);
|
|
42
|
+
|
|
43
|
+
var dataType = definition.type;
|
|
44
|
+
if (Array.isArray(dataType)) {
|
|
45
|
+
for (var i=0; i<dataType.length; i++)
|
|
46
|
+
_addRule(keyword, dataType[i], definition);
|
|
47
|
+
} else {
|
|
48
|
+
_addRule(keyword, dataType, definition);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var metaSchema = definition.metaSchema;
|
|
52
|
+
if (metaSchema) {
|
|
53
|
+
if (definition.$data && this._opts.$data) {
|
|
54
|
+
metaSchema = {
|
|
55
|
+
anyOf: [
|
|
56
|
+
metaSchema,
|
|
57
|
+
{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
|
58
|
+
]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
definition.validateSchema = this.compile(metaSchema, true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
RULES.keywords[keyword] = RULES.all[keyword] = true;
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
function _addRule(keyword, dataType, definition) {
|
|
69
|
+
var ruleGroup;
|
|
70
|
+
for (var i=0; i<RULES.length; i++) {
|
|
71
|
+
var rg = RULES[i];
|
|
72
|
+
if (rg.type == dataType) {
|
|
73
|
+
ruleGroup = rg;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!ruleGroup) {
|
|
79
|
+
ruleGroup = { type: dataType, rules: [] };
|
|
80
|
+
RULES.push(ruleGroup);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var rule = {
|
|
84
|
+
keyword: keyword,
|
|
85
|
+
definition: definition,
|
|
86
|
+
custom: true,
|
|
87
|
+
code: customRuleCode,
|
|
88
|
+
implements: definition.implements
|
|
89
|
+
};
|
|
90
|
+
ruleGroup.rules.push(rule);
|
|
91
|
+
RULES.custom[keyword] = rule;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get keyword
|
|
100
|
+
* @this Ajv
|
|
101
|
+
* @param {String} keyword pre-defined or custom keyword.
|
|
102
|
+
* @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
|
|
103
|
+
*/
|
|
104
|
+
function getKeyword(keyword) {
|
|
105
|
+
/* jshint validthis: true */
|
|
106
|
+
var rule = this.RULES.custom[keyword];
|
|
107
|
+
return rule ? rule.definition : this.RULES.keywords[keyword] || false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Remove keyword
|
|
113
|
+
* @this Ajv
|
|
114
|
+
* @param {String} keyword pre-defined or custom keyword.
|
|
115
|
+
* @return {Ajv} this for method chaining
|
|
116
|
+
*/
|
|
117
|
+
function removeKeyword(keyword) {
|
|
118
|
+
/* jshint validthis: true */
|
|
119
|
+
var RULES = this.RULES;
|
|
120
|
+
delete RULES.keywords[keyword];
|
|
121
|
+
delete RULES.all[keyword];
|
|
122
|
+
delete RULES.custom[keyword];
|
|
123
|
+
for (var i=0; i<RULES.length; i++) {
|
|
124
|
+
var rules = RULES[i].rules;
|
|
125
|
+
for (var j=0; j<rules.length; j++) {
|
|
126
|
+
if (rules[j].keyword == keyword) {
|
|
127
|
+
rules.splice(j, 1);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Validate keyword definition
|
|
138
|
+
* @this Ajv
|
|
139
|
+
* @param {Object} definition keyword definition object.
|
|
140
|
+
* @param {Boolean} throwError true to throw exception if definition is invalid
|
|
141
|
+
* @return {boolean} validation result
|
|
142
|
+
*/
|
|
143
|
+
function validateKeyword(definition, throwError) {
|
|
144
|
+
validateKeyword.errors = null;
|
|
145
|
+
var v = this._validateKeyword = this._validateKeyword
|
|
146
|
+
|| this.compile(definitionSchema, true);
|
|
147
|
+
|
|
148
|
+
if (v(definition)) return true;
|
|
149
|
+
validateKeyword.errors = v.errors;
|
|
150
|
+
if (throwError)
|
|
151
|
+
throw new Error('custom keyword definition is invalid: ' + this.errorsText(v.errors));
|
|
152
|
+
else
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
return keyword;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { requireKeyword as __require };
|
|
159
|
+
//# sourceMappingURL=keyword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword.js","sources":["../../../../../../node_modules/ajv/lib/keyword.js"],"sourcesContent":["'use strict';\n\nvar IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;\nvar customRuleCode = require('./dotjs/custom');\nvar definitionSchema = require('./definition_schema');\n\nmodule.exports = {\n add: addKeyword,\n get: getKeyword,\n remove: removeKeyword,\n validate: validateKeyword\n};\n\n\n/**\n * Define custom keyword\n * @this Ajv\n * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords).\n * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.\n * @return {Ajv} this for method chaining\n */\nfunction addKeyword(keyword, definition) {\n /* jshint validthis: true */\n /* eslint no-shadow: 0 */\n var RULES = this.RULES;\n if (RULES.keywords[keyword])\n throw new Error('Keyword ' + keyword + ' is already defined');\n\n if (!IDENTIFIER.test(keyword))\n throw new Error('Keyword ' + keyword + ' is not a valid identifier');\n\n if (definition) {\n this.validateKeyword(definition, true);\n\n var dataType = definition.type;\n if (Array.isArray(dataType)) {\n for (var i=0; i<dataType.length; i++)\n _addRule(keyword, dataType[i], definition);\n } else {\n _addRule(keyword, dataType, definition);\n }\n\n var metaSchema = definition.metaSchema;\n if (metaSchema) {\n if (definition.$data && this._opts.$data) {\n metaSchema = {\n anyOf: [\n metaSchema,\n { '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }\n ]\n };\n }\n definition.validateSchema = this.compile(metaSchema, true);\n }\n }\n\n RULES.keywords[keyword] = RULES.all[keyword] = true;\n\n\n function _addRule(keyword, dataType, definition) {\n var ruleGroup;\n for (var i=0; i<RULES.length; i++) {\n var rg = RULES[i];\n if (rg.type == dataType) {\n ruleGroup = rg;\n break;\n }\n }\n\n if (!ruleGroup) {\n ruleGroup = { type: dataType, rules: [] };\n RULES.push(ruleGroup);\n }\n\n var rule = {\n keyword: keyword,\n definition: definition,\n custom: true,\n code: customRuleCode,\n implements: definition.implements\n };\n ruleGroup.rules.push(rule);\n RULES.custom[keyword] = rule;\n }\n\n return this;\n}\n\n\n/**\n * Get keyword\n * @this Ajv\n * @param {String} keyword pre-defined or custom keyword.\n * @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.\n */\nfunction getKeyword(keyword) {\n /* jshint validthis: true */\n var rule = this.RULES.custom[keyword];\n return rule ? rule.definition : this.RULES.keywords[keyword] || false;\n}\n\n\n/**\n * Remove keyword\n * @this Ajv\n * @param {String} keyword pre-defined or custom keyword.\n * @return {Ajv} this for method chaining\n */\nfunction removeKeyword(keyword) {\n /* jshint validthis: true */\n var RULES = this.RULES;\n delete RULES.keywords[keyword];\n delete RULES.all[keyword];\n delete RULES.custom[keyword];\n for (var i=0; i<RULES.length; i++) {\n var rules = RULES[i].rules;\n for (var j=0; j<rules.length; j++) {\n if (rules[j].keyword == keyword) {\n rules.splice(j, 1);\n break;\n }\n }\n }\n return this;\n}\n\n\n/**\n * Validate keyword definition\n * @this Ajv\n * @param {Object} definition keyword definition object.\n * @param {Boolean} throwError true to throw exception if definition is invalid\n * @return {boolean} validation result\n */\nfunction validateKeyword(definition, throwError) {\n validateKeyword.errors = null;\n var v = this._validateKeyword = this._validateKeyword\n || this.compile(definitionSchema, true);\n\n if (v(definition)) return true;\n validateKeyword.errors = v.errors;\n if (throwError)\n throw new Error('custom keyword definition is invalid: ' + this.errorsText(v.errors));\n else\n return false;\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;CAEA,IAAI,UAAU,GAAG,wBAAwB;CACzC,IAAI,cAAc,GAAGA,aAAA,EAAyB;CAC9C,IAAI,gBAAgB,GAAGC,wBAAA,EAA8B;;AAErD,CAAA,OAAc,GAAG;GACf,GAAG,EAAE,UAAU;GACf,GAAG,EAAE,UAAU;GACf,MAAM,EAAE,aAAa;AACvB,GAAE,QAAQ,EAAE;EACX;;;AAGD;AACA;AACA;AACA;AACA;AACA;A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,KAAI,OAAO,KAAK;AAChB,CAAA;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
2
|
+
var $id = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
|
|
3
|
+
var description = "Meta-schema for $data reference (JSON Schema extension proposal)";
|
|
4
|
+
var type = "object";
|
|
5
|
+
var required = [
|
|
6
|
+
"$data"
|
|
7
|
+
];
|
|
8
|
+
var properties = {
|
|
9
|
+
$data: {
|
|
10
|
+
type: "string",
|
|
11
|
+
anyOf: [
|
|
12
|
+
{
|
|
13
|
+
format: "relative-json-pointer"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
format: "json-pointer"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var additionalProperties = false;
|
|
22
|
+
var require$$12 = {
|
|
23
|
+
$schema: $schema,
|
|
24
|
+
$id: $id,
|
|
25
|
+
description: description,
|
|
26
|
+
type: type,
|
|
27
|
+
required: required,
|
|
28
|
+
properties: properties,
|
|
29
|
+
additionalProperties: additionalProperties
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { $id, $schema, additionalProperties, require$$12 as default, description, properties, required, type };
|
|
33
|
+
//# sourceMappingURL=data.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
2
|
+
var $id = "http://json-schema.org/draft-07/schema#";
|
|
3
|
+
var title = "Core schema meta-schema";
|
|
4
|
+
var definitions = {
|
|
5
|
+
schemaArray: {
|
|
6
|
+
type: "array",
|
|
7
|
+
minItems: 1,
|
|
8
|
+
items: {
|
|
9
|
+
$ref: "#"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
nonNegativeInteger: {
|
|
13
|
+
type: "integer",
|
|
14
|
+
minimum: 0
|
|
15
|
+
},
|
|
16
|
+
nonNegativeIntegerDefault0: {
|
|
17
|
+
allOf: [
|
|
18
|
+
{
|
|
19
|
+
$ref: "#/definitions/nonNegativeInteger"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"default": 0
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
simpleTypes: {
|
|
27
|
+
"enum": [
|
|
28
|
+
"array",
|
|
29
|
+
"boolean",
|
|
30
|
+
"integer",
|
|
31
|
+
"null",
|
|
32
|
+
"number",
|
|
33
|
+
"object",
|
|
34
|
+
"string"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
stringArray: {
|
|
38
|
+
type: "array",
|
|
39
|
+
items: {
|
|
40
|
+
type: "string"
|
|
41
|
+
},
|
|
42
|
+
uniqueItems: true,
|
|
43
|
+
"default": [
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var type = [
|
|
48
|
+
"object",
|
|
49
|
+
"boolean"
|
|
50
|
+
];
|
|
51
|
+
var properties = {
|
|
52
|
+
$id: {
|
|
53
|
+
type: "string",
|
|
54
|
+
format: "uri-reference"
|
|
55
|
+
},
|
|
56
|
+
$schema: {
|
|
57
|
+
type: "string",
|
|
58
|
+
format: "uri"
|
|
59
|
+
},
|
|
60
|
+
$ref: {
|
|
61
|
+
type: "string",
|
|
62
|
+
format: "uri-reference"
|
|
63
|
+
},
|
|
64
|
+
$comment: {
|
|
65
|
+
type: "string"
|
|
66
|
+
},
|
|
67
|
+
title: {
|
|
68
|
+
type: "string"
|
|
69
|
+
},
|
|
70
|
+
description: {
|
|
71
|
+
type: "string"
|
|
72
|
+
},
|
|
73
|
+
"default": true,
|
|
74
|
+
readOnly: {
|
|
75
|
+
type: "boolean",
|
|
76
|
+
"default": false
|
|
77
|
+
},
|
|
78
|
+
examples: {
|
|
79
|
+
type: "array",
|
|
80
|
+
items: true
|
|
81
|
+
},
|
|
82
|
+
multipleOf: {
|
|
83
|
+
type: "number",
|
|
84
|
+
exclusiveMinimum: 0
|
|
85
|
+
},
|
|
86
|
+
maximum: {
|
|
87
|
+
type: "number"
|
|
88
|
+
},
|
|
89
|
+
exclusiveMaximum: {
|
|
90
|
+
type: "number"
|
|
91
|
+
},
|
|
92
|
+
minimum: {
|
|
93
|
+
type: "number"
|
|
94
|
+
},
|
|
95
|
+
exclusiveMinimum: {
|
|
96
|
+
type: "number"
|
|
97
|
+
},
|
|
98
|
+
maxLength: {
|
|
99
|
+
$ref: "#/definitions/nonNegativeInteger"
|
|
100
|
+
},
|
|
101
|
+
minLength: {
|
|
102
|
+
$ref: "#/definitions/nonNegativeIntegerDefault0"
|
|
103
|
+
},
|
|
104
|
+
pattern: {
|
|
105
|
+
type: "string",
|
|
106
|
+
format: "regex"
|
|
107
|
+
},
|
|
108
|
+
additionalItems: {
|
|
109
|
+
$ref: "#"
|
|
110
|
+
},
|
|
111
|
+
items: {
|
|
112
|
+
anyOf: [
|
|
113
|
+
{
|
|
114
|
+
$ref: "#"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
$ref: "#/definitions/schemaArray"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"default": true
|
|
121
|
+
},
|
|
122
|
+
maxItems: {
|
|
123
|
+
$ref: "#/definitions/nonNegativeInteger"
|
|
124
|
+
},
|
|
125
|
+
minItems: {
|
|
126
|
+
$ref: "#/definitions/nonNegativeIntegerDefault0"
|
|
127
|
+
},
|
|
128
|
+
uniqueItems: {
|
|
129
|
+
type: "boolean",
|
|
130
|
+
"default": false
|
|
131
|
+
},
|
|
132
|
+
contains: {
|
|
133
|
+
$ref: "#"
|
|
134
|
+
},
|
|
135
|
+
maxProperties: {
|
|
136
|
+
$ref: "#/definitions/nonNegativeInteger"
|
|
137
|
+
},
|
|
138
|
+
minProperties: {
|
|
139
|
+
$ref: "#/definitions/nonNegativeIntegerDefault0"
|
|
140
|
+
},
|
|
141
|
+
required: {
|
|
142
|
+
$ref: "#/definitions/stringArray"
|
|
143
|
+
},
|
|
144
|
+
additionalProperties: {
|
|
145
|
+
$ref: "#"
|
|
146
|
+
},
|
|
147
|
+
definitions: {
|
|
148
|
+
type: "object",
|
|
149
|
+
additionalProperties: {
|
|
150
|
+
$ref: "#"
|
|
151
|
+
},
|
|
152
|
+
"default": {
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
properties: {
|
|
156
|
+
type: "object",
|
|
157
|
+
additionalProperties: {
|
|
158
|
+
$ref: "#"
|
|
159
|
+
},
|
|
160
|
+
"default": {
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
patternProperties: {
|
|
164
|
+
type: "object",
|
|
165
|
+
additionalProperties: {
|
|
166
|
+
$ref: "#"
|
|
167
|
+
},
|
|
168
|
+
propertyNames: {
|
|
169
|
+
format: "regex"
|
|
170
|
+
},
|
|
171
|
+
"default": {
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
dependencies: {
|
|
175
|
+
type: "object",
|
|
176
|
+
additionalProperties: {
|
|
177
|
+
anyOf: [
|
|
178
|
+
{
|
|
179
|
+
$ref: "#"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
$ref: "#/definitions/stringArray"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
propertyNames: {
|
|
188
|
+
$ref: "#"
|
|
189
|
+
},
|
|
190
|
+
"const": true,
|
|
191
|
+
"enum": {
|
|
192
|
+
type: "array",
|
|
193
|
+
items: true,
|
|
194
|
+
minItems: 1,
|
|
195
|
+
uniqueItems: true
|
|
196
|
+
},
|
|
197
|
+
type: {
|
|
198
|
+
anyOf: [
|
|
199
|
+
{
|
|
200
|
+
$ref: "#/definitions/simpleTypes"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: "array",
|
|
204
|
+
items: {
|
|
205
|
+
$ref: "#/definitions/simpleTypes"
|
|
206
|
+
},
|
|
207
|
+
minItems: 1,
|
|
208
|
+
uniqueItems: true
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
format: {
|
|
213
|
+
type: "string"
|
|
214
|
+
},
|
|
215
|
+
contentMediaType: {
|
|
216
|
+
type: "string"
|
|
217
|
+
},
|
|
218
|
+
contentEncoding: {
|
|
219
|
+
type: "string"
|
|
220
|
+
},
|
|
221
|
+
"if": {
|
|
222
|
+
$ref: "#"
|
|
223
|
+
},
|
|
224
|
+
then: {
|
|
225
|
+
$ref: "#"
|
|
226
|
+
},
|
|
227
|
+
"else": {
|
|
228
|
+
$ref: "#"
|
|
229
|
+
},
|
|
230
|
+
allOf: {
|
|
231
|
+
$ref: "#/definitions/schemaArray"
|
|
232
|
+
},
|
|
233
|
+
anyOf: {
|
|
234
|
+
$ref: "#/definitions/schemaArray"
|
|
235
|
+
},
|
|
236
|
+
oneOf: {
|
|
237
|
+
$ref: "#/definitions/schemaArray"
|
|
238
|
+
},
|
|
239
|
+
not: {
|
|
240
|
+
$ref: "#"
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
var require$$13 = {
|
|
244
|
+
$schema: $schema,
|
|
245
|
+
$id: $id,
|
|
246
|
+
title: title,
|
|
247
|
+
definitions: definitions,
|
|
248
|
+
type: type,
|
|
249
|
+
properties: properties,
|
|
250
|
+
"default": true
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export { $id, $schema, require$$13 as default, definitions, properties, title, type };
|
|
254
|
+
//# sourceMappingURL=json-schema-draft-07.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-draft-07.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
class ParseError extends Error {
|
|
2
|
+
constructor(message, options) {
|
|
3
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function noop(_arg) {
|
|
7
|
+
}
|
|
8
|
+
function createParser(callbacks) {
|
|
9
|
+
if (typeof callbacks == "function")
|
|
10
|
+
throw new TypeError(
|
|
11
|
+
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
12
|
+
);
|
|
13
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
14
|
+
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
15
|
+
function feed(newChunk) {
|
|
16
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
17
|
+
for (const line of complete)
|
|
18
|
+
parseLine(line);
|
|
19
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
20
|
+
}
|
|
21
|
+
function parseLine(line) {
|
|
22
|
+
if (line === "") {
|
|
23
|
+
dispatchEvent();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (line.startsWith(":")) {
|
|
27
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
31
|
+
if (fieldSeparatorIndex !== -1) {
|
|
32
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
33
|
+
processField(field, value, line);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
processField(line, "", line);
|
|
37
|
+
}
|
|
38
|
+
function processField(field, value, line) {
|
|
39
|
+
switch (field) {
|
|
40
|
+
case "event":
|
|
41
|
+
eventType = value;
|
|
42
|
+
break;
|
|
43
|
+
case "data":
|
|
44
|
+
data = `${data}${value}
|
|
45
|
+
`;
|
|
46
|
+
break;
|
|
47
|
+
case "id":
|
|
48
|
+
id = value.includes("\0") ? void 0 : value;
|
|
49
|
+
break;
|
|
50
|
+
case "retry":
|
|
51
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
52
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
53
|
+
type: "invalid-retry",
|
|
54
|
+
value,
|
|
55
|
+
line
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
onError(
|
|
61
|
+
new ParseError(
|
|
62
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
63
|
+
{ type: "unknown-field", field, value, line }
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function dispatchEvent() {
|
|
70
|
+
data.length > 0 && onEvent({
|
|
71
|
+
id,
|
|
72
|
+
event: eventType || void 0,
|
|
73
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
74
|
+
// then remove the last character from the data buffer.
|
|
75
|
+
data: data.endsWith(`
|
|
76
|
+
`) ? data.slice(0, -1) : data
|
|
77
|
+
}), id = void 0, data = "", eventType = "";
|
|
78
|
+
}
|
|
79
|
+
function reset(options = {}) {
|
|
80
|
+
incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
|
|
81
|
+
}
|
|
82
|
+
return { feed, reset };
|
|
83
|
+
}
|
|
84
|
+
function splitLines(chunk) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
let incompleteLine = "", searchIndex = 0;
|
|
87
|
+
for (; searchIndex < chunk.length; ) {
|
|
88
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
89
|
+
`, searchIndex);
|
|
90
|
+
let lineEnd = -1;
|
|
91
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
92
|
+
incompleteLine = chunk.slice(searchIndex);
|
|
93
|
+
break;
|
|
94
|
+
} else {
|
|
95
|
+
const line = chunk.slice(searchIndex, lineEnd);
|
|
96
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
97
|
+
` && searchIndex++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return [lines, incompleteLine];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { ParseError, createParser };
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/eventsource-parser/dist/index.js"],"sourcesContent":["class ParseError extends Error {\n constructor(message, options) {\n super(message), this.name = \"ParseError\", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;\n }\n}\nfunction noop(_arg) {\n}\nfunction createParser(callbacks) {\n if (typeof callbacks == \"function\")\n throw new TypeError(\n \"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?\"\n );\n const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;\n let incompleteLine = \"\", isFirstChunk = !0, id, data = \"\", eventType = \"\";\n function feed(newChunk) {\n const chunk = isFirstChunk ? newChunk.replace(/^\\xEF\\xBB\\xBF/, \"\") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);\n for (const line of complete)\n parseLine(line);\n incompleteLine = incomplete, isFirstChunk = !1;\n }\n function parseLine(line) {\n if (line === \"\") {\n dispatchEvent();\n return;\n }\n if (line.startsWith(\":\")) {\n onComment && onComment(line.slice(line.startsWith(\": \") ? 2 : 1));\n return;\n }\n const fieldSeparatorIndex = line.indexOf(\":\");\n if (fieldSeparatorIndex !== -1) {\n const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === \" \" ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);\n processField(field, value, line);\n return;\n }\n processField(line, \"\", line);\n }\n function processField(field, value, line) {\n switch (field) {\n case \"event\":\n eventType = value;\n break;\n case \"data\":\n data = `${data}${value}\n`;\n break;\n case \"id\":\n id = value.includes(\"\\0\") ? void 0 : value;\n break;\n case \"retry\":\n /^\\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(\n new ParseError(`Invalid \\`retry\\` value: \"${value}\"`, {\n type: \"invalid-retry\",\n value,\n line\n })\n );\n break;\n default:\n onError(\n new ParseError(\n `Unknown field \"${field.length > 20 ? `${field.slice(0, 20)}\\u2026` : field}\"`,\n { type: \"unknown-field\", field, value, line }\n )\n );\n break;\n }\n }\n function dispatchEvent() {\n data.length > 0 && onEvent({\n id,\n event: eventType || void 0,\n // If the data buffer's last character is a U+000A LINE FEED (LF) character,\n // then remove the last character from the data buffer.\n data: data.endsWith(`\n`) ? data.slice(0, -1) : data\n }), id = void 0, data = \"\", eventType = \"\";\n }\n function reset(options = {}) {\n incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = !0, id = void 0, data = \"\", eventType = \"\", incompleteLine = \"\";\n }\n return { feed, reset };\n}\nfunction splitLines(chunk) {\n const lines = [];\n let incompleteLine = \"\", searchIndex = 0;\n for (; searchIndex < chunk.length; ) {\n const crIndex = chunk.indexOf(\"\\r\", searchIndex), lfIndex = chunk.indexOf(`\n`, searchIndex);\n let lineEnd = -1;\n if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {\n incompleteLine = chunk.slice(searchIndex);\n break;\n } else {\n const line = chunk.slice(searchIndex, lineEnd);\n lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === \"\\r\" && chunk[searchIndex] === `\n` && searchIndex++;\n }\n }\n return [lines, incompleteLine];\n}\nexport {\n ParseError,\n createParser\n};\n//# sourceMappingURL=index.js.map\n"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,KAAK,CAAC;AAC/B,EAAE,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE;AAChC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,YAAY,EAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;AACxJ,EAAE;AACF;AACA,SAAS,IAAI,CAAC,IAAI,EAAE;AACpB;AACA,SAAS,YAAY,CAAC,SAAS,EAAE;AACjC,EAAE,IAAI,OAAO,SAAS,IAAI,UAAU;AACpC,IAAI,MAAM,IAAI,SAAS;AACvB,MAAM;AACN,KAAK;AACL,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,SAAS;AACjF,EAAE,IAAI,cAAc,GAAG,EAAE,EAAE,YAAY,GAAG,IAAE,EAAE,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE;AAC3E,EAAE,SAAS,IAAI,CAAC,QAAQ,EAAE;A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AI,CAAC,MAAM;AACX,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC;AACpD,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK;AAC7G,CAAC,IAAI,WAAW,EAAE;AAClB,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC;AAChC;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createParser } from './index.js';
|
|
2
|
+
export { ParseError } from './index.js';
|
|
3
|
+
|
|
4
|
+
class EventSourceParserStream extends TransformStream {
|
|
5
|
+
constructor({ onError, onRetry, onComment } = {}) {
|
|
6
|
+
let parser;
|
|
7
|
+
super({
|
|
8
|
+
start(controller) {
|
|
9
|
+
parser = createParser({
|
|
10
|
+
onEvent: (event) => {
|
|
11
|
+
controller.enqueue(event);
|
|
12
|
+
},
|
|
13
|
+
onError(error) {
|
|
14
|
+
onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
|
|
15
|
+
},
|
|
16
|
+
onRetry,
|
|
17
|
+
onComment
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
transform(chunk) {
|
|
21
|
+
parser.feed(chunk);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { EventSourceParserStream };
|
|
28
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sources":["../../../../../../node_modules/eventsource-parser/dist/stream.js"],"sourcesContent":["import { createParser } from \"./index.js\";\nimport { ParseError } from \"./index.js\";\nclass EventSourceParserStream extends TransformStream {\n constructor({ onError, onRetry, onComment } = {}) {\n let parser;\n super({\n start(controller) {\n parser = createParser({\n onEvent: (event) => {\n controller.enqueue(event);\n },\n onError(error) {\n onError === \"terminate\" ? controller.error(error) : typeof onError == \"function\" && onError(error);\n },\n onRetry,\n onComment\n });\n },\n transform(chunk) {\n parser.feed(chunk);\n }\n });\n }\n}\nexport {\n EventSourceParserStream,\n ParseError\n};\n//# sourceMappingURL=stream.js.map\n"],"names":[],"mappings":";;;AAEA,MAAM,uBAAuB,SAAS,eAAe,CAAC;AACtD,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE;AACpD,IAAI,IAAI,MAAM;AACd,IAAI,KAAK,CAAC;AACV,MAAM,KAAK,CAAC,UAAU,EAAE;AACxB,QAAQ,MAAM,GAAG,YAAY,CAAC;AAC9B,UAAU,OAAO,EAAE,CAAC,KAAK,KAAK;AAC9B,YAAY,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC;AACrC,UAAU,CAAC;AACX,UAAU,OAAO,CAAC,KAAK,EAAE;AACzB,YAAY,OAAO,KAAK,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,OAAO,OAAO,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;AAC9G,UAAU,CAAC;AACX,UAAU,OAAO;AACjB,UAAU;AACV,SAAS,CAAC;AACV,MAAM,CAAC;AACP,MAAM,SAAS,CAAC,KAAK,EAAE;AACvB,QAAQ,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,MAAM;AACN,KAAK,CAAC;AACN,EAAE;AACF;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var fastDeepEqual;
|
|
2
|
+
var hasRequiredFastDeepEqual;
|
|
3
|
+
|
|
4
|
+
function requireFastDeepEqual () {
|
|
5
|
+
if (hasRequiredFastDeepEqual) return fastDeepEqual;
|
|
6
|
+
hasRequiredFastDeepEqual = 1;
|
|
7
|
+
|
|
8
|
+
// do not edit .js files directly - edit src/index.jst
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
fastDeepEqual = function equal(a, b) {
|
|
13
|
+
if (a === b) return true;
|
|
14
|
+
|
|
15
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
16
|
+
if (a.constructor !== b.constructor) return false;
|
|
17
|
+
|
|
18
|
+
var length, i, keys;
|
|
19
|
+
if (Array.isArray(a)) {
|
|
20
|
+
length = a.length;
|
|
21
|
+
if (length != b.length) return false;
|
|
22
|
+
for (i = length; i-- !== 0;)
|
|
23
|
+
if (!equal(a[i], b[i])) return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
30
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
31
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
32
|
+
|
|
33
|
+
keys = Object.keys(a);
|
|
34
|
+
length = keys.length;
|
|
35
|
+
if (length !== Object.keys(b).length) return false;
|
|
36
|
+
|
|
37
|
+
for (i = length; i-- !== 0;)
|
|
38
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
39
|
+
|
|
40
|
+
for (i = length; i-- !== 0;) {
|
|
41
|
+
var key = keys[i];
|
|
42
|
+
|
|
43
|
+
if (!equal(a[key], b[key])) return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// true if both NaN, false otherwise
|
|
50
|
+
return a!==a && b!==b;
|
|
51
|
+
};
|
|
52
|
+
return fastDeepEqual;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { requireFastDeepEqual as __require };
|
|
56
|
+
//# sourceMappingURL=index.js.map
|