need4deed-sdk 0.0.90 → 0.0.91

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.
@@ -1,13 +1,16 @@
1
+ import { VoidableProps } from "../utils";
1
2
  import { OptionById } from "./common";
2
3
  import { TranslatedIntoType } from "./opportunity";
3
- export interface ApiOpportunityAccompanyingDetails {
4
- appointmentAddress?: string;
5
- appointmentDate?: string;
6
- appointmentTime?: string;
7
- refugeeNumber?: string;
8
- refugeeName?: string;
9
- appointmentLanguage?: TranslatedIntoType;
10
- refugeeLanguage?: OptionById[];
11
- appointmentPostcode?: string;
12
- appointmentDistrict?: OptionById;
4
+ interface OpportunityAccompanyingDetails {
5
+ appointmentAddress: string;
6
+ appointmentDate: string;
7
+ appointmentTime: string;
8
+ refugeeNumber: string;
9
+ refugeeName: string;
10
+ appointmentLanguage: TranslatedIntoType;
11
+ refugeeLanguage: OptionById[];
12
+ appointmentPostcode: string;
13
+ appointmentDistrict: OptionById;
13
14
  }
15
+ export type ApiOpportunityAccompanyingDetails = VoidableProps<OpportunityAccompanyingDetails>;
16
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { Voidable, VoidableProps } from "../utils";
2
2
  import { ApiComment } from "./comment";
3
3
  import { OptionById } from "./common";
4
+ import { ApiLanguage } from "./language";
4
5
  import { OptionItem } from "./option";
5
6
  import { ApiPersonGet } from "./person";
6
7
  export declare enum AgentType {
@@ -59,7 +60,7 @@ export declare enum AgentTrustType {
59
60
  }
60
61
  export interface AgentDetails {
61
62
  about: string;
62
- website?: string;
63
+ website?: Voidable<string>;
63
64
  address: string;
64
65
  organizationType: AgentType;
65
66
  operator: string;
@@ -69,26 +70,31 @@ export interface AgentDetails {
69
70
  export interface ApiRepresentativeGet extends ApiPersonGet {
70
71
  role: AgentRoleType;
71
72
  }
72
- export type ApiRepresentativePatch = Partial<ApiRepresentativeGet>;
73
- export interface ApiAgentGetList {
73
+ export type ApiRepresentativePatch = VoidableProps<ApiRepresentativeGet>;
74
+ interface AgentGetList {
74
75
  id: number;
75
76
  title: string;
76
77
  type: AgentType;
77
78
  volunteerSearch: AgentVolunteerSearchType;
78
79
  trustLevel: AgentTrustType;
79
- district?: OptionById;
80
+ district: OptionById;
80
81
  activeVolunteers: number;
82
+ email: string;
83
+ numActiveVolunteers: number;
81
84
  }
82
- export interface ApiAgentGet extends ApiAgentGetList {
85
+ export type ApiAgentGetList = VoidableProps<AgentGetList, "district">;
86
+ interface AgentGet extends AgentGetList {
83
87
  createdAt: Date;
84
- updatedAt?: Voidable<Date>;
85
- operator?: Voidable<string>;
86
- representative?: Voidable<ApiRepresentativeGet>;
87
- serviceType?: Voidable<AgentServiceType[]>;
88
+ updatedAt: Date;
89
+ operator: string;
90
+ representative: ApiRepresentativeGet;
91
+ serviceType: AgentServiceType[];
88
92
  statusEngagement: AgentEngagementStatusType;
89
93
  agentDetails: AgentDetails;
90
94
  comments: ApiComment[];
95
+ languages: ApiLanguage[];
91
96
  }
97
+ export type ApiAgentGet = VoidableProps<AgentGet, "district" | "operator" | "representative" | "serviceType" | "updatedAt">;
92
98
  interface AgentPatch {
93
99
  title: string;
94
100
  type: AgentType;
@@ -103,6 +109,7 @@ interface AgentPatch {
103
109
  statusSearch: AgentVolunteerSearchType;
104
110
  services: AgentServiceType[];
105
111
  languages: OptionById[];
112
+ districtId: number;
106
113
  }
107
114
  export type ApiAgentPatch = VoidableProps<AgentPatch>;
108
115
  export {};
@@ -1,4 +1,4 @@
1
- import { Id, Lang } from "..";
1
+ import { Id, Lang, VoidableProps, VoidableUndefined } from "..";
2
2
  import { ApiOpportunityAccompanyingDetails } from "./accompanying";
3
3
  import { AgentType } from "./agent";
4
4
  import { ApiComment } from "./comment";
@@ -73,7 +73,7 @@ export interface OpportunityFormData {
73
73
  category_id: OptionId;
74
74
  last_edited_time_notion?: string;
75
75
  }
76
- export interface OpportunityLegacyFormData {
76
+ export interface OpportunityLegacyFormDataProps {
77
77
  title: string;
78
78
  rac_email: string;
79
79
  rac_full_name: string;
@@ -101,6 +101,7 @@ export interface OpportunityLegacyFormData {
101
101
  last_edited_time_notion?: string;
102
102
  language: `${Lang}`;
103
103
  }
104
+ export type OpportunityLegacyFormData = VoidableUndefined<OpportunityLegacyFormDataProps>;
104
105
  export interface ApiOpportunityAgent {
105
106
  id: number;
106
107
  type: AgentType;
@@ -140,7 +141,7 @@ export interface ApiOpportunityGet extends ApiOpportunityGetList {
140
141
  agent: ApiOpportunityAgent;
141
142
  }
142
143
  export type ApiOpportunityLean = Omit<ApiOpportunityGet, "comments">;
143
- export type ApiOpportunityPatch = Partial<{
144
+ export type ApiOpportunityPatch = VoidableProps<{
144
145
  statusOpportunity: OpportunityStatusType;
145
146
  numberVolunteers: number;
146
147
  description: string;
@@ -1,6 +1,7 @@
1
1
  import { EntityTableName } from "../core";
2
+ import { VoidableProps } from "../utils";
2
3
  export interface OptionItem {
3
4
  title: string;
4
5
  id: number;
5
6
  }
6
- export type ApiOptionLists = Partial<Record<EntityTableName, OptionItem[]>>;
7
+ export type ApiOptionLists = VoidableProps<Record<EntityTableName, OptionItem[]>>;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
@@ -1,4 +1,5 @@
1
1
  import { DocumentStatusType, Id } from "../core";
2
+ import { VoidableProps } from "../utils";
2
3
  import { OptionById, OptionId } from "./common";
3
4
  import { ApiLanguage } from "./language";
4
5
  import { ApiOpportunityGetList, OpportunityVolunteer } from "./opportunity";
@@ -105,12 +106,12 @@ export declare enum VolunteerStateMatchType {
105
106
  }
106
107
  export declare const VolunteerCommunicationType: typeof PreferredCommunicationType;
107
108
  export type VolunteerCommunicationType = PreferredCommunicationType;
108
- export interface ApiVolunteerGetList {
109
+ interface VolunteerGetListProps {
109
110
  id: number;
110
111
  statusEngagement: VolunteerStateEngagementType;
111
112
  statusType: VolunteerStateTypeType;
112
- statusMatch?: VolunteerStateMatchType;
113
- statusCommunication?: VolunteerStateCommunicationType;
113
+ statusMatch: VolunteerStateMatchType;
114
+ statusCommunication: VolunteerStateCommunicationType;
114
115
  name: string;
115
116
  avatarUrl: string;
116
117
  languages: ApiLanguage[];
@@ -119,6 +120,7 @@ export interface ApiVolunteerGetList {
119
120
  skills: OptionItem[];
120
121
  locations: OptionItem[];
121
122
  }
123
+ export type ApiVolunteerGetList = VoidableProps<VolunteerGetListProps, "statusMatch" | "statusCommunication">;
122
124
  export interface ApiVolunteerGet {
123
125
  id: number;
124
126
  person: ApiPersonGet;
@@ -150,8 +152,7 @@ export interface ApiVolunteerGet {
150
152
  skills: OptionItem[];
151
153
  locations: OptionItem[];
152
154
  }
153
- export interface VolunteerPatchBodyData extends Partial<ApiVolunteerGet> {
154
- }
155
+ export type VolunteerPatchBodyData = VoidableProps<ApiVolunteerGet>;
155
156
  export interface ApiVolunteerOpportunityGet extends OpportunityVolunteer {
156
157
  name: string;
157
158
  avatarUrl: string;
@@ -169,3 +170,4 @@ export interface ApiVolunteerOpportunityGetList extends ApiOpportunityGetList {
169
170
  location: OptionById[];
170
171
  availability: ApiAvailability[];
171
172
  }
173
+ export {};
@@ -1,5 +1,8 @@
1
1
  export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
2
- export type VoidableProps<T> = {
3
- [K in keyof T]?: T[K] | undefined | null;
2
+ export type VoidableProps<T, K extends keyof T = keyof T> = Omit<T, K> & {
3
+ [P in K]?: T[P] | null;
4
+ };
5
+ export type VoidableUndefined<T> = {
6
+ [K in keyof T]: undefined extends T[K] ? T[K] | null : T[K];
4
7
  };
5
8
  export type Voidable<T> = T | undefined | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "need4deed-sdk",
3
- "version": "0.0.90",
3
+ "version": "0.0.91",
4
4
  "description": "Need4Deed.org SDK",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",