@adobe-commerce/aio-toolkit 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +219 -1
- package/dist/index.d.mts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +440 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +437 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -35
package/dist/index.js
CHANGED
|
@@ -31,6 +31,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
+
AbdbCollection: () => collection_default,
|
|
35
|
+
AbdbColumn: () => column_default,
|
|
36
|
+
AbdbColumnType: () => AbdbColumnType,
|
|
34
37
|
AdminUiSdk: () => AdminUiSdk,
|
|
35
38
|
AdobeAuth: () => adobe_auth_default,
|
|
36
39
|
AdobeCommerceClient: () => adobe_commerce_client_default,
|
|
@@ -3732,6 +3735,440 @@ __name(_RuntimeApiGatewayService, "RuntimeApiGatewayService");
|
|
|
3732
3735
|
_RuntimeApiGatewayService.BASE_URL = "https://adobeioruntime.net/apis";
|
|
3733
3736
|
var RuntimeApiGatewayService = _RuntimeApiGatewayService;
|
|
3734
3737
|
|
|
3738
|
+
// src/framework/abdb/column/types.ts
|
|
3739
|
+
var AbdbColumnType = /* @__PURE__ */ ((AbdbColumnType2) => {
|
|
3740
|
+
AbdbColumnType2["STRING"] = "STRING";
|
|
3741
|
+
AbdbColumnType2["NUMBER"] = "NUMBER";
|
|
3742
|
+
AbdbColumnType2["BOOLEAN"] = "BOOLEAN";
|
|
3743
|
+
AbdbColumnType2["DATETIME"] = "DATETIME";
|
|
3744
|
+
return AbdbColumnType2;
|
|
3745
|
+
})(AbdbColumnType || {});
|
|
3746
|
+
|
|
3747
|
+
// src/framework/abdb/column/index.ts
|
|
3748
|
+
var ISO_8601_DATETIME = /^\d{4}-\d{2}-\d{2}([Tt ]\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z|[+-]\d{2}(:?\d{2})?)?)?$/;
|
|
3749
|
+
var _AbdbColumn = class _AbdbColumn {
|
|
3750
|
+
/**
|
|
3751
|
+
* @param options - Field definition
|
|
3752
|
+
* @throws {Error} When `name` is missing or blank, or `type` is missing / not a member of {@link AbdbColumnType}
|
|
3753
|
+
*/
|
|
3754
|
+
constructor(options) {
|
|
3755
|
+
if (!options?.name?.trim()) {
|
|
3756
|
+
throw new Error('AbdbColumn: "name" is required and cannot be empty');
|
|
3757
|
+
}
|
|
3758
|
+
if (!options.type || !Object.values(AbdbColumnType).includes(options.type)) {
|
|
3759
|
+
throw new Error('AbdbColumn: "type" is required');
|
|
3760
|
+
}
|
|
3761
|
+
this._name = options.name.trim();
|
|
3762
|
+
this._type = options.type;
|
|
3763
|
+
this._description = void 0;
|
|
3764
|
+
this._isRequired = options.isRequired ?? false;
|
|
3765
|
+
if (options.description !== void 0) {
|
|
3766
|
+
const trimmed = options.description.trim();
|
|
3767
|
+
if (trimmed.length > 0) {
|
|
3768
|
+
this._description = trimmed;
|
|
3769
|
+
}
|
|
3770
|
+
}
|
|
3771
|
+
Object.freeze(this);
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Returns the trimmed field name.
|
|
3775
|
+
*/
|
|
3776
|
+
getName() {
|
|
3777
|
+
return this._name;
|
|
3778
|
+
}
|
|
3779
|
+
/**
|
|
3780
|
+
* Returns the expected value type for this column.
|
|
3781
|
+
*/
|
|
3782
|
+
getType() {
|
|
3783
|
+
return this._type;
|
|
3784
|
+
}
|
|
3785
|
+
/**
|
|
3786
|
+
* Returns the optional description, if one was provided and non-whitespace.
|
|
3787
|
+
*
|
|
3788
|
+
* @returns Description string, or `undefined` when not set
|
|
3789
|
+
*/
|
|
3790
|
+
getDescription() {
|
|
3791
|
+
return this._description;
|
|
3792
|
+
}
|
|
3793
|
+
/**
|
|
3794
|
+
* Returns whether a value is mandatory for {@link AbdbColumn#validate}.
|
|
3795
|
+
*
|
|
3796
|
+
* @returns `true` if constructed with `isRequired: true`; otherwise `false`
|
|
3797
|
+
*/
|
|
3798
|
+
getIsRequired() {
|
|
3799
|
+
return this._isRequired;
|
|
3800
|
+
}
|
|
3801
|
+
/**
|
|
3802
|
+
* Serializes this column to a plain object for JSON (config files, APIs, persistence).
|
|
3803
|
+
*/
|
|
3804
|
+
toJSON() {
|
|
3805
|
+
const json = {
|
|
3806
|
+
name: this._name,
|
|
3807
|
+
type: this._type
|
|
3808
|
+
};
|
|
3809
|
+
if (this._description !== void 0) {
|
|
3810
|
+
json.description = this._description;
|
|
3811
|
+
}
|
|
3812
|
+
if (this._isRequired) {
|
|
3813
|
+
json.isRequired = true;
|
|
3814
|
+
}
|
|
3815
|
+
return json;
|
|
3816
|
+
}
|
|
3817
|
+
/**
|
|
3818
|
+
* Creates a new column with the same or overridden options. Does not mutate this instance.
|
|
3819
|
+
*
|
|
3820
|
+
* Passing `description: ' '` (blank / whitespace) clears the description on the new column.
|
|
3821
|
+
*
|
|
3822
|
+
* @param overrides - Partial options; omitted keys keep current values
|
|
3823
|
+
* @returns A new {@link AbdbColumn} instance
|
|
3824
|
+
*/
|
|
3825
|
+
clone(overrides = {}) {
|
|
3826
|
+
const name = overrides.name ?? this._name;
|
|
3827
|
+
const type = overrides.type ?? this._type;
|
|
3828
|
+
const isRequired = overrides.isRequired ?? this._isRequired;
|
|
3829
|
+
if (overrides.description !== void 0) {
|
|
3830
|
+
return new _AbdbColumn({ name, type, description: overrides.description, isRequired });
|
|
3831
|
+
}
|
|
3832
|
+
if (this._description !== void 0) {
|
|
3833
|
+
return new _AbdbColumn({ name, type, description: this._description, isRequired });
|
|
3834
|
+
}
|
|
3835
|
+
return new _AbdbColumn({ name, type, isRequired });
|
|
3836
|
+
}
|
|
3837
|
+
/**
|
|
3838
|
+
* Validates a payload value against this column's requiredness and {@link AbdbColumnType}.
|
|
3839
|
+
*
|
|
3840
|
+
* **Missing values** (`undefined`, `null`, or empty / whitespace-only strings) are handled first:
|
|
3841
|
+
* if `isRequired` is `false`, validation succeeds; if `true`, throws.
|
|
3842
|
+
*
|
|
3843
|
+
* **Type rules** (when a non-missing value is present):
|
|
3844
|
+
* - `STRING`: primitive string
|
|
3845
|
+
* - `NUMBER`: finite number, or a non-empty string whose trim parses to a finite number via `Number`
|
|
3846
|
+
* - `BOOLEAN`: primitive boolean, or non-empty trimmed string `"true"` / `"false"` (case-insensitive)
|
|
3847
|
+
* - `DATETIME`: valid `Date`, finite numeric timestamp (ms), or non-empty trimmed ISO 8601 date/datetime string
|
|
3848
|
+
*
|
|
3849
|
+
* @param value - Document field or API payload value
|
|
3850
|
+
* @throws {Error} When required and missing, or when the value does not match the column type
|
|
3851
|
+
*/
|
|
3852
|
+
validate(value) {
|
|
3853
|
+
if (this._isMissingValue(value)) {
|
|
3854
|
+
if (this._isRequired) {
|
|
3855
|
+
throw new Error(`AbdbColumn: "${this._name}" is required`);
|
|
3856
|
+
}
|
|
3857
|
+
return;
|
|
3858
|
+
}
|
|
3859
|
+
switch (this._type) {
|
|
3860
|
+
case "STRING" /* STRING */:
|
|
3861
|
+
this._validateStringValue(value);
|
|
3862
|
+
return;
|
|
3863
|
+
case "NUMBER" /* NUMBER */:
|
|
3864
|
+
this._validateNumberValue(value);
|
|
3865
|
+
return;
|
|
3866
|
+
case "BOOLEAN" /* BOOLEAN */:
|
|
3867
|
+
this._validateBooleanValue(value);
|
|
3868
|
+
return;
|
|
3869
|
+
case "DATETIME" /* DATETIME */:
|
|
3870
|
+
this._validateDateTimeValue(value);
|
|
3871
|
+
return;
|
|
3872
|
+
default: {
|
|
3873
|
+
const _unreachable = this._type;
|
|
3874
|
+
throw new Error(`AbdbColumn: unhandled type "${_unreachable}"`);
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
/**
|
|
3879
|
+
* Whether `value` counts as absent for requiredness checks (before type validation).
|
|
3880
|
+
*
|
|
3881
|
+
* @returns `true` for `undefined`, `null`, or a string that is empty after trim
|
|
3882
|
+
*/
|
|
3883
|
+
_isMissingValue(value) {
|
|
3884
|
+
if (value === void 0 || value === null) {
|
|
3885
|
+
return true;
|
|
3886
|
+
}
|
|
3887
|
+
return typeof value === "string" && value.trim() === "";
|
|
3888
|
+
}
|
|
3889
|
+
/**
|
|
3890
|
+
* @throws {Error} When `value` is not a primitive string
|
|
3891
|
+
*/
|
|
3892
|
+
_validateStringValue(value) {
|
|
3893
|
+
if (typeof value !== "string") {
|
|
3894
|
+
throw new Error(`AbdbColumn: "${this._name}" expects string, got ${typeof value}`);
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
/**
|
|
3898
|
+
* @throws {Error} When not a finite number or numeric string
|
|
3899
|
+
*/
|
|
3900
|
+
_validateNumberValue(value) {
|
|
3901
|
+
if (typeof value === "number") {
|
|
3902
|
+
if (Number.isFinite(value)) {
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
throw new Error(`AbdbColumn: "${this._name}" expects a finite number, got ${String(value)}`);
|
|
3906
|
+
}
|
|
3907
|
+
if (typeof value === "string") {
|
|
3908
|
+
const trimmed = value.trim();
|
|
3909
|
+
const n = Number(trimmed);
|
|
3910
|
+
if (Number.isFinite(n)) {
|
|
3911
|
+
return;
|
|
3912
|
+
}
|
|
3913
|
+
throw new Error(
|
|
3914
|
+
`AbdbColumn: "${this._name}" expects a finite number or numeric string, got ${JSON.stringify(value)}`
|
|
3915
|
+
);
|
|
3916
|
+
}
|
|
3917
|
+
throw new Error(
|
|
3918
|
+
`AbdbColumn: "${this._name}" expects a finite number or numeric string, got ${typeof value}`
|
|
3919
|
+
);
|
|
3920
|
+
}
|
|
3921
|
+
/**
|
|
3922
|
+
* @throws {Error} When not a boolean or `"true"` / `"false"` string
|
|
3923
|
+
*/
|
|
3924
|
+
_validateBooleanValue(value) {
|
|
3925
|
+
if (typeof value === "boolean") {
|
|
3926
|
+
return;
|
|
3927
|
+
}
|
|
3928
|
+
if (typeof value === "string") {
|
|
3929
|
+
const t = value.trim().toLowerCase();
|
|
3930
|
+
if (t === "true" || t === "false") {
|
|
3931
|
+
return;
|
|
3932
|
+
}
|
|
3933
|
+
throw new Error(
|
|
3934
|
+
`AbdbColumn: "${this._name}" expects boolean or "true"/"false" string, got ${JSON.stringify(value)}`
|
|
3935
|
+
);
|
|
3936
|
+
}
|
|
3937
|
+
throw new Error(
|
|
3938
|
+
`AbdbColumn: "${this._name}" expects boolean or "true"/"false" string, got ${typeof value}`
|
|
3939
|
+
);
|
|
3940
|
+
}
|
|
3941
|
+
/**
|
|
3942
|
+
* @throws {Error} When not a valid `Date`, finite timestamp, or ISO 8601 string
|
|
3943
|
+
*/
|
|
3944
|
+
_validateDateTimeValue(value) {
|
|
3945
|
+
if (value instanceof Date) {
|
|
3946
|
+
if (!Number.isNaN(value.getTime())) {
|
|
3947
|
+
return;
|
|
3948
|
+
}
|
|
3949
|
+
throw new Error(`AbdbColumn: "${this._name}" expects a valid Date`);
|
|
3950
|
+
}
|
|
3951
|
+
if (typeof value === "number") {
|
|
3952
|
+
if (Number.isFinite(value)) {
|
|
3953
|
+
return;
|
|
3954
|
+
}
|
|
3955
|
+
throw new Error(
|
|
3956
|
+
`AbdbColumn: "${this._name}" expects a finite numeric timestamp, got ${value}`
|
|
3957
|
+
);
|
|
3958
|
+
}
|
|
3959
|
+
if (typeof value === "string") {
|
|
3960
|
+
const s = value.trim();
|
|
3961
|
+
if (!ISO_8601_DATETIME.test(s)) {
|
|
3962
|
+
throw new Error(
|
|
3963
|
+
`AbdbColumn: "${this._name}" expects ISO 8601 datetime string, got ${JSON.stringify(value)}`
|
|
3964
|
+
);
|
|
3965
|
+
}
|
|
3966
|
+
const t = Date.parse(s);
|
|
3967
|
+
if (Number.isNaN(t)) {
|
|
3968
|
+
throw new Error(
|
|
3969
|
+
`AbdbColumn: "${this._name}" expects ISO 8601 datetime string, got ${JSON.stringify(value)}`
|
|
3970
|
+
);
|
|
3971
|
+
}
|
|
3972
|
+
return;
|
|
3973
|
+
}
|
|
3974
|
+
throw new Error(
|
|
3975
|
+
`AbdbColumn: "${this._name}" expects Date, finite numeric timestamp, or ISO 8601 datetime string, got ${typeof value}`
|
|
3976
|
+
);
|
|
3977
|
+
}
|
|
3978
|
+
};
|
|
3979
|
+
__name(_AbdbColumn, "AbdbColumn");
|
|
3980
|
+
var AbdbColumn = _AbdbColumn;
|
|
3981
|
+
var column_default = AbdbColumn;
|
|
3982
|
+
|
|
3983
|
+
// src/framework/abdb/collection/index.ts
|
|
3984
|
+
var import_aio_lib_db = require("@adobe/aio-lib-db");
|
|
3985
|
+
var _AbdbCollection = class _AbdbCollection {
|
|
3986
|
+
/**
|
|
3987
|
+
* Creates a collection and optionally configures it in a callback (e.g. chained {@link addColumn} calls).
|
|
3988
|
+
*
|
|
3989
|
+
* @param name - Raw collection name; trimmed and validated
|
|
3990
|
+
* @param callback - Optional function invoked with `this` for fluent setup
|
|
3991
|
+
* @throws {Error} When `name` is empty, whitespace-only, or contains invalid characters
|
|
3992
|
+
*/
|
|
3993
|
+
constructor(name, callback) {
|
|
3994
|
+
this._name = this._validateCollectionName(name);
|
|
3995
|
+
this._columns = /* @__PURE__ */ new Map();
|
|
3996
|
+
if (callback) {
|
|
3997
|
+
callback(this);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
/**
|
|
4001
|
+
* Returns this collection's name.
|
|
4002
|
+
*/
|
|
4003
|
+
getName() {
|
|
4004
|
+
return this._name;
|
|
4005
|
+
}
|
|
4006
|
+
addColumn(name, type, descriptionOrOptions, isRequired) {
|
|
4007
|
+
const trimmed = this._validateColumnName(name);
|
|
4008
|
+
if (this._columns.has(trimmed)) {
|
|
4009
|
+
throw new Error(`AbdbCollection: duplicate column name "${trimmed}"`);
|
|
4010
|
+
}
|
|
4011
|
+
const columnOptions = { name: trimmed, type };
|
|
4012
|
+
if (typeof descriptionOrOptions === "string") {
|
|
4013
|
+
columnOptions.description = descriptionOrOptions;
|
|
4014
|
+
if (isRequired !== void 0) {
|
|
4015
|
+
columnOptions.isRequired = isRequired;
|
|
4016
|
+
}
|
|
4017
|
+
} else if (descriptionOrOptions !== void 0) {
|
|
4018
|
+
if (descriptionOrOptions.description !== void 0) {
|
|
4019
|
+
columnOptions.description = descriptionOrOptions.description;
|
|
4020
|
+
}
|
|
4021
|
+
if (descriptionOrOptions.isRequired !== void 0) {
|
|
4022
|
+
columnOptions.isRequired = descriptionOrOptions.isRequired;
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
this._columns.set(trimmed, new column_default(columnOptions));
|
|
4026
|
+
return this;
|
|
4027
|
+
}
|
|
4028
|
+
/**
|
|
4029
|
+
* Returns a defensive copy of columns in insertion order.
|
|
4030
|
+
*/
|
|
4031
|
+
getColumns() {
|
|
4032
|
+
return Array.from(this._columns.values());
|
|
4033
|
+
}
|
|
4034
|
+
/**
|
|
4035
|
+
* Returns the column registered under `name`, or `undefined` if no such column exists.
|
|
4036
|
+
*
|
|
4037
|
+
* @param name - Column name to look up (exact match after trimming)
|
|
4038
|
+
* @returns The {@link AbdbColumn} instance, or `undefined`
|
|
4039
|
+
*/
|
|
4040
|
+
getColumn(name) {
|
|
4041
|
+
return this._columns.get(name.trim());
|
|
4042
|
+
}
|
|
4043
|
+
/**
|
|
4044
|
+
* Returns `true` when a column with the given name has been registered.
|
|
4045
|
+
*
|
|
4046
|
+
* @param name - Column name to check (exact match after trimming)
|
|
4047
|
+
*/
|
|
4048
|
+
hasColumn(name) {
|
|
4049
|
+
return this._columns.has(name.trim());
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Validates a document-style object against this collection's columns. Throws on the **first** failing
|
|
4053
|
+
* column. Use {@link validateAll} when you need all errors reported at once.
|
|
4054
|
+
*
|
|
4055
|
+
* Missing keys are read as `undefined`, so a **required** column whose key is absent fails validation.
|
|
4056
|
+
* Extra keys not matching any column name are ignored.
|
|
4057
|
+
*
|
|
4058
|
+
* @param record - Key/value payload whose keys are column names
|
|
4059
|
+
* @throws {Error} When any column validation fails (requiredness or type)
|
|
4060
|
+
*/
|
|
4061
|
+
validate(record) {
|
|
4062
|
+
for (const col of this._columns.values()) {
|
|
4063
|
+
col.validate(record[col.getName()]);
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
/**
|
|
4067
|
+
* Validates a document-style object against **all** columns and collects every error instead of
|
|
4068
|
+
* stopping at the first failure. Useful at API boundaries where reporting all problems at once
|
|
4069
|
+
* gives a better developer or end-user experience.
|
|
4070
|
+
*
|
|
4071
|
+
* Returns an empty array when the record is fully valid.
|
|
4072
|
+
*
|
|
4073
|
+
* @param record - Key/value payload whose keys are column names
|
|
4074
|
+
* @returns Array of validation error messages, one per failing column (insertion order)
|
|
4075
|
+
*
|
|
4076
|
+
* @example
|
|
4077
|
+
* ```typescript
|
|
4078
|
+
* const errors = orders.validateAll(payload);
|
|
4079
|
+
* if (errors.length > 0) {
|
|
4080
|
+
* return { status: 400, body: { errors } };
|
|
4081
|
+
* }
|
|
4082
|
+
* ```
|
|
4083
|
+
*/
|
|
4084
|
+
validateAll(record) {
|
|
4085
|
+
const errors = [];
|
|
4086
|
+
for (const col of this._columns.values()) {
|
|
4087
|
+
try {
|
|
4088
|
+
col.validate(record[col.getName()]);
|
|
4089
|
+
} catch (e) {
|
|
4090
|
+
errors.push(e instanceof Error ? e.message : String(e));
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
return errors;
|
|
4094
|
+
}
|
|
4095
|
+
/**
|
|
4096
|
+
* Connects to the database (via `@adobe/aio-lib-db`), runs `callback` with the selected DB **collection**
|
|
4097
|
+
* handle and the **client**, then closes the client in a `finally` block.
|
|
4098
|
+
*
|
|
4099
|
+
* **Errors:** `DbError` instances are rethrown as `AbdbCollection: database error: …`;
|
|
4100
|
+
* any other value is wrapped as `AbdbCollection: unexpected error: …`.
|
|
4101
|
+
*
|
|
4102
|
+
* @param callback - Receives `(collection, client)` after connect
|
|
4103
|
+
* @param token - IMS access token for `initDb`
|
|
4104
|
+
* @param region - Data region (default: `'amer'`)
|
|
4105
|
+
* @returns Promise resolving to the callback's return value
|
|
4106
|
+
* @throws {Error} On init, connect, `DbError`, or callback failure
|
|
4107
|
+
*/
|
|
4108
|
+
async run(callback, token, region = "amer") {
|
|
4109
|
+
let client;
|
|
4110
|
+
try {
|
|
4111
|
+
const db = await (0, import_aio_lib_db.init)({ token, region });
|
|
4112
|
+
client = await db.connect();
|
|
4113
|
+
const collection = await client.collection(this._name);
|
|
4114
|
+
return await callback(collection, client);
|
|
4115
|
+
} catch (error) {
|
|
4116
|
+
if (error instanceof import_aio_lib_db.DbError) {
|
|
4117
|
+
throw new Error(`AbdbCollection: database error: ${error.message}`);
|
|
4118
|
+
}
|
|
4119
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4120
|
+
throw new Error(`AbdbCollection: unexpected error: ${detail}`);
|
|
4121
|
+
} finally {
|
|
4122
|
+
await client?.close();
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
/**
|
|
4126
|
+
* Validates and normalizes the collection identifier used at construction.
|
|
4127
|
+
*
|
|
4128
|
+
* @throws {Error} If the name is empty or not `[a-zA-Z0-9_]`
|
|
4129
|
+
*/
|
|
4130
|
+
_validateCollectionName(name) {
|
|
4131
|
+
return this._validateIdentifier(
|
|
4132
|
+
name,
|
|
4133
|
+
'AbdbCollection: "name" is required and cannot be empty',
|
|
4134
|
+
"AbdbCollection: name must contain only alphanumeric characters and underscores"
|
|
4135
|
+
);
|
|
4136
|
+
}
|
|
4137
|
+
/**
|
|
4138
|
+
* Validates and normalizes a column name before {@link addColumn} stores it.
|
|
4139
|
+
*
|
|
4140
|
+
* @throws {Error} If the name is empty or not `[a-zA-Z0-9_]`
|
|
4141
|
+
*/
|
|
4142
|
+
_validateColumnName(name) {
|
|
4143
|
+
return this._validateIdentifier(
|
|
4144
|
+
name,
|
|
4145
|
+
'AbdbCollection: column "name" is required and cannot be empty',
|
|
4146
|
+
"AbdbCollection: column name must contain only alphanumeric characters and underscores"
|
|
4147
|
+
);
|
|
4148
|
+
}
|
|
4149
|
+
/**
|
|
4150
|
+
* Shared validation for collection and column identifiers.
|
|
4151
|
+
*
|
|
4152
|
+
* @param raw - Unvalidated string
|
|
4153
|
+
* @param emptyMessage - Thrown when `raw` is missing or whitespace-only
|
|
4154
|
+
* @param invalidMessage - Thrown when the trimmed value is not alphanumeric with underscores
|
|
4155
|
+
* @returns The trimmed identifier
|
|
4156
|
+
*/
|
|
4157
|
+
_validateIdentifier(raw, emptyMessage, invalidMessage) {
|
|
4158
|
+
if (!raw || raw.trim() === "") {
|
|
4159
|
+
throw new Error(emptyMessage);
|
|
4160
|
+
}
|
|
4161
|
+
const trimmed = raw.trim();
|
|
4162
|
+
if (!/^[a-zA-Z0-9_]+$/.test(trimmed)) {
|
|
4163
|
+
throw new Error(invalidMessage);
|
|
4164
|
+
}
|
|
4165
|
+
return trimmed;
|
|
4166
|
+
}
|
|
4167
|
+
};
|
|
4168
|
+
__name(_AbdbCollection, "AbdbCollection");
|
|
4169
|
+
var AbdbCollection = _AbdbCollection;
|
|
4170
|
+
var collection_default = AbdbCollection;
|
|
4171
|
+
|
|
3735
4172
|
// src/integration/onboard-events/index.ts
|
|
3736
4173
|
var import_aio_sdk5 = require("@adobe/aio-sdk");
|
|
3737
4174
|
|
|
@@ -8852,6 +9289,9 @@ __name(_AdminUiSdk, "AdminUiSdk");
|
|
|
8852
9289
|
var AdminUiSdk = _AdminUiSdk;
|
|
8853
9290
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8854
9291
|
0 && (module.exports = {
|
|
9292
|
+
AbdbCollection,
|
|
9293
|
+
AbdbColumn,
|
|
9294
|
+
AbdbColumnType,
|
|
8855
9295
|
AdminUiSdk,
|
|
8856
9296
|
AdobeAuth,
|
|
8857
9297
|
AdobeCommerceClient,
|