@takuhon/core 0.25.0 → 1.0.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  var $schema = "https://json-schema.org/draft/2020-12/schema";
2
- var $id = "https://takuhon.example/schemas/0.7.0/takuhon.schema.json";
2
+ var $id = "https://takuhon.example/schemas/1.0.0/takuhon.schema.json";
3
3
  var title = "Takuhon Profile";
4
4
  var description = "Portable profile data format consumed by @takuhon/core. The canonical contract for profile content authored as takuhon.json.";
5
5
  var type = "object";
@@ -7,10 +7,6 @@ var additionalProperties = false;
7
7
  var required = [
8
8
  "schemaVersion",
9
9
  "profile",
10
- "links",
11
- "careers",
12
- "projects",
13
- "skills",
14
10
  "contact",
15
11
  "settings",
16
12
  "meta"
@@ -197,9 +193,10 @@ var $defs = {
197
193
  additionalProperties: {
198
194
  type: "string",
199
195
  minLength: 1,
200
- maxLength: 200
196
+ maxLength: 200,
197
+ pattern: "\\S"
201
198
  },
202
- description: "Map of BCP-47 locale tag to short title-like string (max 200 chars per value)."
199
+ description: "Map of BCP-47 locale tag to short title-like string (max 200 chars per value). Each value must contain at least one non-whitespace character."
203
200
  },
204
201
  LocalizedBody: {
205
202
  type: "object",
@@ -211,9 +208,10 @@ var $defs = {
211
208
  additionalProperties: {
212
209
  type: "string",
213
210
  minLength: 1,
214
- maxLength: 5000
211
+ maxLength: 5000,
212
+ pattern: "\\S"
215
213
  },
216
- description: "Map of BCP-47 locale tag to body-length string (max 5000 chars per value)."
214
+ description: "Map of BCP-47 locale tag to body-length string (max 5000 chars per value). Each value must contain at least one non-whitespace character."
217
215
  },
218
216
  LinkType: {
219
217
  type: "string",
@@ -238,7 +236,7 @@ var $defs = {
238
236
  },
239
237
  Profile: {
240
238
  type: "object",
241
- additionalProperties: true,
239
+ additionalProperties: false,
242
240
  required: [
243
241
  "displayName"
244
242
  ],
@@ -262,7 +260,7 @@ var $defs = {
262
260
  },
263
261
  Avatar: {
264
262
  type: "object",
265
- additionalProperties: true,
263
+ additionalProperties: false,
266
264
  required: [
267
265
  "url"
268
266
  ],
@@ -280,7 +278,7 @@ var $defs = {
280
278
  },
281
279
  Address: {
282
280
  type: "object",
283
- additionalProperties: true,
281
+ additionalProperties: false,
284
282
  properties: {
285
283
  country: {
286
284
  $ref: "#/$defs/Iso3166Alpha2"
@@ -359,7 +357,7 @@ var $defs = {
359
357
  },
360
358
  Career: {
361
359
  type: "object",
362
- additionalProperties: true,
360
+ additionalProperties: false,
363
361
  required: [
364
362
  "id",
365
363
  "organization",
@@ -412,7 +410,7 @@ var $defs = {
412
410
  },
413
411
  Project: {
414
412
  type: "object",
415
- additionalProperties: true,
413
+ additionalProperties: false,
416
414
  required: [
417
415
  "id",
418
416
  "title"
@@ -469,7 +467,7 @@ var $defs = {
469
467
  },
470
468
  Skill: {
471
469
  type: "object",
472
- additionalProperties: true,
470
+ additionalProperties: false,
473
471
  required: [
474
472
  "id",
475
473
  "label"
@@ -500,7 +498,7 @@ var $defs = {
500
498
  },
501
499
  Contact: {
502
500
  type: "object",
503
- additionalProperties: true,
501
+ additionalProperties: false,
504
502
  properties: {
505
503
  email: {
506
504
  $ref: "#/$defs/Email"
@@ -516,7 +514,7 @@ var $defs = {
516
514
  },
517
515
  Settings: {
518
516
  type: "object",
519
- additionalProperties: true,
517
+ additionalProperties: false,
520
518
  required: [
521
519
  "defaultLocale",
522
520
  "availableLocales"
@@ -709,7 +707,7 @@ var $defs = {
709
707
  },
710
708
  Meta: {
711
709
  type: "object",
712
- additionalProperties: true,
710
+ additionalProperties: false,
713
711
  required: [
714
712
  "contentLicense"
715
713
  ],
@@ -774,7 +772,7 @@ var $defs = {
774
772
  },
775
773
  MetaPrivacy: {
776
774
  type: "object",
777
- additionalProperties: true,
775
+ additionalProperties: false,
778
776
  description: "Opt-out flags that strip personally identifying fields from public API output (GET /api/profile, /api/jsonld, /takuhon.json). Admin endpoints (PUT /api/admin/*, GET /api/admin/export) ignore these flags. Privacy-by-default: omitting the object or individual flags is equivalent to true.",
779
777
  properties: {
780
778
  hideCredentialIds: {
@@ -791,7 +789,7 @@ var $defs = {
791
789
  },
792
790
  Certification: {
793
791
  type: "object",
794
- additionalProperties: true,
792
+ additionalProperties: false,
795
793
  required: [
796
794
  "id",
797
795
  "title",
@@ -842,7 +840,7 @@ var $defs = {
842
840
  },
843
841
  Membership: {
844
842
  type: "object",
845
- additionalProperties: true,
843
+ additionalProperties: false,
846
844
  required: [
847
845
  "id",
848
846
  "organization",
@@ -892,7 +890,7 @@ var $defs = {
892
890
  },
893
891
  Volunteering: {
894
892
  type: "object",
895
- additionalProperties: true,
893
+ additionalProperties: false,
896
894
  required: [
897
895
  "id",
898
896
  "organization",
@@ -945,7 +943,7 @@ var $defs = {
945
943
  },
946
944
  Honor: {
947
945
  type: "object",
948
- additionalProperties: true,
946
+ additionalProperties: false,
949
947
  required: [
950
948
  "id",
951
949
  "title",
@@ -982,7 +980,7 @@ var $defs = {
982
980
  },
983
981
  Education: {
984
982
  type: "object",
985
- additionalProperties: true,
983
+ additionalProperties: false,
986
984
  required: [
987
985
  "id",
988
986
  "institution",
@@ -1041,7 +1039,7 @@ var $defs = {
1041
1039
  },
1042
1040
  Publication: {
1043
1041
  type: "object",
1044
- additionalProperties: true,
1042
+ additionalProperties: false,
1045
1043
  required: [
1046
1044
  "id",
1047
1045
  "title",
@@ -1093,7 +1091,7 @@ var $defs = {
1093
1091
  },
1094
1092
  Language: {
1095
1093
  type: "object",
1096
- additionalProperties: true,
1094
+ additionalProperties: false,
1097
1095
  required: [
1098
1096
  "id",
1099
1097
  "language",
@@ -1131,7 +1129,7 @@ var $defs = {
1131
1129
  },
1132
1130
  Course: {
1133
1131
  type: "object",
1134
- additionalProperties: true,
1132
+ additionalProperties: false,
1135
1133
  required: [
1136
1134
  "id",
1137
1135
  "title"
@@ -1175,7 +1173,7 @@ var $defs = {
1175
1173
  },
1176
1174
  Patent: {
1177
1175
  type: "object",
1178
- additionalProperties: true,
1176
+ additionalProperties: false,
1179
1177
  required: [
1180
1178
  "id",
1181
1179
  "title",
@@ -1240,7 +1238,7 @@ var $defs = {
1240
1238
  },
1241
1239
  TestScore: {
1242
1240
  type: "object",
1243
- additionalProperties: true,
1241
+ additionalProperties: false,
1244
1242
  required: [
1245
1243
  "id",
1246
1244
  "title",
@@ -1284,7 +1282,7 @@ var $defs = {
1284
1282
  },
1285
1283
  Recommendation: {
1286
1284
  type: "object",
1287
- additionalProperties: true,
1285
+ additionalProperties: false,
1288
1286
  required: [
1289
1287
  "id",
1290
1288
  "body",
@@ -1326,7 +1324,7 @@ var $defs = {
1326
1324
  },
1327
1325
  RecommendationAuthor: {
1328
1326
  type: "object",
1329
- additionalProperties: true,
1327
+ additionalProperties: false,
1330
1328
  required: [
1331
1329
  "name"
1332
1330
  ],
@@ -1557,6 +1555,7 @@ declare const schema: {
1557
1555
  type: string;
1558
1556
  minLength: number;
1559
1557
  maxLength: number;
1558
+ pattern: string;
1560
1559
  };
1561
1560
  description: string;
1562
1561
  };
@@ -1571,6 +1570,7 @@ declare const schema: {
1571
1570
  type: string;
1572
1571
  minLength: number;
1573
1572
  maxLength: number;
1573
+ pattern: string;
1574
1574
  };
1575
1575
  description: string;
1576
1576
  };
@@ -2596,8 +2596,8 @@ type Schema = typeof schemaJson;
2596
2596
  *
2597
2597
  * These mirror the canonical contract defined in `takuhon.schema.json`. The
2598
2598
  * published shape is sanity-checked at commit 1 by `__tests__/schema.test.ts`
2599
- * (top-level keys, `$defs`, required fields, hybrid `additionalProperties`
2600
- * splits, Spec §6 invariants) and by `__tests__/example.test.ts` (the bundled
2599
+ * (top-level keys, `$defs`, required fields, the closed `additionalProperties`
2600
+ * contract, Spec §6 invariants) and by `__tests__/example.test.ts` (the bundled
2601
2601
  * fixture is assigned to `Takuhon` via a boundary cast, and per-Spec invariants
2602
2602
  * are asserted at runtime). Those tests catch the kind of drift that changes
2603
2603
  * the published shape, but they do not enforce field-by-field parity between
@@ -2607,27 +2607,31 @@ type Schema = typeof schemaJson;
2607
2607
  * When the schema changes, update these types accordingly and add a migration
2608
2608
  * entry under `src/migrations/` for the next minor version.
2609
2609
  *
2610
- * Public surface scope (hybrid `additionalProperties` strategy):
2610
+ * `additionalProperties` policy (schema 1.0.0 — precise contract):
2611
2611
  *
2612
- * - **Closed** in the schema (no forward-compatible extras): the document
2613
- * root, `ContentLicense`, and every `Link` variant.
2614
- * - **Open** in the schema (`additionalProperties: true`): `Profile`,
2615
- * `Settings`, `Meta`, `Career`, `Project`, `Skill`, `Contact`, `Avatar`,
2616
- * `Address`, and the locale-keyed map shapes `LocalizedTitle` /
2617
- * `LocalizedBody`.
2612
+ * Every object in the contract is **closed** (`additionalProperties: false`):
2613
+ * the document root, `ContentLicense`, every `Link` variant, `PublicVisibility`,
2614
+ * `ActivitySettings`, and reversing the pre-1.0 hybrid strategy — every
2615
+ * content entity (`Profile`, `Career`, `Project`, `Skill`, `Education`, …)
2616
+ * plus `Settings`, `Meta`, and `MetaPrivacy`. An undeclared property (a
2617
+ * misspelled `tittle`) is therefore a validation error rather than silently
2618
+ * dropped data. The only intentionally open shapes are the locale-keyed maps
2619
+ * `LocalizedTitle` / `LocalizedBody`, whose keys are arbitrary BCP-47 tags
2620
+ * constrained by `propertyNames` with the value schema bounding each entry.
2618
2621
  *
2619
- * The public TypeScript surface intentionally omits an `[key: string]: unknown`
2620
- * index signature on the open containers. Declared properties stay accurately
2621
- * typed regardless of the choice what such a signature would change is
2622
- * access to *undeclared* keys: it would let consumers spell arbitrary property
2623
- * names without an error and force `unknown` narrowing for those reads, and it
2624
- * would dilute IDE autocomplete on every dotted access. Keeping the types
2625
- * focused on the canonical members preserves that ergonomics. Consumers that
2626
- * need to attach custom fields should extend the relevant interface locally:
2622
+ * This is the canonical "precise contract" stance: the schema fully defines the
2623
+ * accepted shape, so the JSON-LD and MCP surfaces that AI agents and search
2624
+ * engines read are trustworthy. The closure is deliberate and, for the 1.x
2625
+ * line, treated as irreversible-by-default a future minor can re-open
2626
+ * extension space *non-breakingly* via `patternProperties: { "^x-": {} }` (the
2627
+ * OpenAPI `x-` convention) should adopter demand appear, without ever loosening
2628
+ * the contract retroactively.
2627
2629
  *
2628
- * interface MyProfile extends Profile {
2629
- * customField: string;
2630
- * }
2630
+ * The public TypeScript surface therefore omits any `[key: string]: unknown`
2631
+ * index signature: declared properties stay accurately typed and IDE
2632
+ * autocomplete is not diluted. Consumers that need to carry their own data
2633
+ * alongside a profile should keep it in a sibling structure rather than
2634
+ * smuggling undeclared keys into the contract — schema 1.0.0 now rejects them.
2631
2635
  */
2632
2636
  /** BCP-47 language tag, e.g. 'en', 'ja', 'zh-Hant', 'pt-BR'. */
2633
2637
  type LocaleTag = string;
@@ -3322,7 +3326,7 @@ interface LocalizedTakuhon {
3322
3326
  * versions whose JSON Schema this package literally bundles, not the full
3323
3327
  * support window seen by end users.
3324
3328
  */
3325
- declare const SUPPORTED_SCHEMA_VERSIONS: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0"];
3329
+ declare const SUPPORTED_SCHEMA_VERSIONS: readonly ["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0", "0.7.0", "1.0.0"];
3326
3330
  /**
3327
3331
  * A single validation failure.
3328
3332
  *
@@ -4452,6 +4456,6 @@ declare function stripImageMetadata(bytes: Uint8Array, mime: AcceptedImageMime):
4452
4456
  * A takuhon profile document's `schemaVersion` field must be migrate-compatible
4453
4457
  * with this version. See operational-lifecycle docs for the migration policy.
4454
4458
  */
4455
- declare const SCHEMA_VERSION = "0.7.0";
4459
+ declare const SCHEMA_VERSION = "1.0.0";
4456
4460
 
4457
4461
  export { ACCEPTED_IMAGE_MIME_TYPES, type AcceptedImageMime, type ActivitySettings, type ActivitySnapshot, type ActivityStorage, type Address, type AssetOptions, type AssetRecord, type Avatar, type Career, type Certification, type CodingTime, ConflictError, type Contact, type ContentLicense, type ContentLicenseAttribution, type ContributionCalendar, type ContributionDay, type Course, type CvDocument, type CvHeader, type CvSection, type CvSectionKind, DARK_PALETTE, type Education, type ExportOptions, type ExportedTakuhon, type GravatarOptions, type Honor, IMAGE_EXTENSIONS, type ImageInfo, ImportError, type Iso3166Alpha2, type IsoDateTime, LIGHT_PALETTE, type Language, type LanguageBreakdown, type LanguageProficiency, type Link, type LinkBuiltin, type LinkCustom, type LinkType, type LocaleTag, type LocalizedAddress, type LocalizedAvatar, type LocalizedBody, type LocalizedCareer, type LocalizedCertification, type LocalizedCourse, type LocalizedEducation, type LocalizedHonor, type LocalizedLanguage, type LocalizedLink, type LocalizedLinkBuiltin, type LocalizedLinkCustom, type LocalizedMembership, type LocalizedPatent, type LocalizedProfile, type LocalizedProject, type LocalizedPublication, type LocalizedRecommendation, type LocalizedRecommendationAuthor, type LocalizedTakuhon, type LocalizedTestScore, type LocalizedTitle, type LocalizedVolunteering, MAX_IMAGE_BYTES, MAX_IMAGE_DIMENSION, MAX_IMAGE_FRAMES, MCP_PROFILE_SECTIONS, MCP_RESOURCES, MCP_TOOLS, type McpInputSchema, type McpProfileSection, McpRequestError, type McpResourceDefinition, type McpResourceResult, type McpToolDefinition, type McpToolResult, type Membership, type Meta, type MetaPrivacy, type Migration, MigrationError, type NormalizedTakuhon, NotFoundError, type Palette, type Patent, type PatentStatus, type Profile, type Project, type PublicVisibility, type Publication, RANK_FULL_CODING_HOURS, RANK_FULL_CONTRIBUTIONS, RANK_TIER_THRESHOLDS, type RankInput, type RankTier, type RankTierLabel, type Recommendation, type RecommendationAuthor, type RenderActivitySvgOptions, SCHEMA_VERSION, SUPPORTED_SCHEMA_VERSIONS, type Schema, type Settings, type Skill, type Slug, StorageError, type Takuhon, type TakuhonAssetStorage, type TakuhonStorage, type TestScore, type ValidationError, type ValidationResult, type Volunteering, type YearMonth, applyPublicPrivacyFilter, computeLanguagePercentages, deriveCv, deriveRankTier, detectImageMime, executeMcpTool, exportTakuhon, formatCodingTime, formatDate, generateJsonLd, generatePersonJsonLd, generateProfilePageJsonLd, getPresentLabel, gravatarUrl, importTakuhon, isActivitySnapshot, migrateTakuhon, migrations, normalize, readImageInfo, readMcpResource, renderActivitySvg, resolveLocale, schema, stripImageMetadata, validate };