@adobe/aio-commerce-lib-auth 0.8.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +1 -4
- package/bin/cli.mjs +24 -0
- package/dist/cjs/chunk-C0xms8kb.cjs +34 -0
- package/dist/cjs/commands/index.cjs +162 -84
- package/dist/cjs/index.cjs +750 -1
- package/dist/es/commands/index.mjs +157 -84
- package/dist/es/index.d.mts +0 -2
- package/dist/es/index.mjs +737 -1
- package/package.json +19 -8
- package/dist/cjs/chunk-YD6SZpHm.cjs +0 -1
|
@@ -1,88 +1,117 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_chunk=require(`../chunk-YD6SZpHm.cjs`);let _adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`),_adobe_aio_lib_ims=require(`@adobe/aio-lib-ims`);_adobe_aio_lib_ims=require_chunk.n(_adobe_aio_lib_ims);let consola=require(`consola`);consola=require_chunk.n(consola);let fs=require(`fs`),path=require(`path`);path=require_chunk.n(path);function stringifyError(error){return error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError?error.display():error instanceof Error?error.message:String(error)}var require_ms=require_chunk.t(((exports,module)=>{var s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;module.exports=function(val,options){options||={};var type=typeof val;if(type===`string`&&val.length>0)return parse(val);if(type===`number`&&isFinite(val))return options.long?fmtLong(val):fmtShort(val);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(val))};function parse(str){if(str=String(str),!(str.length>100)){var match=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);if(match){var n=parseFloat(match[1]);switch((match[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return n*y;case`weeks`:case`week`:case`w`:return n*w;case`days`:case`day`:case`d`:return n*d;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*h;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*m;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*s;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function fmtShort(ms){var msAbs=Math.abs(ms);return msAbs>=d?Math.round(ms/d)+`d`:msAbs>=h?Math.round(ms/h)+`h`:msAbs>=m?Math.round(ms/m)+`m`:msAbs>=s?Math.round(ms/s)+`s`:ms+`ms`}function fmtLong(ms){var msAbs=Math.abs(ms);return msAbs>=d?plural(ms,msAbs,d,`day`):msAbs>=h?plural(ms,msAbs,h,`hour`):msAbs>=m?plural(ms,msAbs,m,`minute`):msAbs>=s?plural(ms,msAbs,s,`second`):ms+` ms`}function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+` `+name+(isPlural?`s`:``)}})),require_common$1=require_chunk.t(((exports,module)=>{function setup(env){createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=coerce,createDebug.disable=disable,createDebug.enable=enable,createDebug.enabled=enabled,createDebug.humanize=require_ms(),createDebug.destroy=destroy,Object.keys(env).forEach(key=>{createDebug[key]=env[key]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={};function selectColor(namespace){let hash=0;for(let i=0;i<namespace.length;i++)hash=(hash<<5)-hash+namespace.charCodeAt(i),hash|=0;return createDebug.colors[Math.abs(hash)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(namespace){let prevTime,enableOverride=null,namespacesCache,enabledCache;function debug(...args){if(!debug.enabled)return;let self=debug,curr=Number(new Date);self.diff=curr-(prevTime||curr),self.prev=prevTime,self.curr=curr,prevTime=curr,args[0]=createDebug.coerce(args[0]),typeof args[0]!=`string`&&args.unshift(`%O`);let index=0;args[0]=args[0].replace(/%([a-zA-Z%])/g,(match,format)=>{if(match===`%%`)return`%`;index++;let formatter=createDebug.formatters[format];if(typeof formatter==`function`){let val=args[index];match=formatter.call(self,val),args.splice(index,1),index--}return match}),createDebug.formatArgs.call(self,args),(self.log||createDebug.log).apply(self,args)}return debug.namespace=namespace,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(namespace),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,`enabled`,{enumerable:!0,configurable:!1,get:()=>enableOverride===null?(namespacesCache!==createDebug.namespaces&&(namespacesCache=createDebug.namespaces,enabledCache=createDebug.enabled(namespace)),enabledCache):enableOverride,set:v=>{enableOverride=v}}),typeof createDebug.init==`function`&&createDebug.init(debug),debug}function extend(namespace,delimiter){let newDebug=createDebug(this.namespace+(delimiter===void 0?`:`:delimiter)+namespace);return newDebug.log=this.log,newDebug}function enable(namespaces){createDebug.save(namespaces),createDebug.namespaces=namespaces,createDebug.names=[],createDebug.skips=[];let split=(typeof namespaces==`string`?namespaces:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let ns of split)ns[0]===`-`?createDebug.skips.push(ns.slice(1)):createDebug.names.push(ns)}function matchesTemplate(search,template){let searchIndex=0,templateIndex=0,starIndex=-1,matchIndex=0;for(;searchIndex<search.length;)if(templateIndex<template.length&&(template[templateIndex]===search[searchIndex]||template[templateIndex]===`*`))template[templateIndex]===`*`?(starIndex=templateIndex,matchIndex=searchIndex,templateIndex++):(searchIndex++,templateIndex++);else if(starIndex!==-1)templateIndex=starIndex+1,matchIndex++,searchIndex=matchIndex;else return!1;for(;templateIndex<template.length&&template[templateIndex]===`*`;)templateIndex++;return templateIndex===template.length}function disable(){let namespaces=[...createDebug.names,...createDebug.skips.map(namespace=>`-`+namespace)].join(`,`);return createDebug.enable(``),namespaces}function enabled(name){for(let skip of createDebug.skips)if(matchesTemplate(name,skip))return!1;for(let ns of createDebug.names)if(matchesTemplate(name,ns))return!0;return!1}function coerce(val){return val instanceof Error?val.stack||val.message:val}function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return createDebug.enable(createDebug.load()),createDebug}module.exports=setup})),require_browser=require_chunk.t(((exports,module)=>{exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.destroy=(()=>{let warned=!1;return()=>{warned||(warned=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),exports.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function useColors(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let m;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(m=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(m[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(args){if(args[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+args[0]+(this.useColors?`%c `:` `)+`+`+module.exports.humanize(this.diff),!this.useColors)return;let c=`color: `+this.color;args.splice(1,0,c,`color: inherit`);let index=0,lastC=0;args[0].replace(/%[a-zA-Z%]/g,match=>{match!==`%%`&&(index++,match===`%c`&&(lastC=index))}),args.splice(lastC,0,c)}exports.log=console.debug||console.log||(()=>{});function save(namespaces){try{namespaces?exports.storage.setItem(`debug`,namespaces):exports.storage.removeItem(`debug`)}catch{}}function load(){let r;try{r=exports.storage.getItem(`debug`)||exports.storage.getItem(`DEBUG`)}catch{}return!r&&typeof process<`u`&&`env`in process&&(r=process.env.DEBUG),r}function localstorage(){try{return localStorage}catch{}}module.exports=require_common$1()(exports);let{formatters}=module.exports;formatters.j=function(v){try{return JSON.stringify(v)}catch(error){return`[UnexpectedJSONParseError]: `+error.message}}})),require_has_flag=require_chunk.t(((exports,module)=>{module.exports=(flag,argv=process.argv)=>{let prefix=flag.startsWith(`-`)?``:flag.length===1?`-`:`--`,position=argv.indexOf(prefix+flag),terminatorPosition=argv.indexOf(`--`);return position!==-1&&(terminatorPosition===-1||position<terminatorPosition)}})),require_supports_color=require_chunk.t(((exports,module)=>{let os$4=require(`os`),tty$1=require(`tty`),hasFlag=require_has_flag(),{env}=process,forceColor;hasFlag(`no-color`)||hasFlag(`no-colors`)||hasFlag(`color=false`)||hasFlag(`color=never`)?forceColor=0:(hasFlag(`color`)||hasFlag(`colors`)||hasFlag(`color=true`)||hasFlag(`color=always`))&&(forceColor=1),`FORCE_COLOR`in env&&(forceColor=env.FORCE_COLOR===`true`?1:env.FORCE_COLOR===`false`?0:env.FORCE_COLOR.length===0?1:Math.min(parseInt(env.FORCE_COLOR,10),3));function translateLevel(level){return level===0?!1:{level,hasBasic:!0,has256:level>=2,has16m:level>=3}}function supportsColor(haveStream,streamIsTTY){if(forceColor===0)return 0;if(hasFlag(`color=16m`)||hasFlag(`color=full`)||hasFlag(`color=truecolor`))return 3;if(hasFlag(`color=256`))return 2;if(haveStream&&!streamIsTTY&&forceColor===void 0)return 0;let min=forceColor||0;if(env.TERM===`dumb`)return min;if(process.platform===`win32`){let osRelease=os$4.release().split(`.`);return Number(osRelease[0])>=10&&Number(osRelease[2])>=10586?Number(osRelease[2])>=14931?3:2:1}if(`CI`in env)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(sign=>sign in env)||env.CI_NAME===`codeship`?1:min;if(`TEAMCITY_VERSION`in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in env){let version=parseInt((env.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(env.TERM_PROGRAM){case`iTerm.app`:return version>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||`COLORTERM`in env?1:min}function getSupportLevel(stream){return translateLevel(supportsColor(stream,stream&&stream.isTTY))}module.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(!0,tty$1.isatty(1))),stderr:translateLevel(supportsColor(!0,tty$1.isatty(2)))}})),require_node=require_chunk.t(((exports,module)=>{let tty=require(`tty`),util=require(`util`);exports.init=init,exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.destroy=util.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),exports.colors=[6,2,3,4,5,1];try{let supportsColor=require_supports_color();supportsColor&&(supportsColor.stderr||supportsColor).level>=2&&(exports.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}exports.inspectOpts=Object.keys(process.env).filter(key=>/^debug_/i.test(key)).reduce((obj,key)=>{let prop=key.substring(6).toLowerCase().replace(/_([a-z])/g,(_,k)=>k.toUpperCase()),val=process.env[key];return val=/^(yes|on|true|enabled)$/i.test(val)?!0:/^(no|off|false|disabled)$/i.test(val)?!1:val===`null`?null:Number(val),obj[prop]=val,obj},{});function useColors(){return`colors`in exports.inspectOpts?!!exports.inspectOpts.colors:tty.isatty(process.stderr.fd)}function formatArgs(args){let{namespace:name,useColors}=this;if(useColors){let c=this.color,colorCode=`\x1B[3`+(c<8?c:`8;5;`+c),prefix=` ${colorCode};1m${name} \u001B[0m`;args[0]=prefix+args[0].split(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const require_chunk = require('../chunk-C0xms8kb.cjs');
|
|
3
|
+
let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
|
|
4
|
+
let _adobe_aio_lib_ims = require("@adobe/aio-lib-ims");
|
|
5
|
+
_adobe_aio_lib_ims = require_chunk.__toESM(_adobe_aio_lib_ims);
|
|
6
|
+
let consola = require("consola");
|
|
7
|
+
consola = require_chunk.__toESM(consola);
|
|
8
|
+
let fs = require("fs");
|
|
9
|
+
let path = require("path");
|
|
10
|
+
path = require_chunk.__toESM(path);
|
|
11
|
+
let _adobe_aio_lib_core_config = require("@adobe/aio-lib-core-config");
|
|
12
|
+
_adobe_aio_lib_core_config = require_chunk.__toESM(_adobe_aio_lib_core_config);
|
|
13
|
+
let dotenv = require("dotenv");
|
|
14
|
+
dotenv = require_chunk.__toESM(dotenv);
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`;return result.replace(/\n$/,``)}module.exports=makeSnippet})),require_type=require_chunk.t(((exports,module)=>{var YAMLException=require_exception(),TYPE_CONSTRUCTOR_OPTIONS=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],YAML_NODE_KINDS=[`scalar`,`sequence`,`mapping`];function compileStyleAliases(map){var result={};return map!==null&&Object.keys(map).forEach(function(style){map[style].forEach(function(alias){result[String(alias)]=style})}),result}function Type(tag,options){if(options||={},Object.keys(options).forEach(function(name){if(TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)===-1)throw new YAMLException(`Unknown option "`+name+`" is met in definition of "`+tag+`" YAML type.`)}),this.options=options,this.tag=tag,this.kind=options.kind||null,this.resolve=options.resolve||function(){return!0},this.construct=options.construct||function(data){return data},this.instanceOf=options.instanceOf||null,this.predicate=options.predicate||null,this.represent=options.represent||null,this.representName=options.representName||null,this.defaultStyle=options.defaultStyle||null,this.multi=options.multi||!1,this.styleAliases=compileStyleAliases(options.styleAliases||null),YAML_NODE_KINDS.indexOf(this.kind)===-1)throw new YAMLException(`Unknown kind "`+this.kind+`" is specified for "`+tag+`" YAML type.`)}module.exports=Type})),require_schema=require_chunk.t(((exports,module)=>{var YAMLException=require_exception(),Type=require_type();function compileList(schema,name){var result=[];return schema[name].forEach(function(currentType){var newIndex=result.length;result.forEach(function(previousType,previousIndex){previousType.tag===currentType.tag&&previousType.kind===currentType.kind&&previousType.multi===currentType.multi&&(newIndex=previousIndex)}),result[newIndex]=currentType}),result}function compileMap(){var result={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},index,length;function collectType(type){type.multi?(result.multi[type.kind].push(type),result.multi.fallback.push(type)):result[type.kind][type.tag]=result.fallback[type.tag]=type}for(index=0,length=arguments.length;index<length;index+=1)arguments[index].forEach(collectType);return result}function Schema(definition){return this.extend(definition)}Schema.prototype.extend=function(definition){var implicit=[],explicit=[];if(definition instanceof Type)explicit.push(definition);else if(Array.isArray(definition))explicit=explicit.concat(definition);else if(definition&&(Array.isArray(definition.implicit)||Array.isArray(definition.explicit)))definition.implicit&&(implicit=implicit.concat(definition.implicit)),definition.explicit&&(explicit=explicit.concat(definition.explicit));else throw new YAMLException(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);implicit.forEach(function(type){if(!(type instanceof Type))throw new YAMLException(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(type.loadKind&&type.loadKind!==`scalar`)throw new YAMLException(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(type.multi)throw new YAMLException(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),explicit.forEach(function(type){if(!(type instanceof Type))throw new YAMLException(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});var result=Object.create(Schema.prototype);return result.implicit=(this.implicit||[]).concat(implicit),result.explicit=(this.explicit||[]).concat(explicit),result.compiledImplicit=compileList(result,`implicit`),result.compiledExplicit=compileList(result,`explicit`),result.compiledTypeMap=compileMap(result.compiledImplicit,result.compiledExplicit),result},module.exports=Schema})),require_str=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(data){return data===null?``:data}})})),require_seq=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(data){return data===null?[]:data}})})),require_map=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(data){return data===null?{}:data}})})),require_failsafe=require_chunk.t(((exports,module)=>{module.exports=new(require_schema())({explicit:[require_str(),require_seq(),require_map()]})})),require_null=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlNull(data){if(data===null)return!0;var max=data.length;return max===1&&data===`~`||max===4&&(data===`null`||data===`Null`||data===`NULL`)}function constructYamlNull(){return null}function isNull(object){return object===null}module.exports=new Type(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:resolveYamlNull,construct:constructYamlNull,predicate:isNull,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`})})),require_bool=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlBoolean(data){if(data===null)return!1;var max=data.length;return max===4&&(data===`true`||data===`True`||data===`TRUE`)||max===5&&(data===`false`||data===`False`||data===`FALSE`)}function constructYamlBoolean(data){return data===`true`||data===`True`||data===`TRUE`}function isBoolean(object){return Object.prototype.toString.call(object)===`[object Boolean]`}module.exports=new Type(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:resolveYamlBoolean,construct:constructYamlBoolean,predicate:isBoolean,represent:{lowercase:function(object){return object?`true`:`false`},uppercase:function(object){return object?`TRUE`:`FALSE`},camelcase:function(object){return object?`True`:`False`}},defaultStyle:`lowercase`})})),require_int=require_chunk.t(((exports,module)=>{var common=require_common(),Type=require_type();function isHexCode(c){return 48<=c&&c<=57||65<=c&&c<=70||97<=c&&c<=102}function isOctCode(c){return 48<=c&&c<=55}function isDecCode(c){return 48<=c&&c<=57}function resolveYamlInteger(data){if(data===null)return!1;var max=data.length,index=0,hasDigits=!1,ch;if(!max)return!1;if(ch=data[index],(ch===`-`||ch===`+`)&&(ch=data[++index]),ch===`0`){if(index+1===max)return!0;if(ch=data[++index],ch===`b`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(ch!==`0`&&ch!==`1`)return!1;hasDigits=!0}return hasDigits&&ch!==`_`}if(ch===`x`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(!isHexCode(data.charCodeAt(index)))return!1;hasDigits=!0}return hasDigits&&ch!==`_`}if(ch===`o`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(!isOctCode(data.charCodeAt(index)))return!1;hasDigits=!0}return hasDigits&&ch!==`_`}}if(ch===`_`)return!1;for(;index<max;index++)if(ch=data[index],ch!==`_`){if(!isDecCode(data.charCodeAt(index)))return!1;hasDigits=!0}return!(!hasDigits||ch===`_`)}function constructYamlInteger(data){var value=data,sign=1,ch;if(value.indexOf(`_`)!==-1&&(value=value.replace(/_/g,``)),ch=value[0],(ch===`-`||ch===`+`)&&(ch===`-`&&(sign=-1),value=value.slice(1),ch=value[0]),value===`0`)return 0;if(ch===`0`){if(value[1]===`b`)return sign*parseInt(value.slice(2),2);if(value[1]===`x`)return sign*parseInt(value.slice(2),16);if(value[1]===`o`)return sign*parseInt(value.slice(2),8)}return sign*parseInt(value,10)}function isInteger(object){return Object.prototype.toString.call(object)===`[object Number]`&&object%1==0&&!common.isNegativeZero(object)}module.exports=new Type(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:resolveYamlInteger,construct:constructYamlInteger,predicate:isInteger,represent:{binary:function(obj){return obj>=0?`0b`+obj.toString(2):`-0b`+obj.toString(2).slice(1)},octal:function(obj){return obj>=0?`0o`+obj.toString(8):`-0o`+obj.toString(8).slice(1)},decimal:function(obj){return obj.toString(10)},hexadecimal:function(obj){return obj>=0?`0x`+obj.toString(16).toUpperCase():`-0x`+obj.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}})})),require_float=require_chunk.t(((exports,module)=>{var common=require_common(),Type=require_type(),YAML_FLOAT_PATTERN=RegExp(`^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function resolveYamlFloat(data){return!(data===null||!YAML_FLOAT_PATTERN.test(data)||data[data.length-1]===`_`)}function constructYamlFloat(data){var value=data.replace(/_/g,``).toLowerCase(),sign=value[0]===`-`?-1:1;return`+-`.indexOf(value[0])>=0&&(value=value.slice(1)),value===`.inf`?sign===1?1/0:-1/0:value===`.nan`?NaN:sign*parseFloat(value,10)}var SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/;function representYamlFloat(object,style){var res;if(isNaN(object))switch(style){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(object===1/0)switch(style){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(object===-1/0)switch(style){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(common.isNegativeZero(object))return`-0.0`;return res=object.toString(10),SCIENTIFIC_WITHOUT_DOT.test(res)?res.replace(`e`,`.e`):res}function isFloat(object){return Object.prototype.toString.call(object)===`[object Number]`&&(object%1!=0||common.isNegativeZero(object))}module.exports=new Type(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:resolveYamlFloat,construct:constructYamlFloat,predicate:isFloat,represent:representYamlFloat,defaultStyle:`lowercase`})})),require_json=require_chunk.t(((exports,module)=>{module.exports=require_failsafe().extend({implicit:[require_null(),require_bool(),require_int(),require_float()]})})),require_core=require_chunk.t(((exports,module)=>{module.exports=require_json()})),require_timestamp=require_chunk.t(((exports,module)=>{var Type=require_type(),YAML_DATE_REGEXP=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),YAML_TIMESTAMP_REGEXP=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function resolveYamlTimestamp(data){return data===null?!1:YAML_DATE_REGEXP.exec(data)!==null||YAML_TIMESTAMP_REGEXP.exec(data)!==null}function constructYamlTimestamp(data){var match,year,month,day,hour,minute,second,fraction=0,delta=null,tz_hour,tz_minute,date;if(match=YAML_DATE_REGEXP.exec(data),match===null&&(match=YAML_TIMESTAMP_REGEXP.exec(data)),match===null)throw Error(`Date resolve error`);if(year=+match[1],month=match[2]-1,day=+match[3],!match[4])return new Date(Date.UTC(year,month,day));if(hour=+match[4],minute=+match[5],second=+match[6],match[7]){for(fraction=match[7].slice(0,3);fraction.length<3;)fraction+=`0`;fraction=+fraction}return match[9]&&(tz_hour=+match[10],tz_minute=+(match[11]||0),delta=(tz_hour*60+tz_minute)*6e4,match[9]===`-`&&(delta=-delta)),date=new Date(Date.UTC(year,month,day,hour,minute,second,fraction)),delta&&date.setTime(date.getTime()-delta),date}function representYamlTimestamp(object){return object.toISOString()}module.exports=new Type(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:resolveYamlTimestamp,construct:constructYamlTimestamp,instanceOf:Date,represent:representYamlTimestamp})})),require_merge=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlMerge(data){return data===`<<`||data===null}module.exports=new Type(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:resolveYamlMerge})})),require_binary=require_chunk.t(((exports,module)=>{var Type=require_type(),BASE64_MAP=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`,didReadContent?1+emptyLines:emptyLines),didReadContent=!0,detectedIndent=!0,emptyLines=0,captureStart=state.position;!is_EOL(ch)&&ch!==0;)ch=state.input.charCodeAt(++state.position);captureSegment(state,captureStart,state.position,!1)}return!0}function readBlockSequence(state,nodeIndent){var _line,_tag=state.tag,_anchor=state.anchor,_result=[],following,detected=!1,ch;if(state.firstTabInLine!==-1)return!1;for(state.anchor!==null&&(state.anchorMap[state.anchor]=_result),ch=state.input.charCodeAt(state.position);ch!==0&&(state.firstTabInLine!==-1&&(state.position=state.firstTabInLine,throwError(state,`tab characters must not be used in indentation`)),!(ch!==45||(following=state.input.charCodeAt(state.position+1),!is_WS_OR_EOL(following))));){if(detected=!0,state.position++,skipSeparationSpace(state,!0,-1)&&state.lineIndent<=nodeIndent){_result.push(null),ch=state.input.charCodeAt(state.position);continue}if(_line=state.line,composeNode(state,nodeIndent,CONTEXT_BLOCK_IN,!1,!0),_result.push(state.result),skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position),(state.line===_line||state.lineIndent>nodeIndent)&&ch!==0)throwError(state,`bad indentation of a sequence entry`);else if(state.lineIndent<nodeIndent)break}return detected?(state.tag=_tag,state.anchor=_anchor,state.kind=`sequence`,state.result=_result,!0):!1}function readBlockMapping(state,nodeIndent,flowIndent){var following,allowCompact,_line,_keyLine,_keyLineStart,_keyPos,_tag=state.tag,_anchor=state.anchor,_result={},overridableKeys=Object.create(null),keyTag=null,keyNode=null,valueNode=null,atExplicitKey=!1,detected=!1,ch;if(state.firstTabInLine!==-1)return!1;for(state.anchor!==null&&(state.anchorMap[state.anchor]=_result),ch=state.input.charCodeAt(state.position);ch!==0;){if(!atExplicitKey&&state.firstTabInLine!==-1&&(state.position=state.firstTabInLine,throwError(state,`tab characters must not be used in indentation`)),following=state.input.charCodeAt(state.position+1),_line=state.line,(ch===63||ch===58)&&is_WS_OR_EOL(following))ch===63?(atExplicitKey&&(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),detected=!0,atExplicitKey=!0,allowCompact=!0):atExplicitKey?(atExplicitKey=!1,allowCompact=!0):throwError(state,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),state.position+=1,ch=following;else{if(_keyLine=state.line,_keyLineStart=state.lineStart,_keyPos=state.position,!composeNode(state,flowIndent,CONTEXT_FLOW_OUT,!1,!0))break;if(state.line===_line){for(ch=state.input.charCodeAt(state.position);is_WHITE_SPACE(ch);)ch=state.input.charCodeAt(++state.position);if(ch===58)ch=state.input.charCodeAt(++state.position),is_WS_OR_EOL(ch)||throwError(state,`a whitespace character is expected after the key-value separator within a block mapping`),atExplicitKey&&(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),detected=!0,atExplicitKey=!1,allowCompact=!1,keyTag=state.tag,keyNode=state.result;else if(detected)throwError(state,`can not read an implicit mapping pair; a colon is missed`);else return state.tag=_tag,state.anchor=_anchor,!0}else if(detected)throwError(state,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return state.tag=_tag,state.anchor=_anchor,!0}if((state.line===_line||state.lineIndent>nodeIndent)&&(atExplicitKey&&(_keyLine=state.line,_keyLineStart=state.lineStart,_keyPos=state.position),composeNode(state,nodeIndent,CONTEXT_BLOCK_OUT,!0,allowCompact)&&(atExplicitKey?keyNode=state.result:valueNode=state.result),atExplicitKey||(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,valueNode,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position)),(state.line===_line||state.lineIndent>nodeIndent)&&ch!==0)throwError(state,`bad indentation of a mapping entry`);else if(state.lineIndent<nodeIndent)break}return atExplicitKey&&storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),detected&&(state.tag=_tag,state.anchor=_anchor,state.kind=`mapping`,state.result=_result),detected}function readTagProperty(state){var _position,isVerbatim=!1,isNamed=!1,tagHandle,tagName,ch=state.input.charCodeAt(state.position);if(ch!==33)return!1;if(state.tag!==null&&throwError(state,`duplication of a tag property`),ch=state.input.charCodeAt(++state.position),ch===60?(isVerbatim=!0,ch=state.input.charCodeAt(++state.position)):ch===33?(isNamed=!0,tagHandle=`!!`,ch=state.input.charCodeAt(++state.position)):tagHandle=`!`,_position=state.position,isVerbatim){do ch=state.input.charCodeAt(++state.position);while(ch!==0&&ch!==62);state.position<state.length?(tagName=state.input.slice(_position,state.position),ch=state.input.charCodeAt(++state.position)):throwError(state,`unexpected end of the stream within a verbatim tag`)}else{for(;ch!==0&&!is_WS_OR_EOL(ch);)ch===33&&(isNamed?throwError(state,`tag suffix cannot contain exclamation marks`):(tagHandle=state.input.slice(_position-1,state.position+1),PATTERN_TAG_HANDLE.test(tagHandle)||throwError(state,`named tag handle cannot contain such characters`),isNamed=!0,_position=state.position+1)),ch=state.input.charCodeAt(++state.position);tagName=state.input.slice(_position,state.position),PATTERN_FLOW_INDICATORS.test(tagName)&&throwError(state,`tag suffix cannot contain flow indicator characters`)}tagName&&!PATTERN_TAG_URI.test(tagName)&&throwError(state,`tag name cannot contain such characters: `+tagName);try{tagName=decodeURIComponent(tagName)}catch{throwError(state,`tag name is malformed: `+tagName)}return isVerbatim?state.tag=tagName:_hasOwnProperty.call(state.tagMap,tagHandle)?state.tag=state.tagMap[tagHandle]+tagName:tagHandle===`!`?state.tag=`!`+tagName:tagHandle===`!!`?state.tag=`tag:yaml.org,2002:`+tagName:throwError(state,`undeclared tag handle "`+tagHandle+`"`),!0}function readAnchorProperty(state){var _position,ch=state.input.charCodeAt(state.position);if(ch!==38)return!1;for(state.anchor!==null&&throwError(state,`duplication of an anchor property`),ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch)&&!is_FLOW_INDICATOR(ch);)ch=state.input.charCodeAt(++state.position);return state.position===_position&&throwError(state,`name of an anchor node must contain at least one character`),state.anchor=state.input.slice(_position,state.position),!0}function readAlias(state){var _position,alias,ch=state.input.charCodeAt(state.position);if(ch!==42)return!1;for(ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch)&&!is_FLOW_INDICATOR(ch);)ch=state.input.charCodeAt(++state.position);return state.position===_position&&throwError(state,`name of an alias node must contain at least one character`),alias=state.input.slice(_position,state.position),_hasOwnProperty.call(state.anchorMap,alias)||throwError(state,`unidentified alias "`+alias+`"`),state.result=state.anchorMap[alias],skipSeparationSpace(state,!0,-1),!0}function composeNode(state,parentIndent,nodeContext,allowToSeek,allowCompact){var allowBlockStyles,allowBlockScalars,allowBlockCollections,indentStatus=1,atNewLine=!1,hasContent=!1,typeIndex,typeQuantity,typeList,type,flowIndent,blockIndent;if(state.listener!==null&&state.listener(`open`,state),state.tag=null,state.anchor=null,state.kind=null,state.result=null,allowBlockStyles=allowBlockScalars=allowBlockCollections=CONTEXT_BLOCK_OUT===nodeContext||CONTEXT_BLOCK_IN===nodeContext,allowToSeek&&skipSeparationSpace(state,!0,-1)&&(atNewLine=!0,state.lineIndent>parentIndent?indentStatus=1:state.lineIndent===parentIndent?indentStatus=0:state.lineIndent<parentIndent&&(indentStatus=-1)),indentStatus===1)for(;readTagProperty(state)||readAnchorProperty(state);)skipSeparationSpace(state,!0,-1)?(atNewLine=!0,allowBlockCollections=allowBlockStyles,state.lineIndent>parentIndent?indentStatus=1:state.lineIndent===parentIndent?indentStatus=0:state.lineIndent<parentIndent&&(indentStatus=-1)):allowBlockCollections=!1;if(allowBlockCollections&&=atNewLine||allowCompact,(indentStatus===1||CONTEXT_BLOCK_OUT===nodeContext)&&(flowIndent=CONTEXT_FLOW_IN===nodeContext||CONTEXT_FLOW_OUT===nodeContext?parentIndent:parentIndent+1,blockIndent=state.position-state.lineStart,indentStatus===1?allowBlockCollections&&(readBlockSequence(state,blockIndent)||readBlockMapping(state,blockIndent,flowIndent))||readFlowCollection(state,flowIndent)?hasContent=!0:(allowBlockScalars&&readBlockScalar(state,flowIndent)||readSingleQuotedScalar(state,flowIndent)||readDoubleQuotedScalar(state,flowIndent)?hasContent=!0:readAlias(state)?(hasContent=!0,(state.tag!==null||state.anchor!==null)&&throwError(state,`alias node should not have any properties`)):readPlainScalar(state,flowIndent,CONTEXT_FLOW_IN===nodeContext)&&(hasContent=!0,state.tag===null&&(state.tag=`?`)),state.anchor!==null&&(state.anchorMap[state.anchor]=state.result)):indentStatus===0&&(hasContent=allowBlockCollections&&readBlockSequence(state,blockIndent))),state.tag===null)state.anchor!==null&&(state.anchorMap[state.anchor]=state.result);else if(state.tag===`?`){for(state.result!==null&&state.kind!==`scalar`&&throwError(state,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+state.kind+`"`),typeIndex=0,typeQuantity=state.implicitTypes.length;typeIndex<typeQuantity;typeIndex+=1)if(type=state.implicitTypes[typeIndex],type.resolve(state.result)){state.result=type.construct(state.result),state.tag=type.tag,state.anchor!==null&&(state.anchorMap[state.anchor]=state.result);break}}else if(state.tag!==`!`){if(_hasOwnProperty.call(state.typeMap[state.kind||`fallback`],state.tag))type=state.typeMap[state.kind||`fallback`][state.tag];else for(type=null,typeList=state.typeMap.multi[state.kind||`fallback`],typeIndex=0,typeQuantity=typeList.length;typeIndex<typeQuantity;typeIndex+=1)if(state.tag.slice(0,typeList[typeIndex].tag.length)===typeList[typeIndex].tag){type=typeList[typeIndex];break}type||throwError(state,`unknown tag !<`+state.tag+`>`),state.result!==null&&type.kind!==state.kind&&throwError(state,`unacceptable node kind for !<`+state.tag+`> tag; it should be "`+type.kind+`", not "`+state.kind+`"`),type.resolve(state.result,state.tag)?(state.result=type.construct(state.result,state.tag),state.anchor!==null&&(state.anchorMap[state.anchor]=state.result)):throwError(state,`cannot resolve a node with !<`+state.tag+`> explicit tag`)}return state.listener!==null&&state.listener(`close`,state),state.tag!==null||state.anchor!==null||hasContent}function readDocument(state){var documentStart=state.position,_position,directiveName,directiveArgs,hasDirectives=!1,ch;for(state.version=null,state.checkLineBreaks=state.legacy,state.tagMap=Object.create(null),state.anchorMap=Object.create(null);(ch=state.input.charCodeAt(state.position))!==0&&(skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position),!(state.lineIndent>0||ch!==37));){for(hasDirectives=!0,ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch);)ch=state.input.charCodeAt(++state.position);for(directiveName=state.input.slice(_position,state.position),directiveArgs=[],directiveName.length<1&&throwError(state,`directive name must not be less than one character in length`);ch!==0;){for(;is_WHITE_SPACE(ch);)ch=state.input.charCodeAt(++state.position);if(ch===35){do ch=state.input.charCodeAt(++state.position);while(ch!==0&&!is_EOL(ch));break}if(is_EOL(ch))break;for(_position=state.position;ch!==0&&!is_WS_OR_EOL(ch);)ch=state.input.charCodeAt(++state.position);directiveArgs.push(state.input.slice(_position,state.position))}ch!==0&&readLineBreak(state),_hasOwnProperty.call(directiveHandlers,directiveName)?directiveHandlers[directiveName](state,directiveName,directiveArgs):throwWarning(state,`unknown document directive "`+directiveName+`"`)}if(skipSeparationSpace(state,!0,-1),state.lineIndent===0&&state.input.charCodeAt(state.position)===45&&state.input.charCodeAt(state.position+1)===45&&state.input.charCodeAt(state.position+2)===45?(state.position+=3,skipSeparationSpace(state,!0,-1)):hasDirectives&&throwError(state,`directives end mark is expected`),composeNode(state,state.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(state,!0,-1),state.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart,state.position))&&throwWarning(state,`non-ASCII line breaks are interpreted as content`),state.documents.push(state.result),state.position===state.lineStart&&testDocumentSeparator(state)){state.input.charCodeAt(state.position)===46&&(state.position+=3,skipSeparationSpace(state,!0,-1));return}if(state.position<state.length-1)throwError(state,`end of the stream or a document separator is expected`);else return}function loadDocuments(input,options){input=String(input),options||={},input.length!==0&&(input.charCodeAt(input.length-1)!==10&&input.charCodeAt(input.length-1)!==13&&(input+=`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`)&&(common.EOL=eol)},version,rt:{parse:function(text,options){return(options||={}).keepWsc=!0,parse(text,options)},stringify:function(value,options){return(options||={}).keepWsc=!0,stringify(value,options)}},comments:require_hjson_comments(),dsf:require_hjson_dsf().std}})),require_cjs=require_chunk.t(((exports,module)=>{var isMergeableObject=function(value){return isNonNullObject(value)&&!isSpecial(value)};function isNonNullObject(value){return!!value&&typeof value==`object`}function isSpecial(value){var stringValue=Object.prototype.toString.call(value);return stringValue===`[object RegExp]`||stringValue===`[object Date]`||isReactElement(value)}var REACT_ELEMENT_TYPE=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function isReactElement(value){return value.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(val){return Array.isArray(val)?[]:{}}function cloneUnlessOtherwiseSpecified(value,options){return options.clone!==!1&&options.isMergeableObject(value)?deepmerge(emptyTarget(value),value,options):value}function defaultArrayMerge(target,source,options){return target.concat(source).map(function(element){return cloneUnlessOtherwiseSpecified(element,options)})}function getMergeFunction(key,options){if(!options.customMerge)return deepmerge;var customMerge=options.customMerge(key);return typeof customMerge==`function`?customMerge:deepmerge}function getEnumerableOwnPropertySymbols(target){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(target).filter(function(symbol){return Object.propertyIsEnumerable.call(target,symbol)}):[]}function getKeys(target){return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))}function propertyIsOnObject(object,property){try{return property in object}catch{return!1}}function propertyIsUnsafe(target,key){return propertyIsOnObject(target,key)&&!(Object.hasOwnProperty.call(target,key)&&Object.propertyIsEnumerable.call(target,key))}function mergeObject(target,source,options){var destination={};return options.isMergeableObject(target)&&getKeys(target).forEach(function(key){destination[key]=cloneUnlessOtherwiseSpecified(target[key],options)}),getKeys(source).forEach(function(key){propertyIsUnsafe(target,key)||(propertyIsOnObject(target,key)&&options.isMergeableObject(source[key])?destination[key]=getMergeFunction(key,options)(target[key],source[key],options):destination[key]=cloneUnlessOtherwiseSpecified(source[key],options))}),destination}function deepmerge(target,source,options){options||={},options.arrayMerge=options.arrayMerge||defaultArrayMerge,options.isMergeableObject=options.isMergeableObject||isMergeableObject,options.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var sourceIsArray=Array.isArray(source);return sourceIsArray===Array.isArray(target)?sourceIsArray?options.arrayMerge(target,source,options):mergeObject(target,source,options):cloneUnlessOtherwiseSpecified(source,options)}deepmerge.all=function(array,options){if(!Array.isArray(array))throw Error(`first argument should be an array`);return array.reduce(function(prev,next){return deepmerge(prev,next,options)},{})},module.exports=deepmerge})),require_util=require_chunk.t(((exports,module)=>{let fs$2=require(`fs`),path$4=require(`path`),yaml=require_js_yaml(),hjson=require_hjson(),deepmerge=require_cjs(),mkdirp=dir=>{dir||=``;let parts=path$4.resolve(dir).split(path$4.sep);for(let i=1;i<parts.length;i++){let segment=path$4.join(parts.slice(0,i+1).join(path$4.sep)+path$4.sep);fs$2.existsSync(segment)||fs$2.mkdirSync(segment)}},getProp=(obj,key)=>obj[Object.keys(obj).find(k=>k.toLowerCase()===key.toLowerCase())],getValue=(obj,key)=>(key||``).toString().split(`.`).filter(o=>o.trim()).reduce((o,i)=>o&&getProp(o,i),obj),setValue=(key,value,obj)=>{let parts=(key||``).split(`.`).filter(o=>o.trim());if(parts.length===0)return value;let result={...obj},node=result;for(;parts.length>1;){let k=parts.shift();node[k]=typeof node[k]==`object`?{...node[k]}:{},node=node[k]}return node[parts.shift()]=value,result},merge=(...objs)=>{let overwriteMerge=(destinationArray,sourceArray)=>sourceArray,objArray=[...objs].filter(Boolean);return deepmerge.all(objArray,{arrayMerge:overwriteMerge})},shake=obj=>{let shakeObject=o=>{for(let prop in o)o[prop]&&o[prop].constructor===Object?(o[prop]=shakeObject(o[prop]),Object.keys(o[prop]).length===0&&delete o[prop]):o[prop]??delete o[prop];return o};return shakeObject(obj)};module.exports={mkdirp,getValue,setValue,merge,loadFile:file=>{let contents=fs$2.readFileSync(file,`utf-8`).trim();if(contents)if(contents[0]===`{`)try{return{values:hjson.parse(contents),format:`json`}}catch{throw Error(`Cannot parse json`)}else try{return{values:yaml.load(contents,{json:!0}),format:`yaml`}}catch{throw Error(`Cannot parse yaml`)}return{values:{},format:`json`}},saveFile:(file,obj,format)=>{obj||={},mkdirp(path$4.dirname(file)),obj=shake(obj);let str;return str=Object.keys(obj).length===0?``:format===`json`?hjson.stringify(obj,{condense:!0,emitRootBraces:!0,separator:!0,bracesSameLine:!0,multiline:`off`}):yaml.dump(obj,{sortKeys:!0,lineWidth:1024,noCompatMode:!0}),fs$2.writeFileSync(file,str),!0}}})),require_Config=require_chunk.t(((exports,module)=>{let path$3=require(`path`),os$1=require(`os`),dotenv=require_dotenv(),debug=require_src$1()(`aio-cli-config`),{merge,loadFile,saveFile,getValue,setValue}=require_util(),readFile=file=>{debug(`reading config: ${file}`);try{return loadFile(file)}catch(ex){ex.code!==`ENOENT`&&debug(ex.toString())}return{format:`json`}};module.exports=class{reload(){dotenv(!0);let configRootKey=process.env.AIO_CONFIG_KEY||`aio`,configBasePath=process.env.XDG_CONFIG_HOME||path$3.join(os$1.homedir(),`.config`);this.global={file:process.env.AIO_CONFIG_FILE||path$3.join(configBasePath,configRootKey)},this.local={file:path$3.join(process.cwd(),`.${configRootKey}`)},this.global={...this.global,...readFile(this.global.file)},this.local={...this.local,...readFile(this.local.file)},this.envs={};let envKeys=[];for(let key in process.env){let dynamicKey=RegExp(`^${configRootKey.toUpperCase()}_(.+)`,`i`),match=key.match(dynamicKey);if(match){let newKey=match[1].toLowerCase().split(/(?<!_)_(?!_)/).join(`.`).replace(/__/gi,`_`);envKeys.push(newKey),this.envs=setValue(newKey,process.env[key],this.envs)}}return envKeys.length>0&&debug(`reading env variables: ${envKeys.join(`, `)}`),this.values=merge(this.global.values,this.local.values,this.envs),this}get(key=``,source){this.values||this.reload();let vals=this.values;source===`global`?vals=this.global.values:source===`local`?vals=this.local.values:source===`env`&&(vals=this.envs);let value=getValue(vals,key);return value==null?value:JSON.parse(JSON.stringify(value))}set(key,value,local=!1){this.values||this.reload();let config$1=local?this.local:this.global,obj=setValue(key,value,config$1.values);return debug(`writing config: ${key||`<all>`} at ${config$1.file}`),saveFile(config$1.file,obj,config$1.format),this.reload()}}})),require_pipe=require_chunk.t(((exports,module)=>{let status=Symbol.for(`aio-cli-config.pipe`);module.exports=()=>new Promise(resolve=>{if(global[status]||process.stdin.isTTY)return resolve(global[status]);let data=[];process.stdin.on(`data`,line=>data.push(line.toString())),process.stdin.once(`end`,()=>{let result=data.join(``);global[status]=result,resolve(result)})})})),require_src=require_chunk.t(((exports,module)=>{let Config=require_Config(),pipe=require_pipe(),dotenv=require_dotenv(),config=new Config;module.exports=new class{get(key,source){return config.get(key,source)}set(key,value,local){return config.set(key,value,local)&&this}delete(key,local){return config.set(key,null,local)&&this}reload(){return config.reload()&&this}get getPipedData(){return pipe}get dotenv(){return dotenv}}})),require_package=require_chunk.t(((exports,module)=>{module.exports={name:`dotenv`,version:`17.3.1`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,pretest:`npm run lint && npm run dts-check`,test:`tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000`,"test:coverage":`tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},homepage:`https://github.com/motdotla/dotenv#readme`,funding:`https://dotenvx.com`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@types/node":`^18.11.3`,decache:`^4.6.2`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-version":`^9.5.0`,tap:`^19.2.0`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),require_main=require_chunk.t(((exports,module)=>{let fs$1=require(`fs`),path$2=require(`path`),os=require(`os`),crypto=require(`crypto`),version=require_package().version,TIPS=[`🔐 encrypt with Dotenvx: https://dotenvx.com`,`🔐 prevent committing .env to code: https://dotenvx.com/precommit`,`🔐 prevent building .env in docker: https://dotenvx.com/prebuild`,`🤖 agentic secret storage: https://dotenvx.com/as2`,`⚡️ secrets for agents: https://dotenvx.com/as2`,`🛡️ auth for agents: https://vestauth.com`,"🛠️ run anywhere with `dotenvx run -- yourcommand`",`⚙️ specify custom .env file path with { path: '/custom/path/.env' }`,`⚙️ enable debug logging with { debug: true }`,`⚙️ override existing env vars with { override: true }`,`⚙️ suppress all logs with { quiet: true }`,`⚙️ write to custom object with { processEnv: myObject }`,`⚙️ load multiple .env files with { path: ['.env.local', '.env'] }`];function _getRandomTip(){return TIPS[Math.floor(Math.random()*TIPS.length)]}function parseBoolean(value){return typeof value==`string`?![`false`,`0`,`no`,`off`,``].includes(value.toLowerCase()):!!value}function supportsAnsi(){return process.stdout.isTTY}function dim(text){return supportsAnsi()?`\x1b[2m${text}\x1b[0m`:text}let LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(src){let obj={},lines=src.toString();lines=lines.replace(/\r\n?/gm,`
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
16
|
+
//#region ../../packages-private/scripting-utils/source/error.ts
|
|
17
|
+
/**
|
|
18
|
+
* This module exports shared error utilities for the AIO Commerce SDK.
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Stringify an error to a human-friendly string.
|
|
23
|
+
* @param error - The error to stringify.
|
|
24
|
+
*/
|
|
25
|
+
function stringifyError(error) {
|
|
26
|
+
if (error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError) return error.display();
|
|
27
|
+
return error instanceof Error ? error.message : String(error);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../../packages-private/scripting-utils/source/env.ts
|
|
32
|
+
/**
|
|
33
|
+
* This module exports shared environment utilities for the AIO Commerce SDK.
|
|
34
|
+
* @packageDocumentation
|
|
35
|
+
*/
|
|
36
|
+
const { context } = _adobe_aio_lib_ims.default;
|
|
37
|
+
const IMS_KEYS = {
|
|
38
|
+
client_id: "AIO_COMMERCE_AUTH_IMS_CLIENT_ID",
|
|
39
|
+
client_secrets: "AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS",
|
|
40
|
+
technical_account_email: "AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL",
|
|
41
|
+
technical_account_id: "AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID",
|
|
42
|
+
scopes: "AIO_COMMERCE_AUTH_IMS_SCOPES",
|
|
43
|
+
ims_org_id: "AIO_COMMERCE_AUTH_IMS_ORG_ID"
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Replaces or creates an environment variable in a .env file
|
|
47
|
+
* @param filePath - The path to the .env file
|
|
48
|
+
* @param key - The environment variable key to replace or create
|
|
49
|
+
* @param value - The new value for the environment variable
|
|
50
|
+
*/
|
|
51
|
+
function replaceEnvVar(filePath, key, value) {
|
|
52
|
+
const envPath = path.default.resolve(filePath);
|
|
53
|
+
const envLines = (0, fs.readFileSync)(envPath, "utf8").split("\n");
|
|
54
|
+
const formattedValue = value.includes(" ") ? `"${value}"` : value;
|
|
55
|
+
let keyExists = false;
|
|
56
|
+
const updatedLines = envLines.map((line) => {
|
|
57
|
+
if (line.trim().startsWith("#") || !line.includes("=")) return line;
|
|
58
|
+
const [currentKey] = line.split("=");
|
|
59
|
+
if (currentKey === key) {
|
|
60
|
+
keyExists = true;
|
|
61
|
+
return `${key}=${formattedValue}`;
|
|
62
|
+
}
|
|
63
|
+
return line;
|
|
64
|
+
});
|
|
65
|
+
if (!keyExists) updatedLines.push(`${key}=${formattedValue}`);
|
|
66
|
+
(0, fs.writeFileSync)(envPath, updatedLines.join("\n"), "utf8");
|
|
67
|
+
}
|
|
68
|
+
/** Returns the path to the .env file. */
|
|
69
|
+
function resolveEnvPath() {
|
|
70
|
+
const envPath = process.env.INIT_CWD ? `${process.env.INIT_CWD}/.env` : ".env";
|
|
71
|
+
return path.default.resolve(envPath);
|
|
72
|
+
}
|
|
73
|
+
/** Resolves the IMS server to server context from the project workspace credentials. */
|
|
74
|
+
function resolveImsS2SContext() {
|
|
75
|
+
const [credential] = (_adobe_aio_lib_core_config.default.get("project.workspace.details.credentials") ?? []).filter(({ integration_type }) => integration_type === "oauth_server_to_server").map(({ name }) => name) ?? [];
|
|
76
|
+
if (!credential) return Promise.resolve(null);
|
|
77
|
+
return context.get(credential);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Syncs the IMS credentials environment variables from the configured IMS context in
|
|
81
|
+
* the .env file, in a way that is compatible with `@adobe/aio-commerce-lib-auth`
|
|
82
|
+
*/
|
|
83
|
+
async function syncImsCredentials() {
|
|
84
|
+
const envPath = resolveEnvPath();
|
|
85
|
+
const envVars = dotenv.default.parse((0, fs.readFileSync)(envPath, "utf8"));
|
|
86
|
+
const imsContext = await resolveImsS2SContext();
|
|
87
|
+
if (!imsContext) return;
|
|
88
|
+
const { data } = imsContext;
|
|
89
|
+
for (const [key, value] of Object.entries(data)) {
|
|
90
|
+
const oauthKey = IMS_KEYS[key];
|
|
91
|
+
if (!oauthKey) continue;
|
|
92
|
+
if (!envVars[oauthKey] || envVars[oauthKey] !== value) replaceEnvVar(envPath, oauthKey, value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region source/commands/sync-ims-credentials.ts
|
|
98
|
+
/** Synchronizes the current context IMS credentials to their AIO_COMMERCE_IMS_AUTH counterparts. */
|
|
99
|
+
async function run() {
|
|
100
|
+
consola.default.start("Syncing IMS credentials...");
|
|
101
|
+
try {
|
|
102
|
+
await syncImsCredentials();
|
|
103
|
+
consola.default.success("IMS credentials successfully synced to their AIO_COMMERCE_IMS_AUTH counterparts!");
|
|
104
|
+
} catch (error) {
|
|
105
|
+
consola.default.error(stringifyError(error));
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region source/commands/index.ts
|
|
112
|
+
const NAMESPACE = "@adobe/aio-commerce-lib-auth";
|
|
113
|
+
const [command, subcommand] = process.argv.slice(2);
|
|
114
|
+
const USAGE = `
|
|
86
115
|
Usage: ${NAMESPACE} <command> [target]
|
|
87
116
|
|
|
88
117
|
Commands:
|
|
@@ -92,4 +121,53 @@ Commands:
|
|
|
92
121
|
|
|
93
122
|
Examples:
|
|
94
123
|
${NAMESPACE} sync-ims-credentials
|
|
95
|
-
|
|
124
|
+
`;
|
|
125
|
+
/** Command handlers registry mapping command names to their subcommand handlers */
|
|
126
|
+
const COMMANDS = { "sync-ims-credentials": run };
|
|
127
|
+
/**
|
|
128
|
+
* Generic command handler that dispatches to specific command implementations
|
|
129
|
+
* @param commandName - The name of the command (for error messages)
|
|
130
|
+
* @param target - The target subcommand to execute
|
|
131
|
+
* @param handlers - Map of target names to handler functions
|
|
132
|
+
*/
|
|
133
|
+
async function handleCommand(commandName, target, handlers) {
|
|
134
|
+
if (!target) {
|
|
135
|
+
const availableTargets = Object.keys(handlers).join(", ");
|
|
136
|
+
consola.default.error(`No ${commandName} target specified`);
|
|
137
|
+
consola.default.info(`Available targets: ${availableTargets}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
const handler = handlers[target];
|
|
141
|
+
if (!handler) {
|
|
142
|
+
const availableTargets = Object.keys(handlers).join(", ");
|
|
143
|
+
consola.default.error(`Unknown ${commandName} target: ${target}`);
|
|
144
|
+
consola.default.info(`Available targets: ${availableTargets}`);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
await handler();
|
|
148
|
+
}
|
|
149
|
+
async function main() {
|
|
150
|
+
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
151
|
+
consola.default.log.raw(USAGE);
|
|
152
|
+
process.exit(0);
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const handlers = COMMANDS[command];
|
|
156
|
+
if (!handlers) {
|
|
157
|
+
consola.default.error(`Unknown command: ${command}`);
|
|
158
|
+
consola.default.log.raw(USAGE);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
if (typeof handlers === "function") {
|
|
162
|
+
await handlers();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
await handleCommand(command, subcommand, handlers);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
consola.default.error(stringifyError(error));
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
main();
|
|
172
|
+
|
|
173
|
+
//#endregion
|