@project-ajax/sdk 0.0.75 → 0.0.77

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.
@@ -118,13 +118,13 @@ export type SyncConfiguration<PK extends string, S extends Schema<PK>, State = u
118
118
  mode?: SyncMode;
119
119
  /**
120
120
  * How often the sync should run.
121
- * - "continuous": Run as frequently as the system allows (default)
121
+ * - "continuous": Run as frequently as the system allows
122
122
  * - Interval string: Run at specified intervals, e.g. "1h", "30m", "1d"
123
123
  *
124
124
  * Minimum interval: 1 minute ("1m")
125
125
  * Maximum interval: 7 days ("7d")
126
126
  *
127
- * @default "continuous"
127
+ * @default "30m"
128
128
  */
129
129
  schedule?: Schedule;
130
130
  /**
@@ -33,10 +33,14 @@ const MS_PER_HOUR = 60 * MS_PER_MINUTE;
33
33
  const MS_PER_DAY = 24 * MS_PER_HOUR;
34
34
  const MIN_INTERVAL_MS = MS_PER_MINUTE;
35
35
  const MAX_INTERVAL_MS = 7 * MS_PER_DAY;
36
+ const DEFAULT_INTERVAL_MS = 30 * MS_PER_MINUTE;
36
37
  function parseSchedule(schedule) {
37
- if (!schedule || schedule === "continuous") {
38
+ if (schedule === "continuous") {
38
39
  return { type: "continuous" };
39
40
  }
41
+ if (!schedule) {
42
+ return { type: "interval", intervalMs: DEFAULT_INTERVAL_MS };
43
+ }
40
44
  const match = schedule.match(/^(\d+)(m|h|d)$/);
41
45
  if (!match || !match[1] || !match[2]) {
42
46
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@project-ajax/sdk",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "description": "An SDK for building workers for the Project Ajax platform",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -156,13 +156,13 @@ export type SyncConfiguration<
156
156
 
157
157
  /**
158
158
  * How often the sync should run.
159
- * - "continuous": Run as frequently as the system allows (default)
159
+ * - "continuous": Run as frequently as the system allows
160
160
  * - Interval string: Run at specified intervals, e.g. "1h", "30m", "1d"
161
161
  *
162
162
  * Minimum interval: 1 minute ("1m")
163
163
  * Maximum interval: 7 days ("7d")
164
164
  *
165
- * @default "continuous"
165
+ * @default "30m"
166
166
  */
167
167
  schedule?: Schedule;
168
168
 
@@ -249,14 +249,20 @@ const MS_PER_DAY = 24 * MS_PER_HOUR;
249
249
  const MIN_INTERVAL_MS = MS_PER_MINUTE; // 1m
250
250
  const MAX_INTERVAL_MS = 7 * MS_PER_DAY; // 7d
251
251
 
252
+ const DEFAULT_INTERVAL_MS = 30 * MS_PER_MINUTE; // 30m
253
+
252
254
  /**
253
255
  * Parses a user-friendly schedule string into the normalized backend format.
254
256
  */
255
257
  function parseSchedule(schedule: Schedule | undefined): SyncSchedule {
256
- if (!schedule || schedule === "continuous") {
258
+ if (schedule === "continuous") {
257
259
  return { type: "continuous" };
258
260
  }
259
261
 
262
+ if (!schedule) {
263
+ return { type: "interval", intervalMs: DEFAULT_INTERVAL_MS };
264
+ }
265
+
260
266
  const match = schedule.match(/^(\d+)(m|h|d)$/);
261
267
  if (!match || !match[1] || !match[2]) {
262
268
  throw new Error(