@ucdjs/pipelines-artifacts 0.0.1-beta.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Lucas Nørgård
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @ucdjs/pipelines-artifacts
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![codecov][codecov-src]][codecov-href]
6
+
7
+ > [!IMPORTANT]
8
+ > This is an internal package. It may change without warning and is not subject to semantic versioning. Use at your own risk.
9
+
10
+ A collection of core pipeline functionalities for the UCD project.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @ucdjs/pipelines-artifacts
16
+ ```
17
+
18
+ ## 📄 License
19
+
20
+ Published under [MIT License](./LICENSE).
21
+
22
+ [npm-version-src]: https://img.shields.io/npm/v/@ucdjs/pipelines-artifacts?style=flat&colorA=18181B&colorB=4169E1
23
+ [npm-version-href]: https://npmjs.com/package/@ucdjs/pipelines-artifacts
24
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@ucdjs/pipelines-artifacts?style=flat&colorA=18181B&colorB=4169E1
25
+ [npm-downloads-href]: https://npmjs.com/package/@ucdjs/pipelines-artifacts
26
+ [codecov-src]: https://img.shields.io/codecov/c/gh/ucdjs/ucd?style=flat&colorA=18181B&colorB=4169E1
27
+ [codecov-href]: https://codecov.io/gh/ucdjs/ucd
@@ -0,0 +1,40 @@
1
+ import { ParseContext, ParsedRow, PipelineFilter } from "@ucdjs/pipelines-core";
2
+ import { z } from "zod";
3
+
4
+ //#region src/definition.d.ts
5
+ interface ArtifactBuildContext {
6
+ version: string;
7
+ }
8
+ interface PipelineArtifactDefinition<TId extends string = string, TValue = unknown> {
9
+ id: TId;
10
+ filter?: PipelineFilter;
11
+ parser?: (ctx: ParseContext) => AsyncIterable<ParsedRow>;
12
+ build: (ctx: ArtifactBuildContext, rows?: AsyncIterable<ParsedRow>) => Promise<TValue>;
13
+ }
14
+ declare function definePipelineArtifact<const TId extends string, TValue>(definition: PipelineArtifactDefinition<TId, TValue>): PipelineArtifactDefinition<TId, TValue>;
15
+ type InferArtifactId<T> = T extends PipelineArtifactDefinition<infer TId, unknown> ? TId : never;
16
+ type InferArtifactValue<T> = T extends PipelineArtifactDefinition<string, infer TValue> ? TValue : never;
17
+ type InferArtifactsMap<T extends readonly PipelineArtifactDefinition[]> = { [K in T[number] as InferArtifactId<K>]: InferArtifactValue<K> };
18
+ declare function isPipelineArtifactDefinition(value: unknown): value is PipelineArtifactDefinition;
19
+ //#endregion
20
+ //#region src/schema.d.ts
21
+ interface Artifact<TSchema extends z.ZodType = z.ZodType> {
22
+ _type: "artifact";
23
+ schema: TSchema;
24
+ scope: "version";
25
+ }
26
+ interface GlobalArtifact<TSchema extends z.ZodType = z.ZodType> {
27
+ _type: "global-artifact";
28
+ schema: TSchema;
29
+ scope: "global";
30
+ }
31
+ type ArtifactDefinition<TSchema extends z.ZodType = z.ZodType> = Artifact<TSchema> | GlobalArtifact<TSchema>;
32
+ declare function artifact<TSchema extends z.ZodType>(schema: TSchema): Artifact<TSchema>;
33
+ declare function artifact<TSchema extends z.ZodType>(schema: TSchema, scope: "version"): Artifact<TSchema>;
34
+ declare function artifact<TSchema extends z.ZodType>(schema: TSchema, scope: "global"): GlobalArtifact<TSchema>;
35
+ type InferArtifactSchemaType<T extends ArtifactDefinition> = T extends ArtifactDefinition<infer TSchema> ? z.infer<TSchema> : never;
36
+ type InferEmittedArtifacts<TEmits extends Record<string, ArtifactDefinition>> = { [K in keyof TEmits]: InferArtifactSchemaType<TEmits[K]> };
37
+ declare function isGlobalArtifact<TSchema extends z.ZodType>(def: ArtifactDefinition<TSchema>): def is GlobalArtifact<TSchema>;
38
+ declare function isVersionArtifact<TSchema extends z.ZodType>(def: ArtifactDefinition<TSchema>): def is Artifact<TSchema>;
39
+ //#endregion
40
+ export { type Artifact, type ArtifactBuildContext, type ArtifactDefinition, type GlobalArtifact, type InferArtifactId, type InferArtifactSchemaType, type InferArtifactValue, type InferArtifactsMap, type InferEmittedArtifacts, type PipelineArtifactDefinition, artifact, definePipelineArtifact, isGlobalArtifact, isPipelineArtifactDefinition, isVersionArtifact };
package/dist/index.mjs ADDED
@@ -0,0 +1,31 @@
1
+ //#region src/definition.ts
2
+ function definePipelineArtifact(definition) {
3
+ return definition;
4
+ }
5
+ function isPipelineArtifactDefinition(value) {
6
+ return typeof value === "object" && value !== null && !Array.isArray(value) && "id" in value && "build" in value && typeof value.id === "string" && typeof value.build === "function" && (!("filter" in value) || typeof value.filter === "function") && (!("parser" in value) || typeof value.parser === "function");
7
+ }
8
+
9
+ //#endregion
10
+ //#region src/schema.ts
11
+ function artifact(schema, scope) {
12
+ if (scope === "global") return {
13
+ _type: "global-artifact",
14
+ schema,
15
+ scope: "global"
16
+ };
17
+ return {
18
+ _type: "artifact",
19
+ schema,
20
+ scope: "version"
21
+ };
22
+ }
23
+ function isGlobalArtifact(def) {
24
+ return def._type === "global-artifact";
25
+ }
26
+ function isVersionArtifact(def) {
27
+ return def._type === "artifact";
28
+ }
29
+
30
+ //#endregion
31
+ export { artifact, definePipelineArtifact, isGlobalArtifact, isPipelineArtifactDefinition, isVersionArtifact };
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@ucdjs/pipelines-artifacts",
3
+ "version": "0.0.1-beta.1",
4
+ "type": "module",
5
+ "author": {
6
+ "name": "Lucas Nørgård",
7
+ "email": "lucasnrgaard@gmail.com",
8
+ "url": "https://luxass.dev"
9
+ },
10
+ "license": "MIT",
11
+ "homepage": "https://github.com/ucdjs/ucd",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/ucdjs/ucd.git",
15
+ "directory": "packages/pipelines/pipeline-artifacts"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/ucdjs/ucd/issues"
19
+ },
20
+ "exports": {
21
+ ".": "./dist/index.mjs",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "types": "./dist/index.d.mts",
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "engines": {
29
+ "node": ">=22.18"
30
+ },
31
+ "dependencies": {
32
+ "zod": "4.3.6",
33
+ "@ucdjs/pipelines-core": "0.0.1-beta.1"
34
+ },
35
+ "devDependencies": {
36
+ "@luxass/eslint-config": "7.2.0",
37
+ "eslint": "10.0.0",
38
+ "publint": "0.3.17",
39
+ "tsdown": "0.20.3",
40
+ "typescript": "5.9.3",
41
+ "@ucdjs-tooling/tsconfig": "1.0.0",
42
+ "@ucdjs-tooling/tsdown-config": "1.0.0"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "build": "tsdown --tsconfig=./tsconfig.build.json",
49
+ "dev": "tsdown --watch",
50
+ "clean": "git clean -xdf dist node_modules",
51
+ "lint": "eslint .",
52
+ "typecheck": "tsc --noEmit -p tsconfig.build.json"
53
+ }
54
+ }