@joymerrevent/porters-connect 0.10.0 → 0.11.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,85 @@
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.11.0] - 2026-08-30
9
+
10
+ **参照先の項目を 1 往復で読めるようにし、`field` の語彙をクエリ全体と揃えた版**です。
11
+ どちらも「**要求したものが黙って返らない**」を潰す変更で、`field` に接頭辞を書かなくなる
12
+ **破壊的変更**を含みます(移行は接頭辞を消すだけ)。
13
+
14
+ ### Added
15
+
16
+ - **参照型の展開 `expand`**([ADR-0058][adr58])。`System[Reference]` の項目(`Job.P_Client` など)から
17
+ **参照先の項目そのもの**を取得できるようになりました。これまでは参照先の **ID だけ**を取り出し、
18
+ 入れ子で返ってきた残りを**黙って捨てて**いました。
19
+
20
+ ```ts
21
+ const page = await t.job.search({ expand: { P_Client: ["P_Id", "P_Name"] } });
22
+ page.items[0]?.P_Client; // { P_Id: number | null; P_Name: string | null } | null
23
+
24
+ const plain = await t.job.search();
25
+ plain.items[0]?.P_Client; // number | null(従来どおり)
26
+ ```
27
+
28
+ - **参照先の接頭辞は書きません**。`condition` / `order` / `field` と同じ素の alias で指定すると、
29
+ ライブラリが `field=Job.P_Client(Client.P_Id,Client.P_Name)` を組み立てます。
30
+ Candidate を参照するときの `Person.` も同様です。
31
+ - **`expand` を書いた項目だけ**戻り型が変わります。基底の型は `number | null` のままなので、
32
+ **参照を ID として使っているコードは無変更**です。展開しなかった参照も ID のまま返ります。
33
+ - `search` / `searchAll` / `get(id, { expand })` で使えます。`get` は第 2 引数が増えただけで、
34
+ 既存の `get(id)` はそのままです。
35
+ - 展開した alias は**素のエントリを置き換えて**送られます。同じ alias を `()` 有り・無しで 2 回送ったとき
36
+ どちらが優先されるかは PORTERS のドキュメントに記述が無いため、**そもそも送りません**。
37
+ - 展開できるのは**参照先をライブラリが実装している項目**だけです。`P_Recruiter`(Recruiter は未実装)と
38
+ カスタム項目(`U_`/`A_`)の参照型は対象外で、**従来どおり ID として読めます**。書くと型エラーです。
39
+ - `field` に `"Job.P_Client(Client.P_Id)"` のような展開文字列を書くと、送信前に
40
+ `PortersConfigError` で止まり `expand` を案内します。
41
+ - `()` の中に付ける参照先の接頭辞と入れ子の形は**実機で未確認**です
42
+ ([live-verification][lv] LV-10 / LV-16)。応答の解釈はタグ名に依存しない実装です。
43
+
44
+ - **型の export**: `Expand` / `ExpandedReadRecord` / `ReferenceMap` / `ResourcePageOf` /
45
+ `ReferenceRecord` / `ReadFieldAlias`。`FieldValue` に `ReferenceRecord`(展開された参照の値)が加わります。
46
+
47
+ ### Changed
48
+
49
+ - **(破壊的)Read の `field` は接頭辞なしの alias で書きます**([ADR-0059][adr59])。
50
+ 接頭辞はリソースごとの定数なので、**ライブラリが付けます**。
51
+
52
+ ```diff
53
+ - field: ["Person.P_Id", "Person.P_Name"]
54
+ + field: ["P_Id", "P_Name"]
55
+ ```
56
+
57
+ - 移行は**接頭辞を消すだけ**です。送られる URL は従来と同じで、変わるのは書き方と、
58
+ **どこで間違いに気づけるか**だけです。
59
+ - `condition` / `order` / `expand` はもともと素の alias を受けていたため、
60
+ **同じクエリの中で語彙が 2 つあった**状態が解消されます。
61
+ - **間違いがコンパイルエラーになります** — 綴り間違い(`P_Nmae`)・接頭辞付き(`Person.P_Name`)・
62
+ リソース名との取り違え(`Candidate.P_Name`。Candidate の接頭辞は `Person` です)・展開文字列。
63
+ これまでは型(`string[]`)でも送信前ガードでも素通りし、**PORTERS 側で黙って無視される**だけでした。
64
+ - **未宣言のカスタム項目は引き続き書けます**(`U_` / `A_` で始まる名前)。ただし `U_` 以降の綴りは
65
+ 検査できないので、よく使うものは `defineFields` で宣言してください(宣言すれば綴りも検査されます)。
66
+ - 実行時は接頭辞付きが来ても**剥がして受けます**(応答側と対称の寛容さ)。cast 経由の古い形も壊れません。
67
+ - 対象は `SearchQuery.field`(データ 5 リソース)と `UserSearchQuery.field`(マスタ User)。
68
+ **Attachment は元から接頭辞なし**なので変更ありません。`field: []`(主キーのみ)と
69
+ 省略時の既定 field([ADR-0020][adr20])の意味も変わりません。
70
+ - **pre-1.0 のため minor**([ADR-0055][adr55] と同じ扱い)。
71
+
72
+ - **明示した `field` も既定 field と同じ組み立てを通る**ようになりました。`User` 型の項目を
73
+ `field` で明示すると **4 サブ項目に展開**されます(`Job.P_Owner(User.P_Id,User.P_Type,User.P_Name,User.P_Mail)`)。
74
+ これまでは `()` 無しで送られ、PORTERS が ID を返すため、**型が `UserRef` を約束するのに実体は `null`**
75
+ になっていました。
76
+
77
+ ### Fixed
78
+
79
+ - **参照 ID の読み取りが、リソース名と alias 接頭辞の食い違いで `null` に落ちていました**。
80
+ 入れ子の**包みタグはリソース名**なのに**中の alias は接頭辞付き**で、この 2 つが異なる Candidate
81
+ (`<Candidate>` に `Person.P_Id`)では従来の照合が外れていました。**素の alias で照合**するようにしたので、
82
+ どちらの表記でも読めます。
83
+ - 影響していたのは `Process.P_Candidate` / `Resume.P_Candidate`(Candidate を参照する項目)です。
84
+ 包みタグの実際の値は**実機で未確認**([live-verification][lv] LV-10)で、フェイクサーバーは
85
+ これまで中立な包みを返していたため、テストでは露出していませんでした。
86
+
8
87
  ## [0.10.0] - 2026-08-22
