@api-client/core 0.18.24 → 0.18.25
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/DomainEntity.d.ts +6 -1
- package/build/src/modeling/DomainEntity.d.ts.map +1 -1
- package/build/src/modeling/DomainEntity.js +24 -5
- package/build/src/modeling/DomainEntity.js.map +1 -1
- package/build/src/modeling/Semantics.d.ts +68 -0
- package/build/src/modeling/Semantics.d.ts.map +1 -1
- package/build/src/modeling/Semantics.js +217 -0
- package/build/src/modeling/Semantics.js.map +1 -1
- package/build/src/modeling/definitions/Email.js +1 -1
- package/build/src/modeling/definitions/Email.js.map +1 -1
- package/build/src/modeling/definitions/Password.d.ts.map +1 -1
- package/build/src/modeling/definitions/Password.js +1 -3
- package/build/src/modeling/definitions/Password.js.map +1 -1
- package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
- package/build/src/modeling/helpers/Intelisense.js +24 -58
- package/build/src/modeling/helpers/Intelisense.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +15 -15
- package/package.json +1 -1
- package/src/modeling/DomainEntity.ts +27 -5
- package/src/modeling/Semantics.ts +254 -0
- package/src/modeling/definitions/Email.ts +1 -1
- package/src/modeling/definitions/Password.ts +1 -3
- package/src/modeling/helpers/Intelisense.ts +26 -58
- package/tests/unit/modeling/definitions/password.spec.ts +0 -2
- package/tests/unit/modeling/domain_entity_parents.spec.ts +243 -0
- package/tests/unit/modeling/semantic_runtime.spec.ts +113 -0
- package/tests/unit/modeling/semantics.spec.ts +68 -0
|
@@ -47,9 +47,7 @@ export const DEFAULT_PASSWORD_CONFIG = {
|
|
|
47
47
|
requireNumbers: true,
|
|
48
48
|
requireUppercase: true,
|
|
49
49
|
requireLowercase: true,
|
|
50
|
-
|
|
51
|
-
saltRounds: 12,
|
|
52
|
-
maxAge: undefined,
|
|
50
|
+
minLength: 8,
|
|
53
51
|
preventReuse: false,
|
|
54
52
|
preventReuseCount: 5,
|
|
55
53
|
allowCommonPasswords: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Password.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Password.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACrC;;OAEG;IACH,gDAAiB,CAAA;IACjB;;OAEG;IACH,gDAAiB,CAAA;IACjB;;OAEG;IACH,gDAAiB,CAAA;AACnB,CAAC,EAbW,2BAA2B,KAA3B,2BAA2B,QAatC;AAiGD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA6B,EAAuC,EAAE;IACvG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,QAAQ,CAAA;AAC9C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAyB,EAAE,EAA2B,EAAE;IAC7F,MAAM,YAAY,GAAG;QACnB,GAAG,uBAAuB;QAC1B,GAAG,MAAM;KACV,CAAA;IACD,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,QAAQ;QACzB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,
|
|
1
|
+
{"version":3,"file":"Password.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Password.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACrC;;OAEG;IACH,gDAAiB,CAAA;IACjB;;OAEG;IACH,gDAAiB,CAAA;IACjB;;OAEG;IACH,gDAAiB,CAAA;AACnB,CAAC,EAbW,2BAA2B,KAA3B,2BAA2B,QAatC;AAiGD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA6B,EAAuC,EAAE;IACvG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,QAAQ,CAAA;AAC9C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAyB,EAAE,EAA2B,EAAE;IAC7F,MAAM,YAAY,GAAG;QACnB,GAAG,uBAAuB;QAC1B,GAAG,MAAM;KACV,CAAA;IACD,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,QAAQ;QACzB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,KAAK;IACnB,iBAAiB,EAAE,CAAC;IACpB,oBAAoB,EAAE,KAAK;CAC5B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\n/**\n * Supported encryption algorithms for password hashing.\n */\nexport enum PasswordEncryptionAlgorithm {\n /**\n * bcrypt - Industry standard, secure, and widely supported\n */\n Bcrypt = 'bcrypt',\n /**\n * Argon2 - Winner of the Password Hashing Competition, very secure\n */\n Argon2 = 'argon2',\n /**\n * scrypt - Memory-hard function, good for high-security applications\n */\n Scrypt = 'scrypt',\n}\n\n/**\n * Configuration options for the Password semantic.\n * These options control password validation and encryption behavior.\n */\nexport interface PasswordConfig {\n /**\n * Whether to require special characters.\n * Defaults to false if not specified.\n */\n requireSpecialChars?: boolean\n\n /**\n * Whether to require numbers.\n * Defaults to false if not specified.\n */\n requireNumbers?: boolean\n\n /**\n * Whether to require uppercase letters.\n * Defaults to false if not specified.\n */\n requireUppercase?: boolean\n\n /**\n * Whether to require lowercase letters.\n * Defaults to false if not specified.\n */\n requireLowercase?: boolean\n\n /**\n * Encryption algorithm to use for password hashing.\n * Defaults to 'bcrypt' if not specified.\n */\n encryptionAlgorithm?: PasswordEncryptionAlgorithm\n\n /**\n * Number of salt rounds for bcrypt.\n * Defaults to 12 if not specified.\n */\n saltRounds?: number\n\n /**\n * Maximum age of password in days before requiring change.\n * Defaults to null (no expiration) if not specified.\n */\n maxAge?: number\n\n /**\n * Whether to prevent reuse of recent passwords.\n * Defaults to false if not specified.\n */\n preventReuse?: boolean\n\n /**\n * Number of recent passwords to prevent reuse.\n * Defaults to 5 if preventReuse is true.\n */\n preventReuseCount?: number\n\n /**\n * Custom password validation regex pattern.\n * If specified, overrides other validation rules.\n */\n customPattern?: string\n\n /**\n * Custom error message for validation failures.\n */\n customErrorMessage?: string\n\n /**\n * Whether to allow common passwords.\n * Defaults to false if not specified.\n */\n allowCommonPasswords?: boolean\n\n /**\n * Custom metadata for the password 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 Password semantic.\n */\nexport interface AppliedPasswordSemantic extends AppliedDataSemantic {\n id: SemanticType.Password\n config?: PasswordConfig\n}\n\n/**\n * Type guard to check if a semantic is a Password semantic.\n */\nexport const isPasswordSemantic = (semantic: AppliedDataSemantic): semantic is AppliedPasswordSemantic => {\n return semantic.id === SemanticType.Password\n}\n\n/**\n * Helper function to create a Password semantic with configuration.\n */\nexport const createPasswordSemantic = (config: PasswordConfig = {}): AppliedPasswordSemantic => {\n const mergedConfig = {\n ...DEFAULT_PASSWORD_CONFIG,\n ...config,\n }\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n\n return {\n id: SemanticType.Password,\n config: mergedConfig,\n }\n}\n\n/**\n * Default configuration for Password semantic.\n */\nexport const DEFAULT_PASSWORD_CONFIG: PasswordConfig = {\n requireSpecialChars: true,\n requireNumbers: true,\n requireUppercase: true,\n requireLowercase: true,\n minLength: 8,\n preventReuse: false,\n preventReuseCount: 5,\n allowCommonPasswords: false,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Intelisense.d.ts","sourceRoot":"","sources":["../../../../src/modeling/helpers/Intelisense.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAWnD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAyDnF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,aAAa,CAiB1F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"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,CAmBhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,SAAU,EACtB,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GACzB,cAAc,CAiBhB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAUlG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAUlG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAYlG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GACzB,cAAc,CAYhB;AA0LD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,EAAE,CA4B1E"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SemanticType } from '../Semantics.js';
|
|
2
|
-
import { createEmailSemantic } from '../definitions/Email.js';
|
|
3
|
-
import { createPasswordSemantic } from '../definitions/Password.js';
|
|
2
|
+
import { createEmailSemantic, DEFAULT_EMAIL_CONFIG } from '../definitions/Email.js';
|
|
3
|
+
import { createPasswordSemantic, DEFAULT_PASSWORD_CONFIG } from '../definitions/Password.js';
|
|
4
4
|
import { createPhoneSemantic } from '../definitions/Phone.js';
|
|
5
5
|
import { createPublicUniqueNameSemantic, DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG } from '../definitions/PublicUniqueName.js';
|
|
6
6
|
import { createDescriptionSemantic } from '../definitions/Description.js';
|
|
7
|
-
import {
|
|
7
|
+
import { CURRENCY_PRESETS } from '../definitions/Currency.js';
|
|
8
8
|
import { createStatusSemantic } from '../definitions/Status.js';
|
|
9
9
|
import { SKU_PRESETS } from '../definitions/SKU.js';
|
|
10
10
|
/**
|
|
@@ -123,13 +123,8 @@ export function addEmailField(entity, info = {}) {
|
|
|
123
123
|
type: 'string',
|
|
124
124
|
required: true,
|
|
125
125
|
index: true,
|
|
126
|
-
semantics: [
|
|
127
|
-
createEmailSemantic({
|
|
128
|
-
requireVerification: true,
|
|
129
|
-
verificationMethod: 'email',
|
|
130
|
-
}),
|
|
131
|
-
],
|
|
132
126
|
});
|
|
127
|
+
prop.addSemantic(createEmailSemantic(DEFAULT_EMAIL_CONFIG));
|
|
133
128
|
return prop;
|
|
134
129
|
}
|
|
135
130
|
/**
|
|
@@ -149,16 +144,8 @@ export function addPasswordField(entity, info = {}) {
|
|
|
149
144
|
info: { name: 'password', displayName: 'Password', ...info },
|
|
150
145
|
type: 'string',
|
|
151
146
|
required: true,
|
|
152
|
-
semantics: [
|
|
153
|
-
createPasswordSemantic({
|
|
154
|
-
requireSpecialChars: true,
|
|
155
|
-
requireNumbers: true,
|
|
156
|
-
requireUppercase: true,
|
|
157
|
-
requireLowercase: true,
|
|
158
|
-
minLength: 8,
|
|
159
|
-
}),
|
|
160
|
-
],
|
|
161
147
|
});
|
|
148
|
+
prop.addSemantic(createPasswordSemantic(DEFAULT_PASSWORD_CONFIG));
|
|
162
149
|
return prop;
|
|
163
150
|
}
|
|
164
151
|
/**
|
|
@@ -223,8 +210,8 @@ export function addDescriptionField(entity, info = {}) {
|
|
|
223
210
|
const prop = entity.addProperty({
|
|
224
211
|
info: { name: 'description', displayName: 'Description', ...info },
|
|
225
212
|
type: 'string',
|
|
226
|
-
semantics: [createDescriptionSemantic()],
|
|
227
213
|
});
|
|
214
|
+
prop.addSemantic(createDescriptionSemantic());
|
|
228
215
|
return prop;
|
|
229
216
|
}
|
|
230
217
|
/**
|
|
@@ -574,15 +561,13 @@ export function addPhoneField(entity, info = {}) {
|
|
|
574
561
|
info: { name: 'phone', displayName: 'Phone Number', ...info },
|
|
575
562
|
type: 'string',
|
|
576
563
|
index: true,
|
|
577
|
-
semantics: [
|
|
578
|
-
createPhoneSemantic({
|
|
579
|
-
format: 'international',
|
|
580
|
-
requireCountryCode: true,
|
|
581
|
-
requireVerification: true,
|
|
582
|
-
verificationMethod: 'sms',
|
|
583
|
-
}),
|
|
584
|
-
],
|
|
585
564
|
});
|
|
565
|
+
prop.addSemantic(createPhoneSemantic({
|
|
566
|
+
format: 'international',
|
|
567
|
+
requireCountryCode: true,
|
|
568
|
+
requireVerification: true,
|
|
569
|
+
verificationMethod: 'sms',
|
|
570
|
+
}));
|
|
586
571
|
return prop;
|
|
587
572
|
}
|
|
588
573
|
/**
|
|
@@ -610,8 +595,8 @@ export function addAvatarUrlField(entity, info = {}) {
|
|
|
610
595
|
const prop = entity.addProperty({
|
|
611
596
|
info: { name: 'avatar_url', displayName: 'Avatar URL', ...info },
|
|
612
597
|
type: 'string',
|
|
613
|
-
semantics: [{ id: SemanticType.ImageURL }],
|
|
614
598
|
});
|
|
599
|
+
prop.addSemantic({ id: SemanticType.ImageURL });
|
|
615
600
|
return prop;
|
|
616
601
|
}
|
|
617
602
|
/**
|
|
@@ -645,8 +630,8 @@ export function addPublicUniqueNameField(entity, info = {}) {
|
|
|
645
630
|
index: true,
|
|
646
631
|
required: true,
|
|
647
632
|
unique: true,
|
|
648
|
-
semantics: [createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG)],
|
|
649
633
|
});
|
|
634
|
+
prop.addSemantic(createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG));
|
|
650
635
|
return prop;
|
|
651
636
|
}
|
|
652
637
|
/**
|
|
@@ -675,8 +660,8 @@ export function addSkuField(entity, info = {}) {
|
|
|
675
660
|
type: 'string',
|
|
676
661
|
required: true,
|
|
677
662
|
unique: true,
|
|
678
|
-
semantics: [{ ...SKU_PRESETS.PRODUCT_STANDARD }],
|
|
679
663
|
});
|
|
664
|
+
prop.addSemantic({ ...SKU_PRESETS.PRODUCT_STANDARD });
|
|
680
665
|
return prop;
|
|
681
666
|
}
|
|
682
667
|
/**
|
|
@@ -715,16 +700,8 @@ export function addPriceField(entity, info = {}) {
|
|
|
715
700
|
},
|
|
716
701
|
},
|
|
717
702
|
],
|
|
718
|
-
semantics: [
|
|
719
|
-
createCurrencySemantic({
|
|
720
|
-
storageFormat: 'integer_cents',
|
|
721
|
-
defaultCurrency: 'USD',
|
|
722
|
-
decimalPlaces: 2,
|
|
723
|
-
allowNegative: false,
|
|
724
|
-
validateCurrencyCode: true,
|
|
725
|
-
}),
|
|
726
|
-
],
|
|
727
703
|
});
|
|
704
|
+
prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS });
|
|
728
705
|
return prop;
|
|
729
706
|
}
|
|
730
707
|
/**
|
|
@@ -807,7 +784,9 @@ export function addImagesField(entity, info = {}) {
|
|
|
807
784
|
info: { name: 'images', displayName: 'Images', ...info },
|
|
808
785
|
type: 'string',
|
|
809
786
|
multiple: true,
|
|
810
|
-
|
|
787
|
+
});
|
|
788
|
+
prop.addSemantic({
|
|
789
|
+
id: SemanticType.ImageURL,
|
|
811
790
|
});
|
|
812
791
|
return prop;
|
|
813
792
|
}
|
|
@@ -839,7 +818,6 @@ export function addCustomStatusField(entity, enumValues, info = {}) {
|
|
|
839
818
|
info: { name: 'status', displayName: 'Status', ...info },
|
|
840
819
|
type: 'string',
|
|
841
820
|
required: true,
|
|
842
|
-
semantics: [createStatusSemantic()],
|
|
843
821
|
schema: {
|
|
844
822
|
enum: enumValues,
|
|
845
823
|
defaultValue: {
|
|
@@ -848,6 +826,7 @@ export function addCustomStatusField(entity, enumValues, info = {}) {
|
|
|
848
826
|
},
|
|
849
827
|
},
|
|
850
828
|
});
|
|
829
|
+
prop.addSemantic(createStatusSemantic());
|
|
851
830
|
return prop;
|
|
852
831
|
}
|
|
853
832
|
/**
|
|
@@ -958,22 +937,15 @@ export function addUnitPriceField(entity, info = {}) {
|
|
|
958
937
|
info: { name: 'unitPrice', displayName: 'Unit Price', ...info },
|
|
959
938
|
type: 'number',
|
|
960
939
|
required: true,
|
|
961
|
-
semantics: [
|
|
962
|
-
createCurrencySemantic({
|
|
963
|
-
storageFormat: 'integer_cents',
|
|
964
|
-
defaultCurrency: 'USD',
|
|
965
|
-
decimalPlaces: 2,
|
|
966
|
-
allowNegative: false,
|
|
967
|
-
}),
|
|
968
|
-
],
|
|
969
940
|
});
|
|
941
|
+
prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS });
|
|
970
942
|
return prop;
|
|
971
943
|
}
|
|
972
944
|
/**
|
|
973
945
|
* Adds a currency amount field (subtotal, tax, shipping, etc.).
|
|
974
946
|
*/
|
|
975
947
|
export function addCurrencyAmountField(entity, fieldName, displayName, info = {}) {
|
|
976
|
-
|
|
948
|
+
const prop = entity.addProperty({
|
|
977
949
|
info: {
|
|
978
950
|
name: fieldName,
|
|
979
951
|
displayName,
|
|
@@ -981,15 +953,9 @@ export function addCurrencyAmountField(entity, fieldName, displayName, info = {}
|
|
|
981
953
|
},
|
|
982
954
|
type: 'number',
|
|
983
955
|
required: true,
|
|
984
|
-
semantics: [
|
|
985
|
-
createCurrencySemantic({
|
|
986
|
-
storageFormat: 'integer_cents',
|
|
987
|
-
defaultCurrency: 'USD',
|
|
988
|
-
decimalPlaces: 2,
|
|
989
|
-
allowNegative: false,
|
|
990
|
-
}),
|
|
991
|
-
],
|
|
992
956
|
});
|
|
957
|
+
prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS });
|
|
958
|
+
return prop;
|
|
993
959
|
}
|
|
994
960
|
/**
|
|
995
961
|
* Finds a field in the given entity that matches the specified predicate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Intelisense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,CAAC,QAAQ,CAAC,EAC5F,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAoB,EAAE,SAAiB,EAAE,MAAM,GAAG,KAAK;IAC/E,OAAO,iBAAiB,CACtB,MAAM,EACN,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAC7E,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,MAAM,CAAC,CAAA;AAC5F,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CACtB,MAAM,EACN,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,EAC/F,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CACtB,MAAM,EACN,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAChF,MAAM,CACP,CAAA;AACH,CAAC","sourcesContent":["import type { DomainEntity } from '../DomainEntity.js'\nimport type { DomainElement } from '../DomainElement.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { IThing } from '../../models/Thing.js'\nimport { SemanticType } from '../Semantics.js'\nimport { createEmailSemantic } from '../definitions/Email.js'\nimport { createPasswordSemantic } from '../definitions/Password.js'\nimport { createPhoneSemantic } from '../definitions/Phone.js'\nimport { createPublicUniqueNameSemantic, DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG } from '../definitions/PublicUniqueName.js'\nimport { createDescriptionSemantic } from '../definitions/Description.js'\nimport { createCurrencySemantic } from '../definitions/Currency.js'\nimport { createStatusSemantic } from '../definitions/Status.js'\nimport { SKU_PRESETS } from '../definitions/SKU.js'\n\n/**\n * Adds a field to the given entity that is automatically generated by the system.\n *\n * @param entity The entity to which the auto field will be added.\n * @param autoField The name of the auto field to add.\n * @returns The added DomainElement representing the auto field.\n * @throws Error if the auto field is not supported.\n */\nexport function addAutoField(entity: DomainEntity, autoField: string): DomainElement {\n switch (autoField) {\n case 'id':\n return addIdField(entity)\n case 'email':\n return addEmailField(entity)\n case 'name':\n return addNameField(entity)\n case 'description':\n return addDescriptionField(entity)\n case 'status':\n return addStatusField(entity)\n case 'version':\n return addVersionField(entity)\n case 'owner':\n return addOwnerField(entity)\n case 'created':\n return addCreatedAtField(entity)\n // case 'created-by':\n // return addCreatedByField(entity)\n case 'updated':\n return addUpdatedAtField(entity)\n case 'updated-by':\n return addUpdatedByField(entity)\n case 'is-deleted':\n return addIsDeletedField(entity)\n case 'deleted':\n return addDeletedAtField(entity)\n case 'first-name':\n return addFirstNameField(entity)\n case 'last-name':\n return addLastNameField(entity)\n case 'phone':\n return addPhoneField(entity)\n case 'avatar-url':\n return addAvatarUrlField(entity)\n case 'public-unique-name':\n return addPublicUniqueNameField(entity)\n case 'price':\n return addPriceField(entity)\n case 'sku':\n return addSkuField(entity)\n case 'quantity':\n return addQuantityField(entity)\n case 'weight':\n return addWeightField(entity)\n case 'images':\n return addImagesField(entity)\n case 'session-id':\n return addSessionIdField(entity)\n case 'expires-at':\n return addExpiresAtField(entity)\n case 'unit-price':\n return addUnitPriceField(entity)\n default:\n throw new Error(`Unsupported auto field: ${autoField}`)\n }\n}\n\n/**\n * Adds the primary field (ID) to the given entity.\n * If the ID field already exists, it returns the existing field.\n * Otherwise, it creates a new ID field with a name based on the entity's name.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'id'\n * - primary: true\n * - readOnly: true\n * - schema.defaultValue: { type: 'function', value: 'uuid-v4' }\n *\n * @param entity The entity to which the ID field will be added.\n * @returns The added primary field property.\n */\nexport function addIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findIdField(entity, true)\n if (existing) {\n // If the ID field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: `id`, ...info },\n primary: true,\n readOnly: true,\n // I don't think we need to index the ID field..\n // index: true,\n type: 'string',\n // @TODO: We should experiment with the random ID generation using the nano library.\n schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },\n })\n return prop\n}\n\n/**\n * Adds an email field to the given entity.\n * If the email field already exists, it returns the existing field.\n * Otherwise, it creates a new email field with a semantic annotation.\n * @param entity The entity to which the email field will be added.\n * @returns The added email field property.\n */\nexport function addEmailField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findEmailField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'email', displayName: 'Email Address', ...info },\n type: 'string',\n required: true,\n index: true,\n semantics: [\n createEmailSemantic({\n requireVerification: true,\n verificationMethod: 'email',\n }),\n ],\n })\n return prop\n}\n\n/**\n * Adds a password field to the given entity.\n * If the password field already exists, it returns the existing field.\n * Otherwise, it creates a new password field with a semantic annotation.\n * @param entity The entity to which the password field will be added.\n * @param info Additional information for the password field.\n * @returns The added password field property.\n */\nexport function addPasswordField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findPasswordField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'password', displayName: 'Password', ...info },\n type: 'string',\n required: true,\n semantics: [\n createPasswordSemantic({\n requireSpecialChars: true,\n requireNumbers: true,\n requireUppercase: true,\n requireLowercase: true,\n minLength: 8,\n }),\n ],\n })\n return prop\n}\n\n/**\n * Adds a version field to the given entity.\n * @param entity The entity to which the version field will be added.\n * The version field is used to track the version of the entity.\n * @returns The added version field property.\n */\nexport function addVersionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findVersionField(entity, true)\n if (existing) {\n // If the version field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'version', displayName: 'Version', ...info },\n readOnly: true,\n index: true,\n type: 'number',\n schema: { defaultValue: { type: 'function', value: 'incremental' }, minimum: 0 },\n })\n prop.addSemantic({\n id: SemanticType.Version,\n })\n return prop\n}\n\nexport function addNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'name', displayName: 'Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Title,\n })\n return prop\n}\n\n/**\n * Adds a description field to the specified entity.\n * If a description field already exists, it returns the existing field.\n * Otherwise, it creates a new description field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'description'\n * - info.displayName: 'Description'\n *\n * Set semantics:\n * - `SemanticType.Description`\n *\n * @param entity The entity to which the description field will be added.\n * @returns The added description field property.\n */\nexport function addDescriptionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findDescriptionField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'description', displayName: 'Description', ...info },\n type: 'string',\n semantics: [createDescriptionSemantic()],\n })\n return prop\n}\n\n/**\n * Adds a status field to the specified entity.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - schema.enum: ['Active', 'Draft', 'Archived']\n * - schema.defaultValue: { type: 'literal', value: 'Draft' }\n *\n * Set semantics:\n * - `SemanticType.Status`\n *\n * @param entity The entity to which the status field will be added.\n * @param info Additional information about the field.\n * @returns The added status field property.\n */\nexport function addStatusField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n schema: {\n enum: ['Active', 'Draft', 'Archived'],\n defaultValue: { type: 'literal', value: 'Draft' },\n },\n })\n prop.addSemantic({\n id: SemanticType.Status,\n })\n return prop\n}\n\n/**\n * Adds an owner field to the specified entity.\n * If an owner field already exists, it returns the existing field.\n * Otherwise, it creates a new owner field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'owner'\n * - info.displayName: 'Owner'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the owner field will be added.\n * @param info Additional information about the field.\n * @returns The added owner field property.\n */\nexport function addOwnerField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findOwnerField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation(\n {},\n {\n info: { name: 'owner', displayName: 'Owner', ...info },\n required: true,\n }\n )\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n// This is owner with different name. Use that one instead.\n// function addCreatedByField(entity: DomainEntity): DomainElement {\n// const existing = findCreatedByField(entity, true)\n// if (existing) {\n// return existing\n// }\n// const prop = entity.addProperty({\n// info: { name: 'created_by', displayName: 'Created By' },\n// type: 'string',\n// readOnly: true,\n// index: true,\n// })\n// prop.addSemantic({\n// id: SemanticType.CreatedTimestamp,\n// })\n// return prop\n// }\n\n/**\n * Adds an updated by field to the specified entity as an association to the User entity.\n * If an updated by field already exists, it returns the existing field.\n * Otherwise, it creates a new updated by field with the specified information.\n *\n * Set properties:\n * - info.name: 'updated_by'\n * - info.displayName: 'Updated By'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the updated by field will be added.\n * @param info Additional information about the field.\n * @returns The added updated by field property.\n */\nexport function addUpdatedByField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findUpdatedByField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation(\n {},\n {\n info: { name: 'updated_by', displayName: 'Updated By', ...info },\n required: true,\n }\n )\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n/**\n * Adds a created at field to the specified entity.\n * If a created at field already exists, it returns the existing field.\n * Otherwise, it creates a new created at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'created_at'\n * - info.displayName: 'Created At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `CreatedTimestamp`\n *\n * @param entity The entity to which the created at field will be added.\n * @param info Additional information about the field.\n * @returns The created created at field.\n */\nexport function addCreatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findCreatedAtField(entity, true)\n if (existing) {\n // If the created_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'created_at', displayName: 'Created At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.CreatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an updated at field to the specified entity.\n * If an updated at field already exists, it returns the existing field.\n * Otherwise, it creates a new updated at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'updated_at'\n * - info.displayName: 'Updated At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `UpdatedTimestamp`\n *\n * @param entity The entity to which the updated at field will be added.\n * @param info Additional information about the field.\n * @returns The created updated at field.\n */\nexport function addUpdatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUpdatedAtField(entity, true)\n if (existing) {\n // If the updated_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'updated_at', displayName: 'Updated At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.UpdatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds a deleted at field to the specified entity.\n * If a deleted at field already exists, it returns the existing field.\n * Otherwise, it creates a new deleted at field with the specified information.\n *\n * Set properties:\n * - required: true\n * - type: 'datetime'\n * - info.name: 'deleted_at'\n * - info.displayName: 'Deleted At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `SemanticType.DeletedTimestamp`\n *\n * @param entity The entity to which the deleted_at field will be added.\n * @param info Additional information about the field.\n * @returns The added deleted at field property.\n */\nexport function addDeletedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findDeletedAtField(entity, true)\n if (existing) {\n // If the deleted_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'deleted_at', displayName: 'Deleted At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an is_deleted field to the specified entity.\n * If an is_deleted field already exists, it returns the existing field.\n * Otherwise, it creates a new is_deleted field with the specified information.\n *\n * Set properties:\n * - type: 'boolean'\n * - info.name: 'is_deleted'\n * - info.displayName: 'Is Deleted'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'literal', value: 'false' }\n *\n * Set semantics:\n * - `SemanticType.DeletedFlag`\n *\n * @param entity The entity to which the is_deleted field will be added.\n * @param info Additional information about the field.\n * @returns The added is_deleted field property.\n */\nexport function addIsDeletedField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findIsDeletedField(entity, true)\n if (existing) {\n // If the is_deleted field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'is_deleted', displayName: 'Is Deleted', ...info },\n readOnly: true,\n index: true,\n type: 'boolean',\n schema: { defaultValue: { type: 'literal', value: 'false' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedFlag,\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addFirstNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findFirstNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'first_name', displayName: 'First Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addLastNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findLastNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'last_name', displayName: 'Last Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a phone field to the specified entity.\n * If a phone field already exists, it returns the existing field.\n * Otherwise, it creates a new phone field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'phone'\n * - info.displayName: 'Phone Number'\n * - index: true (to search by phone number)\n *\n * Set semantics:\n * - id: SemanticType.Phone\n *\n * @param entity The entity to which the phone field will be added.\n * @param info Additional information about the field.\n * @returns The created phone field.\n */\nexport function addPhoneField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPhoneField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'phone', displayName: 'Phone Number', ...info },\n type: 'string',\n index: true,\n semantics: [\n createPhoneSemantic({\n format: 'international',\n requireCountryCode: true,\n requireVerification: true,\n verificationMethod: 'sms',\n }),\n ],\n })\n return prop\n}\n\n/**\n * Adds an avatar URL field to the specified entity.\n * If an avatar URL field already exists, it returns the existing field.\n * Otherwise, it creates a new avatar URL field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'avatar_url'\n * - info.displayName: 'Avatar URL'\n *\n * Set semantics:\n * - id: SemanticType.ImageURL\n *\n * @param entity The entity to which the avatar URL field will be added.\n * @param info Additional information about the field.\n * @returns The created avatar URL field.\n */\nexport function addAvatarUrlField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findAvatarUrlField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'avatar_url', displayName: 'Avatar URL', ...info },\n type: 'string',\n semantics: [{ id: SemanticType.ImageURL }],\n })\n return prop\n}\n\n/**\n * Adds a public unique name (slug) field to the specified entity.\n * If a public unique name field already exists, it returns the existing field.\n * Otherwise, it creates a new public unique name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'slug'\n * - info.displayName: 'Public Unique Name'\n * - index: true\n * - required: true\n * - unique: true\n *\n * Set semantics:\n * - id: SemanticType.PublicUniqueName\n *\n * @param entity The entity to which the public unique name field will be added.\n * @param info Additional information about the field.\n * @returns The created public unique name field.\n */\nexport function addPublicUniqueNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPublicUniqueNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'slug', displayName: 'Public Unique Name', ...info },\n type: 'string',\n index: true,\n required: true,\n unique: true,\n semantics: [createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG)],\n })\n return prop\n}\n\n/**\n * Adds a SKU field to the specified entity.\n * If a SKU field already exists, it returns the existing field.\n * Otherwise, it creates a new SKU field with semantic annotation.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sku'\n * - info.displayName: 'SKU'\n * - required: true\n * - unique: true\n *\n * @param entity The entity to which the SKU field will be added.\n * @param info Additional information about the field.\n * @returns The created SKU field.\n */\nexport function addSkuField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSkuField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sku', displayName: 'SKU', ...info },\n type: 'string',\n required: true,\n unique: true,\n semantics: [{ ...SKU_PRESETS.PRODUCT_STANDARD }],\n })\n return prop\n}\n\n/**\n * Adds a price field to the specified entity with currency semantic.\n * If a price field already exists, it returns the existing field.\n * Otherwise, it creates a new price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'price'\n * - info.displayName: 'Price'\n * - required: true\n * - schema.maximum: 0\n *\n * @param entity The entity to which the price field will be added.\n * @param info Additional information about the field.\n * @returns The created price field.\n */\nexport function addPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'price', displayName: 'Price', ...info },\n type: 'number',\n required: true,\n schema: {\n maximum: 0,\n },\n bindings: [\n {\n type: 'web',\n schema: {\n dataType: 'float',\n },\n },\n ],\n semantics: [\n createCurrencySemantic({\n storageFormat: 'integer_cents',\n defaultCurrency: 'USD',\n decimalPlaces: 2,\n allowNegative: false,\n validateCurrencyCode: true,\n }),\n ],\n })\n return prop\n}\n\n/**\n * Adds a quantity field to the specified entity.\n * If a quantity field already exists, it returns the existing field.\n * Otherwise, it creates a new quantity field with validation.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'quantity'\n * - info.displayName: 'Quantity'\n * - required: true\n * - schema.minimum: 0\n *\n * @param entity The entity to which the quantity field will be added.\n * @param info Additional information about the field.\n * @returns The created quantity field.\n */\nexport function addQuantityField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findQuantityField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'quantity', displayName: 'Quantity', ...info },\n type: 'number',\n required: true,\n schema: {\n minimum: 0,\n },\n })\n return prop\n}\n\n/**\n * Adds a weight field to the specified entity.\n * If a weight field already exists, it returns the existing field.\n * Otherwise, it creates a new weight field.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'weight'\n * - info.displayName: 'Weight'\n *\n * @param entity The entity to which the weight field will be added.\n * @param info Additional information about the field.\n * @returns The created weight field.\n */\nexport function addWeightField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findWeightField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'weight', displayName: 'Weight', ...info },\n type: 'number',\n })\n return prop\n}\n\n/**\n * Adds an images field to the specified entity for multiple image URLs.\n * If an images field already exists, it returns the existing field.\n * Otherwise, it creates a new images field with ImageURL semantic.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'images'\n * - info.displayName: 'Images'\n * - multiple: true\n *\n * @param entity The entity to which the images field will be added.\n * @param info Additional information about the field.\n * @returns The created images field.\n */\nexport function addImagesField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findImagesField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'images', displayName: 'Images', ...info },\n type: 'string',\n multiple: true,\n semantics: [{ id: SemanticType.ImageURL }],\n })\n return prop\n}\n\n/**\n * Adds a status field with custom enum values to the specified entity.\n * This is not a regular enum field, it should represent a record status.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with provided enum values.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - required: true\n * - schema.enum: provided enum values\n * - schema.defaultValue: first enum value\n *\n * @param entity The entity to which the status field will be added.\n * @param enumValues Array of status values.\n * @param info Additional information about the field.\n * @returns The created status field.\n */\nexport function addCustomStatusField(\n entity: DomainEntity,\n enumValues: string[],\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n required: true,\n semantics: [createStatusSemantic()],\n schema: {\n enum: enumValues,\n defaultValue: {\n type: 'literal',\n value: enumValues[0],\n },\n },\n })\n return prop\n}\n\n/**\n * Adds a boolean field to the specified entity.\n * If the field already exists, it returns the existing field.\n * Otherwise, it creates a new boolean field with default value.\n *\n * Set properties:\n * - type: 'boolean'\n * - required: true\n * - schema.defaultValue: provided default or 'false'\n *\n * @param entity The entity to which the boolean field will be added.\n * @param fieldName Name of the boolean field.\n * @param defaultValue Default boolean value.\n * @param info Additional information about the field.\n * @returns The created boolean field.\n */\nexport function addBooleanField(\n entity: DomainEntity,\n fieldName: string,\n defaultValue = 'false',\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findBooleanField(entity, fieldName, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: fieldName, ...info },\n type: 'boolean',\n required: true,\n schema: {\n defaultValue: {\n type: 'literal',\n value: defaultValue,\n },\n },\n })\n return prop\n}\n\n/**\n * Adds a session ID field to the specified entity.\n * If a session ID field already exists, it returns the existing field.\n * Otherwise, it creates a new session ID field.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sessionId'\n * - info.displayName: 'Session ID'\n *\n * @param entity The entity to which the session ID field will be added.\n * @param info Additional information about the field.\n * @returns The created session ID field.\n */\nexport function addSessionIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSessionIdField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sessionId', displayName: 'Session ID', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds an expiration datetime field to the specified entity.\n * If an expiration field already exists, it returns the existing field.\n * Otherwise, it creates a new expiration field.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'expiresAt'\n * - info.displayName: 'Expires At'\n *\n * @param entity The entity to which the expiration field will be added.\n * @param info Additional information about the field.\n * @returns The created expiration field.\n */\nexport function addExpiresAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findExpiresAtField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'expiresAt', displayName: 'Expires At', ...info },\n type: 'datetime',\n })\n return prop\n}\n\n/**\n * Adds a unit price field to the specified entity with currency semantic.\n * If a unit price field already exists, it returns the existing field.\n * Otherwise, it creates a new unit price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'unitPrice'\n * - info.displayName: 'Unit Price'\n * - required: true\n *\n * @param entity The entity to which the unit price field will be added.\n * @param info Additional information about the field.\n * @returns The created unit price field.\n */\nexport function addUnitPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUnitPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'unitPrice', displayName: 'Unit Price', ...info },\n type: 'number',\n required: true,\n semantics: [\n createCurrencySemantic({\n storageFormat: 'integer_cents',\n defaultCurrency: 'USD',\n decimalPlaces: 2,\n allowNegative: false,\n }),\n ],\n })\n return prop\n}\n\n/**\n * Adds a currency amount field (subtotal, tax, shipping, etc.).\n */\nexport function addCurrencyAmountField(\n entity: DomainEntity,\n fieldName: string,\n displayName: string,\n info: Partial<IThing> = {}\n): DomainProperty {\n return entity.addProperty({\n info: {\n name: fieldName,\n displayName,\n ...info,\n },\n type: 'number',\n required: true,\n semantics: [\n createCurrencySemantic({\n storageFormat: 'integer_cents',\n defaultCurrency: 'USD',\n decimalPlaces: 2,\n allowNegative: false,\n }),\n ],\n })\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field property or undefined.\n */\nfunction findPropertyField(\n entity: DomainEntity,\n predicate: (property: DomainProperty) => boolean,\n direct = false\n): DomainProperty | undefined {\n for (const property of entity.properties) {\n if (predicate(property)) {\n return property\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const property of parent.properties) {\n if (predicate(property)) {\n return property\n }\n }\n }\n return undefined\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field association or undefined.\n */\nfunction findAssociationField(\n entity: DomainEntity,\n predicate: (property: DomainAssociation) => boolean,\n direct = false\n): DomainAssociation | undefined {\n for (const assoc of entity.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const assoc of parent.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n }\n return undefined\n}\n\n/**\n * Searches for the ID field in the given entity.\n * @param entity The entity to search for the ID field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found ID field property or undefined.\n */\nfunction findIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n if (!direct) {\n // Find the primary key property in the entity, which can be inherited or defined on the entity itself.\n return entity.primaryKey()\n }\n for (const property of entity.properties) {\n if (property.primary) {\n return property\n }\n }\n}\n\n/**\n * Searches for the email field in the given entity.\n * @param entity The entity to search for the email field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found email field property or undefined.\n */\nfunction findEmailField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Email), direct)\n}\n\n/**\n * Searches for the password field in the given entity.\n * @param entity The entity to search for the password field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found password field property or undefined.\n */\nfunction findPasswordField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Password), direct)\n}\n\nfunction findVersionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.Version)\n },\n direct\n )\n}\n\nfunction findNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Title), direct)\n}\n\nfunction findDescriptionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Description), direct)\n}\n\nfunction findStatusField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Status), direct)\n}\n\nfunction findOwnerField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['owner', 'author'].includes(association.info.name || ''),\n direct\n )\n}\n\n// function findCreatedByField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n// return findField(entity, (property) => property.hasSemantic(SemanticType.CreatedTimestamp), direct)\n// }\n\nfunction findUpdatedByField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['updated_by', 'updatedBy'].includes(association.info.name || ''),\n direct\n )\n}\n\nfunction findCreatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.CreatedTimestamp)\n },\n direct\n )\n}\n\nfunction findUpdatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.UpdatedTimestamp)\n },\n direct\n )\n}\n\nfunction findDeletedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.DeletedTimestamp)\n },\n direct\n )\n}\n\nfunction findIsDeletedField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.DeletedFlag), direct)\n}\n\nexport function addRecommendedFields(entity: DomainEntity): DomainElement[] {\n const fields: DomainElement[] = []\n if (!findIdField(entity)) {\n fields.push(addIdField(entity))\n }\n // The version field is not always recommended, so we don't add it by default.\n // if (!findVersionField(entity)) {\n // fields.push(addVersionField(entity))\n // }\n if (!findCreatedAtField(entity)) {\n fields.push(addCreatedAtField(entity))\n }\n // if (!findCreatedByField(entity)) {\n // fields.push(addCreatedByField(entity))\n // }\n if (!findUpdatedAtField(entity)) {\n fields.push(addUpdatedAtField(entity))\n }\n if (!findUpdatedByField(entity)) {\n fields.push(addUpdatedByField(entity))\n }\n if (!findDeletedAtField(entity)) {\n fields.push(addDeletedAtField(entity))\n }\n if (!findIsDeletedField(entity)) {\n fields.push(addIsDeletedField(entity))\n }\n return fields\n}\n\nfunction findFirstNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['first_name', 'firstName'].includes(property.info.name || ''), direct)\n}\n\nfunction findLastNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['last_name', 'lastName'].includes(property.info.name || ''), direct)\n}\n\n// Avatar URL has the `SemanticType.ImageURL` semantic, but it can be used for any image URL.\n// It is not a specific semantic, but it is a common field in many entities.\nfunction findAvatarUrlField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['avatar_url', 'avatarUrl'].includes(property.info.name || ''), direct)\n}\n\nfunction findPhoneField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Phone), direct)\n}\n\nfunction findPublicUniqueNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PublicUniqueName), direct)\n}\n\nfunction findSkuField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.SKU), direct)\n}\n\nfunction findPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) =>\n ['price', 'unitPrice', 'totalPrice'].includes(property.info.name || '') &&\n property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findQuantityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => ['quantity', 'stock', 'amount'].includes(property.info.name || '') && property.type === 'number',\n direct\n )\n}\n\nfunction findWeightField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'weight' && property.type === 'number', direct)\n}\n\nfunction findImagesField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'images' && property.hasSemantic(SemanticType.ImageURL),\n direct\n )\n}\n\nfunction findBooleanField(entity: DomainEntity, fieldName: string, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === fieldName && property.type === 'boolean',\n direct\n )\n}\n\nfunction findSessionIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'sessionId', direct)\n}\n\nfunction findUnitPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'unitPrice' && property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findExpiresAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'expiresAt' && property.type === 'datetime',\n direct\n )\n}\n"]}
|
|
1
|
+
{"version":3,"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AAC,IAAI,KAAK,SAAS,EAC7E,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,MAAM,CAAC,CAAA;AAC5F,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CACtB,MAAM,EACN,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,CAAC,EAC/F,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAoB,EAAE,MAAM,GAAG,KAAK;IAC9D,OAAO,iBAAiB,CACtB,MAAM,EACN,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAChF,MAAM,CACP,CAAA;AACH,CAAC","sourcesContent":["import type { DomainEntity } from '../DomainEntity.js'\nimport type { DomainElement } from '../DomainElement.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { IThing } from '../../models/Thing.js'\nimport { SemanticType } from '../Semantics.js'\nimport { createEmailSemantic, DEFAULT_EMAIL_CONFIG } from '../definitions/Email.js'\nimport { createPasswordSemantic, DEFAULT_PASSWORD_CONFIG } from '../definitions/Password.js'\nimport { createPhoneSemantic } from '../definitions/Phone.js'\nimport { createPublicUniqueNameSemantic, DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG } from '../definitions/PublicUniqueName.js'\nimport { createDescriptionSemantic } from '../definitions/Description.js'\nimport { CURRENCY_PRESETS } from '../definitions/Currency.js'\nimport { createStatusSemantic } from '../definitions/Status.js'\nimport { SKU_PRESETS } from '../definitions/SKU.js'\n\n/**\n * Adds a field to the given entity that is automatically generated by the system.\n *\n * @param entity The entity to which the auto field will be added.\n * @param autoField The name of the auto field to add.\n * @returns The added DomainElement representing the auto field.\n * @throws Error if the auto field is not supported.\n */\nexport function addAutoField(entity: DomainEntity, autoField: string): DomainElement {\n switch (autoField) {\n case 'id':\n return addIdField(entity)\n case 'email':\n return addEmailField(entity)\n case 'name':\n return addNameField(entity)\n case 'description':\n return addDescriptionField(entity)\n case 'status':\n return addStatusField(entity)\n case 'version':\n return addVersionField(entity)\n case 'owner':\n return addOwnerField(entity)\n case 'created':\n return addCreatedAtField(entity)\n // case 'created-by':\n // return addCreatedByField(entity)\n case 'updated':\n return addUpdatedAtField(entity)\n case 'updated-by':\n return addUpdatedByField(entity)\n case 'is-deleted':\n return addIsDeletedField(entity)\n case 'deleted':\n return addDeletedAtField(entity)\n case 'first-name':\n return addFirstNameField(entity)\n case 'last-name':\n return addLastNameField(entity)\n case 'phone':\n return addPhoneField(entity)\n case 'avatar-url':\n return addAvatarUrlField(entity)\n case 'public-unique-name':\n return addPublicUniqueNameField(entity)\n case 'price':\n return addPriceField(entity)\n case 'sku':\n return addSkuField(entity)\n case 'quantity':\n return addQuantityField(entity)\n case 'weight':\n return addWeightField(entity)\n case 'images':\n return addImagesField(entity)\n case 'session-id':\n return addSessionIdField(entity)\n case 'expires-at':\n return addExpiresAtField(entity)\n case 'unit-price':\n return addUnitPriceField(entity)\n default:\n throw new Error(`Unsupported auto field: ${autoField}`)\n }\n}\n\n/**\n * Adds the primary field (ID) to the given entity.\n * If the ID field already exists, it returns the existing field.\n * Otherwise, it creates a new ID field with a name based on the entity's name.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'id'\n * - primary: true\n * - readOnly: true\n * - schema.defaultValue: { type: 'function', value: 'uuid-v4' }\n *\n * @param entity The entity to which the ID field will be added.\n * @returns The added primary field property.\n */\nexport function addIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findIdField(entity, true)\n if (existing) {\n // If the ID field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: `id`, ...info },\n primary: true,\n readOnly: true,\n // I don't think we need to index the ID field..\n // index: true,\n type: 'string',\n // @TODO: We should experiment with the random ID generation using the nano library.\n schema: { defaultValue: { type: 'function', value: 'uuid-v4' } },\n })\n return prop\n}\n\n/**\n * Adds an email field to the given entity.\n * If the email field already exists, it returns the existing field.\n * Otherwise, it creates a new email field with a semantic annotation.\n * @param entity The entity to which the email field will be added.\n * @returns The added email field property.\n */\nexport function addEmailField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findEmailField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'email', displayName: 'Email Address', ...info },\n type: 'string',\n required: true,\n index: true,\n })\n prop.addSemantic(createEmailSemantic(DEFAULT_EMAIL_CONFIG))\n return prop\n}\n\n/**\n * Adds a password field to the given entity.\n * If the password field already exists, it returns the existing field.\n * Otherwise, it creates a new password field with a semantic annotation.\n * @param entity The entity to which the password field will be added.\n * @param info Additional information for the password field.\n * @returns The added password field property.\n */\nexport function addPasswordField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findPasswordField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'password', displayName: 'Password', ...info },\n type: 'string',\n required: true,\n })\n prop.addSemantic(createPasswordSemantic(DEFAULT_PASSWORD_CONFIG))\n return prop\n}\n\n/**\n * Adds a version field to the given entity.\n * @param entity The entity to which the version field will be added.\n * The version field is used to track the version of the entity.\n * @returns The added version field property.\n */\nexport function addVersionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findVersionField(entity, true)\n if (existing) {\n // If the version field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'version', displayName: 'Version', ...info },\n readOnly: true,\n index: true,\n type: 'number',\n schema: { defaultValue: { type: 'function', value: 'incremental' }, minimum: 0 },\n })\n prop.addSemantic({\n id: SemanticType.Version,\n })\n return prop\n}\n\nexport function addNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'name', displayName: 'Name', ...info },\n type: 'string',\n })\n prop.addSemantic({\n id: SemanticType.Title,\n })\n return prop\n}\n\n/**\n * Adds a description field to the specified entity.\n * If a description field already exists, it returns the existing field.\n * Otherwise, it creates a new description field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'description'\n * - info.displayName: 'Description'\n *\n * Set semantics:\n * - `SemanticType.Description`\n *\n * @param entity The entity to which the description field will be added.\n * @returns The added description field property.\n */\nexport function addDescriptionField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findDescriptionField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'description', displayName: 'Description', ...info },\n type: 'string',\n })\n prop.addSemantic(createDescriptionSemantic())\n return prop\n}\n\n/**\n * Adds a status field to the specified entity.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - schema.enum: ['Active', 'Draft', 'Archived']\n * - schema.defaultValue: { type: 'literal', value: 'Draft' }\n *\n * Set semantics:\n * - `SemanticType.Status`\n *\n * @param entity The entity to which the status field will be added.\n * @param info Additional information about the field.\n * @returns The added status field property.\n */\nexport function addStatusField(entity: DomainEntity, info: Partial<IThing> = {}): DomainElement {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n schema: {\n enum: ['Active', 'Draft', 'Archived'],\n defaultValue: { type: 'literal', value: 'Draft' },\n },\n })\n prop.addSemantic({\n id: SemanticType.Status,\n })\n return prop\n}\n\n/**\n * Adds an owner field to the specified entity.\n * If an owner field already exists, it returns the existing field.\n * Otherwise, it creates a new owner field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'owner'\n * - info.displayName: 'Owner'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the owner field will be added.\n * @param info Additional information about the field.\n * @returns The added owner field property.\n */\nexport function addOwnerField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findOwnerField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation(\n {},\n {\n info: { name: 'owner', displayName: 'Owner', ...info },\n required: true,\n }\n )\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n// This is owner with different name. Use that one instead.\n// function addCreatedByField(entity: DomainEntity): DomainElement {\n// const existing = findCreatedByField(entity, true)\n// if (existing) {\n// return existing\n// }\n// const prop = entity.addProperty({\n// info: { name: 'created_by', displayName: 'Created By' },\n// type: 'string',\n// readOnly: true,\n// index: true,\n// })\n// prop.addSemantic({\n// id: SemanticType.CreatedTimestamp,\n// })\n// return prop\n// }\n\n/**\n * Adds an updated by field to the specified entity as an association to the User entity.\n * If an updated by field already exists, it returns the existing field.\n * Otherwise, it creates a new updated by field with the specified information.\n *\n * Set properties:\n * - info.name: 'updated_by'\n * - info.displayName: 'Updated By'\n * - required: true\n *\n * Set semantics:\n * - `SemanticType.ResourceOwnerIdentifier`\n *\n * @param entity The entity to which the updated by field will be added.\n * @param info Additional information about the field.\n * @returns The added updated by field property.\n */\nexport function addUpdatedByField(entity: DomainEntity, info: Partial<IThing> = {}): DomainAssociation {\n const existing = findUpdatedByField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addAssociation(\n {},\n {\n info: { name: 'updated_by', displayName: 'Updated By', ...info },\n required: true,\n }\n )\n prop.addSemantic({\n id: SemanticType.ResourceOwnerIdentifier,\n })\n return prop\n}\n\n/**\n * Adds a created at field to the specified entity.\n * If a created at field already exists, it returns the existing field.\n * Otherwise, it creates a new created at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'created_at'\n * - info.displayName: 'Created At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `CreatedTimestamp`\n *\n * @param entity The entity to which the created at field will be added.\n * @param info Additional information about the field.\n * @returns The created created at field.\n */\nexport function addCreatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findCreatedAtField(entity, true)\n if (existing) {\n // If the created_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'created_at', displayName: 'Created At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.CreatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an updated at field to the specified entity.\n * If an updated at field already exists, it returns the existing field.\n * Otherwise, it creates a new updated at field with the specified information.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'updated_at'\n * - info.displayName: 'Updated At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `UpdatedTimestamp`\n *\n * @param entity The entity to which the updated at field will be added.\n * @param info Additional information about the field.\n * @returns The created updated at field.\n */\nexport function addUpdatedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUpdatedAtField(entity, true)\n if (existing) {\n // If the updated_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'updated_at', displayName: 'Updated At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.UpdatedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds a deleted at field to the specified entity.\n * If a deleted at field already exists, it returns the existing field.\n * Otherwise, it creates a new deleted at field with the specified information.\n *\n * Set properties:\n * - required: true\n * - type: 'datetime'\n * - info.name: 'deleted_at'\n * - info.displayName: 'Deleted At'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'function', value: 'now' }\n *\n * Set semantics:\n * - `SemanticType.DeletedTimestamp`\n *\n * @param entity The entity to which the deleted_at field will be added.\n * @param info Additional information about the field.\n * @returns The added deleted at field property.\n */\nexport function addDeletedAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findDeletedAtField(entity, true)\n if (existing) {\n // If the deleted_at field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'deleted_at', displayName: 'Deleted At', ...info },\n readOnly: true,\n index: true,\n type: 'datetime',\n schema: { defaultValue: { type: 'function', value: 'now' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedTimestamp,\n })\n return prop\n}\n\n/**\n * Adds an is_deleted field to the specified entity.\n * If an is_deleted field already exists, it returns the existing field.\n * Otherwise, it creates a new is_deleted field with the specified information.\n *\n * Set properties:\n * - type: 'boolean'\n * - info.name: 'is_deleted'\n * - info.displayName: 'Is Deleted'\n * - readOnly: true\n * - index: true\n * - schema.defaultValue: { type: 'literal', value: 'false' }\n *\n * Set semantics:\n * - `SemanticType.DeletedFlag`\n *\n * @param entity The entity to which the is_deleted field will be added.\n * @param info Additional information about the field.\n * @returns The added is_deleted field property.\n */\nexport function addIsDeletedField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findIsDeletedField(entity, true)\n if (existing) {\n // If the is_deleted field already exists, return it.\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'is_deleted', displayName: 'Is Deleted', ...info },\n readOnly: true,\n index: true,\n type: 'boolean',\n schema: { defaultValue: { type: 'literal', value: 'false' } },\n })\n prop.addSemantic({\n id: SemanticType.DeletedFlag,\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addFirstNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findFirstNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'first_name', displayName: 'First Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a first name field to the specified entity.\n * If a first name field already exists, it returns the existing field.\n * Otherwise, it creates a new first name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'first_name'\n * - info.displayName: 'First Name'\n *\n * @param entity The entity to which the first name field will be added.\n * @param info Additional information about the field.\n * @returns The created first name field.\n */\nexport function addLastNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findLastNameField(entity)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'last_name', displayName: 'Last Name', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds a phone field to the specified entity.\n * If a phone field already exists, it returns the existing field.\n * Otherwise, it creates a new phone field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'phone'\n * - info.displayName: 'Phone Number'\n * - index: true (to search by phone number)\n *\n * Set semantics:\n * - id: SemanticType.Phone\n *\n * @param entity The entity to which the phone field will be added.\n * @param info Additional information about the field.\n * @returns The created phone field.\n */\nexport function addPhoneField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPhoneField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'phone', displayName: 'Phone Number', ...info },\n type: 'string',\n index: true,\n })\n prop.addSemantic(\n createPhoneSemantic({\n format: 'international',\n requireCountryCode: true,\n requireVerification: true,\n verificationMethod: 'sms',\n })\n )\n return prop\n}\n\n/**\n * Adds an avatar URL field to the specified entity.\n * If an avatar URL field already exists, it returns the existing field.\n * Otherwise, it creates a new avatar URL field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'avatar_url'\n * - info.displayName: 'Avatar URL'\n *\n * Set semantics:\n * - id: SemanticType.ImageURL\n *\n * @param entity The entity to which the avatar URL field will be added.\n * @param info Additional information about the field.\n * @returns The created avatar URL field.\n */\nexport function addAvatarUrlField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findAvatarUrlField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'avatar_url', displayName: 'Avatar URL', ...info },\n type: 'string',\n })\n prop.addSemantic({ id: SemanticType.ImageURL })\n return prop\n}\n\n/**\n * Adds a public unique name (slug) field to the specified entity.\n * If a public unique name field already exists, it returns the existing field.\n * Otherwise, it creates a new public unique name field with the specified information.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'slug'\n * - info.displayName: 'Public Unique Name'\n * - index: true\n * - required: true\n * - unique: true\n *\n * Set semantics:\n * - id: SemanticType.PublicUniqueName\n *\n * @param entity The entity to which the public unique name field will be added.\n * @param info Additional information about the field.\n * @returns The created public unique name field.\n */\nexport function addPublicUniqueNameField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPublicUniqueNameField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'slug', displayName: 'Public Unique Name', ...info },\n type: 'string',\n index: true,\n required: true,\n unique: true,\n })\n prop.addSemantic(createPublicUniqueNameSemantic(DEFAULT_PUBLIC_UNIQUE_NAME_CONFIG))\n return prop\n}\n\n/**\n * Adds a SKU field to the specified entity.\n * If a SKU field already exists, it returns the existing field.\n * Otherwise, it creates a new SKU field with semantic annotation.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sku'\n * - info.displayName: 'SKU'\n * - required: true\n * - unique: true\n *\n * @param entity The entity to which the SKU field will be added.\n * @param info Additional information about the field.\n * @returns The created SKU field.\n */\nexport function addSkuField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSkuField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sku', displayName: 'SKU', ...info },\n type: 'string',\n required: true,\n unique: true,\n })\n prop.addSemantic({ ...SKU_PRESETS.PRODUCT_STANDARD })\n return prop\n}\n\n/**\n * Adds a price field to the specified entity with currency semantic.\n * If a price field already exists, it returns the existing field.\n * Otherwise, it creates a new price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'price'\n * - info.displayName: 'Price'\n * - required: true\n * - schema.maximum: 0\n *\n * @param entity The entity to which the price field will be added.\n * @param info Additional information about the field.\n * @returns The created price field.\n */\nexport function addPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'price', displayName: 'Price', ...info },\n type: 'number',\n required: true,\n schema: {\n maximum: 0,\n },\n bindings: [\n {\n type: 'web',\n schema: {\n dataType: 'float',\n },\n },\n ],\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a quantity field to the specified entity.\n * If a quantity field already exists, it returns the existing field.\n * Otherwise, it creates a new quantity field with validation.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'quantity'\n * - info.displayName: 'Quantity'\n * - required: true\n * - schema.minimum: 0\n *\n * @param entity The entity to which the quantity field will be added.\n * @param info Additional information about the field.\n * @returns The created quantity field.\n */\nexport function addQuantityField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findQuantityField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'quantity', displayName: 'Quantity', ...info },\n type: 'number',\n required: true,\n schema: {\n minimum: 0,\n },\n })\n return prop\n}\n\n/**\n * Adds a weight field to the specified entity.\n * If a weight field already exists, it returns the existing field.\n * Otherwise, it creates a new weight field.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'weight'\n * - info.displayName: 'Weight'\n *\n * @param entity The entity to which the weight field will be added.\n * @param info Additional information about the field.\n * @returns The created weight field.\n */\nexport function addWeightField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findWeightField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'weight', displayName: 'Weight', ...info },\n type: 'number',\n })\n return prop\n}\n\n/**\n * Adds an images field to the specified entity for multiple image URLs.\n * If an images field already exists, it returns the existing field.\n * Otherwise, it creates a new images field with ImageURL semantic.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'images'\n * - info.displayName: 'Images'\n * - multiple: true\n *\n * @param entity The entity to which the images field will be added.\n * @param info Additional information about the field.\n * @returns The created images field.\n */\nexport function addImagesField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findImagesField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'images', displayName: 'Images', ...info },\n type: 'string',\n multiple: true,\n })\n prop.addSemantic({\n id: SemanticType.ImageURL,\n })\n return prop\n}\n\n/**\n * Adds a status field with custom enum values to the specified entity.\n * This is not a regular enum field, it should represent a record status.\n * If a status field already exists, it returns the existing field.\n * Otherwise, it creates a new status field with provided enum values.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'status'\n * - info.displayName: 'Status'\n * - required: true\n * - schema.enum: provided enum values\n * - schema.defaultValue: first enum value\n *\n * @param entity The entity to which the status field will be added.\n * @param enumValues Array of status values.\n * @param info Additional information about the field.\n * @returns The created status field.\n */\nexport function addCustomStatusField(\n entity: DomainEntity,\n enumValues: string[],\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findStatusField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'status', displayName: 'Status', ...info },\n type: 'string',\n required: true,\n schema: {\n enum: enumValues,\n defaultValue: {\n type: 'literal',\n value: enumValues[0],\n },\n },\n })\n prop.addSemantic(createStatusSemantic())\n return prop\n}\n\n/**\n * Adds a boolean field to the specified entity.\n * If the field already exists, it returns the existing field.\n * Otherwise, it creates a new boolean field with default value.\n *\n * Set properties:\n * - type: 'boolean'\n * - required: true\n * - schema.defaultValue: provided default or 'false'\n *\n * @param entity The entity to which the boolean field will be added.\n * @param fieldName Name of the boolean field.\n * @param defaultValue Default boolean value.\n * @param info Additional information about the field.\n * @returns The created boolean field.\n */\nexport function addBooleanField(\n entity: DomainEntity,\n fieldName: string,\n defaultValue = 'false',\n info: Partial<IThing> = {}\n): DomainProperty {\n const existing = findBooleanField(entity, fieldName, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: fieldName, ...info },\n type: 'boolean',\n required: true,\n schema: {\n defaultValue: {\n type: 'literal',\n value: defaultValue,\n },\n },\n })\n return prop\n}\n\n/**\n * Adds a session ID field to the specified entity.\n * If a session ID field already exists, it returns the existing field.\n * Otherwise, it creates a new session ID field.\n *\n * Set properties:\n * - type: 'string'\n * - info.name: 'sessionId'\n * - info.displayName: 'Session ID'\n *\n * @param entity The entity to which the session ID field will be added.\n * @param info Additional information about the field.\n * @returns The created session ID field.\n */\nexport function addSessionIdField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findSessionIdField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'sessionId', displayName: 'Session ID', ...info },\n type: 'string',\n })\n return prop\n}\n\n/**\n * Adds an expiration datetime field to the specified entity.\n * If an expiration field already exists, it returns the existing field.\n * Otherwise, it creates a new expiration field.\n *\n * Set properties:\n * - type: 'datetime'\n * - info.name: 'expiresAt'\n * - info.displayName: 'Expires At'\n *\n * @param entity The entity to which the expiration field will be added.\n * @param info Additional information about the field.\n * @returns The created expiration field.\n */\nexport function addExpiresAtField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findExpiresAtField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'expiresAt', displayName: 'Expires At', ...info },\n type: 'datetime',\n })\n return prop\n}\n\n/**\n * Adds a unit price field to the specified entity with currency semantic.\n * If a unit price field already exists, it returns the existing field.\n * Otherwise, it creates a new unit price field with proper currency handling.\n *\n * Set properties:\n * - type: 'number'\n * - info.name: 'unitPrice'\n * - info.displayName: 'Unit Price'\n * - required: true\n *\n * @param entity The entity to which the unit price field will be added.\n * @param info Additional information about the field.\n * @returns The created unit price field.\n */\nexport function addUnitPriceField(entity: DomainEntity, info: Partial<IThing> = {}): DomainProperty {\n const existing = findUnitPriceField(entity, true)\n if (existing) {\n return existing\n }\n const prop = entity.addProperty({\n info: { name: 'unitPrice', displayName: 'Unit Price', ...info },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Adds a currency amount field (subtotal, tax, shipping, etc.).\n */\nexport function addCurrencyAmountField(\n entity: DomainEntity,\n fieldName: string,\n displayName: string,\n info: Partial<IThing> = {}\n): DomainProperty {\n const prop = entity.addProperty({\n info: {\n name: fieldName,\n displayName,\n ...info,\n },\n type: 'number',\n required: true,\n })\n prop.addSemantic({ ...CURRENCY_PRESETS.USD_CENTS })\n return prop\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field property or undefined.\n */\nfunction findPropertyField(\n entity: DomainEntity,\n predicate: (property: DomainProperty) => boolean,\n direct = false\n): DomainProperty | undefined {\n for (const property of entity.properties) {\n if (predicate(property)) {\n return property\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const property of parent.properties) {\n if (predicate(property)) {\n return property\n }\n }\n }\n return undefined\n}\n\n/**\n * Finds a field in the given entity that matches the specified predicate.\n * @param entity The entity to search within.\n * @param predicate A function that defines the search criteria.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found field association or undefined.\n */\nfunction findAssociationField(\n entity: DomainEntity,\n predicate: (property: DomainAssociation) => boolean,\n direct = false\n): DomainAssociation | undefined {\n for (const assoc of entity.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n if (direct) {\n return undefined\n }\n for (const parent of entity.listParents()) {\n // we can't call a recursive function here because it would scan vertically through the hierarchy\n // and not horizontally through all parents. We need to check each **direct** parent separately,\n // and then move up.\n for (const assoc of parent.associations) {\n if (predicate(assoc)) {\n return assoc\n }\n }\n }\n return undefined\n}\n\n/**\n * Searches for the ID field in the given entity.\n * @param entity The entity to search for the ID field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found ID field property or undefined.\n */\nfunction findIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n if (!direct) {\n // Find the primary key property in the entity, which can be inherited or defined on the entity itself.\n return entity.primaryKey()\n }\n for (const property of entity.properties) {\n if (property.primary) {\n return property\n }\n }\n}\n\n/**\n * Searches for the email field in the given entity.\n * @param entity The entity to search for the email field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found email field property or undefined.\n */\nfunction findEmailField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Email), direct)\n}\n\n/**\n * Searches for the password field in the given entity.\n * @param entity The entity to search for the password field.\n * @param direct Whether to search only the direct properties of the entity.\n * @returns The found password field property or undefined.\n */\nfunction findPasswordField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Password), direct)\n}\n\nfunction findVersionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.Version)\n },\n direct\n )\n}\n\nfunction findNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Title), direct)\n}\n\nfunction findDescriptionField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Description), direct)\n}\n\nfunction findStatusField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Status), direct)\n}\n\nfunction findOwnerField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['owner', 'author'].includes(association.info.name || ''),\n direct\n )\n}\n\n// function findCreatedByField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n// return findField(entity, (property) => property.hasSemantic(SemanticType.CreatedTimestamp), direct)\n// }\n\nfunction findUpdatedByField(entity: DomainEntity, direct = false): DomainAssociation | undefined {\n return findAssociationField(\n entity,\n (association) =>\n association.hasSemantic(SemanticType.ResourceOwnerIdentifier) &&\n ['updated_by', 'updatedBy'].includes(association.info.name || ''),\n direct\n )\n}\n\nfunction findCreatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.CreatedTimestamp)\n },\n direct\n )\n}\n\nfunction findUpdatedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.UpdatedTimestamp)\n },\n direct\n )\n}\n\nfunction findDeletedAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => {\n return property.hasSemantic(SemanticType.DeletedTimestamp)\n },\n direct\n )\n}\n\nfunction findIsDeletedField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.DeletedFlag), direct)\n}\n\nexport function addRecommendedFields(entity: DomainEntity): DomainElement[] {\n const fields: DomainElement[] = []\n if (!findIdField(entity)) {\n fields.push(addIdField(entity))\n }\n // The version field is not always recommended, so we don't add it by default.\n // if (!findVersionField(entity)) {\n // fields.push(addVersionField(entity))\n // }\n if (!findCreatedAtField(entity)) {\n fields.push(addCreatedAtField(entity))\n }\n // if (!findCreatedByField(entity)) {\n // fields.push(addCreatedByField(entity))\n // }\n if (!findUpdatedAtField(entity)) {\n fields.push(addUpdatedAtField(entity))\n }\n if (!findUpdatedByField(entity)) {\n fields.push(addUpdatedByField(entity))\n }\n if (!findDeletedAtField(entity)) {\n fields.push(addDeletedAtField(entity))\n }\n if (!findIsDeletedField(entity)) {\n fields.push(addIsDeletedField(entity))\n }\n return fields\n}\n\nfunction findFirstNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['first_name', 'firstName'].includes(property.info.name || ''), direct)\n}\n\nfunction findLastNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['last_name', 'lastName'].includes(property.info.name || ''), direct)\n}\n\n// Avatar URL has the `SemanticType.ImageURL` semantic, but it can be used for any image URL.\n// It is not a specific semantic, but it is a common field in many entities.\nfunction findAvatarUrlField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => ['avatar_url', 'avatarUrl'].includes(property.info.name || ''), direct)\n}\n\nfunction findPhoneField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Phone), direct)\n}\n\nfunction findPublicUniqueNameField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PublicUniqueName), direct)\n}\n\nfunction findSkuField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.SKU), direct)\n}\n\nfunction findPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) =>\n ['price', 'unitPrice', 'totalPrice'].includes(property.info.name || '') &&\n property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findQuantityField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => ['quantity', 'stock', 'amount'].includes(property.info.name || '') && property.type === 'number',\n direct\n )\n}\n\nfunction findWeightField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'weight' && property.type === 'number', direct)\n}\n\nfunction findImagesField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'images' && property.hasSemantic(SemanticType.ImageURL),\n direct\n )\n}\n\nfunction findBooleanField(entity: DomainEntity, fieldName: string, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === fieldName && property.type === 'boolean',\n direct\n )\n}\n\nfunction findSessionIdField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(entity, (property) => property.info.name === 'sessionId', direct)\n}\n\nfunction findUnitPriceField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'unitPrice' && property.hasSemantic(SemanticType.Currency),\n direct\n )\n}\n\nfunction findExpiresAtField(entity: DomainEntity, direct = false): DomainProperty | undefined {\n return findPropertyField(\n entity,\n (property) => property.info.name === 'expiresAt' && property.type === 'datetime',\n direct\n )\n}\n"]}
|