need4deed-sdk 0.0.194 → 0.0.196

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.
package/README.md CHANGED
@@ -7,3 +7,11 @@ Shared types for need4deed.org
7
7
  `TranslationFieldsByEntity` exports the registered translation fields for each entity. Backend registry validation can use this map to keep accepted fields aligned with the SDK.
8
8
 
9
9
  Opportunity translation endpoints use `info` for the field exposed as `description` by `ApiOpportunityGet` and `ApiOpportunityPatch`. Translation requests must use `info`; ordinary opportunity requests use `description`.
10
+
11
+ ## District aggregate contract
12
+
13
+ District aggregate responses include every configured district, including
14
+ districts with a count of zero. Volunteers are placed and counted in the
15
+ district of their home postcode, not their preferred districts. Each volunteer
16
+ is counted once. Aggregate requests use the same profile-specific `filter`
17
+ types as district marker requests.
@@ -0,0 +1,17 @@
1
+ import { ApiAgentDistrictFilters, ApiDistrictMarkerFilters, ApiOpportunityDistrictFilters, ApiVolunteerDistrictFilters } from "./district-marker";
2
+ export type ApiDistrictAggregateDistrict = {
3
+ districtId: number;
4
+ count: number;
5
+ };
6
+ export type ApiDistrictAggregateQuery<TFilters = ApiDistrictMarkerFilters> = {
7
+ filter?: TFilters;
8
+ };
9
+ export type ApiAgentDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiAgentDistrictFilters>;
10
+ export type ApiOpportunityDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiOpportunityDistrictFilters>;
11
+ export type ApiVolunteerDistrictAggregateQuery = ApiDistrictAggregateQuery<ApiVolunteerDistrictFilters>;
12
+ export type ApiDistrictAggregate = {
13
+ districts: ApiDistrictAggregateDistrict[];
14
+ unassignedBerlin: number;
15
+ outsideBerlin: number;
16
+ remote: number;
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ import { EntityTableName, Id, Lang } from "../core";
2
+ import { AgentType } from "./agent";
3
+ import { ApiLanguage } from "./language";
4
+ import { District } from "./location";
5
+ import { ApiAvailability } from "./time";
6
+ import { VolunteerType } from "./volunteer";
7
+ export declare const apiDistrictMarkerMaxEntities = 500;
8
+ export type ApiDistrictMarkerFilterValue = string | number | boolean | Array<string | number>;
9
+ export type ApiAgentDistrictFilters = Partial<Record<"type" | "status" | "engagementStatus" | "services" | "volunteerSearch", ApiDistrictMarkerFilterValue>>;
10
+ export type ApiOpportunityDistrictFilters = Partial<Record<"type" | "status" | "activity" | "skill" | "match" | "agentId" | "language" | "availability", ApiDistrictMarkerFilterValue>>;
11
+ export type ApiVolunteerDistrictFilters = Partial<Record<"type" | "language" | "activity" | "skill" | "availability" | "engagement" | "match", ApiDistrictMarkerFilterValue>>;
12
+ export type ApiDistrictMarkerFilters = ApiAgentDistrictFilters | ApiOpportunityDistrictFilters | ApiVolunteerDistrictFilters;
13
+ export type ApiDistrictMarkerQuery<TFilters = ApiDistrictMarkerFilters> = {
14
+ districtId: number;
15
+ language: Lang;
16
+ filter?: TFilters;
17
+ };
18
+ export type ApiAgentDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiAgentDistrictFilters>;
19
+ export type ApiOpportunityDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiOpportunityDistrictFilters>;
20
+ export type ApiVolunteerDistrictMarkerQuery = ApiDistrictMarkerQuery<ApiVolunteerDistrictFilters>;
21
+ export type ApiDistrictMarkerChild = {
22
+ id: Id;
23
+ title: string;
24
+ languages?: ApiLanguage[];
25
+ availability?: ApiAvailability[];
26
+ type?: AgentType;
27
+ statusTypes?: VolunteerType[];
28
+ district?: District;
29
+ };
30
+ export type ApiDistrictMarker = {
31
+ lat: number | null;
32
+ lon: number | null;
33
+ districtId: number;
34
+ children: Array<ApiDistrictMarkerChild>;
35
+ entity: EntityTableName.AGENT | EntityTableName.OPPORTUNITY | EntityTableName.VOLUNTEER;
36
+ };
37
+ export type ApiDistrictMarkerGet = {
38
+ markers: ApiDistrictMarker[];
39
+ total: number;
40
+ maxEntities: number;
41
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiDistrictMarkerMaxEntities = void 0;
4
+ exports.apiDistrictMarkerMaxEntities = 500;
@@ -5,7 +5,9 @@ export * from "./appreciation";
5
5
  export * from "./comment";
6
6
  export * from "./common";
7
7
  export * from "./communication";
8
+ export * from "./district-aggregate";
8
9
  export * from "./district-geometry";
10
+ export * from "./district-marker";
9
11
  export * from "./document";
10
12
  export * from "./event";
11
13
  export * from "./language";
@@ -21,7 +21,9 @@ __exportStar(require("./appreciation"), exports);
21
21
  __exportStar(require("./comment"), exports);
22
22
  __exportStar(require("./common"), exports);
23
23
  __exportStar(require("./communication"), exports);
24
+ __exportStar(require("./district-aggregate"), exports);
24
25
  __exportStar(require("./district-geometry"), exports);
26
+ __exportStar(require("./district-marker"), exports);
25
27
  __exportStar(require("./document"), exports);
26
28
  __exportStar(require("./event"), exports);
27
29
  __exportStar(require("./language"), exports);
@@ -9,7 +9,7 @@ export declare enum TranslationStatus {
9
9
  DONE = "done",
10
10
  FAILED = "failed"
11
11
  }
12
- export type TranslationErrorCode = "empty" | "length_ratio" | "token_missing" | "untranslated" | "source_is_target" | "wrong_language" | "bad_response" | "provider_unavailable";
12
+ export type TranslationErrorCode = "empty" | "length_ratio" | "token_missing" | "email_missing" | "url_missing" | "phone_missing" | "date_missing" | "time_missing" | "number_missing" | "untranslated" | "source_is_target" | "wrong_language" | "bad_response" | "provider_unavailable";
13
13
  export interface ApiFieldTranslation {
14
14
  id: number;
15
15
  text: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "need4deed-sdk",
3
- "version": "0.0.194",
3
+ "version": "0.0.196",
4
4
  "description": "Need4Deed.org SDK",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",