9
88
 
10
89
  **partition の束ね方を 1 つに絞り、削除済みレコードを判別できるようにした版**です。
@@ -356,10 +435,13 @@
356
435
  [adr55]: docs/adr/0055-partition-binding-guard.md
357
436
  [adr56]: docs/adr/0056-deleted-flag-typing.md
358
437
  [adr57]: docs/adr/0057-itemstate-existing-explicit.md
438
+ [adr58]: docs/adr/0058-reference-expansion-read.md
439
+ [adr59]: docs/adr/0059-read-field-bare-alias.md
359
440
  [lv]: docs/live-verification.md
360
441
  [kac]: https://keepachangelog.com/en/1.1.0/
361
442
  [semver]: https://semver.org/
362
- [unreleased]: https://github.com/Joymerrevent/porters-connect/compare/v0.10.0...HEAD
443
+ [unreleased]: https://github.com/Joymerrevent/porters-connect/compare/v0.11.0...HEAD
444
+ [0.11.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.10.0...v0.11.0
363
445
  [0.10.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.9.0...v0.10.0
364
446
  [0.9.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.8.0...v0.9.0
365
447
  [0.8.0]: https://github.com/Joymerrevent/porters-connect/compare/v0.7.0...v0.8.0
package/README.md CHANGED
@@ -178,15 +178,18 @@ await porters.auth.exchangeAuthorizationCode(code);
178
178
 
179
179
  - `search(query?)` → `{ items, total, count, start }`(オフセット式ページング)。
180
180
  - `searchAll(query?)` → `AsyncIterable`(200 件刻みで全件 yield)。
181
- - `get(id)` → 1 件 or `undefined`。
181
+ - `get(id, options?)` → 1 件 or `undefined`(`options.expand` で参照先の項目も読めます)。
182
182
  - `create(input)` → 採番された **id(number)**。
183
183
  - `update(id, input)` → その **id**。
184
184
 
185
185
  **検索クエリ**(`query`)の主なキー(すべて型安全。**項目の Data Type が許す演算子だけ**を受けます):
186
186
 
187
- - `field`:取得する項目(接頭辞付き alias の配列。例 `["Person.P_Id", "Person.P_Name"]`)。
187
+ - `field`:取得する項目(**接頭辞なし**の alias の配列。例 `["P_Id", "P_Name"]`。接頭辞はライブラリが付けます)。
188
+ 綴り間違いや接頭辞付きは**コンパイルエラー**になります。
188
189
  **省略するとカタログ上の全項目を既定取得**します(PORTERS は field 未指定だと主キーのみ返すため、
189
190
  ライブラリが既定 field を補います)。`field: []`(空配列)を渡すと API 仕様どおり**主キーのみ**を返します(件数取得など)。
191
+ - `expand`:参照型(`System[Reference]`)の項目について、**参照先の項目も読む**(`{ P_Client: ["P_Id", "P_Name"] }`)。
192
+ 書かなければ従来どおり**参照先の ID**が返り、**書いた項目だけ**戻り型が参照レコードに変わります。1 往復で済みます。
190
193
  - `condition`:検索条件。`{ 項目: { 演算子: 値 } }` 形式(複数項目は AND)。演算子は Data Type ごとに
191
194
  `eq`/`gt`/`ge`/`le`/`lt`(数値・日時・Id)、`part`/`full`(テキスト)、`or`/`and`(Option・参照/ユーザー型は ID)。
192
195
  **日時の値は ISO 8601(UTC `…Z`)**で渡すと PORTERS 形式へ自動変換します。
@@ -198,8 +201,9 @@ await porters.auth.exchangeAuthorizationCode(code);
198
201
  > **削除 API はありません**(PORTERS 仕様)。`delete()` メソッドは提供しません。削除済みは `itemstate: "deleted"` で読みます
199
202
  > (`condition` は `P_Id` / `P_UpdateDate` / `P_UpdatedBy` に限られ、更新日は 90 日以内)。
200
203
  >
201
- > `field` の 3 通りの意味(省略=全項目 / `[]`=主キーのみ / 明示)、Data Type ごとの演算子一覧、
202
- > 削除済み Read の制約、送信前に落ちる条件は [Read クエリ ガイド][read-query-guide] にまとめています。
204
+ > `field` の 3 通りの意味(省略=全項目 / `[]`=主キーのみ / 明示)、`expand` で展開できる項目、
205
+ > Data Type ごとの演算子一覧、削除済み Read の制約、送信前に落ちる条件は
206
+ > [Read クエリ ガイド][read-query-guide] にまとめています。
203
207
 
204
208
  ### カスタム項目(`U_` / `A_`)
205
209
 
package/dist/index.d.ts CHANGED
@@ -137,7 +137,15 @@ type UserRef = {
137
137
  P_Name: string | null;
138
138
  P_Mail: string | null;
139
139
  };
140
- type FieldValue = string | number | string[] | UserRef | null;
140
+ /**
141
+ * An **expanded** `System[Reference]` value: the referenced record's requested fields, decoded by
142
+ * the referenced resource's own catalog (ADR-0058). Only a read that asked for the expansion
143
+ * (`expand`) produces one — without it a reference decodes to the referenced id (`number`).
144
+ */
145
+ type ReferenceRecord = {
146
+ [alias: string]: FieldValue;
147
+ };
148
+ type FieldValue = string | number | string[] | UserRef | ReferenceRecord | null;
141
149
  type DecodedValue<D extends DataType | null> = D extends null ? string : D extends "System[Id]" | "Number" | "System[Reference]" ? number : D extends "User" ? UserRef : D extends "Option" ? string[] : string;
142
150
 
143
151
  type WritableDataType = Exclude<DataType, "System[Id]" | "System[DateTime]">;
@@ -160,12 +168,92 @@ type EmptyCatalog = Record<never, never>;
160
168
  type ReadRecord<F extends FieldCatalog> = {
161
169
  [K in keyof F]?: DecodedValue<F[K]> | null;
162
170
  };
163
- type ResourcePage<F extends FieldCatalog> = {
164
- items: ReadRecord<F>[];
171
+ /**
172
+ * A page of decoded records: the standard Read envelope (Total / Count / Start) around whatever
173
+ * the item decoder produced. Parametrised by the *record* rather than the catalog because a read
174
+ * that expands references returns a wider record than the catalog alone describes (ADR-0058).
175
+ */
176
+ type ResourcePageOf<T> = {
177
+ items: T[];
165
178
  total: number;
166
179
  count: number;
167
180
  start: number;
168
181
  };
182
+ type ResourcePage<F extends FieldCatalog> = ResourcePageOf<ReadRecord<F>>;
183
+ /**
184
+ * What a Read `field` entry may name (ADR-0059): a catalogued alias — every standard `P_` field
185
+ * plus the custom fields declared with `defineFields` (ADR-0023) — or an undeclared tenant custom
186
+ * field, admitted by the `U_`/`A_` naming rule `defineFields` already enforces at runtime.
187
+ *
188
+ * Aliases are **bare**: the resource's prefix (`Person.` for Candidate) is a constant the
189
+ * descriptor knows, so the library adds it. That makes `condition` / `order` / `field` one
190
+ * vocabulary and turns a typo (`P_Nmae`) or a hand-written prefix into a compile error instead of
191
+ * a request that quietly returns nothing.
192
+ */
193
+ type ReadFieldAlias<F extends FieldCatalog> = (keyof F & string) | `U_${string}` | `A_${string}`;
194
+
195
+ /**
196
+ * The resource a `System[Reference]` field points at, as far as expansion needs it: its alias
197
+ * prefix (what goes inside the `()`) and its Data-Type catalog (what decodes the answer).
198
+ *
199
+ * Structurally a {@link ResourceDescriptor}, spelled out here so the two types do not reference
200
+ * each other in a circle. Descriptors are passed in directly — the referenced prefix is **not**
201
+ * the resource name for Candidate (`Person`), which is exactly the trap this removes from callers.
202
+ */
203
+ type ReferenceTarget = {
204
+ name: string;
205
+ path: string;
206
+ prefix: string;
207
+ fields: FieldCatalog;
208
+ };
209
+ /**
210
+ * A resource's expandable reference fields: bare alias -> the referenced resource's descriptor.
211
+ * Only catalogued `System[Reference]` fields whose target the library implements appear here;
212
+ * anything absent simply cannot be expanded (it still reads as the referenced id).
213
+ */
214
+ type ReferenceMap = Readonly<Record<string, ReferenceTarget>>;
215
+ /**
216
+ * "Nothing to expand": the identity default for the reference generic, mirroring
217
+ * {@link EmptyCatalog}. `Record<never, never>` keeps `keyof` empty, so every derived type
218
+ * collapses back to the un-expanded shape.
219
+ */
220
+ type EmptyReferences = Record<never, never>;
221
+ /** The catalog of a reference target — the type its expanded values decode by. */
222
+ type CatalogOf$1<T> = T extends {
223
+ fields: infer F extends FieldCatalog;
224
+ } ? F : never;
225
+ /**
226
+ * What `expand` accepts: for each expandable reference field, the **bare aliases** to read from
227
+ * the referenced record. The referenced prefix is never written by the caller — the descriptor
228
+ * has it (ADR-0058). Only catalogued aliases of the target are allowed: an alias outside its
229
+ * catalog has no Data Type here, so nothing could type or decode it.
230
+ */
231
+ type Expand<R extends ReferenceMap> = {
232
+ [K in keyof R]?: readonly (keyof CatalogOf$1<R[K]> & string)[];
233
+ };
234
+ /**
235
+ * The value an expanded reference field reads back as: the selected aliases, each decoded by the
236
+ * referenced catalog's Data Type.
237
+ *
238
+ * `[S] extends [...]` is deliberately **non-distributive**. A caller who declares their query as
239
+ * the loose `SearchQuery` type passes `S = readonly (...)[] | undefined`, which is not a promise
240
+ * that anything was expanded — that falls through to the un-expanded `number`, so naming the
241
+ * query type never changes what the record claims to hold.
242
+ */
243
+ type ExpandedValue<T extends ReferenceTarget, S> = [S] extends [
244
+ readonly (infer A extends keyof CatalogOf$1<T> & string)[]
245
+ ] ? {
246
+ [K in A]?: DecodedValue<CatalogOf$1<T>[K]> | null;
247
+ } : DecodedValue<"System[Reference]">;
248
+ /**
249
+ * The read record for a query that expanded some references: the plain {@link ReadRecord}, with
250
+ * each expanded field's value replaced by the referenced record's own shape. Fields left out of
251
+ * `expand` keep the referenced id (`number`), so a caller who expands one relation pays no type
252
+ * cost on the others — that asymmetry is the point of `expand` over widening the base type.
253
+ */
254
+ type ExpandedReadRecord<F extends FieldCatalog, R extends ReferenceMap, E> = Omit<ReadRecord<F>, keyof E> & {
255
+ [K in keyof E & keyof R]?: ExpandedValue<R[K], E[K]> | null;
256
+ };
169
257
 
170
258
  /** Comparable ops for numeric Ids (System[Id]); `or` matches a set of Resource Ids (`P_Id:or=1:2`). */
171
259
  type IdCondition = {
@@ -244,14 +332,31 @@ type Order<F extends FieldCatalog> = Array<Partial<Record<OrderableKeys<F>, "asc
244
332
  * ever changes that default. Use `itemstate: "existing"` when live-only actually matters to you.
245
333
  */
246
334
  type ItemState = "existing" | "deleted" | "all";
247
- type SearchQuery<F extends FieldCatalog = FieldCatalog> = {
335
+ type SearchQuery<F extends FieldCatalog = FieldCatalog, R extends ReferenceMap = EmptyReferences> = {
248
336
  /**
249
- * Output fields as prefixed aliases (e.g. `Person.P_Name`). **Omit** to fetch every catalogued
337
+ * Output fields as **bare aliases** (e.g. `P_Name`) — the same vocabulary as `condition` and
338
+ * `order`; the library adds the resource's prefix (ADR-0059). **Omit** to fetch every catalogued
250
339
  * field by default (ADR-0020): PORTERS returns only the primary key for a fieldless request, so
251
340
  * the library sends a catalog-derived default field set instead. Pass `[]` to opt into that
252
- * API-native "primary key only" response (e.g. counting). A non-empty list is sent verbatim.
341
+ * API-native "primary key only" response (e.g. counting).
253
342
  */
254
- field?: string[];
343
+ field?: ReadFieldAlias<F>[];
344
+ /**
345
+ * Read the *fields* of a referenced record, not just its id (ADR-0058): map an expandable
346
+ * `System[Reference]` field to the bare aliases you want from the resource it points at. The
347
+ * referenced prefix is supplied by the library, and the expanded fields come back decoded by
348
+ * that resource's own Data Types.
349
+ *
350
+ * ```ts
351
+ * const page = await t.job.search({ expand: { P_Client: ["P_Id", "P_Name"] } });
352
+ * page.items[0]?.P_Client; // { P_Id: number | null; P_Name: string | null } | null
353
+ * ```
354
+ *
355
+ * A field left out of `expand` still reads as the referenced id — expanding one relation costs
356
+ * nothing on the others. An expanded alias replaces its plain `field` entry, so nothing is
357
+ * requested twice.
358
+ */
359
+ expand?: Expand<R>;
255
360
  /** Typed AND-conditions; each field's operators derive from its Data Type (ADR-0038). */
256
361
  condition?: Condition<F>;
257
362
  /** Sort order; orderable Data Types only (Number/Date/DateTime/Age/System). */
@@ -305,11 +410,18 @@ type CreateInput<F extends FieldCatalog, Req extends keyof F> = {
305
410
  type UpdateInput<F extends FieldCatalog> = {
306
411
  [K in WritableKeys<F>]?: WriteValueOf<F[K]> | null;
307
412
  };
308
- type Resource<F extends FieldCatalog, Req extends keyof F> = {
309
- search(query?: SearchQuery<F>): Promise<ResourcePage<F>>;
413
+ type Resource<F extends FieldCatalog, Req extends keyof F, R extends ReferenceMap = EmptyReferences> = {
414
+ search<const E extends Expand<R> = EmptyReferences>(query?: SearchQuery<F, R> & {
415
+ expand?: E;
416
+ }): Promise<ResourcePageOf<ExpandedReadRecord<F, R, E>>>;
310
417
  /** Auto-paginating search: yields every matching record (200 per page). */
311
- searchAll(query?: Omit<SearchQuery<F>, "count" | "start">): AsyncIterable<ReadRecord<F>>;
312
- get(id: number): Promise<ReadRecord<F> | undefined>;
418
+ searchAll<const E extends Expand<R> = EmptyReferences>(query?: Omit<SearchQuery<F, R>, "count" | "start"> & {
419
+ expand?: E;
420
+ }): AsyncIterable<ExpandedReadRecord<F, R, E>>;
421
+ /** Read one record by id. `expand` reads referenced records too (ADR-0058). */
422
+ get<const E extends Expand<R> = EmptyReferences>(id: number, options?: {
423
+ expand?: E;
424
+ }): Promise<ExpandedReadRecord<F, R, E> | undefined>;
313
425
  /** Create one record; resolves to the newly assigned id. */
314
426
  create(input: CreateInput<F, Req>): Promise<number>;
315
427
  /** Update one record by id; resolves to that id. */
@@ -407,16 +519,44 @@ declare const FIELDS$7: {
407
519
  readonly P_Deleted: null;
408
520
  };
409
521
  declare const REQUIRED_ON_CREATE$3: readonly ["P_Owner", "P_Client", "P_Recruiter"];
522
+ declare const REFERENCES$2: {
523
+ readonly P_Client: {
524
+ readonly name: "Client";
525
+ readonly path: "client";
526
+ readonly prefix: "Client";
527
+ readonly fields: {
528
+ readonly P_Id: "System[Id]";
529
+ readonly P_Owner: "User";
530
+ readonly P_RegistrationDate: "System[DateTime]";
531
+ readonly P_RegisteredBy: "User";
532
+ readonly P_UpdateDate: "System[DateTime]";
533
+ readonly P_UpdatedBy: "User";
534
+ readonly P_Phase: "Option";
535
+ readonly P_PhaseDate: "DateTime";
536
+ readonly P_PhaseMemo: "MultilineText";
537
+ readonly P_Name: "SinglelineText";
538
+ readonly P_Memo: "MultilineText";
539
+ readonly P_Country: "SinglelineText";
540
+ readonly P_Prefecture: "SinglelineText";
541
+ readonly P_City: "SinglelineText";
542
+ readonly P_Street: "MultilineText";
543
+ readonly P_Zipcode: "SinglelineText";
544
+ readonly P_Telephone: "Telephone";
545
+ readonly P_Fax: "Telephone";
546
+ readonly P_Deleted: null;
547
+ };
548
+ };
549
+ };
410
550
  /** A decoded Job: known `P_` fields, each requested field `value | null`. */
411
551
  type Job = ReadRecord<typeof FIELDS$7>;
412
552
  type JobPage = ResourcePage<typeof FIELDS$7>;
413
- type JobSearchQuery = SearchQuery<typeof FIELDS$7>;
553
+ type JobSearchQuery = SearchQuery<typeof FIELDS$7, typeof REFERENCES$2>;
414
554
  /** Fields for `create`: `P_Owner` required; `P_Id` / system timestamps are not settable. */
415
555
  type JobCreateInput = CreateInput<typeof FIELDS$7, (typeof REQUIRED_ON_CREATE$3)[number]>;
416
556
  /** Fields for `update`: all optional (`null` omits, `""` clears a text field). */
417
557
  type JobUpdateInput = UpdateInput<typeof FIELDS$7>;
418
558
  /** The Job accessor; `C` is the declared custom-field catalog merged on (ADR-0023). */
419
- type JobResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$7 & C, (typeof REQUIRED_ON_CREATE$3)[number]>;
559
+ type JobResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$7 & C, (typeof REQUIRED_ON_CREATE$3)[number], typeof REFERENCES$2>;
420
560
 
421
561
  declare const FIELDS$6: {
422
562
  readonly P_Id: "System[Id]";
@@ -473,17 +613,215 @@ declare const FIELDS$5: {
473
613
  readonly P_Deleted: null;
474
614
  };
475
615
  declare const REQUIRED_ON_CREATE$1: readonly ["P_Owner", "P_Client", "P_Recruiter", "P_Job", "P_Candidate", "P_Resume"];
616
+ declare const REFERENCES$1: {
617
+ readonly P_Client: {
618
+ readonly name: "Client";
619
+ readonly path: "client";
620
+ readonly prefix: "Client";
621
+ readonly fields: {
622
+ readonly P_Id: "System[Id]";
623
+ readonly P_Owner: "User";
624
+ readonly P_RegistrationDate: "System[DateTime]";
625
+ readonly P_RegisteredBy: "User";
626
+ readonly P_UpdateDate: "System[DateTime]";
627
+ readonly P_UpdatedBy: "User";
628
+ readonly P_Phase: "Option";
629
+ readonly P_PhaseDate: "DateTime";
630
+ readonly P_PhaseMemo: "MultilineText";
631
+ readonly P_Name: "SinglelineText";
632
+ readonly P_Memo: "MultilineText";
633
+ readonly P_Country: "SinglelineText";
634
+ readonly P_Prefecture: "SinglelineText";
635
+ readonly P_City: "SinglelineText";
636
+ readonly P_Street: "MultilineText";
637
+ readonly P_Zipcode: "SinglelineText";
638
+ readonly P_Telephone: "Telephone";
639
+ readonly P_Fax: "Telephone";
640
+ readonly P_Deleted: null;
641
+ };
642
+ };
643
+ readonly P_Job: {
644
+ readonly name: "Job";
645
+ readonly path: "job";
646
+ readonly prefix: "Job";
647
+ readonly fields: {
648
+ readonly P_Id: "System[Id]";
649
+ readonly P_Owner: "User";
650
+ readonly P_Client: "System[Reference]";
651
+ readonly P_Recruiter: "System[Reference]";
652
+ readonly P_RegistrationDate: "System[DateTime]";
653
+ readonly P_RegisteredBy: "User";
654
+ readonly P_UpdateDate: "System[DateTime]";
655
+ readonly P_UpdatedBy: "User";
656
+ readonly P_Phase: "Option";
657
+ readonly P_PhaseDate: "DateTime";
658
+ readonly P_PhaseMemo: "MultilineText";
659
+ readonly P_Position: "SinglelineText";
660
+ readonly P_Publish: "Option";
661
+ readonly P_JobCategorySummary: "MultilineText";
662
+ readonly P_JobCategory: "Option";
663
+ readonly P_IndustrySummary: "MultilineText";
664
+ readonly P_Industry: "Option";
665
+ readonly P_SalarySummary: "MultilineText";
666
+ readonly P_MinSalary: "Number";
667
+ readonly P_MaxSalary: "Number";
668
+ readonly P_AreaSummary: "MultilineText";
669
+ readonly P_Area: "Option";
670
+ readonly P_PayrollsText: "SinglelineText";
671
+ readonly P_Memo: "MultilineText";
672
+ readonly P_EmploymentPeriod: "MultilineText";
673
+ readonly P_WokingHours: "MultilineText";
674
+ readonly P_Holidays: "MultilineText";
675
+ readonly P_Benefits: "MultilineText";
676
+ readonly P_PubliclyTraded: "Option";
677
+ readonly P_SalesAmountText: "SinglelineText";
678
+ readonly P_EstablishmentDateText: "SinglelineText";
679
+ readonly P_CapitalText: "SinglelineText";
680
+ readonly P_EmploymentType: "Option";
681
+ readonly P_ExpectedAgeReason: "Option";
682
+ readonly P_Deleted: null;
683
+ };
684
+ readonly references: {
685
+ readonly P_Client: {
686
+ readonly name: "Client";
687
+ readonly path: "client";
688
+ readonly prefix: "Client";
689
+ readonly fields: {
690
+ readonly P_Id: "System[Id]";
691
+ readonly P_Owner: "User";
692
+ readonly P_RegistrationDate: "System[DateTime]";
693
+ readonly P_RegisteredBy: "User";
694
+ readonly P_UpdateDate: "System[DateTime]";
695
+ readonly P_UpdatedBy: "User";
696
+ readonly P_Phase: "Option";
697
+ readonly P_PhaseDate: "DateTime";
698
+ readonly P_PhaseMemo: "MultilineText";
699
+ readonly P_Name: "SinglelineText";
700
+ readonly P_Memo: "MultilineText";
701
+ readonly P_Country: "SinglelineText";
702
+ readonly P_Prefecture: "SinglelineText";
703
+ readonly P_City: "SinglelineText";
704
+ readonly P_Street: "MultilineText";
705
+ readonly P_Zipcode: "SinglelineText";
706
+ readonly P_Telephone: "Telephone";
707
+ readonly P_Fax: "Telephone";
708
+ readonly P_Deleted: null;
709
+ };
710
+ };
711
+ };
712
+ };
713
+ readonly P_Candidate: {
714
+ readonly name: "Candidate";
715
+ readonly path: "candidate";
716
+ readonly prefix: "Person";
717
+ readonly fields: {
718
+ readonly P_Id: "System[Id]";
719
+ readonly P_Owner: "User";
720
+ readonly P_RegistrationDate: "System[DateTime]";
721
+ readonly P_RegisteredBy: "User";
722
+ readonly P_UpdateDate: "System[DateTime]";
723
+ readonly P_UpdatedBy: "User";
724
+ readonly P_Phase: "Option";
725
+ readonly P_PhaseDate: "DateTime";
726
+ readonly P_PhaseMemo: "MultilineText";
727
+ readonly P_Name: "SinglelineText";
728
+ readonly P_Reading: "SinglelineText";
729
+ readonly P_Memo: "MultilineText";
730
+ readonly P_Mail: "Mail";
731
+ readonly P_MobileMail: "Mail";
732
+ readonly P_Telephone: "Telephone";
733
+ readonly P_Mobile: "Telephone";
734
+ readonly P_Fax: "Telephone";
735
+ readonly P_Country: "SinglelineText";
736
+ readonly P_Prefecture: "SinglelineText";
737
+ readonly P_City: "SinglelineText";
738
+ readonly P_Street: "MultilineText";
739
+ readonly P_Zipcode: "SinglelineText";
740
+ readonly P_Deleted: null;
741
+ };
742
+ };
743
+ readonly P_Resume: {
744
+ readonly name: "Resume";
745
+ readonly path: "resume";
746
+ readonly prefix: "Resume";
747
+ readonly fields: {
748
+ readonly P_Id: "System[Id]";
749
+ readonly P_Owner: "User";
750
+ readonly P_Candidate: "System[Reference]";
751
+ readonly P_RegistrationDate: "System[DateTime]";
752
+ readonly P_RegisteredBy: "User";
753
+ readonly P_UpdateDate: "System[DateTime]";
754
+ readonly P_UpdatedBy: "User";
755
+ readonly P_Phase: "Option";
756
+ readonly P_PhaseDate: "DateTime";
757
+ readonly P_PhaseMemo: "MultilineText";
758
+ readonly P_Name: "SinglelineText";
759
+ readonly P_RegisterChannel: "Option";
760
+ readonly P_Memo: "MultilineText";
761
+ readonly P_CurrentStatus: "Option";
762
+ readonly P_Education: "MultilineText";
763
+ readonly P_CarrierSummary: "MultilineText";
764
+ readonly P_CurrentSalary: "Number";
765
+ readonly P_ExperiencedJobCategory: "Option";
766
+ readonly P_ExperiencedIndustry: "Option";
767
+ readonly P_ChangeJobsCount: "Number";
768
+ readonly P_Gender: "Option";
769
+ readonly P_DateOfBirth: "Age";
770
+ readonly P_ExpectEmploymentType: "Option";
771
+ readonly P_ExpectArea: "Option";
772
+ readonly P_ExpectJobCategory: "Option";
773
+ readonly P_ExpectIndustry: "Option";
774
+ readonly P_ExpectCondition: "MultilineText";
775
+ readonly P_ExpectSalary: "Number";
776
+ readonly P_DesiredHourlyRate: "Number";
777
+ readonly P_HourlyRate: "Number";
778
+ readonly P_Deleted: null;
779
+ };
780
+ readonly references: {
781
+ readonly P_Candidate: {
782
+ readonly name: "Candidate";
783
+ readonly path: "candidate";
784
+ readonly prefix: "Person";
785
+ readonly fields: {
786
+ readonly P_Id: "System[Id]";
787
+ readonly P_Owner: "User";
788
+ readonly P_RegistrationDate: "System[DateTime]";
789
+ readonly P_RegisteredBy: "User";
790
+ readonly P_UpdateDate: "System[DateTime]";
791
+ readonly P_UpdatedBy: "User";
792
+ readonly P_Phase: "Option";
793
+ readonly P_PhaseDate: "DateTime";
794
+ readonly P_PhaseMemo: "MultilineText";
795
+ readonly P_Name: "SinglelineText";
796
+ readonly P_Reading: "SinglelineText";
797
+ readonly P_Memo: "MultilineText";
798
+ readonly P_Mail: "Mail";
799
+ readonly P_MobileMail: "Mail";
800
+ readonly P_Telephone: "Telephone";
801
+ readonly P_Mobile: "Telephone";
802
+ readonly P_Fax: "Telephone";
803
+ readonly P_Country: "SinglelineText";
804
+ readonly P_Prefecture: "SinglelineText";
805
+ readonly P_City: "SinglelineText";
806
+ readonly P_Street: "MultilineText";
807
+ readonly P_Zipcode: "SinglelineText";
808
+ readonly P_Deleted: null;
809
+ };
810
+ };
811
+ };
812
+ };
813
+ };
476
814
  /** A decoded Process (a Candidate's progress through a Job): known `P_` fields, each
477
815
  * requested field `value | null`. */
478
816
  type Process = ReadRecord<typeof FIELDS$5>;
479
817
  type ProcessPage = ResourcePage<typeof FIELDS$5>;
480
- type ProcessSearchQuery = SearchQuery<typeof FIELDS$5>;
818
+ type ProcessSearchQuery = SearchQuery<typeof FIELDS$5, typeof REFERENCES$1>;
481
819
  /** Fields for `create`: `P_Owner` required; `P_Id` / system timestamps are not settable. */
482
820
  type ProcessCreateInput = CreateInput<typeof FIELDS$5, (typeof REQUIRED_ON_CREATE$1)[number]>;
483
821
  /** Fields for `update`: all optional (`null` omits, `""` clears a text field). */
484
822
  type ProcessUpdateInput = UpdateInput<typeof FIELDS$5>;
485
823
  /** The Process accessor; `C` is the declared custom-field catalog merged on (ADR-0023). */
486
- type ProcessResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$5 & C, (typeof REQUIRED_ON_CREATE$1)[number]>;
824
+ type ProcessResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$5 & C, (typeof REQUIRED_ON_CREATE$1)[number], typeof REFERENCES$1>;
487
825
 
488
826
  declare const FIELDS$4: {
489
827
  readonly P_Id: "System[Id]";
@@ -519,17 +857,49 @@ declare const FIELDS$4: {
519
857
  readonly P_Deleted: null;
520
858
  };
521
859
  declare const REQUIRED_ON_CREATE: readonly ["P_Owner", "P_Candidate"];
860
+ declare const REFERENCES: {
861
+ readonly P_Candidate: {
862
+ readonly name: "Candidate";
863
+ readonly path: "candidate";
864
+ readonly prefix: "Person";
865
+ readonly fields: {
866
+ readonly P_Id: "System[Id]";
867
+ readonly P_Owner: "User";
868
+ readonly P_RegistrationDate: "System[DateTime]";
869
+ readonly P_RegisteredBy: "User";
870
+ readonly P_UpdateDate: "System[DateTime]";
871
+ readonly P_UpdatedBy: "User";
872
+ readonly P_Phase: "Option";
873
+ readonly P_PhaseDate: "DateTime";
874
+ readonly P_PhaseMemo: "MultilineText";
875
+ readonly P_Name: "SinglelineText";
876
+ readonly P_Reading: "SinglelineText";
877
+ readonly P_Memo: "MultilineText";
878
+ readonly P_Mail: "Mail";
879
+ readonly P_MobileMail: "Mail";
880
+ readonly P_Telephone: "Telephone";
881
+ readonly P_Mobile: "Telephone";
882
+ readonly P_Fax: "Telephone";
883
+ readonly P_Country: "SinglelineText";
884
+ readonly P_Prefecture: "SinglelineText";
885
+ readonly P_City: "SinglelineText";
886
+ readonly P_Street: "MultilineText";
887
+ readonly P_Zipcode: "SinglelineText";
888
+ readonly P_Deleted: null;
889
+ };
890
+ };
891
+ };
522
892
  /** A decoded Resume (a Candidate's CV / profile): known `P_` fields, each requested field
523
893
  * `value | null`. */
524
894
  type Resume = ReadRecord<typeof FIELDS$4>;
525
895
  type ResumePage = ResourcePage<typeof FIELDS$4>;
526
- type ResumeSearchQuery = SearchQuery<typeof FIELDS$4>;
896
+ type ResumeSearchQuery = SearchQuery<typeof FIELDS$4, typeof REFERENCES>;
527
897
  /** Fields for `create`: `P_Owner` required; `P_Id` / system timestamps are not settable. */
528
898
  type ResumeCreateInput = CreateInput<typeof FIELDS$4, (typeof REQUIRED_ON_CREATE)[number]>;
529
899
  /** Fields for `update`: all optional (`null` omits, `""` clears a text field). */
530
900
  type ResumeUpdateInput = UpdateInput<typeof FIELDS$4>;
531
901
  /** The Resume accessor; `C` is the declared custom-field catalog merged on (ADR-0023). */
532
- type ResumeResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$4 & C, (typeof REQUIRED_ON_CREATE)[number]>;
902
+ type ResumeResource<C extends FieldCatalog = EmptyCatalog> = Resource<typeof FIELDS$4 & C, (typeof REQUIRED_ON_CREATE)[number], typeof REFERENCES>;
533
903
 
534
904
  /** A decoded Attachment. A field is `null` unless it was returned (see `field`). */
535
905
  type Attachment = {
@@ -620,8 +990,11 @@ type UserSearchQuery = {
620
990
  requestType?: 0 | 1;
621
991
  /** -1 = any (default), 0 = system admins, 1 = standard users. */
622
992
  userType?: -1 | 0 | 1;
623
- /** Output fields (prefixed aliases). Omit to get the 4 core fields (this catalog). */
624
- field?: string[];
993
+ /**
994
+ * Output fields as **bare aliases** (`P_Name`); the library adds the `User.` prefix (ADR-0059).
995
+ * Omit to get the 4 core fields (this catalog).
996
+ */
997
+ field?: ReadFieldAlias<typeof FIELDS$2>[];
625
998
  count?: number;
626
999
  start?: number;
627
1000
  };
@@ -920,4 +1293,4 @@ declare const bytesToBase64: (bytes: Uint8Array) => string;
920
1293
  /** Decode a Base64 string back to raw bytes. */
921
1294
  declare const base64ToBytes: (b64: string) => Uint8Array;
922
1295
 
923
- export { type Attachment, type AttachmentCreate, type AttachmentPage, type AttachmentResource, type AttachmentSearchQuery, type AttachmentUpdate, type AuthApi, type AuthorizationUrlOptions, type BulkWriteResult, type BulkWriteResultItem, type Candidate, type CandidateCreateInput, type CandidatePage, type CandidateResource, type CandidateSearchQuery, type CandidateUpdateInput, type Client, type ClientCreateInput, type ClientPage, type ClientResource, type ClientSearchQuery, type ClientUpdateInput, type Condition, type CustomDataType, type CustomFieldResource, type CustomFor, type DeclaredCatalogs, type DefinedFields, type ErrorCategory, type Field, type FieldBuilder, type FieldDecls, type FieldDef, type FieldPage, type FieldResource, type FieldSearchQuery, type FieldValue, type GetAccessTokenOptions, type ItemState, type Job, type JobCreateInput, type JobPage, type JobResource, type JobSearchQuery, type JobUpdateInput, type MockHandler, type MockReply, type MockTransportOptions, type Option, type OptionResource, type OptionSearchQuery, type Order, type Partition, type PartitionId, type PartitionPage, type PartitionResource, type PartitionSearchQuery, PortersAuthError, PortersClient, type PortersClientOptions, PortersConfigError, PortersError, type PortersErrorContext, type PortersErrorOptions, PortersNetworkError, PortersResourceError, type Process, type ProcessCreateInput, type ProcessPage, type ProcessResource, type ProcessSearchQuery, type ProcessUpdateInput, type ResourceType, type Resume, type ResumeCreateInput, type ResumePage, type ResumeResource, type ResumeSearchQuery, type ResumeUpdateInput, type RevokeUrlOptions, type Scheme, type Scope, type SearchQuery, type StoredTokens, type TenantScope, type TokenProvider, type TokenStore, type Transport, type TransportRequest, type TransportResponse, type User, type UserPage, type UserRef, type UserResource, type UserSearchQuery, base64ToBytes, bytesToBase64, createMockTransport, defineFields };
1296
+ export { type Attachment, type AttachmentCreate, type AttachmentPage, type AttachmentResource, type AttachmentSearchQuery, type AttachmentUpdate, type AuthApi, type AuthorizationUrlOptions, type BulkWriteResult, type BulkWriteResultItem, type Candidate, type CandidateCreateInput, type CandidatePage, type CandidateResource, type CandidateSearchQuery, type CandidateUpdateInput, type Client, type ClientCreateInput, type ClientPage, type ClientResource, type ClientSearchQuery, type ClientUpdateInput, type Condition, type CustomDataType, type CustomFieldResource, type CustomFor, type DeclaredCatalogs, type DefinedFields, type ErrorCategory, type Expand, type ExpandedReadRecord, type Field, type FieldBuilder, type FieldDecls, type FieldDef, type FieldPage, type FieldResource, type FieldSearchQuery, type FieldValue, type GetAccessTokenOptions, type ItemState, type Job, type JobCreateInput, type JobPage, type JobResource, type JobSearchQuery, type JobUpdateInput, type MockHandler, type MockReply, type MockTransportOptions, type Option, type OptionResource, type OptionSearchQuery, type Order, type Partition, type PartitionId, type PartitionPage, type PartitionResource, type PartitionSearchQuery, PortersAuthError, PortersClient, type PortersClientOptions, PortersConfigError, PortersError, type PortersErrorContext, type PortersErrorOptions, PortersNetworkError, PortersResourceError, type Process, type ProcessCreateInput, type ProcessPage, type ProcessResource, type ProcessSearchQuery, type ProcessUpdateInput, type ReadFieldAlias, type ReferenceMap, type ReferenceRecord, type ResourcePageOf, type ResourceType, type Resume, type ResumeCreateInput, type ResumePage, type ResumeResource, type ResumeSearchQuery, type ResumeUpdateInput, type RevokeUrlOptions, type Scheme, type Scope, type SearchQuery, type StoredTokens, type TenantScope, type TokenProvider, type TokenStore, type Transport, type TransportRequest, type TransportResponse, type User, type UserPage, type UserRef, type UserResource, type UserSearchQuery, base64ToBytes, bytesToBase64, createMockTransport, defineFields };