@api-client/core 0.18.53 → 0.18.55

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.
Files changed (32) hide show
  1. package/build/src/modeling/Semantics.d.ts +32 -5
  2. package/build/src/modeling/Semantics.d.ts.map +1 -1
  3. package/build/src/modeling/Semantics.js +129 -5
  4. package/build/src/modeling/Semantics.js.map +1 -1
  5. package/build/src/modeling/definitions/Country.d.ts +38 -0
  6. package/build/src/modeling/definitions/Country.d.ts.map +1 -0
  7. package/build/src/modeling/definitions/Country.js +22 -0
  8. package/build/src/modeling/definitions/Country.js.map +1 -0
  9. package/build/src/modeling/definitions/PostalCode.d.ts +48 -0
  10. package/build/src/modeling/definitions/PostalCode.d.ts.map +1 -0
  11. package/build/src/modeling/definitions/PostalCode.js +22 -0
  12. package/build/src/modeling/definitions/PostalCode.js.map +1 -0
  13. package/build/src/modeling/helpers/Intelisense.d.ts +7 -0
  14. package/build/src/modeling/helpers/Intelisense.d.ts.map +1 -1
  15. package/build/src/modeling/helpers/Intelisense.js +135 -0
  16. package/build/src/modeling/helpers/Intelisense.js.map +1 -1
  17. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.d.ts.map +1 -1
  18. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js +10 -0
  19. package/build/src/modeling/templates/verticals/business-services/ecommerce-domain.js.map +1 -1
  20. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.d.ts.map +1 -1
  21. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js +14 -2
  22. package/build/src/modeling/templates/verticals/business-services/financial-services-domain.js.map +1 -1
  23. package/build/tsconfig.tsbuildinfo +1 -1
  24. package/data/models/example-generator-api.json +12 -12
  25. package/package.json +1 -1
  26. package/src/modeling/Semantics.ts +132 -5
  27. package/src/modeling/definitions/Country.ts +62 -0
  28. package/src/modeling/definitions/PostalCode.ts +70 -0
  29. package/src/modeling/helpers/Intelisense.ts +144 -0
  30. package/src/modeling/templates/verticals/business-services/ecommerce-domain.ts +10 -0
  31. package/src/modeling/templates/verticals/business-services/financial-services-domain.ts +15 -2
  32. package/tests/unit/modeling/helpers/intellisense.spec.ts +268 -0
