microsoft-onedrive-mock 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/dist/routes/v1.js +32 -8
  2. package/package.json +1 -1
package/dist/routes/v1.js CHANGED
@@ -48,15 +48,39 @@ const createV1Router = () => {
48
48
  app.get('/v1.0/me/drive/items/:itemId/children', (req, res) => {
49
49
  const itemId = req.params.itemId;
50
50
  let children = store_1.driveStore.listItems(itemId);
51
- // Basic OData $filter REJECTION
51
+ // Basic OData $filter support for lastModifiedDateTime (RxDB sync)
52
52
  if (req.query.$filter && typeof req.query.$filter === 'string') {
53
- res.status(400).json({
54
- error: {
55
- code: 'invalidRequest',
56
- message: 'Invalid request'
57
- }
58
- });
59
- return;
53
+ const filterStr = req.query.$filter;
54
+ // Support formats like: lastModifiedDateTime ge '2026-03-07T16:41:28.611Z'
55
+ const match = filterStr.match(/lastModifiedDateTime\s+(ge|gt|le|lt|eq)\s+'?([^'\s]+)'?/);
56
+ if (match) {
57
+ const operator = match[1];
58
+ const dateVal = match[2];
59
+ children = children.filter(c => {
60
+ const cTime = c.lastModifiedDateTime || "";
61
+ if (operator === 'ge')
62
+ return cTime >= dateVal;
63
+ if (operator === 'gt')
64
+ return cTime > dateVal;
65
+ if (operator === 'le')
66
+ return cTime <= dateVal;
67
+ if (operator === 'lt')
68
+ return cTime < dateVal;
69
+ if (operator === 'eq')
70
+ return cTime === dateVal;
71
+ return true;
72
+ });
73
+ }
74
+ else {
75
+ // For unsupported filters, return 400 to match real API strictness
76
+ res.status(400).json({
77
+ error: {
78
+ code: 'invalidRequest',
79
+ message: 'Invalid request'
80
+ }
81
+ });
82
+ return;
83
+ }
60
84
  }
61
85
  // Basic OData $orderby support
62
86
  if (req.query.$orderby && typeof req.query.$orderby === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microsoft-onedrive-mock",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Mock-Server that simulates being Microsoft OneDrive. Used for testing.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",