@jwilleke/ngdpbase-types 5.29.0 → 5.29.1

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.
@@ -42,6 +42,6 @@ export type { User, UserPreferences } from '../../src/types/User.js';
42
42
  export type { default as PersonManager, LinkOfferOutcome } from '../../src/managers/PersonManager.js';
43
43
  export type { default as OrganizationManager } from '../../src/managers/OrganizationManager.js';
44
44
  export type { Person, PersonAffiliation, PersonInput, PersonUpdate } from '../../src/types/Person.js';
45
- export type { Organization, OrganizationInput, OrganizationUpdate } from '../../src/types/Organization.js';
45
+ export type { Organization, OrganizationInput, OrganizationUpdate, ContactPoint, ContactPointEntry, PostalAddress } from '../../src/types/Organization.js';
46
46
  export type { ContactRefusedError } from '../../src/utils/contactAccess.js';
47
47
  export type { default as RoleManager } from '../../src/managers/RoleManager.js';
@@ -517,6 +517,11 @@ declare class UserManager extends BaseManager {
517
517
  /**
518
518
  * Search users by username, displayName, or email (case-insensitive substring).
519
519
  * Optionally filter by role and active status.
520
+ *
521
+ * Decides `search-user` itself, with `ctx` (#2018): every user holds it as
522
+ * shipped, anonymous does not. A refusal throws `ContactRefusedError`. Core's
523
+ * own lookups (a notice's recipients, a role's holders) pass the system
524
+ * context with a reason, allowed without a policy evaluation.
520
525
  */
521
526
  searchUsers(query: string, options: {
522
527
  role?: string;
@@ -12,11 +12,15 @@
12
12
  * @see https://schema.org/Organization
13
13
  */
14
14
  /**
15
- * Schema.org PostalAddress (subset used by Organization)
15
+ * Schema.org PostalAddress (subset used by Organization/Person).
16
+ *
17
+ * In schema.org a PostalAddress is a ContactPoint, so it carries the
18
+ * ContactPoint fields too: a `contactPoint[]` entry may be one (a mailing or
19
+ * business address, with its `contactType`, `name` and `telephone`).
16
20
  *
17
21
  * @see https://schema.org/PostalAddress
18
22
  */
19
- export interface PostalAddress {
23
+ export interface PostalAddress extends Omit<ContactPoint, '@type'> {
20
24
  '@type': 'PostalAddress';
21
25
  streetAddress?: string | null;
22
26
  addressLocality?: string | null;
@@ -32,11 +36,19 @@ export interface PostalAddress {
32
36
  export interface ContactPoint {
33
37
  '@type': 'ContactPoint';
34
38
  contactType?: string;
39
+ /** Who or what this contact point reaches, e.g. an agent's or an emergency contact's name (schema.org Thing.name). */
40
+ name?: string;
35
41
  email?: string;
36
42
  telephone?: string;
37
43
  url?: string;
38
44
  availableLanguage?: string[];
39
45
  }
46
+ /**
47
+ * One `contactPoint[]` entry: a ContactPoint, or a PostalAddress (schema.org's
48
+ * ContactPoint subtype). Typed by `contactType` (`mailing`, `business`,
49
+ * `agent`, `emergency`, …); the home address stays in `address`.
50
+ */
51
+ export type ContactPointEntry = ContactPoint | PostalAddress;
40
52
  /**
41
53
  * Canonical Organization record.
42
54
  *
@@ -62,8 +74,8 @@ export interface Organization {
62
74
  foundingDate?: string;
63
75
  /** Postal address */
64
76
  address?: PostalAddress;
65
- /** Contact points (support, sales, etc.) */
66
- contactPoint?: ContactPoint[];
77
+ /** Contact points (support, sales, a mailing address, etc.) */
78
+ contactPoint?: ContactPointEntry[];
67
79
  /** Other URLs that identify this org (LinkedIn, Twitter, etc.) */
68
80
  sameAs?: string[];
69
81
  /** Optional legacy slug or external identifier */
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * @see https://schema.org/Person
17
17
  */
18
- import type { PostalAddress, ContactPoint } from './Organization.js';
18
+ import type { PostalAddress, ContactPointEntry } from './Organization.js';
19
19
  /**
20
20
  * One organization a person is affiliated with (#1930): schema.org
21
21
  * `affiliation`, with the person's role or title there when one is known.
@@ -51,8 +51,8 @@ export interface Person {
51
51
  email?: string;
52
52
  /** Postal address */
53
53
  address?: PostalAddress;
54
- /** Contact points (work phone, mobile, etc.) */
55
- contactPoint?: ContactPoint[];
54
+ /** Everything but the home address: phones, a mailing or business address (a PostalAddress), an agent, an emergency contact; each typed by `contactType`. */
55
+ contactPoint?: ContactPointEntry[];
56
56
  /** ISO language tags this person knows */
57
57
  knowsLanguage?: string[];
58
58
  /** Profile/avatar image URL */
@@ -67,6 +67,13 @@ export declare function isSystemWork(engine: EngineLike, ctx: ActorContext | nul
67
67
  export declare function requireRecordAccess(engine: EngineLike, ctx: ActorContext, kind: keyof typeof CONTACT_PERMISSION, record?: {
68
68
  identifier?: unknown;
69
69
  } | null): Promise<void>;
70
+ /**
71
+ * A lookup of users (#2018): `UserManager.searchUsers` asks `permission`
72
+ * (`search-user`) with the caller's context, and throws
73
+ * {@link ContactRefusedError} on a refusal. Core's own work
74
+ * ({@link isSystemWork}) is allowed without a policy evaluation.
75
+ */
76
+ export declare function requireLookupPermission(engine: EngineLike, ctx: ActorContext, permission: CorePermission): Promise<void>;
70
77
  /** What a contacts record says was done. Names fields, never their values. */
71
78
  export interface ContactChange {
72
79
  kind: 'person' | 'organization';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilleke/ngdpbase-types",
3
- "version": "5.29.0",
3
+ "version": "5.29.1",
4
4
  "description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jim Willeke",