@teleporthq/teleport-plugin-next-data-source 0.43.66 → 0.43.67
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/__tests__/array-mapper-cache-wiring.test.ts +11 -0
- package/__tests__/data-source-request-locale.test.ts +313 -0
- package/__tests__/gated-data-provider.test.ts +88 -0
- package/__tests__/localized-columns.test.ts +217 -0
- package/__tests__/numbered-pagination.test.ts +15 -0
- package/__tests__/product-filter-fields.ts +230 -0
- package/__tests__/product-filter-sql.fixture.json +7 -0
- package/__tests__/refetch-loading-state.test.ts +23 -0
- package/__tests__/search-clear-button.test.ts +122 -0
- package/dist/cjs/content-localization.d.ts +37 -0
- package/dist/cjs/content-localization.d.ts.map +1 -0
- package/dist/cjs/content-localization.js +29 -0
- package/dist/cjs/content-localization.js.map +1 -0
- package/dist/cjs/count-effect.d.ts +11 -1
- package/dist/cjs/count-effect.d.ts.map +1 -1
- package/dist/cjs/count-effect.js +30 -2
- package/dist/cjs/count-effect.js.map +1 -1
- package/dist/cjs/fetchers/airtable.d.ts.map +1 -1
- package/dist/cjs/fetchers/airtable.js +1 -1
- package/dist/cjs/fetchers/airtable.js.map +1 -1
- package/dist/cjs/fetchers/clickhouse.d.ts.map +1 -1
- package/dist/cjs/fetchers/clickhouse.js +1 -1
- package/dist/cjs/fetchers/clickhouse.js.map +1 -1
- package/dist/cjs/fetchers/firestore.d.ts.map +1 -1
- package/dist/cjs/fetchers/firestore.js +1 -1
- package/dist/cjs/fetchers/firestore.js.map +1 -1
- package/dist/cjs/fetchers/mariadb.d.ts.map +1 -1
- package/dist/cjs/fetchers/mariadb.js +1 -1
- package/dist/cjs/fetchers/mariadb.js.map +1 -1
- package/dist/cjs/fetchers/mongodb.d.ts.map +1 -1
- package/dist/cjs/fetchers/mongodb.js +1 -1
- package/dist/cjs/fetchers/mongodb.js.map +1 -1
- package/dist/cjs/fetchers/mysql.d.ts.map +1 -1
- package/dist/cjs/fetchers/mysql.js +1 -1
- package/dist/cjs/fetchers/mysql.js.map +1 -1
- package/dist/cjs/fetchers/postgresql.d.ts.map +1 -1
- package/dist/cjs/fetchers/postgresql.js +2 -1
- package/dist/cjs/fetchers/postgresql.js.map +1 -1
- package/dist/cjs/fetchers/redshift.d.ts.map +1 -1
- package/dist/cjs/fetchers/redshift.js +1 -1
- package/dist/cjs/fetchers/redshift.js.map +1 -1
- package/dist/cjs/fetchers/teleport.d.ts.map +1 -1
- package/dist/cjs/fetchers/teleport.js +10 -3
- package/dist/cjs/fetchers/teleport.js.map +1 -1
- package/dist/cjs/fetchers/turso.d.ts.map +1 -1
- package/dist/cjs/fetchers/turso.js +1 -1
- package/dist/cjs/fetchers/turso.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +60 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/loading-state.d.ts +16 -1
- package/dist/cjs/loading-state.d.ts.map +1 -1
- package/dist/cjs/loading-state.js +69 -3
- package/dist/cjs/loading-state.js.map +1 -1
- package/dist/cjs/localized-columns.d.ts +56 -0
- package/dist/cjs/localized-columns.d.ts.map +1 -0
- package/dist/cjs/localized-columns.js +124 -0
- package/dist/cjs/localized-columns.js.map +1 -0
- package/dist/cjs/pagination-plugin.d.ts.map +1 -1
- package/dist/cjs/pagination-plugin.js +123 -45
- package/dist/cjs/pagination-plugin.js.map +1 -1
- package/dist/cjs/product-filter-fields.d.ts +87 -0
- package/dist/cjs/product-filter-fields.d.ts.map +1 -0
- package/dist/cjs/product-filter-fields.js +161 -0
- package/dist/cjs/product-filter-fields.js.map +1 -0
- package/dist/cjs/request-locale.d.ts +49 -0
- package/dist/cjs/request-locale.d.ts.map +1 -0
- package/dist/cjs/request-locale.js +130 -0
- package/dist/cjs/request-locale.js.map +1 -0
- package/dist/cjs/search-clear.d.ts +31 -0
- package/dist/cjs/search-clear.d.ts.map +1 -0
- package/dist/cjs/search-clear.js +103 -0
- package/dist/cjs/search-clear.js.map +1 -0
- package/dist/cjs/transformations/index.d.ts +16 -2
- package/dist/cjs/transformations/index.d.ts.map +1 -1
- package/dist/cjs/transformations/index.js +14 -2
- package/dist/cjs/transformations/index.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/utils.d.ts +11 -1
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +59 -15
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/content-localization.d.ts +37 -0
- package/dist/esm/content-localization.d.ts.map +1 -0
- package/dist/esm/content-localization.js +24 -0
- package/dist/esm/content-localization.js.map +1 -0
- package/dist/esm/count-effect.d.ts +11 -1
- package/dist/esm/count-effect.d.ts.map +1 -1
- package/dist/esm/count-effect.js +28 -1
- package/dist/esm/count-effect.js.map +1 -1
- package/dist/esm/fetchers/airtable.d.ts.map +1 -1
- package/dist/esm/fetchers/airtable.js +1 -1
- package/dist/esm/fetchers/airtable.js.map +1 -1
- package/dist/esm/fetchers/clickhouse.d.ts.map +1 -1
- package/dist/esm/fetchers/clickhouse.js +1 -1
- package/dist/esm/fetchers/clickhouse.js.map +1 -1
- package/dist/esm/fetchers/firestore.d.ts.map +1 -1
- package/dist/esm/fetchers/firestore.js +1 -1
- package/dist/esm/fetchers/firestore.js.map +1 -1
- package/dist/esm/fetchers/mariadb.d.ts.map +1 -1
- package/dist/esm/fetchers/mariadb.js +1 -1
- package/dist/esm/fetchers/mariadb.js.map +1 -1
- package/dist/esm/fetchers/mongodb.d.ts.map +1 -1
- package/dist/esm/fetchers/mongodb.js +1 -1
- package/dist/esm/fetchers/mongodb.js.map +1 -1
- package/dist/esm/fetchers/mysql.d.ts.map +1 -1
- package/dist/esm/fetchers/mysql.js +1 -1
- package/dist/esm/fetchers/mysql.js.map +1 -1
- package/dist/esm/fetchers/postgresql.d.ts.map +1 -1
- package/dist/esm/fetchers/postgresql.js +2 -1
- package/dist/esm/fetchers/postgresql.js.map +1 -1
- package/dist/esm/fetchers/redshift.d.ts.map +1 -1
- package/dist/esm/fetchers/redshift.js +1 -1
- package/dist/esm/fetchers/redshift.js.map +1 -1
- package/dist/esm/fetchers/teleport.d.ts.map +1 -1
- package/dist/esm/fetchers/teleport.js +10 -3
- package/dist/esm/fetchers/teleport.js.map +1 -1
- package/dist/esm/fetchers/turso.d.ts.map +1 -1
- package/dist/esm/fetchers/turso.js +1 -1
- package/dist/esm/fetchers/turso.js.map +1 -1
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +55 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loading-state.d.ts +16 -1
- package/dist/esm/loading-state.d.ts.map +1 -1
- package/dist/esm/loading-state.js +69 -3
- package/dist/esm/loading-state.js.map +1 -1
- package/dist/esm/localized-columns.d.ts +56 -0
- package/dist/esm/localized-columns.d.ts.map +1 -0
- package/dist/esm/localized-columns.js +119 -0
- package/dist/esm/localized-columns.js.map +1 -0
- package/dist/esm/pagination-plugin.d.ts.map +1 -1
- package/dist/esm/pagination-plugin.js +124 -46
- package/dist/esm/pagination-plugin.js.map +1 -1
- package/dist/esm/product-filter-fields.d.ts +87 -0
- package/dist/esm/product-filter-fields.d.ts.map +1 -0
- package/dist/esm/product-filter-fields.js +154 -0
- package/dist/esm/product-filter-fields.js.map +1 -0
- package/dist/esm/request-locale.d.ts +49 -0
- package/dist/esm/request-locale.d.ts.map +1 -0
- package/dist/esm/request-locale.js +98 -0
- package/dist/esm/request-locale.js.map +1 -0
- package/dist/esm/search-clear.d.ts +31 -0
- package/dist/esm/search-clear.d.ts.map +1 -0
- package/dist/esm/search-clear.js +74 -0
- package/dist/esm/search-clear.js.map +1 -0
- package/dist/esm/transformations/index.d.ts +16 -2
- package/dist/esm/transformations/index.d.ts.map +1 -1
- package/dist/esm/transformations/index.js +14 -2
- package/dist/esm/transformations/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/utils.d.ts +11 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +59 -15
- package/dist/esm/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/content-localization.ts +53 -0
- package/src/count-effect.ts +53 -2
- package/src/fetchers/airtable.ts +4 -2
- package/src/fetchers/clickhouse.ts +4 -2
- package/src/fetchers/firestore.ts +4 -2
- package/src/fetchers/mariadb.ts +4 -2
- package/src/fetchers/mongodb.ts +4 -2
- package/src/fetchers/mysql.ts +4 -2
- package/src/fetchers/postgresql.ts +16 -2
- package/src/fetchers/redshift.ts +4 -2
- package/src/fetchers/teleport.ts +48 -9
- package/src/fetchers/turso.ts +4 -2
- package/src/index.ts +79 -11
- package/src/loading-state.ts +134 -3
- package/src/localized-columns.ts +133 -0
- package/src/pagination-plugin.ts +177 -53
- package/src/product-filter-fields.ts +173 -0
- package/src/request-locale.ts +113 -0
- package/src/search-clear.ts +102 -0
- package/src/transformations/index.ts +30 -5
- package/src/utils.ts +83 -15
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filtering a products list on things that are not a plain column.
|
|
3
|
+
*
|
|
4
|
+
* The storefront's product filters ask questions the `teleport_products` row
|
|
5
|
+
* cannot answer with a single column comparison: "what does it cost right now"
|
|
6
|
+
* (`price` net of a live markdown), "how many stars" (an aggregate over the
|
|
7
|
+
* reviews table), "is it on sale", and "does it come in size XL" (a value
|
|
8
|
+
* inside the `variant_options` JSON). Like the discount-aware sort in
|
|
9
|
+
* `product-price-sort.ts`, these have to be answered by the DATABASE — the list
|
|
10
|
+
* is paginated, so filtering the fetched page would only filter 20 of N rows.
|
|
11
|
+
*
|
|
12
|
+
* The editor emits such a filter as an ordinary condition whose `source` is
|
|
13
|
+
* one of the VIRTUAL field names below. Every SQL builder that can receive a
|
|
14
|
+
* products filter rewrites them into the expressions here:
|
|
15
|
+
*
|
|
16
|
+
* - this file → the generated store's `teleport_products` API route
|
|
17
|
+
* (`fetchers/teleport.ts`, `fetchers/postgresql.ts`);
|
|
18
|
+
* - `database-provider-worker/src/lib/product-filter-fields.ts` → the editor
|
|
19
|
+
* canvas. ⛔ A byte-for-byte mirror of the SQL below; both repos pin the
|
|
20
|
+
* strings with a test, because a clause the canvas cannot build is an HTTP
|
|
21
|
+
* 500 the canvas draws as an EMPTY grid.
|
|
22
|
+
*
|
|
23
|
+
* ## The expressions cannot raise
|
|
24
|
+
*
|
|
25
|
+
* Same discipline as the sort: the JSON column is cast only when its text
|
|
26
|
+
* already looks like an array, the axis key is validated against a slug pattern
|
|
27
|
+
* before it is bound, and an unknown key filters to no rows instead of erroring
|
|
28
|
+
* — a filter that the database rejects would empty the whole products page.
|
|
29
|
+
*/
|
|
30
|
+
import { PRODUCTS_TABLE_NAME, PRODUCT_PRICE_SORT_FIELD, buildProductEffectivePriceSql, supportsProductPriceSort, } from './product-price-sort';
|
|
31
|
+
/** The reviews table the star-rating aggregate reads. Exists once reviews were enabled. */
|
|
32
|
+
export var PRODUCT_REVIEWS_TABLE_NAME = 'teleport_product_reviews';
|
|
33
|
+
/** Virtual field: the product's star bucket — `ROUND(AVG(approved rating))`, 1..5, NULL when unreviewed. */
|
|
34
|
+
export var PRODUCT_RATING_FILTER_FIELD = 'rating';
|
|
35
|
+
/** Virtual field: `'true'` while a markdown is live, else `'false'`. */
|
|
36
|
+
export var PRODUCT_ON_SALE_FILTER_FIELD = 'on_sale';
|
|
37
|
+
/**
|
|
38
|
+
* Virtual field family: `variant_options.<axisKey>` — the product offers the
|
|
39
|
+
* axis (e.g. `size`) in one of the given values (e.g. `xl`).
|
|
40
|
+
*/
|
|
41
|
+
export var PRODUCT_VARIANT_AXIS_FILTER_PREFIX = 'variant_options.';
|
|
42
|
+
/**
|
|
43
|
+
* What an axis key may look like. Keys are produced by the editor's slug
|
|
44
|
+
* helper (`deriveOptionKey`), so this is what every real key matches; anything
|
|
45
|
+
* else is refused before it can reach the database.
|
|
46
|
+
*/
|
|
47
|
+
export var PRODUCT_VARIANT_AXIS_KEY_PATTERN = '^[a-z0-9][a-z0-9_-]{0,63}$';
|
|
48
|
+
/** Generic multi-value operand: the column equals ANY of the destination values. */
|
|
49
|
+
export var IN_OPERAND = 'in';
|
|
50
|
+
/**
|
|
51
|
+
* `ROUND(AVG(rating))` over the product's APPROVED reviews. Only approved rows
|
|
52
|
+
* count — moderation is the merchant's veto — and the outer row is the
|
|
53
|
+
* unaliased `teleport_products` the fetchers select from.
|
|
54
|
+
*/
|
|
55
|
+
export var buildProductRatingBucketSql = function () {
|
|
56
|
+
return "(SELECT ROUND(AVG(r.rating)) FROM ".concat(PRODUCT_REVIEWS_TABLE_NAME, " r WHERE r.product_id = ").concat(PRODUCTS_TABLE_NAME, ".id AND r.status = 'approved' AND r.rating IS NOT NULL)");
|
|
57
|
+
};
|
|
58
|
+
/** `'true'` when the price paid today is below the list price, i.e. a markdown is live. */
|
|
59
|
+
export var buildProductOnSaleSql = function () {
|
|
60
|
+
return "(CASE WHEN ".concat(buildProductEffectivePriceSql(), " < \"price\"::numeric THEN 'true' ELSE 'false' END)");
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Only text that already looks like a JSON array is cast; NULL, empty or a
|
|
64
|
+
* hand-edited scalar reads as "no variant axes".
|
|
65
|
+
*/
|
|
66
|
+
export var SAFE_VARIANT_OPTIONS_JSONB = "CASE\n WHEN \"variant_options\" IS NULL OR btrim(\"variant_options\") NOT LIKE '[%' THEN '[]'::jsonb\n ELSE \"variant_options\"::jsonb\n END";
|
|
67
|
+
/**
|
|
68
|
+
* True when the product declares the axis bound to `keyParam` with at least one
|
|
69
|
+
* of the values bound to `valuesParam` (a `text[]`). Both are PARAMETERS, never
|
|
70
|
+
* interpolated text.
|
|
71
|
+
*/
|
|
72
|
+
export var buildProductVariantAxisExistsSql = function (keyParam, valuesParam) {
|
|
73
|
+
return "EXISTS (SELECT 1 FROM jsonb_array_elements(".concat(SAFE_VARIANT_OPTIONS_JSONB, ") AS ax, jsonb_array_elements(CASE WHEN jsonb_typeof(ax->'values') = 'array' THEN ax->'values' ELSE '[]'::jsonb END) AS v WHERE ax->>'key' = ").concat(keyParam, " AND v->>'value' = ANY(").concat(valuesParam, "::text[]))");
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The complete `productFilterClause(field, operand, value, pushParam)` helper a
|
|
77
|
+
* SQL fetcher embeds in its generated route.
|
|
78
|
+
*
|
|
79
|
+
* Returns a finished WHERE clause for a virtual (or rewritten) products field,
|
|
80
|
+
* or `null` for anything else so the fetcher's ordinary branches run. `pushParam`
|
|
81
|
+
* binds a value and answers its `$n` placeholder. By the time it is called an
|
|
82
|
+
* `in` filter has been normalised to `=` with an ARRAY value (see
|
|
83
|
+
* `normalizeInOperand` in `utils.ts`), which reads as "any of". A virtual field
|
|
84
|
+
* never answers `null` once matched — an operand it cannot express filters to
|
|
85
|
+
* no rows rather than falling into a branch that would name a column the table
|
|
86
|
+
* does not have.
|
|
87
|
+
*
|
|
88
|
+
* Emitted through `JSON.stringify` and string concatenation only — no backtick
|
|
89
|
+
* and no `${` may appear in the output, which is interpolated into a fetcher's
|
|
90
|
+
* template literal. On a table that is not the products table the helper still
|
|
91
|
+
* exists and always answers `null`, so a fetcher can embed it unconditionally.
|
|
92
|
+
*/
|
|
93
|
+
export var generateProductFilterClauseHelper = function (tableName) {
|
|
94
|
+
if (!supportsProductPriceSort(tableName)) {
|
|
95
|
+
return [
|
|
96
|
+
'// Virtual products-table filter fields. This table has none, so every',
|
|
97
|
+
"// condition takes the fetcher's ordinary branches.",
|
|
98
|
+
'function productFilterClause() {',
|
|
99
|
+
' return null',
|
|
100
|
+
'}',
|
|
101
|
+
].join('\n');
|
|
102
|
+
}
|
|
103
|
+
var lines = [
|
|
104
|
+
"// Rewrites the products table's virtual filter fields - the price paid",
|
|
105
|
+
'// today, the star-rating bucket, the on-sale flag and a variant axis - into',
|
|
106
|
+
'// SQL. Answers null for a plain column so the ordinary branches run. An',
|
|
107
|
+
'// "in" filter arrives here already normalised to "=" with an ARRAY value.',
|
|
108
|
+
'function productFilterClause(field, operand, value, pushParam) {',
|
|
109
|
+
" var scalarOps = ['=', '!=', '>', '<', '>=', '<=']",
|
|
110
|
+
" var equalityOps = ['=', '!=']",
|
|
111
|
+
' var compare = function (expression, allowedOps, virtual) {',
|
|
112
|
+
' if (Array.isArray(value)) {',
|
|
113
|
+
" if (operand === '=') {",
|
|
114
|
+
" return expression + '::text = ANY(' + pushParam(value.map(String)) + '::text[])'",
|
|
115
|
+
' }',
|
|
116
|
+
" if (operand === '!=') {",
|
|
117
|
+
" return expression + '::text <> ALL(' + pushParam(value.map(String)) + '::text[])'",
|
|
118
|
+
' }',
|
|
119
|
+
" return virtual ? 'FALSE' : null",
|
|
120
|
+
' }',
|
|
121
|
+
" if (allowedOps.indexOf(operand) === -1) return virtual ? 'FALSE' : null",
|
|
122
|
+
" return expression + ' ' + operand + ' ' + pushParam(value)",
|
|
123
|
+
' }',
|
|
124
|
+
" if (field === ".concat(JSON.stringify(PRODUCT_PRICE_SORT_FIELD), ") {"),
|
|
125
|
+
" return compare(".concat(JSON.stringify('(' + buildProductEffectivePriceSql() + ')'), ", scalarOps, false)"),
|
|
126
|
+
' }',
|
|
127
|
+
" if (field === ".concat(JSON.stringify(PRODUCT_RATING_FILTER_FIELD), ") {"),
|
|
128
|
+
" return compare(".concat(JSON.stringify(buildProductRatingBucketSql()), ", scalarOps, true)"),
|
|
129
|
+
' }',
|
|
130
|
+
" if (field === ".concat(JSON.stringify(PRODUCT_ON_SALE_FILTER_FIELD), ") {"),
|
|
131
|
+
" return compare(".concat(JSON.stringify(buildProductOnSaleSql()), ", equalityOps, true)"),
|
|
132
|
+
' }',
|
|
133
|
+
" if (field.indexOf(".concat(JSON.stringify(PRODUCT_VARIANT_AXIS_FILTER_PREFIX), ") === 0) {"),
|
|
134
|
+
" var axisKey = field.slice(".concat(PRODUCT_VARIANT_AXIS_FILTER_PREFIX.length, ")"),
|
|
135
|
+
" if (!new RegExp(".concat(JSON.stringify(PRODUCT_VARIANT_AXIS_KEY_PATTERN), ").test(axisKey)) {"),
|
|
136
|
+
' // Not a key the editor could have written: no rows, never an error.',
|
|
137
|
+
" return 'FALSE'",
|
|
138
|
+
' }',
|
|
139
|
+
" if (operand !== '=') return 'FALSE'",
|
|
140
|
+
' var values = (Array.isArray(value) ? value : [value]).map(String)',
|
|
141
|
+
' var keyParam = pushParam(axisKey)',
|
|
142
|
+
' var valuesParam = pushParam(values)',
|
|
143
|
+
" return ".concat(JSON.stringify(buildProductVariantAxisExistsSql('__KEY__', '__VALUES__'))),
|
|
144
|
+
// Function replacements: a "$1" inside a replacement STRING is a special
|
|
145
|
+
// pattern, so the placeholders are swapped by callback.
|
|
146
|
+
" .replace('__KEY__', function () { return keyParam })",
|
|
147
|
+
" .replace('__VALUES__', function () { return valuesParam })",
|
|
148
|
+
' }',
|
|
149
|
+
' return null',
|
|
150
|
+
'}',
|
|
151
|
+
];
|
|
152
|
+
return lines.join('\n');
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=product-filter-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-filter-fields.js","sourceRoot":"","sources":["../../src/product-filter-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,sBAAsB,CAAA;AAE7B,2FAA2F;AAC3F,MAAM,CAAC,IAAM,0BAA0B,GAAG,0BAA0B,CAAA;AAEpE,4GAA4G;AAC5G,MAAM,CAAC,IAAM,2BAA2B,GAAG,QAAQ,CAAA;AAEnD,wEAAwE;AACxE,MAAM,CAAC,IAAM,4BAA4B,GAAG,SAAS,CAAA;AAErD;;;GAGG;AACH,MAAM,CAAC,IAAM,kCAAkC,GAAG,kBAAkB,CAAA;AAEpE;;;;GAIG;AACH,MAAM,CAAC,IAAM,gCAA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AG,GAAG,6BAA6B,EAAE,GAAG,GAAG,CAC5C,wBAAqB;QACtB,KAAK;QACL,0BAAmB,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,QAAK;QACnE,6BAAsB,IAAI,CAAC,SAAS,CAAC,2BAA2B,EAAE,CAAC,uBAAoB;QACvF,KAAK;QACL,0BAAmB,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC,QAAK;QACpE,6BAAsB,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,CAAC,yBAAsB;QACnF,KAAK;QACL,8BAAuB,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,eAAY;QACrF,wCAAiC,kCAAkC,CAAC,MAAM,MAAG;QAC7E,8BAAuB,IAAI,CAAC,SAAS,CAAC,gCAAgC,CAAC,uBAAoB;QAC3F,4EAA4E;QAC5E,sBAAsB;QACtB,OAAO;QACP,yCAAyC;QACzC,uEAAuE;QACvE,uCAAuC;QACvC,yCAAyC;QACzC,qBAAc,IAAI,CAAC,SAAS,CAAC,gCAAgC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAE;QACzF,yEAAyE;QACzE,wDAAwD;QACxD,4DAA4D;QAC5D,kEAAkE;QAClE,KAAK;QACL,eAAe;QACf,GAAG;KACJ,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as types from '@babel/types';
|
|
2
|
+
import type { UIDLDependency } from '@teleporthq/teleport-types';
|
|
3
|
+
/**
|
|
4
|
+
* How a generated data-source fetch says which language it is for.
|
|
5
|
+
*
|
|
6
|
+
* A multi-language project stores a translatable column once per language
|
|
7
|
+
* (`name`, `es_name`, …) and the generated fetcher resolves each row against
|
|
8
|
+
* ONE of them (see `transformations/` and `localized-columns.ts`). Nothing
|
|
9
|
+
* about the API route knows the page it serves — an API route has no locale
|
|
10
|
+
* segment in its URL — so the page tells it, through this query parameter:
|
|
11
|
+
*
|
|
12
|
+
* - a client-side fetch (`DataProvider` `params`) sends `router.locale`;
|
|
13
|
+
* - a build-time fetch inside `getStaticProps` sends `context.locale`.
|
|
14
|
+
*
|
|
15
|
+
* Both are what Next.js resolved from the `/es/...` route, so the rows a page
|
|
16
|
+
* renders are in the language the page is in. The same name the details-page
|
|
17
|
+
* fetch (`teleport-plugin-next-static-props`) has always sent.
|
|
18
|
+
*/
|
|
19
|
+
export declare const REQUEST_LOCALE_PARAM = "locale";
|
|
20
|
+
/**
|
|
21
|
+
* `router?.locale` — the client's current locale. Optional-chained like every
|
|
22
|
+
* other generated `router` read: `useRouter()` answers `null` during a static
|
|
23
|
+
* export's first paint.
|
|
24
|
+
*/
|
|
25
|
+
export declare const buildClientLocaleExpression: () => types.Expression;
|
|
26
|
+
/** `locale: router?.locale` — the param of a client-side fetch. */
|
|
27
|
+
export declare const buildClientLocaleParam: () => types.ObjectProperty;
|
|
28
|
+
/** `locale: context.locale` — the param of a fetch inside getStaticProps. */
|
|
29
|
+
export declare const buildServerLocaleParam: () => types.ObjectProperty;
|
|
30
|
+
/** Whether an object literal already carries the locale param. */
|
|
31
|
+
export declare const hasLocaleParam: (properties: types.ObjectExpression['properties']) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Adds the client locale to a fetch's params, once, and to the `useMemo` deps
|
|
34
|
+
* that must rebuild them: a locale switch is a client-side transition on the
|
|
35
|
+
* SAME page instance, so only a dependency change refetches the rows in the
|
|
36
|
+
* new language.
|
|
37
|
+
*/
|
|
38
|
+
export declare const appendClientLocaleParam: (paramsProps: types.ObjectExpression['properties'], memoDeps: types.Expression[]) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Puts `const router = useRouter()` (and its import) in scope, once.
|
|
41
|
+
*
|
|
42
|
+
* Idempotent with every sibling plugin that declares the same hook — the i18n
|
|
43
|
+
* locale mapper, the URL search-params plugin and the base component plugin
|
|
44
|
+
* all guard on the same identifier, so whichever runs first wins and the rest
|
|
45
|
+
* find it in place. Unshifted to the top of the body: nothing reads it before
|
|
46
|
+
* an effect runs, and hooks must not sit below a conditional return.
|
|
47
|
+
*/
|
|
48
|
+
export declare const ensureRouterDeclaration: (body: types.Statement[], dependencies: Record<string, UIDLDependency>) => void;
|
|
49
|
+
//# sourceMappingURL=request-locale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-locale.d.ts","sourceRoot":"","sources":["../../src/request-locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAU5C;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,QAAO,MAAM,UAMlD,CAAA;AAEH,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,QAAO,MAAM,cAC6C,CAAA;AAE7F,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,QAAO,MAAM,cAI7C,CAAA;AAEH,kEAAkE;AAClE,eAAO,MAAM,cAAc,eAAgB,MAAM,gBAAgB,CAAC,YAAY,CAAC,KAAG,OAM/E,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gBACrB,MAAM,gBAAgB,CAAC,YAAY,CAAC,YACvC,MAAM,UAAU,EAAE,KAC3B,IAKF,CAAA;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,SAC5B,MAAM,SAAS,EAAE,gBACT,OAAO,MAAM,EAAE,cAAc,CAAC,KAC3C,IAeF,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import * as types from '@babel/types';
|
|
13
|
+
/**
|
|
14
|
+
* How a generated data-source fetch says which language it is for.
|
|
15
|
+
*
|
|
16
|
+
* A multi-language project stores a translatable column once per language
|
|
17
|
+
* (`name`, `es_name`, …) and the generated fetcher resolves each row against
|
|
18
|
+
* ONE of them (see `transformations/` and `localized-columns.ts`). Nothing
|
|
19
|
+
* about the API route knows the page it serves — an API route has no locale
|
|
20
|
+
* segment in its URL — so the page tells it, through this query parameter:
|
|
21
|
+
*
|
|
22
|
+
* - a client-side fetch (`DataProvider` `params`) sends `router.locale`;
|
|
23
|
+
* - a build-time fetch inside `getStaticProps` sends `context.locale`.
|
|
24
|
+
*
|
|
25
|
+
* Both are what Next.js resolved from the `/es/...` route, so the rows a page
|
|
26
|
+
* renders are in the language the page is in. The same name the details-page
|
|
27
|
+
* fetch (`teleport-plugin-next-static-props`) has always sent.
|
|
28
|
+
*/
|
|
29
|
+
export var REQUEST_LOCALE_PARAM = 'locale';
|
|
30
|
+
/** The dependency behind the `router` every client-side locale read closes over. */
|
|
31
|
+
var USE_ROUTER_DEPENDENCY = {
|
|
32
|
+
type: 'library',
|
|
33
|
+
path: 'next/router',
|
|
34
|
+
version: '^12.1.10',
|
|
35
|
+
meta: { namedImport: true },
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* `router?.locale` — the client's current locale. Optional-chained like every
|
|
39
|
+
* other generated `router` read: `useRouter()` answers `null` during a static
|
|
40
|
+
* export's first paint.
|
|
41
|
+
*/
|
|
42
|
+
export var buildClientLocaleExpression = function () {
|
|
43
|
+
return types.optionalMemberExpression(types.identifier('router'), types.identifier('locale'), false, true);
|
|
44
|
+
};
|
|
45
|
+
/** `locale: router?.locale` — the param of a client-side fetch. */
|
|
46
|
+
export var buildClientLocaleParam = function () {
|
|
47
|
+
return types.objectProperty(types.identifier(REQUEST_LOCALE_PARAM), buildClientLocaleExpression());
|
|
48
|
+
};
|
|
49
|
+
/** `locale: context.locale` — the param of a fetch inside getStaticProps. */
|
|
50
|
+
export var buildServerLocaleParam = function () {
|
|
51
|
+
return types.objectProperty(types.identifier(REQUEST_LOCALE_PARAM), types.memberExpression(types.identifier('context'), types.identifier('locale')));
|
|
52
|
+
};
|
|
53
|
+
/** Whether an object literal already carries the locale param. */
|
|
54
|
+
export var hasLocaleParam = function (properties) {
|
|
55
|
+
return properties.some(function (property) {
|
|
56
|
+
return property.type === 'ObjectProperty' &&
|
|
57
|
+
((property.key.type === 'Identifier' && property.key.name === REQUEST_LOCALE_PARAM) ||
|
|
58
|
+
(property.key.type === 'StringLiteral' && property.key.value === REQUEST_LOCALE_PARAM));
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Adds the client locale to a fetch's params, once, and to the `useMemo` deps
|
|
63
|
+
* that must rebuild them: a locale switch is a client-side transition on the
|
|
64
|
+
* SAME page instance, so only a dependency change refetches the rows in the
|
|
65
|
+
* new language.
|
|
66
|
+
*/
|
|
67
|
+
export var appendClientLocaleParam = function (paramsProps, memoDeps) {
|
|
68
|
+
if (!hasLocaleParam(paramsProps)) {
|
|
69
|
+
paramsProps.push(buildClientLocaleParam());
|
|
70
|
+
}
|
|
71
|
+
memoDeps.push(buildClientLocaleExpression());
|
|
72
|
+
};
|
|
73
|
+
/** Any declaration of `router` — a second one, however it is initialised, is a syntax error. */
|
|
74
|
+
var declaresRouter = function (statement) {
|
|
75
|
+
return statement.type === 'VariableDeclaration' &&
|
|
76
|
+
statement.declarations.some(function (declaration) { return declaration.id.type === 'Identifier' && declaration.id.name === 'router'; });
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Puts `const router = useRouter()` (and its import) in scope, once.
|
|
80
|
+
*
|
|
81
|
+
* Idempotent with every sibling plugin that declares the same hook — the i18n
|
|
82
|
+
* locale mapper, the URL search-params plugin and the base component plugin
|
|
83
|
+
* all guard on the same identifier, so whichever runs first wins and the rest
|
|
84
|
+
* find it in place. Unshifted to the top of the body: nothing reads it before
|
|
85
|
+
* an effect runs, and hooks must not sit below a conditional return.
|
|
86
|
+
*/
|
|
87
|
+
export var ensureRouterDeclaration = function (body, dependencies) {
|
|
88
|
+
if (!dependencies.useRouter) {
|
|
89
|
+
dependencies.useRouter = __assign({}, USE_ROUTER_DEPENDENCY);
|
|
90
|
+
}
|
|
91
|
+
if (body.some(declaresRouter)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
body.unshift(types.variableDeclaration('const', [
|
|
95
|
+
types.variableDeclarator(types.identifier('router'), types.callExpression(types.identifier('useRouter'), [])),
|
|
96
|
+
]));
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=request-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-locale.js","sourceRoot":"","sources":["../../src/request-locale.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAG,QAAQ,CAAA;AAE5C,oFAAoF;AACpF,IAAM,qBAAqB,GAAmB;IAC5C,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;CAC5B,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAM,2BAA2B,GAAG;IACzC,OAAA,KAAK,CAAC,wBAAwB,CAC5B,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC1B,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC1B,KAAK,EACL,IAAI,CACL;AALD,CAKC,CAAA;AAEH,mEAAmE;AACnE,MAAM,CAAC,IAAM,sBAAsB,GAAG;IAC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,UAAC,WAAW,IAAK,OAAA,WAAW,CAAC,EAAE,CAAC,IAAI,KAAK,YAAY,IAAI,WAAW,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,EAAxE,CAAwE,CAC1F;AAHD,CAGC,CAAA;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG,UACrC,IAAuB,EACvB,YAA4C;IAE5C,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;QAC3B,YAAY,CAAC,SAAS,gBAAQ,qBAAqB,CAAE,CAAA;KACtD;IACD,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QAC7B,OAAM;KACP;IACD,IAAI,CAAC,OAAO,CACV,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE;QACjC,KAAK,CAAC,kBAAkB,CACtB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC1B,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,CACxD;KACF,CAAC,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "clear search" button a listing's search field carries — marked
|
|
3
|
+
* `data-tq-search-clear` by the editor (`listing-search-field.ts`), the same
|
|
4
|
+
* marker the canvas renderer acts on. The search keyword is the mapper's own
|
|
5
|
+
* React state, which no authored workflow can reach, so the generator wires
|
|
6
|
+
* the button here: a click empties the query, and the button renders only
|
|
7
|
+
* while the query is non-empty.
|
|
8
|
+
*
|
|
9
|
+
* A button belongs to the search input it shares a parent with — the field
|
|
10
|
+
* wrapper — never to "the next search-enabled mapper": a page with two lists
|
|
11
|
+
* and one clear button would otherwise wire it to the wrong list.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SEARCH_CLEAR_ATTR = "data-tq-search-clear";
|
|
14
|
+
export interface SearchClearButton {
|
|
15
|
+
node: any;
|
|
16
|
+
parent: any;
|
|
17
|
+
index: number;
|
|
18
|
+
}
|
|
19
|
+
/** Every marked button under `root`, with the JSX parent and child index it sits at. */
|
|
20
|
+
export declare function findAllSearchClearButtonsInJSX(root: any): SearchClearButton[];
|
|
21
|
+
/** The search input the button shares its parent with, or null. */
|
|
22
|
+
export declare function findSiblingSearchInput(button: SearchClearButton, searchInputs: any[]): any | null;
|
|
23
|
+
/**
|
|
24
|
+
* Wires one button: `onClick` empties the query, and the element is replaced
|
|
25
|
+
* in its parent by `{query ? <button…/> : null}`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wireSearchClearButton(button: SearchClearButton, vars: {
|
|
28
|
+
searchQueryVar: string;
|
|
29
|
+
setSearchQueryVar: string;
|
|
30
|
+
}): void;
|
|
31
|
+
//# sourceMappingURL=search-clear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-clear.d.ts","sourceRoot":"","sources":["../../src/search-clear.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAIvD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,GAAG,CAAA;IACT,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAQD,wFAAwF;AACxF,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,GAAG,GAAG,iBAAiB,EAAE,CAqC7E;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAGjG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,GAC1D,IAAI,CAgBN"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as types from '@babel/types';
|
|
2
|
+
import { setJSXExpressionAttribute } from './pagination-controls';
|
|
3
|
+
/**
|
|
4
|
+
* The "clear search" button a listing's search field carries — marked
|
|
5
|
+
* `data-tq-search-clear` by the editor (`listing-search-field.ts`), the same
|
|
6
|
+
* marker the canvas renderer acts on. The search keyword is the mapper's own
|
|
7
|
+
* React state, which no authored workflow can reach, so the generator wires
|
|
8
|
+
* the button here: a click empties the query, and the button renders only
|
|
9
|
+
* while the query is non-empty.
|
|
10
|
+
*
|
|
11
|
+
* A button belongs to the search input it shares a parent with — the field
|
|
12
|
+
* wrapper — never to "the next search-enabled mapper": a page with two lists
|
|
13
|
+
* and one clear button would otherwise wire it to the wrong list.
|
|
14
|
+
*/
|
|
15
|
+
export var SEARCH_CLEAR_ATTR = 'data-tq-search-clear';
|
|
16
|
+
function hasSearchClearMarker(node) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return !!((_b = (_a = node === null || node === void 0 ? void 0 : node.openingElement) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.some(function (attr) { var _a; return attr.type === 'JSXAttribute' && ((_a = attr.name) === null || _a === void 0 ? void 0 : _a.name) === SEARCH_CLEAR_ATTR; }));
|
|
19
|
+
}
|
|
20
|
+
/** Every marked button under `root`, with the JSX parent and child index it sits at. */
|
|
21
|
+
export function findAllSearchClearButtonsInJSX(root) {
|
|
22
|
+
var results = [];
|
|
23
|
+
var traverse = function (node) {
|
|
24
|
+
if (!node) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (node.type === 'JSXElement' && Array.isArray(node.children)) {
|
|
28
|
+
node.children.forEach(function (child, index) {
|
|
29
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === 'JSXElement' && hasSearchClearMarker(child)) {
|
|
30
|
+
results.push({ node: child, parent: node, index: index });
|
|
31
|
+
}
|
|
32
|
+
traverse(child);
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (node.body) {
|
|
37
|
+
if (Array.isArray(node.body)) {
|
|
38
|
+
node.body.forEach(function (statement) { return traverse(statement); });
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
traverse(node.body);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (node.consequent) {
|
|
45
|
+
traverse(node.consequent);
|
|
46
|
+
}
|
|
47
|
+
if (node.alternate) {
|
|
48
|
+
traverse(node.alternate);
|
|
49
|
+
}
|
|
50
|
+
if (node.expression) {
|
|
51
|
+
traverse(node.expression);
|
|
52
|
+
}
|
|
53
|
+
if (node.argument) {
|
|
54
|
+
traverse(node.argument);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
traverse(root);
|
|
58
|
+
return results;
|
|
59
|
+
}
|
|
60
|
+
/** The search input the button shares its parent with, or null. */
|
|
61
|
+
export function findSiblingSearchInput(button, searchInputs) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
var siblings = (_a = button.parent.children) !== null && _a !== void 0 ? _a : [];
|
|
64
|
+
return (_b = siblings.find(function (sibling) { return searchInputs.includes(sibling); })) !== null && _b !== void 0 ? _b : null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Wires one button: `onClick` empties the query, and the element is replaced
|
|
68
|
+
* in its parent by `{query ? <button…/> : null}`.
|
|
69
|
+
*/
|
|
70
|
+
export function wireSearchClearButton(button, vars) {
|
|
71
|
+
setJSXExpressionAttribute(button.node, 'onClick', types.arrowFunctionExpression([], types.callExpression(types.identifier(vars.setSearchQueryVar), [types.stringLiteral('')])));
|
|
72
|
+
button.parent.children[button.index] = types.jsxExpressionContainer(types.conditionalExpression(types.identifier(vars.searchQueryVar), button.node, types.nullLiteral()));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=search-clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-clear.js","sourceRoot":"","sources":["../../src/search-clear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA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F,CAAA;IACD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,sBAAsB,CACjE,KAAK,CAAC,qBAAqB,CACzB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,EACrC,MAAM,CAAC,IAAI,EACX,KAAK,CAAC,WAAW,EAAE,CACpB,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GeneratorOptions, UIDLEcommerceCategory } from '@teleporthq/teleport-types';
|
|
2
2
|
import { type EcommerceProductTransformOptions } from './ecommerce-product';
|
|
3
|
+
import { type ContentLocalization, type LocalizedProjectOptions } from '../content-localization';
|
|
3
4
|
export type { EcommerceProductTransformOptions };
|
|
4
5
|
/**
|
|
5
6
|
* Everything a generated fetcher bakes in, for EITHER entity. One options object
|
|
@@ -10,6 +11,13 @@ export type { EcommerceProductTransformOptions };
|
|
|
10
11
|
export interface EntityTransformOptions extends EcommerceProductTransformOptions {
|
|
11
12
|
/** Blog post-category taxonomy — see `blogSettings.categories`. */
|
|
12
13
|
blogCategories?: UIDLEcommerceCategory[];
|
|
14
|
+
/**
|
|
15
|
+
* The languages the rows are stored in — absent for a single-language
|
|
16
|
+
* project. The transform resolves every translatable field against the
|
|
17
|
+
* request's locale (`?locale=es` → `es_name`, falling back to `name`), and
|
|
18
|
+
* the fetcher matches and sorts translatable columns the same way.
|
|
19
|
+
*/
|
|
20
|
+
localization?: ContentLocalization;
|
|
13
21
|
}
|
|
14
22
|
/**
|
|
15
23
|
* Collects everything the product transform bakes in from the generator
|
|
@@ -20,7 +28,7 @@ export interface EntityTransformOptions extends EcommerceProductTransformOptions
|
|
|
20
28
|
* tax-inclusive or untaxed stores. `allowBackorders` is the effective
|
|
21
29
|
* "stock never blocks a purchase" flag — see `resolveAllowBackorders`.
|
|
22
30
|
*/
|
|
23
|
-
export declare const buildProductTransformOptions: (options: Pick<GeneratorOptions, 'ecommerceSettings' | 'invoiceSettings' | 'blogSettings'>) => EntityTransformOptions;
|
|
31
|
+
export declare const buildProductTransformOptions: (options: Pick<GeneratorOptions, 'ecommerceSettings' | 'invoiceSettings' | 'blogSettings'> & LocalizedProjectOptions) => EntityTransformOptions;
|
|
24
32
|
export type TransformationType = 'blog-post' | 'ecommerce-product' | 'custom-page' | null;
|
|
25
33
|
/**
|
|
26
34
|
* Detects which transformation type to apply based on the table name.
|
|
@@ -61,6 +69,12 @@ export declare const REVIEWS_PER_PRODUCT = 5;
|
|
|
61
69
|
* Returns the transform wrapper function code that handles asset map loading
|
|
62
70
|
* and calls the appropriate transformer.
|
|
63
71
|
* Returns empty string if no transformation is needed.
|
|
72
|
+
*
|
|
73
|
+
* The request's `locale` (see `REQUEST_LOCALE_PARAM`) is what every
|
|
74
|
+
* translatable field resolves against; the MAIN locale it falls back to is a
|
|
75
|
+
* project constant and is baked in from `options.localization` rather than
|
|
76
|
+
* asked of every caller. Without a localization every row reads as before —
|
|
77
|
+
* the base columns.
|
|
64
78
|
*/
|
|
65
|
-
export declare const getTransformWrapperCode: (tableName: string) => string;
|
|
79
|
+
export declare const getTransformWrapperCode: (tableName: string, options?: Pick<EntityTransformOptions, 'localization'>) => string;
|
|
66
80
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transformations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAKzF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EAAE,gCAAgC,EAAE,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gCAAgC;IAC9E,mEAAmE;IACnE,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transformations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAKzF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EAAE,gCAAgC,EAAE,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gCAAgC;IAC9E,mEAAmE;IACnE,cAAc,CAAC,EAAE,qBAAqB,EAAE,CAAA;IACxC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAA;CACnC;AAkBD;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,YAC9B,KAAK,gBAAgB,EAAE,mBAAmB,GAAG,iBAAiB,GAAG,cAAc,CAAC,GACvF,uBAAuB,KACxB,sBAMD,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,mBAAmB,GAAG,aAAa,GAAG,IAAI,CAAA;AAezF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,cAAe,MAAM,KAAG,kBAe5D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,cACrB,MAAM,YACR,sBAAsB,KAC9B,MAkBF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,cAAe,MAAM,KAAG,MAAM,GAAG,IAgBnE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,cACvB,MAAM,YACR,KAAK,sBAAsB,EAAE,cAAc,CAAC,KACpD,MAkIF,CAAA"}
|
|
@@ -3,6 +3,8 @@ import { generateSharedTransformationCode } from './shared-utils';
|
|
|
3
3
|
import { generateBlogPostTransformationCode } from './blog-post';
|
|
4
4
|
import { generateCustomPageTransformationCode } from './custom-page';
|
|
5
5
|
import { generateEcommerceProductTransformationCode, } from './ecommerce-product';
|
|
6
|
+
import { REQUEST_LOCALE_PARAM } from '../request-locale';
|
|
7
|
+
import { resolveContentLocalization, } from '../content-localization';
|
|
6
8
|
/**
|
|
7
9
|
* Stock never gates purchasability when the merchant disabled stock management
|
|
8
10
|
* entirely or opted into backorders. Mirrors the GUI rule in
|
|
@@ -33,6 +35,7 @@ export var buildProductTransformOptions = function (options) {
|
|
|
33
35
|
blogCategories: (_b = options.blogSettings) === null || _b === void 0 ? void 0 : _b.categories,
|
|
34
36
|
storefrontTaxRate: StorefrontTax.resolveStorefrontTaxRate(options.invoiceSettings),
|
|
35
37
|
allowBackorders: resolveAllowBackorders(options.ecommerceSettings),
|
|
38
|
+
localization: resolveContentLocalization(options),
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
41
|
/**
|
|
@@ -133,12 +136,21 @@ export var REVIEWS_PER_PRODUCT = 5;
|
|
|
133
136
|
* Returns the transform wrapper function code that handles asset map loading
|
|
134
137
|
* and calls the appropriate transformer.
|
|
135
138
|
* Returns empty string if no transformation is needed.
|
|
139
|
+
*
|
|
140
|
+
* The request's `locale` (see `REQUEST_LOCALE_PARAM`) is what every
|
|
141
|
+
* translatable field resolves against; the MAIN locale it falls back to is a
|
|
142
|
+
* project constant and is baked in from `options.localization` rather than
|
|
143
|
+
* asked of every caller. Without a localization every row reads as before —
|
|
144
|
+
* the base columns.
|
|
136
145
|
*/
|
|
137
|
-
export var getTransformWrapperCode = function (tableName) {
|
|
146
|
+
export var getTransformWrapperCode = function (tableName, options) {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
if (options === void 0) { options = {}; }
|
|
138
149
|
var type = detectTransformationType(tableName);
|
|
139
150
|
if (!type) {
|
|
140
151
|
return '';
|
|
141
152
|
}
|
|
153
|
+
var mainLanguageLiteral = JSON.stringify((_b = (_a = options.localization) === null || _a === void 0 ? void 0 : _a.mainLocale) !== null && _b !== void 0 ? _b : null);
|
|
142
154
|
var transformFn = type === 'blog-post'
|
|
143
155
|
? 'transformBlogPosts'
|
|
144
156
|
: type === 'custom-page'
|
|
@@ -182,6 +194,6 @@ export var getTransformWrapperCode = function (tableName) {
|
|
|
182
194
|
? "\n var ".concat(relatedMapVar, " = null\n if (Array.isArray(records) && records.length === 1) {\n try {\n ").concat(relatedMapVar, " = await ").concat(relatedMapFn, "(getClientFn, records)\n } catch (e) {\n // Best-effort; the related rail stays hidden behind its empty gate.\n }\n }")
|
|
183
195
|
: '';
|
|
184
196
|
var relatedOption = hasRelatedItems ? ", ".concat(relatedMapVar, ": ").concat(relatedMapVar) : '';
|
|
185
|
-
return "\nasync function transformRecords(records, getClientFn, reqQuery) {\n var assetMap = {}\n try {\n assetMap = await getAssetMap(getClientFn)\n } catch (e) {\n // Asset resolution is best-effort; continue without it\n }".concat(relatedEnrichment).concat(variantEnrichment, "\n var currentLanguage =
|
|
197
|
+
return "\nasync function transformRecords(records, getClientFn, reqQuery) {\n var assetMap = {}\n try {\n assetMap = await getAssetMap(getClientFn)\n } catch (e) {\n // Asset resolution is best-effort; continue without it\n }".concat(relatedEnrichment).concat(variantEnrichment, "\n var currentLanguage = reqQuery && typeof reqQuery.").concat(REQUEST_LOCALE_PARAM, " === 'string' && reqQuery.").concat(REQUEST_LOCALE_PARAM, " ? reqQuery.").concat(REQUEST_LOCALE_PARAM, " : null\n var options = { assetMap: assetMap, currentLanguage: currentLanguage, mainLanguage: ").concat(mainLanguageLiteral).concat(variantOption).concat(relatedOption, " }\n return ").concat(transformFn, "(records, options)\n}\n");
|
|
186
198
|
};
|
|
187
199
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transformations/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAE,gCAAgC,EAAE,MAA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