@conloca/content-api 0.1.15 → 0.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/dist/asset-constraints.d.ts +16 -0
- package/dist/asset-constraints.d.ts.map +1 -0
- package/dist/asset-constraints.js +29 -0
- package/dist/asset-constraints.js.map +1 -0
- package/dist/asset-metadata-store.d.ts +60 -0
- package/dist/asset-metadata-store.d.ts.map +1 -0
- package/dist/asset-metadata-store.js +335 -0
- package/dist/asset-metadata-store.js.map +1 -0
- package/dist/asset-operations.d.ts +164 -0
- package/dist/asset-operations.d.ts.map +1 -0
- package/dist/asset-operations.js +784 -0
- package/dist/asset-operations.js.map +1 -0
- package/dist/asset-types.d.ts +72 -0
- package/dist/asset-types.d.ts.map +1 -0
- package/dist/asset-types.js +13 -0
- package/dist/asset-types.js.map +1 -0
- package/dist/asset-usage.d.ts +10 -0
- package/dist/asset-usage.d.ts.map +1 -0
- package/dist/asset-usage.js +49 -0
- package/dist/asset-usage.js.map +1 -0
- package/dist/base-content-index.d.ts +63 -0
- package/dist/base-content-index.d.ts.map +1 -0
- package/dist/base-content-index.js +200 -0
- package/dist/base-content-index.js.map +1 -0
- package/dist/cf-access.d.ts +31 -0
- package/dist/cf-access.d.ts.map +1 -0
- package/dist/cf-access.js +67 -0
- package/dist/cf-access.js.map +1 -0
- package/dist/component-registry.d.ts +50 -0
- package/dist/component-registry.d.ts.map +1 -0
- package/dist/component-registry.js +121 -0
- package/dist/component-registry.js.map +1 -0
- package/dist/component-registry.types.d.ts +11 -0
- package/dist/component-registry.types.d.ts.map +1 -0
- package/dist/component-registry.types.js +2 -0
- package/dist/component-registry.types.js.map +1 -0
- package/dist/component-vocabulary.d.ts +33 -0
- package/dist/component-vocabulary.d.ts.map +1 -0
- package/dist/component-vocabulary.js +105 -0
- package/dist/component-vocabulary.js.map +1 -0
- package/dist/content-api.interface.d.ts +64 -0
- package/dist/content-api.interface.d.ts.map +1 -0
- package/dist/content-api.interface.js +2 -0
- package/dist/content-api.interface.js.map +1 -0
- package/dist/content-filters.d.ts +31 -0
- package/dist/content-filters.d.ts.map +1 -0
- package/dist/content-filters.js +247 -0
- package/dist/content-filters.js.map +1 -0
- package/dist/content-index.d.ts +184 -0
- package/dist/content-index.d.ts.map +1 -0
- package/dist/content-index.js +546 -0
- package/dist/content-index.js.map +1 -0
- package/dist/content-operations.d.ts +157 -0
- package/dist/content-operations.d.ts.map +1 -0
- package/dist/content-operations.js +359 -0
- package/dist/content-operations.js.map +1 -0
- package/dist/content-path.d.ts +59 -0
- package/dist/content-path.d.ts.map +1 -0
- package/dist/content-path.js +88 -0
- package/dist/content-path.js.map +1 -0
- package/dist/content-reader.d.ts +10 -0
- package/dist/content-reader.d.ts.map +1 -0
- package/dist/content-reader.js +14 -0
- package/dist/content-reader.js.map +1 -0
- package/dist/content-utils.d.ts +175 -0
- package/dist/content-utils.d.ts.map +1 -0
- package/dist/content-utils.js +421 -0
- package/dist/content-utils.js.map +1 -0
- package/dist/content-watcher.d.ts +43 -0
- package/dist/content-watcher.d.ts.map +1 -0
- package/dist/content-watcher.js +86 -0
- package/dist/content-watcher.js.map +1 -0
- package/dist/data-index.d.ts +8 -0
- package/dist/data-index.d.ts.map +1 -0
- package/dist/data-index.js +8 -0
- package/dist/data-index.js.map +1 -0
- package/dist/data.d.ts +35 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +104 -0
- package/dist/data.js.map +1 -0
- package/dist/editor-data-bindings.d.ts +10 -0
- package/dist/editor-data-bindings.d.ts.map +1 -0
- package/dist/editor-data-bindings.js +67 -0
- package/dist/editor-data-bindings.js.map +1 -0
- package/dist/etag-utils.d.ts +77 -0
- package/dist/etag-utils.d.ts.map +1 -0
- package/dist/etag-utils.js +161 -0
- package/dist/etag-utils.js.map +1 -0
- package/dist/filesystem-content-api.d.ts +162 -0
- package/dist/filesystem-content-api.d.ts.map +1 -0
- package/dist/filesystem-content-api.js +2307 -0
- package/dist/filesystem-content-api.js.map +1 -0
- package/dist/filesystem-reader-backend.d.ts +46 -0
- package/dist/filesystem-reader-backend.d.ts.map +1 -0
- package/dist/filesystem-reader-backend.js +119 -0
- package/dist/filesystem-reader-backend.js.map +1 -0
- package/dist/fragment-index.d.ts +8 -0
- package/dist/fragment-index.d.ts.map +1 -0
- package/dist/fragment-index.js +8 -0
- package/dist/fragment-index.js.map +1 -0
- package/dist/fragments.d.ts +16 -0
- package/dist/fragments.d.ts.map +1 -0
- package/dist/fragments.js +104 -0
- package/dist/fragments.js.map +1 -0
- package/dist/git-operations.d.ts +49 -0
- package/dist/git-operations.d.ts.map +1 -0
- package/dist/git-operations.js +256 -0
- package/dist/git-operations.js.map +1 -0
- package/dist/header-parser.d.ts +37 -0
- package/dist/header-parser.d.ts.map +1 -0
- package/dist/header-parser.js +233 -0
- package/dist/header-parser.js.map +1 -0
- package/dist/in-memory-content-api.d.ts +35 -0
- package/dist/in-memory-content-api.d.ts.map +1 -0
- package/dist/in-memory-content-api.js +609 -0
- package/dist/in-memory-content-api.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/indexing.d.ts +5 -0
- package/dist/indexing.d.ts.map +1 -0
- package/dist/indexing.js +8 -0
- package/dist/indexing.js.map +1 -0
- package/dist/json-whitespace-view.d.ts +32 -0
- package/dist/json-whitespace-view.d.ts.map +1 -0
- package/dist/json-whitespace-view.js +153 -0
- package/dist/json-whitespace-view.js.map +1 -0
- package/dist/middleware.d.ts +20 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +1082 -0
- package/dist/middleware.js.map +1 -0
- package/dist/node.d.ts +32 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +27 -0
- package/dist/node.js.map +1 -0
- package/dist/page-references.d.ts +21 -0
- package/dist/page-references.d.ts.map +1 -0
- package/dist/page-references.js +50 -0
- package/dist/page-references.js.map +1 -0
- package/dist/read-date.d.ts +3 -0
- package/dist/read-date.d.ts.map +1 -0
- package/dist/read-date.js +9 -0
- package/dist/read-date.js.map +1 -0
- package/dist/reader-backend.d.ts +54 -0
- package/dist/reader-backend.d.ts.map +1 -0
- package/dist/reader-backend.js +2 -0
- package/dist/reader-backend.js.map +1 -0
- package/dist/reader.d.ts +15 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +14 -0
- package/dist/reader.js.map +1 -0
- package/dist/schemas/index.d.ts +102 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +88 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/site-index.d.ts +60 -0
- package/dist/site-index.d.ts.map +1 -0
- package/dist/site-index.js +291 -0
- package/dist/site-index.js.map +1 -0
- package/dist/site.d.ts +23 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +180 -0
- package/dist/site.js.map +1 -0
- package/dist/types.d.ts +641 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +45 -0
- package/dist/types.js.map +1 -0
- package/dist/url-safe-base64.d.ts +12 -0
- package/dist/url-safe-base64.d.ts.map +1 -0
- package/dist/url-safe-base64.js +41 -0
- package/dist/url-safe-base64.js.map +1 -0
- package/dist/url-validation.d.ts +28 -0
- package/dist/url-validation.d.ts.map +1 -0
- package/dist/url-validation.js +123 -0
- package/dist/url-validation.js.map +1 -0
- package/dist/utils/atomic-write.d.ts +6 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +21 -0
- package/dist/utils/atomic-write.js.map +1 -0
- package/dist/utils.d.ts +46 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +71 -0
- package/dist/utils.js.map +1 -0
- package/dist/vite-plugin.d.ts +12 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +30 -0
- package/dist/vite-plugin.js.map +1 -0
- package/dist/vxjson-serialize.d.ts +13 -0
- package/dist/vxjson-serialize.d.ts.map +1 -0
- package/dist/vxjson-serialize.js +53 -0
- package/dist/vxjson-serialize.js.map +1 -0
- package/dist/vxjson.d.ts +113 -0
- package/dist/vxjson.d.ts.map +1 -0
- package/dist/vxjson.js +381 -0
- package/dist/vxjson.js.map +1 -0
- package/dist/xxhash.d.ts +10 -0
- package/dist/xxhash.d.ts.map +1 -0
- package/dist/xxhash.js +35 -0
- package/dist/xxhash.js.map +1 -0
- package/package.json +132 -34
- package/src/asset-constraints.ts +33 -0
- package/src/asset-metadata-store.ts +401 -0
- package/src/asset-operations.ts +914 -0
- package/src/asset-types.ts +74 -0
- package/src/asset-usage.ts +47 -0
- package/src/base-content-index.ts +227 -0
- package/src/cf-access.ts +85 -0
- package/src/component-registry.ts +145 -0
- package/src/component-registry.types.ts +12 -0
- package/src/component-vocabulary.ts +87 -0
- package/src/content-api.interface.ts +94 -0
- package/src/content-filters.ts +278 -0
- package/src/content-index.ts +642 -0
- package/src/content-operations.ts +497 -0
- package/src/content-path.ts +113 -0
- package/src/content-reader.ts +18 -0
- package/src/content-utils.ts +474 -0
- package/src/content-watcher.ts +122 -0
- package/src/data-index.ts +7 -0
- package/src/data.ts +134 -0
- package/src/editor-data-bindings.ts +66 -0
- package/src/etag-utils.ts +204 -0
- package/src/filesystem-content-api.ts +2685 -0
- package/src/filesystem-reader-backend.ts +135 -0
- package/src/fragment-index.ts +7 -0
- package/src/fragments.ts +113 -0
- package/src/git-operations.ts +340 -0
- package/src/header-parser.ts +272 -0
- package/src/in-memory-content-api.ts +760 -0
- package/src/index.ts +45 -0
- package/src/indexing.ts +8 -0
- package/src/json-whitespace-view.ts +155 -0
- package/src/middleware.ts +1341 -0
- package/src/node.ts +40 -0
- package/src/page-references.ts +76 -0
- package/src/read-date.ts +7 -0
- package/src/reader-backend.ts +54 -0
- package/src/reader.ts +15 -0
- package/src/schemas/index.ts +113 -0
- package/src/site-index.ts +330 -0
- package/src/site.ts +198 -0
- package/src/types.ts +759 -0
- package/src/url-safe-base64.ts +38 -0
- package/src/url-validation.ts +121 -0
- package/src/utils/atomic-write.ts +20 -0
- package/src/utils.ts +84 -0
- package/src/vite-plugin.ts +45 -0
- package/src/vxjson-serialize.ts +66 -0
- package/src/vxjson.ts +442 -0
- package/src/xxhash.ts +43 -0
- package/dist/component-registry.types-CBGONnYn.d.mts +0 -71
- package/dist/component-registry.types-CBGONnYn.d.mts.map +0 -1
- package/dist/content-operations-Dv67amz3.d.mts +0 -852
- package/dist/content-operations-Dv67amz3.d.mts.map +0 -1
- package/dist/data-Db1Iv9T0.mjs +0 -60
- package/dist/data-Db1Iv9T0.mjs.map +0 -1
- package/dist/filesystem-content-api-C1TM0GLo.d.mts +0 -119
- package/dist/filesystem-content-api-C1TM0GLo.d.mts.map +0 -1
- package/dist/filesystem-content-api-kxKY5IUw.mjs +0 -2678
- package/dist/filesystem-content-api-kxKY5IUw.mjs.map +0 -1
- package/dist/index.d.mts +0 -79
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -47
- package/dist/index.mjs.map +0 -1
- package/dist/node.d.mts +0 -378
- package/dist/node.d.mts.map +0 -1
- package/dist/node.mjs +0 -2618
- package/dist/node.mjs.map +0 -1
- package/dist/reader.d.mts +0 -18
- package/dist/reader.d.mts.map +0 -1
- package/dist/reader.mjs +0 -22
- package/dist/reader.mjs.map +0 -1
- package/dist/schemas/index.d.mts +0 -90
- package/dist/schemas/index.d.mts.map +0 -1
- package/dist/schemas/index.mjs +0 -70
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/site-vNtJ5jCh.mjs +0 -538
- package/dist/site-vNtJ5jCh.mjs.map +0 -1
- package/dist/types-DWt912tu.mjs +0 -33
- package/dist/types-DWt912tu.mjs.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ContentData, ContentIdentity, ContentManifest, LocaleVersion } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* V8-optimized index for a single site
|
|
4
|
+
* Maintains pathname lookups and collections for one site only
|
|
5
|
+
*/
|
|
6
|
+
export declare class SiteIndex {
|
|
7
|
+
readonly locales: string[];
|
|
8
|
+
private index;
|
|
9
|
+
private contentCache;
|
|
10
|
+
private pathnameIndex;
|
|
11
|
+
private previousPathnameIndex;
|
|
12
|
+
readonly collections: Set<string>;
|
|
13
|
+
constructor(locales: string[]);
|
|
14
|
+
/**
|
|
15
|
+
* Add or update content in the index
|
|
16
|
+
* Merges manifest locales and updates content cache if provided
|
|
17
|
+
*/
|
|
18
|
+
addContent(identity: ContentIdentity, localeVersion: LocaleVersion, content?: ContentData | null): void;
|
|
19
|
+
/**
|
|
20
|
+
* Remove a specific locale from an entry
|
|
21
|
+
*/
|
|
22
|
+
removeLocale(id: string, locale: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Remove an entry from the index
|
|
25
|
+
*/
|
|
26
|
+
removeEntry(id: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get cached content for a specific locale
|
|
29
|
+
*/
|
|
30
|
+
getCachedContent(id: string, locale: string): ContentData | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get content manifest
|
|
33
|
+
*/
|
|
34
|
+
getManifest(id: string): ContentManifest | null;
|
|
35
|
+
/**
|
|
36
|
+
* Find content by pathname
|
|
37
|
+
*/
|
|
38
|
+
getByPathname(pathname: string, locale?: string): ContentManifest | null;
|
|
39
|
+
/**
|
|
40
|
+
* Find content by previous pathname (for redirects)
|
|
41
|
+
*/
|
|
42
|
+
getByPreviousPathname(pathname: string, locale?: string): ContentManifest | null;
|
|
43
|
+
/**
|
|
44
|
+
* Generator for all manifests
|
|
45
|
+
*/
|
|
46
|
+
getAllManifests(): Generator<ContentManifest>;
|
|
47
|
+
/**
|
|
48
|
+
* Generator for manifests by locale
|
|
49
|
+
*/
|
|
50
|
+
getManifestsByLocale(locale: string): Generator<ContentManifest>;
|
|
51
|
+
/**
|
|
52
|
+
* Get the count of indexed content entries (unique IDs)
|
|
53
|
+
*/
|
|
54
|
+
get entryCount(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Clear all indexes
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=site-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-index.d.ts","sourceRoot":"","sources":["../src/site-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/F;;;GAGG;AACH,qBAAa,SAAS;IAkBR,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE;IAhBtC,OAAO,CAAC,KAAK,CAA2C;IAGxD,OAAO,CAAC,YAAY,CAA8D;IAIlF,OAAO,CAAC,aAAa,CAA+C;IAIpE,OAAO,CAAC,qBAAqB,CAA+C;IAG5E,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAE9C,YAAqB,OAAO,EAAE,MAAM,EAAE,EAIrC;IAED;;;OAGG;IACH,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAuItG;IAED;;OAEG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAgC7C;IAED;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAsB5B;IAED;;OAEG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAG/D;IAED;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAE9C;IAED;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAcvE;IAED;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAc/E;IAED;;OAEG;IACF,eAAe,IAAI,SAAS,CAAC,eAAe,CAAC,CAI7C;IAED;;OAEG;IACF,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAMhE;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CASZ;CACF"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { isContentPublished, localesOf, mapLocales } from './content-utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* V8-optimized index for a single site
|
|
4
|
+
* Maintains pathname lookups and collections for one site only
|
|
5
|
+
*/
|
|
6
|
+
export class SiteIndex {
|
|
7
|
+
locales;
|
|
8
|
+
// Primary index: id -> ContentManifest
|
|
9
|
+
index = new Map();
|
|
10
|
+
// Content cache: id -> locale -> content (for small files)
|
|
11
|
+
contentCache = new Map();
|
|
12
|
+
// Pathname index: locale -> (pathname -> ContentManifest)
|
|
13
|
+
// Locale level uses V8-optimized record, pathname level uses Map for dynamic keys
|
|
14
|
+
pathnameIndex;
|
|
15
|
+
// Previous pathname index for redirects: locale -> (oldPathname -> ContentManifest)
|
|
16
|
+
// Same structure - record for locales, Map for pathnames
|
|
17
|
+
previousPathnameIndex;
|
|
18
|
+
// Collections used by this site
|
|
19
|
+
collections = new Set();
|
|
20
|
+
constructor(locales) {
|
|
21
|
+
this.locales = locales;
|
|
22
|
+
// Initialize pathname indexes - V8-optimized record for locales, Maps for pathnames
|
|
23
|
+
this.pathnameIndex = mapLocales(locales, () => new Map());
|
|
24
|
+
this.previousPathnameIndex = mapLocales(locales, () => new Map());
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Add or update content in the index
|
|
28
|
+
* Merges manifest locales and updates content cache if provided
|
|
29
|
+
*/
|
|
30
|
+
addContent(identity, localeVersion, content) {
|
|
31
|
+
// Get existing manifest
|
|
32
|
+
const existing = this.index.get(identity.id);
|
|
33
|
+
const locale = localeVersion.locale;
|
|
34
|
+
if (existing) {
|
|
35
|
+
const existingLocale = existing.locales[locale];
|
|
36
|
+
// Track what we need to rollback
|
|
37
|
+
// First check what pathname currently maps to this manifest in our index
|
|
38
|
+
// This handles in-place updates where the manifest object has already been modified
|
|
39
|
+
let oldPathname;
|
|
40
|
+
// Find all pathnames that currently point to this manifest
|
|
41
|
+
for (const [pathname, indexedManifest] of this.pathnameIndex[locale].entries()) {
|
|
42
|
+
if (indexedManifest === existing && pathname !== localeVersion.pathname) {
|
|
43
|
+
oldPathname = pathname;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// If we didn't find it in the index, fall back to what's stored in the existing locale
|
|
48
|
+
if (!oldPathname && existingLocale?.pathname && existingLocale.pathname !== localeVersion.pathname) {
|
|
49
|
+
oldPathname = existingLocale.pathname;
|
|
50
|
+
}
|
|
51
|
+
const hadExistingLocale = !!existingLocale;
|
|
52
|
+
let deletedOldPathname = false;
|
|
53
|
+
let addedNewPathname = false;
|
|
54
|
+
const addedPreviousPathnames = [];
|
|
55
|
+
// Update locale manifest if changed
|
|
56
|
+
// We need to always check for pathname changes, even if other fields haven't changed
|
|
57
|
+
// This handles in-place updates where the manifest is modified before calling addContent
|
|
58
|
+
const needsUpdate = !existingLocale ||
|
|
59
|
+
existingLocale.etag !== localeVersion.etag ||
|
|
60
|
+
existingLocale.modified !== localeVersion.modified ||
|
|
61
|
+
(oldPathname && oldPathname !== localeVersion.pathname);
|
|
62
|
+
if (needsUpdate) {
|
|
63
|
+
try {
|
|
64
|
+
// Update the manifest locale
|
|
65
|
+
existing.locales[locale] = localeVersion;
|
|
66
|
+
// Update pathname indexes after manifest is updated
|
|
67
|
+
if (localeVersion.pathname) {
|
|
68
|
+
// If pathname changed, remove the old one
|
|
69
|
+
if (oldPathname && oldPathname !== localeVersion.pathname) {
|
|
70
|
+
this.pathnameIndex[locale].delete(oldPathname);
|
|
71
|
+
deletedOldPathname = true;
|
|
72
|
+
// Track the old pathname for redirects only if content is published
|
|
73
|
+
if (isContentPublished(localeVersion)) {
|
|
74
|
+
this.previousPathnameIndex[locale].set(oldPathname, existing);
|
|
75
|
+
addedPreviousPathnames.push(oldPathname);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Add/update the new pathname
|
|
79
|
+
this.pathnameIndex[locale].set(localeVersion.pathname, existing);
|
|
80
|
+
addedNewPathname = true;
|
|
81
|
+
}
|
|
82
|
+
// Update previous pathname indexes from the manifest
|
|
83
|
+
if (localeVersion.previousPathnames) {
|
|
84
|
+
for (const prevPath of Object.keys(localeVersion.previousPathnames)) {
|
|
85
|
+
// Only add if not already there
|
|
86
|
+
if (!this.previousPathnameIndex[locale].has(prevPath)) {
|
|
87
|
+
this.previousPathnameIndex[locale].set(prevPath, existing);
|
|
88
|
+
addedPreviousPathnames.push(prevPath);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
// Rollback only what we changed
|
|
95
|
+
if (hadExistingLocale) {
|
|
96
|
+
existing.locales[locale] = existingLocale;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
existing.locales[locale] = undefined;
|
|
100
|
+
}
|
|
101
|
+
// Rollback pathname index changes
|
|
102
|
+
if (deletedOldPathname && oldPathname) {
|
|
103
|
+
this.pathnameIndex[locale].set(oldPathname, existing);
|
|
104
|
+
}
|
|
105
|
+
if (addedNewPathname && localeVersion.pathname) {
|
|
106
|
+
this.pathnameIndex[locale].delete(localeVersion.pathname);
|
|
107
|
+
}
|
|
108
|
+
// Rollback previous pathname additions
|
|
109
|
+
for (const prevPath of addedPreviousPathnames) {
|
|
110
|
+
this.previousPathnameIndex[locale].delete(prevPath);
|
|
111
|
+
}
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// New content - create ContentManifest with single locale
|
|
118
|
+
const newManifest = {
|
|
119
|
+
id: identity.id,
|
|
120
|
+
type: identity.type,
|
|
121
|
+
kind: identity.kind,
|
|
122
|
+
site: identity.site,
|
|
123
|
+
collection: identity.collection,
|
|
124
|
+
locales: {
|
|
125
|
+
[locale]: localeVersion,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
this.index.set(identity.id, newManifest);
|
|
129
|
+
this.collections.add(identity.collection);
|
|
130
|
+
// Add pathname indexes
|
|
131
|
+
if (localeVersion.pathname) {
|
|
132
|
+
this.pathnameIndex[locale].set(localeVersion.pathname, newManifest);
|
|
133
|
+
}
|
|
134
|
+
if (localeVersion.previousPathnames) {
|
|
135
|
+
for (const prevPath of Object.keys(localeVersion.previousPathnames)) {
|
|
136
|
+
this.previousPathnameIndex[locale].set(prevPath, newManifest);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Update content cache if provided
|
|
141
|
+
if (content !== undefined) {
|
|
142
|
+
const existingCache = this.contentCache.get(identity.id);
|
|
143
|
+
if (existingCache) {
|
|
144
|
+
// Update single locale content
|
|
145
|
+
existingCache[locale] = content;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
this.contentCache.set(identity.id, { [locale]: content });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Remove a specific locale from an entry
|
|
154
|
+
*/
|
|
155
|
+
removeLocale(id, locale) {
|
|
156
|
+
const manifest = this.index.get(id);
|
|
157
|
+
if (!manifest?.locales[locale])
|
|
158
|
+
return;
|
|
159
|
+
const localeVersion = manifest.locales[locale];
|
|
160
|
+
// Remove from pathname indexes
|
|
161
|
+
if (localeVersion.pathname) {
|
|
162
|
+
this.pathnameIndex[locale].delete(localeVersion.pathname);
|
|
163
|
+
}
|
|
164
|
+
if (localeVersion.previousPathnames) {
|
|
165
|
+
for (const prevPath of Object.keys(localeVersion.previousPathnames)) {
|
|
166
|
+
this.previousPathnameIndex[locale].delete(prevPath);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Remove locale from manifest
|
|
170
|
+
manifest.locales[locale] = undefined;
|
|
171
|
+
// Remove from content cache
|
|
172
|
+
const contentCache = this.contentCache.get(id);
|
|
173
|
+
if (contentCache) {
|
|
174
|
+
delete contentCache[locale];
|
|
175
|
+
}
|
|
176
|
+
// If no DEFINED locales left, remove the entire entry. Count values, not
|
|
177
|
+
// keys — the removal above assigns `undefined` (keeping the key), so the
|
|
178
|
+
// key count never reaches zero (BaseContentIndex.removeLocale already
|
|
179
|
+
// counts defined values; this mirrored it incorrectly).
|
|
180
|
+
if (Object.values(manifest.locales).every((lv) => lv === undefined)) {
|
|
181
|
+
this.removeEntry(id);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Remove an entry from the index
|
|
186
|
+
*/
|
|
187
|
+
removeEntry(id) {
|
|
188
|
+
const manifest = this.index.get(id);
|
|
189
|
+
if (!manifest)
|
|
190
|
+
return;
|
|
191
|
+
// Remove from pathname indexes
|
|
192
|
+
for (const localeVersion of localesOf(manifest)) {
|
|
193
|
+
const { locale } = localeVersion;
|
|
194
|
+
if (localeVersion.pathname) {
|
|
195
|
+
this.pathnameIndex[locale].delete(localeVersion.pathname);
|
|
196
|
+
}
|
|
197
|
+
if (localeVersion.previousPathnames) {
|
|
198
|
+
for (const prevPath of Object.keys(localeVersion.previousPathnames)) {
|
|
199
|
+
this.previousPathnameIndex[locale].delete(prevPath);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// Remove from primary index
|
|
204
|
+
this.index.delete(id);
|
|
205
|
+
// Remove from content cache
|
|
206
|
+
this.contentCache.delete(id);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Get cached content for a specific locale
|
|
210
|
+
*/
|
|
211
|
+
getCachedContent(id, locale) {
|
|
212
|
+
const localeContent = this.contentCache.get(id);
|
|
213
|
+
return localeContent?.[locale] || null;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get content manifest
|
|
217
|
+
*/
|
|
218
|
+
getManifest(id) {
|
|
219
|
+
return this.index.get(id) || null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Find content by pathname
|
|
223
|
+
*/
|
|
224
|
+
getByPathname(pathname, locale) {
|
|
225
|
+
if (locale) {
|
|
226
|
+
return this.pathnameIndex[locale]?.get(pathname) || null;
|
|
227
|
+
}
|
|
228
|
+
// Check all locales
|
|
229
|
+
for (const locale of this.locales) {
|
|
230
|
+
const manifest = this.pathnameIndex[locale].get(pathname);
|
|
231
|
+
if (manifest) {
|
|
232
|
+
return manifest;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Find content by previous pathname (for redirects)
|
|
239
|
+
*/
|
|
240
|
+
getByPreviousPathname(pathname, locale) {
|
|
241
|
+
if (locale) {
|
|
242
|
+
return this.previousPathnameIndex[locale]?.get(pathname) || null;
|
|
243
|
+
}
|
|
244
|
+
// Check all locales
|
|
245
|
+
for (const locale of this.locales) {
|
|
246
|
+
const manifest = this.previousPathnameIndex[locale].get(pathname);
|
|
247
|
+
if (manifest) {
|
|
248
|
+
return manifest;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Generator for all manifests
|
|
255
|
+
*/
|
|
256
|
+
*getAllManifests() {
|
|
257
|
+
for (const manifest of this.index.values()) {
|
|
258
|
+
yield manifest;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Generator for manifests by locale
|
|
263
|
+
*/
|
|
264
|
+
*getManifestsByLocale(locale) {
|
|
265
|
+
for (const manifest of this.index.values()) {
|
|
266
|
+
if (manifest.locales[locale]) {
|
|
267
|
+
yield manifest;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get the count of indexed content entries (unique IDs)
|
|
273
|
+
*/
|
|
274
|
+
get entryCount() {
|
|
275
|
+
return this.index.size;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Clear all indexes
|
|
279
|
+
*/
|
|
280
|
+
clear() {
|
|
281
|
+
this.index.clear();
|
|
282
|
+
this.contentCache.clear();
|
|
283
|
+
// Clear all Maps in the pathname indexes
|
|
284
|
+
for (const locale of this.locales) {
|
|
285
|
+
this.pathnameIndex[locale].clear();
|
|
286
|
+
this.previousPathnameIndex[locale].clear();
|
|
287
|
+
}
|
|
288
|
+
this.collections.clear();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=site-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-index.js","sourceRoot":"","sources":["../src/site-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAG/E;;;GAGG;AACH,MAAM,OAAO,SAAS;IAkBC,OAAO;IAjB5B,uCAAuC;IAC/B,KAAK,GAAiC,IAAI,GAAG,EAAE,CAAC;IAExD,2DAA2D;IACnD,YAAY,GAAoD,IAAI,GAAG,EAAE,CAAC;IAElF,0DAA0D;IAC1D,kFAAkF;IAC1E,aAAa,CAA+C;IAEpE,oFAAoF;IACpF,yDAAyD;IACjD,qBAAqB,CAA+C;IAE5E,gCAAgC;IACvB,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE9C,YAAqB,OAAiB;uBAAjB,OAAO;QAC1B,oFAAoF;QACpF,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;QAC1D,IAAI,CAAC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CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,yCAAyC;QACzC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;YACnC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/site.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContentAPI } from './content-api.interface.js';
|
|
2
|
+
import type { SiteIndex } from './site-index.js';
|
|
3
|
+
import type { ContentManifest, CreatePageInput, CreateResult, MoveResult, SiteFilters } from './types.js';
|
|
4
|
+
export declare class Site {
|
|
5
|
+
private siteName;
|
|
6
|
+
private api;
|
|
7
|
+
private siteIndex;
|
|
8
|
+
constructor(siteName: string, api: ContentAPI, siteIndex: SiteIndex);
|
|
9
|
+
listContent(filters?: SiteFilters): Generator<ContentManifest>;
|
|
10
|
+
listPages(locale?: string): Generator<ContentManifest>;
|
|
11
|
+
get collections(): Set<string>;
|
|
12
|
+
/** The languages this site's pages are in. */
|
|
13
|
+
get locales(): readonly string[];
|
|
14
|
+
getByPathname(pathname: string, locale?: string): ContentManifest | null;
|
|
15
|
+
getByPreviousPathname(pathname: string, locale?: string): ContentManifest | null;
|
|
16
|
+
move(id: string, locale: string, newPathname: string): Promise<MoveResult>;
|
|
17
|
+
getRedirect(pathname: string): ContentManifest | null;
|
|
18
|
+
isPathnameAvailable(pathname: string, locale: string, excludeId?: string): boolean;
|
|
19
|
+
getPathnameConflict(pathname: string, locale: string, excludeId?: string): string | null;
|
|
20
|
+
isPathnameInRedirects(pathname: string, locale: string): boolean;
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,GAAG,IAAI,CAEpD;IAGD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAcjF;IAGD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvF;IAGD,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D;IAGK,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CA8BzD;CACF"}
|
package/dist/site.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { localesOf } from './content-utils.js';
|
|
2
|
+
export class Site {
|
|
3
|
+
siteName;
|
|
4
|
+
api;
|
|
5
|
+
siteIndex;
|
|
6
|
+
constructor(siteName, api, siteIndex) {
|
|
7
|
+
this.siteName = siteName;
|
|
8
|
+
this.api = api;
|
|
9
|
+
this.siteIndex = siteIndex;
|
|
10
|
+
}
|
|
11
|
+
// Content discovery
|
|
12
|
+
*listContent(filters) {
|
|
13
|
+
// Get the base manifests using the most efficient method
|
|
14
|
+
let manifests;
|
|
15
|
+
if (filters?.locales && filters.locales.length === 1) {
|
|
16
|
+
manifests = this.siteIndex.getManifestsByLocale(filters.locales[0]);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
manifests = this.siteIndex.getAllManifests();
|
|
20
|
+
}
|
|
21
|
+
// Apply additional filters if needed
|
|
22
|
+
if (filters?.collection || filters?.type || filters?.published !== undefined) {
|
|
23
|
+
for (const manifest of manifests) {
|
|
24
|
+
if (filters.collection && manifest.collection !== filters.collection)
|
|
25
|
+
continue;
|
|
26
|
+
if (filters.type && manifest.type !== filters.type)
|
|
27
|
+
continue;
|
|
28
|
+
if (filters.published !== undefined) {
|
|
29
|
+
// Check if any locale is published
|
|
30
|
+
let hasPublishedLocale = false;
|
|
31
|
+
for (const locale of localesOf(manifest)) {
|
|
32
|
+
if (!locale.unpublishAt || new Date(locale.unpublishAt) > new Date()) {
|
|
33
|
+
hasPublishedLocale = true;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (filters.published !== hasPublishedLocale)
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
yield manifest;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// No additional filters, yield all manifests
|
|
45
|
+
yield* manifests;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// List pages (convenience method for middleware)
|
|
49
|
+
*listPages(locale) {
|
|
50
|
+
const filters = {};
|
|
51
|
+
if (locale)
|
|
52
|
+
filters.locales = [locale];
|
|
53
|
+
yield* this.listContent(filters);
|
|
54
|
+
}
|
|
55
|
+
// Get all collections for this site
|
|
56
|
+
get collections() {
|
|
57
|
+
return this.siteIndex.collections;
|
|
58
|
+
}
|
|
59
|
+
/** The languages this site's pages are in. */
|
|
60
|
+
get locales() {
|
|
61
|
+
return this.siteIndex.locales;
|
|
62
|
+
}
|
|
63
|
+
// Pathname operations (returns null if available, ContentManifest if taken)
|
|
64
|
+
getByPathname(pathname, locale) {
|
|
65
|
+
return this.siteIndex.getByPathname(pathname, locale);
|
|
66
|
+
}
|
|
67
|
+
// Get by previous pathname (for redirects)
|
|
68
|
+
getByPreviousPathname(pathname, locale) {
|
|
69
|
+
return this.siteIndex.getByPreviousPathname(pathname, locale);
|
|
70
|
+
}
|
|
71
|
+
// Move content (handles rename + redirect tracking)
|
|
72
|
+
async move(id, locale, newPathname) {
|
|
73
|
+
// Check if new pathname is available
|
|
74
|
+
const existing = this.getByPathname(newPathname, locale);
|
|
75
|
+
if (existing && existing.id !== id) {
|
|
76
|
+
return {
|
|
77
|
+
moved: false,
|
|
78
|
+
reason: 'already_exists',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Get current content
|
|
82
|
+
const content = await this.api.getLocalized(id, locale);
|
|
83
|
+
if (!content) {
|
|
84
|
+
return {
|
|
85
|
+
moved: false,
|
|
86
|
+
reason: 'not_found',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Update with new pathname (this will handle previousPathnames)
|
|
90
|
+
const updateResult = await this.api.updateLocalized({
|
|
91
|
+
id,
|
|
92
|
+
locale,
|
|
93
|
+
data: {
|
|
94
|
+
pathname: newPathname,
|
|
95
|
+
meta: content.localized.meta,
|
|
96
|
+
},
|
|
97
|
+
etag: content.localized.etag,
|
|
98
|
+
});
|
|
99
|
+
if (!updateResult.success) {
|
|
100
|
+
const { reason } = updateResult;
|
|
101
|
+
return {
|
|
102
|
+
moved: false,
|
|
103
|
+
// A move reports anything already taken as `already_exists`, as the check above does. It
|
|
104
|
+
// sends no name, so a malformed one is no fault of the move's: `write_error`.
|
|
105
|
+
reason: reason === 'pathname_taken' || reason === 'pathname_in_redirects' || reason === 'name_taken'
|
|
106
|
+
? 'already_exists'
|
|
107
|
+
: reason === 'invalid_name'
|
|
108
|
+
? 'write_error'
|
|
109
|
+
: reason,
|
|
110
|
+
error: updateResult.error,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
moved: true,
|
|
115
|
+
previousPathname: content.localized.pathname,
|
|
116
|
+
etag: updateResult.etag,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Check if pathname is in redirect history
|
|
120
|
+
getRedirect(pathname) {
|
|
121
|
+
return this.siteIndex.getByPreviousPathname(pathname);
|
|
122
|
+
}
|
|
123
|
+
// Validate pathname is available (not taken or in redirects)
|
|
124
|
+
isPathnameAvailable(pathname, locale, excludeId) {
|
|
125
|
+
// Check if pathname is already taken
|
|
126
|
+
const existing = this.getByPathname(pathname, locale);
|
|
127
|
+
if (existing && existing.id !== excludeId) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
// Check if pathname is in redirects
|
|
131
|
+
const redirect = this.getByPreviousPathname(pathname, locale);
|
|
132
|
+
if (redirect && redirect.id !== excludeId) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
// Get the ID of content that conflicts with a pathname
|
|
138
|
+
getPathnameConflict(pathname, locale, excludeId) {
|
|
139
|
+
const existing = this.getByPathname(pathname, locale);
|
|
140
|
+
if (existing && existing.id !== excludeId) {
|
|
141
|
+
return existing.id;
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
// Check if pathname is in redirects
|
|
146
|
+
isPathnameInRedirects(pathname, locale) {
|
|
147
|
+
return this.getByPreviousPathname(pathname, locale) !== null;
|
|
148
|
+
}
|
|
149
|
+
// Create page with validation
|
|
150
|
+
async create(data) {
|
|
151
|
+
// Validate pathname availability for all locales
|
|
152
|
+
for (const [locale, localeData] of Object.entries(data.locales)) {
|
|
153
|
+
const existing = this.getByPathname(localeData.pathname, locale);
|
|
154
|
+
if (existing) {
|
|
155
|
+
return {
|
|
156
|
+
success: false,
|
|
157
|
+
reason: 'pathname_taken',
|
|
158
|
+
error: new Error(`Pathname ${localeData.pathname} is already in use for locale ${locale}`),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
// Check redirects too
|
|
162
|
+
const redirect = this.getRedirect(localeData.pathname);
|
|
163
|
+
if (redirect) {
|
|
164
|
+
return {
|
|
165
|
+
success: false,
|
|
166
|
+
reason: 'pathname_in_redirects',
|
|
167
|
+
error: new Error(`Pathname ${localeData.pathname} is in redirect history for locale ${locale}`),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return this.api.createContent({
|
|
172
|
+
kind: 'page',
|
|
173
|
+
site: this.siteName,
|
|
174
|
+
collection: data.collection,
|
|
175
|
+
type: 'puck',
|
|
176
|
+
locales: data.locales,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+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