@alneas/business-jp API Reference
@alneas/business-jp API Reference
Section titled “@alneas/business-jp API Reference”FUNCTION legalDocument
Section titled “FUNCTION legalDocument”Exported symbol legalDocument
export const legalDocumentFUNCTION notifications
Section titled “FUNCTION notifications”Exported symbol notifications
export const notificationsFUNCTION resolveSealLabel
Section titled “FUNCTION resolveSealLabel”Resolves the label (typically family name) to display on a fallback seal.
Priority order:
options.sealLabeloptions.familyNamefullNameparsing (applyingnameOrderrule)
When nameOrder: "auto":
- Names containing CJK characters: use first token
- 2 or more Latin words: use last token
- Otherwise: use first token
export function resolveSealLabel(fullName?: string, options: SealLabelOptions =Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
fullName |
`string | undefined` | Optional |
options |
SealLabelOptions |
Optional | Label resolution options |
Returns
Section titled “Returns”- Type:
string - Description: Stamp label (
""if empty)
Example
Section titled “Example”```tsresolveSealLabel("山田 太郎") // => "山田"resolveSealLabel("John Smith") // => "Smith"resolveSealLabel("TANAKA", { maxChars: 2 }) // => "TA"---
### `FUNCTION` `createFallbackSealSvg`
Generates an SVG string for a fallback stamp seal.
Can be used as a fallback when no saved stamp image is available.Output is a simple red circular seal with vertically stacked characters.
```typescriptexport function createFallbackSealSvg( fullName?: string, options: FallbackSealOptions =Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
fullName |
`string | undefined` | Optional |
options |
FallbackSealOptions |
Optional | Generation options |
Returns
Section titled “Returns”- Type:
string | null - Description: SVG string, or
nullif the seal face label cannot be resolved
Example
Section titled “Example”```tsconst svg = createFallbackSealSvg("山田 太郎");---
### `FUNCTION` `createFallbackSealPngDataUrl`
Generates a PNG Data URL for a fallback stamp seal.Returns `null` in environments where the Canvas API is unavailable.
```typescriptexport function createFallbackSealPngDataUrl( fullName?: string, options: FallbackSealOptions =Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
fullName |
`string | undefined` | Optional |
options |
FallbackSealOptions |
Optional | Generation options |
Returns
Section titled “Returns”- Type:
string | null - Description: PNG Data URL, or
nullif generation fails
FUNCTION createFallbackSealDataUrl
Section titled “FUNCTION createFallbackSealDataUrl”Generates a Data URL for a fallback stamp seal.
Behavior of outputFormat:
auto(default): PNG when Canvas is available, otherwise SVGpng: PNG only (nullif Canvas is unavailable)svg: SVG only
export function createFallbackSealDataUrl( fullName?: string, options: FallbackSealOptions =Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
fullName |
`string | undefined` | Optional |
options |
FallbackSealOptions |
Optional | Generation options |
Returns
Section titled “Returns”- Type:
string | null - Description: Data URL, or
nullif the seal face label cannot be resolved
Example
Section titled “Example”```tsconst dataUrl = createFallbackSealDataUrl("John Smith", { nameOrder: "given-first" });---
### `TYPE` `SealNameOrder`
Type `SealNameOrder`
```typescripttype SealNameOrderINTERFACE SealLabelOptions
Section titled “INTERFACE SealLabelOptions”Options for determining the stamp label (text on the seal face).
interface SealLabelOptionsINTERFACE FallbackSealOptions
Section titled “INTERFACE FallbackSealOptions”Options for generating fallback seal SVG or Data URL.
interface FallbackSealOptionsFUNCTION parseLegalDocument
Section titled “FUNCTION parseLegalDocument”Parses Japanese legal documents formatted in Markdown and returns structured data.
export function parseLegalDocument(markdown: string): ParsedDocumentParameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
markdown |
string |
Yes |
Returns
Section titled “Returns”- Type:
ParsedDocument
FUNCTION buildLegalDocumentPdfmakeContent
Section titled “FUNCTION buildLegalDocumentPdfmakeContent”Builds pdfmake document definition content from a ParsedDocument.
export function buildLegalDocumentPdfmakeContent( parsed: ParsedDocument,)Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
parsed |
ParsedDocument |
Yes |
Returns
Section titled “Returns”- Type:
{ content: any[]; styles: { docTitle: { fontSize: number; bold: boolean; alignment: string; }; docReference: { fontSize: number; }; articleHeader: { fontSize: number; bold: boolean; }; signatureRole: { fontSize: number; bold: boolean; margin: number[]; }; signatureText: { fontSize: number; }; }; pageSize: "A4"; pageMargins: [number, number, number, number]; defaultStyle: { fontSize: number; lineHeight: number; }; }
TYPE PartyType
Section titled “TYPE PartyType”Type PartyType
type PartyType