Skip to content

Commit

Permalink
Merge pull request #70 from Zimbra/PREAPPS-1028
Browse files Browse the repository at this point in the history
PREAPPS-1028: Deleted contact's public certificate accessible to the logged user while composing message
  • Loading branch information
silentsakky authored Oct 19, 2018
2 parents 7cee86e + 82a7256 commit ea1cace
Show file tree
Hide file tree
Showing 8 changed files with 2,478 additions and 2,683 deletions.
4,974 changes: 2,331 additions & 2,643 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zimbra/api-client",
"amdName": "zmApiJsClient",
"version": "7.2.0",
"version": "8.0.0-beta.1",
"description": "Zimbra JS API Client and GraphQL client for making requests against the Zimbra SOAP API.",
"main": "dist/zm-api-js-client.js",
"source": "index.ts",
Expand All @@ -27,7 +27,8 @@
"minify:cjs": "cross-var uglifyjs $npm_package_main -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o $npm_package_main --source-map content=$npm_package_main.map,url=zm-api-js-client.js.map,filename=$npm_package_main.map",
"minify:umd": "cross-var uglifyjs $npm_package_umd_main -c pure_getters,pure_funcs=classCallCheck -m toplevel,reserved=['_createClass'] --keep-fnames -o $npm_package_umd_main --source-map content=$npm_package_umd_main.map,url=zm-api-js-client.umd.js.map,filename=$npm_package_umd_main.map",
"size": "echo \"Gzipped Size: $(gzip-size $npm_package_main | pretty-bytes)\"",
"prepublishOnly": "npm test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags"
"prepublishOnly": "npm test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags",
"publish:beta": "npm publish --tag=beta"
},
"keywords": [
"zimbra",
Expand Down
12 changes: 9 additions & 3 deletions src/batch-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ export class ZimbraBatchClient {
}
});

public contactAction = (options: ActionOptions) =>
this.action(ActionType.contact, options);

public conversationAction = (options: ActionOptions) =>
this.action(ActionType.conversation, options);

Expand Down Expand Up @@ -389,13 +392,16 @@ export class ZimbraBatchClient {
jwtToken: this.jwtToken
});

public getContact = ({ id }: GetContactOptions) =>
public getContact = ({ id, ids, ...rest }: GetContactOptions) =>
this.jsonRequest({
name: 'GetContacts',
body: {
cn: { id }
cn: {
id: id || (ids || []).join(',')
},
...rest
}
}).then(res => normalize(Contact)(res.cn[0]));
}).then(res => res.cn.map((contact: any) => normalize(Contact)(contact)));

