type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
() => new MnemonicKey() | daodiseomoney/station | src/auth/modules/create/NewWalletForm.tsx | TypeScript |
ClassDeclaration |
export class Assets {
public static CMSGitIgnore: string = `
# compiled output
/dist
/lib
/node_modules
/public/bundle.*
# Environment
app.env
.env
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# OS
.DS_Store
# Tests
/coverage
/.nyc_output
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
`;
public static readonly BCMSConfig = {
frontend: {
build: false,
useCustom: true,
custom: {
props: [
'templateStore',
{
name: 'pageTwoTitle',
value: 'This is MY page 2 title!',
},
],
},
},
server: {
port: '@PORT',
security: {
jwt: {
secret: '@JWT_SECRET',
issuer: 'localhost',
},
},
database: {
type: '@DB_TYPE',
mongo: {
database: {
host: '@DB_HOST',
port: '@DB_PORT',
name: '@DB_NAME',
user: '@DB_USER',
pass: '@DB_PASS',
prefix: '@DB_PRFX',
cluster: '@DB_CLUSTER',
},
},
},
git: {
install: false,
use: false,
},
env: {},
},
};
public static dockerSH = `
#!/bin/bash
port=@port
appName=@appName
docker stop $appName
docker rm $appName
docker rmi $appName
docker build . -t $appName
docker run -d -p $port:$port --mount source=$appName-vol,target=/app/uploads --env-file app.env --name $appName $appName
`;
public static dockerClearSH = `
#!/bin/bash
port=@port
appName=@appName
docker stop $appName
docker rm $appName
docker rmi $appName
`;
} | becomesco/cms-cli | src/util/assets.ts | TypeScript |
InterfaceDeclaration | /**
* User-Facing Amplitude SDK Client.
*
* This interface contains all methods needed with the SDK once it has
* been installed.
*
*/
export interface Client<O extends Options = Options> {
/** Return the current options */
getOptions(): O;
/**
* Captures a manually created event and sends it to Amplitude.
*
* @param event The event to send to Amplitude.
*/
logEvent(event: Event): Promise<Response>;
/**
* Flush and send all the events which haven't been sent.
*/
flush(): Promise<Response>;
} | Aksouda/bigfive-web | node_modules/@amplitude/types/esm/src/client.d.ts | TypeScript |
FunctionDeclaration | // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter();
(router as any).matcher = (newRouter as any).matcher // reset router
} | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "redirect" */ '@/views/redirect/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "login" */ '@/views/login/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "auth-redirect" */ '@/views/login/auth-redirect.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "404" */ '@/views/error-page/404.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "401" */ '@/views/error-page/401.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "guide" */ '@/views/guide/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "profile" */ '@/views/profile/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "permission-page" */ '@/views/permission/page.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "permission-directive" */ '@/views/permission/directive.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "permission-role" */ '@/views/permission/role.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "icons" */ '@/views/icons/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "example-create" */ '@/views/example/create.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "example-edit" */ '@/views/example/edit.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "example-list" */ '@/views/example/list.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "tab" */ '@/views/tab/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "error-page-401" */ '@/views/error-page/401.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "error-page-404" */ '@/views/error-page/404.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "error-log" */ '@/views/error-log/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "export-excel" */ '@/views/excel/export-excel.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "select-excel" */ '@/views/excel/select-excel.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "merge-header" */ '@/views/excel/merge-header.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "upload-excel" */ '@/views/excel/upload-excel.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "zip" */ '@/views/zip/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "pdf" */ '@/views/pdf/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "pdf-download-example" */ '@/views/pdf/download.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "theme" */ '@/views/theme/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "clipboard" */ '@/views/clipboard/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => import(/* webpackChunkName: "i18n-demo" */ '@/views/i18n-demo/index.vue') | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
() => new VueRouter({
// mode: 'history', // Disabled due to Github Pages doesn't support this, enable this if you need.
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
},
base: process.env.BASE_URL,
routes: constantRoutes
}) | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
(to, from, savedPosition) => {
if (savedPosition) {
return savedPosition
} else {
return { x: 0, y: 0 }
}
} | 7TingYu/kkb-honer-admin | src/router/index.ts | TypeScript |
ArrowFunction |
( x: number ): number => x | AlisaLC/stdlib | lib/node_modules/@stdlib/stats/base/dists/signrank/quantile/docs/types/test.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'docu-container',
template: `
<docu-section *ngFor="let section of documentation?.sections; trackBy: trackByIndex" [section]="section"></docu-section>
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ContainerComponent {
@Input() documentation: Documentation;
trackByIndex(index: number) {
return index;
}
} | ngfelixl/documentations | projects/ng-write/src/lib/shared/components/container.component.ts | TypeScript |
MethodDeclaration |
trackByIndex(index: number) {
return index;
} | ngfelixl/documentations | projects/ng-write/src/lib/shared/components/container.component.ts | TypeScript |
ClassDeclaration |
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
providers: [ConfigResolveService],
})
export class EventsRoutingModule {
} | sunbird-cb/sunbird-cb-orgportal | project/ws/app/src/lib/routes/events/events.routing.module.ts | TypeScript |
InterfaceDeclaration |
export interface Request {
params: Request | { [key: string]: any };
} | mitchdotdeveloper/linkcluster | server/src/types.d.ts | TypeScript |
TypeAliasDeclaration |
type NonFunctionProperties<T> = {
[K in keyof T]: T[K] extends Function ? never : K;
}[keyof T]; | mitchdotdeveloper/linkcluster | server/src/types.d.ts | TypeScript |
TypeAliasDeclaration |
export type OmitClassMethods<T> = Pick<T, NonFunctionProperties<T>>; | mitchdotdeveloper/linkcluster | server/src/types.d.ts | TypeScript |
ArrowFunction |
line => line.length !== 0 | LuisMayo/advent-of-code-2021 | day1/part2.ts | TypeScript |
ArrowFunction |
line => +line | LuisMayo/advent-of-code-2021 | day1/part2.ts | TypeScript |
TypeAliasDeclaration | /**
* text type defs
*
* @see './text.js'
* @see './text_color.js'
*/
type TEXT_SIZES = 's' | 'xs'; | Bargs/eui | src/components/text/index.d.ts | TypeScript |
TypeAliasDeclaration |
type COLORS =
| 'default'
| 'subdued'
| 'secondary'
| 'accent'
| 'danger'
| 'warning'
| 'ghost'; | Bargs/eui | src/components/text/index.d.ts | TypeScript |
TypeAliasDeclaration |
type EuiTextProps = CommonProps &
HTMLAttributes<HTMLDivElement> & {
size?: TEXT_SIZES;
color?: COLORS;
grow?: boolean;
}; | Bargs/eui | src/components/text/index.d.ts | TypeScript |
TypeAliasDeclaration |
type EuiTextColorProps = CommonProps &
HTMLAttributes<HTMLDivElement> &
HTMLAttributes<HTMLSpanElement> & {
color?: COLORS;
}; | Bargs/eui | src/components/text/index.d.ts | TypeScript |
MethodDeclaration |
LAUNCH() {
return this.toIntent('HappyBirthdayIntent');
} | scottleedavis/zorielle-birthday | src/app.ts | TypeScript |
MethodDeclaration |
HappyBirthdayIntent() {
this.tell(`I hope you have a good unicorn birthday party Zorielle Nova.`);
} | scottleedavis/zorielle-birthday | src/app.ts | TypeScript |
MethodDeclaration |
'AMAZON.CancelIntent'() {
this.tell('Ok Zori');
} | scottleedavis/zorielle-birthday | src/app.ts | TypeScript |
MethodDeclaration |
'AMAZON.HelpIntent'() {
this.tell('Help Zori?');
} | scottleedavis/zorielle-birthday | src/app.ts | TypeScript |
FunctionDeclaration |
export async function* paginateListFleets(
config: WorkLinkPaginationConfiguration,
input: ListFleetsCommandInput,
...additionalArguments: any
): Paginator<ListFleetsCommandOutput> {
// ToDo: replace with actual type instead of typeof input.NextToken
let token: typeof input.NextToken | undefined = config.startingToken || undefined;
let hasNext = true;
let page: ListFleetsCommandOutput;
while (hasNext) {
input.NextToken = token;
input["MaxResults"] = config.pageSize;
if (config.client instanceof WorkLink) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof WorkLinkClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected WorkLink | WorkLinkClient");
}
yield page;
token = page.NextToken;
hasNext = !!token;
}
// @ts-ignore
return undefined;
} | Autoskaler/aws-sdk-js-v3 | deno/client-worklink/pagination/ListFleetsPaginator.ts | TypeScript |
ArrowFunction |
async (
client: WorkLinkClient,
input: ListFleetsCommandInput,
...args: any
): Promise<ListFleetsCommandOutput> => {
// @ts-ignore
return await client.send(new ListFleetsCommand(input), ...args);
} | Autoskaler/aws-sdk-js-v3 | deno/client-worklink/pagination/ListFleetsPaginator.ts | TypeScript |
ArrowFunction |
async (
client: WorkLink,
input: ListFleetsCommandInput,
...args: any
): Promise<ListFleetsCommandOutput> => {
// @ts-ignore
return await client.listFleets(input, ...args);
} | Autoskaler/aws-sdk-js-v3 | deno/client-worklink/pagination/ListFleetsPaginator.ts | TypeScript |
TypeAliasDeclaration | /**
* Stores the last generated prefix. An object is used instead of a number so
* that the value can be passed by reference.
*/
type PrefixIndex = { value: number } | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
ele(p1: string | null | ExpandObject, p2?: AttributesObject | string,
p3?: AttributesObject): this {
// parse if JS object or XML or JSON string
if (isObject(p1) || (isString(p1) && (/^\s*</.test(p1) || /^\s*[\{\[]/.test(p1) || /^(\s*|(#.*)|(%.*))*---/.test(p1)))) {
const frag = fragment().set(this._options as unknown as Partial<XMLBuilderOptions>)
try {
frag.ele(p1 as any)
} catch (err) {
this.emit("error", err)
return this
}
for (const node of frag.node.childNodes) {
this._fromNode(node)
}
return this
}
this._serializeOpenTag(true)
if (!this._fragment && this._hasDocumentElement && this._writer.level === 0) {
this.emit("error", new Error("Document cannot have multiple document element nodes."))
return this
}
try {
this._currentElement = fragment(this._builderOptions).ele(p1 as any, p2 as any, p3 as any)
} catch (err) {
this.emit("error", err)
return this
}
if (!this._fragment && !this._hasDocumentElement && this._docTypeName !== ""
&& (this._currentElement.node as Element)._qualifiedName !== this._docTypeName) {
this.emit("error", new Error("Document element name does not match DocType declaration name."))
return this
}
this._currentElementSerialized = false
if (!this._fragment) {
this._hasDocumentElement = true
}
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
att(p1: AttributesObject | string | null, p2?: string, p3?: string): this {
if (this._currentElement === undefined) {
this.emit("error", new Error("Cannot insert an attribute node as child of a document node."))
return this
}
try {
this._currentElement.att(p1 as any, p2 as any, p3 as any)
} catch (err) {
this.emit("error", err)
return this
}
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
com(content: string): this {
this._serializeOpenTag(true)
let node: Comment
try {
node = fragment(this._builderOptions).com(content).first().node as Comment
} catch (err) {
/* istanbul ignore next */
this.emit("error", err)
/* istanbul ignore next */
return this
}
if (this._options.wellFormed && (!xml_isLegalChar(node.data) ||
node.data.indexOf("--") !== -1 || node.data.endsWith("-"))) {
this.emit("error", new Error("Comment data contains invalid characters (well-formed required)."))
return this
}
this._push(this._writer.comment(node.data))
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
txt(content: string): this {
if (!this._fragment && this._currentElement === undefined) {
this.emit("error", new Error("Cannot insert a text node as child of a document node."))
return this
}
this._serializeOpenTag(true)
let node: Text
try {
node = fragment(this._builderOptions).txt(content).first().node as Text
} catch (err) {
/* istanbul ignore next */
this.emit("error", err)
/* istanbul ignore next */
return this
}
if (this._options.wellFormed && !xml_isLegalChar(node.data)) {
this.emit("error", new Error("Text data contains invalid characters (well-formed required)."))
return this
}
const markup = node.data.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
this._push(this._writer.text(markup))
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
ins(target: string | PIObject, content: string = ''): this {
this._serializeOpenTag(true)
let node: ProcessingInstruction
try {
node = fragment(this._builderOptions).ins(target as any, content).first().node as ProcessingInstruction
} catch (err) {
/* istanbul ignore next */
this.emit("error", err)
/* istanbul ignore next */
return this
}
if (this._options.wellFormed && (node.target.indexOf(":") !== -1 || (/^xml$/i).test(node.target))) {
this.emit("error", new Error("Processing instruction target contains invalid characters (well-formed required)."))
return this
}
if (this._options.wellFormed && !xml_isLegalChar(node.data)) {
this.emit("error", Error("Processing instruction data contains invalid characters (well-formed required)."))
return this
}
this._push(this._writer.instruction(node.target, node.data))
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
dat(content: string): this {
this._serializeOpenTag(true)
let node: CDATASection
try {
node = fragment(this._builderOptions).dat(content).first().node as CDATASection
} catch (err) {
this.emit("error", err)
return this
}
this._push(this._writer.cdata(node.data))
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
dec(options: { version?: "1.0", encoding?: string, standalone?: boolean } = { version: "1.0" }): this {
if (this._fragment) {
this.emit("error", Error("Cannot insert an XML declaration into a document fragment."))
return this
}
if (this._hasDeclaration) {
this.emit("error", Error("XML declaration is already inserted."))
return this
}
this._push(this._writer.declaration(options.version || "1.0", options.encoding, options.standalone))
this._hasDeclaration = true
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
dtd(options: DTDOptions & { name: string }): this {
if (this._fragment) {
this.emit("error", Error("Cannot insert a DocType declaration into a document fragment."))
return this
}
if (this._docTypeName !== "") {
this.emit("error", new Error("DocType declaration is already inserted."))
return this
}
if (this._hasDocumentElement) {
this.emit("error", new Error("Cannot insert DocType declaration after document element."))
return this
}
let node: DocumentType
try {
node = create().dtd(options).first().node as DocumentType
} catch (err) {
this.emit("error", err)
return this
}
if (this._options.wellFormed && !xml_isPubidChar(node.publicId)) {
this.emit("error", new Error("DocType public identifier does not match PubidChar construct (well-formed required)."))
return this
}
if (this._options.wellFormed &&
(!xml_isLegalChar(node.systemId) ||
(node.systemId.indexOf('"') !== -1 && node.systemId.indexOf("'") !== -1))) {
this.emit("error", new Error("DocType system identifier contains invalid characters (well-formed required)."))
return this
}
this._docTypeName = options.name
this._push(this._writer.docType(options.name, node.publicId, node.systemId))
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
import(node: XMLBuilder): this {
const frag = fragment().set(this._options as unknown as Partial<XMLBuilderOptions>)
try {
frag.import(node)
} catch (err) {
this.emit("error", err)
return this
}
for (const node of frag.node.childNodes) {
this._fromNode(node)
}
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
up(): this {
this._serializeOpenTag(false)
this._serializeCloseTag()
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /** @inheritdoc */
end(): this {
this._serializeOpenTag(false)
while (this._openTags.length > 0) {
this._serializeCloseTag()
}
this._push(null)
return this
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Serializes the opening tag of an element node.
*
* @param hasChildren - whether the element node has child nodes
*/
private _serializeOpenTag(hasChildren: boolean): void {
if (this._currentElementSerialized) return
if (this._currentElement === undefined) return
const node = this._currentElement.node as Element
if (this._options.wellFormed && (node.localName.indexOf(":") !== -1 ||
!xml_isName(node.localName))) {
this.emit("error", new Error("Node local name contains invalid characters (well-formed required)."))
return
}
let qualifiedName = ""
let ignoreNamespaceDefinitionAttribute = false
let map = this._prefixMap.copy()
let localPrefixesMap: { [key: string]: string } = {}
let localDefaultNamespace = this._recordNamespaceInformation(node, map, localPrefixesMap)
let inheritedNS = this._openTags.length === 0 ? null : this._openTags[this._openTags.length - 1][1]
let ns = node.namespaceURI
if (ns === null) ns = inheritedNS
if (inheritedNS === ns) {
if (localDefaultNamespace !== null) {
ignoreNamespaceDefinitionAttribute = true
}
if (ns === infraNamespace.XML) {
qualifiedName = "xml:" + node.localName
} else {
qualifiedName = node.localName
}
this._writer.beginElement(qualifiedName)
this._push(this._writer.openTagBegin(qualifiedName))
} else {
let prefix = node.prefix
let candidatePrefix: string | null = null
if (prefix !== null || ns !== localDefaultNamespace) {
candidatePrefix = map.get(prefix, ns)
}
if (prefix === "xmlns") {
if (this._options.wellFormed) {
this.emit("error", new Error("An element cannot have the 'xmlns' prefix (well-formed required)."))
return
}
candidatePrefix = prefix
}
if (candidatePrefix !== null) {
qualifiedName = candidatePrefix + ':' + node.localName
if (localDefaultNamespace !== null && localDefaultNamespace !== infraNamespace.XML) {
inheritedNS = localDefaultNamespace || null
}
this._writer.beginElement(qualifiedName)
this._push(this._writer.openTagBegin(qualifiedName))
} else if (prefix !== null) {
if (prefix in localPrefixesMap) {
prefix = this._generatePrefix(ns, map, this._prefixIndex)
}
map.set(prefix, ns)
qualifiedName += prefix + ':' + node.localName
this._writer.beginElement(qualifiedName)
this._push(this._writer.openTagBegin(qualifiedName))
this._push(this._writer.attribute("xmlns:" + prefix,
this._serializeAttributeValue(ns, this._options.wellFormed)))
if (localDefaultNamespace !== null) {
inheritedNS = localDefaultNamespace || null
}
} else if (localDefaultNamespace === null ||
(localDefaultNamespace !== null && localDefaultNamespace !== ns)) {
ignoreNamespaceDefinitionAttribute = true
qualifiedName += node.localName
inheritedNS = ns
this._writer.beginElement(qualifiedName)
this._push(this._writer.openTagBegin(qualifiedName))
this._push(this._writer.attribute("xmlns",
this._serializeAttributeValue(ns, this._options.wellFormed)))
} else {
qualifiedName += node.localName
inheritedNS = ns
this._writer.beginElement(qualifiedName)
this._push(this._writer.openTagBegin(qualifiedName))
}
}
this._serializeAttributes(node, map, this._prefixIndex, localPrefixesMap,
ignoreNamespaceDefinitionAttribute, this._options.wellFormed)
const isHTML = (ns === infraNamespace.HTML)
if (isHTML && !hasChildren &&
XMLBuilderCBImpl._VoidElementNames.has(node.localName)) {
this._push(this._writer.openTagEnd(qualifiedName, true, true))
this._writer.endElement(qualifiedName)
} else if (!isHTML && !hasChildren) {
this._push(this._writer.openTagEnd(qualifiedName, true, false))
this._writer.endElement(qualifiedName)
} else {
this._push(this._writer.openTagEnd(qualifiedName, false, false))
}
this._currentElementSerialized = true
/**
* Save qualified name, original inherited ns, original prefix map, and
* hasChildren flag.
*/
this._openTags.push([qualifiedName, inheritedNS, this._prefixMap, hasChildren])
/**
* New values of inherited namespace and prefix map will be used while
* serializing child nodes. They will be returned to their original values
* when this node is closed using the _openTags array item we saved above.
*/
if (this._isPrefixMapModified(this._prefixMap, map)) {
this._prefixMap = map
}
/**
* Calls following this will either serialize child nodes or close this tag.
*/
this._writer.level++
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Serializes the closing tag of an element node.
*/
private _serializeCloseTag(): void {
this._writer.level--
const lastEle = this._openTags.pop()
/* istanbul ignore next */
if (lastEle === undefined) {
this.emit("error", new Error("Last element is undefined."))
return
}
const [qualifiedName, ns, map, hasChildren] = lastEle
/**
* Restore original values of inherited namespace and prefix map.
*/
this._prefixMap = map
if (!hasChildren) return
this._push(this._writer.closeTag(qualifiedName))
this._writer.endElement(qualifiedName)
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Pushes data to internal buffer.
*
* @param data - data
*/
private _push(data: string | null): void {
if (data === null) {
this._ended = true
this.emit("end")
} else if (this._ended) {
this.emit("error", new Error("Cannot push to ended stream."))
} else if (data.length !== 0) {
this._writer.hasData = true
this.emit("data", data, this._writer.level)
}
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Reads and serializes an XML tree.
*
* @param node - root node
*/
private _fromNode(node: Node) {
if (Guard.isElementNode(node)) {
const name = node.prefix ? node.prefix + ":" + node.localName : node.localName
if (node.namespaceURI !== null) {
this.ele(node.namespaceURI, name)
} else {
this.ele(name)
}
for (const attr of node.attributes) {
const name = attr.prefix ? attr.prefix + ":" + attr.localName : attr.localName
if (attr.namespaceURI !== null) {
this.att(attr.namespaceURI, name, attr.value)
} else {
this.att(name, attr.value)
}
}
for (const child of node.childNodes) {
this._fromNode(child)
}
this.up()
} else if (Guard.isExclusiveTextNode(node) && node.data) {
this.txt(node.data)
} else if (Guard.isCommentNode(node)) {
this.com(node.data)
} else if (Guard.isCDATASectionNode(node)) {
this.dat(node.data)
} else if (Guard.isProcessingInstructionNode(node)) {
this.ins(node.target, node.data)
}
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Produces an XML serialization of the attributes of an element node.
*
* @param node - node to serialize
* @param map - namespace prefix map
* @param prefixIndex - generated namespace prefix index
* @param localPrefixesMap - local prefixes map
* @param ignoreNamespaceDefinitionAttribute - whether to ignore namespace
* attributes
* @param requireWellFormed - whether to check conformance
*/
private _serializeAttributes(node: Element, map: NamespacePrefixMap,
prefixIndex: PrefixIndex, localPrefixesMap: { [key: string]: string },
ignoreNamespaceDefinitionAttribute: boolean,
requireWellFormed: boolean): void {
const localNameSet = requireWellFormed ? new LocalNameSet() : undefined
for (const attr of node.attributes) {
// Optimize common case
if (!requireWellFormed && !ignoreNamespaceDefinitionAttribute && attr.namespaceURI === null) {
this._push(this._writer.attribute(attr.localName,
this._serializeAttributeValue(attr.value, this._options.wellFormed)))
continue
}
if (requireWellFormed && localNameSet && localNameSet.has(attr.namespaceURI, attr.localName)) {
this.emit("error", new Error("Element contains duplicate attributes (well-formed required)."))
return
}
if (requireWellFormed && localNameSet) localNameSet.set(attr.namespaceURI, attr.localName)
let attributeNamespace = attr.namespaceURI
let candidatePrefix: string | null = null
if (attributeNamespace !== null) {
candidatePrefix = map.get(attr.prefix, attributeNamespace)
if (attributeNamespace === infraNamespace.XMLNS) {
if (attr.value === infraNamespace.XML ||
(attr.prefix === null && ignoreNamespaceDefinitionAttribute) ||
(attr.prefix !== null && (!(attr.localName in localPrefixesMap) ||
localPrefixesMap[attr.localName] !== attr.value) &&
map.has(attr.localName, attr.value)))
continue
if (requireWellFormed && attr.value === infraNamespace.XMLNS) {
this.emit("error", new Error("XMLNS namespace is reserved (well-formed required)."))
return
}
if (requireWellFormed && attr.value === '') {
this.emit("error", new Error("Namespace prefix declarations cannot be used to undeclare a namespace (well-formed required)."))
return
}
if (attr.prefix === 'xmlns') candidatePrefix = 'xmlns'
/**
* _Note:_ The (candidatePrefix === null) check is not in the spec.
* We deviate from the spec here. Otherwise a prefix is generated for
* all attributes with namespaces.
*/
} else if (candidatePrefix === null) {
if (attr.prefix !== null &&
(!map.hasPrefix(attr.prefix) ||
map.has(attr.prefix, attributeNamespace))) {
/**
* Check if we can use the attribute's own prefix.
* We deviate from the spec here.
* TODO: This is not an efficient way of searching for prefixes.
* Follow developments to the spec.
*/
candidatePrefix = attr.prefix
} else {
candidatePrefix = this._generatePrefix(attributeNamespace, map, prefixIndex)
}
this._push(this._writer.attribute("xmlns:" + candidatePrefix,
this._serializeAttributeValue(attributeNamespace, this._options.wellFormed)))
}
}
if (requireWellFormed && (attr.localName.indexOf(":") !== -1 ||
!xml_isName(attr.localName) ||
(attr.localName === "xmlns" && attributeNamespace === null))) {
this.emit("error", new Error("Attribute local name contains invalid characters (well-formed required)."))
return
}
this._push(this._writer.attribute(
(candidatePrefix !== null ? candidatePrefix + ":" : "") + attr.localName,
this._serializeAttributeValue(attr.value, this._options.wellFormed)))
}
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Produces an XML serialization of an attribute value.
*
* @param value - attribute value
* @param requireWellFormed - whether to check conformance
*/
private _serializeAttributeValue(value: string | null, requireWellFormed: boolean): string {
if (requireWellFormed && value !== null && !xml_isLegalChar(value)) {
this.emit("error", new Error("Invalid characters in attribute value."))
return ""
}
if (value === null) return ""
return value.replace(/(?!&(lt|gt|amp|apos|quot);)&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Records namespace information for the given element and returns the
* default namespace attribute value.
*
* @param node - element node to process
* @param map - namespace prefix map
* @param localPrefixesMap - local prefixes map
*/
private _recordNamespaceInformation(node: Element, map: NamespacePrefixMap,
localPrefixesMap: { [key: string]: string }): string | null {
let defaultNamespaceAttrValue: string | null = null
for (const attr of node.attributes) {
let attributeNamespace = attr.namespaceURI
let attributePrefix = attr.prefix
if (attributeNamespace === infraNamespace.XMLNS) {
if (attributePrefix === null) {
defaultNamespaceAttrValue = attr.value
continue
} else {
let prefixDefinition = attr.localName
let namespaceDefinition: string | null = attr.value
if (namespaceDefinition === infraNamespace.XML) {
continue
}
if (namespaceDefinition === '') {
namespaceDefinition = null
}
if (map.has(prefixDefinition, namespaceDefinition)) {
continue
}
map.set(prefixDefinition, namespaceDefinition)
localPrefixesMap[prefixDefinition] = namespaceDefinition || ''
}
}
}
return defaultNamespaceAttrValue
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Generates a new prefix for the given namespace.
*
* @param newNamespace - a namespace to generate prefix for
* @param prefixMap - namespace prefix map
* @param prefixIndex - generated namespace prefix index
*/
private _generatePrefix(newNamespace: string | null,
prefixMap: NamespacePrefixMap, prefixIndex: PrefixIndex): string {
let generatedPrefix = "ns" + prefixIndex.value
prefixIndex.value++
prefixMap.set(generatedPrefix, newNamespace)
return generatedPrefix
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
MethodDeclaration | /**
* Determines if the namespace prefix map was modified from its original.
*
* @param originalMap - original namespace prefix map
* @param newMap - new namespace prefix map
*/
private _isPrefixMapModified(originalMap: NamespacePrefixMap, newMap: NamespacePrefixMap) {
const items1: { [key: string]: string[] } = (originalMap as any)._items
const items2: { [key: string]: string[] } = (newMap as any)._items
const nullItems1: string[] = (originalMap as any)._nullItems
const nullItems2: string[] = (newMap as any)._nullItems
for (const key in items2) {
const arr1 = items1[key]
if (arr1 === undefined) return true
const arr2 = items2[key]
if (arr1.length !== arr2.length) return true
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) return true
}
}
if (nullItems1.length !== nullItems2.length) return true
for (let i = 0; i < nullItems1.length; i++) {
if (nullItems1[i] !== nullItems2[i]) return true
}
return false
} | coffeemakr/xmlbuilder2 | src/builder/XMLBuilderCBImpl.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the GetInAppUpdateTokenResponse class.
* @constructor
* @member {string} apiToken The api token generated will not be accessible
* again
*/
export interface GetInAppUpdateTokenResponse {
apiToken: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ApiTokensCreateResponse class.
* @constructor
* @member {string} id The unique id (UUID) of the api token
* @member {string} apiToken The api token generated will not be accessible
* again
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
export interface ApiTokensCreateResponse {
id: string;
apiToken: string;
description?: string;
scope?: string[];
createdAt: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ApiTokensCreateRequest class.
* @constructor
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
*/
export interface ApiTokensCreateRequest {
description?: string;
scope?: string[];
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ApiTokensGetResponse class.
* @constructor
* @member {string} id The unique id (UUID) of the api token
* @member {string} [description] The description of the token
* @member {array} [scope] The scope for this token.
* @member {string} createdAt The creation time
*/
export interface ApiTokensGetResponse {
id: string;
description?: string;
scope?: string[];
createdAt: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the Status class.
* @constructor
* @member {string} status
*/
export interface Status {
status: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the Failure class.
* @constructor
* @member {string} message
*/
export interface Failure {
message: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ErrorDetails class.
* @constructor
* @member {string} code Possible values include: 'BadRequest', 'Conflict',
* 'NotAcceptable', 'NotFound', 'InternalServerError', 'Unauthorized',
* 'TooManyRequests'
* @member {string} message
*/
export interface ErrorDetails {
code: string;
message: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ErrorResponse class.
* @constructor
* @member {object} error
* @member {string} [error.code] Possible values include: 'BadRequest',
* 'Conflict', 'NotAcceptable', 'NotFound', 'InternalServerError',
* 'Unauthorized', 'TooManyRequests'
* @member {string} [error.message]
*/
export interface ErrorResponse {
error: ErrorDetails;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the SuccessResponse class.
* @constructor
* @member {string} message
*/
export interface SuccessResponse {
message: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AADTenantAddRequest class.
* @constructor
* @member {string} userId The user wanting to add this tenant to the
* organization, must be an admin of the organization
* @member {string} aadTenantId The AAD tenant id
* @member {string} displayName The name of the AAD Tenant
*/
export interface AADTenantAddRequest {
userId: string;
aadTenantId: string;
displayName: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AADTenantResponse class.
* @constructor
* @member {string} aadTenantId The AAD tenant id
* @member {string} displayName The name of the AAD Tenant
*/
export interface AADTenantResponse {
aadTenantId: string;
displayName: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the ApiTokensPostRequest class.
* @constructor
* @member {string} [description] The description of the token
* @member {string} [encryptedToken] An encrypted value of the token.
* @member {array} [scope] The scope for this token. An array of supported
* roles.
* @member {string} [tokenHash] The hashed value of api token
* @member {string} [tokenType] The token's type. public:managed by the user;
* in_app_update:special token for in-app update scenario; buid:dedicated for
* CI usage for now; session:for CLI session management; tester_app: used for
* tester mobile app; default is "public".'. Possible values include: 'public',
* 'in_app_update', 'build', 'session', 'tester_app'
*/
export interface ApiTokensPostRequest {
description?: string;
encryptedToken?: string;
scope?: string[];
tokenHash?: string;
tokenType?: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AppPatchRequest class.
* @constructor
* @member {string} [description] A short text describing the app
* @member {string} [displayName] The display name of the app
* @member {string} [name] The name of the app used in URLs
* @member {string} [iconUrl] The string representation of the URL pointing to
* the app's icon
*/
export interface AppPatchRequest {
description?: string;
displayName?: string;
name?: string;
iconUrl?: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AppRepoPatchRequest class.
* @constructor
* @member {string} [repoUrl] The absolute URL of the repository
*/
export interface AppRepoPatchRequest {
repoUrl?: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AppRepoPostRequest class.
* @constructor
* @member {string} repoUrl The absolute URL of the repository
* @member {string} [repoProvider] The provider of the repository. Possible
* values include: 'github', 'bitbucket', 'vsts'
* @member {string} userId The unique id (UUID) of the user who configured the
* repository
*/
export interface AppRepoPostRequest {
repoUrl: string;
repoProvider?: string;
userId: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AppRequest class.
* @constructor
* @member {string} [description] A short text describing the app
* @member {string} displayName The descriptive name of the app. This can
* contain any characters
* @member {string} [name] The name of the app used in URLs
* @member {string} os The OS the app will be running on. Possible values
* include: 'Android', 'iOS', 'macOS', 'Tizen', 'tvOS', 'Windows'
* @member {string} platform The platform of the app. Possible values include:
* 'Java', 'Objective-C-Swift', 'UWP', 'Cordova', 'React-Native', 'Xamarin'
*/
export interface AppRequest {
description?: string;
displayName: string;
name?: string;
os: string;
platform: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AppTeamAddRequest class.
* @constructor
* @member {string} name The name of the app to be added to the team
*/
export interface AppTeamAddRequest {
name: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AzureSubscriptionAddRequest class.
* @constructor
* @member {string} subscriptionId The azure subscription id
* @member {string} tenantId The tenant id of the azure subscription belongs to
* @member {string} subscriptionName The name of the azure subscription
* @member {boolean} [isBilling] If the subscription is used for billing
*/
export interface AzureSubscriptionAddRequest {
subscriptionId: string;
tenantId: string;
subscriptionName: string;
isBilling?: boolean;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AzureSubscriptionUpdateBillableRequest class.
* @constructor
* @member {boolean} isBillable Billable status of the subscription
*/
export interface AzureSubscriptionUpdateBillableRequest {
isBillable: boolean;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AzureSubscriptionPatchRequest class.
* @constructor
* @member {boolean} isBilling If the subscription is used for billing
*/
export interface AzureSubscriptionPatchRequest {
isBilling: boolean;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the AzureSubscriptionAddToAppRequest class.
* @constructor
* @member {string} subscriptionId The azure subscription id
*/
export interface AzureSubscriptionAddToAppRequest {
subscriptionId: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the DistributionGroupPatchRequest class.
* @constructor
* @member {string} [name] The name of the distribution group
* @member {boolean} [isPublic] Whether the distribution group is public
*/
export interface DistributionGroupPatchRequest {
name?: string;
isPublic?: boolean;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the DistributionGroupRequest class.
* @constructor
* @member {string} name The name of the distribution group
*/
export interface DistributionGroupRequest {
name: string;
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
InterfaceDeclaration | /**
* @class
* Initializes a new instance of the DistributionGroupUserRequest class.
* @constructor
* @member {array} [userEmails] The list of emails of the users
*/
export interface DistributionGroupUserRequest {
userEmails?: string[];
} | AndreyMitsyk/appcenter-cli | src/util/apis/generated/models/index.d.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.