UNPKG

@salesforce/core

Version:

Core libraries to interact with SFDX projects, orgs, and APIs.

66 lines 2.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MetadataRegistrySchema = void 0; /* * Copyright 2026, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const zod_1 = require("zod"); const SuffixIndexSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.string()); const DirectoryIndexSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.string()); /** * TypeInfoSchema has a circular reference (children.types references TypeIndexSchema, * which references TypeInfoSchema). We use z.lazy() to defer schema evaluation until * runtime to avoid "Cannot access before initialization" errors. z.ZodType<T> provides * an explicit type annotation since TypeScript can't infer recursive types properly. */ const TypeInfoSchema = zod_1.z.lazy(() => zod_1.z.object({ id: zod_1.z.string(), name: zod_1.z.string(), directoryName: zod_1.z.string(), suffix: zod_1.z.string().optional(), strictDirectoryName: zod_1.z.boolean().optional(), ignoreParsedFullName: zod_1.z.boolean().optional(), folderContentType: zod_1.z.string().optional(), folderType: zod_1.z.string().optional(), xmlElementName: zod_1.z.string().optional(), uniqueIdElement: zod_1.z.string().optional(), isAddressable: zod_1.z.boolean().optional(), unaddressableWithoutParent: zod_1.z.boolean().optional(), supportsWildcardAndName: zod_1.z.boolean().optional(), supportsPartialDelete: zod_1.z.boolean().optional(), aliasFor: zod_1.z.string().optional(), children: zod_1.z .object({ types: TypeIndexSchema, suffixes: SuffixIndexSchema, directories: DirectoryIndexSchema.optional(), }) .optional(), strategies: zod_1.z .object({ adapter: zod_1.z.enum(['mixedContent', 'matchingContentFile', 'decomposed', 'bundle', 'default']), transformer: zod_1.z.enum(['decomposed', 'staticResource', 'standard']).optional(), decomposition: zod_1.z.enum(['topLevel', 'folderPerType']).optional(), }) .optional(), })); const TypeIndexSchema = zod_1.z.lazy(() => zod_1.z.record(zod_1.z.string(), TypeInfoSchema)); exports.MetadataRegistrySchema = zod_1.z.object({ types: TypeIndexSchema, suffixes: SuffixIndexSchema, strictDirectoryNames: zod_1.z.record(zod_1.z.string(), zod_1.z.string()), childTypes: zod_1.z.record(zod_1.z.string(), zod_1.z.string()), }); //# sourceMappingURL=registryVariants.js.map