@blinkk/root-cms 2.5.14 → 2.5.15

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/app.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getServerVersion
3
- } from "./chunk-KG774TBP.js";
3
+ } from "./chunk-NMUXWSFO.js";
4
4
  import {
5
5
  getCollectionSchema,
6
6
  getProjectSchemas
@@ -1501,10 +1501,41 @@ ${errorMessages}`);
1501
1501
  const docRef = this.db.doc(dbPath);
1502
1502
  const doc = await docRef.get();
1503
1503
  if (doc.exists) {
1504
- return doc.data();
1504
+ const dataSource = doc.data();
1505
+ if (dataSource.archivedAt) {
1506
+ console.warn(
1507
+ `warning: data source "${dataSourceId}" is archived` + (dataSource.archivedBy ? ` (archived by ${dataSource.archivedBy})` : "")
1508
+ );
1509
+ }
1510
+ return dataSource;
1505
1511
  }
1506
1512
  return null;
1507
1513
  }
1514
+ /**
1515
+ * Archives a data source. Archived data sources cannot be synced or published.
1516
+ */
1517
+ async archiveDataSource(dataSourceId, options) {
1518
+ const dbPath = `Projects/${this.projectId}/DataSources/${dataSourceId}`;
1519
+ const docRef = this.db.doc(dbPath);
1520
+ const archivedBy = options?.archivedBy || "root-cms-client";
1521
+ await docRef.update({
1522
+ archivedAt: Timestamp2.now(),
1523
+ archivedBy
1524
+ });
1525
+ console.log(`archived data source: ${dataSourceId}`);
1526
+ }
1527
+ /**
1528
+ * Unarchives a data source.
1529
+ */
1530
+ async unarchiveDataSource(dataSourceId) {
1531
+ const dbPath = `Projects/${this.projectId}/DataSources/${dataSourceId}`;
1532
+ const docRef = this.db.doc(dbPath);
1533
+ await docRef.update({
1534
+ archivedAt: FieldValue2.delete(),
1535
+ archivedBy: FieldValue2.delete()
1536
+ });
1537
+ console.log(`unarchived data source: ${dataSourceId}`);
1538
+ }
1508
1539
  /**
1509
1540
  * Syncs a data source to draft state.
1510
1541
  */
@@ -1513,6 +1544,9 @@ ${errorMessages}`);
1513
1544
  if (!dataSource) {
1514
1545
  throw new Error(`data source not found: ${dataSourceId}`);
1515
1546
  }
1547
+ if (dataSource.archivedAt) {
1548
+ throw new Error(`data source is archived: ${dataSourceId}`);
1549
+ }
1516
1550
  const result = await this.fetchData(dataSource);
1517
1551
  const dataSourceDocRef = this.db.doc(
1518
1552
  `Projects/${this.projectId}/DataSources/${dataSourceId}`
@@ -1545,6 +1579,9 @@ ${errorMessages}`);
1545
1579
  if (!dataSource) {
1546
1580
  throw new Error(`data source not found: ${dataSourceId}`);
1547
1581
  }
1582
+ if (dataSource.archivedAt) {
1583
+ throw new Error(`data source is archived: ${dataSourceId}`);
1584
+ }
1548
1585
  const dataSourceDocRef = this.db.doc(
1549
1586
  `Projects/${this.projectId}/DataSources/${dataSourceId}`
1550
1587
  );
@@ -1586,6 +1623,9 @@ ${errorMessages}`);
1586
1623
  if (!dataSource) {
1587
1624
  throw new Error(`data source not found: ${id}`);
1588
1625
  }
1626
+ if (dataSource.archivedAt) {
1627
+ throw new Error(`data source is archived: ${id}`);
1628
+ }
1589
1629
  const dataSourceDocRef = this.db.doc(
1590
1630
  `Projects/${this.projectId}/DataSources/${id}`
1591
1631
  );
