rmapi-js 12.0.0 → 12.0.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/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface EntryCommon extends ItemRef {
11
11
  /** the visible display name of this entry */
12
12
  visibleName: string;
13
13
  /** the last modified timestamp */
14
- lastModified: string;
14
+ lastModified?: string;
15
15
  /** true if the entry is starred in most ui elements */
16
16
  pinned: boolean;
17
17
  /**
package/dist/raw.d.ts CHANGED
@@ -329,6 +329,8 @@ export interface LegacyDocumentContent extends CommonDocumentContent {
329
329
  * metadata about it.
330
330
  */
331
331
  export interface TemplateContent {
332
+ /** the template's own id, when present */
333
+ id?: string;
332
334
  /** the template name */
333
335
  name: string;
334
336
  /** the template's author */
@@ -338,7 +340,7 @@ export interface TemplateContent {
338
340
  /** category names this template belongs to (eg: "Planning", "Productivity") */
339
341
  categories: string[];
340
342
  /** labels associated with this template (eg: "Project management") */
341
- labels: string[];
343
+ labels?: string[];
342
344
  /** the orientation of this template */
343
345
  orientation: "portrait" | "landscape";
344
346
  /** semantic version for this template */
@@ -351,10 +353,15 @@ export interface TemplateContent {
351
353
  * - `rm2`: reMarkable 2
352
354
  * - `rmPP`: reMarkable Paper Pro
353
355
  */
354
- supportedScreens: ("rm2" | "rmPP")[];
355
- /** constant values used by the commands in `items` */
356
+ supportedScreens?: ("rm2" | "rmPP")[];
357
+ /**
358
+ * named constants used by the `items` DSL
359
+ *
360
+ * A value is either a literal number or an expression string that references
361
+ * other constants and `templateWidth`, e.g. `"templateWidth - (offsetX * 2)"`.
362
+ */
356
363
  constants?: {
357
- [name: string]: number;
364
+ [name: string]: number | string;
358
365
  }[];
359
366
  /** the template definition, an SVG-like DSL in JSON */
360
367
  items: object[];
@@ -370,17 +377,17 @@ export interface Metadata {
370
377
  /** creation time, a string of the epoch timestamp */
371
378
  createdTime?: string;
372
379
  /** [speculative] true if the item has been actually deleted */
373
- deleted?: boolean;
380
+ deleted?: boolean | null;
374
381
  /** the last modify time, the string of the epoch timestamp */
375
- lastModified: string;
382
+ lastModified?: string;
376
383
  /** the last opened epoch timestamp, isn't defined for CollectionType */
377
384
  lastOpened?: string;
378
385
  /** the last page opened, isn't defined for CollectionType, starts at 0*/
379
386
  lastOpenedPage?: number;
380
387
  /** [speculative] true if the metadata has been modified */
381
- metadatamodified?: boolean;
388
+ metadatamodified?: boolean | null;
382
389
  /** [speculative] true if the item has been modified */
383
- modified?: boolean;
390
+ modified?: boolean | null;
384
391
  /**
385
392
  * the id of the parent collection
386
393
  *
@@ -391,7 +398,7 @@ export interface Metadata {
391
398
  /** true of the item is starred */
392
399
  pinned: boolean;
393
400
  /** [unknown] */
394
- synced?: boolean;
401
+ synced?: boolean | null;
395
402
  /**
396
403
  * the type of item this corresponds to
397
404
  *
package/dist/raw.js CHANGED
@@ -174,19 +174,22 @@ const legacyDocumentContent = commonDocumentContent
174
174
  .passthrough();
175
175
  const templateContent = z
176
176
  .object({
177
+ id: z.string().optional(),
177
178
  name: z.string(),
178
179
  author: z.string(),
179
180
  iconData: z.string(),
180
181
  categories: z.array(z.string()),
181
- labels: z.array(z.string()),
182
+ labels: z.array(z.string()).optional(),
182
183
  orientation: z.enum(["portrait", "landscape"]),
183
184
  templateVersion: z.string(),
184
- supportedScreens: z.array(z.enum(["rm2", "rmPP"])),
185
- constants: z.array(z.record(z.string(), z.number().int())).optional(),
185
+ supportedScreens: z.array(z.enum(["rm2", "rmPP"])).optional(),
186
+ constants: z
187
+ .array(z.record(z.string(), z.union([z.number(), z.string()])))
188
+ .optional(),
186
189
  items: z.array(z.unknown()),
187
190
  formatVersion: z.number().int().nonnegative().optional(),
188
191
  })
189
- .strict();
192
+ .passthrough();
190
193
  // content payloads aren't discriminable (legacy/modern differ only by tags
191
194
  // element type), so this is an ordered union: the first matching variant wins
192
195
  const content = z.union([
@@ -198,7 +201,7 @@ const content = z.union([
198
201
  ]);
199
202
  const metadata = z
200
203
  .object({
201
- lastModified: z.string(),
204
+ lastModified: z.string().optional(),
202
205
  parent: z.string(),
203
206
  pinned: z.boolean(),
204
207
  type: z.enum(["DocumentType", "CollectionType", "TemplateType"]),
@@ -206,10 +209,10 @@ const metadata = z
206
209
  lastOpened: z.string().optional(),
207
210
  lastOpenedPage: z.number().int().optional(),
208
211
  createdTime: z.string().optional(),
209
- deleted: z.boolean().optional(),
210
- metadatamodified: z.boolean().optional(),
211
- modified: z.boolean().optional(),
212
- synced: z.boolean().optional(),
212
+ deleted: z.boolean().nullish(),
213
+ metadatamodified: z.boolean().nullish(),
214
+ modified: z.boolean().nullish(),
215
+ synced: z.boolean().nullish(),
213
216
  version: z.number().int().nonnegative().optional(),
214
217
  new: z.boolean().optional(),
215
218
  source: z.string().optional(),