@api-client/core 0.17.4 → 0.17.5
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/build/src/modeling/Semantics.d.ts +1 -1
- package/build/src/modeling/Semantics.d.ts.map +1 -1
- package/build/src/modeling/Semantics.js +6 -6
- package/build/src/modeling/Semantics.js.map +1 -1
- package/build/src/modeling/definitions/{Price.d.ts → Currency.d.ts} +24 -24
- package/build/src/modeling/definitions/Currency.d.ts.map +1 -0
- package/build/src/modeling/definitions/{Price.js → Currency.js} +18 -18
- package/build/src/modeling/definitions/Currency.js.map +1 -0
- package/build/src/modeling/definitions/HTML.d.ts +17 -4
- package/build/src/modeling/definitions/HTML.d.ts.map +1 -1
- package/build/src/modeling/definitions/HTML.js +0 -1
- package/build/src/modeling/definitions/HTML.js.map +1 -1
- package/build/src/modeling/definitions/Markdown.d.ts +12 -4
- package/build/src/modeling/definitions/Markdown.d.ts.map +1 -1
- package/build/src/modeling/definitions/Markdown.js +0 -1
- package/build/src/modeling/definitions/Markdown.js.map +1 -1
- package/build/src/modeling/definitions/Status.d.ts +1 -1
- package/build/src/modeling/definitions/Status.d.ts.map +1 -1
- package/build/src/modeling/definitions/Status.js +1 -0
- package/build/src/modeling/definitions/Status.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modeling/Semantics.ts +6 -6
- package/src/modeling/definitions/{Price.examples.md → Currency.examples.md} +12 -12
- package/src/modeling/definitions/{Price.ts → Currency.ts} +26 -26
- package/src/modeling/definitions/HTML.ts +17 -5
- package/src/modeling/definitions/Markdown.ts +12 -5
- package/src/modeling/definitions/Status.ts +2 -1
- package/tests/unit/modeling/definitions/{price.spec.ts → currency.spec.ts} +114 -114
- package/tests/unit/modeling/definitions/description.spec.ts +0 -2
- package/tests/unit/modeling/semantic-configs.spec.ts +44 -44
- package/tests/unit/modeling/semantics.spec.ts +10 -1
- package/build/src/modeling/definitions/Price.d.ts.map +0 -1
- package/build/src/modeling/definitions/Price.js.map +0 -1
|
@@ -15,7 +15,7 @@ export interface StatusConfig {
|
|
|
15
15
|
* Default state when creating new records.
|
|
16
16
|
* Must be one of the allowedStates (if specified) or enum values from the schema.
|
|
17
17
|
*/
|
|
18
|
-
defaultState
|
|
18
|
+
defaultState?: string;
|
|
19
19
|
/**
|
|
20
20
|
* State transitions configuration.
|
|
21
21
|
* Maps from current state to array of allowed next states.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAExB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAExB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAEtC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CACrB,MAAM,EACN;QACE;;;WAGG;QACH,QAAQ,CAAC,EAAE,OAAO,CAAA;QAElB;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;QAEpB;;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AA;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,qBAE5E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAQ,OAAO,CAAC,YAAY,CAAM,KAAG,qBAqBzE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YA0BnC,CAAA"}
|
|
@@ -32,6 +32,7 @@ export const createStatusSemantic = (config = {}) => {
|
|
|
32
32
|
* Default configuration for Status semantic.
|
|
33
33
|
*/
|
|
34
34
|
export const DEFAULT_STATUS_CONFIG = {
|
|
35
|
+
allowedStates: ['draft', 'published', 'archived'],
|
|
35
36
|
defaultState: 'draft',
|
|
36
37
|
stateBehaviors: {
|
|
37
38
|
draft: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAoK9C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAA6B,EAAqC,EAAE;IACnG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,MAAM,CAAA;AAC5C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAgC,EAAE,EAAyB,EAAE;IAChG,MAAM,YAAY,GAAG;QACnB,GAAG,qBAAqB;QACxB,GAAG,MAAM;QACT,4BAA4B;QAC5B,cAAc,EAAE,MAAM,CAAC,cAAc;YACnC,CAAC,CAAC,EAAE,GAAG,qBAAqB,CAAC,cAAc,EAAE,GAAG,MAAM,CAAC,cAAc,EAAE;YACvE,CAAC,CAAC,qBAAqB,CAAC,cAAc;QACxC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACvB,CAAC,CAAC,EAAE,GAAG,qBAAqB,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;YAC3D,CAAC,CAAC,qBAAqB,CAAC,QAAQ;KACnC,CAAA;IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,MAAM;QACvB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,YAAY,EAAE,OAAO;IACrB,cAAc,EAAE;QACd,KAAK,EAAE;YACL,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,IAAI;SAClB;QACD,SAAS,EAAE;YACT,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,KAAK;SACnB;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,KAAK;SACnB;KACF;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,KAAK;QACxB,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,KAAK;KACxB;CACF,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the Status semantic.\n * These options control state management and workflow behavior.\n */\nexport interface StatusConfig {\n /**\n * Allowed states for this status field.\n * Only required when the field doesn't have enum values defined in the schema.\n * If enum values are defined in DomainProperty > Schema, those values will be used instead.\n */\n allowedStates?: string[]\n\n /**\n * Default state when creating new records.\n * Must be one of the allowedStates (if specified) or enum values from the schema.\n */\n defaultState
|
|
1
|
+
{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,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AAW,EAAE,KAAK;SACnB;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,KAAK;SACnB;KACF;IACD,QAAQ,EAAE;QACR,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,KAAK;QACxB,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,KAAK;KACxB;CACF,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Configuration options for the Status semantic.\n * These options control state management and workflow behavior.\n */\nexport interface StatusConfig {\n /**\n * Allowed states for this status field.\n * Only required when the field doesn't have enum values defined in the schema.\n * If enum values are defined in DomainProperty > Schema, those values will be used instead.\n */\n allowedStates?: string[]\n\n /**\n * Default state when creating new records.\n * Must be one of the allowedStates (if specified) or enum values from the schema.\n */\n defaultState?: string\n\n /**\n * State transitions configuration.\n * Maps from current state to array of allowed next states.\n */\n transitions?: Record<string, string[]>\n\n /**\n * State-specific behaviors and permissions.\n */\n stateBehaviors?: Record<\n string,\n {\n /**\n * Whether records in this state are publicly visible.\n * Defaults to true if not specified.\n */\n isPublic?: boolean\n\n /**\n * Whether records in this state can be edited.\n * Defaults to true if not specified.\n */\n isEditable?: boolean\n\n /**\n * Whether records in this state can be deleted.\n * Defaults to false if not specified.\n */\n isDeletable?: boolean\n\n /**\n * Whether this state requires approval before transition.\n * Defaults to false if not specified.\n */\n requiresApproval?: boolean\n\n /**\n * Custom display name for this state.\n */\n displayName?: string\n\n /**\n * Custom description for this state.\n */\n description?: string\n\n /**\n * Color or visual indicator for this state.\n */\n color?: string\n\n /**\n * Icon for this state.\n */\n icon?: string\n }\n >\n\n /**\n * Workflow configuration for status management.\n */\n workflow?: {\n /**\n * Whether status changes require approval.\n * Defaults to false if not specified.\n */\n requiresApproval?: boolean\n\n /**\n * Roles that can approve status changes.\n * Required if requiresApproval is true.\n */\n approvalRoles?: string[]\n\n /**\n * Whether to send notifications on status changes.\n * Defaults to false if not specified.\n */\n sendNotifications?: boolean\n\n /**\n * Notification channels to use.\n */\n notificationChannels?: ('email' | 'sms' | 'push' | 'webhook')[]\n\n /**\n * Whether to log status change history.\n * Defaults to true if not specified.\n */\n logHistory?: boolean\n\n /**\n * Whether to allow bulk status changes.\n * Defaults to false if not specified.\n */\n allowBulkChanges?: boolean\n }\n\n /**\n * Auto-transitions based on conditions.\n */\n autoTransitions?: {\n /**\n * Current state that triggers the auto-transition.\n */\n from: string\n\n /**\n * Target state to transition to.\n */\n to: string\n\n /**\n * Condition that triggers the transition.\n * Examples: \"after 24 hours\", \"when approved\", \"when payment received\"\n */\n condition: string\n\n /**\n * Whether this auto-transition requires approval.\n * Defaults to false if not specified.\n */\n requiresApproval?: boolean\n }[]\n\n /**\n * Custom metadata for the status field.\n */\n metadata?: Record<string, unknown>\n\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for Status semantic.\n */\nexport interface AppliedStatusSemantic extends AppliedDataSemantic {\n id: SemanticType.Status\n config?: StatusConfig\n}\n\n/**\n * Type guard to check if a semantic is a Status semantic.\n */\nexport const isStatusSemantic = (semantic: AppliedDataSemantic): semantic is AppliedStatusSemantic => {\n return semantic.id === SemanticType.Status\n}\n\n/**\n * Helper function to create a Status semantic with configuration.\n */\nexport const createStatusSemantic = (config: Partial<StatusConfig> = {}): AppliedStatusSemantic => {\n const mergedConfig = {\n ...DEFAULT_STATUS_CONFIG,\n ...config,\n // Deep merge nested objects\n stateBehaviors: config.stateBehaviors\n ? { ...DEFAULT_STATUS_CONFIG.stateBehaviors, ...config.stateBehaviors }\n : DEFAULT_STATUS_CONFIG.stateBehaviors,\n workflow: config.workflow\n ? { ...DEFAULT_STATUS_CONFIG.workflow, ...config.workflow }\n : DEFAULT_STATUS_CONFIG.workflow,\n }\n\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.Status,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for Status semantic.\n */\nexport const DEFAULT_STATUS_CONFIG: StatusConfig = {\n allowedStates: ['draft', 'published', 'archived'],\n defaultState: 'draft',\n stateBehaviors: {\n draft: {\n isPublic: false,\n isEditable: true,\n isDeletable: true,\n },\n published: {\n isPublic: true,\n isEditable: true,\n isDeletable: false,\n },\n archived: {\n isPublic: false,\n isEditable: false,\n isDeletable: false,\n },\n },\n workflow: {\n requiresApproval: false,\n sendNotifications: false,\n logHistory: true,\n allowBulkChanges: false,\n },\n}\n"]}
|