@verdaccio/core 8.1.4 → 8.2.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/build/_virtual/_rolldown/runtime.js +33 -0
- package/build/_virtual/_rolldown/runtime.mjs +13 -0
- package/build/auth-utils.d.ts +0 -1
- package/build/auth-utils.js +23 -25
- package/build/auth-utils.js.map +1 -1
- package/build/auth-utils.mjs +32 -0
- package/build/auth-utils.mjs.map +1 -0
- package/build/constants.js +201 -157
- package/build/constants.js.map +1 -1
- package/build/constants.mjs +185 -0
- package/build/constants.mjs.map +1 -0
- package/build/crypto-utils.d.ts +0 -2
- package/build/crypto-utils.js +33 -29
- package/build/crypto-utils.js.map +1 -1
- package/build/crypto-utils.mjs +40 -0
- package/build/crypto-utils.mjs.map +1 -0
- package/build/error-utils.js +92 -80
- package/build/error-utils.js.map +1 -1
- package/build/error-utils.mjs +107 -0
- package/build/error-utils.mjs.map +1 -0
- package/build/file-utils.js +35 -31
- package/build/file-utils.js.map +1 -1
- package/build/file-utils.mjs +35 -0
- package/build/file-utils.mjs.map +1 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +125 -185
- package/build/index.mjs +15 -0
- package/build/ip-utils.js +52 -69
- package/build/ip-utils.js.map +1 -1
- package/build/ip-utils.mjs +60 -0
- package/build/ip-utils.mjs.map +1 -0
- package/build/pkg-utils.js +60 -76
- package/build/pkg-utils.js.map +1 -1
- package/build/pkg-utils.mjs +69 -0
- package/build/pkg-utils.mjs.map +1 -0
- package/build/plugin-utils.d.ts +0 -1
- package/build/plugin-utils.js +27 -78
- package/build/plugin-utils.js.map +1 -1
- package/build/plugin-utils.mjs +26 -0
- package/build/plugin-utils.mjs.map +1 -0
- package/build/schemes/publish-manifest.js +33 -43
- package/build/schemes/publish-manifest.js.map +1 -1
- package/build/schemes/publish-manifest.mjs +36 -0
- package/build/schemes/publish-manifest.mjs.map +1 -0
- package/build/schemes/unpublish-manifest.js +51 -72
- package/build/schemes/unpublish-manifest.js.map +1 -1
- package/build/schemes/unpublish-manifest.mjs +54 -0
- package/build/schemes/unpublish-manifest.mjs.map +1 -0
- package/build/search-utils.js +9 -9
- package/build/search-utils.js.map +1 -1
- package/build/search-utils.mjs +8 -0
- package/build/search-utils.mjs.map +1 -0
- package/build/stream-utils.d.ts +0 -1
- package/build/stream-utils.js +29 -28
- package/build/stream-utils.js.map +1 -1
- package/build/stream-utils.mjs +30 -0
- package/build/stream-utils.mjs.map +1 -0
- package/build/string-utils.js +31 -34
- package/build/string-utils.js.map +1 -1
- package/build/string-utils.mjs +31 -0
- package/build/string-utils.mjs.map +1 -0
- package/build/tarball-utils.js +40 -39
- package/build/tarball-utils.js.map +1 -1
- package/build/tarball-utils.mjs +46 -0
- package/build/tarball-utils.mjs.map +1 -0
- package/build/validation-utils.js +78 -112
- package/build/validation-utils.js.map +1 -1
- package/build/validation-utils.mjs +91 -0
- package/build/validation-utils.mjs.map +1 -0
- package/build/warning-utils.d.ts +1 -0
- package/build/warning-utils.js +38 -33
- package/build/warning-utils.js.map +1 -1
- package/build/warning-utils.mjs +40 -0
- package/build/warning-utils.mjs.map +1 -0
- package/package.json +19 -6
- package/build/index.js.map +0 -1
- package/build/path-utils.js +0 -2
- package/build/path-utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"plugin-utils.js","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n"],"mappings":";;;;;;;AA2BA,IAAa,SAAb,MAAa,OAAqB;CAChC,OAAO,UAAU;CACjB;CACA;CACA;CACA,YAAmB,QAAsB,SAAwB;EAC/D,KAAK,UAAU,OAAO;EACtB,KAAK,SAAS;EACd,KAAK,UAAU;CACjB;CAEA,aAAoB;EAClB,OAAO,KAAK;CACd;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
//#region src/plugin-utils.ts
|
|
3
|
+
var plugin_utils_exports = /* @__PURE__ */ __exportAll({ Plugin: () => Plugin });
|
|
4
|
+
/**
|
|
5
|
+
* Base Plugin Class
|
|
6
|
+
*
|
|
7
|
+
* Set of utilities for developing plugins.
|
|
8
|
+
*/
|
|
9
|
+
var Plugin = class Plugin {
|
|
10
|
+
static version = 1;
|
|
11
|
+
version;
|
|
12
|
+
config;
|
|
13
|
+
options;
|
|
14
|
+
constructor(config, options) {
|
|
15
|
+
this.version = Plugin.version;
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.options = options;
|
|
18
|
+
}
|
|
19
|
+
getVersion() {
|
|
20
|
+
return this.version;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { plugin_utils_exports };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=plugin-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-utils.mjs","names":[],"sources":["../src/plugin-utils.ts"],"sourcesContent":["import type { Express, RequestHandler } from 'express';\nimport type { Readable, Writable } from 'node:stream';\n\nimport type {\n AllowAccess,\n Callback,\n Config,\n Logger,\n Manifest,\n PackageAccess,\n RemoteUser,\n Token,\n TokenFilter,\n} from '@verdaccio/types';\n\nimport type { VerdaccioError, searchUtils } from '.';\n\nexport interface PluginOptions {\n config: Config;\n logger: Logger;\n}\n\n/**\n * Base Plugin Class\n *\n * Set of utilities for developing plugins.\n */\nexport class Plugin<PluginConfig> {\n static version = 1;\n public readonly version: number;\n public readonly config: PluginConfig | unknown;\n public readonly options: PluginOptions;\n public constructor(config: PluginConfig, options: PluginOptions) {\n this.version = Plugin.version;\n this.config = config;\n this.options = options;\n }\n\n public getVersion() {\n return this.version;\n }\n}\n\n// --- STORAGE PLUGIN ---\n\n/**\n * Storage Handler\n *\n * Used in storage plugin for managing packages and tarballs.\n */\nexport interface StorageHandler {\n logger: Logger;\n deletePackage(fileName: string): Promise<void>;\n removePackage(packageName: string): Promise<void>;\n // next packages migration (this list is meant to replace the callback parent functions)\n updatePackage(\n packageName: string,\n handleUpdate: (manifest: Manifest) => Promise<Manifest>\n ): Promise<Manifest>;\n readPackage(packageName: string): Promise<Manifest>;\n savePackage(packageName: string, manifest: Manifest): Promise<void>;\n readTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Readable>;\n createPackage(packageName: string, manifest: Manifest): Promise<void>;\n writeTarball(fileName: string, { signal }: { signal: AbortSignal }): Promise<Writable>;\n // verify if tarball exist in the storage\n hasTarball(fileName: string): Promise<boolean>;\n // verify if package exist in the storage\n hasPackage(packageName: string): Promise<boolean>;\n}\n\n/**\n * Storage Plugin interface\n *\n * https://verdaccio.org/docs/plugin-storage\n */\nexport interface Storage<PluginConfig> extends Plugin<PluginConfig> {\n add(packageName: string): Promise<void>;\n remove(packageName: string): Promise<void>;\n get(): Promise<string[]>;\n init(): Promise<void>;\n getSecret(): Promise<string>;\n setSecret(secret: string): Promise<any>;\n getPackageStorage(packageName: string): StorageHandler;\n search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;\n saveToken(token: Token): Promise<any>;\n deleteToken(user: string, tokenKey: string): Promise<any>;\n readTokens(filter: TokenFilter): Promise<Token[]>;\n}\n\n// --- MIDDLEWARE PLUGIN ---\n\n/**\n * Middleware Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-middleware\n *\n * This function allow add middleware to the application.\n *\n * ```ts\n * import express, { Request, Response } from 'express';\n * \n * class Middleware extends Plugin {\n * // instances of auth and storage are injected\n * register_middlewares(app, auth, storage) {\n * const router = express.Router();\n * router.post('/my-endpoint', (req: Request, res: Response): void => {\n res.status(200).end();\n });\n * }\n * }\n *\n * const [plugin] = await asyncLoadPlugin(...);\n * plugin.register_middlewares(app, auth, storage);\n * ```\n */\nexport interface ExpressMiddleware<PluginConfig, Storage, Auth> extends Plugin<PluginConfig> {\n register_middlewares(app: Express, auth: Auth, storage: Storage): void;\n}\n\n// --- AUTH PLUGIN ---\n\nexport type AuthCallback = (error: VerdaccioError | null, groups?: string[] | false) => void;\n\nexport type AuthAccessCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AuthUserCallback = (error: VerdaccioError | null, access?: boolean | string) => void;\nexport type AuthChangePasswordCallback = (error: VerdaccioError | null, access?: boolean) => void;\nexport type AccessCallback = (error: VerdaccioError | null, ok?: boolean) => void;\n\nexport interface AuthPluginPackage {\n packageName: string;\n packageVersion?: string;\n tag?: string;\n}\n\n/**\n * Authentication Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-auth\n */\nexport interface Auth<T> extends Plugin<T> {\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public authenticate(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // always return an array of users\n return done(null, [user]); \n * }\n * ```\n */\n authenticate(user: string, password: string, cb: AuthCallback): void;\n /**\n * Handles the authenticated method.\n * ```ts\n * class Auth {\n public adduser(user: string, password: string, done: AuthCallback): void {\n if (!password) {\n return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));\n }\n // return boolean\n return done(null, true); \n * }\n * ```\n */\n adduser?(user: string, password: string, cb: AuthUserCallback): void;\n changePassword?(\n user: string,\n password: string,\n newPassword: string,\n cb: AuthChangePasswordCallback\n ): void;\n allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void;\n allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AccessCallback): void;\n allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AccessCallback): void;\n allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void;\n allow_unpublish?(\n user: RemoteUser,\n pkg: AllowAccess & PackageAccess,\n cb: AuthAccessCallback\n ): void;\n apiJWTmiddleware?(helpers: any): RequestHandler;\n}\n\nexport interface IBasicAuth {\n authenticate(user: string, password: string, cb: Callback): void;\n invalidateToken?(token: string): Promise<void>;\n changePassword(user: string, password: string, newPassword: string, cb: Callback): void;\n allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;\n add_user(user: string, password: string, cb: Callback): any;\n}\n\n// --- FILTER PLUGIN ---\n\n/**\n * Filter Plugin Interface\n *\n * https://verdaccio.org/docs/plugin-filter\n */\nexport interface ManifestFilter<T> extends Plugin<T> {\n filter_metadata(manifest: Manifest): Promise<Manifest>;\n}\n"],"mappings":";;;;;;;;AA2BA,IAAa,SAAb,MAAa,OAAqB;CAChC,OAAO,UAAU;CACjB;CACA;CACA;CACA,YAAmB,QAAsB,SAAwB;EAC/D,KAAK,UAAU,OAAO;EACtB,KAAK,SAAS;EACd,KAAK,UAAU;CACjB;CAEA,aAAoB;EAClB,OAAO,KAAK;CACd;AACF"}
|
|
@@ -1,48 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let ajv = require("ajv");
|
|
3
|
+
ajv = require_runtime.__toESM(ajv);
|
|
4
|
+
//#region src/schemes/publish-manifest.ts
|
|
5
|
+
var validate = new ajv.default().compile({
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
name: { type: "string" },
|
|
9
|
+
versions: {
|
|
10
|
+
type: "object",
|
|
11
|
+
maxProperties: 1
|
|
12
|
+
},
|
|
13
|
+
_attachments: {
|
|
14
|
+
type: "object",
|
|
15
|
+
maxProperties: 1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
required: [
|
|
19
|
+
"name",
|
|
20
|
+
"versions",
|
|
21
|
+
"_attachments"
|
|
22
|
+
],
|
|
23
|
+
additionalProperties: true
|
|
5
24
|
});
|
|
6
|
-
exports.validatePublishSingleVersion = validatePublishSingleVersion;
|
|
7
|
-
var _ajv = _interopRequireDefault(require("ajv"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const ajv = new _ajv.default();
|
|
10
|
-
|
|
11
|
-
// FIXME: this could extend from @verdaccio/types but we need
|
|
12
|
-
// schemas from @verdaccio/types to be able to validate them
|
|
13
|
-
|
|
14
|
-
const schema = {
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
name: {
|
|
18
|
-
type: 'string'
|
|
19
|
-
},
|
|
20
|
-
versions: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
maxProperties: 1
|
|
23
|
-
},
|
|
24
|
-
_attachments: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
maxProperties: 1
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
required: ['name', 'versions', '_attachments'],
|
|
30
|
-
additionalProperties: true
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// validate is a type guard for MyData - type is inferred from schema type
|
|
34
|
-
const validate = ajv.compile(schema);
|
|
35
|
-
|
|
36
25
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
* Validate if a manifest has the correct structure when a new package
|
|
27
|
+
* is being created. The properties name, versions and _attachments must contain 1 element.
|
|
28
|
+
* @param data a manifest object
|
|
29
|
+
* @returns boolean
|
|
30
|
+
*/
|
|
42
31
|
function validatePublishSingleVersion(manifest) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
return validate(manifest);
|
|
32
|
+
if (!manifest) return false;
|
|
33
|
+
return validate(manifest);
|
|
47
34
|
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.validatePublishSingleVersion = validatePublishSingleVersion;
|
|
37
|
+
|
|
48
38
|
//# sourceMappingURL=publish-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-manifest.js","names":[
|
|
1
|
+
{"version":3,"file":"publish-manifest.js","names":[],"sources":["../../src/schemes/publish-manifest.ts"],"sourcesContent":["import type { JSONSchemaType } from 'ajv';\nimport Ajv from 'ajv';\n\nconst ajv = new Ajv();\n\n// FIXME: this could extend from @verdaccio/types but we need\n// schemas from @verdaccio/types to be able to validate them\ninterface Manifest {\n name: string;\n versions: object;\n _attachments: object;\n}\n\nconst schema: JSONSchemaType<Manifest> = {\n type: 'object',\n properties: {\n name: { type: 'string' },\n versions: { type: 'object', maxProperties: 1 },\n _attachments: { type: 'object', maxProperties: 1 },\n },\n required: ['name', 'versions', '_attachments'],\n additionalProperties: true,\n};\n\n// validate is a type guard for MyData - type is inferred from schema type\nconst validate = ajv.compile(schema);\n\n/**\n * Validate if a manifest has the correct structure when a new package\n * is being created. The properties name, versions and _attachments must contain 1 element.\n * @param data a manifest object\n * @returns boolean\n */\nexport function validatePublishSingleVersion(manifest: any) {\n if (!manifest) {\n return false;\n }\n return validate(manifest);\n}\n"],"mappings":";;;;AAyBA,IAAM,WAAW,IAtBD,IAAA,QAsBC,EAAI,QAAQ;CAX3B,MAAM;CACN,YAAY;EACV,MAAM,EAAE,MAAM,SAAS;EACvB,UAAU;GAAE,MAAM;GAAU,eAAe;EAAE;EAC7C,cAAc;GAAE,MAAM;GAAU,eAAe;EAAE;CACnD;CACA,UAAU;EAAC;EAAQ;EAAY;CAAc;CAC7C,sBAAsB;AAIK,CAAM;;;;;;;AAQnC,SAAgB,6BAA6B,UAAe;CAC1D,IAAI,CAAC,UACH,OAAO;CAET,OAAO,SAAS,QAAQ;AAC1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
//#region src/schemes/publish-manifest.ts
|
|
3
|
+
var validate = new Ajv().compile({
|
|
4
|
+
type: "object",
|
|
5
|
+
properties: {
|
|
6
|
+
name: { type: "string" },
|
|
7
|
+
versions: {
|
|
8
|
+
type: "object",
|
|
9
|
+
maxProperties: 1
|
|
10
|
+
},
|
|
11
|
+
_attachments: {
|
|
12
|
+
type: "object",
|
|
13
|
+
maxProperties: 1
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
required: [
|
|
17
|
+
"name",
|
|
18
|
+
"versions",
|
|
19
|
+
"_attachments"
|
|
20
|
+
],
|
|
21
|
+
additionalProperties: true
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Validate if a manifest has the correct structure when a new package
|
|
25
|
+
* is being created. The properties name, versions and _attachments must contain 1 element.
|
|
26
|
+
* @param data a manifest object
|
|
27
|
+
* @returns boolean
|
|
28
|
+
*/
|
|
29
|
+
function validatePublishSingleVersion(manifest) {
|
|
30
|
+
if (!manifest) return false;
|
|
31
|
+
return validate(manifest);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { validatePublishSingleVersion };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=publish-manifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-manifest.mjs","names":[],"sources":["../../src/schemes/publish-manifest.ts"],"sourcesContent":["import type { JSONSchemaType } from 'ajv';\nimport Ajv from 'ajv';\n\nconst ajv = new Ajv();\n\n// FIXME: this could extend from @verdaccio/types but we need\n// schemas from @verdaccio/types to be able to validate them\ninterface Manifest {\n name: string;\n versions: object;\n _attachments: object;\n}\n\nconst schema: JSONSchemaType<Manifest> = {\n type: 'object',\n properties: {\n name: { type: 'string' },\n versions: { type: 'object', maxProperties: 1 },\n _attachments: { type: 'object', maxProperties: 1 },\n },\n required: ['name', 'versions', '_attachments'],\n additionalProperties: true,\n};\n\n// validate is a type guard for MyData - type is inferred from schema type\nconst validate = ajv.compile(schema);\n\n/**\n * Validate if a manifest has the correct structure when a new package\n * is being created. The properties name, versions and _attachments must contain 1 element.\n * @param data a manifest object\n * @returns boolean\n */\nexport function validatePublishSingleVersion(manifest: any) {\n if (!manifest) {\n return false;\n }\n return validate(manifest);\n}\n"],"mappings":";;AAyBA,IAAM,WAAW,IAtBD,IAsBC,EAAI,QAAQ;CAX3B,MAAM;CACN,YAAY;EACV,MAAM,EAAE,MAAM,SAAS;EACvB,UAAU;GAAE,MAAM;GAAU,eAAe;EAAE;EAC7C,cAAc;GAAE,MAAM;GAAU,eAAe;EAAE;CACnD;CACA,UAAU;EAAC;EAAQ;EAAY;CAAc;CAC7C,sBAAsB;AAIK,CAAM;;;;;;;AAQnC,SAAgB,6BAA6B,UAAe;CAC1D,IAAI,CAAC,UACH,OAAO;CAET,OAAO,SAAS,QAAQ;AAC1B"}
|
|
@@ -1,77 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let ajv = require("ajv");
|
|
3
|
+
ajv = require_runtime.__toESM(ajv);
|
|
4
|
+
//#region src/schemes/unpublish-manifest.ts
|
|
5
|
+
var validate = new ajv.default().compile({
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
name: { type: "string" },
|
|
9
|
+
versions: {
|
|
10
|
+
type: "object",
|
|
11
|
+
minProperties: 1
|
|
12
|
+
},
|
|
13
|
+
_rev: { type: "string" },
|
|
14
|
+
_id: { type: "string" },
|
|
15
|
+
time: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
created: { type: "string" },
|
|
19
|
+
modified: { type: "string" }
|
|
20
|
+
},
|
|
21
|
+
patternProperties: { "^[0-9]+\\.[0-9]+\\.[0-9]+-\\d+$": { type: "string" } },
|
|
22
|
+
additionalProperties: true
|
|
23
|
+
},
|
|
24
|
+
readme: { type: "string" },
|
|
25
|
+
"dist-tags": {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: { latest: { type: "string" } },
|
|
28
|
+
required: ["latest"],
|
|
29
|
+
additionalProperties: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: [
|
|
33
|
+
"name",
|
|
34
|
+
"versions",
|
|
35
|
+
"dist-tags",
|
|
36
|
+
"_rev",
|
|
37
|
+
"_id",
|
|
38
|
+
"readme",
|
|
39
|
+
"time"
|
|
40
|
+
],
|
|
41
|
+
additionalProperties: true
|
|
5
42
|
});
|
|
6
|
-
exports.validateUnPublishSingleVersion = validateUnPublishSingleVersion;
|
|
7
|
-
var _ajv = _interopRequireDefault(require("ajv"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const ajv = new _ajv.default();
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
const schema = {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
name: {
|
|
15
|
-
type: 'string'
|
|
16
|
-
},
|
|
17
|
-
versions: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
minProperties: 1
|
|
20
|
-
},
|
|
21
|
-
_rev: {
|
|
22
|
-
type: 'string'
|
|
23
|
-
},
|
|
24
|
-
_id: {
|
|
25
|
-
type: 'string'
|
|
26
|
-
},
|
|
27
|
-
time: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
properties: {
|
|
30
|
-
created: {
|
|
31
|
-
type: 'string'
|
|
32
|
-
},
|
|
33
|
-
modified: {
|
|
34
|
-
type: 'string'
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
patternProperties: {
|
|
38
|
-
'^[0-9]+\\.[0-9]+\\.[0-9]+-\\d+$': {
|
|
39
|
-
type: 'string'
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
additionalProperties: true
|
|
43
|
-
},
|
|
44
|
-
readme: {
|
|
45
|
-
type: 'string'
|
|
46
|
-
},
|
|
47
|
-
'dist-tags': {
|
|
48
|
-
type: 'object',
|
|
49
|
-
properties: {
|
|
50
|
-
latest: {
|
|
51
|
-
type: 'string'
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
required: ['latest'],
|
|
55
|
-
additionalProperties: true
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
required: ['name', 'versions', 'dist-tags', '_rev', '_id', 'readme', 'time'],
|
|
59
|
-
additionalProperties: true
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// validate is a type guard for MyData - type is inferred from schema type
|
|
63
|
-
const validate = ajv.compile(schema);
|
|
64
|
-
|
|
65
43
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
* Validate if a manifest has the correct structure when a new package
|
|
45
|
+
* is being created. The properties name, versions and _attachments must contain 1 element.
|
|
46
|
+
* @param data a manifest object
|
|
47
|
+
* @returns boolean
|
|
48
|
+
*/
|
|
71
49
|
function validateUnPublishSingleVersion(manifest) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
return validate(manifest);
|
|
50
|
+
if (!manifest) return false;
|
|
51
|
+
return validate(manifest);
|
|
76
52
|
}
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.validateUnPublishSingleVersion = validateUnPublishSingleVersion;
|
|
55
|
+
|
|
77
56
|
//# sourceMappingURL=unpublish-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpublish-manifest.js","names":[
|
|
1
|
+
{"version":3,"file":"unpublish-manifest.js","names":[],"sources":["../../src/schemes/unpublish-manifest.ts"],"sourcesContent":["import type { JSONSchemaType } from 'ajv';\nimport Ajv from 'ajv';\n\nconst ajv = new Ajv();\n\ninterface Manifest {\n name: string;\n versions: Record<string, unknown>;\n _rev: string;\n _id: string;\n time: {\n created: string;\n modified: string;\n [key: string]: string; // Allows pattern properties such as version numbers\n };\n readme: string;\n 'dist-tags': {\n latest: string;\n [key: string]: unknown; // Allows additional properties\n };\n}\n\n// @ts-ignore\nconst schema: JSONSchemaType<Manifest> = {\n type: 'object',\n properties: {\n name: { type: 'string' },\n versions: { type: 'object', minProperties: 1 },\n _rev: { type: 'string' },\n _id: { type: 'string' },\n time: {\n type: 'object',\n properties: {\n created: { type: 'string' },\n modified: { type: 'string' },\n },\n patternProperties: {\n '^[0-9]+\\\\.[0-9]+\\\\.[0-9]+-\\\\d+$': { type: 'string' },\n },\n additionalProperties: true,\n },\n readme: { type: 'string' },\n 'dist-tags': {\n type: 'object',\n properties: {\n latest: { type: 'string' },\n },\n required: ['latest'],\n additionalProperties: true,\n },\n },\n required: ['name', 'versions', 'dist-tags', '_rev', '_id', 'readme', 'time'],\n additionalProperties: true,\n};\n\n// validate is a type guard for MyData - type is inferred from schema type\nconst validate = ajv.compile(schema);\n\n/**\n * Validate if a manifest has the correct structure when a new package\n * is being created. The properties name, versions and _attachments must contain 1 element.\n * @param data a manifest object\n * @returns boolean\n */\nexport function validateUnPublishSingleVersion(manifest: any) {\n if (!manifest) {\n return false;\n }\n return validate(manifest);\n}\n"],"mappings":";;;;AAwDA,IAAM,WAAW,IArDD,IAAA,QAqDC,EAAI,QAAQ;CAhC3B,MAAM;CACN,YAAY;EACV,MAAM,EAAE,MAAM,SAAS;EACvB,UAAU;GAAE,MAAM;GAAU,eAAe;EAAE;EAC7C,MAAM,EAAE,MAAM,SAAS;EACvB,KAAK,EAAE,MAAM,SAAS;EACtB,MAAM;GACJ,MAAM;GACN,YAAY;IACV,SAAS,EAAE,MAAM,SAAS;IAC1B,UAAU,EAAE,MAAM,SAAS;GAC7B;GACA,mBAAmB,EACjB,mCAAmC,EAAE,MAAM,SAAS,EACtD;GACA,sBAAsB;EACxB;EACA,QAAQ,EAAE,MAAM,SAAS;EACzB,aAAa;GACX,MAAM;GACN,YAAY,EACV,QAAQ,EAAE,MAAM,SAAS,EAC3B;GACA,UAAU,CAAC,QAAQ;GACnB,sBAAsB;EACxB;CACF;CACA,UAAU;EAAC;EAAQ;EAAY;EAAa;EAAQ;EAAO;EAAU;CAAM;CAC3E,sBAAsB;AAIK,CAAM;;;;;;;AAQnC,SAAgB,+BAA+B,UAAe;CAC5D,IAAI,CAAC,UACH,OAAO;CAET,OAAO,SAAS,QAAQ;AAC1B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
//#region src/schemes/unpublish-manifest.ts
|
|
3
|
+
var validate = new Ajv().compile({
|
|
4
|
+
type: "object",
|
|
5
|
+
properties: {
|
|
6
|
+
name: { type: "string" },
|
|
7
|
+
versions: {
|
|
8
|
+
type: "object",
|
|
9
|
+
minProperties: 1
|
|
10
|
+
},
|
|
11
|
+
_rev: { type: "string" },
|
|
12
|
+
_id: { type: "string" },
|
|
13
|
+
time: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
created: { type: "string" },
|
|
17
|
+
modified: { type: "string" }
|
|
18
|
+
},
|
|
19
|
+
patternProperties: { "^[0-9]+\\.[0-9]+\\.[0-9]+-\\d+$": { type: "string" } },
|
|
20
|
+
additionalProperties: true
|
|
21
|
+
},
|
|
22
|
+
readme: { type: "string" },
|
|
23
|
+
"dist-tags": {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: { latest: { type: "string" } },
|
|
26
|
+
required: ["latest"],
|
|
27
|
+
additionalProperties: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
required: [
|
|
31
|
+
"name",
|
|
32
|
+
"versions",
|
|
33
|
+
"dist-tags",
|
|
34
|
+
"_rev",
|
|
35
|
+
"_id",
|
|
36
|
+
"readme",
|
|
37
|
+
"time"
|
|
38
|
+
],
|
|
39
|
+
additionalProperties: true
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Validate if a manifest has the correct structure when a new package
|
|
43
|
+
* is being created. The properties name, versions and _attachments must contain 1 element.
|
|
44
|
+
* @param data a manifest object
|
|
45
|
+
* @returns boolean
|
|
46
|
+
*/
|
|
47
|
+
function validateUnPublishSingleVersion(manifest) {
|
|
48
|
+
if (!manifest) return false;
|
|
49
|
+
return validate(manifest);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { validateUnPublishSingleVersion };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=unpublish-manifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unpublish-manifest.mjs","names":[],"sources":["../../src/schemes/unpublish-manifest.ts"],"sourcesContent":["import type { JSONSchemaType } from 'ajv';\nimport Ajv from 'ajv';\n\nconst ajv = new Ajv();\n\ninterface Manifest {\n name: string;\n versions: Record<string, unknown>;\n _rev: string;\n _id: string;\n time: {\n created: string;\n modified: string;\n [key: string]: string; // Allows pattern properties such as version numbers\n };\n readme: string;\n 'dist-tags': {\n latest: string;\n [key: string]: unknown; // Allows additional properties\n };\n}\n\n// @ts-ignore\nconst schema: JSONSchemaType<Manifest> = {\n type: 'object',\n properties: {\n name: { type: 'string' },\n versions: { type: 'object', minProperties: 1 },\n _rev: { type: 'string' },\n _id: { type: 'string' },\n time: {\n type: 'object',\n properties: {\n created: { type: 'string' },\n modified: { type: 'string' },\n },\n patternProperties: {\n '^[0-9]+\\\\.[0-9]+\\\\.[0-9]+-\\\\d+$': { type: 'string' },\n },\n additionalProperties: true,\n },\n readme: { type: 'string' },\n 'dist-tags': {\n type: 'object',\n properties: {\n latest: { type: 'string' },\n },\n required: ['latest'],\n additionalProperties: true,\n },\n },\n required: ['name', 'versions', 'dist-tags', '_rev', '_id', 'readme', 'time'],\n additionalProperties: true,\n};\n\n// validate is a type guard for MyData - type is inferred from schema type\nconst validate = ajv.compile(schema);\n\n/**\n * Validate if a manifest has the correct structure when a new package\n * is being created. The properties name, versions and _attachments must contain 1 element.\n * @param data a manifest object\n * @returns boolean\n */\nexport function validateUnPublishSingleVersion(manifest: any) {\n if (!manifest) {\n return false;\n }\n return validate(manifest);\n}\n"],"mappings":";;AAwDA,IAAM,WAAW,IArDD,IAqDC,EAAI,QAAQ;CAhC3B,MAAM;CACN,YAAY;EACV,MAAM,EAAE,MAAM,SAAS;EACvB,UAAU;GAAE,MAAM;GAAU,eAAe;EAAE;EAC7C,MAAM,EAAE,MAAM,SAAS;EACvB,KAAK,EAAE,MAAM,SAAS;EACtB,MAAM;GACJ,MAAM;GACN,YAAY;IACV,SAAS,EAAE,MAAM,SAAS;IAC1B,UAAU,EAAE,MAAM,SAAS;GAC7B;GACA,mBAAmB,EACjB,mCAAmC,EAAE,MAAM,SAAS,EACtD;GACA,sBAAsB;EACxB;EACA,QAAQ,EAAE,MAAM,SAAS;EACzB,aAAa;GACX,MAAM;GACN,YAAY,EACV,QAAQ,EAAE,MAAM,SAAS,EAC3B;GACA,UAAU,CAAC,QAAQ;GACnB,sBAAsB;EACxB;CACF;CACA,UAAU;EAAC;EAAQ;EAAY;EAAa;EAAQ;EAAO;EAAU;CAAM;CAC3E,sBAAsB;AAIK,CAAM;;;;;;;AAQnC,SAAgB,+BAA+B,UAAe;CAC5D,IAAI,CAAC,UACH,OAAO;CAET,OAAO,SAAS,QAAQ;AAC1B"}
|
package/build/search-utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/search-utils.ts
|
|
2
|
+
var search_utils_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.js").__exportAll({ UNSCOPED: () => UNSCOPED });
|
|
3
|
+
var UNSCOPED = "unscoped";
|
|
4
|
+
//#endregion
|
|
5
|
+
Object.defineProperty(exports, "search_utils_exports", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return search_utils_exports;
|
|
9
|
+
}
|
|
5
10
|
});
|
|
6
|
-
exports.UNSCOPED = void 0;
|
|
7
|
-
// @deprecated use @verdaccio/types
|
|
8
|
-
|
|
9
|
-
// @deprecated use @verdaccio/types
|
|
10
11
|
|
|
11
|
-
const UNSCOPED = exports.UNSCOPED = 'unscoped';
|
|
12
12
|
//# sourceMappingURL=search-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"search-utils.js","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["export type SearchMetrics = {\n quality: number;\n popularity: number;\n maintenance: number;\n};\nexport type UnStable = {\n flags?: {\n // if is false is not be included in search results (majority are stable)\n unstable?: boolean;\n };\n};\nexport type SearchItemPkg = {\n name: string;\n scoped?: string;\n path?: string;\n time?: number | Date;\n};\n\ntype PrivatePackage = {\n // note: prefixed to avoid external conflicts\n\n // the package is published as private\n verdaccioPrivate?: boolean;\n // if the package is not private but is cached\n verdaccioPkgCached?: boolean;\n};\n\nexport interface SearchItem extends UnStable, PrivatePackage {\n package: SearchItemPkg;\n score: Score;\n}\n\nexport type Score = {\n final: number;\n detail: SearchMetrics;\n};\n\nexport type SearchResults = {\n objects: SearchItemPkg[];\n total: number;\n time: string;\n};\n\n// @deprecated use @verdaccio/types\ntype PublisherMaintainer = {\n username: string;\n email: string;\n};\n\n// @deprecated use @verdaccio/types\nexport type SearchPackageBody = {\n name: string;\n scope: string;\n description: string;\n author: string | PublisherMaintainer;\n version: string;\n keywords: string | string[] | undefined;\n date: string;\n links?: {\n npm: string; // only include placeholder for URL eg: {url}/{packageName}\n homepage?: string;\n repository?: string;\n bugs?: string;\n };\n publisher?: any;\n maintainers?: PublisherMaintainer[];\n};\n\nexport interface SearchPackageItem extends UnStable, PrivatePackage {\n package: SearchPackageBody;\n score: Score;\n searchScore?: number;\n}\n\nexport const UNSCOPED = 'unscoped';\n\nexport type SearchQuery = {\n text: string;\n size?: number;\n from?: number;\n} & SearchMetrics;\n"],"mappings":";;AA0EA,IAAa,WAAW"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
//#region src/search-utils.ts
|
|
3
|
+
var search_utils_exports = /* @__PURE__ */ __exportAll({ UNSCOPED: () => UNSCOPED });
|
|
4
|
+
var UNSCOPED = "unscoped";
|
|
5
|
+
//#endregion
|
|
6
|
+
export { search_utils_exports };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=search-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-utils.mjs","names":[],"sources":["../src/search-utils.ts"],"sourcesContent":["export type SearchMetrics = {\n quality: number;\n popularity: number;\n maintenance: number;\n};\nexport type UnStable = {\n flags?: {\n // if is false is not be included in search results (majority are stable)\n unstable?: boolean;\n };\n};\nexport type SearchItemPkg = {\n name: string;\n scoped?: string;\n path?: string;\n time?: number | Date;\n};\n\ntype PrivatePackage = {\n // note: prefixed to avoid external conflicts\n\n // the package is published as private\n verdaccioPrivate?: boolean;\n // if the package is not private but is cached\n verdaccioPkgCached?: boolean;\n};\n\nexport interface SearchItem extends UnStable, PrivatePackage {\n package: SearchItemPkg;\n score: Score;\n}\n\nexport type Score = {\n final: number;\n detail: SearchMetrics;\n};\n\nexport type SearchResults = {\n objects: SearchItemPkg[];\n total: number;\n time: string;\n};\n\n// @deprecated use @verdaccio/types\ntype PublisherMaintainer = {\n username: string;\n email: string;\n};\n\n// @deprecated use @verdaccio/types\nexport type SearchPackageBody = {\n name: string;\n scope: string;\n description: string;\n author: string | PublisherMaintainer;\n version: string;\n keywords: string | string[] | undefined;\n date: string;\n links?: {\n npm: string; // only include placeholder for URL eg: {url}/{packageName}\n homepage?: string;\n repository?: string;\n bugs?: string;\n };\n publisher?: any;\n maintainers?: PublisherMaintainer[];\n};\n\nexport interface SearchPackageItem extends UnStable, PrivatePackage {\n package: SearchPackageBody;\n score: Score;\n searchScore?: number;\n}\n\nexport const UNSCOPED = 'unscoped';\n\nexport type SearchQuery = {\n text: string;\n size?: number;\n from?: number;\n} & SearchMetrics;\n"],"mappings":";;;AA0EA,IAAa,WAAW"}
|
package/build/stream-utils.d.ts
CHANGED
package/build/stream-utils.js
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
let node_stream = require("node:stream");
|
|
3
|
+
//#region src/stream-utils.ts
|
|
4
|
+
var stream_utils_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
5
|
+
readableToString: () => readableToString,
|
|
6
|
+
transformObjectToString: () => transformObjectToString
|
|
5
7
|
});
|
|
6
|
-
exports.transformObjectToString = exports.readableToString = void 0;
|
|
7
|
-
var _nodeStream = require("node:stream");
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
const buffer = Buffer.concat(chunks);
|
|
17
|
-
const str = buffer.toString('utf-8');
|
|
18
|
-
return str;
|
|
9
|
+
* Converts a buffer stream to a string.
|
|
10
|
+
*/
|
|
11
|
+
var readableToString = async (stream) => {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
for await (const chunk of stream) chunks.push(Buffer.from(chunk));
|
|
14
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
19
15
|
};
|
|
20
|
-
|
|
21
16
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
17
|
+
* Transform stream object mode to string
|
|
18
|
+
**/
|
|
19
|
+
var transformObjectToString = () => {
|
|
20
|
+
return new node_stream.Transform({
|
|
21
|
+
objectMode: true,
|
|
22
|
+
transform: (chunk, encoding, callback) => {
|
|
23
|
+
callback(null, JSON.stringify(chunk));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
32
26
|
};
|
|
33
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
Object.defineProperty(exports, "stream_utils_exports", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function() {
|
|
31
|
+
return stream_utils_exports;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
34
35
|
//# sourceMappingURL=stream-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-utils.js","names":[
|
|
1
|
+
{"version":3,"file":"stream-utils.js","names":[],"sources":["../src/stream-utils.ts"],"sourcesContent":["import type { Readable } from 'node:stream';\nimport { Transform } from 'node:stream';\n\n/**\n * Converts a buffer stream to a string.\n */\nconst readableToString = async (stream: Readable) => {\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(Buffer.from(chunk));\n }\n const buffer = Buffer.concat(chunks);\n const str = buffer.toString('utf-8');\n return str;\n};\n\n/**\n * Transform stream object mode to string\n **/\nconst transformObjectToString = () => {\n return new Transform({\n objectMode: true,\n transform: (chunk, encoding, callback) => {\n callback(null, JSON.stringify(chunk));\n },\n });\n};\n\nexport { readableToString, transformObjectToString };\n"],"mappings":";;;;;;;;;;AAMA,IAAM,mBAAmB,OAAO,WAAqB;CACnD,MAAM,SAAmB,CAAC;CAC1B,WAAW,MAAM,SAAS,QACxB,OAAO,KAAK,OAAO,KAAK,KAAK,CAAC;CAIhC,OAFe,OAAO,OAAO,MACjB,EAAO,SAAS,OACrB;AACT;;;;AAKA,IAAM,gCAAgC;CACpC,OAAO,IAAI,YAAA,UAAU;EACnB,YAAY;EACZ,YAAY,OAAO,UAAU,aAAa;GACxC,SAAS,MAAM,KAAK,UAAU,KAAK,CAAC;EACtC;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { Transform } from "node:stream";
|
|
3
|
+
//#region src/stream-utils.ts
|
|
4
|
+
var stream_utils_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
readableToString: () => readableToString,
|
|
6
|
+
transformObjectToString: () => transformObjectToString
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Converts a buffer stream to a string.
|
|
10
|
+
*/
|
|
11
|
+
var readableToString = async (stream) => {
|
|
12
|
+
const chunks = [];
|
|
13
|
+
for await (const chunk of stream) chunks.push(Buffer.from(chunk));
|
|
14
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Transform stream object mode to string
|
|
18
|
+
**/
|
|
19
|
+
var transformObjectToString = () => {
|
|
20
|
+
return new Transform({
|
|
21
|
+
objectMode: true,
|
|
22
|
+
transform: (chunk, encoding, callback) => {
|
|
23
|
+
callback(null, JSON.stringify(chunk));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { stream_utils_exports };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=stream-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-utils.mjs","names":[],"sources":["../src/stream-utils.ts"],"sourcesContent":["import type { Readable } from 'node:stream';\nimport { Transform } from 'node:stream';\n\n/**\n * Converts a buffer stream to a string.\n */\nconst readableToString = async (stream: Readable) => {\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(Buffer.from(chunk));\n }\n const buffer = Buffer.concat(chunks);\n const str = buffer.toString('utf-8');\n return str;\n};\n\n/**\n * Transform stream object mode to string\n **/\nconst transformObjectToString = () => {\n return new Transform({\n objectMode: true,\n transform: (chunk, encoding, callback) => {\n callback(null, JSON.stringify(chunk));\n },\n });\n};\n\nexport { readableToString, transformObjectToString };\n"],"mappings":";;;;;;;;;;AAMA,IAAM,mBAAmB,OAAO,WAAqB;CACnD,MAAM,SAAmB,CAAC;CAC1B,WAAW,MAAM,SAAS,QACxB,OAAO,KAAK,OAAO,KAAK,KAAK,CAAC;CAIhC,OAFe,OAAO,OAAO,MACjB,EAAO,SAAS,OACrB;AACT;;;;AAKA,IAAM,gCAAgC;CACpC,OAAO,IAAI,UAAU;EACnB,YAAY;EACZ,YAAY,OAAO,UAAU,aAAa;GACxC,SAAS,MAAM,KAAK,UAAU,KAAK,CAAC;EACtC;CACF,CAAC;AACH"}
|