@uniformdev/canvas 20.71.2-alpha.14 → 20.71.2-alpha.19
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/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.esm.js +18 -0
- package/dist/index.js +18 -0
- package/dist/index.mjs +18 -0
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1658,6 +1658,8 @@ interface components$q {
|
|
|
1658
1658
|
* select.slots[except]=footer
|
|
1659
1659
|
* select.slots[depth]=2
|
|
1660
1660
|
* select.slots.<name>[depth]=1
|
|
1661
|
+
* select.fields[blockDepth]=2
|
|
1662
|
+
* select.fields[blockDepth]=preserveAll
|
|
1661
1663
|
*/
|
|
1662
1664
|
/**
|
|
1663
1665
|
* Prefix used by every `select.*` query parameter on the wire. Exported so
|
|
@@ -1677,6 +1679,22 @@ type FieldsProjection = {
|
|
|
1677
1679
|
* modifier; the pruner ignores this — see lib/canvas-sdk applyProjection.
|
|
1678
1680
|
*/
|
|
1679
1681
|
locales?: string[];
|
|
1682
|
+
/**
|
|
1683
|
+
* Controls how far projection descends into block-typed fields (`$block`).
|
|
1684
|
+
* A block field's value is an array of structured content, each with its own
|
|
1685
|
+
* fields, so projection can recurse into it like any other node.
|
|
1686
|
+
*
|
|
1687
|
+
* - Omitted (default): projection descends into blocks without limit,
|
|
1688
|
+
* applying `only`/`except` at every block level.
|
|
1689
|
+
* - A non-negative integer `N`: keep block nesting up to `N` levels. Block
|
|
1690
|
+
* fields on a node at depth `>= N` are dropped; `only`/`except` still
|
|
1691
|
+
* apply within the levels that are kept. `0` removes every block-typed
|
|
1692
|
+
* field; `1` keeps top-level blocks but not blocks nested inside them.
|
|
1693
|
+
* - `'preserveAll'`: Projection does not evaluate within blocks at all:
|
|
1694
|
+
* `only`/`except` do not apply to fields within blocks. The top level block field
|
|
1695
|
+
* is still subject to projection rules, but its descendants are not.
|
|
1696
|
+
*/
|
|
1697
|
+
blockDepth?: number | 'preserveAll';
|
|
1680
1698
|
};
|
|
1681
1699
|
type FieldTypesProjection = {
|
|
1682
1700
|
/** Include only fields whose `type` matches one of these patterns. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1658,6 +1658,8 @@ interface components$q {
|
|
|
1658
1658
|
* select.slots[except]=footer
|
|
1659
1659
|
* select.slots[depth]=2
|
|
1660
1660
|
* select.slots.<name>[depth]=1
|
|
1661
|
+
* select.fields[blockDepth]=2
|
|
1662
|
+
* select.fields[blockDepth]=preserveAll
|
|
1661
1663
|
*/
|
|
1662
1664
|
/**
|
|
1663
1665
|
* Prefix used by every `select.*` query parameter on the wire. Exported so
|
|
@@ -1677,6 +1679,22 @@ type FieldsProjection = {
|
|
|
1677
1679
|
* modifier; the pruner ignores this — see lib/canvas-sdk applyProjection.
|
|
1678
1680
|
*/
|
|
1679
1681
|
locales?: string[];
|
|
1682
|
+
/**
|
|
1683
|
+
* Controls how far projection descends into block-typed fields (`$block`).
|
|
1684
|
+
* A block field's value is an array of structured content, each with its own
|
|
1685
|
+
* fields, so projection can recurse into it like any other node.
|
|
1686
|
+
*
|
|
1687
|
+
* - Omitted (default): projection descends into blocks without limit,
|
|
1688
|
+
* applying `only`/`except` at every block level.
|
|
1689
|
+
* - A non-negative integer `N`: keep block nesting up to `N` levels. Block
|
|
1690
|
+
* fields on a node at depth `>= N` are dropped; `only`/`except` still
|
|
1691
|
+
* apply within the levels that are kept. `0` removes every block-typed
|
|
1692
|
+
* field; `1` keeps top-level blocks but not blocks nested inside them.
|
|
1693
|
+
* - `'preserveAll'`: Projection does not evaluate within blocks at all:
|
|
1694
|
+
* `only`/`except` do not apply to fields within blocks. The top level block field
|
|
1695
|
+
* is still subject to projection rules, but its descendants are not.
|
|
1696
|
+
*/
|
|
1697
|
+
blockDepth?: number | 'preserveAll';
|
|
1680
1698
|
};
|
|
1681
1699
|
type FieldTypesProjection = {
|
|
1682
1700
|
/** Include only fields whose `type` matches one of these patterns. */
|
package/dist/index.esm.js
CHANGED
|
@@ -70,6 +70,9 @@ function projectionToQuery(spec) {
|
|
|
70
70
|
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
71
71
|
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
72
72
|
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
73
|
+
if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
|
|
74
|
+
out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
|
|
75
|
+
}
|
|
73
76
|
}
|
|
74
77
|
if (fieldTypes) {
|
|
75
78
|
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
@@ -2765,6 +2768,18 @@ function parseDepth(value, key) {
|
|
|
2765
2768
|
}
|
|
2766
2769
|
return Number(str);
|
|
2767
2770
|
}
|
|
2771
|
+
function parseBlockDepth(value, key) {
|
|
2772
|
+
const str = toStringValue2(value);
|
|
2773
|
+
if (str === "preserveAll") {
|
|
2774
|
+
return "preserveAll";
|
|
2775
|
+
}
|
|
2776
|
+
if (str === void 0 || str === "" || !/^\d+$/.test(str)) {
|
|
2777
|
+
throw new Error(
|
|
2778
|
+
`Invalid select projection: '${key}' must be a non-negative integer or 'preserveAll' (got ${JSON.stringify(str)})`
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
return Number(str);
|
|
2782
|
+
}
|
|
2768
2783
|
function extractSelectKeys(source) {
|
|
2769
2784
|
if (source instanceof URLSearchParams) {
|
|
2770
2785
|
let out2;
|
|
@@ -2825,6 +2840,9 @@ function queryToProjection(source) {
|
|
|
2825
2840
|
case "locales":
|
|
2826
2841
|
fields.locales = parseCsv(value);
|
|
2827
2842
|
break;
|
|
2843
|
+
case "blockDepth":
|
|
2844
|
+
fields.blockDepth = parseBlockDepth(value, rawKey);
|
|
2845
|
+
break;
|
|
2828
2846
|
default:
|
|
2829
2847
|
throw new Error(`Invalid select projection: unsupported operator 'fields[${operator}]'`);
|
|
2830
2848
|
}
|
package/dist/index.js
CHANGED
|
@@ -279,6 +279,9 @@ function projectionToQuery(spec) {
|
|
|
279
279
|
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
280
280
|
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
281
281
|
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
282
|
+
if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
|
|
283
|
+
out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
|
|
284
|
+
}
|
|
282
285
|
}
|
|
283
286
|
if (fieldTypes) {
|
|
284
287
|
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
@@ -2974,6 +2977,18 @@ function parseDepth(value, key) {
|
|
|
2974
2977
|
}
|
|
2975
2978
|
return Number(str);
|
|
2976
2979
|
}
|
|
2980
|
+
function parseBlockDepth(value, key) {
|
|
2981
|
+
const str = toStringValue2(value);
|
|
2982
|
+
if (str === "preserveAll") {
|
|
2983
|
+
return "preserveAll";
|
|
2984
|
+
}
|
|
2985
|
+
if (str === void 0 || str === "" || !/^\d+$/.test(str)) {
|
|
2986
|
+
throw new Error(
|
|
2987
|
+
`Invalid select projection: '${key}' must be a non-negative integer or 'preserveAll' (got ${JSON.stringify(str)})`
|
|
2988
|
+
);
|
|
2989
|
+
}
|
|
2990
|
+
return Number(str);
|
|
2991
|
+
}
|
|
2977
2992
|
function extractSelectKeys(source) {
|
|
2978
2993
|
if (source instanceof URLSearchParams) {
|
|
2979
2994
|
let out2;
|
|
@@ -3034,6 +3049,9 @@ function queryToProjection(source) {
|
|
|
3034
3049
|
case "locales":
|
|
3035
3050
|
fields.locales = parseCsv(value);
|
|
3036
3051
|
break;
|
|
3052
|
+
case "blockDepth":
|
|
3053
|
+
fields.blockDepth = parseBlockDepth(value, rawKey);
|
|
3054
|
+
break;
|
|
3037
3055
|
default:
|
|
3038
3056
|
throw new Error(`Invalid select projection: unsupported operator 'fields[${operator}]'`);
|
|
3039
3057
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -70,6 +70,9 @@ function projectionToQuery(spec) {
|
|
|
70
70
|
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
71
71
|
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
72
72
|
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
73
|
+
if (fields.blockDepth === "preserveAll" || typeof fields.blockDepth === "number") {
|
|
74
|
+
out[`${p}fields[blockDepth]`] = String(fields.blockDepth);
|
|
75
|
+
}
|
|
73
76
|
}
|
|
74
77
|
if (fieldTypes) {
|
|
75
78
|
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
@@ -2765,6 +2768,18 @@ function parseDepth(value, key) {
|
|
|
2765
2768
|
}
|
|
2766
2769
|
return Number(str);
|
|
2767
2770
|
}
|
|
2771
|
+
function parseBlockDepth(value, key) {
|
|
2772
|
+
const str = toStringValue2(value);
|
|
2773
|
+
if (str === "preserveAll") {
|
|
2774
|
+
return "preserveAll";
|
|
2775
|
+
}
|
|
2776
|
+
if (str === void 0 || str === "" || !/^\d+$/.test(str)) {
|
|
2777
|
+
throw new Error(
|
|
2778
|
+
`Invalid select projection: '${key}' must be a non-negative integer or 'preserveAll' (got ${JSON.stringify(str)})`
|
|
2779
|
+
);
|
|
2780
|
+
}
|
|
2781
|
+
return Number(str);
|
|
2782
|
+
}
|
|
2768
2783
|
function extractSelectKeys(source) {
|
|
2769
2784
|
if (source instanceof URLSearchParams) {
|
|
2770
2785
|
let out2;
|
|
@@ -2825,6 +2840,9 @@ function queryToProjection(source) {
|
|
|
2825
2840
|
case "locales":
|
|
2826
2841
|
fields.locales = parseCsv(value);
|
|
2827
2842
|
break;
|
|
2843
|
+
case "blockDepth":
|
|
2844
|
+
fields.blockDepth = parseBlockDepth(value, rawKey);
|
|
2845
|
+
break;
|
|
2828
2846
|
default:
|
|
2829
2847
|
throw new Error(`Invalid select projection: unsupported operator 'fields[${operator}]'`);
|
|
2830
2848
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas",
|
|
3
|
-
"version": "20.71.2-alpha.
|
|
3
|
+
"version": "20.71.2-alpha.19+29ab6d7f60",
|
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"svix": "1.96.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@uniformdev/assets": "20.71.2-alpha.
|
|
40
|
-
"@uniformdev/context": "20.71.2-alpha.
|
|
41
|
-
"@uniformdev/richtext": "20.71.2-alpha.
|
|
39
|
+
"@uniformdev/assets": "20.71.2-alpha.19+29ab6d7f60",
|
|
40
|
+
"@uniformdev/context": "20.71.2-alpha.19+29ab6d7f60",
|
|
41
|
+
"@uniformdev/richtext": "20.71.2-alpha.19+29ab6d7f60",
|
|
42
42
|
"immer": "11.1.8",
|
|
43
43
|
"p-limit": "6.2.0",
|
|
44
44
|
"p-retry": "6.2.1",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "29ab6d7f60af8eee4244b495f391611999326075"
|
|
54
54
|
}
|