mirror of
https://github.com/github/codeql-action
synced 2026-05-29 05:00:55 +03:00
Add typings for js-yaml
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+6
@@ -469,6 +469,12 @@
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/js-yaml": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
|
||||
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/js-yaml`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for js-yaml (https://github.com/nodeca/js-yaml).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-yaml.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Fri, 19 Nov 2021 18:01:12 GMT
|
||||
* Dependencies: none
|
||||
* Global values: `jsyaml`
|
||||
|
||||
# Credits
|
||||
These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Sebastian Clausen](https://github.com/sclausen), [ExE Boss](https://github.com/ExE-Boss), [Armaan Tobaccowalla](https://github.com/ArmaanT), and [Linus Unnebäck](https://github.com/LinusU).
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export * from "./index.js";
|
||||
export { default } from "./index.js";
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
// Type definitions for js-yaml 4.0
|
||||
// Project: https://github.com/nodeca/js-yaml
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Sebastian Clausen <https://github.com/sclausen>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Armaan Tobaccowalla <https://github.com/ArmaanT>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export as namespace jsyaml;
|
||||
|
||||
export function load(str: string, opts?: LoadOptions): unknown;
|
||||
|
||||
export class Type {
|
||||
constructor(tag: string, opts?: TypeConstructorOptions);
|
||||
kind: 'sequence' | 'scalar' | 'mapping' | null;
|
||||
resolve(data: any): boolean;
|
||||
construct(data: any, type?: string): any;
|
||||
instanceOf: object | null;
|
||||
predicate: ((data: object) => boolean) | null;
|
||||
represent: ((data: object) => any) | { [x: string]: (data: object) => any } | null;
|
||||
representName: ((data: object) => any) | null;
|
||||
defaultStyle: string | null;
|
||||
multi: boolean;
|
||||
styleAliases: { [x: string]: any };
|
||||
}
|
||||
|
||||
export class Schema {
|
||||
constructor(definition: SchemaDefinition | Type[] | Type);
|
||||
extend(types: SchemaDefinition | Type[] | Type): Schema;
|
||||
}
|
||||
|
||||
export function loadAll(str: string, iterator?: null, opts?: LoadOptions): unknown[];
|
||||
export function loadAll(str: string, iterator: (doc: unknown) => void, opts?: LoadOptions): void;
|
||||
|
||||
export function dump(obj: any, opts?: DumpOptions): string;
|
||||
|
||||
export interface LoadOptions {
|
||||
/** string to be used as a file path in error/warning messages. */
|
||||
filename?: string | undefined;
|
||||
/** function to call on warning messages. */
|
||||
onWarning?(this: null, e: YAMLException): void;
|
||||
/** specifies a schema to use. */
|
||||
schema?: Schema | undefined;
|
||||
/** compatibility with JSON.parse behaviour. */
|
||||
json?: boolean | undefined;
|
||||
/** listener for parse events */
|
||||
listener?(this: State, eventType: EventType, state: State): void;
|
||||
}
|
||||
|
||||
export type EventType = 'open' | 'close';
|
||||
|
||||
export interface State {
|
||||
input: string;
|
||||
filename: string | null;
|
||||
schema: Schema;
|
||||
onWarning: (this: null, e: YAMLException) => void;
|
||||
json: boolean;
|
||||
length: number;
|
||||
position: number;
|
||||
line: number;
|
||||
lineStart: number;
|
||||
lineIndent: number;
|
||||
version: null | number;
|
||||
checkLineBreaks: boolean;
|
||||
kind: string;
|
||||
result: any;
|
||||
implicitTypes: Type[];
|
||||
}
|
||||
|
||||
export interface DumpOptions {
|
||||
/** indentation width to use (in spaces). */
|
||||
indent?: number | undefined;
|
||||
/** when true, will not add an indentation level to array elements */
|
||||
noArrayIndent?: boolean | undefined;
|
||||
/** do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types. */
|
||||
skipInvalid?: boolean | undefined;
|
||||
/** specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere */
|
||||
flowLevel?: number | undefined;
|
||||
/** Each tag may have own set of styles. - "tag" => "style" map. */
|
||||
styles?: { [x: string]: any } | undefined;
|
||||
/** specifies a schema to use. */
|
||||
schema?: Schema | undefined;
|
||||
/** if true, sort keys when dumping YAML. If a function, use the function to sort the keys. (default: false) */
|
||||
sortKeys?: boolean | ((a: any, b: any) => number) | undefined;
|
||||
/** set max line width. (default: 80) */
|
||||
lineWidth?: number | undefined;
|
||||
/** if true, don't convert duplicate objects into references (default: false) */
|
||||
noRefs?: boolean | undefined;
|
||||
/** if true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 (default: false) */
|
||||
noCompatMode?: boolean | undefined;
|
||||
/**
|
||||
* if true flow sequences will be condensed, omitting the space between `key: value` or `a, b`. Eg. `'[a,b]'` or `{a:{b:c}}`.
|
||||
* Can be useful when using yaml for pretty URL query params as spaces are %-encoded. (default: false).
|
||||
*/
|
||||
condenseFlow?: boolean | undefined;
|
||||
/** strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters. (default: `'`) */
|
||||
quotingType?: "'" | '"' | undefined;
|
||||
/** if true, all non-key strings will be quoted even if they normally don't need to. (default: false) */
|
||||
forceQuotes?: boolean | undefined;
|
||||
/** callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`). */
|
||||
replacer?: ((key: string, value: any) => any) | undefined;
|
||||
}
|
||||
|
||||
export interface TypeConstructorOptions {
|
||||
kind?: 'sequence' | 'scalar' | 'mapping' | undefined;
|
||||
resolve?: ((data: any) => boolean) | undefined;
|
||||
construct?: ((data: any, type?: string) => any) | undefined;
|
||||
instanceOf?: object | undefined;
|
||||
predicate?: ((data: object) => boolean) | undefined;
|
||||
represent?: ((data: object) => any) | { [x: string]: (data: object) => any } | undefined;
|
||||
representName?: ((data: object) => any) | undefined;
|
||||
defaultStyle?: string | undefined;
|
||||
multi?: boolean | undefined;
|
||||
styleAliases?: { [x: string]: any } | undefined;
|
||||
}
|
||||
|
||||
export interface SchemaDefinition {
|
||||
implicit?: Type[] | undefined;
|
||||
explicit?: Type[] | undefined;
|
||||
}
|
||||
|
||||
/** only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 */
|
||||
export let FAILSAFE_SCHEMA: Schema;
|
||||
/** only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 */
|
||||
export let JSON_SCHEMA: Schema;
|
||||
/** same as JSON_SCHEMA: http://www.yaml.org/spec/1.2/spec.html#id2804923 */
|
||||
export let CORE_SCHEMA: Schema;
|
||||
/** all supported YAML types */
|
||||
export let DEFAULT_SCHEMA: Schema;
|
||||
|
||||
export interface Mark {
|
||||
buffer: string;
|
||||
column: number;
|
||||
line: number;
|
||||
name: string;
|
||||
position: number;
|
||||
snippet: string;
|
||||
}
|
||||
|
||||
export class YAMLException extends Error {
|
||||
constructor(reason?: string, mark?: Mark);
|
||||
|
||||
toString(compact?: boolean): string;
|
||||
|
||||
name: string;
|
||||
|
||||
reason: string;
|
||||
|
||||
message: string;
|
||||
|
||||
mark: Mark;
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "@types/js-yaml",
|
||||
"version": "4.0.5",
|
||||
"description": "TypeScript definitions for js-yaml",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-yaml",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Bart van der Schoor",
|
||||
"url": "https://github.com/Bartvds",
|
||||
"githubUsername": "Bartvds"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian Clausen",
|
||||
"url": "https://github.com/sclausen",
|
||||
"githubUsername": "sclausen"
|
||||
},
|
||||
{
|
||||
"name": "ExE Boss",
|
||||
"url": "https://github.com/ExE-Boss",
|
||||
"githubUsername": "ExE-Boss"
|
||||
},
|
||||
{
|
||||
"name": "Armaan Tobaccowalla",
|
||||
"url": "https://github.com/ArmaanT",
|
||||
"githubUsername": "ArmaanT"
|
||||
},
|
||||
{
|
||||
"name": "Linus Unnebäck",
|
||||
"url": "https://github.com/LinusU",
|
||||
"githubUsername": "LinusU"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||
"directory": "types/js-yaml"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "6f40877154edac83ffa22d53a6aca74f151a0d094074c81ce7fb21df57ea5725",
|
||||
"typeScriptVersion": "3.8",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": {
|
||||
"import": "./index.d.mts",
|
||||
"default": "./index.d.ts"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+13
@@ -38,6 +38,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "3.0.1",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/long": "4.0.1",
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.3.8",
|
||||
@@ -521,6 +522,12 @@
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/js-yaml": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
|
||||
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
|
||||
@@ -5885,6 +5892,12 @@
|
||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/js-yaml": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
|
||||
"integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/json-schema": {
|
||||
"version": "7.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@ava/typescript": "3.0.1",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/long": "4.0.1",
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.3.8",
|
||||
|
||||
+12
-12
@@ -269,7 +269,7 @@ test("getWorkflowErrors() when on.push is correct with empty objects", (t) => {
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
@@ -441,7 +441,7 @@ on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
@@ -559,7 +559,7 @@ test("getWorkflowErrors() when branches contain dots", (t) => {
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [4.1, master]
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
@@ -575,7 +575,7 @@ on:
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
@@ -604,7 +604,7 @@ jobs:
|
||||
|
||||
test3:
|
||||
steps: []
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
@@ -635,7 +635,7 @@ jobs:
|
||||
|
||||
test3:
|
||||
steps: []
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
@@ -645,7 +645,7 @@ test("getWorkflowErrors() when on is missing", (t) => {
|
||||
const errors = actionsutil.getWorkflowErrors(
|
||||
yaml.load(`
|
||||
name: "CodeQL"
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
);
|
||||
|
||||
t.deepEqual(...errorCodes(errors, []));
|
||||
@@ -658,7 +658,7 @@ test("getWorkflowErrors() with a different on setup", (t) => {
|
||||
yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: "workflow_dispatch"
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
),
|
||||
[]
|
||||
)
|
||||
@@ -670,7 +670,7 @@ on: "workflow_dispatch"
|
||||
yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: [workflow_dispatch]
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
),
|
||||
[]
|
||||
)
|
||||
@@ -683,7 +683,7 @@ on: [workflow_dispatch]
|
||||
name: "CodeQL"
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
),
|
||||
[]
|
||||
)
|
||||
@@ -699,7 +699,7 @@ name: "CodeQL"
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
),
|
||||
[]
|
||||
)
|
||||
@@ -711,7 +711,7 @@ on:
|
||||
yaml.load(`
|
||||
name: "CodeQL"
|
||||
on: ["push"]
|
||||
`)
|
||||
`) as actionsutil.Workflow
|
||||
),
|
||||
[]
|
||||
)
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ interface WorkflowTriggers {
|
||||
pull_request?: WorkflowTrigger | null;
|
||||
}
|
||||
|
||||
interface Workflow {
|
||||
export interface Workflow {
|
||||
jobs?: { [key: string]: WorkflowJob };
|
||||
on?: string | string[] | WorkflowTriggers;
|
||||
}
|
||||
@@ -411,7 +411,7 @@ export async function getWorkflow(): Promise<Workflow> {
|
||||
relativePath
|
||||
);
|
||||
|
||||
return yaml.load(fs.readFileSync(absolutePath, "utf-8"));
|
||||
return yaml.load(fs.readFileSync(absolutePath, "utf-8")) as Workflow;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ function dbIsFinalized(
|
||||
try {
|
||||
const dbInfo = yaml.load(
|
||||
fs.readFileSync(path.resolve(dbPath, "codeql-database.yml"), "utf8")
|
||||
);
|
||||
) as { inProgress?: boolean };
|
||||
return !("inProgress" in dbInfo);
|
||||
} catch (e) {
|
||||
logger.warning(
|
||||
|
||||
+4
-2
@@ -1448,7 +1448,7 @@ function getLocalConfig(configFile: string, workspacePath: string): UserConfig {
|
||||
throw new Error(getConfigFileDoesNotExistErrorMessage(configFile));
|
||||
}
|
||||
|
||||
return yaml.load(fs.readFileSync(configFile, "utf8"));
|
||||
return yaml.load(fs.readFileSync(configFile, "utf8")) as UserConfig;
|
||||
}
|
||||
|
||||
async function getRemoteConfig(
|
||||
@@ -1483,7 +1483,9 @@ async function getRemoteConfig(
|
||||
throw new Error(getConfigFileFormatInvalidMessage(configFile));
|
||||
}
|
||||
|
||||
return yaml.load(Buffer.from(fileContents, "base64").toString("binary"));
|
||||
return yaml.load(
|
||||
Buffer.from(fileContents, "base64").toString("binary")
|
||||
) as UserConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user