Skip to content

Commit

Permalink
v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
natelindev committed Jul 3, 2022
1 parent f366a05 commit 0526d4a
Show file tree
Hide file tree
Showing 27 changed files with 7,812 additions and 4,170 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
CREDENTIAL_DAVICAL_USERNAME=""
CREDENTIAL_DAVICAL_PASSWORD=""
CREDENTIAL_DAVICAL_SERVER_URL=""
CREDENTIAL_ZOHO_USERNAME=""
CREDENTIAL_ZOHO_PASSWORD=""
CREDENTIAL_ZOHO_SERVER_URL=""
Expand Down
1 change: 1 addition & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"consts",
"copyfiles",
"ctag",
"DAVICAL",
"DAVV",
"displayname",
"docusuarus",
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v2.0.3

**improvements**

- added support for davical
- fixed a bug related to expand #116
- updated deps

## v2.0.2

**improvements**
Expand Down
40 changes: 20 additions & 20 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsdav",
"version": "2.0.2",
"version": "2.0.3",
"description": "WebDAV, CALDAV, and CARDDAV client for Nodejs and the Browser",
"keywords": [
"dav",
Expand Down Expand Up @@ -54,36 +54,36 @@
"xml-js": "1.6.11"
},
"devDependencies": {
"@rollup/plugin-commonjs": "21.0.3",
"@rollup/plugin-commonjs": "22.0.1",
"@rollup/plugin-node-resolve": "13.1.3",
"@rollup/plugin-typescript": "8.3.1",
"@rollup/plugin-typescript": "8.3.3",
"@types/base-64": "1.0.0",
"@types/debug": "4.1.7",
"@types/jest": "27.4.1",
"@types/node": "17.0.23",
"@typescript-eslint/eslint-plugin": "5.16.0",
"@typescript-eslint/parser": "5.16.0",
"@types/jest": "28.1.4",
"@types/node": "18.0.0",
"@typescript-eslint/eslint-plugin": "5.30.3",
"@typescript-eslint/parser": "5.18.0",
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"dotenv": "16.0.0",
"eslint": "8.12.0",
"dotenv": "16.0.1",
"eslint": "8.19.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "16.1.4",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-module-utils": "2.7.3",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-prettier": "4.0.0",
"jest": "27.5.1",
"prettier": "2.6.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "4.2.1",
"jest": "28.1.2",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"rollup": "2.70.1",
"rollup-plugin-dts": "4.2.0",
"rollup": "2.75.7",
"rollup-plugin-dts": "4.2.2",
"rollup-plugin-node-builtins": "2.1.2",
"rollup-plugin-polyfill-node": "0.8.0",
"rollup-plugin-polyfill-node": "0.9.0",
"rollup-plugin-terser": "7.0.2",
"sort-package-json": "1.55.0",
"ts-jest": "27.1.4",
"typescript": "4.6.3"
"sort-package-json": "1.57.0",
"ts-jest": "28.0.5",
"typescript": "4.7.4"
},
"engines": {
"node": ">=10"
Expand Down
101 changes: 73 additions & 28 deletions dist/tsdav.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function hasFields(obj, fields) {
}
return inObj(obj);
}
const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr}`), '');
const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr.toString()}`), '');

