new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import type { ImportRunner } from '../models/ImportRunner';
|
||||
import type { ResponseRunner } from '../models/ResponseRunner';
|
||||
export declare class ImportService {
|
||||
/**
|
||||
* Post json
|
||||
* Create new runners from json and insert them into the provided group. <br> If teams/classes are provided alongside the runner's name they'll automaticly be created under the provided org and the runners will be inserted into the teams instead.
|
||||
* @param group
|
||||
* @param requestBody ImportRunner
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostJson(group?: number, requestBody?: Array<ImportRunner>): Promise<Array<ResponseRunner>>;
|
||||
/**
|
||||
* Post orgs json
|
||||
* Create new runners from json and insert them into the provided org. <br> If teams/classes are provided alongside the runner's name they'll automaticly be created under the provided org and the runners will be inserted into the teams instead.
|
||||
* @param id
|
||||
* @param requestBody ImportRunner
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostOrgsJson(id: number, requestBody?: Array<ImportRunner>): Promise<Array<ResponseRunner>>;
|
||||
/**
|
||||
* Post teams json
|
||||
* Create new runners from json and insert them into the provided team
|
||||
* @param id
|
||||
* @param requestBody ImportRunner
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostTeamsJson(id: number, requestBody?: Array<ImportRunner>): Promise<Array<ResponseRunner>>;
|
||||
/**
|
||||
* Post csv
|
||||
* Create new runners from csv and insert them into the provided group. <br> If teams/classes are provided alongside the runner's name they'll automaticly be created under the provided org and the runners will be inserted into the teams instead.
|
||||
* @param group
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostCsv(group?: number): Promise<Array<ResponseRunner>>;
|
||||
/**
|
||||
* Post orgs csv
|
||||
* Create new runners from csv and insert them into the provided org. <br> If teams/classes are provided alongside the runner's name they'll automaticly be created under the provided org and the runners will be inserted into the teams instead.
|
||||
* @param id
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostOrgsCsv(id: number): Promise<Array<ResponseRunner>>;
|
||||
/**
|
||||
* Post teams csv
|
||||
* Create new runners from csv and insert them into the provided team
|
||||
* @param id
|
||||
* @result ResponseRunner
|
||||
* @throws ApiError
|
||||
*/
|
||||
static importControllerPostTeamsCsv(id: number): Promise<Array<ResponseRunner>>;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import Container from './container.js'
|
||||
import Node, { NodeProps } from './node.js'
|
||||
|
||||
interface CommentRaws extends Record<string, unknown> {
|
||||
/**
|
||||
* The space symbols before the node.
|
||||
*/
|
||||
before?: string
|
||||
|
||||
/**
|
||||
* The space symbols between `/*` and the comment’s text.
|
||||
*/
|
||||
left?: string
|
||||
|
||||
/**
|
||||
* The space symbols between the comment’s text.
|
||||
*/
|
||||
right?: string
|
||||
}
|
||||
|
||||
export interface CommentProps extends NodeProps {
|
||||
/** Content of the comment. */
|
||||
text: string
|
||||
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
||||
raws?: CommentRaws
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a comment between declarations or statements (rule and at-rules).
|
||||
*
|
||||
* ```js
|
||||
* Once (root, { Comment }) {
|
||||
* let note = new Comment({ text: 'Note: …' })
|
||||
* root.append(note)
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Comments inside selectors, at-rule parameters, or declaration values
|
||||
* will be stored in the `raws` properties explained above.
|
||||
*/
|
||||
export default class Comment extends Node {
|
||||
type: 'comment'
|
||||
parent: Container | undefined
|
||||
raws: CommentRaws
|
||||
|
||||
/**
|
||||
* The comment's text.
|
||||
*/
|
||||
text: string
|
||||
|
||||
constructor(defaults?: CommentProps)
|
||||
assign(overrides: object | CommentProps): this
|
||||
clone(overrides?: Partial<CommentProps>): this
|
||||
cloneBefore(overrides?: Partial<CommentProps>): this
|
||||
cloneAfter(overrides?: Partial<CommentProps>): this
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dateTimestampProvider.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/dateTimestampProvider.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D,GAAG;QAGD,OAAO,CAAC,qBAAqB,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IACxD,CAAC;IACD,QAAQ,EAAE,SAAS;CACpB,CAAC"}
|
||||
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TestTools = exports.Immediate = void 0;
|
||||
var nextHandle = 1;
|
||||
var resolved;
|
||||
var activeHandles = {};
|
||||
function findAndClearHandle(handle) {
|
||||
if (handle in activeHandles) {
|
||||
delete activeHandles[handle];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.Immediate = {
|
||||
setImmediate: function (cb) {
|
||||
var handle = nextHandle++;
|
||||
activeHandles[handle] = true;
|
||||
if (!resolved) {
|
||||
resolved = Promise.resolve();
|
||||
}
|
||||
resolved.then(function () { return findAndClearHandle(handle) && cb(); });
|
||||
return handle;
|
||||
},
|
||||
clearImmediate: function (handle) {
|
||||
findAndClearHandle(handle);
|
||||
},
|
||||
};
|
||||
exports.TestTools = {
|
||||
pending: function () {
|
||||
return Object.keys(activeHandles).length;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=Immediate.js.map
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var includes = function includes(arr, val) {
|
||||
return arr.some(function (arrVal) {
|
||||
return val === arrVal;
|
||||
});
|
||||
};
|
||||
|
||||
var _default = includes;
|
||||
exports.default = _default;
|
||||
module.exports = exports.default;
|
||||
module.exports.default = exports.default;
|
||||
@@ -0,0 +1,107 @@
|
||||
import setupTrackingContext from './lib/setupTrackingContext'
|
||||
import processTailwindFeatures from './processTailwindFeatures'
|
||||
import { env } from './lib/sharedState'
|
||||
import { findAtConfigPath } from './lib/findAtConfigPath'
|
||||
|
||||
module.exports = function tailwindcss(configOrPath) {
|
||||
return {
|
||||
postcssPlugin: 'tailwindcss',
|
||||
plugins: [
|
||||
env.DEBUG &&
|
||||
function (root) {
|
||||
console.log('\n')
|
||||
console.time('JIT TOTAL')
|
||||
return root
|
||||
},
|
||||
function (root, result) {
|
||||
// Use the path for the `@config` directive if it exists, otherwise use the
|
||||
// path for the file being processed
|
||||
configOrPath = findAtConfigPath(root, result) ?? configOrPath
|
||||
|
||||
let context = setupTrackingContext(configOrPath)
|
||||
|
||||
if (root.type === 'document') {
|
||||
let roots = root.nodes.filter((node) => node.type === 'root')
|
||||
|
||||
for (const root of roots) {
|
||||
if (root.type === 'root') {
|
||||
processTailwindFeatures(context)(root, result)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
processTailwindFeatures(context)(root, result)
|
||||
},
|
||||
env.OXIDE &&
|
||||
function lightningCssPlugin(_root, result) {
|
||||
let postcss = require('postcss')
|
||||
let lightningcss = require('lightningcss')
|
||||
let browserslist = require('browserslist')
|
||||
|
||||
try {
|
||||
let transformed = lightningcss.transform({
|
||||
filename: result.opts.from,
|
||||
code: Buffer.from(result.root.toString()),
|
||||
minify: false,
|
||||
sourceMap: !!result.map,
|
||||
inputSourceMap: result.map ? result.map.toString() : undefined,
|
||||
targets:
|
||||
typeof process !== 'undefined' && process.env.JEST_WORKER_ID
|
||||
? { chrome: 106 << 16 }
|
||||
: lightningcss.browserslistToTargets(
|
||||
browserslist(require('../package.json').browserslist)
|
||||
),
|
||||
|
||||
drafts: {
|
||||
nesting: true,
|
||||
customMedia: true,
|
||||
},
|
||||
})
|
||||
|
||||
result.map = Object.assign(result.map ?? {}, {
|
||||
toJSON() {
|
||||
return transformed.map.toJSON()
|
||||
},
|
||||
toString() {
|
||||
return transformed.map.toString()
|
||||
},
|
||||
})
|
||||
|
||||
result.root = postcss.parse(transformed.code.toString('utf8'))
|
||||
} catch (err) {
|
||||
if (typeof process !== 'undefined' && process.env.JEST_WORKER_ID) {
|
||||
let lines = err.source.split('\n')
|
||||
err = new Error(
|
||||
[
|
||||
'Error formatting using Lightning CSS:',
|
||||
'',
|
||||
...[
|
||||
'```css',
|
||||
...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
|
||||
' '.repeat(err.loc.column - 1) + '^-- ' + err.toString(),
|
||||
...lines.slice(err.loc.line, err.loc.line + 2),
|
||||
'```',
|
||||
],
|
||||
].join('\n')
|
||||
)
|
||||
}
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(err, lightningCssPlugin)
|
||||
}
|
||||
throw err
|
||||
}
|
||||
},
|
||||
env.DEBUG &&
|
||||
function (root) {
|
||||
console.timeEnd('JIT TOTAL')
|
||||
console.log('\n')
|
||||
return root
|
||||
},
|
||||
].filter(Boolean),
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.postcss = true
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB EC FC","194":"BB CB DB EB FB GB"},D:{"1":"BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB"},E:{"1":"A B C K L G 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F HC zB IC JC KC LC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"F B C G M N O w g x PC QC RC SC qB AC TC rB"},G:{"1":"bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"CSS Font Loading"};
|
||||
@@ -0,0 +1,26 @@
|
||||
import merge from './util/merge';
|
||||
import assertString from './util/assertString';
|
||||
import includes from './util/includes';
|
||||
import { decimal } from './alpha';
|
||||
|
||||
function decimalRegExp(options) {
|
||||
var regExp = new RegExp("^[-+]?([0-9]+)?(\\".concat(decimal[options.locale], "[0-9]{").concat(options.decimal_digits, "})").concat(options.force_decimal ? '' : '?', "$"));
|
||||
return regExp;
|
||||
}
|
||||
|
||||
var default_decimal_options = {
|
||||
force_decimal: false,
|
||||
decimal_digits: '1,',
|
||||
locale: 'en-US'
|
||||
};
|
||||
var blacklist = ['', '-', '+'];
|
||||
export default function isDecimal(str, options) {
|
||||
assertString(str);
|
||||
options = merge(options, default_decimal_options);
|
||||
|
||||
if (options.locale in decimal) {
|
||||
return !includes(blacklist, str.replace(/ /g, '')) && decimalRegExp(options).test(str);
|
||||
}
|
||||
|
||||
throw new Error("Invalid locale '".concat(options.locale, "'"));
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('upperFirst', require('../upperFirst'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../src/internal/operators/find.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,2DAAgE;AA4DhE,SAAgB,IAAI,CAClB,SAAsE,EACtE,OAAa;IAEb,OAAO,cAAO,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1D,CAAC;AALD,oBAKC;AAED,SAAgB,UAAU,CACxB,SAAsE,EACtE,OAAY,EACZ,IAAuB;IAEvB,IAAM,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC;IACnC,OAAO,UAAC,MAAqB,EAAE,UAA2B;QACxD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,SAAS,CACd,6CAAwB,CACtB,UAAU,EACV,UAAC,KAAK;YACJ,IAAM,CAAC,GAAG,KAAK,EAAE,CAAC;YAClB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE;gBAC7C,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACvC,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;QACH,CAAC,EACD;YACE,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC5C,UAAU,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAzBD,gCAyBC"}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Node from './shared/Node';
|
||||
import Component from '../Component';
|
||||
import TemplateScope from './shared/TemplateScope';
|
||||
import { INode } from './interfaces';
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
export default class Text extends Node {
|
||||
type: 'Text';
|
||||
data: string;
|
||||
synthetic: boolean;
|
||||
constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
|
||||
should_skip(): any;
|
||||
keep_space(): boolean;
|
||||
within_pre(): boolean;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"s t u f H","2":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q","516":"r"},C:{"1":"H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f EC FC"},D:{"1":"s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a","194":"c d e i j k l m n o p q","450":"b","516":"r"},E:{"1":"sB 6B 7B 8B 9B OC","2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B"},F:{"1":"d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB PC QC RC SC qB AC TC rB","194":"P Q R wB S T U V W X Y Z","516":"a b c"},G:{"1":"sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"1":"g","2":"I wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"2":"1B"},R:{"2":"9C"},S:{"2":"AD BD"}},B:5,C:"CSS Container Queries (Size)"};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"single.js","sourceRoot":"","sources":["../../../../src/internal/operators/single.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAiFhE,MAAM,UAAU,MAAM,CAAI,SAAuE;IAC/F,OAAO,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACpC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,WAAc,CAAC;QACnB,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,SAAS,CACd,wBAAwB,CACtB,UAAU,EACV,CAAC,KAAK,EAAE,EAAE;YACR,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,EAAE;gBACnD,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,0BAA0B,CAAC,CAAC,CAAC;gBAC5E,QAAQ,GAAG,IAAI,CAAC;gBAChB,WAAW,GAAG,KAAK,CAAC;aACrB;QACH,CAAC,EACD,GAAG,EAAE;YACH,IAAI,QAAQ,EAAE;gBACZ,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;gBAC7B,UAAU,CAAC,QAAQ,EAAE,CAAC;aACvB;iBAAM;gBACL,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;aAC1F;QACH,CAAC,CACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"useTabs": false,
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"parser": "babylon",
|
||||
"noSemi": false
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
Copyright 2008 Fair Oaks Labs, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,193 @@
|
||||
import process from 'node:process';
|
||||
import {spawn} from 'node:child_process';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
import path from 'node:path';
|
||||
import {format} from 'node:util';
|
||||
import ConfigStore from 'configstore';
|
||||
import chalk from 'chalk';
|
||||
import semver from 'semver';
|
||||
import semverDiff from 'semver-diff';
|
||||
import latestVersion from 'latest-version';
|
||||
import {isNpmOrYarn} from 'is-npm';
|
||||
import isInstalledGlobally from 'is-installed-globally';
|
||||
import isYarnGlobal from 'is-yarn-global';
|
||||
import hasYarn from 'has-yarn';
|
||||
import boxen from 'boxen';
|
||||
import {xdgConfig} from 'xdg-basedir';
|
||||
import isCi from 'is-ci';
|
||||
import pupa from 'pupa';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const ONE_DAY = 1000 * 60 * 60 * 24;
|
||||
|
||||
export default class UpdateNotifier {
|
||||
// Public
|
||||
config;
|
||||
update;
|
||||
|
||||
// Semi-private (used for tests)
|
||||
_packageName;
|
||||
_shouldNotifyInNpmScript;
|
||||
|
||||
#options;
|
||||
#packageVersion;
|
||||
#updateCheckInterval;
|
||||
#isDisabled;
|
||||
|
||||
constructor(options = {}) {
|
||||
this.#options = options;
|
||||
options.pkg = options.pkg || {};
|
||||
options.distTag = options.distTag || 'latest';
|
||||
|
||||
// Reduce pkg to the essential keys. with fallback to deprecated options
|
||||
// TODO: Remove deprecated options at some point far into the future
|
||||
options.pkg = {
|
||||
name: options.pkg.name || options.packageName,
|
||||
version: options.pkg.version || options.packageVersion,
|
||||
};
|
||||
|
||||
if (!options.pkg.name || !options.pkg.version) {
|
||||
throw new Error('pkg.name and pkg.version required');
|
||||
}
|
||||
|
||||
this._packageName = options.pkg.name;
|
||||
this.#packageVersion = options.pkg.version;
|
||||
this.#updateCheckInterval = typeof options.updateCheckInterval === 'number' ? options.updateCheckInterval : ONE_DAY;
|
||||
this.#isDisabled = 'NO_UPDATE_NOTIFIER' in process.env
|
||||
|| process.env.NODE_ENV === 'test'
|
||||
|| process.argv.includes('--no-update-notifier')
|
||||
|| isCi;
|
||||
this._shouldNotifyInNpmScript = options.shouldNotifyInNpmScript;
|
||||
|
||||
if (!this.#isDisabled) {
|
||||
try {
|
||||
this.config = new ConfigStore(`update-notifier-${this._packageName}`, {
|
||||
optOut: false,
|
||||
// Init with the current time so the first check is only
|
||||
// after the set interval, so not to bother users right away
|
||||
lastUpdateCheck: Date.now(),
|
||||
});
|
||||
} catch {
|
||||
// Expecting error code EACCES or EPERM
|
||||
const message
|
||||
= chalk.yellow(format(' %s update check failed ', options.pkg.name))
|
||||
+ format('\n Try running with %s or get access ', chalk.cyan('sudo'))
|
||||
+ '\n to the local update config store via \n'
|
||||
+ chalk.cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgConfig));
|
||||
|
||||
process.on('exit', () => {
|
||||
console.error(boxen(message, {textAlignment: 'center'}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check() {
|
||||
if (
|
||||
!this.config
|
||||
|| this.config.get('optOut')
|
||||
|| this.#isDisabled
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.update = this.config.get('update');
|
||||
|
||||
if (this.update) {
|
||||
// Use the real latest version instead of the cached one
|
||||
this.update.current = this.#packageVersion;
|
||||
|
||||
// Clear cached information
|
||||
this.config.delete('update');
|
||||
}
|
||||
|
||||
// Only check for updates on a set interval
|
||||
if (Date.now() - this.config.get('lastUpdateCheck') < this.#updateCheckInterval) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Spawn a detached process, passing the options as an environment property
|
||||
spawn(process.execPath, [path.join(__dirname, 'check.js'), JSON.stringify(this.#options)], {
|
||||
detached: true,
|
||||
stdio: 'ignore',
|
||||
}).unref();
|
||||
}
|
||||
|
||||
async fetchInfo() {
|
||||
const {distTag} = this.#options;
|
||||
const latest = await latestVersion(this._packageName, {version: distTag});
|
||||
|
||||
return {
|
||||
latest,
|
||||
current: this.#packageVersion,
|
||||
type: semverDiff(this.#packageVersion, latest) || distTag,
|
||||
name: this._packageName,
|
||||
};
|
||||
}
|
||||
|
||||
notify(options) {
|
||||
const suppressForNpm = !this._shouldNotifyInNpmScript && isNpmOrYarn;
|
||||
if (!process.stdout.isTTY || suppressForNpm || !this.update || !semver.gt(this.update.latest, this.update.current)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
options = {
|
||||
isGlobal: isInstalledGlobally,
|
||||
isYarnGlobal: isYarnGlobal(),
|
||||
...options,
|
||||
};
|
||||
|
||||
let installCommand;
|
||||
if (options.isYarnGlobal) {
|
||||
installCommand = `yarn global add ${this._packageName}`;
|
||||
} else if (options.isGlobal) {
|
||||
installCommand = `npm i -g ${this._packageName}`;
|
||||
} else if (hasYarn()) {
|
||||
installCommand = `yarn add ${this._packageName}`;
|
||||
} else {
|
||||
installCommand = `npm i ${this._packageName}`;
|
||||
}
|
||||
|
||||
const defaultTemplate = 'Update available '
|
||||
+ chalk.dim('{currentVersion}')
|
||||
+ chalk.reset(' → ')
|
||||
+ chalk.green('{latestVersion}')
|
||||
+ ' \nRun ' + chalk.cyan('{updateCommand}') + ' to update';
|
||||
|
||||
const template = options.message || defaultTemplate;
|
||||
|
||||
options.boxenOptions = options.boxenOptions || {
|
||||
padding: 1,
|
||||
margin: 1,
|
||||
textAlignment: 'center',
|
||||
borderColor: 'yellow',
|
||||
borderStyle: 'round',
|
||||
};
|
||||
|
||||
const message = boxen(
|
||||
pupa(template, {
|
||||
packageName: this._packageName,
|
||||
currentVersion: this.update.current,
|
||||
latestVersion: this.update.latest,
|
||||
updateCommand: installCommand,
|
||||
}),
|
||||
options.boxenOptions,
|
||||
);
|
||||
|
||||
if (options.defer === false) {
|
||||
console.error(message);
|
||||
} else {
|
||||
process.on('exit', () => {
|
||||
console.error(message);
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
console.error('');
|
||||
process.exit();
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
# Number
|
||||
|
||||
_number_ primitive
|
||||
|
||||
## `number/coerce`
|
||||
|
||||
Restricted number coercion. Returns number presentation for every value that follows below constraints
|
||||
|
||||
- is implicitly coercible to number
|
||||
- is neither `null` nor `undefined`
|
||||
- is not `NaN` and doesn't coerce to `NaN`
|
||||
|
||||
For all other values `null` is returned
|
||||
|
||||
```javascript
|
||||
const coerceToNumber = require("type/number/coerce");
|
||||
|
||||
coerceToNumber("12"); // 12
|
||||
coerceToNumber({}); // null
|
||||
coerceToNumber(null); // null
|
||||
```
|
||||
|
||||
## `number/ensure`
|
||||
|
||||
If given argument is a number coercible value (via [`number/coerce`](#numbercoerce)) returns result number.
|
||||
Otherwise `TypeError` is thrown.
|
||||
|
||||
```javascript
|
||||
const ensureNumber = require("type/number/ensure");
|
||||
|
||||
ensureNumber(12); // "12"
|
||||
ensureNumber(null); // Thrown TypeError: null is not a number
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onErrorResumeNextWith.js","sourceRoot":"","sources":["../../../../src/internal/operators/onErrorResumeNextWith.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,iBAAiB,IAAI,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAiFlF,MAAM,UAAU,qBAAqB;IACnC,iBAAyE;SAAzE,UAAyE,EAAzE,qBAAyE,EAAzE,IAAyE;QAAzE,4BAAyE;;IAMzE,IAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAuC,CAAC;IAElF,OAAO,UAAC,MAAM,IAAK,OAAA,UAAU,8BAAC,MAAM,UAAK,WAAW,KAAjC,CAAkC,CAAC;AACxD,CAAC;AAKD,MAAM,CAAC,IAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"52":0.00892,"78":0.19331,"87":1.27882,"91":0.00297,"99":0.00297,"100":0.00595,"102":0.01784,"103":0.00297,"104":0.00595,"105":0.00297,"106":0.00595,"107":0.0119,"108":0.01784,"109":0.72566,"110":0.53235,"111":0.02379,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 88 89 90 92 93 94 95 96 97 98 101 112 3.5 3.6"},D:{"58":0.00595,"65":0.00892,"67":0.00297,"69":0.01784,"70":0.00595,"72":0.00892,"74":0.01487,"75":0.00595,"77":0.01487,"78":0.00595,"79":0.01487,"83":0.00595,"84":0.00297,"85":0.00595,"86":0.00892,"87":0.01487,"88":0.00892,"89":1.0528,"91":0.00595,"92":0.00595,"93":0.00595,"94":0.00297,"95":0.0119,"96":0.01487,"97":0.00892,"98":0.00892,"99":0.00595,"100":0.02379,"101":0.00595,"102":0.0119,"103":0.05948,"104":0.02379,"105":0.02379,"106":0.04164,"107":0.0684,"108":0.20521,"109":13.2224,"110":7.60452,"111":0.03271,"112":0.00892,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 60 61 62 63 64 66 68 71 73 76 80 81 90 113"},F:{"75":0.16357,"85":0.00595,"93":0.00595,"94":0.17249,"95":0.18736,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 9.5-9.6 10.5 10.6 11.1 11.5 11.6 12.1","10.0-10.1":0},B:{"18":0.00595,"89":0.44313,"92":0.0119,"104":0.00297,"107":0.00595,"108":0.02082,"109":0.64833,"110":0.91302,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 90 91 93 94 95 96 97 98 99 100 101 102 103 105 106"},E:{"4":0,"13":0.00297,"14":0.18736,_:"0 5 6 7 8 9 10 11 12 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 16.4","11.1":0.00297,"12.1":0.00595,"13.1":0.01784,"14.1":0.03271,"15.1":0.00297,"15.2-15.3":0.00595,"15.4":0.01487,"15.5":0.02379,"15.6":0.09517,"16.0":0.0119,"16.1":0.05056,"16.2":0.09517,"16.3":0.07435},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.00416,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01831,"10.0-10.2":0.00083,"10.3":0.02913,"11.0-11.2":0.01748,"11.3-11.4":0.00333,"12.0-12.1":0.00666,"12.2-12.5":0.38196,"13.0-13.1":0.0025,"13.2":0.0025,"13.3":0.01498,"13.4-13.7":0.03994,"14.0-14.4":0.12982,"14.5-14.8":0.27961,"15.0-15.1":0.04993,"15.2-15.3":0.08238,"15.4":0.08322,"15.5":0.20555,"15.6":0.7581,"16.0":0.46102,"16.1":1.67765,"16.2":1.74755,"16.3":1.15089,"16.4":0.00499},P:{"4":0.03367,"20":0.23566,"5.0-5.4":0.01042,"6.2-6.4":0.0206,"7.2-7.4":0.03367,"8.2":0.02044,"9.2":0.04119,"10.1":0.0217,"11.1-11.2":0.06179,"12.0":0.0206,"13.0":0.01122,"14.0":0.07209,"15.0":0.05149,"16.0":0.01122,"17.0":0.04489,"18.0":0.03367,"19.0":0.404},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00468,"4.4":0,"4.4.3-4.4.4":0.03045},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"11":0.00595,_:"6 7 8 9 10 5.5"},N:{"10":0.03712,"11":0.07423},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.81502},H:{"0":0.46562},L:{"0":61.74007},R:{_:"0"},M:{"0":0.07729},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,12 @@
|
||||
function getUserAgent() {
|
||||
if (typeof navigator === "object" && "userAgent" in navigator) {
|
||||
return navigator.userAgent;
|
||||
}
|
||||
if (typeof process === "object" && "version" in process) {
|
||||
return `Node.js/${process.version.substr(1)} (${process.platform}; ${process.arch})`;
|
||||
}
|
||||
return "<environment undetectable>";
|
||||
}
|
||||
|
||||
export { getUserAgent };
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"VirtualTimeScheduler.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/VirtualTimeScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAyBtD,YAAY,sBAA0C,aAAoB,EAAS,YAAoB,QAAQ;QAC7G,KAAK,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QADoC,cAAS,GAAT,SAAS,CAAmB;QAfxG,UAAK,GAAW,CAAC,CAAC;QAMlB,UAAK,GAAW,CAAC,CAAC,CAAC;IAW1B,CAAC;IAOM,KAAK;QACV,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QACpC,IAAI,KAAU,CAAC;QACf,IAAI,MAAoC,CAAC;QAEzC,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,IAAI,SAAS,EAAE;YACzD,OAAO,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;YAE1B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;gBACxD,MAAM;aACP;SACF;QAED,IAAI,KAAK,EAAE;YACT,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE;gBACjC,MAAM,CAAC,WAAW,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,CAAC;SACb;IACH,CAAC;;AApDM,oCAAe,GAAG,EAAE,CAAC;AAuD9B,MAAM,OAAO,aAAiB,SAAQ,WAAc;IAGlD,YACY,SAA+B,EAC/B,IAAmD,EACnD,QAAgB,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC;QAEhD,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAJb,cAAS,GAAT,SAAS,CAAsB;QAC/B,SAAI,GAAJ,IAAI,CAA+C;QACnD,UAAK,GAAL,KAAK,CAAiC;QALxC,WAAM,GAAY,IAAI,CAAC;QAQ/B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;IACvC,CAAC;IAEM,QAAQ,CAAC,KAAS,EAAE,QAAgB,CAAC;QAC1C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;gBACZ,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACrC;YACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAKpB,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5D,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjB,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACtC;aAAM;YAGL,OAAO,YAAY,CAAC,KAAK,CAAC;SAC3B;IACH,CAAC;IAES,cAAc,CAAC,SAA+B,EAAE,EAAQ,EAAE,QAAgB,CAAC;QACnF,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC;QACrC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,OAAmC,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACrE,OAAO,CAAC,CAAC;IACX,CAAC;IAES,cAAc,CAAC,SAA+B,EAAE,EAAQ,EAAE,QAAgB,CAAC;QACnF,OAAO,SAAS,CAAC;IACnB,CAAC;IAES,QAAQ,CAAC,KAAQ,EAAE,KAAa;QACxC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;YACxB,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACrC;IACH,CAAC;IAEO,MAAM,CAAC,WAAW,CAAI,CAAmB,EAAE,CAAmB;QACpE,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;YACvB,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;gBACvB,OAAO,CAAC,CAAC;aACV;iBAAM,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE;gBAC5B,OAAO,CAAC,CAAC;aACV;iBAAM;gBACL,OAAO,CAAC,CAAC,CAAC;aACX;SACF;aAAM,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE;YAC5B,OAAO,CAAC,CAAC;SACV;aAAM;YACL,OAAO,CAAC,CAAC,CAAC;SACX;IACH,CAAC;CACF"}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('flatMapDeep', require('../flatMapDeep'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,48 @@
|
||||
// Reference counter, useful for garbage collector like functionality
|
||||
|
||||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
|
||||
, create = Object.create, defineProperties = Object.defineProperties;
|
||||
|
||||
extensions.refCounter = function (ignore, conf, options) {
|
||||
var cache, postfix;
|
||||
|
||||
cache = create(null);
|
||||
postfix = (options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async" : "";
|
||||
|
||||
conf.on("set" + postfix, function (id, length) {
|
||||
cache[id] = length || 1;
|
||||
});
|
||||
conf.on("get" + postfix, function (id) {
|
||||
++cache[id];
|
||||
});
|
||||
conf.on("delete" + postfix, function (id) {
|
||||
delete cache[id];
|
||||
});
|
||||
conf.on("clear" + postfix, function () {
|
||||
cache = {};
|
||||
});
|
||||
|
||||
defineProperties(conf.memoized, {
|
||||
deleteRef: d(function () {
|
||||
var id = conf.get(arguments);
|
||||
if (id === null) return null;
|
||||
if (!cache[id]) return null;
|
||||
if (!--cache[id]) {
|
||||
conf.delete(id);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}),
|
||||
getRefCount: d(function () {
|
||||
var id = conf.get(arguments);
|
||||
if (id === null) return 0;
|
||||
if (!cache[id]) return 0;
|
||||
return cache[id];
|
||||
})
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
[![Build status][nix-build-image]][nix-build-url]
|
||||
[![Windows status][win-build-image]][win-build-url]
|
||||
![Transpilation status][transpilation-image]
|
||||
[![npm version][npm-image]][npm-url]
|
||||
|
||||
# timers-ext
|
||||
|
||||
## Timers extensions
|
||||
|
||||
### Installation
|
||||
|
||||
$ npm install timers-ext
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
### API
|
||||
|
||||
#### MAX*TIMEOUT *(timers-ext/max-timeout)\_
|
||||
|
||||
Maximum possible timeout value in milliseconds. It equals to maximum positive value for 32bit signed integer, so _2³¹ (2147483647)_, which makes it around 24.9 days
|
||||
|
||||
#### delay(fn[, timeout]) _(timers-ext/delay)_
|
||||
|
||||
Returns function which when invoked will call _fn_ function after specified
|
||||
_timeout_. If _timeout_ is not provided [nextTick](https://github.com/medikoo/next-tick/#next-tick) propagation is used.
|
||||
|
||||
#### once(fn[, timeout]) _(timers-ext/once)_
|
||||
|
||||
Makes sure to execute _fn_ function only once after a defined interval of time (debounce). If _timeout_ is not provided [nextTick](https://github.com/medikoo/next-tick/#next-tick) propagation is used.
|
||||
|
||||
```javascript
|
||||
var nextTick = require("next-tick");
|
||||
var logFoo = function() {
|
||||
console.log("foo");
|
||||
};
|
||||
var logFooOnce = require("timers-ext/once")(logFoo);
|
||||
|
||||
logFooOnce();
|
||||
logFooOnce(); // ignored, logFoo will be logged only once
|
||||
logFooOnce(); // ignored
|
||||
|
||||
nextTick(function() {
|
||||
logFooOnce(); // Invokes another log (as tick passed)
|
||||
logFooOnce(); // ignored
|
||||
logFooOnce(); // ignored
|
||||
});
|
||||
```
|
||||
|
||||
#### validTimeout(timeout) _(timers-ext/valid-timeout)_
|
||||
|
||||
Validates timeout value.
|
||||
For `NaN` resolved _timeout_ `0` is returned.
|
||||
If _timeout_ resolves to a number:
|
||||
|
||||
- for _timeout < 0_ `0` is returned
|
||||
- for _0 >= timeout <= [MAX_TIMEOUT](#max_timeout-timers-extmax-timeout)_, `timeout` value is returned
|
||||
- for _timeout > [MAX_TIMEOUT](#max_timeout-timers-extmax-timeout)_ exception is thrown
|
||||
|
||||
### Tests
|
||||
|
||||
$ npm test
|
||||
|
||||
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/timers-ext/branches/master/shields_badge.svg
|
||||
[nix-build-url]: https://semaphoreci.com/medikoo-org/timers-ext
|
||||
[win-build-image]: https://ci.appveyor.com/api/projects/status/2i5nerowov2ho3o9?svg=true
|
||||
[win-build-url]: https://ci.appveyor.com/project/medikoo/timers-ext
|
||||
[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg
|
||||
[npm-image]: https://img.shields.io/npm/v/timers-ext.svg
|
||||
[npm-url]: https://www.npmjs.com/package/timers-ext
|
||||
@@ -0,0 +1,61 @@
|
||||
// Packages
|
||||
var retrier = require('retry');
|
||||
|
||||
function retry(fn, opts) {
|
||||
function run(resolve, reject) {
|
||||
var options = opts || {};
|
||||
var op;
|
||||
|
||||
// Default `randomize` to true
|
||||
if (!('randomize' in options)) {
|
||||
options.randomize = true;
|
||||
}
|
||||
|
||||
op = retrier.operation(options);
|
||||
|
||||
// We allow the user to abort retrying
|
||||
// this makes sense in the cases where
|
||||
// knowledge is obtained that retrying
|
||||
// would be futile (e.g.: auth errors)
|
||||
|
||||
function bail(err) {
|
||||
reject(err || new Error('Aborted'));
|
||||
}
|
||||
|
||||
function onError(err, num) {
|
||||
if (err.bail) {
|
||||
bail(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!op.retry(err)) {
|
||||
reject(op.mainError());
|
||||
} else if (options.onRetry) {
|
||||
options.onRetry(err, num);
|
||||
}
|
||||
}
|
||||
|
||||
function runAttempt(num) {
|
||||
var val;
|
||||
|
||||
try {
|
||||
val = fn(bail, num);
|
||||
} catch (err) {
|
||||
onError(err, num);
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.resolve(val)
|
||||
.then(resolve)
|
||||
.catch(function catchIt(err) {
|
||||
onError(err, num);
|
||||
});
|
||||
}
|
||||
|
||||
op.attempt(runAttempt);
|
||||
}
|
||||
|
||||
return new Promise(run);
|
||||
}
|
||||
|
||||
module.exports = retry;
|
||||
@@ -0,0 +1,84 @@
|
||||
import Renderer, { BindingGroup } from './Renderer';
|
||||
import Wrapper from './wrappers/shared/Wrapper';
|
||||
import { Node, Identifier } from 'estree';
|
||||
export interface Bindings {
|
||||
object: Identifier;
|
||||
property: Identifier;
|
||||
snippet: Node;
|
||||
store: string;
|
||||
modifier: (node: Node) => Node;
|
||||
}
|
||||
export interface BlockOptions {
|
||||
parent?: Block;
|
||||
name: Identifier;
|
||||
type: string;
|
||||
renderer?: Renderer;
|
||||
comment?: string;
|
||||
key?: Identifier;
|
||||
bindings?: Map<string, Bindings>;
|
||||
dependencies?: Set<string>;
|
||||
}
|
||||
export default class Block {
|
||||
parent?: Block;
|
||||
renderer: Renderer;
|
||||
name: Identifier;
|
||||
type: string;
|
||||
comment?: string;
|
||||
wrappers: Wrapper[];
|
||||
key: Identifier;
|
||||
first: Identifier;
|
||||
dependencies: Set<string>;
|
||||
bindings: Map<string, Bindings>;
|
||||
binding_group_initialised: Set<string>;
|
||||
binding_groups: Set<BindingGroup>;
|
||||
chunks: {
|
||||
declarations: Array<Node | Node[]>;
|
||||
init: Array<Node | Node[]>;
|
||||
create: Array<Node | Node[]>;
|
||||
claim: Array<Node | Node[]>;
|
||||
hydrate: Array<Node | Node[]>;
|
||||
mount: Array<Node | Node[]>;
|
||||
measure: Array<Node | Node[]>;
|
||||
restore_measurements: Array<Node | Node[]>;
|
||||
fix: Array<Node | Node[]>;
|
||||
animate: Array<Node | Node[]>;
|
||||
intro: Array<Node | Node[]>;
|
||||
update: Array<Node | Node[]>;
|
||||
outro: Array<Node | Node[]>;
|
||||
destroy: Array<Node | Node[]>;
|
||||
};
|
||||
event_listeners: Node[];
|
||||
maintain_context: boolean;
|
||||
has_animation: boolean;
|
||||
has_intros: boolean;
|
||||
has_outros: boolean;
|
||||
has_intro_method: boolean;
|
||||
has_outro_method: boolean;
|
||||
outros: number;
|
||||
aliases: Map<string, Identifier>;
|
||||
variables: Map<string, {
|
||||
id: Identifier;
|
||||
init?: Node;
|
||||
}>;
|
||||
get_unique_name: (name: string) => Identifier;
|
||||
has_update_method: boolean;
|
||||
autofocus?: {
|
||||
element_var: string;
|
||||
condition_expression?: any;
|
||||
};
|
||||
constructor(options: BlockOptions);
|
||||
assign_variable_names(): void;
|
||||
add_dependencies(dependencies: Set<string>): void;
|
||||
add_element(id: Identifier, render_statement: Node, claim_statement: Node, parent_node: Node, no_detach?: boolean): void;
|
||||
add_intro(local?: boolean): void;
|
||||
add_outro(local?: boolean): void;
|
||||
add_animation(): void;
|
||||
add_variable(id: Identifier, init?: Node): void;
|
||||
alias(name: string): Identifier;
|
||||
child(options: BlockOptions): Block;
|
||||
get_contents(key?: any): Node[];
|
||||
has_content(): boolean;
|
||||
render(): Node[];
|
||||
render_listeners(chunk?: string): void;
|
||||
render_binding_groups(): void;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
var SetCache = require('./_SetCache'),
|
||||
arrayIncludes = require('./_arrayIncludes'),
|
||||
arrayIncludesWith = require('./_arrayIncludesWith'),
|
||||
arrayMap = require('./_arrayMap'),
|
||||
baseUnary = require('./_baseUnary'),
|
||||
cacheHas = require('./_cacheHas');
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* The base implementation of methods like `_.intersection`, without support
|
||||
* for iteratee shorthands, that accepts an array of arrays to inspect.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} arrays The arrays to inspect.
|
||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
||||
* @param {Function} [comparator] The comparator invoked per element.
|
||||
* @returns {Array} Returns the new array of shared values.
|
||||
*/
|
||||
function baseIntersection(arrays, iteratee, comparator) {
|
||||
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
||||
length = arrays[0].length,
|
||||
othLength = arrays.length,
|
||||
othIndex = othLength,
|
||||
caches = Array(othLength),
|
||||
maxLength = Infinity,
|
||||
result = [];
|
||||
|
||||
while (othIndex--) {
|
||||
var array = arrays[othIndex];
|
||||
if (othIndex && iteratee) {
|
||||
array = arrayMap(array, baseUnary(iteratee));
|
||||
}
|
||||
maxLength = nativeMin(array.length, maxLength);
|
||||
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
|
||||
? new SetCache(othIndex && array)
|
||||
: undefined;
|
||||
}
|
||||
array = arrays[0];
|
||||
|
||||
var index = -1,
|
||||
seen = caches[0];
|
||||
|
||||
outer:
|
||||
while (++index < length && result.length < maxLength) {
|
||||
var value = array[index],
|
||||
computed = iteratee ? iteratee(value) : value;
|
||||
|
||||
value = (comparator || value !== 0) ? value : 0;
|
||||
if (!(seen
|
||||
? cacheHas(seen, computed)
|
||||
: includes(result, computed, comparator)
|
||||
)) {
|
||||
othIndex = othLength;
|
||||
while (--othIndex) {
|
||||
var cache = caches[othIndex];
|
||||
if (!(cache
|
||||
? cacheHas(cache, computed)
|
||||
: includes(arrays[othIndex], computed, comparator))
|
||||
) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
if (seen) {
|
||||
seen.push(computed);
|
||||
}
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseIntersection;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E CC","260":"F A B"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K L EC FC"},D:{"1":"QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB","132":"CB DB EB FB GB HB IB JB KB LB MB NB OB PB"},E:{"1":"C K L G qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D F A B HC zB IC JC LC 0B","132":"E KC"},F:{"1":"DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e rB","2":"G M N O w g x y","4":"B C QC RC SC qB AC TC","16":"F PC","132":"0 1 2 3 4 5 6 7 8 9 z AB BB CB"},G:{"1":"eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC VC WC XC ZC aC bC cC dC","132":"E YC"},H:{"1":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D","132":"A"},K:{"1":"h rB","4":"A B C qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","132":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:4,C:"SVG fragment identifiers"};
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@octokit/auth-token",
|
||||
"description": "GitHub API token authentication for browsers and Node.js",
|
||||
"version": "3.0.3",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist-*/",
|
||||
"bin/"
|
||||
],
|
||||
"source": "dist-src/index.js",
|
||||
"types": "dist-types/index.d.ts",
|
||||
"main": "dist-node/index.js",
|
||||
"module": "dist-web/index.js",
|
||||
"pika": true,
|
||||
"sideEffects": false,
|
||||
"keywords": [
|
||||
"github",
|
||||
"octokit",
|
||||
"authentication",
|
||||
"api"
|
||||
],
|
||||
"repository": "github:octokit/auth-token.js",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@octokit/core": "^4.0.0",
|
||||
"@octokit/request": "^6.0.0",
|
||||
"@pika/pack": "^0.3.7",
|
||||
"@pika/plugin-build-node": "^0.9.0",
|
||||
"@pika/plugin-build-web": "^0.9.0",
|
||||
"@pika/plugin-ts-standard-pkg": "^0.9.0",
|
||||
"@types/fetch-mock": "^7.3.1",
|
||||
"@types/jest": "^29.0.0",
|
||||
"fetch-mock": "^9.0.0",
|
||||
"jest": "^29.0.0",
|
||||
"prettier": "2.8.3",
|
||||
"semantic-release": "^20.0.0",
|
||||
"ts-jest": "^29.0.0",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.add = exports.toBig = exports.split = exports.fromBig = void 0;
|
||||
const U32_MASK64 = BigInt(2 ** 32 - 1);
|
||||
const _32n = BigInt(32);
|
||||
// We are not using BigUint64Array, because they are extremely slow as per 2022
|
||||
function fromBig(n, le = false) {
|
||||
if (le)
|
||||
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
||||
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
||||
}
|
||||
exports.fromBig = fromBig;
|
||||
function split(lst, le = false) {
|
||||
let Ah = new Uint32Array(lst.length);
|
||||
let Al = new Uint32Array(lst.length);
|
||||
for (let i = 0; i < lst.length; i++) {
|
||||
const { h, l } = fromBig(lst[i], le);
|
||||
[Ah[i], Al[i]] = [h, l];
|
||||
}
|
||||
return [Ah, Al];
|
||||
}
|
||||
exports.split = split;
|
||||
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
||||
exports.toBig = toBig;
|
||||
// for Shift in [0, 32)
|
||||
const shrSH = (h, l, s) => h >>> s;
|
||||
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
||||
// Right rotate for Shift in [1, 32)
|
||||
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
|
||||
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
||||
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
|
||||
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
|
||||
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
||||
// Right rotate for shift===32 (just swaps l&h)
|
||||
const rotr32H = (h, l) => l;
|
||||
const rotr32L = (h, l) => h;
|
||||
// Left rotate for Shift in [1, 32)
|
||||
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
||||
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
||||
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
||||
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
||||
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
||||
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
||||
// simple take carry out of low bit sum by shift, we need to use division.
|
||||
// Removing "export" has 5% perf penalty -_-
|
||||
function add(Ah, Al, Bh, Bl) {
|
||||
const l = (Al >>> 0) + (Bl >>> 0);
|
||||
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
||||
}
|
||||
exports.add = add;
|
||||
// Addition with more than 2 elements
|
||||
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
||||
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
||||
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
||||
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
||||
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
||||
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
||||
// prettier-ignore
|
||||
const u64 = {
|
||||
fromBig, split, toBig: exports.toBig,
|
||||
shrSH, shrSL,
|
||||
rotrSH, rotrSL, rotrBH, rotrBL,
|
||||
rotr32H, rotr32L,
|
||||
rotlSH, rotlSL, rotlBH, rotlBL,
|
||||
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
||||
};
|
||||
exports.default = u64;
|
||||
//# sourceMappingURL=_u64.js.map
|
||||
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.firstValueFrom = void 0;
|
||||
var EmptyError_1 = require("./util/EmptyError");
|
||||
var Subscriber_1 = require("./Subscriber");
|
||||
function firstValueFrom(source, config) {
|
||||
var hasConfig = typeof config === 'object';
|
||||
return new Promise(function (resolve, reject) {
|
||||
var subscriber = new Subscriber_1.SafeSubscriber({
|
||||
next: function (value) {
|
||||
resolve(value);
|
||||
subscriber.unsubscribe();
|
||||
},
|
||||
error: reject,
|
||||
complete: function () {
|
||||
if (hasConfig) {
|
||||
resolve(config.defaultValue);
|
||||
}
|
||||
else {
|
||||
reject(new EmptyError_1.EmptyError());
|
||||
}
|
||||
},
|
||||
});
|
||||
source.subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
exports.firstValueFrom = firstValueFrom;
|
||||
//# sourceMappingURL=firstValueFrom.js.map
|
||||
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
var exp = Math.exp;
|
||||
|
||||
module.exports = function (value) {
|
||||
if (isNaN(value)) return NaN;
|
||||
value = Number(value);
|
||||
if (value === 0) return 1;
|
||||
if (!isFinite(value)) return Infinity;
|
||||
return (exp(value) + exp(-value)) / 2;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { observable as Symbol_observable } from '../symbol/observable';
|
||||
import { isFunction } from './isFunction';
|
||||
export function isInteropObservable(input) {
|
||||
return isFunction(input[Symbol_observable]);
|
||||
}
|
||||
//# sourceMappingURL=isInteropObservable.js.map
|
||||
@@ -0,0 +1,63 @@
|
||||
import type { CreateAuth } from '../models/CreateAuth';
|
||||
import type { CreateResetToken } from '../models/CreateResetToken';
|
||||
import type { HandleLogout } from '../models/HandleLogout';
|
||||
import type { IllegalJWTError } from '../models/IllegalJWTError';
|
||||
import type { InvalidCredentialsError } from '../models/InvalidCredentialsError';
|
||||
import type { JwtNotProvidedError } from '../models/JwtNotProvidedError';
|
||||
import type { Logout } from '../models/Logout';
|
||||
import type { PasswordNeededError } from '../models/PasswordNeededError';
|
||||
import type { RefreshAuth } from '../models/RefreshAuth';
|
||||
import type { RefreshTokenCountInvalidError } from '../models/RefreshTokenCountInvalidError';
|
||||
import type { ResetPassword } from '../models/ResetPassword';
|
||||
import type { ResponseAuth } from '../models/ResponseAuth';
|
||||
import type { ResponseEmpty } from '../models/ResponseEmpty';
|
||||
import type { UsernameOrEmailNeededError } from '../models/UsernameOrEmailNeededError';
|
||||
import type { UserNotFoundError } from '../models/UserNotFoundError';
|
||||
export declare class AuthService {
|
||||
/**
|
||||
* Login
|
||||
* Login with your username/email and password. <br> You will receive:
|
||||
* * access token (use it as a bearer token)
|
||||
* * refresh token (will also be sent as a cookie)
|
||||
* @param requestBody CreateAuth
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static authControllerLogin(requestBody?: CreateAuth): Promise<(ResponseAuth | InvalidCredentialsError | UserNotFoundError | UsernameOrEmailNeededError | PasswordNeededError | InvalidCredentialsError)>;
|
||||
/**
|
||||
* Logout
|
||||
* Logout using your refresh token. <br> This instantly invalidates all your access and refresh tokens.
|
||||
* @param requestBody HandleLogout
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static authControllerLogout(requestBody?: HandleLogout): Promise<(Logout | InvalidCredentialsError | UserNotFoundError | UsernameOrEmailNeededError | PasswordNeededError | InvalidCredentialsError)>;
|
||||
/**
|
||||
* Refresh
|
||||
* Refresh your access and refresh tokens using a valid refresh token. <br> You will receive:
|
||||
* * access token (use it as a bearer token)
|
||||
* * refresh token (will also be sent as a cookie)
|
||||
* @param requestBody RefreshAuth
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static authControllerRefresh(requestBody?: RefreshAuth): Promise<(ResponseAuth | JwtNotProvidedError | IllegalJWTError | UserNotFoundError | RefreshTokenCountInvalidError)>;
|
||||
/**
|
||||
* Get reset token
|
||||
* Request a password reset token. <br> This will provide you with a reset token that you can use by posting to /api/auth/reset/{token}.
|
||||
* @param locale
|
||||
* @param requestBody CreateResetToken
|
||||
* @result ResponseEmpty
|
||||
* @throws ApiError
|
||||
*/
|
||||
static authControllerGetResetToken(locale?: string, requestBody?: CreateResetToken): Promise<ResponseEmpty>;
|
||||
/**
|
||||
* Reset password
|
||||
* Reset a user's utilising a valid password reset token. <br> This will set the user's password to the one you provided in the body. <br> To get a reset token post to /api/auth/reset with your username.
|
||||
* @param token
|
||||
* @param requestBody ResetPassword
|
||||
* @result any
|
||||
* @throws ApiError
|
||||
*/
|
||||
static authControllerResetPassword(token: string, requestBody?: ResetPassword): Promise<(ResponseAuth | UserNotFoundError | UsernameOrEmailNeededError)>;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
var isValue = require("../value/is");
|
||||
|
||||
module.exports = function (value) {
|
||||
if (!isValue(value)) return null;
|
||||
try {
|
||||
value = +value; // Ensure implicit coercion
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
if (isNaN(value)) return null;
|
||||
return value;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
var apply = require('./_apply'),
|
||||
arrayMap = require('./_arrayMap'),
|
||||
baseFlatten = require('./_baseFlatten'),
|
||||
baseIteratee = require('./_baseIteratee'),
|
||||
baseRest = require('./_baseRest'),
|
||||
baseUnary = require('./_baseUnary'),
|
||||
castRest = require('./_castRest'),
|
||||
isArray = require('./isArray');
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with its arguments transformed.
|
||||
*
|
||||
* @static
|
||||
* @since 4.0.0
|
||||
* @memberOf _
|
||||
* @category Function
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {...(Function|Function[])} [transforms=[_.identity]]
|
||||
* The argument transforms.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* function doubled(n) {
|
||||
* return n * 2;
|
||||
* }
|
||||
*
|
||||
* function square(n) {
|
||||
* return n * n;
|
||||
* }
|
||||
*
|
||||
* var func = _.overArgs(function(x, y) {
|
||||
* return [x, y];
|
||||
* }, [square, doubled]);
|
||||
*
|
||||
* func(9, 3);
|
||||
* // => [81, 6]
|
||||
*
|
||||
* func(10, 5);
|
||||
* // => [100, 10]
|
||||
*/
|
||||
var overArgs = castRest(function(func, transforms) {
|
||||
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
||||
? arrayMap(transforms[0], baseUnary(baseIteratee))
|
||||
: arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
|
||||
|
||||
var funcsLength = transforms.length;
|
||||
return baseRest(function(args) {
|
||||
var index = -1,
|
||||
length = nativeMin(args.length, funcsLength);
|
||||
|
||||
while (++index < length) {
|
||||
args[index] = transforms[index].call(this, args[index]);
|
||||
}
|
||||
return apply(func, this, args);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = overArgs;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","16":"CC","900":"J D E F"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","1025":"C K L G M N O"},C:{"1":"RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","900":"DC tB EC FC","1025":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","16":"v HC","900":"I zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","16":"F","132":"B C PC QC RC SC qB AC TC rB"},G:{"1":"UC BC VC WC XC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","16":"zB","2052":"E YC"},H:{"132":"oC"},I:{"1":"tB I rC sC BC tC uC","16":"pC qC","4097":"f"},J:{"1":"D A"},K:{"132":"A B C qB AC rB","4097":"h"},L:{"4097":"H"},M:{"4097":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"4097":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1025":"AD BD"}},B:1,C:"maxlength attribute for input and textarea elements"};
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isArrayLikeObject', require('../isArrayLikeObject'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAC,MAAM,SAAS,CAAA;AAC9C,OAAO,EAIL,oBAAoB,EAMrB,MAAM,SAAS,CAAA;AAiBhB,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;CACrB;AAED,oBAAY,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI;IAAC,GAAG,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAC,GAAG;IAAC,GAAG,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,CAAC,CAAA;CAAC,CAAA;AA+KpE,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,MAAM,CAAC,CAAa;IAE5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,oBAAoB,CAAC,CAAS;gBAE1B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;IASxD,KAAK,IAAI,MAAM,CAAC,oBAAoB,EAAE,EAAE,WAAW,CAAC;IAOpD,OAAO,CAAC,YAAY;IA6DpB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,QAAQ;IAkFhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,YAAY;IAuCpB,wBAAwB,IAAI,MAAM,GAAG,IAAI;IAczC;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAsDrB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,aAAa;IAsFrB;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,oBAAoB;IAyO5B,OAAO,CAAC,qBAAqB;IAe7B;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAiDrC,OAAO,CAAC,6BAA6B;IAwBrC;;;;;;;;;OASG;IACH,OAAO,CAAC,6BAA6B;IA6GrC,OAAO,CAAC,sBAAsB;IAuC9B,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,aAAa;IASrB;;;OAGG;IACH,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,KAAK;IAcb,oDAAoD;IACpD,OAAO,CAAC,IAAI;IAgBZ;;;;;OAKG;IACH,OAAO,CAAC,MAAM;IAUd;;;OAGG;IACH,OAAO,CAAC,SAAS;IAYjB;;;OAGG;IACH,OAAO,CAAC,MAAM;IA0Bd,sFAAsF;IACtF,OAAO,CAAC,SAAS;IAMjB;;;OAGG;IACH,OAAO,CAAC,IAAI;CASb"}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { EnsureOptions } from '../ensure';
|
||||
|
||||
declare function ensureValue<T>(value: any, options?: EnsureOptions): T;
|
||||
export default ensureValue;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,295 @@
|
||||
"use strict";
|
||||
|
||||
var gitUp = require("git-up");
|
||||
|
||||
/**
|
||||
* gitUrlParse
|
||||
* Parses a Git url.
|
||||
*
|
||||
* @name gitUrlParse
|
||||
* @function
|
||||
* @param {String} url The Git url to parse.
|
||||
* @return {GitUrl} The `GitUrl` object containing:
|
||||
*
|
||||
* - `protocols` (Array): An array with the url protocols (usually it has one element).
|
||||
* - `port` (null|Number): The domain port.
|
||||
* - `resource` (String): The url domain (including subdomains).
|
||||
* - `user` (String): The authentication user (usually for ssh urls).
|
||||
* - `pathname` (String): The url pathname.
|
||||
* - `hash` (String): The url hash.
|
||||
* - `search` (String): The url querystring value.
|
||||
* - `href` (String): The input url.
|
||||
* - `protocol` (String): The git url protocol.
|
||||
* - `token` (String): The oauth token (could appear in the https urls).
|
||||
* - `source` (String): The Git provider (e.g. `"github.com"`).
|
||||
* - `owner` (String): The repository owner.
|
||||
* - `name` (String): The repository name.
|
||||
* - `ref` (String): The repository ref (e.g., "master" or "dev").
|
||||
* - `filepath` (String): A filepath relative to the repository root.
|
||||
* - `filepathtype` (String): The type of filepath in the url ("blob" or "tree").
|
||||
* - `full_name` (String): The owner and name values in the `owner/name` format.
|
||||
* - `toString` (Function): A function to stringify the parsed url into another url type.
|
||||
* - `organization` (String): The organization the owner belongs to. This is CloudForge specific.
|
||||
* - `git_suffix` (Boolean): Whether to add the `.git` suffix or not.
|
||||
*
|
||||
*/
|
||||
function gitUrlParse(url) {
|
||||
|
||||
if (typeof url !== "string") {
|
||||
throw new Error("The url must be a string.");
|
||||
}
|
||||
|
||||
var shorthandRe = /^([a-z\d-]{1,39})\/([-\.\w]{1,100})$/i;
|
||||
|
||||
if (shorthandRe.test(url)) {
|
||||
url = "https://github.com/" + url;
|
||||
}
|
||||
|
||||
var urlInfo = gitUp(url),
|
||||
sourceParts = urlInfo.resource.split("."),
|
||||
splits = null;
|
||||
|
||||
urlInfo.toString = function (type) {
|
||||
return gitUrlParse.stringify(this, type);
|
||||
};
|
||||
|
||||
urlInfo.source = sourceParts.length > 2 ? sourceParts.slice(1 - sourceParts.length).join(".") : urlInfo.source = urlInfo.resource;
|
||||
|
||||
// Note: Some hosting services (e.g. Visual Studio Team Services) allow whitespace characters
|
||||
// in the repository and owner names so we decode the URL pieces to get the correct result
|
||||
urlInfo.git_suffix = /\.git$/.test(urlInfo.pathname);
|
||||
urlInfo.name = decodeURIComponent((urlInfo.pathname || urlInfo.href).replace(/(^\/)|(\/$)/g, '').replace(/\.git$/, ""));
|
||||
urlInfo.owner = decodeURIComponent(urlInfo.user);
|
||||
|
||||
switch (urlInfo.source) {
|
||||
case "git.cloudforge.com":
|
||||
urlInfo.owner = urlInfo.user;
|
||||
urlInfo.organization = sourceParts[0];
|
||||
urlInfo.source = "cloudforge.com";
|
||||
break;
|
||||
case "visualstudio.com":
|
||||
// Handle VSTS SSH URLs
|
||||
if (urlInfo.resource === 'vs-ssh.visualstudio.com') {
|
||||
splits = urlInfo.name.split("/");
|
||||
if (splits.length === 4) {
|
||||
urlInfo.organization = splits[1];
|
||||
urlInfo.owner = splits[2];
|
||||
urlInfo.name = splits[3];
|
||||
urlInfo.full_name = splits[2] + '/' + splits[3];
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
splits = urlInfo.name.split("/");
|
||||
if (splits.length === 2) {
|
||||
urlInfo.owner = splits[1];
|
||||
urlInfo.name = splits[1];
|
||||
urlInfo.full_name = '_git/' + urlInfo.name;
|
||||
} else if (splits.length === 3) {
|
||||
urlInfo.name = splits[2];
|
||||
if (splits[0] === 'DefaultCollection') {
|
||||
urlInfo.owner = splits[2];
|
||||
urlInfo.organization = splits[0];
|
||||
urlInfo.full_name = urlInfo.organization + '/_git/' + urlInfo.name;
|
||||
} else {
|
||||
urlInfo.owner = splits[0];
|
||||
urlInfo.full_name = urlInfo.owner + '/_git/' + urlInfo.name;
|
||||
}
|
||||
} else if (splits.length === 4) {
|
||||
urlInfo.organization = splits[0];
|
||||
urlInfo.owner = splits[1];
|
||||
urlInfo.name = splits[3];
|
||||
urlInfo.full_name = urlInfo.organization + '/' + urlInfo.owner + '/_git/' + urlInfo.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Azure DevOps (formerly Visual Studio Team Services)
|
||||
case "dev.azure.com":
|
||||
case "azure.com":
|
||||
if (urlInfo.resource === 'ssh.dev.azure.com') {
|
||||
splits = urlInfo.name.split("/");
|
||||
if (splits.length === 4) {
|
||||
urlInfo.organization = splits[1];
|
||||
urlInfo.owner = splits[2];
|
||||
urlInfo.name = splits[3];
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
splits = urlInfo.name.split("/");
|
||||
if (splits.length === 5) {
|
||||
urlInfo.organization = splits[0];
|
||||
urlInfo.owner = splits[1];
|
||||
urlInfo.name = splits[4];
|
||||
urlInfo.full_name = '_git/' + urlInfo.name;
|
||||
} else if (splits.length === 3) {
|
||||
urlInfo.name = splits[2];
|
||||
if (splits[0] === 'DefaultCollection') {
|
||||
urlInfo.owner = splits[2];
|
||||
urlInfo.organization = splits[0];
|
||||
urlInfo.full_name = urlInfo.organization + '/_git/' + urlInfo.name;
|
||||
} else {
|
||||
urlInfo.owner = splits[0];
|
||||
urlInfo.full_name = urlInfo.owner + '/_git/' + urlInfo.name;
|
||||
}
|
||||
} else if (splits.length === 4) {
|
||||
urlInfo.organization = splits[0];
|
||||
urlInfo.owner = splits[1];
|
||||
urlInfo.name = splits[3];
|
||||
urlInfo.full_name = urlInfo.organization + '/' + urlInfo.owner + '/_git/' + urlInfo.name;
|
||||
}
|
||||
if (urlInfo.query && urlInfo.query['path']) {
|
||||
urlInfo.filepath = urlInfo.query['path'].replace(/^\/+/g, ''); // Strip leading slash (/)
|
||||
}
|
||||
if (urlInfo.query && urlInfo.query['version']) {
|
||||
// version=GB<branch>
|
||||
urlInfo.ref = urlInfo.query['version'].replace(/^GB/, ''); // remove GB
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
splits = urlInfo.name.split("/");
|
||||
var nameIndex = splits.length - 1;
|
||||
if (splits.length >= 2) {
|
||||
var dashIndex = splits.indexOf("-", 2);
|
||||
var blobIndex = splits.indexOf("blob", 2);
|
||||
var treeIndex = splits.indexOf("tree", 2);
|
||||
var commitIndex = splits.indexOf("commit", 2);
|
||||
var srcIndex = splits.indexOf("src", 2);
|
||||
var rawIndex = splits.indexOf("raw", 2);
|
||||
var editIndex = splits.indexOf("edit", 2);
|
||||
nameIndex = dashIndex > 0 ? dashIndex - 1 : blobIndex > 0 ? blobIndex - 1 : treeIndex > 0 ? treeIndex - 1 : commitIndex > 0 ? commitIndex - 1 : srcIndex > 0 ? srcIndex - 1 : rawIndex > 0 ? rawIndex - 1 : editIndex > 0 ? editIndex - 1 : nameIndex;
|
||||
|
||||
urlInfo.owner = splits.slice(0, nameIndex).join('/');
|
||||
urlInfo.name = splits[nameIndex];
|
||||
if (commitIndex) {
|
||||
urlInfo.commit = splits[nameIndex + 2];
|
||||
}
|
||||
}
|
||||
|
||||
urlInfo.ref = "";
|
||||
urlInfo.filepathtype = "";
|
||||
urlInfo.filepath = "";
|
||||
var offsetNameIndex = splits.length > nameIndex && splits[nameIndex + 1] === "-" ? nameIndex + 1 : nameIndex;
|
||||
|
||||
if (splits.length > offsetNameIndex + 2 && ["raw", "src", "blob", "tree", "edit"].indexOf(splits[offsetNameIndex + 1]) >= 0) {
|
||||
urlInfo.filepathtype = splits[offsetNameIndex + 1];
|
||||
urlInfo.ref = splits[offsetNameIndex + 2];
|
||||
if (splits.length > offsetNameIndex + 3) {
|
||||
urlInfo.filepath = splits.slice(offsetNameIndex + 3).join('/');
|
||||
}
|
||||
}
|
||||
urlInfo.organization = urlInfo.owner;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!urlInfo.full_name) {
|
||||
urlInfo.full_name = urlInfo.owner;
|
||||
if (urlInfo.name) {
|
||||
urlInfo.full_name && (urlInfo.full_name += "/");
|
||||
urlInfo.full_name += urlInfo.name;
|
||||
}
|
||||
}
|
||||
// Bitbucket Server
|
||||
if (urlInfo.owner.startsWith("scm/")) {
|
||||
urlInfo.source = "bitbucket-server";
|
||||
urlInfo.owner = urlInfo.owner.replace("scm/", "");
|
||||
urlInfo.organization = urlInfo.owner;
|
||||
urlInfo.full_name = urlInfo.owner + "/" + urlInfo.name;
|
||||
}
|
||||
|
||||
var bitbucket = /(projects|users)\/(.*?)\/repos\/(.*?)((\/.*$)|$)/;
|
||||
var matches = bitbucket.exec(urlInfo.pathname);
|
||||
if (matches != null) {
|
||||
urlInfo.source = "bitbucket-server";
|
||||
if (matches[1] === "users") {
|
||||
urlInfo.owner = "~" + matches[2];
|
||||
} else {
|
||||
urlInfo.owner = matches[2];
|
||||
}
|
||||
|
||||
urlInfo.organization = urlInfo.owner;
|
||||
urlInfo.name = matches[3];
|
||||
|
||||
splits = matches[4].split("/");
|
||||
if (splits.length > 1) {
|
||||
if (["raw", "browse"].indexOf(splits[1]) >= 0) {
|
||||
urlInfo.filepathtype = splits[1];
|
||||
if (splits.length > 2) {
|
||||
urlInfo.filepath = splits.slice(2).join('/');
|
||||
}
|
||||
} else if (splits[1] === "commits" && splits.length > 2) {
|
||||
urlInfo.commit = splits[2];
|
||||
}
|
||||
}
|
||||
urlInfo.full_name = urlInfo.owner + "/" + urlInfo.name;
|
||||
|
||||
if (urlInfo.query.at) {
|
||||
urlInfo.ref = urlInfo.query.at;
|
||||
} else {
|
||||
urlInfo.ref = "";
|
||||
}
|
||||
}
|
||||
return urlInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* stringify
|
||||
* Stringifies a `GitUrl` object.
|
||||
*
|
||||
* @name stringify
|
||||
* @function
|
||||
* @param {GitUrl} obj The parsed Git url object.
|
||||
* @param {String} type The type of the stringified url (default `obj.protocol`).
|
||||
* @return {String} The stringified url.
|
||||
*/
|
||||
gitUrlParse.stringify = function (obj, type) {
|
||||
type = type || (obj.protocols && obj.protocols.length ? obj.protocols.join('+') : obj.protocol);
|
||||
var port = obj.port ? ":" + obj.port : '';
|
||||
var user = obj.user || 'git';
|
||||
var maybeGitSuffix = obj.git_suffix ? ".git" : "";
|
||||
switch (type) {
|
||||
case "ssh":
|
||||
if (port) return "ssh://" + user + "@" + obj.resource + port + "/" + obj.full_name + maybeGitSuffix;else return user + "@" + obj.resource + ":" + obj.full_name + maybeGitSuffix;
|
||||
case "git+ssh":
|
||||
case "ssh+git":
|
||||
case "ftp":
|
||||
case "ftps":
|
||||
return type + "://" + user + "@" + obj.resource + port + "/" + obj.full_name + maybeGitSuffix;
|
||||
case "http":
|
||||
case "https":
|
||||
var auth = obj.token ? buildToken(obj) : obj.user && (obj.protocols.includes('http') || obj.protocols.includes('https')) ? obj.user + "@" : "";
|
||||
return type + "://" + auth + obj.resource + port + "/" + buildPath(obj) + maybeGitSuffix;
|
||||
default:
|
||||
return obj.href;
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* buildToken
|
||||
* Builds OAuth token prefix (helper function)
|
||||
*
|
||||
* @name buildToken
|
||||
* @function
|
||||
* @param {GitUrl} obj The parsed Git url object.
|
||||
* @return {String} token prefix
|
||||
*/
|
||||
function buildToken(obj) {
|
||||
switch (obj.source) {
|
||||
case "bitbucket.org":
|
||||
return "x-token-auth:" + obj.token + "@";
|
||||
default:
|
||||
return obj.token + "@";
|
||||
}
|
||||
}
|
||||
|
||||
function buildPath(obj) {
|
||||
switch (obj.source) {
|
||||
case "bitbucket-server":
|
||||
return "scm/" + obj.full_name;
|
||||
default:
|
||||
return "" + obj.full_name;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = gitUrlParse;
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function () {
|
||||
var arr = [1, 2, 3, 4, 5];
|
||||
if (typeof arr.copyWithin !== "function") return false;
|
||||
return String(arr.copyWithin(1, 3)) === "1,4,5,4,5";
|
||||
};
|
||||
@@ -0,0 +1,347 @@
|
||||
/**
|
||||
* Emulates forthcoming HMR hooks in Svelte.
|
||||
*
|
||||
* All references to private component state ($$) are now isolated in this
|
||||
* module.
|
||||
*/
|
||||
import {
|
||||
current_component,
|
||||
get_current_component,
|
||||
set_current_component,
|
||||
} from 'svelte/internal'
|
||||
|
||||
const captureState = cmp => {
|
||||
// sanity check: propper behaviour here is to crash noisily so that
|
||||
// user knows that they're looking at something broken
|
||||
if (!cmp) {
|
||||
throw new Error('Missing component')
|
||||
}
|
||||
if (!cmp.$$) {
|
||||
throw new Error('Invalid component')
|
||||
}
|
||||
|
||||
const {
|
||||
$$: { callbacks, bound, ctx, props },
|
||||
} = cmp
|
||||
|
||||
const state = cmp.$capture_state()
|
||||
|
||||
// capturing current value of props (or we'll recreate the component with the
|
||||
// initial prop values, that may have changed -- and would not be reflected in
|
||||
// options.props)
|
||||
const hmr_props_values = {}
|
||||
Object.keys(cmp.$$.props).forEach(prop => {
|
||||
hmr_props_values[prop] = ctx[props[prop]]
|
||||
})
|
||||
|
||||
return {
|
||||
ctx,
|
||||
props,
|
||||
callbacks,
|
||||
bound,
|
||||
state,
|
||||
hmr_props_values,
|
||||
}
|
||||
}
|
||||
|
||||
// remapping all existing bindings (including hmr_future_foo ones) to the
|
||||
// new version's props indexes, and refresh them with the new value from
|
||||
// context
|
||||
const restoreBound = (cmp, restore) => {
|
||||
// reverse prop:ctxIndex in $$.props to ctxIndex:prop
|
||||
//
|
||||
// ctxIndex can be either a regular index in $$.ctx or a hmr_future_ prop
|
||||
//
|
||||
const propsByIndex = {}
|
||||
for (const [name, i] of Object.entries(restore.props)) {
|
||||
propsByIndex[i] = name
|
||||
}
|
||||
|
||||
// NOTE $$.bound cannot change in the HMR lifetime of a component, because
|
||||
// if bindings changes, that means the parent component has changed,
|
||||
// which means the child (current) component will be wholly recreated
|
||||
for (const [oldIndex, updateBinding] of Object.entries(restore.bound)) {
|
||||
// can be either regular prop, or future_hmr_ prop
|
||||
const propName = propsByIndex[oldIndex]
|
||||
|
||||
// this should never happen if remembering of future props is enabled...
|
||||
// in any case, there's nothing we can do about it if we have lost prop
|
||||
// name knowledge at this point
|
||||
if (propName == null) continue
|
||||
|
||||
// NOTE $$.props[propName] also propagates knowledge of a possible
|
||||
// future prop to the new $$.props (via $$.props being a Proxy)
|
||||
const newIndex = cmp.$$.props[propName]
|
||||
cmp.$$.bound[newIndex] = updateBinding
|
||||
|
||||
// NOTE if the prop doesn't exist or doesn't exist anymore in the new
|
||||
// version of the component, clearing the binding is the expected
|
||||
// behaviour (since that's what would happen in non HMR code)
|
||||
const newValue = cmp.$$.ctx[newIndex]
|
||||
updateBinding(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
// restoreState
|
||||
//
|
||||
// It is too late to restore context at this point because component instance
|
||||
// function has already been called (and so context has already been read).
|
||||
// Instead, we rely on setting current_component to the same value it has when
|
||||
// the component was first rendered -- which fix support for context, and is
|
||||
// also generally more respectful of normal operation.
|
||||
//
|
||||
const restoreState = (cmp, restore) => {
|
||||
if (!restore) return
|
||||
|
||||
if (restore.callbacks) {
|
||||
cmp.$$.callbacks = restore.callbacks
|
||||
}
|
||||
|
||||
if (restore.bound) {
|
||||
restoreBound(cmp, restore)
|
||||
}
|
||||
|
||||
// props, props.$$slots are restored at component creation (works
|
||||
// better -- well, at all actually)
|
||||
}
|
||||
|
||||
const get_current_component_safe = () => {
|
||||
// NOTE relying on dynamic bindings (current_component) makes us dependent on
|
||||
// bundler config (and apparently it does not work in demo-svelte-nollup)
|
||||
try {
|
||||
// unfortunately, unlike current_component, get_current_component() can
|
||||
// crash in the normal path (when there is really no parent)
|
||||
return get_current_component()
|
||||
} catch (err) {
|
||||
// ... so we need to consider that this error means that there is no parent
|
||||
//
|
||||
// that makes us tightly coupled to the error message but, at least, we
|
||||
// won't mute an unexpected error, which is quite a horrible thing to do
|
||||
if (err.message === 'Function called outside component initialization') {
|
||||
// who knows...
|
||||
return current_component
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const createProxiedComponent = (
|
||||
Component,
|
||||
initialOptions,
|
||||
{ allowLiveBinding, onInstance, onMount, onDestroy }
|
||||
) => {
|
||||
let cmp
|
||||
let options = initialOptions
|
||||
|
||||
const isCurrent = _cmp => cmp === _cmp
|
||||
|
||||
const assignOptions = (target, anchor, restore, preserveLocalState) => {
|
||||
const props = Object.assign({}, options.props)
|
||||
|
||||
// Filtering props to avoid "unexpected prop" warning
|
||||
// NOTE this is based on props present in initial options, but it should
|
||||
// always works, because props that are passed from the parent can't
|
||||
// change without a code change to the parent itself -- hence, the
|
||||
// child component will be fully recreated, and initial options should
|
||||
// always represent props that are currnetly passed by the parent
|
||||
if (options.props && restore.hmr_props_values) {
|
||||
for (const prop of Object.keys(options.props)) {
|
||||
if (restore.hmr_props_values.hasOwnProperty(prop)) {
|
||||
props[prop] = restore.hmr_props_values[prop]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preserveLocalState && restore.state) {
|
||||
if (Array.isArray(preserveLocalState)) {
|
||||
// form ['a', 'b'] => preserve only 'a' and 'b'
|
||||
props.$$inject = {}
|
||||
for (const key of preserveLocalState) {
|
||||
props.$$inject[key] = restore.state[key]
|
||||
}
|
||||
} else {
|
||||
props.$$inject = restore.state
|
||||
}
|
||||
} else {
|
||||
delete props.$$inject
|
||||
}
|
||||
options = Object.assign({}, initialOptions, {
|
||||
target,
|
||||
anchor,
|
||||
props,
|
||||
hydrate: false,
|
||||
})
|
||||
}
|
||||
|
||||
// Preserving knowledge of "future props" -- very hackish version (maybe
|
||||
// there should be an option to opt out of this)
|
||||
//
|
||||
// The use case is bind:something where something doesn't exist yet in the
|
||||
// target component, but comes to exist later, after a HMR update.
|
||||
//
|
||||
// If Svelte can't map a prop in the current version of the component, it
|
||||
// will just completely discard it:
|
||||
// https://github.com/sveltejs/svelte/blob/1632bca34e4803d6b0e0b0abd652ab5968181860/src/runtime/internal/Component.ts#L46
|
||||
//
|
||||
const rememberFutureProps = cmp => {
|
||||
if (typeof Proxy === 'undefined') return
|
||||
|
||||
cmp.$$.props = new Proxy(cmp.$$.props, {
|
||||
get(target, name) {
|
||||
if (target[name] === undefined) {
|
||||
target[name] = 'hmr_future_' + name
|
||||
}
|
||||
return target[name]
|
||||
},
|
||||
set(target, name, value) {
|
||||
target[name] = value
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const instrument = targetCmp => {
|
||||
const createComponent = (Component, restore, previousCmp) => {
|
||||
set_current_component(parentComponent || previousCmp)
|
||||
const comp = new Component(options)
|
||||
// NOTE must be instrumented before restoreState, because restoring
|
||||
// bindings relies on hacked $$.props
|
||||
instrument(comp)
|
||||
restoreState(comp, restore)
|
||||
return comp
|
||||
}
|
||||
|
||||
rememberFutureProps(targetCmp)
|
||||
|
||||
targetCmp.$$.on_hmr = []
|
||||
|
||||
// `conservative: true` means we want to be sure that the new component has
|
||||
// actually been successfuly created before destroying the old instance.
|
||||
// This could be useful for preventing runtime errors in component init to
|
||||
// bring down the whole HMR. Unfortunately the implementation bellow is
|
||||
// broken (FIXME), but that remains an interesting target for when HMR hooks
|
||||
// will actually land in Svelte itself.
|
||||
//
|
||||
// The goal would be to render an error inplace in case of error, to avoid
|
||||
// losing the navigation stack (especially annoying in native, that is not
|
||||
// based on URL navigation, so we lose the current page on each error).
|
||||
//
|
||||
targetCmp.$replace = (
|
||||
Component,
|
||||
{
|
||||
target = options.target,
|
||||
anchor = options.anchor,
|
||||
preserveLocalState,
|
||||
conservative = false,
|
||||
}
|
||||
) => {
|
||||
const restore = captureState(targetCmp)
|
||||
assignOptions(
|
||||
target || options.target,
|
||||
anchor,
|
||||
restore,
|
||||
preserveLocalState
|
||||
)
|
||||
|
||||
const callbacks = cmp ? cmp.$$.on_hmr : []
|
||||
|
||||
const afterCallbacks = callbacks.map(fn => fn(cmp)).filter(Boolean)
|
||||
|
||||
const previous = cmp
|
||||
if (conservative) {
|
||||
try {
|
||||
const next = createComponent(Component, restore, previous)
|
||||
// prevents on_destroy from firing on non-final cmp instance
|
||||
cmp = null
|
||||
previous.$destroy()
|
||||
cmp = next
|
||||
} catch (err) {
|
||||
cmp = previous
|
||||
throw err
|
||||
}
|
||||
} else {
|
||||
// prevents on_destroy from firing on non-final cmp instance
|
||||
cmp = null
|
||||
if (previous) {
|
||||
// previous can be null if last constructor has crashed
|
||||
previous.$destroy()
|
||||
}
|
||||
cmp = createComponent(Component, restore, cmp)
|
||||
}
|
||||
|
||||
cmp.$$.hmr_cmp = cmp
|
||||
|
||||
for (const fn of afterCallbacks) {
|
||||
fn(cmp)
|
||||
}
|
||||
|
||||
cmp.$$.on_hmr = callbacks
|
||||
|
||||
return cmp
|
||||
}
|
||||
|
||||
// NOTE onMount must provide target & anchor (for us to be able to determinate
|
||||
// actual DOM insertion point)
|
||||
//
|
||||
// And also, to support keyed list, it needs to be called each time the
|
||||
// component is moved (same as $$.fragment.m)
|
||||
if (onMount) {
|
||||
const m = targetCmp.$$.fragment.m
|
||||
targetCmp.$$.fragment.m = (...args) => {
|
||||
const result = m(...args)
|
||||
onMount(...args)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE onDestroy must be called even if the call doesn't pass through the
|
||||
// component's $destroy method (that we can hook onto by ourselves, since
|
||||
// it's public API) -- this happens a lot in svelte's internals, that
|
||||
// manipulates cmp.$$.fragment directly, often binding to fragment.d,
|
||||
// for example
|
||||
if (onDestroy) {
|
||||
targetCmp.$$.on_destroy.push(() => {
|
||||
if (isCurrent(targetCmp)) {
|
||||
onDestroy()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (onInstance) {
|
||||
onInstance(targetCmp)
|
||||
}
|
||||
|
||||
// Svelte 3 creates and mount components from their constructor if
|
||||
// options.target is present.
|
||||
//
|
||||
// This means that at this point, the component's `fragment.c` and,
|
||||
// most notably, `fragment.m` will already have been called _from inside
|
||||
// createComponent_. That is: before we have a chance to hook on it.
|
||||
//
|
||||
// Proxy's constructor
|
||||
// -> createComponent
|
||||
// -> component constructor
|
||||
// -> component.$$.fragment.c(...) (or l, if hydrate:true)
|
||||
// -> component.$$.fragment.m(...)
|
||||
//
|
||||
// -> you are here <-
|
||||
//
|
||||
if (onMount) {
|
||||
const { target, anchor } = options
|
||||
if (target) {
|
||||
onMount(target, anchor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const parentComponent = allowLiveBinding
|
||||
? current_component
|
||||
: get_current_component_safe()
|
||||
|
||||
cmp = new Component(options)
|
||||
cmp.$$.hmr_cmp = cmp
|
||||
|
||||
instrument(cmp)
|
||||
|
||||
return cmp
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
var String = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(String, _Node);
|
||||
|
||||
function String(opts) {
|
||||
var _this;
|
||||
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.STRING;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return String;
|
||||
}(_node["default"]);
|
||||
|
||||
exports["default"] = String;
|
||||
module.exports = exports.default;
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Config, CosmiconfigResult, Loaders, LoadersSync } from './types';
|
||||
declare type LoaderResult = Config | null;
|
||||
export declare type Loader = ((filepath: string, content: string) => Promise<LoaderResult>) | LoaderSync;
|
||||
export declare type LoaderSync = (filepath: string, content: string) => LoaderResult;
|
||||
export declare type Transform = ((CosmiconfigResult: CosmiconfigResult) => Promise<CosmiconfigResult>) | TransformSync;
|
||||
export declare type TransformSync = (CosmiconfigResult: CosmiconfigResult) => CosmiconfigResult;
|
||||
interface OptionsBase {
|
||||
packageProp?: string | Array<string>;
|
||||
searchPlaces?: Array<string>;
|
||||
ignoreEmptySearchPlaces?: boolean;
|
||||
stopDir?: string;
|
||||
cache?: boolean;
|
||||
}
|
||||
export interface Options extends OptionsBase {
|
||||
loaders?: Loaders;
|
||||
transform?: Transform;
|
||||
}
|
||||
export interface OptionsSync extends OptionsBase {
|
||||
loaders?: LoadersSync;
|
||||
transform?: TransformSync;
|
||||
}
|
||||
export interface PublicExplorerBase {
|
||||
clearLoadCache: () => void;
|
||||
clearSearchCache: () => void;
|
||||
clearCaches: () => void;
|
||||
}
|
||||
export interface PublicExplorer extends PublicExplorerBase {
|
||||
search: (searchFrom?: string) => Promise<CosmiconfigResult>;
|
||||
load: (filepath: string) => Promise<CosmiconfigResult>;
|
||||
}
|
||||
export interface PublicExplorerSync extends PublicExplorerBase {
|
||||
search: (searchFrom?: string) => CosmiconfigResult;
|
||||
load: (filepath: string) => CosmiconfigResult;
|
||||
}
|
||||
export declare const metaSearchPlaces: string[];
|
||||
declare const defaultLoaders: Readonly<{
|
||||
readonly '.cjs': LoaderSync;
|
||||
readonly '.js': LoaderSync;
|
||||
readonly '.json': LoaderSync;
|
||||
readonly '.yaml': LoaderSync;
|
||||
readonly '.yml': LoaderSync;
|
||||
readonly noExt: LoaderSync;
|
||||
}>;
|
||||
declare function cosmiconfig(moduleName: string, options?: Options): PublicExplorer;
|
||||
declare function cosmiconfigSync(moduleName: string, options?: OptionsSync): PublicExplorerSync;
|
||||
export { cosmiconfig, cosmiconfigSync, defaultLoaders };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[20277] = (function(){ var d = "\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a âäàáã}çñ#.<(+!&éêëèíîïìߤÅ*);^-/ÂÄÀÁÃ$ÇÑø,%_>?¦ÉÊËÈÍÎÏÌ`:ÆØ'=\"@abcdefghi«»ðýþ±°jklmnopqrªº{¸[]µüstuvwxyz¡¿ÐÝÞ®¢£¥·©§¶¼½¾¬|¯¨´×æABCDEFGHIôöòóõåJKLMNOPQR¹û~ùúÿ\\÷STUVWXYZ²ÔÖÒÓÕ0123456789³ÛÜÙÚ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,3 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import type { URL } from 'url';
|
||||
export default function isUnixSocketURL(url: URL): boolean;
|
||||
@@ -0,0 +1,409 @@
|
||||
# graphql.js
|
||||
|
||||
> GitHub GraphQL API client for browsers and Node
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/graphql)
|
||||
[](https://github.com/octokit/graphql.js/actions?query=workflow%3ATest+branch%3Amain)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [Send a simple query](#send-a-simple-query)
|
||||
- [Authentication](#authentication)
|
||||
- [Variables](#variables)
|
||||
- [Pass query together with headers and variables](#pass-query-together-with-headers-and-variables)
|
||||
- [Use with GitHub Enterprise](#use-with-github-enterprise)
|
||||
- [Use custom `@octokit/request` instance](#use-custom-octokitrequest-instance)
|
||||
- [TypeScript](#typescript)
|
||||
- [Additional Types](#additional-types)
|
||||
- [Errors](#errors)
|
||||
- [Partial responses](#partial-responses)
|
||||
- [Writing tests](#writing-tests)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/graphql` directly from [cdn.skypack.dev](https://cdn.skypack.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { graphql } from "https://cdn.skypack.dev/@octokit/graphql";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/graphql</code>
|
||||
|
||||
```js
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
// or: import { graphql } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### Send a simple query
|
||||
|
||||
```js
|
||||
const { repository } = await graphql(
|
||||
`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Authentication
|
||||
|
||||
The simplest way to authenticate a request is to set the `Authorization` header, e.g. to a [personal access token](https://github.com/settings/tokens/).
|
||||
|
||||
```js
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphqlWithAuth(`
|
||||
{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
|
||||
|
||||
```js
|
||||
const { createAppAuth } = require("@octokit/auth-app");
|
||||
const auth = createAppAuth({
|
||||
appId: process.env.APP_ID,
|
||||
privateKey: process.env.PRIVATE_KEY,
|
||||
installationId: 123,
|
||||
});
|
||||
const graphqlWithAuth = graphql.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { repository } = await graphqlWithAuth(
|
||||
`{
|
||||
repository(owner: "octokit", name: "graphql.js") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
);
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
⚠️ Do not use [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) in the query strings as they make your code vulnerable to query injection attacks (see [#2](https://github.com/octokit/graphql.js/issues/2)). Use variables instead:
|
||||
|
||||
```js
|
||||
const { lastIssues } = await graphql(
|
||||
`
|
||||
query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
issues(last: $num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Pass query together with headers and variables
|
||||
|
||||
```js
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
const { lastIssues } = await graphql({
|
||||
query: `query lastIssues($owner: String!, $repo: String!, $num: Int = 3) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
issues(last:$num) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`,
|
||||
owner: "octokit",
|
||||
repo: "graphql.js",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Use with GitHub Enterprise
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
baseUrl: "https://github-enterprise.acme-inc.com/api",
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const { repository } = await graphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
```
|
||||
|
||||
### Use custom `@octokit/request` instance
|
||||
|
||||
```js
|
||||
const { request } = require("@octokit/request");
|
||||
const { withCustomRequest } = require("@octokit/graphql");
|
||||
|
||||
let requestCounter = 0;
|
||||
const myRequest = request.defaults({
|
||||
headers: {
|
||||
authorization: "bearer secret123",
|
||||
},
|
||||
request: {
|
||||
hook(request, options) {
|
||||
requestCounter++;
|
||||
return request(options);
|
||||
},
|
||||
},
|
||||
});
|
||||
const myGraphql = withCustomRequest(myRequest);
|
||||
await request("/");
|
||||
await myGraphql(`
|
||||
{
|
||||
repository(owner: "acme-project", name: "acme-repo") {
|
||||
issues(last: 3) {
|
||||
edges {
|
||||
node {
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`);
|
||||
// requestCounter is now 2
|
||||
```
|
||||
|
||||
## TypeScript
|
||||
|
||||
`@octokit/graphql` is exposing proper types for its usage with TypeScript projects.
|
||||
|
||||
### Additional Types
|
||||
|
||||
Additionally, `GraphQlQueryResponseData` has been exposed to users:
|
||||
|
||||
```ts
|
||||
import type { GraphQlQueryResponseData } from "@octokit/graphql";
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
In case of a GraphQL error, `error.message` is set to a combined message describing all errors returned by the endpoint.
|
||||
All errors can be accessed at `error.errors`. `error.request` has the request options such as query, variables and headers set for easier debugging.
|
||||
|
||||
```js
|
||||
let { graphql, GraphqlResponseError } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
viewer {
|
||||
bioHtml
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
if (error instanceof GraphqlResponseError) {
|
||||
// do something with the error, allowing you to detect a graphql response error,
|
||||
// compared to accidentally catching unrelated errors.
|
||||
|
||||
// server responds with an object like the following (as an example)
|
||||
// class GraphqlResponseError {
|
||||
// "headers": {
|
||||
// "status": "403",
|
||||
// },
|
||||
// "data": null,
|
||||
// "errors": [{
|
||||
// "message": "Field 'bioHtml' doesn't exist on type 'User'",
|
||||
// "locations": [{
|
||||
// "line": 3,
|
||||
// "column": 5
|
||||
// }]
|
||||
// }]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // Field 'bioHtml' doesn't exist on type 'User'
|
||||
} else {
|
||||
// handle non-GraphQL error
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Partial responses
|
||||
|
||||
A GraphQL query may respond with partial data accompanied by errors. In this case we will throw an error but the partial data will still be accessible through `error.data`
|
||||
|
||||
```js
|
||||
let { graphql } = require("@octokit/graphql");
|
||||
graphql = graphql.defaults({
|
||||
headers: {
|
||||
authorization: `token secret123`,
|
||||
},
|
||||
});
|
||||
const query = `{
|
||||
repository(name: "probot", owner: "probot") {
|
||||
name
|
||||
ref(qualifiedName: "master") {
|
||||
target {
|
||||
... on Commit {
|
||||
history(first: 25, after: "invalid cursor") {
|
||||
nodes {
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`;
|
||||
|
||||
try {
|
||||
const result = await graphql(query);
|
||||
} catch (error) {
|
||||
// server responds with
|
||||
// {
|
||||
// "data": {
|
||||
// "repository": {
|
||||
// "name": "probot",
|
||||
// "ref": null
|
||||
// }
|
||||
// },
|
||||
// "errors": [
|
||||
// {
|
||||
// "type": "INVALID_CURSOR_ARGUMENTS",
|
||||
// "path": [
|
||||
// "repository",
|
||||
// "ref",
|
||||
// "target",
|
||||
// "history"
|
||||
// ],
|
||||
// "locations": [
|
||||
// {
|
||||
// "line": 7,
|
||||
// "column": 11
|
||||
// }
|
||||
// ],
|
||||
// "message": "`invalid cursor` does not appear to be a valid cursor."
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
console.log("Request failed:", error.request); // { query, variables: {}, headers: { authorization: 'token secret123' } }
|
||||
console.log(error.message); // `invalid cursor` does not appear to be a valid cursor.
|
||||
console.log(error.data); // { repository: { name: 'probot', ref: null } }
|
||||
}
|
||||
```
|
||||
|
||||
## Writing tests
|
||||
|
||||
You can pass a replacement for [the built-in fetch implementation](https://github.com/bitinn/node-fetch) as `request.fetch` option. For example, using [fetch-mock](http://www.wheresrhys.co.uk/fetch-mock/) works great to write tests
|
||||
|
||||
```js
|
||||
const assert = require("assert");
|
||||
const fetchMock = require("fetch-mock/es5/server");
|
||||
|
||||
const { graphql } = require("@octokit/graphql");
|
||||
|
||||
graphql("{ viewer { login } }", {
|
||||
headers: {
|
||||
authorization: "token secret123",
|
||||
},
|
||||
request: {
|
||||
fetch: fetchMock
|
||||
.sandbox()
|
||||
.post("https://api.github.com/graphql", (url, options) => {
|
||||
assert.strictEqual(options.headers.authorization, "token secret123");
|
||||
assert.strictEqual(
|
||||
options.body,
|
||||
'{"query":"{ viewer { login } }"}',
|
||||
"Sends correct query"
|
||||
);
|
||||
return { data: {} };
|
||||
}),
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('isInteger', require('../isInteger'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0.00604,"49":0,"50":0,"51":0,"52":0.02416,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00604,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01812,"79":0,"80":0,"81":0,"82":0,"83":0.00604,"84":0,"85":0,"86":0,"87":0.00604,"88":0.00604,"89":0,"90":0,"91":0.01208,"92":0,"93":0,"94":0,"95":0.00604,"96":0,"97":0,"98":0,"99":0,"100":0.00604,"101":0,"102":0.0302,"103":0.00604,"104":0.00604,"105":0.00604,"106":0.00604,"107":0.00604,"108":0.05435,"109":0.9904,"110":0.65825,"111":0,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00604,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.0302,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0.01208,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.00604,"77":0.00604,"78":0.00604,"79":0.02416,"80":0.00604,"81":0.00604,"83":0,"84":0.01208,"85":0.02416,"86":0.01208,"87":0.02416,"88":0.01208,"89":0.03623,"90":0.01208,"91":0.03623,"92":0.01208,"93":0.02416,"94":0.00604,"95":0.01208,"96":0.01208,"97":0.01208,"98":0.01812,"99":0.01208,"100":0.02416,"101":0.06643,"102":0.01812,"103":0.08455,"104":0.02416,"105":0.06039,"106":0.04831,"107":0.07247,"108":0.37442,"109":13.80515,"110":8.69012,"111":0.01208,"112":0.00604,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.01812,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0.00604,"85":0.00604,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.27779,"94":2.3069,"95":0.60994,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0.00604,"15":0,"16":0,"17":0,"18":0.00604,"79":0,"80":0.00604,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00604,"90":0,"91":0,"92":0.00604,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0.00604,"103":0.00604,"104":0.00604,"105":0.00604,"106":0.00604,"107":0.02416,"108":0.06643,"109":1.96871,"110":2.46391},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00604,"14":0.04227,"15":0.01208,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0.00604,"12.1":0.01208,"13.1":0.07247,"14.1":0.13286,"15.1":0.01208,"15.2-15.3":0.0302,"15.4":0.0302,"15.5":0.09059,"15.6":0.31403,"16.0":0.06039,"16.1":0.16909,"16.2":0.45293,"16.3":0.32611,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0.00568,"9.0-9.2":0,"9.3":0.07765,"10.0-10.2":0,"10.3":0.0909,"11.0-11.2":0.00568,"11.3-11.4":0.00947,"12.0-12.1":0.01515,"12.2-12.5":0.38444,"13.0-13.1":0.00379,"13.2":0.00568,"13.3":0.01326,"13.4-13.7":0.04924,"14.0-14.4":0.14771,"14.5-14.8":0.44504,"15.0-15.1":0.10416,"15.2-15.3":0.1231,"15.4":0.14393,"15.5":0.36171,"15.6":1.3105,"16.0":2.193,"16.1":4.42766,"16.2":4.65302,"16.3":3.27624,"16.4":0.02841},P:{"4":0.06233,"20":0.64413,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01039,"12.0":0.01039,"13.0":0.01039,"14.0":0.01039,"15.0":0,"16.0":0.02078,"17.0":0.01039,"18.0":0.02078,"19.0":1.01814},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00716,"4.2-4.3":0.02147,"4.4":0,"4.4.3-4.4.4":0.15742},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.1087,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":0.1426},H:{"0":0.22875},L:{"0":41.76835},R:{_:"0"},M:{"0":0.17825},Q:{"13.1":0}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"finalize.js","sourceRoot":"","sources":["../../../../src/internal/operators/finalize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA+DvC,MAAM,UAAU,QAAQ,CAAI,QAAoB;IAC9C,OAAO,OAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAGhC,IAAI;YACF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;SAC9B;gBAAS;YACR,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
||||
@@ -0,0 +1,77 @@
|
||||
# deprecation
|
||||
|
||||
> Log a deprecation message with stack
|
||||
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `deprecation` directly from [cdn.pika.dev](https://cdn.pika.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { Deprecation } from "https://cdn.pika.dev/deprecation/v2";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with `npm install deprecation`
|
||||
|
||||
```js
|
||||
const { Deprecation } = require("deprecation");
|
||||
// or: import { Deprecation } from "deprecation";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```js
|
||||
function foo() {
|
||||
bar();
|
||||
}
|
||||
|
||||
function bar() {
|
||||
baz();
|
||||
}
|
||||
|
||||
function baz() {
|
||||
console.warn(new Deprecation("[my-lib] foo() is deprecated, use bar()"));
|
||||
}
|
||||
|
||||
foo();
|
||||
// { Deprecation: [my-lib] foo() is deprecated, use bar()
|
||||
// at baz (/path/to/file.js:12:15)
|
||||
// at bar (/path/to/file.js:8:3)
|
||||
// at foo (/path/to/file.js:4:3)
|
||||
```
|
||||
|
||||
To log a deprecation message only once, you can use the [once](https://www.npmjs.com/package/once) module.
|
||||
|
||||
```js
|
||||
const Deprecation = require("deprecation");
|
||||
const once = require("once");
|
||||
|
||||
const deprecateFoo = once(console.warn);
|
||||
|
||||
function foo() {
|
||||
deprecateFoo(new Deprecation("[my-lib] foo() is deprecated, use bar()"));
|
||||
}
|
||||
|
||||
foo();
|
||||
foo(); // logs nothing
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[ISC](LICENSE)
|
||||
@@ -0,0 +1,2 @@
|
||||
export { webSocket as webSocket } from '../internal/observable/dom/webSocket';
|
||||
export { WebSocketSubject, WebSocketSubjectConfig } from '../internal/observable/dom/WebSocketSubject';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"d e i j k l m n o p q r s t u f H","2":"C K L G M N O P Q R S T U V W X Y Z a b c"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B","260":"9B OC"},F:{"1":"Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P PC QC RC SC qB AC TC rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B","260":"9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"1":"g 6C 7C 8C","2":"I wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB"},Q:{"2":"1B"},R:{"1":"9C"},S:{"2":"AD BD"}},B:5,C:"WebCodecs API"};
|
||||
@@ -0,0 +1,2 @@
|
||||
import createPlugin from '../util/createPlugin'
|
||||
export default createPlugin
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('debounce', require('../debounce'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,153 @@
|
||||
### Estraverse [](http://travis-ci.org/estools/estraverse)
|
||||
|
||||
Estraverse ([estraverse](http://github.com/estools/estraverse)) is
|
||||
[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
||||
traversal functions from [esmangle project](http://github.com/estools/esmangle).
|
||||
|
||||
### Documentation
|
||||
|
||||
You can find usage docs at [wiki page](https://github.com/estools/estraverse/wiki/Usage).
|
||||
|
||||
### Example Usage
|
||||
|
||||
The following code will output all variables declared at the root of a file.
|
||||
|
||||
```javascript
|
||||
estraverse.traverse(ast, {
|
||||
enter: function (node, parent) {
|
||||
if (node.type == 'FunctionExpression' || node.type == 'FunctionDeclaration')
|
||||
return estraverse.VisitorOption.Skip;
|
||||
},
|
||||
leave: function (node, parent) {
|
||||
if (node.type == 'VariableDeclarator')
|
||||
console.log(node.id.name);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
We can use `this.skip`, `this.remove` and `this.break` functions instead of using Skip, Remove and Break.
|
||||
|
||||
```javascript
|
||||
estraverse.traverse(ast, {
|
||||
enter: function (node) {
|
||||
this.break();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
And estraverse provides `estraverse.replace` function. When returning node from `enter`/`leave`, current node is replaced with it.
|
||||
|
||||
```javascript
|
||||
result = estraverse.replace(tree, {
|
||||
enter: function (node) {
|
||||
// Replace it with replaced.
|
||||
if (node.type === 'Literal')
|
||||
return replaced;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
By passing `visitor.keys` mapping, we can extend estraverse traversing functionality.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Extending the existing traversing rules.
|
||||
keys: {
|
||||
// TargetNodeName: [ 'keys', 'containing', 'the', 'other', '**node**' ]
|
||||
TestExpression: ['argument']
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
By passing `visitor.fallback` option, we can control the behavior when encountering unknown nodes.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Iterating the child **nodes** of unknown nodes.
|
||||
fallback: 'iteration'
|
||||
});
|
||||
```
|
||||
|
||||
When `visitor.fallback` is a function, we can determine which keys to visit on each node.
|
||||
|
||||
```javascript
|
||||
// This tree contains a user-defined `TestExpression` node.
|
||||
var tree = {
|
||||
type: 'TestExpression',
|
||||
|
||||
// This 'argument' is the property containing the other **node**.
|
||||
argument: {
|
||||
type: 'Literal',
|
||||
value: 20
|
||||
},
|
||||
|
||||
// This 'extended' is the property not containing the other **node**.
|
||||
extended: true
|
||||
};
|
||||
estraverse.traverse(tree, {
|
||||
enter: function (node) { },
|
||||
|
||||
// Skip the `argument` property of each node
|
||||
fallback: function(node) {
|
||||
return Object.keys(node).filter(function(key) {
|
||||
return key !== 'argument';
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
Copyright (C) 2012-2016 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
"name": "array",
|
||||
"processSafe":true,
|
||||
"regExp": /^\*array\*/,
|
||||
"parserFunc": function parser_array(params) {
|
||||
var fieldName = params.head.replace(this.regExp, '');
|
||||
if (params.resultRow[fieldName] === undefined) {
|
||||
params.resultRow[fieldName] = [];
|
||||
}
|
||||
params.resultRow[fieldName].push(params.item);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00212,"39":0,"40":0,"41":0,"42":0,"43":0.00212,"44":0,"45":0,"46":0,"47":0,"48":0.00212,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00212,"69":0,"70":0,"71":0,"72":0.00212,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00212,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0.00212,"95":0,"96":0,"97":0,"98":0,"99":0.00212,"100":0,"101":0,"102":0.00424,"103":0.00424,"104":0.00212,"105":0.00212,"106":0.00212,"107":0.00212,"108":0.01485,"109":0.12938,"110":0.0806,"111":0.00212,"112":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0.00212,"35":0,"36":0,"37":0,"38":0.00212,"39":0.00212,"40":0,"41":0,"42":0,"43":0.00212,"44":0,"45":0,"46":0,"47":0,"48":0.00212,"49":0.00212,"50":0,"51":0,"52":0.00212,"53":0,"54":0.00212,"55":0.00212,"56":0,"57":0,"58":0.00212,"59":0,"60":0,"61":0,"62":0.00636,"63":0.00212,"64":0.00212,"65":0,"66":0,"67":0,"68":0,"69":0.00848,"70":0.00212,"71":0.00848,"72":0.00424,"73":0.00424,"74":0.00212,"75":0.00212,"76":0.00212,"77":0.00212,"78":0.00848,"79":0.00848,"80":0.00848,"81":0.00636,"83":0.00212,"84":0.00424,"85":0.00212,"86":0.01485,"87":0.01485,"88":0.00212,"89":0.00424,"90":0.00212,"91":0.00636,"92":0.00848,"93":0,"94":0.00424,"95":0.00424,"96":0.00636,"97":0.00424,"98":0.00424,"99":0.00848,"100":0.00636,"101":0.00212,"102":0.00636,"103":0.01485,"104":0.00848,"105":0.00848,"106":0.01273,"107":0.02333,"108":0.07848,"109":1.46985,"110":0.67872,"111":0.00424,"112":0.00212,"113":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0.01061,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0.00212,"60":0.00212,"62":0,"63":0.00212,"64":0.00212,"65":0,"66":0.00212,"67":0.02121,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0.00212,"75":0,"76":0,"77":0,"78":0,"79":0.00424,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0.00212,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00212,"93":0,"94":0.0509,"95":0.12514,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0.00212},B:{"12":0.01273,"13":0.00424,"14":0.00848,"15":0.00212,"16":0.00848,"17":0.00212,"18":0.02121,"79":0,"80":0,"81":0.00212,"83":0,"84":0.00424,"85":0,"86":0,"87":0,"88":0,"89":0.00636,"90":0.00848,"91":0,"92":0.02545,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0.00424,"101":0,"102":0.00212,"103":0.00212,"104":0,"105":0.00212,"106":0.00212,"107":0.00424,"108":0.01485,"109":0.11878,"110":0.16332},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0.00424,"15":0,_:"0","3.1":0,"3.2":0,"5.1":0.00636,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00212,"13.1":0.00424,"14.1":0.00212,"15.1":0.01909,"15.2-15.3":0.00848,"15.4":0.01909,"15.5":0.03182,"15.6":0.08484,"16.0":0.01061,"16.1":0.05727,"16.2":0.12302,"16.3":0.15483,"16.4":0},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.0136,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02947,"10.0-10.2":0,"10.3":0.01813,"11.0-11.2":0,"11.3-11.4":0.00453,"12.0-12.1":0.02267,"12.2-12.5":0.71396,"13.0-13.1":0.02493,"13.2":0.02493,"13.3":0.068,"13.4-13.7":0.10199,"14.0-14.4":0.37171,"14.5-14.8":0.42611,"15.0-15.1":0.36038,"15.2-15.3":0.52584,"15.4":0.56437,"15.5":0.93155,"15.6":1.56618,"16.0":2.45013,"16.1":3.68993,"16.2":4.06391,"16.3":4.23616,"16.4":0.02493},P:{"4":0.42533,"20":0.19241,"5.0-5.4":0.16203,"6.2-6.4":0.12152,"7.2-7.4":0.33419,"8.2":0.01013,"9.2":0.21266,"10.1":0.01013,"11.1-11.2":0.13165,"12.0":0.10127,"13.0":0.08101,"14.0":0.09114,"15.0":0.04051,"16.0":0.20254,"17.0":0.13165,"18.0":0.18228,"19.0":1.01268},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0.00375,"4.2-4.3":0.00625,"4.4":0,"4.4.3-4.4.4":0.21635},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0.00424,"10":0,"11":0.09545,"5.5":0},N:{"10":0,"11":0},S:{"2.5":0.00788,_:"3.0-3.1"},J:{"7":0,"10":0},O:{"0":1.33943},H:{"0":0.7161},L:{"0":68.55879},R:{_:"0"},M:{"0":0.06303},Q:{"13.1":0}};
|
||||
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
var toArray = require("./to-array")
|
||||
, isDate = require("../date/is-date")
|
||||
, isValue = require("../object/is-value")
|
||||
, isRegExp = require("../reg-exp/is-reg-exp");
|
||||
|
||||
var isArray = Array.isArray
|
||||
, stringify = JSON.stringify
|
||||
, objHasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var keyValueToString = function (value, key) {
|
||||
return stringify(key) + ":" + module.exports(value);
|
||||
};
|
||||
|
||||
var sparseMap = function (arr) {
|
||||
var i, length = arr.length, result = new Array(length);
|
||||
for (i = 0; i < length; ++i) {
|
||||
if (!objHasOwnProperty.call(arr, i)) continue;
|
||||
result[i] = module.exports(arr[i]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports = function (obj) {
|
||||
if (!isValue(obj)) return String(obj);
|
||||
switch (typeof obj) {
|
||||
case "string":
|
||||
return stringify(obj);
|
||||
case "number":
|
||||
case "boolean":
|
||||
case "function":
|
||||
return String(obj);
|
||||
case "object":
|
||||
if (isArray(obj)) return "[" + sparseMap(obj) + "]";
|
||||
if (isRegExp(obj)) return String(obj);
|
||||
if (isDate(obj)) return "new Date(" + obj.valueOf() + ")";
|
||||
return "{" + toArray(obj, keyValueToString) + "}";
|
||||
default:
|
||||
throw new TypeError("Serialization of " + String(obj) + "is unsupported");
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,123 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../prettify.css" />
|
||||
<link rel="stylesheet" href="../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../index.html">All files</a> csv2json
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/12</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="Gruntfile.js"><a href="Gruntfile.js.html">Gruntfile.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="8" class="abs low">0/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="8" class="abs low">0/8</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="browser_index.js"><a href="browser_index.js.html">browser_index.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="3" class="abs low">0/3</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="2" class="abs low">0/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="3" class="abs low">0/3</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="index.js"><a href="index.js.html">index.js</a></td>
|
||||
<td data-value="0" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="0" class="pct low">0%</td>
|
||||
<td data-value="1" class="abs low">0/1</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user