@headroom-cms/api 0.1.5 → 0.1.7

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/LICENSE ADDED
@@ -0,0 +1,142 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software
14
+ to do everything you might do with the software that would
15
+ otherwise infringe the licensor's copyright in it for any
16
+ permitted purpose. However, you may only distribute the
17
+ software according to [Distribution License](#distribution-license)
18
+ and make changes or new works based on the software according to
19
+ [Changes and New Works License](#changes-and-new-works-license).
20
+
21
+ ## Distribution License
22
+
23
+ The licensor grants you an additional copyright license to
24
+ distribute copies of the software. Your license to distribute
25
+ covers distributing the software with changes and new works
26
+ permitted by [Changes and New Works License](#changes-and-new-works-license).
27
+
28
+ ## Notices
29
+
30
+ You must ensure that anyone who gets a copy of any part of
31
+ the software from you also gets a copy of these terms or the
32
+ URL for them above, as well as copies of any plain-text lines
33
+ beginning with `Required Notice:` that the licensor provided
34
+ with the software. For example:
35
+
36
+ > Required Notice: Copyright Cykod LLC (https://cykod.com)
37
+
38
+ ## Changes and New Works License
39
+
40
+ The licensor grants you an additional copyright license to
41
+ make changes and new works based on the software for any
42
+ permitted purpose.
43
+
44
+ ## Patent License
45
+
46
+ The licensor grants you a patent license for the software
47
+ that covers patent claims the licensor can license, or
48
+ becomes able to license, that you would infringe by using
49
+ the software.
50
+
51
+ ## Noncommercial Purposes
52
+
53
+ Any noncommercial purpose is a permitted purpose.
54
+
55
+ ## Personal Uses
56
+
57
+ Personal use for research, experiment, and testing for
58
+ the benefit of public knowledge, personal study, private
59
+ entertainment, hobby projects, amateur pursuits, or
60
+ religious observance, without any anticipated commercial
61
+ application, is use for a permitted purpose.
62
+
63
+ ## Noncommercial Organizations
64
+
65
+ Use by any charitable organization, educational institution,
66
+ public research organization, public safety or health
67
+ organization, environmental protection organization, or
68
+ government institution is use for a permitted purpose
69
+ regardless of the source of funding or obligations
70
+ resulting from the funding.
71
+
72
+ ## Fair Use
73
+
74
+ You may have "fair use" rights for the software under the
75
+ law. These terms do not limit them.
76
+
77
+ ## No Other Rights
78
+
79
+ These terms do not allow you to sublicense or transfer any
80
+ of your licenses to anyone else, or prevent the licensor
81
+ from granting licenses to anyone else. These terms do not
82
+ imply any other licenses.
83
+
84
+ ## Patent Defense
85
+
86
+ If you make any written claim that the software infringes
87
+ or contributes to infringement of any patent, your patent
88
+ license for the software granted under these terms ends
89
+ immediately. If your company makes such a claim, your
90
+ patent license ends immediately for work on behalf of
91
+ your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the
97
+ software not covered by your licenses, your licenses can
98
+ nonetheless continue if you come into full compliance with
99
+ these terms, and take practical steps to correct past
100
+ violations, within 32 days of receiving notice. Otherwise,
101
+ all your licenses end immediately.
102
+
103
+ ## No Liability
104
+
105
+ As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be
107
+ liable to you for any damages arising out of these terms
108
+ or the use or nature of the software, under any kind of
109
+ legal claim.
110
+
111
+ ## Definitions
112
+
113
+ The **licensor** is the individual or entity offering these
114
+ terms, and the **software** is the software the licensor
115
+ makes available under these terms.
116
+
117
+ **You** refers to the individual or entity agreeing to
118
+ these terms.
119
+
120
+ **Your company** is any legal entity, sole proprietorship,
121
+ or other kind of organization that you work for, plus all
122
+ organizations that have control over, are under the control
123
+ of, or are under common control with that organization.
124
+ **Control** means ownership of substantially all the assets
125
+ of an entity, or the power to direct its management and
126
+ policies by vote, contract, or otherwise. Control can be
127
+ direct or indirect.
128
+
129
+ **Your licenses** are all the licenses granted to you for
130
+ the software under these terms.
131
+
132
+ **Use** means anything you do with the software requiring
133
+ one of your licenses.
134
+
135
+ ---
136
+
137
+ ## Commercial License
138
+
139
+ For commercial use of Headroom CMS, a commercial license is
140
+ required at $5/month.
141
+
142
+ To purchase a commercial license, contact: headroom@cykod.com
package/dist/astro.js CHANGED
@@ -304,7 +304,10 @@ var HeadroomClient = class {
304
304
  const res = await fetch(url, {
305
305
  method: "POST",
306
306
  headers,
307
- body: JSON.stringify({ fields: options.fields })
307
+ body: JSON.stringify({
308
+ fields: options.fields,
309
+ ...options.relationships && { relationships: options.relationships }
310
+ })
308
311
  });
309
312
  if (!res.ok) {
310
313
  let code = "UNKNOWN";
package/dist/index.cjs CHANGED
@@ -332,7 +332,10 @@ var HeadroomClient = class {
332
332
  const res = await fetch(url, {
333
333
  method: "POST",
334
334
  headers,
335
- body: JSON.stringify({ fields: options.fields })
335
+ body: JSON.stringify({
336
+ fields: options.fields,
337
+ ...options.relationships && { relationships: options.relationships }
338
+ })
336
339
  });
337
340
  if (!res.ok) {
338
341
  let code = "UNKNOWN";
package/dist/index.d.cts CHANGED
@@ -61,6 +61,12 @@ interface ContentMetadata {
61
61
  coverUrl?: string;
62
62
  coverMediaId?: string;
63
63
  lastPublishedAt?: number;
64
+ /** Set to "submission" for submission content, omitted for regular content */
65
+ mode?: string;
66
+ /** Site user ID of the submitter (submissions only) */
67
+ siteUserId?: string;
68
+ /** Submission field values (submissions only) */
69
+ fields?: Record<string, unknown>;
64
70
  }
65
71
  interface ContentItem extends ContentMetadata {
66
72
  body?: {
@@ -159,6 +165,10 @@ interface SubmitOptions {
159
165
  fields: Record<string, unknown>;
160
166
  /** Optional site user session token (adds X-Headroom-Session header) */
161
167
  sessionToken?: string;
168
+ /** Optional relationships to associate with the submission */
169
+ relationships?: Record<string, {
170
+ contentId: string;
171
+ }[]>;
162
172
  }
163
173
  /** Result returned from a successful submission. */
164
174
  interface SubmitResult {
@@ -260,8 +270,8 @@ declare class HeadroomClient {
260
270
  cursor?: string;
261
271
  before?: number;
262
272
  after?: number;
263
- /** Sort order: "published_desc" (default), "published_asc", "title_asc", "title_desc" */
264
- sort?: "published_desc" | "published_asc" | "title_asc" | "title_desc";
273
+ /** Sort order. For regular queries: "published_desc" (default), "published_asc", "title_asc", "title_desc". For relatedTo queries: "created_desc" (default), "created_asc". */
274
+ sort?: "published_desc" | "published_asc" | "title_asc" | "title_desc" | "created_desc" | "created_asc";
265
275
  /** Find content that has a relationship pointing to this content ID (reverse query) */
266
276
  relatedTo?: string;
267
277
  /** Filter reverse query to a specific relationship field name */
package/dist/index.d.ts CHANGED
@@ -61,6 +61,12 @@ interface ContentMetadata {
61
61
  coverUrl?: string;
62
62
  coverMediaId?: string;
63
63
  lastPublishedAt?: number;
64
+ /** Set to "submission" for submission content, omitted for regular content */
65
+ mode?: string;
66
+ /** Site user ID of the submitter (submissions only) */
67
+ siteUserId?: string;
68
+ /** Submission field values (submissions only) */
69
+ fields?: Record<string, unknown>;
64
70
  }
65
71
  interface ContentItem extends ContentMetadata {
66
72
  body?: {
@@ -159,6 +165,10 @@ interface SubmitOptions {
159
165
  fields: Record<string, unknown>;
160
166
  /** Optional site user session token (adds X-Headroom-Session header) */
161
167
  sessionToken?: string;
168
+ /** Optional relationships to associate with the submission */
169
+ relationships?: Record<string, {
170
+ contentId: string;
171
+ }[]>;
162
172
  }
163
173
  /** Result returned from a successful submission. */
164
174
  interface SubmitResult {
@@ -260,8 +270,8 @@ declare class HeadroomClient {
260
270
  cursor?: string;
261
271
  before?: number;
262
272
  after?: number;
263
- /** Sort order: "published_desc" (default), "published_asc", "title_asc", "title_desc" */
264
- sort?: "published_desc" | "published_asc" | "title_asc" | "title_desc";
273
+ /** Sort order. For regular queries: "published_desc" (default), "published_asc", "title_asc", "title_desc". For relatedTo queries: "created_desc" (default), "created_asc". */
274
+ sort?: "published_desc" | "published_asc" | "title_asc" | "title_desc" | "created_desc" | "created_asc";
265
275
  /** Find content that has a relationship pointing to this content ID (reverse query) */
266
276
  relatedTo?: string;
267
277
  /** Filter reverse query to a specific relationship field name */
package/dist/index.js CHANGED
@@ -304,7 +304,10 @@ var HeadroomClient = class {
304
304
  const res = await fetch(url, {
305
305
  method: "POST",
306
306
  headers,
307
- body: JSON.stringify({ fields: options.fields })
307
+ body: JSON.stringify({
308
+ fields: options.fields,
309
+ ...options.relationships && { relationships: options.relationships }
310
+ })
308
311
  });
309
312
  if (!res.ok) {
310
313
  let code = "UNKNOWN";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headroom-cms/api",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -38,13 +38,6 @@
38
38
  "dist",
39
39
  "blocks"
40
40
  ],
41
- "scripts": {
42
- "build": "tsup",
43
- "dev": "tsup --watch",
44
- "test": "vitest run",
45
- "test:watch": "vitest",
46
- "typecheck": "tsc --noEmit"
47
- },
48
41
  "peerDependencies": {
49
42
  "astro": ">=5",
50
43
  "next": ">=14",
@@ -78,5 +71,12 @@
78
71
  "tsup": "~8.5.0",
79
72
  "typescript": "~5.9.3",
80
73
  "vitest": "~4.0.18"
74
+ },
75
+ "scripts": {
76
+ "build": "tsup",
77
+ "dev": "tsup --watch",
78
+ "test": "vitest run",
79
+ "test:watch": "vitest",
80
+ "typecheck": "tsc --noEmit"
81
81
  }
82
- }
82
+ }