const debug$4 = getLogger__default["default"]('tsdav:collection');
const collectionQuery = (params) => __awaiter(void 0, void 0, void 0, function* () {
Expand Down Expand Up @@ -878,7 +878,22 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct
(yield calendarQuery({
url: calendar.url,
props: {
[`${exports.DAVNamespaceShort.DAV}:getetag`]: {},
[`${exports.DAVNamespaceShort.DAV}:getetag`]: Object.assign({}, (expand && timeRange
? {
[`${exports.DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
}
: {})),
},
filters,
depth: '1',
Expand All @@ -887,33 +902,63 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct
.map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full
.filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those
.map((url) => new URL(url).pathname); // obtain pathname of the url
const calendarObjectResults = calendarObjectUrls.length > 0
? yield calendarMultiGet({
url: calendar.url,
props: {
[`${exports.DAVNamespaceShort.DAV}:getetag`]: {},
[`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${exports.DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
let calendarObjectResults = [];
if (calendarObjectUrls.length > 0) {
if (expand) {
calendarObjectResults = yield calendarQuery({
url: calendar.url,
props: {
[`${exports.DAVNamespaceShort.DAV}:getetag`]: {},
[`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${exports.DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
},
}
: {})),
},
objectUrls: calendarObjectUrls,
depth: '1',
headers,
})
: [];
}
: {})),
},
filters,
depth: '1',
headers,
});
}
else {
calendarObjectResults = yield calendarMultiGet({
url: calendar.url,
props: {
[`${exports.DAVNamespaceShort.DAV}:getetag`]: {},
[`${exports.DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${exports.DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
}
: {})),
},
objectUrls: calendarObjectUrls,
depth: '1',
headers,
});
}
}
return calendarObjectResults.map((res) => {
var _a, _b, _c, _d, _e, _f;
return ({
Expand Down
20 changes: 10 additions & 10 deletions dist/tsdav.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ declare const addressBookMultiGet: (params: {
headers?: Record<string, string>;
}) => Promise<DAVResponse[]>;
declare const fetchAddressBooks: (params?: {
account?: DAVAccount | undefined;
props?: ElementCompact | undefined;
headers?: Record<string, string> | undefined;
} | undefined) => Promise<DAVAddressBook[]>;
account?: DAVAccount;
props?: ElementCompact;
headers?: Record<string, string>;
}) => Promise<DAVAddressBook[]>;
declare const fetchVCards: (params: {
addressBook: DAVAddressBook;
headers?: Record<string, string> | undefined;
Expand Down Expand Up @@ -232,10 +232,10 @@ declare const makeCalendar: (params: {
headers?: Record<string, string>;
}) => Promise<DAVResponse[]>;
declare const fetchCalendars: (params?: {
account?: DAVAccount | undefined;
props?: ElementCompact | undefined;
headers?: Record<string, string> | undefined;
} | undefined) => Promise<DAVCalendar[]>;
account?: DAVAccount;
props?: ElementCompact;
headers?: Record<string, string>;
}) => Promise<DAVCalendar[]>;
declare const fetchCalendarObjects: (params: {
calendar: DAVCalendar;
objectUrls?: string[] | undefined;
Expand Down Expand Up @@ -588,8 +588,8 @@ declare const getOauthHeaders: (credentials: DAVCredentials) => Promise<{
};
}>;

declare const urlEquals: (urlA?: string | undefined, urlB?: string | undefined) => boolean;
declare const urlContains: (urlA?: string | undefined, urlB?: string | undefined) => boolean;
declare const urlEquals: (urlA?: string, urlB?: string) => boolean;
declare const urlContains: (urlA?: string, urlB?: string) => boolean;
declare const getDAVAttribute: (nsArr: DAVNamespace[]) => {
[key: string]: DAVNamespace;
};
Expand Down
101 changes: 73 additions & 28 deletions dist/tsdav.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function hasFields(obj, fields) {
}
return inObj(obj);
}
const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr}`), '');
const findMissingFieldNames = (obj, fields) => fields.reduce((prev, curr) => (obj[curr] ? prev : `${prev.length ? `${prev},` : ''}${curr.toString()}`), '');

const debug$4 = getLogger('tsdav:collection');
const collectionQuery = (params) => __awaiter(void 0, void 0, void 0, function* () {
Expand Down Expand Up @@ -869,7 +869,22 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct
(yield calendarQuery({
url: calendar.url,
props: {
[`${DAVNamespaceShort.DAV}:getetag`]: {},
[`${DAVNamespaceShort.DAV}:getetag`]: Object.assign({}, (expand && timeRange
? {
[`${DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
}
: {})),
},
filters,
depth: '1',
Expand All @@ -878,33 +893,63 @@ const fetchCalendarObjects = (params) => __awaiter(void 0, void 0, void 0, funct
.map((url) => (url.startsWith('http') || !url ? url : new URL(url, calendar.url).href)) // patch up to full url if url is not full
.filter(urlFilter !== null && urlFilter !== void 0 ? urlFilter : ((url) => Boolean(url === null || url === void 0 ? void 0 : url.includes('.ics')))) // filter out non ics calendar objects since apple calendar might have those
.map((url) => new URL(url).pathname); // obtain pathname of the url
const calendarObjectResults = calendarObjectUrls.length > 0
? yield calendarMultiGet({
url: calendar.url,
props: {
[`${DAVNamespaceShort.DAV}:getetag`]: {},
[`${DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
let calendarObjectResults = [];
if (calendarObjectUrls.length > 0) {
if (expand) {
calendarObjectResults = yield calendarQuery({
url: calendar.url,
props: {
[`${DAVNamespaceShort.DAV}:getetag`]: {},
[`${DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
},
}
: {})),
},
objectUrls: calendarObjectUrls,
depth: '1',
headers,
})
: [];
}
: {})),
},
filters,
depth: '1',
headers,
});
}
else {
calendarObjectResults = yield calendarMultiGet({
url: calendar.url,
props: {
[`${DAVNamespaceShort.DAV}:getetag`]: {},
[`${DAVNamespaceShort.CALDAV}:calendar-data`]: Object.assign({}, (expand && timeRange
? {
[`${DAVNamespaceShort.CALDAV}:expand`]: {
_attributes: {
start: `${new Date(timeRange.start)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
end: `${new Date(timeRange.end)
.toISOString()
.slice(0, 19)
.replace(/[-:.]/g, '')}Z`,
},
},
}
: {})),
},
objectUrls: calendarObjectUrls,
depth: '1',
headers,
});
}
}
return calendarObjectResults.map((res) => {
var _a, _b, _c, _d, _e, _f;
return ({
Expand Down
Loading

1 comment on commit 0526d4a

@vercel
Copy link

@vercel vercel bot commented on 0526d4a Jul 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

tsdav – ./

tsdav.vercel.app
tsdav-git-master-llldar.vercel.app
tsdav-llldar.vercel.app

Please sign in to comment.