@@ -1751,7 +1791,14 @@ ${errorMessages}`);
1751
1791
  const docRef = this.dbDataSourceDataRef(dataSourceId, { mode });
1752
1792
  const doc = await docRef.get();
1753
1793
  if (doc.exists) {
1754
- return doc.data();
1794
+ const dataSourceData = doc.data();
1795
+ if (dataSourceData.dataSource?.archivedAt) {
1796
+ const archivedBy = dataSourceData.dataSource.archivedBy;
1797
+ console.warn(
1798
+ `warning: data source "${dataSourceId}" is archived` + (archivedBy ? ` (archived by ${archivedBy})` : "")
1799
+ );
1800
+ }
1801
+ return dataSourceData;
1755
1802
  }
1756
1803
  return null;
1757
1804
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RootCMSClient,
3
3
  getCmsPlugin
4
- } from "./chunk-YMUZ5H5C.js";
4
+ } from "./chunk-47KOES6P.js";
5
5
 
6
6
  // core/versions.ts
7
7
  import fs from "fs";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@blinkk/root-cms",
4
- version: "2.5.14",
4
+ version: "2.5.15",
5
5
  author: "s@blinkk.com",
6
6
  license: "MIT",
7
7
  engines: {
@@ -169,7 +169,7 @@ var package_default = {
169
169
  yjs: "13.6.27"
170
170
  },
171
171
  peerDependencies: {
172
- "@blinkk/root": "2.5.14",
172
+ "@blinkk/root": "2.5.15",
173
173
  "firebase-admin": ">=11",
174
174
  "firebase-functions": ">=4",
175
175
  preact: ">=10",
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  RootCMSClient,
6
6
  getCmsPlugin,
7
7
  unmarshalData
8
- } from "./chunk-YMUZ5H5C.js";
8
+ } from "./chunk-47KOES6P.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
 
11
11
  // cli/cli.ts
@@ -624,6 +624,8 @@ interface DataSource {
624
624
  syncedBy?: string;
625
625
  publishedAt?: Timestamp;
626
626
  publishedBy?: string;
627
+ archivedAt?: Timestamp;
628
+ archivedBy?: string;
627
629
  }
628
630
  interface DataSourceData<T = any> {
629
631
  dataSource: DataSource;
@@ -1005,6 +1007,16 @@ declare class RootCMSClient {
1005
1007
  * Returns a data source configuration object.
1006
1008
  */
1007
1009
  getDataSource(dataSourceId: string): Promise<DataSource | null>;
1010
+ /**
1011
+ * Archives a data source. Archived data sources cannot be synced or published.
1012
+ */
1013
+ archiveDataSource(dataSourceId: string, options?: {
1014
+ archivedBy?: string;
1015
+ }): Promise<void>;
1016
+ /**
1017
+ * Unarchives a data source.
1018
+ */
1019
+ unarchiveDataSource(dataSourceId: string): Promise<void>;
1008
1020
  /**
1009
1021
  * Syncs a data source to draft state.
1010
1022
  */
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-cP6yMgT8.js';
4
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-DUc18VW8.js';
5
5
  import './schema-D7MOj-YC.js';
package/dist/client.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  translationsForLocale,
13
13
  unmarshalArray,
14
14
  unmarshalData
15
- } from "./chunk-YMUZ5H5C.js";
15
+ } from "./chunk-47KOES6P.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
  export {
18
18
  BatchRequest,
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-cP6yMgT8.js';
2
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-cP6yMgT8.js';
1
+ import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-DUc18VW8.js';
2
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-DUc18VW8.js';
3
3
  import { Request, RootConfig, Response, RouteParams, GetStaticProps, GetStaticPaths } from '@blinkk/root';
4
4
  import { Query } from 'firebase-admin/firestore';
5
5
  export { s as schema } from './schema-D7MOj-YC.js';
package/dist/core.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  translationsForLocale,
17
17
  unmarshalArray,
18
18
  unmarshalData
19
- } from "./chunk-YMUZ5H5C.js";
19
+ } from "./chunk-47KOES6P.js";
20
20
  import {
21
21
  __export
22
22
  } from "./chunk-MLKGABMK.js";
package/dist/functions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runCronJobs
3
- } from "./chunk-H6ZKML2S.js";
4
- import "./chunk-YMUZ5H5C.js";
3
+ } from "./chunk-5Y3VCZEZ.js";
4
+ import "./chunk-47KOES6P.js";
5
5
  import "./chunk-MLKGABMK.js";
6
6
 
7
7
  // core/functions.ts
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-cP6yMgT8.js';
4
+ export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-DUc18VW8.js';
5
5
  import './schema-D7MOj-YC.js';
package/dist/plugin.js CHANGED
@@ -4,15 +4,15 @@ import {
4
4
  } from "./chunk-T5UK2H24.js";
5
5
  import {
6
6
  getServerVersion
7
- } from "./chunk-KG774TBP.js";
7
+ } from "./chunk-NMUXWSFO.js";
8
8
  import {
9
9
  runCronJobs
10
- } from "./chunk-H6ZKML2S.js";
10
+ } from "./chunk-5Y3VCZEZ.js";
11
11
  import {
12
12
  RootCMSClient,
13
13
  parseDocId,
14
14
  unmarshalData
15
- } from "./chunk-YMUZ5H5C.js";
15
+ } from "./chunk-47KOES6P.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
 
18
18
  // core/plugin.ts