new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"1":"e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w 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","132":"jB kB"},E:{"2":"I u J E F G A B C K L H GC zB HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"1":"cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w 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 OC PC QC RC qB 9B SC rB"},G:{"2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"2":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I vC wC xC yC zC 0B"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:6,C:"Signed HTTP Exchanges (SXG)"};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,99 @@
|
||||
import Context from './core/Context';
|
||||
import Rows from './core/Handlers/Rows';
|
||||
import Pages from './core/Handlers/Pages';
|
||||
import GlobalSearch from './core/Handlers/GlobalSearch';
|
||||
import Filters from './core/Handlers/Filters';
|
||||
export default class DataHandler {
|
||||
context;
|
||||
rows;
|
||||
pages;
|
||||
globalSearch;
|
||||
filters;
|
||||
i18n;
|
||||
constructor(data = [], params = { rowsPerPage: null }) {
|
||||
this.i18n = this.translate(params.i18n);
|
||||
this.context = new Context(data, params);
|
||||
this.rows = new Rows(this.context);
|
||||
this.pages = new Pages(this.context);
|
||||
this.globalSearch = new GlobalSearch(this.context);
|
||||
this.filters = new Filters(this.context);
|
||||
}
|
||||
setRows(data) {
|
||||
this.context.rawRows.set(data);
|
||||
}
|
||||
getRows() {
|
||||
return this.context.rows;
|
||||
}
|
||||
getRowCount() {
|
||||
return this.context.rowCount;
|
||||
}
|
||||
getRowsPerPage() {
|
||||
return this.context.rowsPerPage;
|
||||
}
|
||||
sort(orderBy) {
|
||||
this.setPage(1);
|
||||
this.rows.sort(orderBy);
|
||||
}
|
||||
sortAsc(orderBy) {
|
||||
this.setPage(1);
|
||||
this.rows.sortAsc(orderBy);
|
||||
}
|
||||
sortDesc(orderBy) {
|
||||
this.setPage(1);
|
||||
this.rows.sortDesc(orderBy);
|
||||
}
|
||||
getSorted() {
|
||||
return this.context.sorted;
|
||||
}
|
||||
search(value, scope = null) {
|
||||
this.globalSearch.set(value, scope);
|
||||
}
|
||||
clearSearch() {
|
||||
this.globalSearch.remove();
|
||||
}
|
||||
filter(value, filterBy) {
|
||||
return this.filters.set(value, filterBy);
|
||||
}
|
||||
getPages(params = { ellipsis: false }) {
|
||||
if (params.ellipsis) {
|
||||
return this.context.pagesWithEllipsis;
|
||||
}
|
||||
return this.context.pages;
|
||||
}
|
||||
getPageCount() {
|
||||
return this.context.pageCount;
|
||||
}
|
||||
getPageNumber() {
|
||||
return this.context.pageNumber;
|
||||
}
|
||||
setPage(value) {
|
||||
switch (value) {
|
||||
case 'previous': return this.pages.previous();
|
||||
case 'next': return this.pages.next();
|
||||
default: return this.pages.goTo(value);
|
||||
}
|
||||
}
|
||||
getTriggerChange() {
|
||||
return this.context.triggerChange;
|
||||
}
|
||||
translate(i18n) {
|
||||
return { ...{
|
||||
search: 'Search...',
|
||||
show: 'Show',
|
||||
entries: 'entries',
|
||||
filter: 'Filter',
|
||||
rowCount: 'Showing {start} to {end} of {total} entries',
|
||||
noRows: 'No entries to found',
|
||||
previous: 'Previous',
|
||||
next: 'Next'
|
||||
}, ...i18n };
|
||||
}
|
||||
/**
|
||||
* Deprecated
|
||||
* use setRows() instead
|
||||
*/
|
||||
update(data) {
|
||||
console.log('%c%s', 'color:#e65100;background:#fff3e0;font-size:12px;border-radius:4px;padding:4px;text-align:center;', `DataHandler.update(data) method is deprecated. Please use DataHandler.setRows(data) instead`);
|
||||
this.context.rawRows.set(data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { MonoTypeOperatorFunction, SchedulerLike } from '../types';
|
||||
/**
|
||||
* Delays the emission of items from the source Observable by a given timeout or
|
||||
* until a given Date.
|
||||
*
|
||||
* <span class="informal">Time shifts each item by some specified amount of
|
||||
* milliseconds.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* If the delay argument is a Number, this operator time shifts the source
|
||||
* Observable by that amount of time expressed in milliseconds. The relative
|
||||
* time intervals between the values are preserved.
|
||||
*
|
||||
* If the delay argument is a Date, this operator time shifts the start of the
|
||||
* Observable execution until the given date occurs.
|
||||
*
|
||||
* ## Examples
|
||||
* Delay each click by one second
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { delay } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const delayedClicks = clicks.pipe(delay(1000)); // each click emitted after 1 second
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* Delay all clicks until a future date happens
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { delay } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const date = new Date('March 15, 2050 12:00:00'); // in the future
|
||||
* const delayedClicks = clicks.pipe(delay(date)); // click emitted only after that date
|
||||
* delayedClicks.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link debounceTime}
|
||||
* @see {@link delayWhen}
|
||||
*
|
||||
* @param {number|Date} delay The delay duration in milliseconds (a `number`) or
|
||||
* a `Date` until which the emission of the source items is delayed.
|
||||
* @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for
|
||||
* managing the timers that handle the time-shift for each item.
|
||||
* @return {Observable} An Observable that delays the emissions of the source
|
||||
* Observable by the specified timeout or Date.
|
||||
* @method delay
|
||||
* @owner Observable
|
||||
*/
|
||||
export declare function delay<T>(delay: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapTo.js","sources":["../../src/internal/operators/mapTo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAA2C;AAoC3C,SAAgB,KAAK,CAAO,KAAQ;IAClC,OAAO,UAAC,MAAqB,IAAK,OAAA,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC,EAArC,CAAqC,CAAC;AAC1E,CAAC;AAFD,sBAEC;AAED;IAIE,uBAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,4BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;IACH,oBAAC;AAAD,CAAC,AAXD,IAWC;AAOD;IAAoC,mCAAa;IAI/C,yBAAY,WAA0B,EAAE,KAAQ;QAAhD,YACE,kBAAM,WAAW,CAAC,SAEnB;QADC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;;IACrB,CAAC;IAES,+BAAK,GAAf,UAAgB,CAAI;QAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IACH,sBAAC;AAAD,CAAC,AAZD,CAAoC,uBAAU,GAY7C"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"yocto-queue","version":"0.1.0","files":{"license":{"checkedAt":1678887829613,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1678887829627,"integrity":"sha512-wglk2JaUmJkp+CVT59KRJQwdUsMD603mGi5aTb4GQAZO1ptS5RUoqSBpm8X8cHwJ+7SyVRRFifqBTduGgRrAAg==","mode":420,"size":949},"index.d.ts":{"checkedAt":1678887829627,"integrity":"sha512-vCiwh0vRuDHHweQIcDuDnrFu6NIghxkwOCj8ZO2CWEM+Ci1BM7lqBW791tcDcccON804Xctorve2c0KtPAC83w==","mode":420,"size":1140},"readme.md":{"checkedAt":1678887829627,"integrity":"sha512-H72sBXSo4Lmf7eEZHMLaEgbFSRXNKjXAVFFUrMtdiXZcA+U+dovWhieEwMSXsaQOX+qNRDiyfo67ZOHOT8B/Lg==","mode":420,"size":2096},"package.json":{"checkedAt":1678887829627,"integrity":"sha512-UE5uilRYzZlvZ/zLu+VR2Y17BqUWNlegnYoRIR/cuSs6i0yFifmbNIPrGRqn5mToHfmnAeNvmeyZ/pYdKBNCnQ==","mode":420,"size":725}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"1":"hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w 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 DC EC"},D:{"1":"PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB"},E:{"1":"B C K L H qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J E F G A GC zB HC IC JC KC 0B"},F:{"1":"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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"0 1 2 3 4 5 6 7 8 9 G B C H M N O v w x y z AB BB OC PC QC RC qB 9B SC rB"},G:{"1":"dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"F zB TC AC UC VC WC XC YC ZC aC bC","16":"cC"},H:{"2":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC sC tC"},J:{"2":"E A"},K:{"1":"e","2":"A B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C","2":"I"},Q:{"1":"1B"},R:{"1":"8C"},S:{"2":"9C"}},B:1,C:"unhandledrejection/rejectionhandled events"};
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/using';
|
||||
@@ -0,0 +1 @@
|
||||
export declare const VERSION = "6.41.0";
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,MAAM,EACN,iBAAiB,EAGjB,OAAO,EACP,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,aAAK,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;AAClC,oBAAY,MAAM,GACd,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC,GAC9D,UAAU,CAAC;AACf,oBAAY,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;AAE7E,oBAAY,SAAS,GACjB,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC,GACtE,aAAa,CAAC;AAElB,oBAAY,aAAa,GAAG,CAC1B,iBAAiB,EAAE,iBAAiB,KACjC,iBAAiB,CAAC;AAEvB,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,OAAQ,SAAQ,WAAW;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAGD,iBAAS,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY;;;;;;EAe7D;AAGD,iBAAS,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;;;;;;EAerE;AAGD,QAAA,MAAM,cAAc;;;;;;;EAOT,CAAC;AAkDZ,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"prepend-http","version":"2.0.0","files":{"license":{"checkedAt":1678887829653,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"package.json":{"checkedAt":1678887830388,"integrity":"sha512-mE10rWorrOu5PcQmUL01Mp4JFV/dBGC38i6Y3wKLELoi3ISZH1Z9zHpj7QqWVTVPGXJWSCoU1AM/FP0lZU35BQ==","mode":420,"size":622},"readme.md":{"checkedAt":1678887830388,"integrity":"sha512-v7OlakH7Cc4qzeUV8ENLV7nn+SEPK6Y4i3ShJrVdzNcg7+S1jiniOhrdMO19pj+cWm0uuhhDgTb8nbGUQAslYQ==","mode":420,"size":862},"index.js":{"checkedAt":1678887830388,"integrity":"sha512-tJhm+k8RSs1xf5CDDByPKoe/vefU7P2bKyt+xKiFV2h3RhGKkXHH7S4DnBEX/tbA5MVSRsRH7y3qrNrvZIcDiA==","mode":420,"size":387}}}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"16":"J E BC","132":"F G A B"},B:{"132":"C K L H M N O","322":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB DC EC","1025":"VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB","1602":"UB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB","322":"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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"2":"I u J E F G A B C K L H GC zB HC IC JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC"},F:{"2":"0 1 2 3 4 5 G B C H M N O v w x y z OC PC QC RC qB 9B SC rB","322":"6 7 8 9 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d"},G:{"2":"F zB TC AC UC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"nC"},I:{"2":"tB I oC pC qC rC AC sC tC","322":"D"},J:{"2":"E A"},K:{"2":"A B C qB 9B rB","322":"e"},L:{"322":"D"},M:{"1025":"D"},N:{"132":"A B"},O:{"322":"uC"},P:{"2":"I","322":"vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"322":"1B"},R:{"322":"8C"},S:{"2":"9C"}},B:4,C:"CSS text-justify"};
|
||||
@@ -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,"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,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0.01864,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0.00466,"104":0,"105":0,"106":0.00466,"107":0.00466,"108":0.34491,"109":0.22373,"110":0,"111":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.00932,"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,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0.00466,"71":0,"72":0,"73":0,"74":0,"75":1.86906,"76":0.00932,"77":0,"78":0,"79":0.02797,"80":0.00466,"81":0.00932,"83":0.02331,"84":0,"85":0,"86":0.00466,"87":0.00466,"88":0.00932,"89":0.00466,"90":0,"91":0,"92":0,"93":0.00932,"94":0.00466,"95":0,"96":0.00932,"97":0.01864,"98":0,"99":0,"100":0.01398,"101":0,"102":0.00466,"103":0.04195,"104":0.00932,"105":0.01864,"106":0.02331,"107":0.42881,"108":5.39744,"109":4.14363,"110":0.04195,"111":0.00466,"112":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.00466,"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,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.05127,"94":0.08856,"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,"15":0,"16":0,"17":0,"18":0.03263,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0.00466,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00466,"106":0.00466,"107":0.06992,"108":1.71525,"109":1.32372},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0.00932,"14":0.05127,"15":0.01864,_:"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,"12.1":0,"13.1":0.14915,"14.1":0.27034,"15.1":0.02331,"15.2-15.3":0.04661,"15.4":0.06992,"15.5":0.26102,"15.6":1.24449,"16.0":0.18178,"16.1":0.52203,"16.2":0.69915,"16.3":0.1072},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,"9.0-9.2":0,"9.3":0.49702,"10.0-10.2":0,"10.3":0.0557,"11.0-11.2":0.00857,"11.3-11.4":0,"12.0-12.1":0.00857,"12.2-12.5":1.53821,"13.0-13.1":0,"13.2":0,"13.3":0.00857,"13.4-13.7":0.03856,"14.0-14.4":0.32135,"14.5-14.8":0.56558,"15.0-15.1":0.17139,"15.2-15.3":0.26565,"15.4":0.29136,"15.5":1.22971,"15.6":6.69698,"16.0":4.03619,"16.1":14.91075,"16.2":9.18211,"16.3":0.92978},P:{"4":0.06327,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0.09491,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.07382,"12.0":0,"13.0":0,"14.0":0.03164,"15.0":0.02109,"16.0":0.02109,"17.0":0.02109,"18.0":0.02109,"19.0":4.32375},I:{"0":0,"3":0,"4":0.01565,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.90265},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0.00466,"11":0.02331,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},S:{"2.5":0},R:{_:"0"},M:{"0":0.04805},Q:{"13.1":0},O:{"0":0.02136},H:{"0":0.06066},L:{"0":31.24063}};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"onErrorResumeNext.js","sources":["../src/observable/onErrorResumeNext.ts"],"names":[],"mappings":";;;;;AAAA,8DAAyD"}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { RequestRequestOptions } from "./RequestRequestOptions";
|
||||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
|
||||
*/
|
||||
export declare type RequestParameters = {
|
||||
/**
|
||||
* Base URL to be used when a relative URL is passed, such as `/orgs/{org}`.
|
||||
* If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
|
||||
* will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/{org}`.
|
||||
*/
|
||||
baseUrl?: Url;
|
||||
/**
|
||||
* HTTP headers. Use lowercase keys.
|
||||
*/
|
||||
headers?: RequestHeaders;
|
||||
/**
|
||||
* Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
|
||||
*/
|
||||
mediaType?: {
|
||||
/**
|
||||
* `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
|
||||
*/
|
||||
format?: string;
|
||||
/**
|
||||
* Custom media type names of {@link https://developer.github.com/v3/media/|API Previews} without the `-preview` suffix.
|
||||
* Example for single preview: `['squirrel-girl']`.
|
||||
* Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
|
||||
*/
|
||||
previews?: string[];
|
||||
};
|
||||
/**
|
||||
* Pass custom meta information for the request. The `request` object will be returned as is.
|
||||
*/
|
||||
request?: RequestRequestOptions;
|
||||
/**
|
||||
* Any additional parameter will be passed as follows
|
||||
* 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
|
||||
* 2. Query parameter if `method` is `'GET'` or `'HEAD'`
|
||||
* 3. Request body if `parameter` is `'data'`
|
||||
* 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
|
||||
*/
|
||||
[parameter: string]: unknown;
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
/** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { AsyncScheduler } from './AsyncScheduler';
|
||||
var QueueScheduler = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(QueueScheduler, _super);
|
||||
function QueueScheduler() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return QueueScheduler;
|
||||
}(AsyncScheduler));
|
||||
export { QueueScheduler };
|
||||
//# sourceMappingURL=QueueScheduler.js.map
|
||||
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Subscriber_1 = require("../Subscriber");
|
||||
var Notification_1 = require("../Notification");
|
||||
function observeOn(scheduler, delay) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
return function observeOnOperatorFunction(source) {
|
||||
return source.lift(new ObserveOnOperator(scheduler, delay));
|
||||
};
|
||||
}
|
||||
exports.observeOn = observeOn;
|
||||
var ObserveOnOperator = (function () {
|
||||
function ObserveOnOperator(scheduler, delay) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
this.scheduler = scheduler;
|
||||
this.delay = delay;
|
||||
}
|
||||
ObserveOnOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
|
||||
};
|
||||
return ObserveOnOperator;
|
||||
}());
|
||||
exports.ObserveOnOperator = ObserveOnOperator;
|
||||
var ObserveOnSubscriber = (function (_super) {
|
||||
__extends(ObserveOnSubscriber, _super);
|
||||
function ObserveOnSubscriber(destination, scheduler, delay) {
|
||||
if (delay === void 0) { delay = 0; }
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.scheduler = scheduler;
|
||||
_this.delay = delay;
|
||||
return _this;
|
||||
}
|
||||
ObserveOnSubscriber.dispatch = function (arg) {
|
||||
var notification = arg.notification, destination = arg.destination;
|
||||
notification.observe(destination);
|
||||
this.unsubscribe();
|
||||
};
|
||||
ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
|
||||
var destination = this.destination;
|
||||
destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
|
||||
};
|
||||
ObserveOnSubscriber.prototype._next = function (value) {
|
||||
this.scheduleMessage(Notification_1.Notification.createNext(value));
|
||||
};
|
||||
ObserveOnSubscriber.prototype._error = function (err) {
|
||||
this.scheduleMessage(Notification_1.Notification.createError(err));
|
||||
this.unsubscribe();
|
||||
};
|
||||
ObserveOnSubscriber.prototype._complete = function () {
|
||||
this.scheduleMessage(Notification_1.Notification.createComplete());
|
||||
this.unsubscribe();
|
||||
};
|
||||
return ObserveOnSubscriber;
|
||||
}(Subscriber_1.Subscriber));
|
||||
exports.ObserveOnSubscriber = ObserveOnSubscriber;
|
||||
var ObserveOnMessage = (function () {
|
||||
function ObserveOnMessage(notification, destination) {
|
||||
this.notification = notification;
|
||||
this.destination = destination;
|
||||
}
|
||||
return ObserveOnMessage;
|
||||
}());
|
||||
exports.ObserveOnMessage = ObserveOnMessage;
|
||||
//# sourceMappingURL=observeOn.js.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J E F G A B BC"},B:{"1":"P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t","2":"C K L H M N O"},C:{"1":"a b c d f g h i j k l m n o p q r s D t xB yB","2":"CC tB DC EC","33":"TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z","164":"0 1 2 3 4 5 6 7 8 9 I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB"},D:{"1":"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 e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC","2":"I u J E F G A B C K L H M N O v w","132":"0 1 2 3 4 5 6 7 8 9 x y z AB BB CB DB EB FB GB HB"},E:{"1":"L H 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","2":"I u J GC zB HC","132":"E F G A B C K IC JC KC 0B qB rB"},F:{"1":"5 6 7 8 9 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 e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d","2":"G OC PC QC","132":"0 1 2 3 4 H M N O v w x y z","164":"B C RC qB 9B SC rB"},G:{"1":"jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","2":"zB TC AC UC VC","132":"F WC XC YC ZC aC bC cC dC eC fC gC hC iC"},H:{"164":"nC"},I:{"1":"D","2":"tB I oC pC qC rC AC","132":"sC tC"},J:{"132":"E A"},K:{"1":"e","2":"A","164":"B C qB 9B rB"},L:{"1":"D"},M:{"1":"D"},N:{"2":"A B"},O:{"1":"uC"},P:{"1":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"1":"1B"},R:{"1":"8C"},S:{"164":"9C"}},B:4,C:"CSS3 tab-size"};
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "boxen",
|
||||
"version": "5.1.2",
|
||||
"description": "Create boxes in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/boxen",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"box",
|
||||
"boxes",
|
||||
"terminal",
|
||||
"term",
|
||||
"console",
|
||||
"ascii",
|
||||
"unicode",
|
||||
"border",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-align": "^3.0.0",
|
||||
"camelcase": "^6.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-boxes": "^2.2.1",
|
||||
"string-width": "^4.2.2",
|
||||
"type-fest": "^0.20.2",
|
||||
"widest-line": "^3.1.0",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.4.0",
|
||||
"nyc": "^15.1.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.36.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
# auth-token.js
|
||||
|
||||
> GitHub API token authentication for browsers and Node.js
|
||||
|
||||
[](https://www.npmjs.com/package/@octokit/auth-token)
|
||||
[](https://github.com/octokit/auth-token.js/actions?query=workflow%3ATest)
|
||||
|
||||
`@octokit/auth-token` is the simplest of [GitHub’s authentication strategies](https://github.com/octokit/auth.js).
|
||||
|
||||
It is useful if you want to support multiple authentication strategies, as it’s API is compatible with its sibling packages for [basic](https://github.com/octokit/auth-basic.js), [GitHub App](https://github.com/octokit/auth-app.js) and [OAuth app](https://github.com/octokit/auth.js) authentication.
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Usage](#usage)
|
||||
- [`createTokenAuth(token) options`](#createtokenauthtoken-options)
|
||||
- [`auth()`](#auth)
|
||||
- [Authentication object](#authentication-object)
|
||||
- [`auth.hook(request, route, options)` or `auth.hook(request, options)`](#authhookrequest-route-options-or-authhookrequest-options)
|
||||
- [Find more information](#find-more-information)
|
||||
- [Find out what scopes are enabled for oauth tokens](#find-out-what-scopes-are-enabled-for-oauth-tokens)
|
||||
- [Find out if token is a personal access token or if it belongs to an OAuth app](#find-out-if-token-is-a-personal-access-token-or-if-it-belongs-to-an-oauth-app)
|
||||
- [Find out what permissions are enabled for a repository](#find-out-what-permissions-are-enabled-for-a-repository)
|
||||
- [Use token for git operations](#use-token-for-git-operations)
|
||||
- [License](#license)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
## Usage
|
||||
|
||||
<table>
|
||||
<tbody valign=top align=left>
|
||||
<tr><th>
|
||||
Browsers
|
||||
</th><td width=100%>
|
||||
|
||||
Load `@octokit/auth-token` directly from [cdn.skypack.dev](https://cdn.skypack.dev)
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import { createTokenAuth } from "https://cdn.skypack.dev/@octokit/auth-token";
|
||||
</script>
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
<tr><th>
|
||||
Node
|
||||
</th><td>
|
||||
|
||||
Install with <code>npm install @octokit/auth-token</code>
|
||||
|
||||
```js
|
||||
const { createTokenAuth } = require("@octokit/auth-token");
|
||||
// or: import { createTokenAuth } from "@octokit/auth-token";
|
||||
```
|
||||
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
```js
|
||||
const auth = createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
const authentication = await auth();
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
```
|
||||
|
||||
## `createTokenAuth(token) options`
|
||||
|
||||
The `createTokenAuth` method accepts a single argument of type string, which is the token. The passed token can be one of the following:
|
||||
|
||||
- [Personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
|
||||
- [OAuth access token](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/)
|
||||
- [GITHUB_TOKEN provided to GitHub Actions](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables)
|
||||
- Installation access token ([server-to-server](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation))
|
||||
- User authentication for installation ([user-to-server](https://docs.github.com/en/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps))
|
||||
|
||||
Examples
|
||||
|
||||
```js
|
||||
// Personal access token or OAuth access token
|
||||
createTokenAuth("ghp_PersonalAccessToken01245678900000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghp_PersonalAccessToken01245678900000000',
|
||||
// tokenType: 'oauth'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghs_InstallallationOrActionToken00000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghs_InstallallationOrActionToken00000000',
|
||||
// tokenType: 'installation'
|
||||
// }
|
||||
|
||||
// Installation access token or GitHub Action token
|
||||
createTokenAuth("ghu_InstallationUserToServer000000000000");
|
||||
// {
|
||||
// type: 'token',
|
||||
// token: 'ghu_InstallationUserToServer000000000000',
|
||||
// tokenType: 'user-to-server'
|
||||
// }
|
||||
```
|
||||
|
||||
## `auth()`
|
||||
|
||||
The `auth()` method has no options. It returns a promise which resolves with the the authentication object.
|
||||
|
||||
## Authentication object
|
||||
|
||||
<table width="100%">
|
||||
<thead align=left>
|
||||
<tr>
|
||||
<th width=150>
|
||||
name
|
||||
</th>
|
||||
<th width=70>
|
||||
type
|
||||
</th>
|
||||
<th>
|
||||
description
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody align=left valign=top>
|
||||
<tr>
|
||||
<th>
|
||||
<code>type</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
<code>"token"</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>token</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
The provided token.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<code>tokenType</code>
|
||||
</th>
|
||||
<th>
|
||||
<code>string</code>
|
||||
</th>
|
||||
<td>
|
||||
Can be either <code>"oauth"</code> for personal access tokens and OAuth tokens, <code>"installation"</code> for installation access tokens (includes <code>GITHUB_TOKEN</code> provided to GitHub Actions), <code>"app"</code> for a GitHub App JSON Web Token, or <code>"user-to-server"</code> for a user authentication token through an app installation.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## `auth.hook(request, route, options)` or `auth.hook(request, options)`
|
||||
|
||||
`auth.hook()` hooks directly into the request life cycle. It authenticates the request using the provided token.
|
||||
|
||||
The `request` option is an instance of [`@octokit/request`](https://github.com/octokit/request.js#readme). The `route`/`options` parameters are the same as for the [`request()` method](https://github.com/octokit/request.js#request).
|
||||
|
||||
`auth.hook()` can be called directly to send an authenticated request
|
||||
|
||||
```js
|
||||
const { data: authorizations } = await auth.hook(
|
||||
request,
|
||||
"GET /authorizations"
|
||||
);
|
||||
```
|
||||
|
||||
Or it can be passed as option to [`request()`](https://github.com/octokit/request.js#request).
|
||||
|
||||
```js
|
||||
const requestWithAuth = request.defaults({
|
||||
request: {
|
||||
hook: auth.hook,
|
||||
},
|
||||
});
|
||||
|
||||
const { data: authorizations } = await requestWithAuth("GET /authorizations");
|
||||
```
|
||||
|
||||
## Find more information
|
||||
|
||||
`auth()` does not send any requests, it only transforms the provided token string into an authentication object.
|
||||
|
||||
Here is a list of things you can do to retrieve further information
|
||||
|
||||
### Find out what scopes are enabled for oauth tokens
|
||||
|
||||
Note that this does not work for installations. There is no way to retrieve permissions based on an installation access tokens.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /", {
|
||||
headers: authentication.headers,
|
||||
});
|
||||
const scopes = response.headers["x-oauth-scopes"].split(/,\s+/);
|
||||
|
||||
if (scopes.length) {
|
||||
console.log(
|
||||
`"${TOKEN}" has ${scopes.length} scopes enabled: ${scopes.join(", ")}`
|
||||
);
|
||||
} else {
|
||||
console.log(`"${TOKEN}" has no scopes enabled`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out if token is a personal access token or if it belongs to an OAuth app
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("HEAD /", {
|
||||
headers: authentication.headers,
|
||||
});
|
||||
const clientId = response.headers["x-oauth-client-id"];
|
||||
|
||||
if (clientId) {
|
||||
console.log(
|
||||
`"${token}" is an OAuth token, its app’s client_id is ${clientId}.`
|
||||
);
|
||||
} else {
|
||||
console.log(`"${token}" is a personal access token`);
|
||||
}
|
||||
```
|
||||
|
||||
### Find out what permissions are enabled for a repository
|
||||
|
||||
Note that the `permissions` key is not set when authenticated using an installation access token.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const authentication = await auth();
|
||||
|
||||
const response = await request("GET /repos/{owner}/{repo}", {
|
||||
owner: 'octocat',
|
||||
repo: 'hello-world'
|
||||
headers: authentication.headers
|
||||
});
|
||||
|
||||
console.log(response.data.permissions)
|
||||
// {
|
||||
// admin: true,
|
||||
// push: true,
|
||||
// pull: true
|
||||
// }
|
||||
```
|
||||
|
||||
### Use token for git operations
|
||||
|
||||
Both OAuth and installation access tokens can be used for git operations. However, when using with an installation, [the token must be prefixed with `x-access-token`](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation).
|
||||
|
||||
This example is using the [`execa`](https://github.com/sindresorhus/execa) package to run a `git push` command.
|
||||
|
||||
```js
|
||||
const TOKEN = "ghp_PersonalAccessToken01245678900000000";
|
||||
|
||||
const auth = createTokenAuth(TOKEN);
|
||||
const { token, tokenType } = await auth();
|
||||
const tokenWithPrefix =
|
||||
tokenType === "installation" ? `x-access-token:${token}` : token;
|
||||
|
||||
const repositoryUrl = `https://${tokenWithPrefix}@github.com/octocat/hello-world.git`;
|
||||
|
||||
const { stdout } = await execa("git", ["push", repositoryUrl]);
|
||||
console.log(stdout);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
Reference in New Issue
Block a user