@vitrine-kit/payload-blueprint 0.2.0 → 0.2.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/README.md +2 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# @vitrine-kit/payload-blueprint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vitrine's base Payload collections and the `extend()` API for **additively** extending their fields from features (contract 5, spec §5).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Скелет (M0). Наполняется в M2.
|
|
5
|
+
A feature adds fields (`extend('product', { addFields })`) without breaking existing ones. Shipped as a versioned package.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BlueprintFieldDef, Extend } from '@vitrine-kit/contracts';
|
|
|
3
3
|
interface BlueprintCollectionConfig {
|
|
4
4
|
slug: string;
|
|
5
5
|
fields: BlueprintFieldDef[];
|
|
6
|
-
/**
|
|
6
|
+
/** Other Payload collection options (admin, access, hooks, upload, auth, …). */
|
|
7
7
|
[option: string]: unknown;
|
|
8
8
|
}
|
|
9
9
|
declare const categoriesCollection: BlueprintCollectionConfig;
|
|
@@ -13,12 +13,12 @@ declare const variantsCollection: BlueprintCollectionConfig;
|
|
|
13
13
|
declare const productsCollection: BlueprintCollectionConfig;
|
|
14
14
|
declare const ordersCollection: BlueprintCollectionConfig;
|
|
15
15
|
declare const cartsCollection: BlueprintCollectionConfig;
|
|
16
|
-
/**
|
|
16
|
+
/** Base collections in a stable order. */
|
|
17
17
|
declare const baseCollections: BlueprintCollectionConfig[];
|
|
18
18
|
|
|
19
19
|
interface Blueprint {
|
|
20
20
|
extend: Extend;
|
|
21
|
-
/**
|
|
21
|
+
/** Assembles the base collections + additive extensions. */
|
|
22
22
|
build(): BlueprintCollectionConfig[];
|
|
23
23
|
}
|
|
24
24
|
declare function createBlueprint(): Blueprint;
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var variantsCollection = {
|
|
|
29
29
|
f("sku", "text", { required: true, unique: true, index: true }),
|
|
30
30
|
f("product", "relationship", { relationTo: "products", required: true }),
|
|
31
31
|
f("price", "number", { required: true }),
|
|
32
|
-
//
|
|
32
|
+
// minor units (e.g. cents)
|
|
33
33
|
f("stock", "number"),
|
|
34
34
|
f("options", "json")
|
|
35
35
|
// { size: 'M', color: 'red' }
|
|
@@ -66,7 +66,7 @@ var ordersCollection = {
|
|
|
66
66
|
f("paymentProvider", "text"),
|
|
67
67
|
// 'stripe' | 'paddle' | 'yookassa'
|
|
68
68
|
f("paymentRef", "text", { index: true }),
|
|
69
|
-
//
|
|
69
|
+
// webhook idempotency (dedup by payment reference)
|
|
70
70
|
f("createdAt", "date")
|
|
71
71
|
]
|
|
72
72
|
};
|
|
@@ -76,7 +76,7 @@ var cartsCollection = {
|
|
|
76
76
|
access: adminOnly,
|
|
77
77
|
fields: [
|
|
78
78
|
f("lines", "json"),
|
|
79
|
-
// CartLine[] (
|
|
79
|
+
// CartLine[] (contract); arithmetic lives in @vitrine-kit/core
|
|
80
80
|
f("currency", "text"),
|
|
81
81
|
f("subtotal", "number"),
|
|
82
82
|
f("discountTotal", "number"),
|
|
@@ -123,7 +123,7 @@ function createBlueprint() {
|
|
|
123
123
|
for (const field of adds) {
|
|
124
124
|
if (existing.has(field.name)) {
|
|
125
125
|
throw new Error(
|
|
126
|
-
`[vitrine] blueprint:
|
|
126
|
+
`[vitrine] blueprint: field "${field.name}" already exists in "${base.slug}" \u2014 extend() is additive only`
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
existing.add(field.name);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitrine-kit/payload-blueprint",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Vitrine —
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Vitrine — base Payload collections + additive extend().",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"directory": "packages/payload-blueprint"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@vitrine-kit/contracts": "1.
|
|
28
|
+
"@vitrine-kit/contracts": "1.2.0"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsup src/index.ts --format esm --dts --clean",
|