public getContactFrequency = (options: GetContactFrequencyOptions) =>
this.jsonRequest({
Expand Down
3 changes: 3 additions & 0 deletions src/batch-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export interface FreeBusyOptions {
}

export interface GetContactOptions {
derefGroupMember: boolean;
id: string;
ids: Array<string>;
memberOf: boolean;
}

export interface GetContactFrequencyOptions {
Expand Down
36 changes: 23 additions & 13 deletions src/normalize/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,6 @@ export const ActionOptions = new Entity({
grant: ACLGrant
});

export const Contact = new Entity({
d: 'date',
l: 'folderId',
rev: 'revision',
sf: 'sortField',
_attrs: 'attributes'
});

export const AutoComplete = new Entity({
t: 'type'
});
Expand All @@ -321,10 +313,6 @@ export const AutoCompleteResponse = new Entity({
match: AutoCompleteMatch
});

export const AutoCompleteGALResponse = new Entity({
cn: ['contacts', Contact]
});

export const ShareNotification = new Entity({
e: ['address', ShareNotificationAddress]
});
Expand All @@ -334,6 +322,27 @@ export const ExternalCalendar = new Entity({
l: 'folderId'
});

const contactFields = {
d: 'date',
l: 'folderId',
rev: 'revision',
sf: 'sortField',
_attrs: 'attributes'
};

const contactListMembers = new Entity({
cn: ['contacts', new Entity({ ...contactFields })]
});

export const Contact = new Entity({
...contactFields,
m: ['members', contactListMembers]
});

export const AutoCompleteGALResponse = new Entity({
cn: ['contacts', Contact]
});

export const Appointment = new Entity({
alarm: 'alarm',
inst: ['instances', Instance]
Expand Down Expand Up @@ -443,5 +452,6 @@ const ContactInputAttributes = new Entity({
export const ContactInputRequest = new Entity({
l: 'folderId',
tn: 'tagNames',
a: ['attributes', ContactInputAttributes]
a: ['attributes', ContactInputAttributes],
m: 'memberOps'
});
89 changes: 69 additions & 20 deletions src/schema/generated-schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export interface MailItem {
export interface Query {
accountInfo?: AccountInfo | null;
autoComplete?: AutoCompleteResponse | null;
autoCompleteGAL?: AutoCompleteGALResponse | null;
downloadMessage?: SMimeMessage | null;
freeBusy?: FreeBusy[] | null;
getContact?: Contact | null;
getContact?: Contact[] | null;
getAppointments?: SearchResponse | null;
getContactFrequency?: ContactFrequencyResponse | null;
getConversation?: Conversation | null;
Expand Down Expand Up @@ -241,23 +242,8 @@ export interface AutoCompleteMatch {
fileas?: string | null;
}

export interface SMimeMessage {
id?: string | null;
content?: string | null;
}

export interface FreeBusy {
id: string;
tentative?: FreeBusyInstance[] | null;
busy?: FreeBusyInstance[] | null;
unavailable?: FreeBusyInstance[] | null;
nodata?: FreeBusyInstance[] | null;
free?: FreeBusyInstance[] | null;
}

export interface FreeBusyInstance {
start?: number | null;
end?: number | null;
export interface AutoCompleteGALResponse {
contacts?: Contact[] | null;
}

export interface Contact {
Expand All @@ -267,7 +253,9 @@ export interface Contact {
revision?: number | null;
sortField?: string | null;
fileAsStr?: string | null;
memberOf?: string | null;
attributes?: ContactAttributes | null;
members?: ContactListMember[] | null;
}

export interface ContactAttributes {
Expand Down Expand Up @@ -315,10 +303,36 @@ export interface ContactAttributes {
website?: string | null;
notes?: string | null;
userCertificate?: string | null;
zimbraCalResType?: string | null;
fileAs?: string | null /* Used for contact lists */;
type?: string | null;
}

export interface ContactListMember {
contacts?: Contact[] | null;
type: string;
value: string;
}

export interface SMimeMessage {
id?: string | null;
content?: string | null;
}

export interface FreeBusy {
id: string;
tentative?: FreeBusyInstance[] | null;
busy?: FreeBusyInstance[] | null;
unavailable?: FreeBusyInstance[] | null;
nodata?: FreeBusyInstance[] | null;
free?: FreeBusyInstance[] | null;
}

export interface FreeBusyInstance {
start?: number | null;
end?: number | null;
}

export interface SearchResponse {
contacts?: Contact[] | null;
messages?: MessageInfo[] | null;
Expand Down Expand Up @@ -492,6 +506,7 @@ export interface CalendarItemAttendee {
rsvp?: boolean | null;
address?: string | null;
name?: string | null;
calendarUserType?: string | null;
}

export interface StringContent {
Expand Down Expand Up @@ -974,14 +989,15 @@ export interface Mutation {
changeCalendarColor?: boolean | null;
changePassword?: string | null;
checkCalendar?: boolean | null;
contactAction?: ActionOpResponse | null;
conversationAction?: boolean | null;
createAppointment?: boolean | null;
createAppointmentException?: boolean | null;
createCalendar?: boolean | null;
createContact?: Contact | null;
createContactList?: Contact | null;
modifyContact?: Contact | null;
modifyContactList?: Contact | null;
modifyContactList?: boolean | null;
createFolder?: Folder | null;
createMountpoint?: boolean | null;
createSharedCalendar?: boolean | null;
Expand Down Expand Up @@ -1032,6 +1048,15 @@ export interface ExternalAccountTestResponse {
error?: string | null;
}

export interface ActionOpResponse {
action?: ActionOpResponseData | null;
}

export interface ActionOpResponseData {
id: string;
op: string;
}

export interface SignatureResponse {
signature?: NameId[] | null;
}
Expand Down Expand Up @@ -1237,6 +1262,7 @@ export interface CalendarItemAttendeesInput {
rsvp?: boolean | null;
address: string;
name?: string | null;
calendarUserType?: string | null;
}

export interface CalendarItemAlarmInput {
Expand Down Expand Up @@ -1363,6 +1389,13 @@ export interface ModifyContactInput {
folderId?: string | null;
tagNames?: string | null;
attributes: ContactAttrsInput;
memberOps?: ContactListOps[] | null;
}

export interface ContactListOps {
op: string;
type: string;
value: string;
}

export interface NewMountpointSpec {
Expand Down Expand Up @@ -1785,6 +1818,12 @@ export interface AutoCompleteQueryArgs {
folders?: string | null;
includeGal?: boolean | null;
}
export interface AutoCompleteGalQueryArgs {
limit?: number | null;
name: string;
type?: GalSearchType | null;
needExp?: boolean | null;
}
export interface DownloadMessageQueryArgs {
id: string;
}
Expand All @@ -1794,7 +1833,10 @@ export interface FreeBusyQueryArgs {
end?: number | null;
}
export interface GetContactQueryArgs {
id: string;
id?: string | null;
ids?: string[] | null;
derefGroupMember?: boolean | null;
memberOf?: boolean | null;
}
export interface GetAppointmentsQueryArgs {
calExpandInstStart: number;
Expand Down Expand Up @@ -1865,6 +1907,7 @@ export interface SearchQueryArgs {
fullConversation?: boolean | null;
limit?: number | null;
needExp?: boolean | null;
memberOf?: boolean | null;
offset?: number | null;
query?: string | null;
recip?: number | null;
Expand Down Expand Up @@ -1918,6 +1961,12 @@ export interface CheckCalendarMutationArgs {
calendarId: string;
value: boolean;
}
export interface ContactActionMutationArgs {
id?: string | null;
ids?: string[] | null;
folderId?: string | null;
op: string;
}
export interface ConversationActionMutationArgs {
ids: string[];
op: string;
Expand Down
Loading

0 comments on commit ea1cace

Please sign in to comment.