@ibm/zapp-core 1.2.3 → 1.3.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/lib/index.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export abstract class SchemaDocumentCache {
|
|
|
126
126
|
protected normalizePath(inputPath: string): string;
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
|
-
* JSON schema for zapp.json and zapp.yaml files. Version 1.
|
|
129
|
+
* JSON schema for zapp.json and zapp.yaml files. Version 1.3.0 -- Licensed Materials - Property of IBM - (c) Copyright IBM Corporation 2022, 2024. All Rights Reserved.
|
|
130
130
|
*/
|
|
131
131
|
export type IBMZappDocument = CoreProperties;
|
|
132
132
|
/**
|
|
@@ -144,7 +144,7 @@ export type Person = {
|
|
|
144
144
|
export type Profile = {
|
|
145
145
|
name: string;
|
|
146
146
|
type: 'dbb';
|
|
147
|
-
settings:
|
|
147
|
+
settings: DbbBuilderSettings | DbbGroovySettings;
|
|
148
148
|
} | {
|
|
149
149
|
name: string;
|
|
150
150
|
type: 'rseapi';
|
|
@@ -247,12 +247,37 @@ export interface LibraryItem {
|
|
|
247
247
|
/**
|
|
248
248
|
* An array of include file locations. For 'local' libraries values can be absolute and relative filename paths using GLOB patterns. For 'mvs' libraries value can be data set names. GLOB patterns for data sets are currently not supported.
|
|
249
249
|
*/
|
|
250
|
-
locations
|
|
250
|
+
locations?: string[];
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
253
|
-
*
|
|
253
|
+
* zBuilder user build properties for running user build on remote host.
|
|
254
254
|
*/
|
|
255
|
-
export interface
|
|
255
|
+
export interface DbbBuilderSettings {
|
|
256
|
+
/**
|
|
257
|
+
* Command that the build script is executed with such as the path to groovyz and it's parameters.
|
|
258
|
+
*/
|
|
259
|
+
command: string;
|
|
260
|
+
/**
|
|
261
|
+
* Defines named build lifecycles that represent different build scenarios the customer needs to perform and can be executed from the DBB CLI.
|
|
262
|
+
*/
|
|
263
|
+
lifecycle: string;
|
|
264
|
+
/**
|
|
265
|
+
* Additional arguments and options for the lifecycle.
|
|
266
|
+
*/
|
|
267
|
+
lifecycleArgs: string[];
|
|
268
|
+
/**
|
|
269
|
+
* Lists of GLOB patterns that define the files that should be uploaded to USS for a build. Relative path names are interpreted relative to the location of the ZAPP file that is being used for the build, which is a ZAPP file in the same workspace as the program to be build.
|
|
270
|
+
*/
|
|
271
|
+
additionalDependencies?: string[];
|
|
272
|
+
/**
|
|
273
|
+
* Lists of GLOB patterns that define the files that should be downloaded from USS after the build. Relative path names are interpreted relative to the DBB log directory user setting. If not provided then all files of the user setting location will be downloaded.
|
|
274
|
+
*/
|
|
275
|
+
logFilePatterns?: string[];
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Groovyz user build script properties for running user build on remote host.
|
|
279
|
+
*/
|
|
280
|
+
export interface DbbGroovySettings {
|
|
256
281
|
/**
|
|
257
282
|
* Defines the name of the application to build. Will be used to create a folder on USS to upload all files to.
|
|
258
283
|
*/
|
|
@@ -688,7 +713,7 @@ export class UserBuildController extends ZappProfilesController {
|
|
|
688
713
|
* DbbSettingsItem object of the profile that matches the profileName
|
|
689
714
|
* or if omitted the first one found. Undefined if not available.
|
|
690
715
|
*/
|
|
691
|
-
static getUserBuildSettings(workspacePath: string, profileName?: string):
|
|
716
|
+
static getUserBuildSettings(workspacePath: string, profileName?: string): DbbBuilderSettings | DbbGroovySettings | undefined;
|
|
692
717
|
}
|
|
693
718
|
/**
|
|
694
719
|
* A collection of business logic for accessing, manipulating, validating
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var e=require("fs"),t=require("yawn-yaml/cjs"),i=require("path"),s=require("os"),r=require("js-yaml"),a=require("ajv"),n=require("ajv-formats");function o(e,t){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e}function p(e){return e&&e.__esModule?e.default:e}function l(e,t,i,s){Object.defineProperty(e,t,{get:i,set:s,enumerable:!0,configurable:!0})}var c={},d={},h={};l(h,"SchemaDocumentInstance",()=>u);class u{constructor(e,i){this.isValid=!1,i&&this.prependErrorMessage(i);try{this.yawn=new(p(t))(e),this.validate()}catch(e){this.prependErrorMessage(e?.message)}}getAsYaml(){return this.yawn?.yaml}getAsJson(){return JSON.stringify(this.yawn?.json)}getAsObject(){return this.yawn?.json}static async readFileWithRetry(t){let i="";for(let s=0;s<10&&!(i=await e.promises.readFile(t,"utf8"));s++)await new Promise(e=>setTimeout(e,100));return i}write(){if(!this.isValid){this.appendErrorMessage(`Tried to write invalid document "${this.file?.path}"`);return}if(this.file?.path){let t="# Undefined "+this.type+" document.";"json"===this.file.type&&(t=JSON.stringify(this.getAsObject())),"yaml"===this.file.type&&(t=this.getAsYaml()||t),e.writeFileSync(this.file.path,t,{encoding:"utf-8"})}}writeToFile(e){this.file=e,this.write()}appendErrorMessage(e){let t=this.errorMessages?`${this.errorMessages}
|
|
2
2
|
`:"";this.errorMessages=`${t}- ${e||"Unknown Error reading "+this.type+" file."}`}prependErrorMessage(e){let t=this.errorMessages?`
|
|
3
|
-
${this.errorMessages}`:"";this.errorMessages=`- ${e||"Unknown Error reading "+this.type+" file."}${t}`}}var m={};l(m,"SchemaDocumentCache",()=>f);class f{constructor(e){this.type=e,this.documentsCache=new Map,this.workspacesMap=new Map,this.numberDocsAdded=0,this.numberDocsRemoved=0,this.numberDocsFound=0}addDocument(e,t,i){let s=this.normalizePath(e),r=this.normalizePath(t);this.documentsCache.set(s,i),this.workspacesMap.set(r,s)}removeDocument(e){let t=this.normalizePath(e);this.workspacesMap.forEach((e,i)=>{e===t&&this.workspacesMap.delete(i)});let i=this.documentsCache.delete(t);return i&&this.numberDocsRemoved++,i}getCacheSize(){return this.documentsCache.size}getAllDocumentLocations(){return[...this.documentsCache.keys()]}clearSchemaDocument(e){if(!e)return;let t=this.normalizePath(e),s=i.dirname(t);this.workspacesMap.has(s)&&this.workspacesMap.delete(s),this.documentsCache.has(t)&&(this.documentsCache.delete(t),this.numberDocsRemoved++)}clearCache(){this.workspacesMap.clear(),this.documentsCache.clear()}getCacheStats(){return{documentsCacheSize:this.documentsCache.size,workspacesMapSize:this.workspacesMap.size,numberDocsAdded:this.numberDocsAdded,numberDocsRemoved:this.numberDocsRemoved,numberDocsFound:this.numberDocsFound}}normalizePath(e){if(!e)return e;let t=i.normalize(e);if("win32"===s.platform()){let e=i.basename(t);if(this.isValidFilename(e)){let s=i.dirname(t);t=i.join(s.toUpperCase(),e)}else t=t.toUpperCase()}return t}}o(d,h),o(d,m),o(c,d);var g={},y={},b={};l(b,"PropertyGroupsController",()=>j);var P={};l(P,"ZappDocumentsCache",()=>I);var w={};l(w,"ZappDocumentInstance",()=>v);var S={};S=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","title":"IBM Zapp Document","description":"JSON schema for zapp.json and zapp.yaml files. Version 1.2.1 -- Licensed Materials - Property of IBM - (c) Copyright IBM Corporation 2022, 2024. All Rights Reserved.","type":"object","definitions":{"coreProperties":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"description":"The name of the Z Project.","type":"string","maxLength":214,"minLength":1},"description":{"description":"This helps people understand your project as it would be used by tools.","type":"string"},"version":{"description":"Version is a string and it must be parsable for managing dependencies.","type":"string","default":"1.0.0"},"groupId":{"description":"Defines a group name that is shared for each application part in case of applications composed of multiple parts. Allows to uniquely identify the parts by concatenating with the artifact id. For example a groupId `com.ibm.wazi` with an artifactId `service` would create the unique application identifier `com.ibm.wazi.service`.","type":"string","examples":["com.ibm.wazi","payments"]},"artifactId":{"description":"Define id of the application artifact. Use it in combination with a groupId for multi-part applications.","type":"string","default":"","examples":["sam"]},"parentId":{"description":"In case of a multi-part application defines the name of the parent application part. This zapp will inherit properties such as propertyGroups defined in the parent.","type":"string","default":"","examples":["com.ibm.wazi.parent"]},"keywords":{"description":"This helps people discover your project.","type":"array","items":{"type":"string"}},"homepage":{"description":"The url to the project homepage.","type":"string","oneOf":[{"format":"uri"},{"enum":["."]}]},"license":{"type":"string","description":"You should specify a license for your package so that people know how they are permitted to use it and any restrictions you\'re placing on it."},"author":{"$ref":"#/definitions/person"},"contributors":{"description":"A list of people who contributed to this package.","type":"array","items":{"$ref":"#/definitions/person"},"minItems":1},"maintainers":{"description":"A list of people who maintain this package.","type":"array","items":{"$ref":"#/definitions/person"},"minItems":1},"propertyGroups":{"description":"A list of properties defining path names for resolving dependencies.","type":"array","items":{"$ref":"#/definitions/propertyGroupItem"},"minItems":1},"profiles":{"description":"Profiles are additional groups of properties that should only become valid under specific conditions such as running in a build job or as part of a debug session.","type":"array","items":{"$ref":"#/definitions/profile"},"minItems":1}}},"propertyGroupItem":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","description":"The name of the property group, which is used in hovers and error messages.","examples":["sample-local","sample-remote"]},"language":{"type":"string","enum":["cobol","pl1","hlasm","rexx","jcl"],"description":"Limits the property group to one specific language."},"compilerOptions":{"type":"string","description":"Global compiler options separated by a comma that impact the parsing of the programs for the editor. Requires that you specify a language. If there are multiple Property Groups for a language with compiler option then they will be concatenated."},"libraries":{"type":"array","description":"An array of potential library locations defining the search order for include files. Libraries with the name \'syslib\' will be handled as default include locations. The list can contain many entries of the type \'local\' or \'mvs\'. It can contain items of the same type twice in case, for example, you want to search in remote locations first, then some local location, and if still not found more remote locations.","items":{"$ref":"#/definitions/libraryItem"},"minItems":1}}},"libraryItem":{"type":"object","additionalProperties":false,"required":["name","type","locations"],"properties":{"name":{"type":"string","description":"Name of the library. The default name should be `syslib` if using unnamed libraries.","default":"syslib","examples":["syslib","maclib","currencylib"]},"type":{"type":"string","enum":["mvs","local"],"description":"The type of the property group defining where dependencies should be located. Allowed values are \'local\' for using a local workspace and \'mvs\' for dependencies located in MVS Datasets.","default":"local","examples":["local","mvs"]},"locations":{"type":"array","description":"An array of include file locations. For \'local\' libraries values can be absolute and relative filename paths using GLOB patterns. For \'mvs\' libraries value can be data set names. GLOB patterns for data sets are currently not supported.","items":{"type":"string"},"minItems":1,"examples":["**/copybook","USER1.SAMPLE.COBCOPY"]}}},"person":{"description":"A person who has been involved in creating or maintaining this package","type":["object","string"],"required":["name"],"properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"},"email":{"type":"string","format":"email"}}},"profile":{"type":"object","description":"Profiles are additional groups of properties that should only become valid under specific conditions such as running in a build job or as part of a debug session.","additionalProperties":false,"required":["name","type"],"properties":{"name":{"type":"string","description":"The name of the profile.","examples":["dbb-build"]},"language":{"type":"string","enum":["cobol","pl1"],"description":"If the profile type supports it then it defines a scope for the profile to one specific programming language. For example, a profile that defines preprocessor commands for COBOL."},"type":{"type":"string","enum":["dbb","rseapi","debug","preprocessor","test"],"description":"The type of the profile.","default":"dbb"},"location":{"type":"string","enum":["mvs","local"],"description":"If the profile type supports it then it defines a scope for the profile to a specific location for resources. For example, a profile that defines preprocessor commands to be executed on MVS or local files.","default":"local"},"settings":{"description":"Settings objects specific to the type specified for the profile.","type":"object"}},"oneOf":[{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"dbb","type":"string"},"settings":{"$ref":"#/definitions/dbbSettingsItem"}}},{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"rseapi","type":"string"},"settings":{"$ref":"#/definitions/rseapiSettingsItem"}}},{"required":["name","type","settings","location","language"],"additionalProperties":false,"properties":{"name":{"type":"string"},"language":{"type":"string"},"type":{"const":"preprocessor","type":"string"},"location":{"type":"string"},"settings":{"oneOf":[{"$ref":"#/definitions/localPreprocessorSettingsItem"},{"$ref":"#/definitions/mvsPreprocessorSettingsItem"}]}},"if":{"properties":{"location":{"const":"local","type":"string"}}},"then":{"properties":{"settings":{"$ref":"#/definitions/localPreprocessorSettingsItem"}}},"else":{"properties":{"settings":{"$ref":"#/definitions/mvsPreprocessorSettingsItem"}}}},{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"test","type":"string"},"settings":{"$ref":"#/definitions/testSettingsItem"}}}]},"dbbSettingsItem":{"type":"object","additionalProperties":false,"required":["application","command"],"description":"DBB build script properties for running User Build on remote host.","properties":{"application":{"type":"string","description":"Defines the name of the application to build. Will be used to create a folder on USS to upload all files to."},"command":{"type":"string","description":"Command that the build script is executed with such as the path to groovyz and it\'s parameters."},"buildScriptPath":{"type":"string","description":"The full path of build script on the remote host that should be used with the command."},"buildScriptArgs":{"type":"array","items":{"type":"string"},"description":"A list of strings that are the parameters for the build script. Check the documentation for built-in variables, such as the name of the program to build, that can be used here."},"additionalDependencies":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be uploaded to USS for a build. Relative path names are interpreted relative to the location of the ZAPP file that is being used for the build, which is a ZAPP file in the same workspace as the program to be build."},"logFilePatterns":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be downloaded from USS after the build. Relative path names are interpreted relative to the DBB log directory user setting. If not provided then all files of the user setting location will be downloaded."}}},"rseapiSettingsItem":{"type":"object","additionalProperties":false,"description":"RSE API client settings for interactions with a z/OS remote host running an RSE API server.","required":["mappings","default.encoding"],"properties":{"mappings":{"type":"array","description":"A list of mapping objects that map local file extensions to transfer modes and encodings to MVS datasets that can be specified using wildcards.","items":{"$ref":"#/definitions/rseapiSettingsItemMapping"}},"default.encoding":{"type":"string","description":"The encoding to be used when no mapping can be found. If not provided then either the user or server default will be used."}}},"rseapiSettingsItemMapping":{"type":"object","additionalProperties":false,"description":"One mapping that contains at least transfer and resource values.","properties":{"extension":{"type":"string","description":"A local file extension such as cbl or pl1."},"transfer":{"type":"string","enum":["text","binary"],"description":"The transfer mode to be used. Can be \'text\' or \'binary\'."},"resource":{"type":"string","description":"The data set name to be mapped to. Can use a wildcard such as \'**CPY\'."},"encoding":{"type":"string","description":"The encoding to be used for text transfer. See the RSE API documentation for the values allowed."},"memberMappings":{"type":"array","items":{"type":"object","additionalProperties":false,"description":"One member mapping that contains at least transfer and resource values.","properties":{"extension":{"type":"string","description":"A local file extension such as cbl or pl1."},"transfer":{"type":"string","enum":["text","binary"],"description":"The transfer mode to be used. Can be \'text\' or \'binary\'."},"encoding":{"type":"string","description":"The encoding to be used for text transfer. See the RSE API documentation for the values allowed."},"resource":{"type":"string","description":"The data set member name to be mapped to. Can use a wildcard such as \'**CPY\'."}}},"description":"A nested mappings array with resource mappings to members of the data sets that were mapped by the parent mapping."}}},"localPreprocessorSettingsItem":{"type":"object","additionalProperties":false,"description":"Preprocessor properties for preprocessing COBOL/PL/I files.","required":["command","outputPath","fileExtension"],"properties":{"command":{"type":"string","description":"The command to run to execute the preprocessor executable."},"outputPath":{"type":"string","description":"Path where preprocessor produces its build output."},"fileExtension":{"type":"string","description":"The desired file extension for the post-processed file."},"environmentVariables":{"type":"object","additionalProperties":false,"description":"Specifies any user defined environment variables to be passed to the preprocessor.","patternProperties":{"[a-zA-Z_][a-zA-Z0-9_]*":{"anyOf":[{"type":"string"}]}}}}},"mvsPreprocessorSettingsItem":{"type":"object","additionalProperties":false,"description":"Preprocessor properties for preprocessing COBOL/PL/I files.","required":["commandDataSet","outputDataSet","tempDataHLQ"],"properties":{"commandDataSet":{"type":"string","description":"Specifies an input listing sequential data set."},"commandParameters":{"type":"string","description":"The parameters for the command being run."},"outputDataSet":{"type":"string","description":"Specifies an output listing sequential data set."},"tempDataHLQ":{"type":"string","description":"Specifies the high-level qualifier used for data sets created by plug-in requests to export observation files."}}},"testSettingsItem":{"type":"object","additionalProperties":false,"description":"Test properties for a test case.","required":["unitTest"],"properties":{"unitTest":{"type":"object","additionalProperties":false,"description":"Properties to run a unit test case.","required":["procLib"],"properties":{"procLib":{"type":"array","description":"Specifies the list of Procedure libraries.","items":{"type":"string"}},"allocateWorkingDs":{"type":"boolean","description":" If this option is selected, the data set for the working file is allocated automatically with the allocation options."},"ioDataSetAllocation":{"type":"object","description":"Options to allocate a working file.","properties":{"ioSpaceUnit":{"type":"string","enum":["TRACKS","BLOCKS","CYLINDERS"],"description":"The unit of primary and secondary space to be allocated."},"ioQuant1":{"type":"integer","description":"The amount of DASD space to be used for primary space allocation (PRIMARY)."},"ioQuant2":{"type":"integer","description":"The amount of DASD space to be used for secondary space allocation (SECONDARY)."},"ioHLQ":{"type":"string","description":"The high-level qualifier for the VSAM or QSAM data files for file I/O simulation. These files are allocated when running a Unit test case."}}},"configDS":{"type":"string","description":"Runner configuration destination container."},"resultDS":{"type":"string","description":"Runner result destination container."},"userLibraries":{"type":"array","description":"The datat set of the application under test","items":{"type":"string"}},"defaultTestCaseFolder":{"type":"string","description":"The default local folder to create the test case artifacts."},"jobcard":{"type":"string","description":"The job card to run a unit test"}}}}}},"anyOf":[{"$ref":"#/definitions/coreProperties"}]}');class v extends u{static #e=this.validationFunction=v.initAjvValidator();static initAjvValidator(){let e=new(p(a))({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});return p(n)(e),e.compile(S)}static createFromYamlString(e){return new v(e)}static createFromJsonString(e){let t="";try{let i=JSON.parse(e);return t=r.dump(i),this.createFromYamlString(t)}catch(e){return new v(t,e?.message||e)}}static createFromObject(e){return this.createFromJsonString(JSON.stringify(e))}static async createFromYamlFile(e){let t="";try{t=await this.readFileWithRetry(e);let i=this.createFromYamlString(t);return i.file={path:e,type:"yaml"},i}catch(e){return new v(t,e?.message||e)}}static async createFromJsonFile(e){let t="";try{t=await this.readFileWithRetry(e);let i=this.createFromJsonString(t);return i.file={path:e,type:"json"},i}catch(e){return new v(t,e?.message||e)}}static async createFromFile(e){return e?.endsWith(".yaml")||e?.endsWith(".yml")?await this.createFromYamlFile(e):e?.endsWith(".json")?await this.createFromJsonFile(e):new v("","Invalid filename for reading a ZAPP file.")}static async loadFromWorkspace(e){let t=this.findZappFile(e);return t?.type==="yaml"?await this.createFromYamlFile(t.path):t?.type==="json"?await this.createFromJsonFile(t.path):new v("",`No ZAPP file was found in "${e}".`)}static findZappFile(t){if(!t)return;let s=i.normalize(t),r=i.join(s,"zapp.yaml");if(e.existsSync(r))return{path:r,type:"yaml"};let a=i.join(s,"zapp.yml");if(e.existsSync(a))return{path:a,type:"yaml"};let n=i.join(s,"zapp.json");if(e.existsSync(n))return{path:n,type:"json"}}static isZappFileName(e){return/^(zapp\.)(yml|yaml|json)$/.test(e)}getVariables(){let e=[],t=this.getAsYaml();if(t){let i=t.match(/\${.*?}/g);i&&(e=(e=[...new Set(i)]).map(e=>e.replace(/[${}]/g,"")))}return e}getAsDocument(){try{let e=this.yawn.json;if(e)return e}catch(e){this.prependErrorMessage(e?.message)}}validate(){if(this.yawn){if(this.isValid=v.validationFunction(this.getAsObject()),!this.isValid){let e=v.validationFunction.errors;return e?e.forEach(e=>{let t=e.message;if(e.params){let i=e.params,s=Object.keys(i).map(e=>`${e}:${i[e]}`);t=`${t}(${s})`}this.appendErrorMessage(t)}):this.appendErrorMessage("Unknown validation error."),!1}return!0}return!1}constructor(...e){super(...e),this.type="zapp"}}class I extends f{static #e=this.cacheType="zapp";static getInstance(){return this.instance||(this.instance=new I(this.cacheType)),this.instance}static resetInstance(){this.instance=void 0}static getZappDocument(e){if(!e)return;let t=this.getInstance().normalizePath(e);if(this.getInstance().documentsCache.has(t))return this.getInstance().numberDocsFound++,this.getInstance().documentsCache.get(t)}static async loadZappDocument(e,t){if(!e)return;let s=this.getInstance().normalizePath(e),r=await v.createFromFile(s),a=t;return t||(a=i.dirname(s)),this.getInstance().addDocument(e,a,r),this.getInstance().numberDocsAdded++,r}static removeZappDocument(e){return this.getInstance().removeDocument(e)}static clearZappDocument(e){this.getInstance().clearSchemaDocument(e)}static getZappDocumentInWorkspace(e){if(!e)return;let t=this.getInstance().normalizePath(e),i=this.getInstance().workspacesMap.get(t);if(i)return this.getZappDocument(i)}static async loadZappDocumentInWorkspace(e){let t=this.getInstance().normalizePath(e),i=v.findZappFile(t);if(i){let s=await this.loadZappDocument(i.path,e);return this.getInstance().workspacesMap.set(t,i.path),s}}isValidFilename(e){return v.isZappFileName(e)}static getVariablesFromAllDocs(){let e=[];for(let t of this.getInstance().documentsCache.values())t instanceof v&&e.push(...t.getVariables());return e.length>1&&(e=[...new Set(e)]),e}static getCacheSize(){return this.getInstance().getCacheSize()}static getAllDocumentLocations(){return this.getInstance().getAllDocumentLocations()}static getCacheStats(){return this.getInstance().getCacheStats()}static clearCache(){this.getInstance().clearCache(),this.resetInstance()}}var D={};l(D,"ZappUserVariablesCache",()=>A);class A{static getInstance(){return this.instance||(this.instance=new A),this.instance}static resetInstance(){this.instance=void 0}static saveZappUserVariables(e){A.getInstance().zappUserSettingsMap=e,A.getInstance().zappUserSettingsMap.forEach((e,t)=>{if(e.includes(p(i).win32.sep)){let s=e.split(p(i).win32.sep).join(p(i).posix.sep);A.getInstance().zappUserSettingsMap.set(t,s)}})}static getZappUserVariables(){return A.getInstance().zappUserSettingsMap}static clearCache(){A.getInstance().zappUserSettingsMap.clear(),this.resetInstance()}static replaceUserVariables(e){if(!e)return;let t=JSON.stringify(e),i=A.getZappUserVariables();if(!i||0===i.size)return e;let s=t.replace(/\${.*?\}/g,e=>{let t=e.slice(2,-1),s=i.get(t)??e;return t.replace(t,s)});try{return JSON.parse(s)}catch(t){return e}}constructor(){this.zappUserSettingsMap=new Map}}class j{static getPropertyGroups(e,t){let i=[],s=I.getZappDocumentInWorkspace(e);if(s&&!s.errorMessages){let e=s.getAsDocument();if(e){let s=e.propertyGroups;s&&(i=s,t&&(i=s.filter(e=>!e.language||e.language===t)))}}return A.replaceUserVariables(i)}}var T={};l(T,"UserBuildController",()=>x);var M={};l(M,"ZappProfilesController",()=>C);class C{static getZappProfiles(e){let t=I.getZappDocumentInWorkspace(e);if(!t||t.errorMessages)return;let i=t.getAsDocument();if(i&&i.profiles&&0!==i.profiles.length)return i.profiles}static async loadZappProfiles(e){if(await I.loadZappDocumentInWorkspace(e))return this.getZappProfiles(e)}}var F={};l(F,"zappConstants",()=>O);const O={profileTypeDbb:"dbb",profileTypeRseApi:"rseapi",propertyPropertyGroups:"propertyGroups",profileTypePreprocessor:"preprocessor"};class x extends C{static getUserBuildProfileNames(e){let t=this.getZappProfiles(e);if(t&&t.length>0)return t.filter(e=>e.type===O.profileTypeDbb).map(e=>e.name)}static getUserBuildSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){if(t){let e=i.find(e=>e.name===t);if(e?.type===O.profileTypeDbb)return A.replaceUserVariables(e.settings)}else{let e=i.find(e=>e.type===O.profileTypeDbb);return A.replaceUserVariables(e?.settings)}}}}var Z={};l(Z,"RseApiController",()=>z);class z extends C{static getRseApiProfileNames(e){let t=this.getZappProfiles(e);if(t&&t.length>0)return t.filter(e=>e.type===O.profileTypeRseApi).map(e=>e.name)}static onlyOneMappingsEntry(e){let t=this.getRseApiProfileNames(e);return t?.length===1}static getRseApiSettings(e){let t=this.getZappProfiles(e);if(t&&t.length>0){let e=t.find(e=>e.type===O.profileTypeRseApi);return A.replaceUserVariables(e?.settings)}}static async loadRseApiSettings(e){if(await this.loadZappProfiles(e))return this.getRseApiSettings(e)}}var U={};l(U,"PreprocessorController",()=>k);class k extends C{static getPreprocessorProfileNames(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0)return i.filter(e=>e.type===O.profileTypePreprocessor&&"language"in e&&(void 0===t||e.language===t)).map(e=>e.name)}static getPreprocessorProfileNamesBasedOnLocation(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0)return s.filter(e=>e.type===O.profileTypePreprocessor&&"location"in e&&e.location===t&&(void 0===i||e.language===i)).map(e=>e.name)}static getLocalPreprocessorSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){let e=i.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"local"===e.location&&(void 0===t||e.language===t));return A.replaceUserVariables(e?.settings)}}static getMvsPreprocessorSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){let e=i.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"mvs"===e.location&&(void 0===t||e.language===t));return A.replaceUserVariables(e?.settings)}}static getLocalPreprocessorProfileNamesBasedOnName(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0){let e=s.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"local"===e.location&&e.name===t&&(void 0===i||e.language===i));return A.replaceUserVariables(e?.settings)}}static getMvsPreprocessorProfileNamesBasedOnName(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0){let e=s.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"mvs"===e.location&&e.name===t&&(void 0===i||e.language===i));return A.replaceUserVariables(e?.settings)}}}o(y,b),o(y,T),o(y,Z),o(y,M),o(y,U);var R={};o(R,{}),o(R,w),o(R,P),o(R,F),o(R,D),o(g,y),o(g,R),o(module.exports,c),o(module.exports,g);
|
|
3
|
+
${this.errorMessages}`:"";this.errorMessages=`- ${e||"Unknown Error reading "+this.type+" file."}${t}`}}var m={};l(m,"SchemaDocumentCache",()=>f);class f{constructor(e){this.type=e,this.documentsCache=new Map,this.workspacesMap=new Map,this.numberDocsAdded=0,this.numberDocsRemoved=0,this.numberDocsFound=0}addDocument(e,t,i){let s=this.normalizePath(e),r=this.normalizePath(t);this.documentsCache.set(s,i),this.workspacesMap.set(r,s)}removeDocument(e){let t=this.normalizePath(e);this.workspacesMap.forEach((e,i)=>{e===t&&this.workspacesMap.delete(i)});let i=this.documentsCache.delete(t);return i&&this.numberDocsRemoved++,i}getCacheSize(){return this.documentsCache.size}getAllDocumentLocations(){return[...this.documentsCache.keys()]}clearSchemaDocument(e){if(!e)return;let t=this.normalizePath(e),s=i.dirname(t);this.workspacesMap.has(s)&&this.workspacesMap.delete(s),this.documentsCache.has(t)&&(this.documentsCache.delete(t),this.numberDocsRemoved++)}clearCache(){this.workspacesMap.clear(),this.documentsCache.clear()}getCacheStats(){return{documentsCacheSize:this.documentsCache.size,workspacesMapSize:this.workspacesMap.size,numberDocsAdded:this.numberDocsAdded,numberDocsRemoved:this.numberDocsRemoved,numberDocsFound:this.numberDocsFound}}normalizePath(e){if(!e)return e;let t=i.normalize(e);if("win32"===s.platform()){let e=i.basename(t);if(this.isValidFilename(e)){let s=i.dirname(t);t=i.join(s.toUpperCase(),e)}else t=t.toUpperCase()}return t}}o(d,h),o(d,m),o(c,d);var g={},y={},b={};l(b,"PropertyGroupsController",()=>j);var P={};l(P,"ZappDocumentsCache",()=>I);var w={};l(w,"ZappDocumentInstance",()=>v);var S={};S=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","title":"IBM Zapp Document","description":"JSON schema for zapp.json and zapp.yaml files. Version 1.3.0 -- Licensed Materials - Property of IBM - (c) Copyright IBM Corporation 2022, 2024. All Rights Reserved.","type":"object","definitions":{"coreProperties":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"description":"The name of the Z Project.","type":"string","maxLength":214,"minLength":1},"description":{"description":"This helps people understand your project as it would be used by tools.","type":"string"},"version":{"description":"Version is a string and it must be parsable for managing dependencies.","type":"string","default":"1.0.0"},"groupId":{"description":"Defines a group name that is shared for each application part in case of applications composed of multiple parts. Allows to uniquely identify the parts by concatenating with the artifact id. For example a groupId `com.ibm.wazi` with an artifactId `service` would create the unique application identifier `com.ibm.wazi.service`.","type":"string","examples":["com.ibm.wazi","payments"]},"artifactId":{"description":"Define id of the application artifact. Use it in combination with a groupId for multi-part applications.","type":"string","default":"","examples":["sam"]},"parentId":{"description":"In case of a multi-part application defines the name of the parent application part. This zapp will inherit properties such as propertyGroups defined in the parent.","type":"string","default":"","examples":["com.ibm.wazi.parent"]},"keywords":{"description":"This helps people discover your project.","type":"array","items":{"type":"string"}},"homepage":{"description":"The url to the project homepage.","type":"string","oneOf":[{"format":"uri"},{"enum":["."]}]},"license":{"type":"string","description":"You should specify a license for your package so that people know how they are permitted to use it and any restrictions you\'re placing on it."},"author":{"$ref":"#/definitions/person"},"contributors":{"description":"A list of people who contributed to this package.","type":"array","items":{"$ref":"#/definitions/person"},"minItems":1},"maintainers":{"description":"A list of people who maintain this package.","type":"array","items":{"$ref":"#/definitions/person"},"minItems":1},"propertyGroups":{"description":"A list of properties defining path names for resolving dependencies.","type":"array","items":{"$ref":"#/definitions/propertyGroupItem"},"minItems":1},"profiles":{"description":"Profiles are additional groups of properties that should only become valid under specific conditions such as running in a build job or as part of a debug session.","type":"array","items":{"$ref":"#/definitions/profile"},"minItems":1}}},"propertyGroupItem":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","description":"The name of the property group, which is used in hovers and error messages.","examples":["sample-local","sample-remote"]},"language":{"type":"string","enum":["cobol","pl1","hlasm","rexx","jcl"],"description":"Limits the property group to one specific language."},"compilerOptions":{"type":"string","description":"Global compiler options separated by a comma that impact the parsing of the programs for the editor. Requires that you specify a language. If there are multiple Property Groups for a language with compiler option then they will be concatenated."},"libraries":{"type":"array","description":"An array of potential library locations defining the search order for include files. Libraries with the name \'syslib\' will be handled as default include locations. The list can contain many entries of the type \'local\' or \'mvs\'. It can contain items of the same type twice in case, for example, you want to search in remote locations first, then some local location, and if still not found more remote locations.","items":{"$ref":"#/definitions/libraryItem"},"minItems":1}}},"libraryItem":{"type":"object","additionalProperties":false,"required":["name","type"],"properties":{"name":{"type":"string","description":"Name of the library. The default name should be `syslib` if using unnamed libraries.","default":"syslib","examples":["syslib","jcllib","maclib","currencylib"]},"type":{"type":"string","enum":["mvs","local"],"description":"The type of the property group defining where dependencies should be located. Allowed values are \'local\' for using a local workspace and \'mvs\' for dependencies located in MVS Datasets.","default":"local","examples":["local","mvs"]},"locations":{"type":"array","description":"An array of include file locations. For \'local\' libraries values can be absolute and relative filename paths using GLOB patterns. For \'mvs\' libraries value can be data set names. GLOB patterns for data sets are currently not supported.","items":{"type":"string"},"examples":["**/copybook","USER1.SAMPLE.COBCOPY"]}},"if":{"properties":{"name":{"const":"jcllib","type":"string"},"type":{"const":"mvs","type":"string"}}},"then":{"required":["name","type"]},"else":{"required":["name","type","locations"]}},"person":{"description":"A person who has been involved in creating or maintaining this package","type":["object","string"],"required":["name"],"properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"},"email":{"type":"string","format":"email"}}},"profile":{"type":"object","description":"Profiles are additional groups of properties that should only become valid under specific conditions such as running in a build job or as part of a debug session.","additionalProperties":false,"required":["name","type"],"properties":{"name":{"type":"string","description":"The name of the profile.","examples":["dbb-build"]},"language":{"type":"string","enum":["cobol","pl1"],"description":"If the profile type supports it then it defines a scope for the profile to one specific programming language. For example, a profile that defines preprocessor commands for COBOL."},"type":{"type":"string","enum":["dbb","rseapi","debug","preprocessor","test"],"description":"The type of the profile.","default":"dbb"},"location":{"type":"string","enum":["mvs","local"],"description":"If the profile type supports it then it defines a scope for the profile to a specific location for resources. For example, a profile that defines preprocessor commands to be executed on MVS or local files.","default":"local"},"settings":{"description":"Settings objects specific to the type specified for the profile.","type":"object"}},"oneOf":[{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"dbb","type":"string"},"settings":{"oneOf":[{"$ref":"#/definitions/dbbBuilderSettings"},{"$ref":"#/definitions/dbbGroovySettings"}]}}},{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"rseapi","type":"string"},"settings":{"$ref":"#/definitions/rseapiSettingsItem"}}},{"required":["name","type","settings","location","language"],"additionalProperties":false,"properties":{"name":{"type":"string"},"language":{"type":"string"},"type":{"const":"preprocessor","type":"string"},"location":{"type":"string"},"settings":{"oneOf":[{"$ref":"#/definitions/localPreprocessorSettingsItem"},{"$ref":"#/definitions/mvsPreprocessorSettingsItem"}]}},"if":{"properties":{"location":{"const":"local","type":"string"}}},"then":{"properties":{"settings":{"$ref":"#/definitions/localPreprocessorSettingsItem"}}},"else":{"properties":{"settings":{"$ref":"#/definitions/mvsPreprocessorSettingsItem"}}}},{"required":["name","type","settings"],"additionalProperties":false,"properties":{"name":{"type":"string"},"type":{"const":"test","type":"string"},"settings":{"$ref":"#/definitions/testSettingsItem"}}}]},"dbbGroovySettings":{"type":"object","additionalProperties":false,"required":["application","command"],"description":"Groovyz user build script properties for running user build on remote host.","properties":{"application":{"type":"string","description":"Defines the name of the application to build. Will be used to create a folder on USS to upload all files to."},"command":{"type":"string","description":"Command that the build script is executed with such as the path to groovyz and it\'s parameters."},"buildScriptPath":{"type":"string","description":"The full path of build script on the remote host that should be used with the command."},"buildScriptArgs":{"type":"array","items":{"type":"string"},"description":"A list of strings that are the parameters for the build script. Check the documentation for built-in variables, such as the name of the program to build, that can be used here."},"additionalDependencies":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be uploaded to USS for a build. Relative path names are interpreted relative to the location of the ZAPP file that is being used for the build, which is a ZAPP file in the same workspace as the program to be build."},"logFilePatterns":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be downloaded from USS after the build. Relative path names are interpreted relative to the DBB log directory user setting. If not provided then all files of the user setting location will be downloaded."}}},"dbbBuilderSettings":{"type":"object","additionalProperties":false,"required":["command","lifecycle","lifecycleArgs"],"description":"zBuilder user build properties for running user build on remote host.","properties":{"command":{"type":"string","description":"Command that the build script is executed with such as the path to groovyz and it\'s parameters."},"lifecycle":{"type":"string","description":"Defines named build lifecycles that represent different build scenarios the customer needs to perform and can be executed from the DBB CLI."},"lifecycleArgs":{"type":"array","description":"Additional arguments and options for the lifecycle.","items":{"type":"string"}},"additionalDependencies":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be uploaded to USS for a build. Relative path names are interpreted relative to the location of the ZAPP file that is being used for the build, which is a ZAPP file in the same workspace as the program to be build."},"logFilePatterns":{"type":"array","items":{"type":"string"},"description":"Lists of GLOB patterns that define the files that should be downloaded from USS after the build. Relative path names are interpreted relative to the DBB log directory user setting. If not provided then all files of the user setting location will be downloaded."}}},"rseapiSettingsItem":{"type":"object","additionalProperties":false,"description":"RSE API client settings for interactions with a z/OS remote host running an RSE API server.","required":["mappings","default.encoding"],"properties":{"mappings":{"type":"array","description":"A list of mapping objects that map local file extensions to transfer modes and encodings to MVS datasets that can be specified using wildcards.","items":{"$ref":"#/definitions/rseapiSettingsItemMapping"}},"default.encoding":{"type":"string","description":"The encoding to be used when no mapping can be found. If not provided then either the user or server default will be used."}}},"rseapiSettingsItemMapping":{"type":"object","additionalProperties":false,"description":"One mapping that contains at least transfer and resource values.","properties":{"extension":{"type":"string","description":"A local file extension such as cbl or pl1."},"transfer":{"type":"string","enum":["text","binary"],"description":"The transfer mode to be used. Can be \'text\' or \'binary\'."},"resource":{"type":"string","description":"The data set name to be mapped to. Can use a wildcard such as \'**CPY\'."},"encoding":{"type":"string","description":"The encoding to be used for text transfer. See the RSE API documentation for the values allowed."},"memberMappings":{"type":"array","items":{"type":"object","additionalProperties":false,"description":"One member mapping that contains at least transfer and resource values.","properties":{"extension":{"type":"string","description":"A local file extension such as cbl or pl1."},"transfer":{"type":"string","enum":["text","binary"],"description":"The transfer mode to be used. Can be \'text\' or \'binary\'."},"encoding":{"type":"string","description":"The encoding to be used for text transfer. See the RSE API documentation for the values allowed."},"resource":{"type":"string","description":"The data set member name to be mapped to. Can use a wildcard such as \'**CPY\'."}}},"description":"A nested mappings array with resource mappings to members of the data sets that were mapped by the parent mapping."}}},"localPreprocessorSettingsItem":{"type":"object","additionalProperties":false,"description":"Preprocessor properties for preprocessing COBOL/PL/I files.","required":["command","outputPath","fileExtension"],"properties":{"command":{"type":"string","description":"The command to run to execute the preprocessor executable."},"outputPath":{"type":"string","description":"Path where preprocessor produces its build output."},"fileExtension":{"type":"string","description":"The desired file extension for the post-processed file."},"environmentVariables":{"type":"object","additionalProperties":false,"description":"Specifies any user defined environment variables to be passed to the preprocessor.","patternProperties":{"[a-zA-Z_][a-zA-Z0-9_]*":{"anyOf":[{"type":"string"}]}}}}},"mvsPreprocessorSettingsItem":{"type":"object","additionalProperties":false,"description":"Preprocessor properties for preprocessing COBOL/PL/I files.","required":["commandDataSet","outputDataSet","tempDataHLQ"],"properties":{"commandDataSet":{"type":"string","description":"Specifies an input listing sequential data set."},"commandParameters":{"type":"string","description":"The parameters for the command being run."},"outputDataSet":{"type":"string","description":"Specifies an output listing sequential data set."},"tempDataHLQ":{"type":"string","description":"Specifies the high-level qualifier used for data sets created by plug-in requests to export observation files."}}},"testSettingsItem":{"type":"object","additionalProperties":false,"description":"Test properties for a test case.","required":["unitTest"],"properties":{"unitTest":{"type":"object","additionalProperties":false,"description":"Properties to run a unit test case.","required":["procLib"],"properties":{"procLib":{"type":"array","description":"Specifies the list of Procedure libraries.","items":{"type":"string"}},"allocateWorkingDs":{"type":"boolean","description":" If this option is selected, the data set for the working file is allocated automatically with the allocation options."},"ioDataSetAllocation":{"type":"object","description":"Options to allocate a working file.","properties":{"ioSpaceUnit":{"type":"string","enum":["TRACKS","BLOCKS","CYLINDERS"],"description":"The unit of primary and secondary space to be allocated."},"ioQuant1":{"type":"integer","description":"The amount of DASD space to be used for primary space allocation (PRIMARY)."},"ioQuant2":{"type":"integer","description":"The amount of DASD space to be used for secondary space allocation (SECONDARY)."},"ioHLQ":{"type":"string","description":"The high-level qualifier for the VSAM or QSAM data files for file I/O simulation. These files are allocated when running a Unit test case."}}},"configDS":{"type":"string","description":"Runner configuration destination container."},"resultDS":{"type":"string","description":"Runner result destination container."},"userLibraries":{"type":"array","description":"The datat set of the application under test","items":{"type":"string"}},"defaultTestCaseFolder":{"type":"string","description":"The default local folder to create the test case artifacts."},"jobcard":{"type":"string","description":"The job card to run a unit test"}}}}}},"anyOf":[{"$ref":"#/definitions/coreProperties"}]}');class v extends u{static #e=this.validationFunction=v.initAjvValidator();static initAjvValidator(){let e=new(p(a))({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});return p(n)(e),e.compile(S)}static createFromYamlString(e){return new v(e)}static createFromJsonString(e){let t="";try{let i=JSON.parse(e);return t=r.dump(i),this.createFromYamlString(t)}catch(e){return new v(t,e?.message||e)}}static createFromObject(e){return this.createFromJsonString(JSON.stringify(e))}static async createFromYamlFile(e){let t="";try{t=await this.readFileWithRetry(e);let i=this.createFromYamlString(t);return i.file={path:e,type:"yaml"},i}catch(e){return new v(t,e?.message||e)}}static async createFromJsonFile(e){let t="";try{t=await this.readFileWithRetry(e);let i=this.createFromJsonString(t);return i.file={path:e,type:"json"},i}catch(e){return new v(t,e?.message||e)}}static async createFromFile(e){return e?.endsWith(".yaml")||e?.endsWith(".yml")?await this.createFromYamlFile(e):e?.endsWith(".json")?await this.createFromJsonFile(e):new v("","Invalid filename for reading a ZAPP file.")}static async loadFromWorkspace(e){let t=this.findZappFile(e);return t?.type==="yaml"?await this.createFromYamlFile(t.path):t?.type==="json"?await this.createFromJsonFile(t.path):new v("",`No ZAPP file was found in "${e}".`)}static findZappFile(t){if(!t)return;let s=i.normalize(t),r=i.join(s,"zapp.yaml");if(e.existsSync(r))return{path:r,type:"yaml"};let a=i.join(s,"zapp.yml");if(e.existsSync(a))return{path:a,type:"yaml"};let n=i.join(s,"zapp.json");if(e.existsSync(n))return{path:n,type:"json"}}static isZappFileName(e){return/^(zapp\.)(yml|yaml|json)$/.test(e)}getVariables(){let e=[],t=this.getAsYaml();if(t){let i=t.match(/\${.*?}/g);i&&(e=(e=[...new Set(i)]).map(e=>e.replace(/[${}]/g,"")))}return e}getAsDocument(){try{let e=this.yawn.json;if(e)return e}catch(e){this.prependErrorMessage(e?.message)}}validate(){if(this.yawn){if(this.isValid=v.validationFunction(this.getAsObject()),!this.isValid){let e=v.validationFunction.errors;return e?e.forEach(e=>{let t=e.message;if(e.params){let i=e.params,s=Object.keys(i).map(e=>`${e}:${i[e]}`);t=`${t}(${s})`}this.appendErrorMessage(t)}):this.appendErrorMessage("Unknown validation error."),!1}return!0}return!1}constructor(...e){super(...e),this.type="zapp"}}class I extends f{static #e=this.cacheType="zapp";static getInstance(){return this.instance||(this.instance=new I(this.cacheType)),this.instance}static resetInstance(){this.instance=void 0}static getZappDocument(e){if(!e)return;let t=this.getInstance().normalizePath(e);if(this.getInstance().documentsCache.has(t))return this.getInstance().numberDocsFound++,this.getInstance().documentsCache.get(t)}static async loadZappDocument(e,t){if(!e)return;let s=this.getInstance().normalizePath(e),r=await v.createFromFile(s),a=t;return t||(a=i.dirname(s)),this.getInstance().addDocument(e,a,r),this.getInstance().numberDocsAdded++,r}static removeZappDocument(e){return this.getInstance().removeDocument(e)}static clearZappDocument(e){this.getInstance().clearSchemaDocument(e)}static getZappDocumentInWorkspace(e){if(!e)return;let t=this.getInstance().normalizePath(e),i=this.getInstance().workspacesMap.get(t);if(i)return this.getZappDocument(i)}static async loadZappDocumentInWorkspace(e){let t=this.getInstance().normalizePath(e),i=v.findZappFile(t);if(i){let s=await this.loadZappDocument(i.path,e);return this.getInstance().workspacesMap.set(t,i.path),s}}isValidFilename(e){return v.isZappFileName(e)}static getVariablesFromAllDocs(){let e=[];for(let t of this.getInstance().documentsCache.values())t instanceof v&&e.push(...t.getVariables());return e.length>1&&(e=[...new Set(e)]),e}static getCacheSize(){return this.getInstance().getCacheSize()}static getAllDocumentLocations(){return this.getInstance().getAllDocumentLocations()}static getCacheStats(){return this.getInstance().getCacheStats()}static clearCache(){this.getInstance().clearCache(),this.resetInstance()}}var D={};l(D,"ZappUserVariablesCache",()=>A);class A{static getInstance(){return this.instance||(this.instance=new A),this.instance}static resetInstance(){this.instance=void 0}static saveZappUserVariables(e){A.getInstance().zappUserSettingsMap=e,A.getInstance().zappUserSettingsMap.forEach((e,t)=>{if(e.includes(p(i).win32.sep)){let s=e.split(p(i).win32.sep).join(p(i).posix.sep);A.getInstance().zappUserSettingsMap.set(t,s)}})}static getZappUserVariables(){return A.getInstance().zappUserSettingsMap}static clearCache(){A.getInstance().zappUserSettingsMap.clear(),this.resetInstance()}static replaceUserVariables(e){if(!e)return;let t=JSON.stringify(e),i=A.getZappUserVariables();if(!i||0===i.size)return e;let s=t.replace(/\${.*?\}/g,e=>{let t=e.slice(2,-1),s=i.get(t)??e;return t.replace(t,s)});try{return JSON.parse(s)}catch(t){return e}}constructor(){this.zappUserSettingsMap=new Map}}class j{static getPropertyGroups(e,t){let i=[],s=I.getZappDocumentInWorkspace(e);if(s&&!s.errorMessages){let e=s.getAsDocument();if(e){let s=e.propertyGroups;s&&(i=s,t&&(i=s.filter(e=>!e.language||e.language===t)))}}return A.replaceUserVariables(i)}}var C={};l(C,"UserBuildController",()=>x);var T={};l(T,"ZappProfilesController",()=>M);class M{static getZappProfiles(e){let t=I.getZappDocumentInWorkspace(e);if(!t||t.errorMessages)return;let i=t.getAsDocument();if(i&&i.profiles&&0!==i.profiles.length)return i.profiles}static async loadZappProfiles(e){if(await I.loadZappDocumentInWorkspace(e))return this.getZappProfiles(e)}}var F={};l(F,"zappConstants",()=>O);const O={profileTypeDbb:"dbb",profileTypeRseApi:"rseapi",propertyPropertyGroups:"propertyGroups",profileTypePreprocessor:"preprocessor"};class x extends M{static getUserBuildProfileNames(e){let t=this.getZappProfiles(e);if(t&&t.length>0)return t.filter(e=>e.type===O.profileTypeDbb).map(e=>e.name)}static getUserBuildSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){if(t){let e=i.find(e=>e.name===t);if(e?.type===O.profileTypeDbb)return A.replaceUserVariables(e.settings)}else{let e=i.find(e=>e.type===O.profileTypeDbb);return A.replaceUserVariables(e?.settings)}}}}var z={};l(z,"RseApiController",()=>Z);class Z extends M{static getRseApiProfileNames(e){let t=this.getZappProfiles(e);if(t&&t.length>0)return t.filter(e=>e.type===O.profileTypeRseApi).map(e=>e.name)}static onlyOneMappingsEntry(e){let t=this.getRseApiProfileNames(e);return t?.length===1}static getRseApiSettings(e){let t=this.getZappProfiles(e);if(t&&t.length>0){let e=t.find(e=>e.type===O.profileTypeRseApi);return A.replaceUserVariables(e?.settings)}}static async loadRseApiSettings(e){if(await this.loadZappProfiles(e))return this.getRseApiSettings(e)}}var U={};l(U,"PreprocessorController",()=>k);class k extends M{static getPreprocessorProfileNames(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0)return i.filter(e=>e.type===O.profileTypePreprocessor&&"language"in e&&(void 0===t||e.language===t)).map(e=>e.name)}static getPreprocessorProfileNamesBasedOnLocation(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0)return s.filter(e=>e.type===O.profileTypePreprocessor&&"location"in e&&e.location===t&&(void 0===i||e.language===i)).map(e=>e.name)}static getLocalPreprocessorSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){let e=i.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"local"===e.location&&(void 0===t||e.language===t));return A.replaceUserVariables(e?.settings)}}static getMvsPreprocessorSettings(e,t){let i=this.getZappProfiles(e);if(i&&i.length>0){let e=i.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"mvs"===e.location&&(void 0===t||e.language===t));return A.replaceUserVariables(e?.settings)}}static getLocalPreprocessorProfileNamesBasedOnName(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0){let e=s.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"local"===e.location&&e.name===t&&(void 0===i||e.language===i));return A.replaceUserVariables(e?.settings)}}static getMvsPreprocessorProfileNamesBasedOnName(e,t,i){let s=this.getZappProfiles(e);if(s&&s.length>0){let e=s.find(e=>e.type===O.profileTypePreprocessor&&"location"in e&&"mvs"===e.location&&e.name===t&&(void 0===i||e.language===i));return A.replaceUserVariables(e?.settings)}}}o(y,b),o(y,C),o(y,z),o(y,T),o(y,U);var L={};o(L,{}),o(L,w),o(L,P),o(L,F),o(L,D),o(g,y),o(g,L),o(module.exports,c),o(module.exports,g);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibm/zapp-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "IBM ZAPP parser and core utilities",
|
|
5
5
|
"publisher": "IBM",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"scripts": {
|
|
69
69
|
"prebuild": "npm run build:resources",
|
|
70
70
|
"build": "tsc --pretty && npm run checkDeps && npm run lintErrors",
|
|
71
|
-
"build:resources": "rimraf resources/* && copyfiles -f ../../schema/*-schema-1.
|
|
71
|
+
"build:resources": "rimraf resources/* && copyfiles -f ../../schema/*-schema-1.3.0.json ./resources",
|
|
72
72
|
"build:version": "npm version --new-version $npm_package_version-`date '+%Y%m%d%H%M'`-`git rev-parse --short HEAD` --no-git-tag-version",
|
|
73
73
|
"build:package": "npm run clean && parcel build",
|
|
74
74
|
"build:test": "npm run clean && npm run build && npm run test",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"title": "IBM Zapp Document",
|
|
4
|
-
"description": "JSON schema for zapp.json and zapp.yaml files. Version 1.
|
|
4
|
+
"description": "JSON schema for zapp.json and zapp.yaml files. Version 1.3.0 -- Licensed Materials - Property of IBM - (c) Copyright IBM Corporation 2022, 2024. All Rights Reserved.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"definitions": {
|
|
7
7
|
"coreProperties": {
|
|
@@ -133,13 +133,13 @@
|
|
|
133
133
|
"libraryItem": {
|
|
134
134
|
"type": "object",
|
|
135
135
|
"additionalProperties": false,
|
|
136
|
-
"required": ["name", "type"
|
|
136
|
+
"required": ["name", "type"],
|
|
137
137
|
"properties": {
|
|
138
138
|
"name": {
|
|
139
139
|
"type": "string",
|
|
140
140
|
"description": "Name of the library. The default name should be `syslib` if using unnamed libraries.",
|
|
141
141
|
"default": "syslib",
|
|
142
|
-
"examples": ["syslib", "maclib", "currencylib"]
|
|
142
|
+
"examples": ["syslib", "jcllib", "maclib", "currencylib"]
|
|
143
143
|
},
|
|
144
144
|
"type": {
|
|
145
145
|
"type": "string",
|
|
@@ -154,10 +154,14 @@
|
|
|
154
154
|
"items": {
|
|
155
155
|
"type": "string"
|
|
156
156
|
},
|
|
157
|
-
"minItems": 1,
|
|
158
157
|
"examples": ["**/copybook", "USER1.SAMPLE.COBCOPY"]
|
|
159
158
|
}
|
|
160
|
-
}
|
|
159
|
+
},
|
|
160
|
+
"if": {
|
|
161
|
+
"properties": { "name": { "const": "jcllib", "type": "string" }, "type": { "const": "mvs", "type": "string" } }
|
|
162
|
+
},
|
|
163
|
+
"then": { "required": ["name", "type"] },
|
|
164
|
+
"else": { "required": ["name", "type", "locations"] }
|
|
161
165
|
},
|
|
162
166
|
"person": {
|
|
163
167
|
"description": "A person who has been involved in creating or maintaining this package",
|
|
@@ -218,7 +222,7 @@
|
|
|
218
222
|
"name": { "type": "string" },
|
|
219
223
|
"type": { "const": "dbb", "type": "string" },
|
|
220
224
|
"settings": {
|
|
221
|
-
"$ref": "#/definitions/
|
|
225
|
+
"oneOf": [{ "$ref": "#/definitions/dbbBuilderSettings" }, { "$ref": "#/definitions/dbbGroovySettings" }]
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
},
|
|
@@ -265,11 +269,11 @@
|
|
|
265
269
|
}
|
|
266
270
|
]
|
|
267
271
|
},
|
|
268
|
-
"
|
|
272
|
+
"dbbGroovySettings": {
|
|
269
273
|
"type": "object",
|
|
270
274
|
"additionalProperties": false,
|
|
271
275
|
"required": ["application", "command"],
|
|
272
|
-
"description": "
|
|
276
|
+
"description": "Groovyz user build script properties for running user build on remote host.",
|
|
273
277
|
"properties": {
|
|
274
278
|
"application": {
|
|
275
279
|
"type": "string",
|
|
@@ -306,6 +310,43 @@
|
|
|
306
310
|
}
|
|
307
311
|
}
|
|
308
312
|
},
|
|
313
|
+
"dbbBuilderSettings": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"additionalProperties": false,
|
|
316
|
+
"required": ["command", "lifecycle", "lifecycleArgs"],
|
|
317
|
+
"description": "zBuilder user build properties for running user build on remote host.",
|
|
318
|
+
"properties": {
|
|
319
|
+
"command": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"description": "Command that the build script is executed with such as the path to groovyz and it's parameters."
|
|
322
|
+
},
|
|
323
|
+
"lifecycle": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"description": "Defines named build lifecycles that represent different build scenarios the customer needs to perform and can be executed from the DBB CLI."
|
|
326
|
+
},
|
|
327
|
+
"lifecycleArgs": {
|
|
328
|
+
"type": "array",
|
|
329
|
+
"description": "Additional arguments and options for the lifecycle.",
|
|
330
|
+
"items": {
|
|
331
|
+
"type": "string"
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
"additionalDependencies": {
|
|
335
|
+
"type": "array",
|
|
336
|
+
"items": {
|
|
337
|
+
"type": "string"
|
|
338
|
+
},
|
|
339
|
+
"description": "Lists of GLOB patterns that define the files that should be uploaded to USS for a build. Relative path names are interpreted relative to the location of the ZAPP file that is being used for the build, which is a ZAPP file in the same workspace as the program to be build."
|
|
340
|
+
},
|
|
341
|
+
"logFilePatterns": {
|
|
342
|
+
"type": "array",
|
|
343
|
+
"items": {
|
|
344
|
+
"type": "string"
|
|
345
|
+
},
|
|
346
|
+
"description": "Lists of GLOB patterns that define the files that should be downloaded from USS after the build. Relative path names are interpreted relative to the DBB log directory user setting. If not provided then all files of the user setting location will be downloaded."
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
309
350
|
"rseapiSettingsItem": {
|
|
310
351
|
"type": "object",
|
|
311
352
|
"additionalProperties": false,
|