@contentrain/query 7.1.0 → 7.2.1

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.
@@ -1,3 +1,5 @@
1
+ import { FieldDef } from "@contentrain/types";
2
+
1
3
  //#region src/cdn/data-source.d.ts
2
4
  interface CollectionDataSource<T> {
3
5
  getAll(locale: string): Promise<T[]>;
@@ -194,49 +196,152 @@ declare class MediaAccessor {
194
196
  }
195
197
  //#endregion
196
198
  //#region src/cdn/forms-client.d.ts
197
- interface FormFieldConfig {
198
- id: string;
199
- type: string;
200
- required?: boolean;
201
- label?: string;
202
- placeholder?: string;
203
- options?: Array<{
204
- value: string;
205
- label: string;
206
- }>;
207
- pattern?: string;
208
- min?: number;
209
- max?: number;
210
- }
199
+ /** One exposed field, as the model defines it. */
200
+ type FormFieldConfig = FieldDef;
211
201
  interface FormConfig {
212
202
  modelId: string;
213
- fields: FormFieldConfig[];
214
- captchaType?: 'turnstile' | null;
203
+ /** The project's default locale — what a submission is validated against and written to. */
204
+ locale: string;
205
+ /** Exposed fields only, keyed by field id. */
206
+ fields: Record<string, FormFieldConfig>;
207
+ captcha: 'turnstile' | null;
208
+ /** Turnstile widget key, when `captcha` is set and the operator configured one. */
209
+ captchaSiteKey: string | null;
215
210
  successMessage?: string;
216
- honeypotField?: string;
211
+ /** Name of the hidden honeypot input to render (and leave empty), or null. */
212
+ honeypotField: string | null;
213
+ }
214
+ interface FormFieldError {
215
+ field: string;
216
+ message: string;
217
217
  }
218
218
  interface FormSubmitResult {
219
219
  success: boolean;
220
+ /** The model's `successMessage` on success. */
220
221
  message?: string;
221
- errors?: Array<{
222
- field: string;
223
- message: string;
224
- }>;
222
+ /** Validation errors against the exposed fields, or `captcha`. */
223
+ errors?: FormFieldError[];
224
+ }
225
+ interface FormSubmitOptions {
226
+ /** Turnstile token, when the config's `captcha` is set. */
227
+ captchaToken?: string;
228
+ /** Value of the honeypot input. A human leaves it empty; a filled one is silently dropped server-side. */
229
+ honeypot?: string;
225
230
  }
226
231
  interface FormsClientConfig {
232
+ /** Public API root — `https://studio.contentrain.io/api/forms/v1`. */
227
233
  baseUrl: string;
228
234
  projectId: string;
229
- apiKey?: string;
230
235
  }
231
236
  declare class FormsClient {
232
237
  private _baseUrl;
233
238
  private _projectId;
234
- private _apiKey;
235
239
  constructor(config: FormsClientConfig);
236
240
  config(modelId: string): Promise<FormConfig>;
237
- submit(modelId: string, data: Record<string, unknown>, options?: {
238
- captchaToken?: string;
239
- }): Promise<FormSubmitResult>;
241
+ /**
242
+ * Resolves with the server's verdict for 2xx responses — including
243
+ * `{ success: false, errors }` for validation failures, which are not
244
+ * exceptions. Rejects with `ContentrainError` on 403/404/429/5xx.
245
+ */
246
+ submit(modelId: string, data: Record<string, unknown>, options?: FormSubmitOptions): Promise<FormSubmitResult>;
247
+ }
248
+ //#endregion
249
+ //#region src/cdn/comments-client.d.ts
250
+ type CommentType = 'comment' | 'pingback' | 'trackback';
251
+ interface CommentAuthor {
252
+ name: string;
253
+ url: string | null;
254
+ /** Written from Studio by a workspace member. */
255
+ isModerator: boolean;
256
+ }
257
+ interface PublicComment {
258
+ id: string;
259
+ parentId: string | null;
260
+ depth: number;
261
+ author: CommentAuthor;
262
+ /** Plain text. */
263
+ body: string;
264
+ type: CommentType;
265
+ /** ISO 8601. */
266
+ createdAt: string;
267
+ replies: PublicComment[];
268
+ }
269
+ interface CommentThreadConfig {
270
+ /** Thread closed → render the comments, hide the form. */
271
+ closed: boolean;
272
+ requireApproval: boolean;
273
+ requireEmail: boolean;
274
+ /** Reply nesting cap for new submissions (0 = flat). */
275
+ maxDepth: number;
276
+ maxBodyLength: number;
277
+ captcha: 'turnstile' | null;
278
+ captchaSiteKey: string | null;
279
+ honeypotField: string | null;
280
+ }
281
+ interface CommentThread {
282
+ entry: {
283
+ modelId: string;
284
+ entryId: string;
285
+ locale: string;
286
+ };
287
+ config: CommentThreadConfig;
288
+ /** Root comments of this page, replies nested. */
289
+ comments: PublicComment[];
290
+ /** Root comments in total. */
291
+ total: number;
292
+ page: number;
293
+ limit: number;
294
+ }
295
+ interface CommentThreadQuery {
296
+ locale?: string;
297
+ page?: number;
298
+ limit?: number;
299
+ sort?: 'oldest' | 'newest';
300
+ }
301
+ interface CommentSubmission {
302
+ author: {
303
+ name: string;
304
+ email?: string;
305
+ url?: string;
306
+ };
307
+ body: string;
308
+ /** Reply target — an approved comment's id; omitted or null for a root comment. */
309
+ parentId?: string | null;
310
+ captchaToken?: string;
311
+ /** Value of the honeypot input (`config.honeypotField`); a human leaves it empty. */
312
+ honeypot?: string;
313
+ }
314
+ interface CommentFieldError {
315
+ /** `author.name` · `author.email` · `author.url` · `body` · `parentId` · `captcha` */
316
+ field: string;
317
+ message: string;
318
+ }
319
+ interface CommentSubmitResult {
320
+ success: boolean;
321
+ /** `approved` renders now; `pending` is only echoed back to its author. */
322
+ status?: 'pending' | 'approved';
323
+ /** The stored comment, in the public shape. Absent when the honeypot swallowed the post. */
324
+ comment?: PublicComment;
325
+ errors?: CommentFieldError[];
326
+ }
327
+ interface CommentsClientConfig {
328
+ /** Public API root — `https://studio.contentrain.io/api/comments/v1`. */
329
+ baseUrl: string;
330
+ projectId: string;
331
+ }
332
+ declare class CommentsClient {
333
+ private _baseUrl;
334
+ private _projectId;
335
+ constructor(config: CommentsClientConfig);
336
+ thread(modelId: string, entryId: string, query?: CommentThreadQuery): Promise<CommentThread>;
337
+ /**
338
+ * Resolves with the server's verdict for 2xx responses — including
339
+ * `{ success: false, errors }`. Rejects with `ContentrainError` on
340
+ * 403 (thread closed / plan), 404, 429 and 5xx.
341
+ */
342
+ submit(modelId: string, entryId: string, submission: CommentSubmission, options?: {
343
+ locale?: string;
344
+ }): Promise<CommentSubmitResult>;
240
345
  }
241
346
  //#endregion
242
347
  //#region src/cdn/conversation-client.d.ts
@@ -320,6 +425,7 @@ declare function createContentrain(config: ContentrainCDNConfig): {
320
425
  document: <T extends object = Record<string, unknown>>(modelId: string) => CdnDocumentQuery<T>;
321
426
  media: () => MediaAccessor;
322
427
  form: () => FormsClient;
428
+ comments: () => CommentsClient;
323
429
  conversation: () => ConversationClient;
324
430
  manifest: () => Promise<unknown>;
325
431
  models: () => Promise<unknown[]>;
@@ -327,5 +433,5 @@ declare function createContentrain(config: ContentrainCDNConfig): {
327
433
  preload: (locale?: string) => Promise<boolean>;
328
434
  };
329
435
  //#endregion
330
- export { applyWhere as A, CdnDocumentQuery as C, EntryMeta as D, CdnCollectionQuery as E, DocumentDataSource as F, DocumentIndexEntry as I, SingletonDataSource as L, TransportConfig as M, CollectionDataSource as N, WhereClause as O, DictionaryDataSource as P, MediaManifest as S, CdnSingletonAccessor as T, FormsClient as _, ConversationClient as a, MediaAsset as b, ConversationHistory as c, ConversationSendOptions as d, ConversationToolResult as f, FormSubmitResult as g, FormFieldConfig as h, ContentrainError as i, HttpTransport as j, WhereOp as k, ConversationMessage as l, FormConfig as m, ContentrainCDNConfig as n, ConversationClientConfig as o, ConversationUsage as p, createContentrain as r, ConversationContext as s, ContentrainCDNClient as t, ConversationResponse as u, FormsClientConfig as v, CdnDictionaryAccessor as w, MediaAssetMeta as x, MediaAccessor as y };
331
- //# sourceMappingURL=index-mxo0dHvb.d.cts.map
436
+ export { FormsClient as A, EntryMeta as B, CommentsClientConfig as C, FormFieldError as D, FormFieldConfig as E, MediaManifest as F, TransportConfig as G, WhereOp as H, CdnDocumentQuery as I, DocumentDataSource as J, CollectionDataSource as K, CdnDictionaryAccessor as L, MediaAccessor as M, MediaAsset as N, FormSubmitOptions as O, MediaAssetMeta as P, CdnSingletonAccessor as R, CommentsClient as S, FormConfig as T, applyWhere as U, WhereClause as V, HttpTransport as W, SingletonDataSource as X, DocumentIndexEntry as Y, CommentSubmitResult as _, ConversationClient as a, CommentThreadQuery as b, ConversationHistory as c, ConversationSendOptions as d, ConversationToolResult as f, CommentSubmission as g, CommentFieldError as h, ContentrainError as i, FormsClientConfig as j, FormSubmitResult as k, ConversationMessage as l, CommentAuthor as m, ContentrainCDNConfig as n, ConversationClientConfig as o, ConversationUsage as p, DictionaryDataSource as q, createContentrain as r, ConversationContext as s, ContentrainCDNClient as t, ConversationResponse as u, CommentThread as v, PublicComment as w, CommentType as x, CommentThreadConfig as y, CdnCollectionQuery as z };
437
+ //# sourceMappingURL=index-Cjj6FPwV.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Cjj6FPwV.d.cts","names":[],"sources":["../src/cdn/data-source.ts","../src/cdn/http-transport.ts","../src/shared/where.ts","../src/cdn/collection-query.ts","../src/cdn/singleton-accessor.ts","../src/cdn/dictionary-accessor.ts","../src/cdn/document-query.ts","../src/cdn/media-accessor.ts","../src/cdn/forms-client.ts","../src/cdn/comments-client.ts","../src/cdn/conversation-client.ts","../src/cdn/errors.ts","../src/cdn/index.ts"],"mappings":";;;UAAiB,oBAAA;EACf,MAAA,CAAO,MAAA,WAAiB,OAAA,CAAQ,CAAA;EAChC,MAAA,CAAO,EAAA,UAAY,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAG7B,mBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGd,oBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,MAAA;AAAA;;;;;;;;;;;;;;KAgBnB,kBAAA,MAAwB,IAAA,CAAK,CAAA;AAAA,UAExB,kBAAA;EACf,QAAA,CAAS,MAAA,WAAiB,OAAA,CAAQ,kBAAA,CAAmB,CAAA;EACrD,SAAA,CAAU,IAAA,UAAc,MAAA,WAAiB,OAAA;IAAU,WAAA,EAAa,CAAA;IAAG,IAAA;IAAc,IAAA;EAAA;AAAA;;;UCtBlE,eAAA;EACf,OAAA;EACA,SAAA;EACA,MAAA;EDXmC;ECanC,MAAA;IAAqB,YAAA;EAAA;EACrB,aAAA;AAAA;AAAA,cAkBW,aAAA;EAAA,QACH,QAAA;EAAA,QACA,UAAA;EAAA,QACA,OAAA;EAAA,QACA,MA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GX,oBAAA,GAAuB,UAAA,QAAkB,iBAAA;AAAA,iBAErC,iBAAA,CAAkB,MAAA,EAAQ,oBAAA;kCAWT,MAAA,mBAAA,OAAA,aAA2C,kBAAA,CAAA,CAAA;wBAGlD,MAAA,oBAAuB,MAAA,mBAAA,OAAA,aAA2C,oBAAA,CAAA,CAAA;mCAG5D,qBAAA;gCAGD,MAAA,mBAAA,OAAA,aAA2C,gBAAA,CAAA,CAAA;;;;;;;yBAyBpD,OAAA;gCAEO,OAAA;AAAA"}
@@ -1,3 +1,5 @@
1
+ import { FieldDef } from "@contentrain/types";
2
+
1
3
  //#region src/cdn/data-source.d.ts
2
4
  interface CollectionDataSource<T> {
3
5
  getAll(locale: string): Promise<T[]>;
@@ -194,49 +196,152 @@ declare class MediaAccessor {
194
196
  }
195
197
  //#endregion
196
198
  //#region src/cdn/forms-client.d.ts
197
- interface FormFieldConfig {
198
- id: string;
199
- type: string;
200
- required?: boolean;
201
- label?: string;
202
- placeholder?: string;
203
- options?: Array<{
204
- value: string;
205
- label: string;
206
- }>;
207
- pattern?: string;
208
- min?: number;
209
- max?: number;
210
- }
199
+ /** One exposed field, as the model defines it. */
200
+ type FormFieldConfig = FieldDef;
211
201
  interface FormConfig {
212
202
  modelId: string;
213
- fields: FormFieldConfig[];
214
- captchaType?: 'turnstile' | null;
203
+ /** The project's default locale — what a submission is validated against and written to. */
204
+ locale: string;
205
+ /** Exposed fields only, keyed by field id. */
206
+ fields: Record<string, FormFieldConfig>;
207
+ captcha: 'turnstile' | null;
208
+ /** Turnstile widget key, when `captcha` is set and the operator configured one. */
209
+ captchaSiteKey: string | null;
215
210
  successMessage?: string;
216
- honeypotField?: string;
211
+ /** Name of the hidden honeypot input to render (and leave empty), or null. */
212
+ honeypotField: string | null;
213
+ }
214
+ interface FormFieldError {
215
+ field: string;
216
+ message: string;
217
217
  }
218
218
  interface FormSubmitResult {
219
219
  success: boolean;
220
+ /** The model's `successMessage` on success. */
220
221
  message?: string;
221
- errors?: Array<{
222
- field: string;
223
- message: string;
224
- }>;
222
+ /** Validation errors against the exposed fields, or `captcha`. */
223
+ errors?: FormFieldError[];
224
+ }
225
+ interface FormSubmitOptions {
226
+ /** Turnstile token, when the config's `captcha` is set. */
227
+ captchaToken?: string;
228
+ /** Value of the honeypot input. A human leaves it empty; a filled one is silently dropped server-side. */
229
+ honeypot?: string;
225
230
  }
226
231
  interface FormsClientConfig {
232
+ /** Public API root — `https://studio.contentrain.io/api/forms/v1`. */
227
233
  baseUrl: string;
228
234
  projectId: string;
229
- apiKey?: string;
230
235
  }
231
236
  declare class FormsClient {
232
237
  private _baseUrl;
233
238
  private _projectId;
234
- private _apiKey;
235
239
  constructor(config: FormsClientConfig);
236
240
  config(modelId: string): Promise<FormConfig>;
237
- submit(modelId: string, data: Record<string, unknown>, options?: {
238
- captchaToken?: string;
239
- }): Promise<FormSubmitResult>;
241
+ /**
242
+ * Resolves with the server's verdict for 2xx responses — including
243
+ * `{ success: false, errors }` for validation failures, which are not
244
+ * exceptions. Rejects with `ContentrainError` on 403/404/429/5xx.
245
+ */
246
+ submit(modelId: string, data: Record<string, unknown>, options?: FormSubmitOptions): Promise<FormSubmitResult>;
247
+ }
248
+ //#endregion
249
+ //#region src/cdn/comments-client.d.ts
250
+ type CommentType = 'comment' | 'pingback' | 'trackback';
251
+ interface CommentAuthor {
252
+ name: string;
253
+ url: string | null;
254
+ /** Written from Studio by a workspace member. */
255
+ isModerator: boolean;
256
+ }
257
+ interface PublicComment {
258
+ id: string;
259
+ parentId: string | null;
260
+ depth: number;
261
+ author: CommentAuthor;
262
+ /** Plain text. */
263
+ body: string;
264
+ type: CommentType;
265
+ /** ISO 8601. */
266
+ createdAt: string;
267
+ replies: PublicComment[];
268
+ }
269
+ interface CommentThreadConfig {
270
+ /** Thread closed → render the comments, hide the form. */
271
+ closed: boolean;
272
+ requireApproval: boolean;
273
+ requireEmail: boolean;
274
+ /** Reply nesting cap for new submissions (0 = flat). */
275
+ maxDepth: number;
276
+ maxBodyLength: number;
277
+ captcha: 'turnstile' | null;
278
+ captchaSiteKey: string | null;
279
+ honeypotField: string | null;
280
+ }
281
+ interface CommentThread {
282
+ entry: {
283
+ modelId: string;
284
+ entryId: string;
285
+ locale: string;
286
+ };
287
+ config: CommentThreadConfig;
288
+ /** Root comments of this page, replies nested. */
289
+ comments: PublicComment[];
290
+ /** Root comments in total. */
291
+ total: number;
292
+ page: number;
293
+ limit: number;
294
+ }
295
+ interface CommentThreadQuery {
296
+ locale?: string;
297
+ page?: number;
298
+ limit?: number;
299
+ sort?: 'oldest' | 'newest';
300
+ }
301
+ interface CommentSubmission {
302
+ author: {
303
+ name: string;
304
+ email?: string;
305
+ url?: string;
306
+ };
307
+ body: string;
308
+ /** Reply target — an approved comment's id; omitted or null for a root comment. */
309
+ parentId?: string | null;
310
+ captchaToken?: string;
311
+ /** Value of the honeypot input (`config.honeypotField`); a human leaves it empty. */
312
+ honeypot?: string;
313
+ }
314
+ interface CommentFieldError {
315
+ /** `author.name` · `author.email` · `author.url` · `body` · `parentId` · `captcha` */
316
+ field: string;
317
+ message: string;
318
+ }
319
+ interface CommentSubmitResult {
320
+ success: boolean;
321
+ /** `approved` renders now; `pending` is only echoed back to its author. */
322
+ status?: 'pending' | 'approved';
323
+ /** The stored comment, in the public shape. Absent when the honeypot swallowed the post. */
324
+ comment?: PublicComment;
325
+ errors?: CommentFieldError[];
326
+ }
327
+ interface CommentsClientConfig {
328
+ /** Public API root — `https://studio.contentrain.io/api/comments/v1`. */
329
+ baseUrl: string;
330
+ projectId: string;
331
+ }
332
+ declare class CommentsClient {
333
+ private _baseUrl;
334
+ private _projectId;
335
+ constructor(config: CommentsClientConfig);
336
+ thread(modelId: string, entryId: string, query?: CommentThreadQuery): Promise<CommentThread>;
337
+ /**
338
+ * Resolves with the server's verdict for 2xx responses — including
339
+ * `{ success: false, errors }`. Rejects with `ContentrainError` on
340
+ * 403 (thread closed / plan), 404, 429 and 5xx.
341
+ */
342
+ submit(modelId: string, entryId: string, submission: CommentSubmission, options?: {
343
+ locale?: string;
344
+ }): Promise<CommentSubmitResult>;
240
345
  }
241
346
  //#endregion
242
347
  //#region src/cdn/conversation-client.d.ts
@@ -320,6 +425,7 @@ declare function createContentrain(config: ContentrainCDNConfig): {
320
425
  document: <T extends object = Record<string, unknown>>(modelId: string) => CdnDocumentQuery<T>;
321
426
  media: () => MediaAccessor;
322
427
  form: () => FormsClient;
428
+ comments: () => CommentsClient;
323
429
  conversation: () => ConversationClient;
324
430
  manifest: () => Promise<unknown>;
325
431
  models: () => Promise<unknown[]>;
@@ -327,5 +433,5 @@ declare function createContentrain(config: ContentrainCDNConfig): {
327
433
  preload: (locale?: string) => Promise<boolean>;
328
434
  };
329
435
  //#endregion
330
- export { applyWhere as A, CdnDocumentQuery as C, EntryMeta as D, CdnCollectionQuery as E, DocumentDataSource as F, DocumentIndexEntry as I, SingletonDataSource as L, TransportConfig as M, CollectionDataSource as N, WhereClause as O, DictionaryDataSource as P, MediaManifest as S, CdnSingletonAccessor as T, FormsClient as _, ConversationClient as a, MediaAsset as b, ConversationHistory as c, ConversationSendOptions as d, ConversationToolResult as f, FormSubmitResult as g, FormFieldConfig as h, ContentrainError as i, HttpTransport as j, WhereOp as k, ConversationMessage as l, FormConfig as m, ContentrainCDNConfig as n, ConversationClientConfig as o, ConversationUsage as p, createContentrain as r, ConversationContext as s, ContentrainCDNClient as t, ConversationResponse as u, FormsClientConfig as v, CdnDictionaryAccessor as w, MediaAssetMeta as x, MediaAccessor as y };
331
- //# sourceMappingURL=index-DYWwX7xL.d.mts.map
436
+ export { FormsClient as A, EntryMeta as B, CommentsClientConfig as C, FormFieldError as D, FormFieldConfig as E, MediaManifest as F, TransportConfig as G, WhereOp as H, CdnDocumentQuery as I, DocumentDataSource as J, CollectionDataSource as K, CdnDictionaryAccessor as L, MediaAccessor as M, MediaAsset as N, FormSubmitOptions as O, MediaAssetMeta as P, CdnSingletonAccessor as R, CommentsClient as S, FormConfig as T, applyWhere as U, WhereClause as V, HttpTransport as W, SingletonDataSource as X, DocumentIndexEntry as Y, CommentSubmitResult as _, ConversationClient as a, CommentThreadQuery as b, ConversationHistory as c, ConversationSendOptions as d, ConversationToolResult as f, CommentSubmission as g, CommentFieldError as h, ContentrainError as i, FormsClientConfig as j, FormSubmitResult as k, ConversationMessage as l, CommentAuthor as m, ContentrainCDNConfig as n, ConversationClientConfig as o, ConversationUsage as p, DictionaryDataSource as q, createContentrain as r, ConversationContext as s, ContentrainCDNClient as t, ConversationResponse as u, CommentThread as v, PublicComment as w, CommentType as x, CommentThreadConfig as y, CdnCollectionQuery as z };
437
+ //# sourceMappingURL=index-hug7w9_n.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-hug7w9_n.d.mts","names":[],"sources":["../src/cdn/data-source.ts","../src/cdn/http-transport.ts","../src/shared/where.ts","../src/cdn/collection-query.ts","../src/cdn/singleton-accessor.ts","../src/cdn/dictionary-accessor.ts","../src/cdn/document-query.ts","../src/cdn/media-accessor.ts","../src/cdn/forms-client.ts","../src/cdn/comments-client.ts","../src/cdn/conversation-client.ts","../src/cdn/errors.ts","../src/cdn/index.ts"],"mappings":";;;UAAiB,oBAAA;EACf,MAAA,CAAO,MAAA,WAAiB,OAAA,CAAQ,CAAA;EAChC,MAAA,CAAO,EAAA,UAAY,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAG7B,mBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGd,oBAAA;EACf,GAAA,CAAI,MAAA,WAAiB,OAAA,CAAQ,MAAA;AAAA;;;;;;;;;;;;;;KAgBnB,kBAAA,MAAwB,IAAA,CAAK,CAAA;AAAA,UAExB,kBAAA;EACf,QAAA,CAAS,MAAA,WAAiB,OAAA,CAAQ,kBAAA,CAAmB,CAAA;EACrD,SAAA,CAAU,IAAA,UAAc,MAAA,WAAiB,OAAA;IAAU,WAAA,EAAa,CAAA;IAAG,IAAA;IAAc,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A,CAAQ,mBAAA;AAAA;;;cCxFlE,gBAAA,SAAyB,KAAA;EAE3B,MAAA;cAAA,MAAA,UACP,OAAA;AAAA;;;UCOa,oBAAA;EACf,SAAA;EACA,MAAA;EACA,OAAA;EACA,aAAA;EZbA;EYeA,MAAA;IAAqB,YAAA;EAAA;AAAA;AAAA,KAGX,oBAAA,GAAuB,UAAA,QAAkB,iBAAA;AAAA,iBAErC,iBAAA,CAAkB,MAAA,EAAQ,oBAAA;kCAWT,MAAA,mBAAA,OAAA,aAA2C,kBAAA,CAAA,CAAA;wBAGlD,MAAA,oBAAuB,MAAA,mBAAA,OAAA,aAA2C,oBAAA,CAAA,CAAA;mCAG5D,qBAAA;gCAGD,MAAA,mBAAA,OAAA,aAA2C,gBAAA,CAAA,CAAA;;;;;;;yBAyBpD,OAAA;gCAEO,OAAA;AAAA"}
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_cdn = require("./cdn-DrQCLLj6.cjs");
5
+ const require_cdn = require("./cdn-s8-GAk7S.cjs");
6
6
  //#region src/runtime/query.ts
7
7
  var QueryBuilder = class {
8
8
  _data;
@@ -390,6 +390,7 @@ async function createContentrainClient(projectRoot) {
390
390
  return await import(pathToFileURL(resolve(projectRoot ?? process.cwd(), ".contentrain", "client", "index.mjs")).href);
391
391
  }
392
392
  //#endregion
393
+ exports.CommentsClient = require_cdn.CommentsClient;
393
394
  exports.ContentrainError = require_cdn.ContentrainError;
394
395
  exports.ConversationClient = require_cdn.ConversationClient;
395
396
  exports.DictionaryAccessor = DictionaryAccessor;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as applyWhere, D as EntryMeta, I as DocumentIndexEntry, O as WhereClause, S as MediaManifest, _ as FormsClient, a as ConversationClient, b as MediaAsset, c as ConversationHistory, g as FormSubmitResult, h as FormFieldConfig, i as ContentrainError, k as WhereOp, l as ConversationMessage, m as FormConfig, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as FormsClientConfig, x as MediaAssetMeta, y as MediaAccessor } from "./index-mxo0dHvb.cjs";
1
+ import { A as FormsClient, B as EntryMeta, C as CommentsClientConfig, D as FormFieldError, E as FormFieldConfig, F as MediaManifest, H as WhereOp, M as MediaAccessor, N as MediaAsset, O as FormSubmitOptions, P as MediaAssetMeta, S as CommentsClient, T as FormConfig, U as applyWhere, V as WhereClause, Y as DocumentIndexEntry, _ as CommentSubmitResult, a as ConversationClient, b as CommentThreadQuery, c as ConversationHistory, g as CommentSubmission, h as CommentFieldError, i as ContentrainError, j as FormsClientConfig, k as FormSubmitResult, l as ConversationMessage, m as CommentAuthor, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as CommentThread, w as PublicComment, y as CommentThreadConfig } from "./index-Cjj6FPwV.cjs";
2
2
  import { ContentStatus, ContentrainConfig, FieldDef, FieldType, ModelDefinition, ModelKind } from "@contentrain/types";
3
3
 
4
4
  //#region src/runtime/query.d.ts
@@ -112,5 +112,5 @@ declare function createContentrainClient(projectRoot?: string): Promise<{
112
112
  document: (model: string) => DocumentQuery<Record<string, unknown>>;
113
113
  }>;
114
114
  //#endregion
115
- export { type ContentStatus, type ContentrainCDNClient, type ContentrainCDNConfig, type ContentrainConfig, ContentrainError, ConversationClient, type ConversationClientConfig, type ConversationHistory, type ConversationMessage, type ConversationResponse, DictionaryAccessor, type DocumentIndexEntry, DocumentQuery, type EntryMeta, type FieldDef, type FieldType, type FormConfig, type FormFieldConfig, type FormSubmitResult, FormsClient, type FormsClientConfig, MediaAccessor, type MediaAsset, type MediaAssetMeta, type MediaManifest, type ModelDefinition, type ModelKind, QueryBuilder, type RelationMeta, type RelationResolver, SingletonAccessor, type WhereClause, type WhereOp, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
115
+ export { type CommentAuthor, type CommentFieldError, type CommentSubmission, type CommentSubmitResult, type CommentThread, type CommentThreadConfig, type CommentThreadQuery, CommentsClient, type CommentsClientConfig, type ContentStatus, type ContentrainCDNClient, type ContentrainCDNConfig, type ContentrainConfig, ContentrainError, ConversationClient, type ConversationClientConfig, type ConversationHistory, type ConversationMessage, type ConversationResponse, DictionaryAccessor, type DocumentIndexEntry, DocumentQuery, type EntryMeta, type FieldDef, type FieldType, type FormConfig, type FormFieldConfig, type FormFieldError, type FormSubmitOptions, type FormSubmitResult, FormsClient, type FormsClientConfig, MediaAccessor, type MediaAsset, type MediaAssetMeta, type MediaManifest, type ModelDefinition, type ModelKind, type PublicComment, QueryBuilder, type RelationMeta, type RelationResolver, SingletonAccessor, type WhereClause, type WhereOp, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
116
116
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as applyWhere, D as EntryMeta, I as DocumentIndexEntry, O as WhereClause, S as MediaManifest, _ as FormsClient, a as ConversationClient, b as MediaAsset, c as ConversationHistory, g as FormSubmitResult, h as FormFieldConfig, i as ContentrainError, k as WhereOp, l as ConversationMessage, m as FormConfig, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as FormsClientConfig, x as MediaAssetMeta, y as MediaAccessor } from "./index-DYWwX7xL.mjs";
1
+ import { A as FormsClient, B as EntryMeta, C as CommentsClientConfig, D as FormFieldError, E as FormFieldConfig, F as MediaManifest, H as WhereOp, M as MediaAccessor, N as MediaAsset, O as FormSubmitOptions, P as MediaAssetMeta, S as CommentsClient, T as FormConfig, U as applyWhere, V as WhereClause, Y as DocumentIndexEntry, _ as CommentSubmitResult, a as ConversationClient, b as CommentThreadQuery, c as ConversationHistory, g as CommentSubmission, h as CommentFieldError, i as ContentrainError, j as FormsClientConfig, k as FormSubmitResult, l as ConversationMessage, m as CommentAuthor, n as ContentrainCDNConfig, o as ConversationClientConfig, r as createContentrain, t as ContentrainCDNClient, u as ConversationResponse, v as CommentThread, w as PublicComment, y as CommentThreadConfig } from "./index-hug7w9_n.mjs";
2
2
  import { ContentStatus, ContentrainConfig, FieldDef, FieldType, ModelDefinition, ModelKind } from "@contentrain/types";
3
3
 
4
4
  //#region src/runtime/query.d.ts
@@ -112,5 +112,5 @@ declare function createContentrainClient(projectRoot?: string): Promise<{
112
112
  document: (model: string) => DocumentQuery<Record<string, unknown>>;
113
113
  }>;
114
114
  //#endregion
115
- export { type ContentStatus, type ContentrainCDNClient, type ContentrainCDNConfig, type ContentrainConfig, ContentrainError, ConversationClient, type ConversationClientConfig, type ConversationHistory, type ConversationMessage, type ConversationResponse, DictionaryAccessor, type DocumentIndexEntry, DocumentQuery, type EntryMeta, type FieldDef, type FieldType, type FormConfig, type FormFieldConfig, type FormSubmitResult, FormsClient, type FormsClientConfig, MediaAccessor, type MediaAsset, type MediaAssetMeta, type MediaManifest, type ModelDefinition, type ModelKind, QueryBuilder, type RelationMeta, type RelationResolver, SingletonAccessor, type WhereClause, type WhereOp, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
115
+ export { type CommentAuthor, type CommentFieldError, type CommentSubmission, type CommentSubmitResult, type CommentThread, type CommentThreadConfig, type CommentThreadQuery, CommentsClient, type CommentsClientConfig, type ContentStatus, type ContentrainCDNClient, type ContentrainCDNConfig, type ContentrainConfig, ContentrainError, ConversationClient, type ConversationClientConfig, type ConversationHistory, type ConversationMessage, type ConversationResponse, DictionaryAccessor, type DocumentIndexEntry, DocumentQuery, type EntryMeta, type FieldDef, type FieldType, type FormConfig, type FormFieldConfig, type FormFieldError, type FormSubmitOptions, type FormSubmitResult, FormsClient, type FormsClientConfig, MediaAccessor, type MediaAsset, type MediaAssetMeta, type MediaManifest, type ModelDefinition, type ModelKind, type PublicComment, QueryBuilder, type RelationMeta, type RelationResolver, SingletonAccessor, type WhereClause, type WhereOp, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
116
116
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as applyWhere, i as MediaAccessor, n as ConversationClient, r as FormsClient, t as createContentrain, u as ContentrainError } from "./cdn-C8dqHhdG.mjs";
1
+ import { a as MediaAccessor, d as ContentrainError, f as applyWhere, i as FormsClient, n as ConversationClient, r as CommentsClient, t as createContentrain } from "./cdn-Do8lyms1.mjs";
2
2
  //#region src/runtime/query.ts
3
3
  var QueryBuilder = class {
4
4
  _data;
@@ -386,6 +386,6 @@ async function createContentrainClient(projectRoot) {
386
386
  return await import(pathToFileURL(resolve(projectRoot ?? process.cwd(), ".contentrain", "client", "index.mjs")).href);
387
387
  }
388
388
  //#endregion
389
- export { ContentrainError, ConversationClient, DictionaryAccessor, DocumentQuery, FormsClient, MediaAccessor, QueryBuilder, SingletonAccessor, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
389
+ export { CommentsClient, ContentrainError, ConversationClient, DictionaryAccessor, DocumentQuery, FormsClient, MediaAccessor, QueryBuilder, SingletonAccessor, applyWhere, createContentrain, createContentrainClient, createContentrainClient as default };
390
390
 
391
391
  //# sourceMappingURL=index.mjs.map