@blinkk/root-cms 1.4.1 → 1.4.2

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
@@ -7,7 +7,7 @@ import { render as renderToString } from "preact-render-to-string";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@blinkk/root-cms",
10
- version: "1.4.1",
10
+ version: "1.4.2",
11
11
  author: "s@blinkk.com",
12
12
  license: "MIT",
13
13
  engines: {
@@ -138,7 +138,7 @@ var package_default = {
138
138
  vitest: "0.34.6"
139
139
  },
140
140
  peerDependencies: {
141
- "@blinkk/root": "1.4.1",
141
+ "@blinkk/root": "1.4.2",
142
142
  "firebase-admin": ">=11",
143
143
  "firebase-functions": ">=4",
144
144
  preact: ">=10",
@@ -294,7 +294,8 @@ ${mainHtml}`;
294
294
  }
295
295
  function serializeCollection(collection) {
296
296
  return {
297
- name: collection.name,
297
+ id: collection.id,
298
+ name: collection.name ?? collection.id,
298
299
  description: collection.description,
299
300
  domain: collection.domain,
300
301
  url: collection.url,
@@ -385,11 +386,15 @@ function getCollections() {
385
386
  const schemas = getProjectSchemas();
386
387
  Object.entries(schemas).forEach(([fileId, schema]) => {
387
388
  if (fileId.startsWith("/collections/")) {
388
- collections[schema.name] = schema;
389
+ const collectionId = parseCollectionId(fileId);
390
+ collections[collectionId] = { ...schema, id: collectionId };
389
391
  }
390
392
  });
391
393
  return collections;
392
394
  }
395
+ function parseCollectionId(fileId) {
396
+ return path.basename(fileId).split(".")[0];
397
+ }
393
398
  function generateNonce() {
394
399
  return crypto.randomBytes(16).toString("base64");
395
400
  }
package/dist/core.d.ts CHANGED
@@ -2,7 +2,7 @@ import { L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslat
2
2
  export { A as Action, p as ArrayObject, c as DataSource, d as DataSourceData, e as DataSourceMode, D as Doc, b as DocMode, h as GetCountOptions, G as GetDocOptions, H as HttpMethod, j as ListActionsOptions, g as ListDocsOptions, R as Release, k as RootCMSClient, f as SaveDraftOptions, S as SetDocOptions, i as Translation, U as UserRole, m as getCmsPlugin, l as isRichTextData, q as marshalArray, n as marshalData, o as normalizeData, v as parseDocId, t as toArrayObject, s as translationsForLocale, r as unmarshalArray, u as unmarshalData } from './client-98Le1XxF.js';
3
3
  import { RootConfig } from '@blinkk/root';
4
4
  import { Query } from 'firebase-admin/firestore';
5
- export { s as schema } from './schema-ix967Ud0.js';
5
+ export { s as schema } from './schema-QC1UuoYc.js';
6
6
  import 'firebase-admin/app';
7
7
  import 'preact';
8
8
 
package/dist/project.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as Schema } from './schema-ix967Ud0.js';
1
+ import { S as Schema } from './schema-QC1UuoYc.js';
2
2
  import 'preact';
3
3
 
4
4
  /**
@@ -164,6 +164,11 @@ declare function defineSchema(schema: Schema): Schema;
164
164
  /** Defines the schema for a collection or reusable component. */
165
165
  declare const define: typeof defineSchema;
166
166
  type Collection = Schema & {
167
+ /**
168
+ * The ID of the collection. This comes from the schema filename, e.g
169
+ * `<id>.schema.ts`.
170
+ */
171
+ id: string;
167
172
  /**
168
173
  * Domain where the collection serves from. Used for multi-domain sites,
169
174
  * defaults to the "domain" value `from root.config.ts`.