@@ -0,0 +1,22 @@
1
+ import { SemanticType } from '../Semantics.js';
2
+ export const isCountrySemantic = (semantic) => {
3
+ return semantic.id === SemanticType.Country;
4
+ };
5
+ export const createCountrySemantic = (config = {}) => {
6
+ const mergedConfig = {
7
+ ...DEFAULT_COUNTRY_CONFIG,
8
+ ...config,
9
+ };
10
+ // Merge metadata separately
11
+ if (config.metadata) {
12
+ mergedConfig.metadata = { ...config.metadata };
13
+ }
14
+ return {
15
+ id: SemanticType.Country,
16
+ config: mergedConfig,
17
+ };
18
+ };
19
+ export const DEFAULT_COUNTRY_CONFIG = {
20
+ format: 'ISO_3166_Alpha_2',
21
+ };
22
+ //# sourceMappingURL=Country.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Country.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/Country.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAuC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAA6B,EAAsC,EAAE;IACrG,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,OAAO,CAAA;AAC7C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAwB,EAAE,EAA0B,EAAE;IAC1F,MAAM,YAAY,GAAG;QACnB,GAAG,sBAAsB;QACzB,GAAG,MAAM;KACV,CAAA;IACD,4BAA4B;IAC5B,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IACD,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,OAAO;QACxB,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAkB;IACnD,MAAM,EAAE,kBAAkB;CAC3B,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n\nexport type CountryFormat = 'ISO_3166_Alpha_2' | 'ISO_3166_Alpha_3' | 'Name'\n\nexport interface CountryConfig {\n /**\n * The format of the country code.\n *\n * @default 'Name'\n */\n format?: CountryFormat\n\n /**\n * The list of allowed countries.\n */\n allowedCountries?: string[]\n\n /**\n * The list of disallowed countries.\n */\n disallowedCountries?: string[]\n /**\n * Custom metadata for the country field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\n/**\n * Type-safe configuration for Country semantic.\n */\nexport interface AppliedCountrySemantic extends AppliedDataSemantic {\n id: SemanticType.Country\n config?: CountryConfig\n}\n\nexport const isCountrySemantic = (semantic: AppliedDataSemantic): semantic is AppliedCountrySemantic => {\n return semantic.id === SemanticType.Country\n}\n\nexport const createCountrySemantic = (config: CountryConfig = {}): AppliedCountrySemantic => {\n const mergedConfig = {\n ...DEFAULT_COUNTRY_CONFIG,\n ...config,\n }\n // Merge metadata separately\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n return {\n id: SemanticType.Country,\n config: mergedConfig,\n }\n}\n\nexport const DEFAULT_COUNTRY_CONFIG: CountryConfig = {\n format: 'ISO_3166_Alpha_2',\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import type { AppliedDataSemantic } from '../Semantics.js';
2
+ import { SemanticType } from '../Semantics.js';
3
+ /**
4
+ * Validation Logic Flow:
5
+ *
6
+ * When the API receives a POST or PATCH request, the following sequence occurs:
7
+ * 1. Semantic Trigger: The Runtime identifies a property with the PostalCode semantic and config.validate: true.
8
+ * 2. Country Lookup: The Runtime identifies the sibling property tagged with `SemanticType.Country`.
9
+ * 3. Regex Retrieval: The Runtime retrieves the appropriate regex pattern based on the country code.
10
+ * 4. Validation: The Runtime validates the postal code against the retrieved regex pattern.
11
+ * 5. Error Handling: If the validation fails, the Runtime returns a 400 Bad Request error with a descriptive message.
12
+ * - Example: "Invalid postal code format for country: [CountryCode]."
13
+ *
14
+ * Validation libraries:
15
+ * - https://www.npmjs.com/package/postcode-validator (MIT)
16
+ * - https://github.com/sashiksu/postal-code-checker (MIT)
17
+ */
18
+ export interface PostalCodeConfig {
19
+ /**
20
+ * Enables regex-based validation based on the value in the sibling property
21
+ * tagged with `SemanticType.Country`.
22
+ */
23
+ validate?: boolean;
24
+ /**
25
+ * The list of allowed postal codes.
26
+ */
27
+ allowedPostalCodes?: string[];
28
+ /**
29
+ * The list of disallowed postal codes.
30
+ */
31
+ disallowedPostalCodes?: string[];
32
+ /**
33
+ * Custom metadata for the postal code field.
34
+ */
35
+ metadata?: Record<string, unknown>;
36
+ /**
37
+ * Index signature to allow additional properties.
38
+ */
39
+ [key: string]: unknown;
40
+ }
41
+ export interface AppliedPostalCodeSemantic extends AppliedDataSemantic {
42
+ id: SemanticType.PostalCode;
43
+ config?: PostalCodeConfig;
44
+ }
45
+ export declare const DEFAULT_POSTAL_CODE_CONFIG: PostalCodeConfig;
46
+ export declare const isPostalCodeSemantic: (semantic: AppliedDataSemantic) => semantic is AppliedPostalCodeSemantic;
47
+ export declare const createPostalCodeSemantic: (config?: PostalCodeConfig) => AppliedPostalCodeSemantic;
48
+ //# sourceMappingURL=PostalCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostalCode.d.ts","sourceRoot":"","sources":["../../../../src/modeling/definitions/PostalCode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE7B;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,EAAE,EAAE,YAAY,CAAC,UAAU,CAAA;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED,eAAO,MAAM,0BAA0B,EAAE,gBAExC,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,UAAU,mBAAmB,KAAG,QAAQ,IAAI,yBAEhF,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,SAAQ,gBAAqB,KAAG,yBAaxE,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { SemanticType } from '../Semantics.js';
2
+ export const DEFAULT_POSTAL_CODE_CONFIG = {
3
+ validate: false,
4
+ };
5
+ export const isPostalCodeSemantic = (semantic) => {
6
+ return semantic.id === SemanticType.PostalCode;
7
+ };
8
+ export const createPostalCodeSemantic = (config = {}) => {
9
+ const mergedConfig = {
10
+ ...DEFAULT_POSTAL_CODE_CONFIG,
11
+ ...config,
12
+ };
13
+ // Merge metadata separately
14
+ if (config.metadata) {
15
+ mergedConfig.metadata = { ...config.metadata };
16
+ }
17
+ return {
18
+ id: SemanticType.PostalCode,
19
+ config: mergedConfig,
20
+ };
21
+ };
22
+ //# sourceMappingURL=PostalCode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostalCode.js","sourceRoot":"","sources":["../../../../src/modeling/definitions/PostalCode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA+C9C,MAAM,CAAC,MAAM,0BAA0B,GAAqB;IAC1D,QAAQ,EAAE,KAAK;CAChB,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAA6B,EAAyC,EAAE;IAC3G,OAAO,QAAQ,CAAC,EAAE,KAAK,YAAY,CAAC,UAAU,CAAA;AAChD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAA2B,EAAE,EAA6B,EAAE;IACnG,MAAM,YAAY,GAAG;QACnB,GAAG,0BAA0B;QAC7B,GAAG,MAAM;KACV,CAAA;IACD,4BAA4B;IAC5B,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,YAAY,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAA;IAChD,CAAC;IACD,OAAO;QACL,EAAE,EAAE,YAAY,CAAC,UAAU;QAC3B,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import type { AppliedDataSemantic } from '../Semantics.js'\nimport { SemanticType } from '../Semantics.js'\n/**\n * Validation Logic Flow:\n *\n * When the API receives a POST or PATCH request, the following sequence occurs:\n * 1. Semantic Trigger: The Runtime identifies a property with the PostalCode semantic and config.validate: true.\n * 2. Country Lookup: The Runtime identifies the sibling property tagged with `SemanticType.Country`.\n * 3. Regex Retrieval: The Runtime retrieves the appropriate regex pattern based on the country code.\n * 4. Validation: The Runtime validates the postal code against the retrieved regex pattern.\n * 5. Error Handling: If the validation fails, the Runtime returns a 400 Bad Request error with a descriptive message.\n * - Example: \"Invalid postal code format for country: [CountryCode].\"\n *\n * Validation libraries:\n * - https://www.npmjs.com/package/postcode-validator (MIT)\n * - https://github.com/sashiksu/postal-code-checker (MIT)\n */\nexport interface PostalCodeConfig {\n /**\n * Enables regex-based validation based on the value in the sibling property\n * tagged with `SemanticType.Country`.\n */\n validate?: boolean\n\n /**\n * The list of allowed postal codes.\n */\n allowedPostalCodes?: string[]\n\n /**\n * The list of disallowed postal codes.\n */\n disallowedPostalCodes?: string[]\n /**\n * Custom metadata for the postal code field.\n */\n metadata?: Record<string, unknown>\n /**\n * Index signature to allow additional properties.\n */\n [key: string]: unknown\n}\n\nexport interface AppliedPostalCodeSemantic extends AppliedDataSemantic {\n id: SemanticType.PostalCode\n config?: PostalCodeConfig\n}\n\nexport const DEFAULT_POSTAL_CODE_CONFIG: PostalCodeConfig = {\n validate: false,\n}\n\nexport const isPostalCodeSemantic = (semantic: AppliedDataSemantic): semantic is AppliedPostalCodeSemantic => {\n return semantic.id === SemanticType.PostalCode\n}\n\nexport const createPostalCodeSemantic = (config: PostalCodeConfig = {}): AppliedPostalCodeSemantic => {\n const mergedConfig = {\n ...DEFAULT_POSTAL_CODE_CONFIG,\n ...config,\n }\n // Merge metadata separately\n if (config.metadata) {\n mergedConfig.metadata = { ...config.metadata }\n }\n return {\n id: SemanticType.PostalCode,\n config: mergedConfig,\n }\n}\n"]}
@@ -53,6 +53,7 @@ export declare function addPasswordField(entity: DomainEntity, info?: Partial<IT
53
53
  */
54
54
  export declare function addVersionField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
55
55
  export declare function addNameField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
56
+ export declare function addDisplayNameField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
56
57
  /**
57
58
  * Adds a description field to the specified entity.
58
59
  * If a description field already exists, it returns the existing field.
@@ -191,6 +192,7 @@ export declare function addUpdatedAtField(entity: DomainEntity, info?: Partial<I
191
192
  * @returns The added deleted at field property.
192
193
  */
193
194
  export declare function addDeletedAtField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
195
+ export declare function addRoleField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
194
196
  /**
195
197
  * Adds an is_deleted field to the specified entity.
196
198
  * If an is_deleted field already exists, it returns the existing field.
@@ -470,4 +472,9 @@ export declare function addUnitPriceField(entity: DomainEntity, info?: Partial<I
470
472
  */
471
473
  export declare function addCurrencyAmountField(entity: DomainEntity, fieldName: string, displayName: string, info?: Partial<IThing>): DomainProperty;
472
474
  export declare function addRecommendedFields(entity: DomainEntity): DomainElement[];
475
+ export declare function addStreetAddressField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
476
+ export declare function addCityField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
477
+ export declare function addPostalCodeField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
478
+ export declare function addCountryField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
479
+ export declare function addRegionField(entity: DomainEntity, info?: Partial<IThing>): DomainProperty;
473
480
  //# sourceMappingURL=Intelisense.d.ts.map
@@ -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,cAAc,CAiB3F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAa9F;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAYjG;AAED;;;;;GAKG;AACH,wB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;AAMD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAWnG;AAMD,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAWhG;AAMD,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,GAAE,OAAO,CAAC,MAAM,CAAM,GAAG,cAAc,CAU/F"}
@@ -7,6 +7,8 @@ import { createDescriptionSemantic } from '../definitions/Description.js';
7
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
+ import { createCountrySemantic, DEFAULT_COUNTRY_CONFIG } from '../definitions/Country.js';
11
+ import { createPostalCodeSemantic, DEFAULT_POSTAL_CODE_CONFIG } from '../definitions/PostalCode.js';
10
12
  /**
11
13
  * Adds a field to the given entity that is automatically generated by the system.
12
14
  *
@@ -23,6 +25,8 @@ export function addAutoField(entity, autoField) {
23
25
  return addEmailField(entity);
24
26
  case 'name':
25
27
  return addNameField(entity);
28
+ case 'display-name':
29
+ return addDisplayNameField(entity);
26
30
  case 'description':
27
31
  return addDescriptionField(entity);
28
32
  case 'status':
@@ -43,6 +47,8 @@ export function addAutoField(entity, autoField) {
43
47
  return addIsDeletedField(entity);
44
48
  case 'deleted':
45
49
  return addDeletedAtField(entity);
50
+ case 'role':
51
+ return addRoleField(entity);
46
52
  case 'first-name':
47
53
  return addFirstNameField(entity);
48
54
  case 'last-name':
@@ -64,11 +70,25 @@ export function addAutoField(entity, autoField) {
64
70
  case 'images':
65
71
  return addImagesField(entity);
66
72
  case 'session-id':
73
+ // This was removed from the UI. We will not support session id configuration
74
+ // as the platform will handle it to separate the business logic from the transport layer.
67
75
  return addSessionIdField(entity);
68
76
  case 'expires-at':
77
+ // This was removed from the UI. We will not support expires at configuration
78
+ // as the platform will handle it to separate the business logic from the transport layer.
69
79
  return addExpiresAtField(entity);
70
80
  case 'unit-price':
71
81
  return addUnitPriceField(entity);
82
+ case 'street-address':
83
+ return addStreetAddressField(entity);
84
+ case 'city':
85
+ return addCityField(entity);
86
+ case 'postal-code':
87
+ return addPostalCodeField(entity);
88
+ case 'country':
89
+ return addCountryField(entity);
90
+ case 'region':
91
+ return addRegionField(entity);
72
92
  default:
73
93
  throw new Error(`Unsupported auto field: ${autoField}`);
74
94
  }
@@ -186,6 +206,20 @@ export function addNameField(entity, info = {}) {
186
206
  });
187
207
  return prop;
188
208
  }
209
+ export function addDisplayNameField(entity, info = {}) {
210
+ const existing = findDisplayNameField(entity, true);
211
+ if (existing) {
212
+ return existing;
213
+ }
214
+ const prop = entity.addProperty({
215
+ info: { name: 'display-name', displayName: 'Display Name', ...info },
216
+ type: 'string',
217
+ });
218
+ prop.addSemantic({
219
+ id: SemanticType.Name,
220
+ });
221
+ return prop;
222
+ }
189
223
  /**
190
224
  * Adds a description field to the specified entity.
191
225
  * If a description field already exists, it returns the existing field.
@@ -446,6 +480,23 @@ export function addDeletedAtField(entity, info = {}) {
446
480
  });
447
481
  return prop;
448
482
  }
483
+ export function addRoleField(entity, info = {}) {
484
+ const existing = findRoleField(entity, true);
485
+ if (existing) {
486
+ return existing;
487
+ }
488
+ const prop = entity.addProperty({
489
+ info: { name: 'role', displayName: 'Role', ...info },
490
+ type: 'string',
491
+ required: true,
492
+ index: true,
493
+ schema: { defaultValue: { type: 'literal', value: 'user' }, enum: ['user', 'admin'] },
494
+ });
495
+ prop.addSemantic({
496
+ id: SemanticType.UserRole,
497
+ });
498
+ return prop;
499
+ }
449
500
  /**
450
501
  * Adds an is_deleted field to the specified entity.
451
502
  * If an is_deleted field already exists, it returns the existing field.
@@ -1056,6 +1107,9 @@ function findVersionField(entity, direct = false) {
1056
1107
  function findNameField(entity, direct = false) {
1057
1108
  return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Title), direct);
1058
1109
  }
1110
+ function findDisplayNameField(entity, direct = false) {
1111
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Name), direct);
1112
+ }
1059
1113
  function findDescriptionField(entity, direct = false) {
1060
1114
  return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Description), direct);
1061
1115
  }
@@ -1088,6 +1142,9 @@ function findDeletedAtField(entity, direct = false) {
1088
1142
  return property.hasSemantic(SemanticType.DeletedTimestamp);
1089
1143
  }, direct);
1090
1144
  }
1145
+ function findRoleField(entity, direct = false) {
1146
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.UserRole), direct);
1147
+ }
1091
1148
  function findIsDeletedField(entity, direct = false) {
1092
1149
  return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.DeletedFlag), direct);
1093
1150
  }
@@ -1165,4 +1222,82 @@ function findUnitPriceField(entity, direct = false) {
1165
1222
  function findExpiresAtField(entity, direct = false) {
1166
1223
  return findPropertyField(entity, (property) => property.info.name === 'expiresAt' && property.type === 'datetime', direct);
1167
1224
  }
1225
+ export function addStreetAddressField(entity, info = {}) {
1226
+ const existing = findStreetAddressField(entity, true);
1227
+ if (existing)
1228
+ return existing;
1229
+ const prop = entity.addProperty({
1230
+ info: { name: 'street_address', displayName: 'Street Address', ...info },
1231
+ type: 'string',
1232
+ required: true,
1233
+ });
1234
+ prop.addSemantic({ id: SemanticType.StreetAddress });
1235
+ return prop;
1236
+ }
1237
+ function findStreetAddressField(entity, direct = false) {
1238
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.StreetAddress), direct);
1239
+ }
1240
+ export function addCityField(entity, info = {}) {
1241
+ const existing = findCityField(entity, true);
1242
+ if (existing)
1243
+ return existing;
1244
+ const prop = entity.addProperty({
1245
+ info: { name: 'city', displayName: 'City', ...info },
1246
+ type: 'string',
1247
+ required: true,
1248
+ index: true,
1249
+ });
1250
+ prop.addSemantic({ id: SemanticType.City });
1251
+ return prop;
1252
+ }
1253
+ function findCityField(entity, direct = false) {
1254
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.City), direct);
1255
+ }
1256
+ export function addPostalCodeField(entity, info = {}) {
1257
+ const existing = findPostalCodeField(entity, true);
1258
+ if (existing)
1259
+ return existing;
1260
+ const prop = entity.addProperty({
1261
+ info: { name: 'postal_code', displayName: 'Postal Code', ...info },
1262
+ type: 'string',
1263
+ required: true,
1264
+ index: true,
1265
+ });
1266
+ prop.addSemantic(createPostalCodeSemantic(DEFAULT_POSTAL_CODE_CONFIG));
1267
+ return prop;
1268
+ }
1269
+ function findPostalCodeField(entity, direct = false) {
1270
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.PostalCode), direct);
1271
+ }
1272
+ export function addCountryField(entity, info = {}) {
1273
+ const existing = findCountryField(entity, true);
1274
+ if (existing)
1275
+ return existing;
1276
+ const prop = entity.addProperty({
1277
+ info: { name: 'country', displayName: 'Country', ...info },
1278
+ type: 'string',
1279
+ required: true,
1280
+ index: true,
1281
+ });
1282
+ prop.addSemantic(createCountrySemantic(DEFAULT_COUNTRY_CONFIG));
1283
+ return prop;
1284
+ }
1285
+ function findCountryField(entity, direct = false) {
1286
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Country), direct);
1287
+ }
1288
+ export function addRegionField(entity, info = {}) {
1289
+ const existing = findRegionField(entity, true);
1290
+ if (existing)
1291
+ return existing;
1292
+ const prop = entity.addProperty({
1293
+ info: { name: 'region', displayName: 'Region', ...info },
1294
+ type: 'string',
1295
+ index: true,
1296
+ });
1297
+ prop.addSemantic({ id: SemanticType.Region });
1298
+ return prop;
1299
+ }
1300
+ function findRegionField(entity, direct = false) {
1301
+ return findPropertyField(entity, (property) => property.hasSemantic(SemanticType.Region), direct);
1302
+ }
1168
1303
  //# sourceMappingURL=Intelisense.js.map