@labdigital/commercetools-mock 0.10.0 → 0.10.1
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/dist/index.d.ts +353 -188
- package/dist/index.global.js +930 -874
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +271 -215
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -215
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/ctMock.ts +15 -9
- package/src/helpers.ts +1 -1
- package/src/lib/projectionSearchFilter.ts +3 -2
- package/src/priceSelector.test.ts +1 -3
- package/src/product-projection-search.ts +1 -3
- package/src/projectAPI.test.ts +7 -0
- package/src/projectAPI.ts +17 -22
- package/src/repositories/abstract.ts +31 -24
- package/src/repositories/cart-discount.ts +3 -4
- package/src/repositories/cart.ts +20 -15
- package/src/repositories/category.ts +6 -7
- package/src/repositories/channel.ts +4 -5
- package/src/repositories/custom-object.ts +9 -13
- package/src/repositories/customer-group.ts +3 -4
- package/src/repositories/customer.ts +4 -5
- package/src/repositories/discount-code.ts +4 -5
- package/src/repositories/errors.ts +1 -3
- package/src/repositories/extension.ts +7 -8
- package/src/repositories/helpers.ts +2 -2
- package/src/repositories/index.ts +19 -3
- package/src/repositories/inventory-entry.ts +4 -5
- package/src/repositories/my-order.ts +2 -2
- package/src/repositories/order-edit.ts +39 -0
- package/src/repositories/order.test.ts +16 -11
- package/src/repositories/order.ts +15 -8
- package/src/repositories/payment.ts +6 -7
- package/src/repositories/product-discount.ts +4 -24
- package/src/repositories/product-projection.ts +11 -5
- package/src/repositories/product-selection.ts +40 -0
- package/src/repositories/product-type.ts +11 -28
- package/src/repositories/product.ts +7 -8
- package/src/repositories/project.ts +8 -8
- package/src/repositories/quote-request.ts +28 -0
- package/src/repositories/quote.ts +28 -0
- package/src/repositories/review.ts +34 -0
- package/src/repositories/shipping-method.ts +10 -11
- package/src/repositories/shopping-list.ts +4 -4
- package/src/repositories/staged-quote.ts +29 -0
- package/src/repositories/standalone-price.ts +36 -0
- package/src/repositories/state.ts +7 -8
- package/src/repositories/store.ts +11 -27
- package/src/repositories/subscription.ts +3 -4
- package/src/repositories/tax-category.ts +5 -22
- package/src/repositories/type.ts +12 -13
- package/src/repositories/zone.ts +4 -5
- package/src/server.ts +4 -4
- package/src/services/abstract.ts +3 -5
- package/src/services/cart-discount.ts +1 -1
- package/src/services/cart.test.ts +1 -1
- package/src/services/cart.ts +40 -33
- package/src/services/category.ts +1 -1
- package/src/services/channel.ts +1 -1
- package/src/services/custom-object.test.ts +1 -1
- package/src/services/custom-object.ts +2 -2
- package/src/services/customer-group.ts +1 -1
- package/src/services/customer.test.ts +1 -1
- package/src/services/customer.ts +3 -3
- package/src/services/discount-code.ts +1 -1
- package/src/services/extension.ts +1 -1
- package/src/services/inventory-entry.test.ts +1 -1
- package/src/services/inventory-entry.ts +1 -1
- package/src/services/my-cart.test.ts +2 -0
- package/src/services/my-cart.ts +1 -1
- package/src/services/my-customer.ts +1 -1
- package/src/services/my-order.ts +1 -1
- package/src/services/my-payment.ts +1 -1
- package/src/services/order.test.ts +24 -20
- package/src/services/order.ts +2 -2
- package/src/services/payment.ts +1 -1
- package/src/services/product-discount.ts +1 -17
- package/src/services/product-projection.test.ts +1 -1
- package/src/services/product-projection.ts +2 -2
- package/src/services/product-type.ts +1 -17
- package/src/services/product.test.ts +1 -1
- package/src/services/product.ts +1 -1
- package/src/services/project.ts +2 -3
- package/src/services/shipping-method.ts +1 -1
- package/src/services/shopping-list.ts +1 -1
- package/src/services/state.ts +1 -1
- package/src/services/store.ts +2 -18
- package/src/services/subscription.ts +1 -1
- package/src/services/tax-category.ts +1 -17
- package/src/services/type.ts +1 -1
- package/src/services/zone.ts +1 -1
- package/src/storage/abstract.ts +82 -0
- package/src/{storage.ts → storage/in-memory.ts} +57 -118
- package/src/storage/index.ts +2 -0
- package/src/types.ts +48 -119
package/dist/index.global.js
CHANGED
|
@@ -36771,549 +36771,118 @@ ${this.pendingMocks().join("\n")}`
|
|
|
36771
36771
|
}
|
|
36772
36772
|
});
|
|
36773
36773
|
|
|
36774
|
-
// node_modules/.pnpm/
|
|
36775
|
-
var
|
|
36776
|
-
"node_modules/.pnpm/
|
|
36774
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/rng.js
|
|
36775
|
+
var require_rng = __commonJS({
|
|
36776
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/rng.js"(exports) {
|
|
36777
36777
|
"use strict";
|
|
36778
|
-
Object.defineProperty(exports, "__esModule", {
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36778
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36779
|
+
value: true
|
|
36780
|
+
});
|
|
36781
|
+
exports.default = rng;
|
|
36782
|
+
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
36783
|
+
function _interopRequireDefault(obj) {
|
|
36784
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
36785
|
+
}
|
|
36786
|
+
var rnds8Pool = new Uint8Array(256);
|
|
36787
|
+
var poolPtr = rnds8Pool.length;
|
|
36788
|
+
function rng() {
|
|
36789
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
36790
|
+
_crypto.default.randomFillSync(rnds8Pool);
|
|
36791
|
+
poolPtr = 0;
|
|
36786
36792
|
}
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
};
|
|
36790
|
-
return LexerState2;
|
|
36791
|
-
}();
|
|
36792
|
-
exports.default = LexerState;
|
|
36793
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
36794
|
+
}
|
|
36793
36795
|
}
|
|
36794
36796
|
});
|
|
36795
36797
|
|
|
36796
|
-
// node_modules/.pnpm/
|
|
36797
|
-
var
|
|
36798
|
-
"node_modules/.pnpm/
|
|
36798
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/regex.js
|
|
36799
|
+
var require_regex = __commonJS({
|
|
36800
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/regex.js"(exports) {
|
|
36799
36801
|
"use strict";
|
|
36800
|
-
|
|
36801
|
-
|
|
36802
|
-
|
|
36803
|
-
|
|
36804
|
-
|
|
36805
|
-
|
|
36806
|
-
d[p] = b[p];
|
|
36807
|
-
};
|
|
36808
|
-
return function(d, b) {
|
|
36809
|
-
extendStatics(d, b);
|
|
36810
|
-
function __() {
|
|
36811
|
-
this.constructor = d;
|
|
36812
|
-
}
|
|
36813
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
36814
|
-
};
|
|
36815
|
-
}();
|
|
36816
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36817
|
-
var Token = function() {
|
|
36818
|
-
function Token2(type, match, groups, start, end, lexer) {
|
|
36819
|
-
this.type = type;
|
|
36820
|
-
this.match = match;
|
|
36821
|
-
this.groups = groups;
|
|
36822
|
-
this.start = start;
|
|
36823
|
-
this.end = end;
|
|
36824
|
-
this.lexer = lexer;
|
|
36825
|
-
}
|
|
36826
|
-
Token2.prototype.strpos = function() {
|
|
36827
|
-
var start = this.lexer.strpos(this.start);
|
|
36828
|
-
var end = this.lexer.strpos(this.end);
|
|
36829
|
-
return { start, end };
|
|
36830
|
-
};
|
|
36831
|
-
Token2.prototype.isEof = function() {
|
|
36832
|
-
return false;
|
|
36833
|
-
};
|
|
36834
|
-
return Token2;
|
|
36835
|
-
}();
|
|
36836
|
-
exports.default = Token;
|
|
36837
|
-
var EOFToken = function(_super) {
|
|
36838
|
-
__extends(EOFToken2, _super);
|
|
36839
|
-
function EOFToken2(lexer) {
|
|
36840
|
-
var _this = this;
|
|
36841
|
-
var end = lexer.source.length;
|
|
36842
|
-
_this = _super.call(this, null, "(eof)", [], end, end, lexer) || this;
|
|
36843
|
-
return _this;
|
|
36844
|
-
}
|
|
36845
|
-
EOFToken2.prototype.isEof = function() {
|
|
36846
|
-
return true;
|
|
36847
|
-
};
|
|
36848
|
-
return EOFToken2;
|
|
36849
|
-
}(Token);
|
|
36850
|
-
exports.EOFToken = EOFToken;
|
|
36851
|
-
exports.EOF = function(lexer) {
|
|
36852
|
-
return new EOFToken(lexer);
|
|
36853
|
-
};
|
|
36802
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36803
|
+
value: true
|
|
36804
|
+
});
|
|
36805
|
+
exports.default = void 0;
|
|
36806
|
+
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
36807
|
+
exports.default = _default;
|
|
36854
36808
|
}
|
|
36855
36809
|
});
|
|
36856
36810
|
|
|
36857
|
-
// node_modules/.pnpm/
|
|
36858
|
-
var
|
|
36859
|
-
"node_modules/.pnpm/
|
|
36811
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/validate.js
|
|
36812
|
+
var require_validate = __commonJS({
|
|
36813
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/validate.js"(exports) {
|
|
36860
36814
|
"use strict";
|
|
36861
|
-
Object.defineProperty(exports, "__esModule", {
|
|
36862
|
-
|
|
36863
|
-
|
|
36815
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36816
|
+
value: true
|
|
36817
|
+
});
|
|
36818
|
+
exports.default = void 0;
|
|
36819
|
+
var _regex = _interopRequireDefault(require_regex());
|
|
36820
|
+
function _interopRequireDefault(obj) {
|
|
36821
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
36864
36822
|
}
|
|
36865
|
-
function
|
|
36866
|
-
|
|
36867
|
-
regex = toRegExp(regex);
|
|
36868
|
-
if (!regex.source.startsWith("^"))
|
|
36869
|
-
return new RegExp("^" + regex.source, regex.flags);
|
|
36870
|
-
else
|
|
36871
|
-
return regex;
|
|
36823
|
+
function validate2(uuid2) {
|
|
36824
|
+
return typeof uuid2 === "string" && _regex.default.test(uuid2);
|
|
36872
36825
|
}
|
|
36873
|
-
|
|
36874
|
-
|
|
36875
|
-
|
|
36876
|
-
|
|
36877
|
-
|
|
36878
|
-
|
|
36879
|
-
|
|
36880
|
-
|
|
36826
|
+
var _default = validate2;
|
|
36827
|
+
exports.default = _default;
|
|
36828
|
+
}
|
|
36829
|
+
});
|
|
36830
|
+
|
|
36831
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/stringify.js
|
|
36832
|
+
var require_stringify5 = __commonJS({
|
|
36833
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/stringify.js"(exports) {
|
|
36834
|
+
"use strict";
|
|
36835
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36836
|
+
value: true
|
|
36837
|
+
});
|
|
36838
|
+
exports.default = void 0;
|
|
36839
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
36840
|
+
function _interopRequireDefault(obj) {
|
|
36841
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
36881
36842
|
}
|
|
36882
|
-
var
|
|
36883
|
-
|
|
36884
|
-
|
|
36843
|
+
var byteToHex = [];
|
|
36844
|
+
for (let i = 0; i < 256; ++i) {
|
|
36845
|
+
byteToHex.push((i + 256).toString(16).substr(1));
|
|
36846
|
+
}
|
|
36847
|
+
function stringify2(arr, offset = 0) {
|
|
36848
|
+
const uuid2 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
36849
|
+
if (!(0, _validate.default)(uuid2)) {
|
|
36850
|
+
throw TypeError("Stringified UUID is invalid");
|
|
36885
36851
|
}
|
|
36886
|
-
|
|
36887
|
-
|
|
36888
|
-
|
|
36889
|
-
|
|
36890
|
-
if (enabled === void 0) {
|
|
36891
|
-
enabled = true;
|
|
36892
|
-
}
|
|
36893
|
-
this.tokenTypes.filter(function(t) {
|
|
36894
|
-
return t.type == type;
|
|
36895
|
-
}).forEach(function(t) {
|
|
36896
|
-
return t.enabled = enabled;
|
|
36897
|
-
});
|
|
36898
|
-
return this;
|
|
36899
|
-
};
|
|
36900
|
-
TokenTypes2.prototype.isEnabled = function(type) {
|
|
36901
|
-
var ttypes = this.tokenTypes.filter(function(tt) {
|
|
36902
|
-
return tt.type == type;
|
|
36903
|
-
});
|
|
36904
|
-
if (ttypes.length == 0)
|
|
36905
|
-
throw new Error("Token of type " + type + " does not exists");
|
|
36906
|
-
return ttypes[0].enabled;
|
|
36907
|
-
};
|
|
36908
|
-
TokenTypes2.prototype.peek = function(source, position) {
|
|
36909
|
-
var s = source.substr(position);
|
|
36910
|
-
return first(this.tokenTypes.filter(function(tt) {
|
|
36911
|
-
return tt.enabled;
|
|
36912
|
-
}), function(tt) {
|
|
36913
|
-
tt.regex.lastIndex = 0;
|
|
36914
|
-
return tt.regex.exec(s);
|
|
36915
|
-
});
|
|
36916
|
-
};
|
|
36917
|
-
TokenTypes2.prototype.token = function(type, pattern, skip) {
|
|
36918
|
-
if (skip === void 0) {
|
|
36919
|
-
skip = false;
|
|
36920
|
-
}
|
|
36921
|
-
this.tokenTypes.push({
|
|
36922
|
-
type,
|
|
36923
|
-
regex: normalize(pattern),
|
|
36924
|
-
enabled: true,
|
|
36925
|
-
skip
|
|
36926
|
-
});
|
|
36927
|
-
return this;
|
|
36928
|
-
};
|
|
36929
|
-
return TokenTypes2;
|
|
36930
|
-
}();
|
|
36931
|
-
exports.default = TokenTypes;
|
|
36852
|
+
return uuid2;
|
|
36853
|
+
}
|
|
36854
|
+
var _default = stringify2;
|
|
36855
|
+
exports.default = _default;
|
|
36932
36856
|
}
|
|
36933
36857
|
});
|
|
36934
36858
|
|
|
36935
|
-
// node_modules/.pnpm/
|
|
36936
|
-
var
|
|
36937
|
-
"node_modules/.pnpm/
|
|
36859
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/v1.js
|
|
36860
|
+
var require_v1 = __commonJS({
|
|
36861
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/v1.js"(exports) {
|
|
36938
36862
|
"use strict";
|
|
36939
|
-
Object.defineProperty(exports, "__esModule", {
|
|
36940
|
-
|
|
36941
|
-
|
|
36942
|
-
|
|
36943
|
-
|
|
36944
|
-
|
|
36945
|
-
|
|
36946
|
-
|
|
36947
|
-
|
|
36948
|
-
|
|
36949
|
-
|
|
36950
|
-
|
|
36951
|
-
|
|
36952
|
-
|
|
36953
|
-
|
|
36954
|
-
|
|
36955
|
-
|
|
36956
|
-
|
|
36957
|
-
|
|
36958
|
-
|
|
36959
|
-
|
|
36960
|
-
|
|
36961
|
-
|
|
36962
|
-
enumerable: true,
|
|
36963
|
-
configurable: true
|
|
36964
|
-
});
|
|
36965
|
-
Object.defineProperty(Lexer2.prototype, "source", {
|
|
36966
|
-
get: function() {
|
|
36967
|
-
return this._state.source;
|
|
36968
|
-
},
|
|
36969
|
-
set: function(s) {
|
|
36970
|
-
this._state = new lexer_state_1.default(s);
|
|
36971
|
-
},
|
|
36972
|
-
enumerable: true,
|
|
36973
|
-
configurable: true
|
|
36974
|
-
});
|
|
36975
|
-
Lexer2.prototype.attachTo = function(other) {
|
|
36976
|
-
this._state = other._state;
|
|
36977
|
-
};
|
|
36978
|
-
Lexer2.prototype.disable = function(type) {
|
|
36979
|
-
this._tokenTypes.disable(type);
|
|
36980
|
-
return this;
|
|
36981
|
-
};
|
|
36982
|
-
Lexer2.prototype.enable = function(type, enabled) {
|
|
36983
|
-
this._tokenTypes.enable(type, enabled);
|
|
36984
|
-
return this;
|
|
36985
|
-
};
|
|
36986
|
-
Lexer2.prototype.expect = function(type) {
|
|
36987
|
-
var t = this.next();
|
|
36988
|
-
if (t.type != type) {
|
|
36989
|
-
var pos = t.strpos();
|
|
36990
|
-
throw new Error("Expected " + type + (t ? ", got " + t.type : "") + " at " + pos.start.line + ":" + pos.start.column);
|
|
36991
|
-
}
|
|
36992
|
-
return t;
|
|
36993
|
-
};
|
|
36994
|
-
Lexer2.prototype.isEnabled = function(tokenType) {
|
|
36995
|
-
return this._tokenTypes.isEnabled(tokenType);
|
|
36996
|
-
};
|
|
36997
|
-
Lexer2.prototype.next = function() {
|
|
36998
|
-
try {
|
|
36999
|
-
var t = this.peek();
|
|
37000
|
-
this._state.position = t.end;
|
|
37001
|
-
return t;
|
|
37002
|
-
} catch (e) {
|
|
37003
|
-
this._state.position = e.end;
|
|
37004
|
-
throw e;
|
|
37005
|
-
}
|
|
37006
|
-
};
|
|
37007
|
-
Lexer2.prototype.peek = function(position) {
|
|
37008
|
-
var _this = this;
|
|
37009
|
-
if (position === void 0) {
|
|
37010
|
-
position = this._state.position;
|
|
37011
|
-
}
|
|
37012
|
-
var read = function(i) {
|
|
37013
|
-
if (i === void 0) {
|
|
37014
|
-
i = position;
|
|
37015
|
-
}
|
|
37016
|
-
if (i >= _this._state.source.length)
|
|
37017
|
-
return token_1.EOF(_this);
|
|
37018
|
-
var n = _this._tokenTypes.peek(_this._state.source, i);
|
|
37019
|
-
return n ? n.item.skip ? read(i + n.result[0].length) : new token_1.default(n.item.type, n.result[0], n.result.map(function(x) {
|
|
37020
|
-
return x;
|
|
37021
|
-
}), i, i + n.result[0].length, _this) : null;
|
|
37022
|
-
};
|
|
37023
|
-
var t = read();
|
|
37024
|
-
if (t)
|
|
37025
|
-
return t;
|
|
37026
|
-
var unexpected = this._state.source.substring(position, position + 1);
|
|
37027
|
-
try {
|
|
37028
|
-
this.peek(position + 1);
|
|
37029
|
-
} catch (e2) {
|
|
37030
|
-
unexpected += e2.unexpected;
|
|
37031
|
-
}
|
|
37032
|
-
var _a = this.strpos(position), line = _a.line, column = _a.column;
|
|
37033
|
-
var e = new Error("Unexpected input: " + unexpected + " at (" + line + ":" + column + ")");
|
|
37034
|
-
e.unexpected = unexpected;
|
|
37035
|
-
e.end = position + unexpected.length;
|
|
37036
|
-
throw e;
|
|
37037
|
-
};
|
|
37038
|
-
Lexer2.prototype.strpos = function(i) {
|
|
37039
|
-
var lines = this._state.source.substring(0, i).split(/\r?\n/);
|
|
37040
|
-
if (!Array.isArray(lines))
|
|
37041
|
-
lines = [lines];
|
|
37042
|
-
var line = lines.length;
|
|
37043
|
-
var column = lines[lines.length - 1].length + 1;
|
|
37044
|
-
return { line, column };
|
|
37045
|
-
};
|
|
37046
|
-
Lexer2.prototype.toArray = function() {
|
|
37047
|
-
var oldState = this._state.copy();
|
|
37048
|
-
this._state.position = 0;
|
|
37049
|
-
var tkns = [];
|
|
37050
|
-
var t;
|
|
37051
|
-
while (!(t = this.next()).isEof())
|
|
37052
|
-
tkns.push(t);
|
|
37053
|
-
this._state = oldState;
|
|
37054
|
-
return tkns;
|
|
37055
|
-
};
|
|
37056
|
-
Lexer2.prototype.token = function(type, pattern, skip) {
|
|
37057
|
-
this._tokenTypes.token(type, pattern, skip);
|
|
37058
|
-
return this;
|
|
37059
|
-
};
|
|
37060
|
-
Lexer2.prototype.keyword = function(kwd) {
|
|
37061
|
-
return this.token(kwd, new RegExp(kwd + "(?=\\W|$)"));
|
|
37062
|
-
};
|
|
37063
|
-
Lexer2.prototype.operator = function(op) {
|
|
37064
|
-
var sOp = new String(op).valueOf();
|
|
37065
|
-
return this.token(op, sOp);
|
|
37066
|
-
};
|
|
37067
|
-
return Lexer2;
|
|
37068
|
-
}();
|
|
37069
|
-
exports.default = Lexer;
|
|
37070
|
-
}
|
|
37071
|
-
});
|
|
37072
|
-
|
|
37073
|
-
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/index.js
|
|
37074
|
-
var require_perplex = __commonJS({
|
|
37075
|
-
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/index.js"(exports, module) {
|
|
37076
|
-
module.exports = require_lexer();
|
|
37077
|
-
}
|
|
37078
|
-
});
|
|
37079
|
-
|
|
37080
|
-
// node_modules/.pnpm/pratt@0.7.0/node_modules/pratt/lib/index.js
|
|
37081
|
-
var require_lib5 = __commonJS({
|
|
37082
|
-
"node_modules/.pnpm/pratt@0.7.0/node_modules/pratt/lib/index.js"(exports) {
|
|
37083
|
-
"use strict";
|
|
37084
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37085
|
-
var createStop = function() {
|
|
37086
|
-
var stopCalled = false;
|
|
37087
|
-
return Object.assign(function(x) {
|
|
37088
|
-
stopCalled = true;
|
|
37089
|
-
return x;
|
|
37090
|
-
}, {
|
|
37091
|
-
isStopped: function() {
|
|
37092
|
-
return stopCalled;
|
|
37093
|
-
}
|
|
37094
|
-
});
|
|
37095
|
-
};
|
|
37096
|
-
var Parser3 = function() {
|
|
37097
|
-
function Parser4(lexer) {
|
|
37098
|
-
this.lexer = lexer;
|
|
37099
|
-
this._nuds = /* @__PURE__ */ new Map();
|
|
37100
|
-
this._leds = /* @__PURE__ */ new Map();
|
|
37101
|
-
this._bps = /* @__PURE__ */ new Map();
|
|
37102
|
-
}
|
|
37103
|
-
Parser4.prototype._type = function(tokenOrType) {
|
|
37104
|
-
return tokenOrType && typeof tokenOrType.isEof == "function" ? tokenOrType.type : tokenOrType;
|
|
37105
|
-
};
|
|
37106
|
-
Parser4.prototype.builder = function() {
|
|
37107
|
-
return new ParserBuilder(this);
|
|
37108
|
-
};
|
|
37109
|
-
Parser4.prototype.bp = function(tokenOrType) {
|
|
37110
|
-
if (tokenOrType == null)
|
|
37111
|
-
return Number.NEGATIVE_INFINITY;
|
|
37112
|
-
if (tokenOrType && typeof tokenOrType.isEof == "function" && tokenOrType.isEof())
|
|
37113
|
-
return Number.NEGATIVE_INFINITY;
|
|
37114
|
-
var type = this._type(tokenOrType);
|
|
37115
|
-
var bp = this._bps.has(type) ? this._bps.get(type) : Number.POSITIVE_INFINITY;
|
|
37116
|
-
return typeof bp == "function" ? bp() : bp;
|
|
37117
|
-
};
|
|
37118
|
-
Parser4.prototype.nud = function(info) {
|
|
37119
|
-
var fn = this._nuds.get(info.token.type);
|
|
37120
|
-
if (!fn) {
|
|
37121
|
-
var start = info.token.strpos().start;
|
|
37122
|
-
throw new Error("Unexpected token: " + info.token.match + " (at " + start.line + ":" + start.column + ")");
|
|
37123
|
-
}
|
|
37124
|
-
return fn(info);
|
|
37125
|
-
};
|
|
37126
|
-
Parser4.prototype.led = function(info) {
|
|
37127
|
-
var fn = this._leds.get(info.token.type);
|
|
37128
|
-
if (!fn) {
|
|
37129
|
-
var start = info.token.strpos().start;
|
|
37130
|
-
throw new Error("Unexpected token: " + info.token.match + " (at " + start.line + ":" + start.column + ")");
|
|
37131
|
-
}
|
|
37132
|
-
return fn(info);
|
|
37133
|
-
};
|
|
37134
|
-
Parser4.prototype.parse = function(opts) {
|
|
37135
|
-
var _this = this;
|
|
37136
|
-
if (opts === void 0) {
|
|
37137
|
-
opts = { terminals: [0] };
|
|
37138
|
-
}
|
|
37139
|
-
var stop = opts.stop = opts.stop || createStop();
|
|
37140
|
-
var check = function() {
|
|
37141
|
-
if (stop.isStopped())
|
|
37142
|
-
return false;
|
|
37143
|
-
var t = _this.lexer.peek();
|
|
37144
|
-
var bp = _this.bp(t);
|
|
37145
|
-
return opts.terminals.reduce(function(canContinue, rbpOrType) {
|
|
37146
|
-
if (!canContinue)
|
|
37147
|
-
return false;
|
|
37148
|
-
if (typeof rbpOrType == "number")
|
|
37149
|
-
return rbpOrType < bp;
|
|
37150
|
-
if (typeof rbpOrType == "string")
|
|
37151
|
-
return t.type != rbpOrType;
|
|
37152
|
-
}, true);
|
|
37153
|
-
};
|
|
37154
|
-
var mkinfo = function(token) {
|
|
37155
|
-
var bp = _this.bp(token);
|
|
37156
|
-
return { token, bp, stop, ctx: opts.ctx, options: opts };
|
|
37157
|
-
};
|
|
37158
|
-
if (!opts.terminals)
|
|
37159
|
-
opts.terminals = [0];
|
|
37160
|
-
if (opts.terminals.length == 0)
|
|
37161
|
-
opts.terminals.push(0);
|
|
37162
|
-
var left = this.nud(mkinfo(this.lexer.next()));
|
|
37163
|
-
while (check()) {
|
|
37164
|
-
var operator = this.lexer.next();
|
|
37165
|
-
left = this.led(Object.assign(mkinfo(operator), { left }));
|
|
37166
|
-
}
|
|
37167
|
-
return left;
|
|
37168
|
-
};
|
|
37169
|
-
return Parser4;
|
|
37170
|
-
}();
|
|
37171
|
-
exports.Parser = Parser3;
|
|
37172
|
-
var ParserBuilder = function() {
|
|
37173
|
-
function ParserBuilder2(parser) {
|
|
37174
|
-
this._parser = parser;
|
|
37175
|
-
}
|
|
37176
|
-
ParserBuilder2.prototype.nud = function(tokenType, bp, fn) {
|
|
37177
|
-
this._parser._nuds.set(tokenType, fn);
|
|
37178
|
-
this.bp(tokenType, bp);
|
|
37179
|
-
return this;
|
|
37180
|
-
};
|
|
37181
|
-
ParserBuilder2.prototype.led = function(tokenType, bp, fn) {
|
|
37182
|
-
this._parser._leds.set(tokenType, fn);
|
|
37183
|
-
this.bp(tokenType, bp);
|
|
37184
|
-
return this;
|
|
37185
|
-
};
|
|
37186
|
-
ParserBuilder2.prototype.either = function(tokenType, bp, fn) {
|
|
37187
|
-
return this.nud(tokenType, bp, function(inf) {
|
|
37188
|
-
return fn(Object.assign(inf, { left: null }));
|
|
37189
|
-
}).led(tokenType, bp, fn);
|
|
37190
|
-
};
|
|
37191
|
-
ParserBuilder2.prototype.bp = function(tokenType, bp) {
|
|
37192
|
-
this._parser._bps.set(tokenType, bp);
|
|
37193
|
-
return this;
|
|
37194
|
-
};
|
|
37195
|
-
ParserBuilder2.prototype.build = function() {
|
|
37196
|
-
return this._parser;
|
|
37197
|
-
};
|
|
37198
|
-
return ParserBuilder2;
|
|
37199
|
-
}();
|
|
37200
|
-
exports.ParserBuilder = ParserBuilder;
|
|
37201
|
-
exports.default = Parser3;
|
|
37202
|
-
}
|
|
37203
|
-
});
|
|
37204
|
-
|
|
37205
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/rng.js
|
|
37206
|
-
var require_rng = __commonJS({
|
|
37207
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/rng.js"(exports) {
|
|
37208
|
-
"use strict";
|
|
37209
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37210
|
-
value: true
|
|
37211
|
-
});
|
|
37212
|
-
exports.default = rng;
|
|
37213
|
-
var _crypto = _interopRequireDefault(__require("crypto"));
|
|
37214
|
-
function _interopRequireDefault(obj) {
|
|
37215
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
37216
|
-
}
|
|
37217
|
-
var rnds8Pool = new Uint8Array(256);
|
|
37218
|
-
var poolPtr = rnds8Pool.length;
|
|
37219
|
-
function rng() {
|
|
37220
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
37221
|
-
_crypto.default.randomFillSync(rnds8Pool);
|
|
37222
|
-
poolPtr = 0;
|
|
37223
|
-
}
|
|
37224
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
37225
|
-
}
|
|
37226
|
-
}
|
|
37227
|
-
});
|
|
37228
|
-
|
|
37229
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/regex.js
|
|
37230
|
-
var require_regex = __commonJS({
|
|
37231
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/regex.js"(exports) {
|
|
37232
|
-
"use strict";
|
|
37233
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37234
|
-
value: true
|
|
37235
|
-
});
|
|
37236
|
-
exports.default = void 0;
|
|
37237
|
-
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
37238
|
-
exports.default = _default;
|
|
37239
|
-
}
|
|
37240
|
-
});
|
|
37241
|
-
|
|
37242
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/validate.js
|
|
37243
|
-
var require_validate = __commonJS({
|
|
37244
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/validate.js"(exports) {
|
|
37245
|
-
"use strict";
|
|
37246
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37247
|
-
value: true
|
|
37248
|
-
});
|
|
37249
|
-
exports.default = void 0;
|
|
37250
|
-
var _regex = _interopRequireDefault(require_regex());
|
|
37251
|
-
function _interopRequireDefault(obj) {
|
|
37252
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
37253
|
-
}
|
|
37254
|
-
function validate2(uuid2) {
|
|
37255
|
-
return typeof uuid2 === "string" && _regex.default.test(uuid2);
|
|
37256
|
-
}
|
|
37257
|
-
var _default = validate2;
|
|
37258
|
-
exports.default = _default;
|
|
37259
|
-
}
|
|
37260
|
-
});
|
|
37261
|
-
|
|
37262
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/stringify.js
|
|
37263
|
-
var require_stringify5 = __commonJS({
|
|
37264
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/stringify.js"(exports) {
|
|
37265
|
-
"use strict";
|
|
37266
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37267
|
-
value: true
|
|
37268
|
-
});
|
|
37269
|
-
exports.default = void 0;
|
|
37270
|
-
var _validate = _interopRequireDefault(require_validate());
|
|
37271
|
-
function _interopRequireDefault(obj) {
|
|
37272
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
37273
|
-
}
|
|
37274
|
-
var byteToHex = [];
|
|
37275
|
-
for (let i = 0; i < 256; ++i) {
|
|
37276
|
-
byteToHex.push((i + 256).toString(16).substr(1));
|
|
37277
|
-
}
|
|
37278
|
-
function stringify2(arr, offset = 0) {
|
|
37279
|
-
const uuid2 = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
37280
|
-
if (!(0, _validate.default)(uuid2)) {
|
|
37281
|
-
throw TypeError("Stringified UUID is invalid");
|
|
37282
|
-
}
|
|
37283
|
-
return uuid2;
|
|
37284
|
-
}
|
|
37285
|
-
var _default = stringify2;
|
|
37286
|
-
exports.default = _default;
|
|
37287
|
-
}
|
|
37288
|
-
});
|
|
37289
|
-
|
|
37290
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/v1.js
|
|
37291
|
-
var require_v1 = __commonJS({
|
|
37292
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/v1.js"(exports) {
|
|
37293
|
-
"use strict";
|
|
37294
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37295
|
-
value: true
|
|
37296
|
-
});
|
|
37297
|
-
exports.default = void 0;
|
|
37298
|
-
var _rng = _interopRequireDefault(require_rng());
|
|
37299
|
-
var _stringify = _interopRequireDefault(require_stringify5());
|
|
37300
|
-
function _interopRequireDefault(obj) {
|
|
37301
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
37302
|
-
}
|
|
37303
|
-
var _nodeId;
|
|
37304
|
-
var _clockseq;
|
|
37305
|
-
var _lastMSecs = 0;
|
|
37306
|
-
var _lastNSecs = 0;
|
|
37307
|
-
function v12(options, buf, offset) {
|
|
37308
|
-
let i = buf && offset || 0;
|
|
37309
|
-
const b = buf || new Array(16);
|
|
37310
|
-
options = options || {};
|
|
37311
|
-
let node = options.node || _nodeId;
|
|
37312
|
-
let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq;
|
|
37313
|
-
if (node == null || clockseq == null) {
|
|
37314
|
-
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
37315
|
-
if (node == null) {
|
|
37316
|
-
node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
36863
|
+
Object.defineProperty(exports, "__esModule", {
|
|
36864
|
+
value: true
|
|
36865
|
+
});
|
|
36866
|
+
exports.default = void 0;
|
|
36867
|
+
var _rng = _interopRequireDefault(require_rng());
|
|
36868
|
+
var _stringify = _interopRequireDefault(require_stringify5());
|
|
36869
|
+
function _interopRequireDefault(obj) {
|
|
36870
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
36871
|
+
}
|
|
36872
|
+
var _nodeId;
|
|
36873
|
+
var _clockseq;
|
|
36874
|
+
var _lastMSecs = 0;
|
|
36875
|
+
var _lastNSecs = 0;
|
|
36876
|
+
function v12(options, buf, offset) {
|
|
36877
|
+
let i = buf && offset || 0;
|
|
36878
|
+
const b = buf || new Array(16);
|
|
36879
|
+
options = options || {};
|
|
36880
|
+
let node = options.node || _nodeId;
|
|
36881
|
+
let clockseq = options.clockseq !== void 0 ? options.clockseq : _clockseq;
|
|
36882
|
+
if (node == null || clockseq == null) {
|
|
36883
|
+
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
36884
|
+
if (node == null) {
|
|
36885
|
+
node = _nodeId = [seedBytes[0] | 1, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
37317
36886
|
}
|
|
37318
36887
|
if (clockseq == null) {
|
|
37319
36888
|
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 16383;
|
|
@@ -37581,115 +37150,546 @@ ${this.pendingMocks().join("\n")}`
|
|
|
37581
37150
|
}
|
|
37582
37151
|
});
|
|
37583
37152
|
|
|
37584
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/nil.js
|
|
37585
|
-
var require_nil = __commonJS({
|
|
37586
|
-
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/nil.js"(exports) {
|
|
37153
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/nil.js
|
|
37154
|
+
var require_nil = __commonJS({
|
|
37155
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/nil.js"(exports) {
|
|
37156
|
+
"use strict";
|
|
37157
|
+
Object.defineProperty(exports, "__esModule", {
|
|
37158
|
+
value: true
|
|
37159
|
+
});
|
|
37160
|
+
exports.default = void 0;
|
|
37161
|
+
var _default = "00000000-0000-0000-0000-000000000000";
|
|
37162
|
+
exports.default = _default;
|
|
37163
|
+
}
|
|
37164
|
+
});
|
|
37165
|
+
|
|
37166
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/version.js
|
|
37167
|
+
var require_version = __commonJS({
|
|
37168
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/version.js"(exports) {
|
|
37169
|
+
"use strict";
|
|
37170
|
+
Object.defineProperty(exports, "__esModule", {
|
|
37171
|
+
value: true
|
|
37172
|
+
});
|
|
37173
|
+
exports.default = void 0;
|
|
37174
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
37175
|
+
function _interopRequireDefault(obj) {
|
|
37176
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
37177
|
+
}
|
|
37178
|
+
function version2(uuid2) {
|
|
37179
|
+
if (!(0, _validate.default)(uuid2)) {
|
|
37180
|
+
throw TypeError("Invalid UUID");
|
|
37181
|
+
}
|
|
37182
|
+
return parseInt(uuid2.substr(14, 1), 16);
|
|
37183
|
+
}
|
|
37184
|
+
var _default = version2;
|
|
37185
|
+
exports.default = _default;
|
|
37186
|
+
}
|
|
37187
|
+
});
|
|
37188
|
+
|
|
37189
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/index.js
|
|
37190
|
+
var require_dist = __commonJS({
|
|
37191
|
+
"node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/index.js"(exports) {
|
|
37192
|
+
"use strict";
|
|
37193
|
+
Object.defineProperty(exports, "__esModule", {
|
|
37194
|
+
value: true
|
|
37195
|
+
});
|
|
37196
|
+
Object.defineProperty(exports, "v1", {
|
|
37197
|
+
enumerable: true,
|
|
37198
|
+
get: function() {
|
|
37199
|
+
return _v.default;
|
|
37200
|
+
}
|
|
37201
|
+
});
|
|
37202
|
+
Object.defineProperty(exports, "v3", {
|
|
37203
|
+
enumerable: true,
|
|
37204
|
+
get: function() {
|
|
37205
|
+
return _v2.default;
|
|
37206
|
+
}
|
|
37207
|
+
});
|
|
37208
|
+
Object.defineProperty(exports, "v4", {
|
|
37209
|
+
enumerable: true,
|
|
37210
|
+
get: function() {
|
|
37211
|
+
return _v3.default;
|
|
37212
|
+
}
|
|
37213
|
+
});
|
|
37214
|
+
Object.defineProperty(exports, "v5", {
|
|
37215
|
+
enumerable: true,
|
|
37216
|
+
get: function() {
|
|
37217
|
+
return _v4.default;
|
|
37218
|
+
}
|
|
37219
|
+
});
|
|
37220
|
+
Object.defineProperty(exports, "NIL", {
|
|
37221
|
+
enumerable: true,
|
|
37222
|
+
get: function() {
|
|
37223
|
+
return _nil.default;
|
|
37224
|
+
}
|
|
37225
|
+
});
|
|
37226
|
+
Object.defineProperty(exports, "version", {
|
|
37227
|
+
enumerable: true,
|
|
37228
|
+
get: function() {
|
|
37229
|
+
return _version.default;
|
|
37230
|
+
}
|
|
37231
|
+
});
|
|
37232
|
+
Object.defineProperty(exports, "validate", {
|
|
37233
|
+
enumerable: true,
|
|
37234
|
+
get: function() {
|
|
37235
|
+
return _validate.default;
|
|
37236
|
+
}
|
|
37237
|
+
});
|
|
37238
|
+
Object.defineProperty(exports, "stringify", {
|
|
37239
|
+
enumerable: true,
|
|
37240
|
+
get: function() {
|
|
37241
|
+
return _stringify.default;
|
|
37242
|
+
}
|
|
37243
|
+
});
|
|
37244
|
+
Object.defineProperty(exports, "parse", {
|
|
37245
|
+
enumerable: true,
|
|
37246
|
+
get: function() {
|
|
37247
|
+
return _parse.default;
|
|
37248
|
+
}
|
|
37249
|
+
});
|
|
37250
|
+
var _v = _interopRequireDefault(require_v1());
|
|
37251
|
+
var _v2 = _interopRequireDefault(require_v3());
|
|
37252
|
+
var _v3 = _interopRequireDefault(require_v4());
|
|
37253
|
+
var _v4 = _interopRequireDefault(require_v5());
|
|
37254
|
+
var _nil = _interopRequireDefault(require_nil());
|
|
37255
|
+
var _version = _interopRequireDefault(require_version());
|
|
37256
|
+
var _validate = _interopRequireDefault(require_validate());
|
|
37257
|
+
var _stringify = _interopRequireDefault(require_stringify5());
|
|
37258
|
+
var _parse = _interopRequireDefault(require_parse5());
|
|
37259
|
+
function _interopRequireDefault(obj) {
|
|
37260
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
37261
|
+
}
|
|
37262
|
+
}
|
|
37263
|
+
});
|
|
37264
|
+
|
|
37265
|
+
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/lexer-state.js
|
|
37266
|
+
var require_lexer_state = __commonJS({
|
|
37267
|
+
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/lexer-state.js"(exports) {
|
|
37268
|
+
"use strict";
|
|
37269
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37270
|
+
var LexerState = function() {
|
|
37271
|
+
function LexerState2(source, position) {
|
|
37272
|
+
if (position === void 0) {
|
|
37273
|
+
position = 0;
|
|
37274
|
+
}
|
|
37275
|
+
this.source = source;
|
|
37276
|
+
this.position = position;
|
|
37277
|
+
}
|
|
37278
|
+
LexerState2.prototype.copy = function() {
|
|
37279
|
+
return new LexerState2(this.source, this.position);
|
|
37280
|
+
};
|
|
37281
|
+
return LexerState2;
|
|
37282
|
+
}();
|
|
37283
|
+
exports.default = LexerState;
|
|
37284
|
+
}
|
|
37285
|
+
});
|
|
37286
|
+
|
|
37287
|
+
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/token.js
|
|
37288
|
+
var require_token = __commonJS({
|
|
37289
|
+
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/token.js"(exports) {
|
|
37290
|
+
"use strict";
|
|
37291
|
+
var __extends = exports && exports.__extends || function() {
|
|
37292
|
+
var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
|
|
37293
|
+
d.__proto__ = b;
|
|
37294
|
+
} || function(d, b) {
|
|
37295
|
+
for (var p in b)
|
|
37296
|
+
if (b.hasOwnProperty(p))
|
|
37297
|
+
d[p] = b[p];
|
|
37298
|
+
};
|
|
37299
|
+
return function(d, b) {
|
|
37300
|
+
extendStatics(d, b);
|
|
37301
|
+
function __() {
|
|
37302
|
+
this.constructor = d;
|
|
37303
|
+
}
|
|
37304
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
37305
|
+
};
|
|
37306
|
+
}();
|
|
37307
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37308
|
+
var Token = function() {
|
|
37309
|
+
function Token2(type, match, groups, start, end, lexer) {
|
|
37310
|
+
this.type = type;
|
|
37311
|
+
this.match = match;
|
|
37312
|
+
this.groups = groups;
|
|
37313
|
+
this.start = start;
|
|
37314
|
+
this.end = end;
|
|
37315
|
+
this.lexer = lexer;
|
|
37316
|
+
}
|
|
37317
|
+
Token2.prototype.strpos = function() {
|
|
37318
|
+
var start = this.lexer.strpos(this.start);
|
|
37319
|
+
var end = this.lexer.strpos(this.end);
|
|
37320
|
+
return { start, end };
|
|
37321
|
+
};
|
|
37322
|
+
Token2.prototype.isEof = function() {
|
|
37323
|
+
return false;
|
|
37324
|
+
};
|
|
37325
|
+
return Token2;
|
|
37326
|
+
}();
|
|
37327
|
+
exports.default = Token;
|
|
37328
|
+
var EOFToken = function(_super) {
|
|
37329
|
+
__extends(EOFToken2, _super);
|
|
37330
|
+
function EOFToken2(lexer) {
|
|
37331
|
+
var _this = this;
|
|
37332
|
+
var end = lexer.source.length;
|
|
37333
|
+
_this = _super.call(this, null, "(eof)", [], end, end, lexer) || this;
|
|
37334
|
+
return _this;
|
|
37335
|
+
}
|
|
37336
|
+
EOFToken2.prototype.isEof = function() {
|
|
37337
|
+
return true;
|
|
37338
|
+
};
|
|
37339
|
+
return EOFToken2;
|
|
37340
|
+
}(Token);
|
|
37341
|
+
exports.EOFToken = EOFToken;
|
|
37342
|
+
exports.EOF = function(lexer) {
|
|
37343
|
+
return new EOFToken(lexer);
|
|
37344
|
+
};
|
|
37345
|
+
}
|
|
37346
|
+
});
|
|
37347
|
+
|
|
37348
|
+
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/token-types.js
|
|
37349
|
+
var require_token_types = __commonJS({
|
|
37350
|
+
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/token-types.js"(exports) {
|
|
37351
|
+
"use strict";
|
|
37352
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37353
|
+
function toRegExp(str) {
|
|
37354
|
+
return new RegExp(str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"));
|
|
37355
|
+
}
|
|
37356
|
+
function normalize(regex) {
|
|
37357
|
+
if (typeof regex === "string")
|
|
37358
|
+
regex = toRegExp(regex);
|
|
37359
|
+
if (!regex.source.startsWith("^"))
|
|
37360
|
+
return new RegExp("^" + regex.source, regex.flags);
|
|
37361
|
+
else
|
|
37362
|
+
return regex;
|
|
37363
|
+
}
|
|
37364
|
+
function first(arr, predicate) {
|
|
37365
|
+
var i = 0;
|
|
37366
|
+
for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
|
|
37367
|
+
var item = arr_1[_i];
|
|
37368
|
+
var result = predicate(item, i++);
|
|
37369
|
+
if (result)
|
|
37370
|
+
return { item, result };
|
|
37371
|
+
}
|
|
37372
|
+
}
|
|
37373
|
+
var TokenTypes = function() {
|
|
37374
|
+
function TokenTypes2() {
|
|
37375
|
+
this.tokenTypes = [];
|
|
37376
|
+
}
|
|
37377
|
+
TokenTypes2.prototype.disable = function(type) {
|
|
37378
|
+
return this.enable(type, false);
|
|
37379
|
+
};
|
|
37380
|
+
TokenTypes2.prototype.enable = function(type, enabled) {
|
|
37381
|
+
if (enabled === void 0) {
|
|
37382
|
+
enabled = true;
|
|
37383
|
+
}
|
|
37384
|
+
this.tokenTypes.filter(function(t) {
|
|
37385
|
+
return t.type == type;
|
|
37386
|
+
}).forEach(function(t) {
|
|
37387
|
+
return t.enabled = enabled;
|
|
37388
|
+
});
|
|
37389
|
+
return this;
|
|
37390
|
+
};
|
|
37391
|
+
TokenTypes2.prototype.isEnabled = function(type) {
|
|
37392
|
+
var ttypes = this.tokenTypes.filter(function(tt) {
|
|
37393
|
+
return tt.type == type;
|
|
37394
|
+
});
|
|
37395
|
+
if (ttypes.length == 0)
|
|
37396
|
+
throw new Error("Token of type " + type + " does not exists");
|
|
37397
|
+
return ttypes[0].enabled;
|
|
37398
|
+
};
|
|
37399
|
+
TokenTypes2.prototype.peek = function(source, position) {
|
|
37400
|
+
var s = source.substr(position);
|
|
37401
|
+
return first(this.tokenTypes.filter(function(tt) {
|
|
37402
|
+
return tt.enabled;
|
|
37403
|
+
}), function(tt) {
|
|
37404
|
+
tt.regex.lastIndex = 0;
|
|
37405
|
+
return tt.regex.exec(s);
|
|
37406
|
+
});
|
|
37407
|
+
};
|
|
37408
|
+
TokenTypes2.prototype.token = function(type, pattern, skip) {
|
|
37409
|
+
if (skip === void 0) {
|
|
37410
|
+
skip = false;
|
|
37411
|
+
}
|
|
37412
|
+
this.tokenTypes.push({
|
|
37413
|
+
type,
|
|
37414
|
+
regex: normalize(pattern),
|
|
37415
|
+
enabled: true,
|
|
37416
|
+
skip
|
|
37417
|
+
});
|
|
37418
|
+
return this;
|
|
37419
|
+
};
|
|
37420
|
+
return TokenTypes2;
|
|
37421
|
+
}();
|
|
37422
|
+
exports.default = TokenTypes;
|
|
37423
|
+
}
|
|
37424
|
+
});
|
|
37425
|
+
|
|
37426
|
+
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/lexer.js
|
|
37427
|
+
var require_lexer = __commonJS({
|
|
37428
|
+
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/lib/lexer.js"(exports) {
|
|
37587
37429
|
"use strict";
|
|
37588
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37589
|
-
|
|
37590
|
-
|
|
37591
|
-
|
|
37592
|
-
|
|
37593
|
-
exports.
|
|
37430
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37431
|
+
var lexer_state_1 = require_lexer_state();
|
|
37432
|
+
exports.LexerState = lexer_state_1.default;
|
|
37433
|
+
var token_1 = require_token();
|
|
37434
|
+
exports.Token = token_1.default;
|
|
37435
|
+
exports.EOF = token_1.EOF;
|
|
37436
|
+
var token_types_1 = require_token_types();
|
|
37437
|
+
exports.TokenTypes = token_types_1.default;
|
|
37438
|
+
var Lexer = function() {
|
|
37439
|
+
function Lexer2(source) {
|
|
37440
|
+
if (source === void 0) {
|
|
37441
|
+
source = "";
|
|
37442
|
+
}
|
|
37443
|
+
this._state = new lexer_state_1.default(source);
|
|
37444
|
+
this._tokenTypes = new token_types_1.default();
|
|
37445
|
+
}
|
|
37446
|
+
Object.defineProperty(Lexer2.prototype, "position", {
|
|
37447
|
+
get: function() {
|
|
37448
|
+
return this._state.position;
|
|
37449
|
+
},
|
|
37450
|
+
set: function(i) {
|
|
37451
|
+
this._state.position = i;
|
|
37452
|
+
},
|
|
37453
|
+
enumerable: true,
|
|
37454
|
+
configurable: true
|
|
37455
|
+
});
|
|
37456
|
+
Object.defineProperty(Lexer2.prototype, "source", {
|
|
37457
|
+
get: function() {
|
|
37458
|
+
return this._state.source;
|
|
37459
|
+
},
|
|
37460
|
+
set: function(s) {
|
|
37461
|
+
this._state = new lexer_state_1.default(s);
|
|
37462
|
+
},
|
|
37463
|
+
enumerable: true,
|
|
37464
|
+
configurable: true
|
|
37465
|
+
});
|
|
37466
|
+
Lexer2.prototype.attachTo = function(other) {
|
|
37467
|
+
this._state = other._state;
|
|
37468
|
+
};
|
|
37469
|
+
Lexer2.prototype.disable = function(type) {
|
|
37470
|
+
this._tokenTypes.disable(type);
|
|
37471
|
+
return this;
|
|
37472
|
+
};
|
|
37473
|
+
Lexer2.prototype.enable = function(type, enabled) {
|
|
37474
|
+
this._tokenTypes.enable(type, enabled);
|
|
37475
|
+
return this;
|
|
37476
|
+
};
|
|
37477
|
+
Lexer2.prototype.expect = function(type) {
|
|
37478
|
+
var t = this.next();
|
|
37479
|
+
if (t.type != type) {
|
|
37480
|
+
var pos = t.strpos();
|
|
37481
|
+
throw new Error("Expected " + type + (t ? ", got " + t.type : "") + " at " + pos.start.line + ":" + pos.start.column);
|
|
37482
|
+
}
|
|
37483
|
+
return t;
|
|
37484
|
+
};
|
|
37485
|
+
Lexer2.prototype.isEnabled = function(tokenType) {
|
|
37486
|
+
return this._tokenTypes.isEnabled(tokenType);
|
|
37487
|
+
};
|
|
37488
|
+
Lexer2.prototype.next = function() {
|
|
37489
|
+
try {
|
|
37490
|
+
var t = this.peek();
|
|
37491
|
+
this._state.position = t.end;
|
|
37492
|
+
return t;
|
|
37493
|
+
} catch (e) {
|
|
37494
|
+
this._state.position = e.end;
|
|
37495
|
+
throw e;
|
|
37496
|
+
}
|
|
37497
|
+
};
|
|
37498
|
+
Lexer2.prototype.peek = function(position) {
|
|
37499
|
+
var _this = this;
|
|
37500
|
+
if (position === void 0) {
|
|
37501
|
+
position = this._state.position;
|
|
37502
|
+
}
|
|
37503
|
+
var read = function(i) {
|
|
37504
|
+
if (i === void 0) {
|
|
37505
|
+
i = position;
|
|
37506
|
+
}
|
|
37507
|
+
if (i >= _this._state.source.length)
|
|
37508
|
+
return token_1.EOF(_this);
|
|
37509
|
+
var n = _this._tokenTypes.peek(_this._state.source, i);
|
|
37510
|
+
return n ? n.item.skip ? read(i + n.result[0].length) : new token_1.default(n.item.type, n.result[0], n.result.map(function(x) {
|
|
37511
|
+
return x;
|
|
37512
|
+
}), i, i + n.result[0].length, _this) : null;
|
|
37513
|
+
};
|
|
37514
|
+
var t = read();
|
|
37515
|
+
if (t)
|
|
37516
|
+
return t;
|
|
37517
|
+
var unexpected = this._state.source.substring(position, position + 1);
|
|
37518
|
+
try {
|
|
37519
|
+
this.peek(position + 1);
|
|
37520
|
+
} catch (e2) {
|
|
37521
|
+
unexpected += e2.unexpected;
|
|
37522
|
+
}
|
|
37523
|
+
var _a = this.strpos(position), line = _a.line, column = _a.column;
|
|
37524
|
+
var e = new Error("Unexpected input: " + unexpected + " at (" + line + ":" + column + ")");
|
|
37525
|
+
e.unexpected = unexpected;
|
|
37526
|
+
e.end = position + unexpected.length;
|
|
37527
|
+
throw e;
|
|
37528
|
+
};
|
|
37529
|
+
Lexer2.prototype.strpos = function(i) {
|
|
37530
|
+
var lines = this._state.source.substring(0, i).split(/\r?\n/);
|
|
37531
|
+
if (!Array.isArray(lines))
|
|
37532
|
+
lines = [lines];
|
|
37533
|
+
var line = lines.length;
|
|
37534
|
+
var column = lines[lines.length - 1].length + 1;
|
|
37535
|
+
return { line, column };
|
|
37536
|
+
};
|
|
37537
|
+
Lexer2.prototype.toArray = function() {
|
|
37538
|
+
var oldState = this._state.copy();
|
|
37539
|
+
this._state.position = 0;
|
|
37540
|
+
var tkns = [];
|
|
37541
|
+
var t;
|
|
37542
|
+
while (!(t = this.next()).isEof())
|
|
37543
|
+
tkns.push(t);
|
|
37544
|
+
this._state = oldState;
|
|
37545
|
+
return tkns;
|
|
37546
|
+
};
|
|
37547
|
+
Lexer2.prototype.token = function(type, pattern, skip) {
|
|
37548
|
+
this._tokenTypes.token(type, pattern, skip);
|
|
37549
|
+
return this;
|
|
37550
|
+
};
|
|
37551
|
+
Lexer2.prototype.keyword = function(kwd) {
|
|
37552
|
+
return this.token(kwd, new RegExp(kwd + "(?=\\W|$)"));
|
|
37553
|
+
};
|
|
37554
|
+
Lexer2.prototype.operator = function(op) {
|
|
37555
|
+
var sOp = new String(op).valueOf();
|
|
37556
|
+
return this.token(op, sOp);
|
|
37557
|
+
};
|
|
37558
|
+
return Lexer2;
|
|
37559
|
+
}();
|
|
37560
|
+
exports.default = Lexer;
|
|
37594
37561
|
}
|
|
37595
37562
|
});
|
|
37596
37563
|
|
|
37597
|
-
// node_modules/.pnpm/
|
|
37598
|
-
var
|
|
37599
|
-
"node_modules/.pnpm/
|
|
37600
|
-
|
|
37601
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37602
|
-
value: true
|
|
37603
|
-
});
|
|
37604
|
-
exports.default = void 0;
|
|
37605
|
-
var _validate = _interopRequireDefault(require_validate());
|
|
37606
|
-
function _interopRequireDefault(obj) {
|
|
37607
|
-
return obj && obj.__esModule ? obj : { default: obj };
|
|
37608
|
-
}
|
|
37609
|
-
function version2(uuid2) {
|
|
37610
|
-
if (!(0, _validate.default)(uuid2)) {
|
|
37611
|
-
throw TypeError("Invalid UUID");
|
|
37612
|
-
}
|
|
37613
|
-
return parseInt(uuid2.substr(14, 1), 16);
|
|
37614
|
-
}
|
|
37615
|
-
var _default = version2;
|
|
37616
|
-
exports.default = _default;
|
|
37564
|
+
// node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/index.js
|
|
37565
|
+
var require_perplex = __commonJS({
|
|
37566
|
+
"node_modules/.pnpm/perplex@0.11.0/node_modules/perplex/index.js"(exports, module) {
|
|
37567
|
+
module.exports = require_lexer();
|
|
37617
37568
|
}
|
|
37618
37569
|
});
|
|
37619
37570
|
|
|
37620
|
-
// node_modules/.pnpm/
|
|
37621
|
-
var
|
|
37622
|
-
"node_modules/.pnpm/
|
|
37571
|
+
// node_modules/.pnpm/pratt@0.7.0/node_modules/pratt/lib/index.js
|
|
37572
|
+
var require_lib5 = __commonJS({
|
|
37573
|
+
"node_modules/.pnpm/pratt@0.7.0/node_modules/pratt/lib/index.js"(exports) {
|
|
37623
37574
|
"use strict";
|
|
37624
|
-
Object.defineProperty(exports, "__esModule", {
|
|
37625
|
-
|
|
37626
|
-
|
|
37627
|
-
|
|
37628
|
-
|
|
37629
|
-
|
|
37630
|
-
|
|
37631
|
-
|
|
37632
|
-
|
|
37633
|
-
|
|
37634
|
-
|
|
37635
|
-
|
|
37636
|
-
|
|
37637
|
-
|
|
37638
|
-
|
|
37639
|
-
|
|
37640
|
-
|
|
37641
|
-
|
|
37642
|
-
return _v3.default;
|
|
37643
|
-
}
|
|
37644
|
-
});
|
|
37645
|
-
Object.defineProperty(exports, "v5", {
|
|
37646
|
-
enumerable: true,
|
|
37647
|
-
get: function() {
|
|
37648
|
-
return _v4.default;
|
|
37649
|
-
}
|
|
37650
|
-
});
|
|
37651
|
-
Object.defineProperty(exports, "NIL", {
|
|
37652
|
-
enumerable: true,
|
|
37653
|
-
get: function() {
|
|
37654
|
-
return _nil.default;
|
|
37655
|
-
}
|
|
37656
|
-
});
|
|
37657
|
-
Object.defineProperty(exports, "version", {
|
|
37658
|
-
enumerable: true,
|
|
37659
|
-
get: function() {
|
|
37660
|
-
return _version.default;
|
|
37661
|
-
}
|
|
37662
|
-
});
|
|
37663
|
-
Object.defineProperty(exports, "validate", {
|
|
37664
|
-
enumerable: true,
|
|
37665
|
-
get: function() {
|
|
37666
|
-
return _validate.default;
|
|
37667
|
-
}
|
|
37668
|
-
});
|
|
37669
|
-
Object.defineProperty(exports, "stringify", {
|
|
37670
|
-
enumerable: true,
|
|
37671
|
-
get: function() {
|
|
37672
|
-
return _stringify.default;
|
|
37575
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37576
|
+
var createStop = function() {
|
|
37577
|
+
var stopCalled = false;
|
|
37578
|
+
return Object.assign(function(x) {
|
|
37579
|
+
stopCalled = true;
|
|
37580
|
+
return x;
|
|
37581
|
+
}, {
|
|
37582
|
+
isStopped: function() {
|
|
37583
|
+
return stopCalled;
|
|
37584
|
+
}
|
|
37585
|
+
});
|
|
37586
|
+
};
|
|
37587
|
+
var Parser3 = function() {
|
|
37588
|
+
function Parser4(lexer) {
|
|
37589
|
+
this.lexer = lexer;
|
|
37590
|
+
this._nuds = /* @__PURE__ */ new Map();
|
|
37591
|
+
this._leds = /* @__PURE__ */ new Map();
|
|
37592
|
+
this._bps = /* @__PURE__ */ new Map();
|
|
37673
37593
|
}
|
|
37674
|
-
|
|
37675
|
-
|
|
37676
|
-
|
|
37677
|
-
|
|
37678
|
-
return
|
|
37594
|
+
Parser4.prototype._type = function(tokenOrType) {
|
|
37595
|
+
return tokenOrType && typeof tokenOrType.isEof == "function" ? tokenOrType.type : tokenOrType;
|
|
37596
|
+
};
|
|
37597
|
+
Parser4.prototype.builder = function() {
|
|
37598
|
+
return new ParserBuilder(this);
|
|
37599
|
+
};
|
|
37600
|
+
Parser4.prototype.bp = function(tokenOrType) {
|
|
37601
|
+
if (tokenOrType == null)
|
|
37602
|
+
return Number.NEGATIVE_INFINITY;
|
|
37603
|
+
if (tokenOrType && typeof tokenOrType.isEof == "function" && tokenOrType.isEof())
|
|
37604
|
+
return Number.NEGATIVE_INFINITY;
|
|
37605
|
+
var type = this._type(tokenOrType);
|
|
37606
|
+
var bp = this._bps.has(type) ? this._bps.get(type) : Number.POSITIVE_INFINITY;
|
|
37607
|
+
return typeof bp == "function" ? bp() : bp;
|
|
37608
|
+
};
|
|
37609
|
+
Parser4.prototype.nud = function(info) {
|
|
37610
|
+
var fn = this._nuds.get(info.token.type);
|
|
37611
|
+
if (!fn) {
|
|
37612
|
+
var start = info.token.strpos().start;
|
|
37613
|
+
throw new Error("Unexpected token: " + info.token.match + " (at " + start.line + ":" + start.column + ")");
|
|
37614
|
+
}
|
|
37615
|
+
return fn(info);
|
|
37616
|
+
};
|
|
37617
|
+
Parser4.prototype.led = function(info) {
|
|
37618
|
+
var fn = this._leds.get(info.token.type);
|
|
37619
|
+
if (!fn) {
|
|
37620
|
+
var start = info.token.strpos().start;
|
|
37621
|
+
throw new Error("Unexpected token: " + info.token.match + " (at " + start.line + ":" + start.column + ")");
|
|
37622
|
+
}
|
|
37623
|
+
return fn(info);
|
|
37624
|
+
};
|
|
37625
|
+
Parser4.prototype.parse = function(opts) {
|
|
37626
|
+
var _this = this;
|
|
37627
|
+
if (opts === void 0) {
|
|
37628
|
+
opts = { terminals: [0] };
|
|
37629
|
+
}
|
|
37630
|
+
var stop = opts.stop = opts.stop || createStop();
|
|
37631
|
+
var check = function() {
|
|
37632
|
+
if (stop.isStopped())
|
|
37633
|
+
return false;
|
|
37634
|
+
var t = _this.lexer.peek();
|
|
37635
|
+
var bp = _this.bp(t);
|
|
37636
|
+
return opts.terminals.reduce(function(canContinue, rbpOrType) {
|
|
37637
|
+
if (!canContinue)
|
|
37638
|
+
return false;
|
|
37639
|
+
if (typeof rbpOrType == "number")
|
|
37640
|
+
return rbpOrType < bp;
|
|
37641
|
+
if (typeof rbpOrType == "string")
|
|
37642
|
+
return t.type != rbpOrType;
|
|
37643
|
+
}, true);
|
|
37644
|
+
};
|
|
37645
|
+
var mkinfo = function(token) {
|
|
37646
|
+
var bp = _this.bp(token);
|
|
37647
|
+
return { token, bp, stop, ctx: opts.ctx, options: opts };
|
|
37648
|
+
};
|
|
37649
|
+
if (!opts.terminals)
|
|
37650
|
+
opts.terminals = [0];
|
|
37651
|
+
if (opts.terminals.length == 0)
|
|
37652
|
+
opts.terminals.push(0);
|
|
37653
|
+
var left = this.nud(mkinfo(this.lexer.next()));
|
|
37654
|
+
while (check()) {
|
|
37655
|
+
var operator = this.lexer.next();
|
|
37656
|
+
left = this.led(Object.assign(mkinfo(operator), { left }));
|
|
37657
|
+
}
|
|
37658
|
+
return left;
|
|
37659
|
+
};
|
|
37660
|
+
return Parser4;
|
|
37661
|
+
}();
|
|
37662
|
+
exports.Parser = Parser3;
|
|
37663
|
+
var ParserBuilder = function() {
|
|
37664
|
+
function ParserBuilder2(parser) {
|
|
37665
|
+
this._parser = parser;
|
|
37679
37666
|
}
|
|
37680
|
-
|
|
37681
|
-
|
|
37682
|
-
|
|
37683
|
-
|
|
37684
|
-
|
|
37685
|
-
|
|
37686
|
-
|
|
37687
|
-
|
|
37688
|
-
|
|
37689
|
-
|
|
37690
|
-
|
|
37691
|
-
|
|
37692
|
-
|
|
37667
|
+
ParserBuilder2.prototype.nud = function(tokenType, bp, fn) {
|
|
37668
|
+
this._parser._nuds.set(tokenType, fn);
|
|
37669
|
+
this.bp(tokenType, bp);
|
|
37670
|
+
return this;
|
|
37671
|
+
};
|
|
37672
|
+
ParserBuilder2.prototype.led = function(tokenType, bp, fn) {
|
|
37673
|
+
this._parser._leds.set(tokenType, fn);
|
|
37674
|
+
this.bp(tokenType, bp);
|
|
37675
|
+
return this;
|
|
37676
|
+
};
|
|
37677
|
+
ParserBuilder2.prototype.either = function(tokenType, bp, fn) {
|
|
37678
|
+
return this.nud(tokenType, bp, function(inf) {
|
|
37679
|
+
return fn(Object.assign(inf, { left: null }));
|
|
37680
|
+
}).led(tokenType, bp, fn);
|
|
37681
|
+
};
|
|
37682
|
+
ParserBuilder2.prototype.bp = function(tokenType, bp) {
|
|
37683
|
+
this._parser._bps.set(tokenType, bp);
|
|
37684
|
+
return this;
|
|
37685
|
+
};
|
|
37686
|
+
ParserBuilder2.prototype.build = function() {
|
|
37687
|
+
return this._parser;
|
|
37688
|
+
};
|
|
37689
|
+
return ParserBuilder2;
|
|
37690
|
+
}();
|
|
37691
|
+
exports.ParserBuilder = ParserBuilder;
|
|
37692
|
+
exports.default = Parser3;
|
|
37693
37693
|
}
|
|
37694
37694
|
});
|
|
37695
37695
|
|
|
@@ -44942,9 +44942,67 @@ ${this.pendingMocks().join("\n")}`
|
|
|
44942
44942
|
var import_supertest = __toESM(require_supertest());
|
|
44943
44943
|
var import_morgan = __toESM(require_morgan());
|
|
44944
44944
|
|
|
44945
|
-
// src/storage.ts
|
|
44945
|
+
// src/storage/abstract.ts
|
|
44946
|
+
var AbstractStorage = class {
|
|
44947
|
+
};
|
|
44948
|
+
|
|
44949
|
+
// src/storage/in-memory.ts
|
|
44946
44950
|
var import_assert = __toESM(__require("assert"));
|
|
44947
44951
|
|
|
44952
|
+
// src/exceptions.ts
|
|
44953
|
+
var CommercetoolsError = class extends Error {
|
|
44954
|
+
constructor(info, statusCode = 400) {
|
|
44955
|
+
super(info.message);
|
|
44956
|
+
this.info = info;
|
|
44957
|
+
this.statusCode = statusCode || 500;
|
|
44958
|
+
}
|
|
44959
|
+
};
|
|
44960
|
+
|
|
44961
|
+
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/wrapper.mjs
|
|
44962
|
+
var import_dist = __toESM(require_dist(), 1);
|
|
44963
|
+
var v1 = import_dist.default.v1;
|
|
44964
|
+
var v3 = import_dist.default.v3;
|
|
44965
|
+
var v4 = import_dist.default.v4;
|
|
44966
|
+
var v5 = import_dist.default.v5;
|
|
44967
|
+
var NIL = import_dist.default.NIL;
|
|
44968
|
+
var version = import_dist.default.version;
|
|
44969
|
+
var validate = import_dist.default.validate;
|
|
44970
|
+
var stringify = import_dist.default.stringify;
|
|
44971
|
+
var parse = import_dist.default.parse;
|
|
44972
|
+
|
|
44973
|
+
// src/helpers.ts
|
|
44974
|
+
var getBaseResourceProperties = () => ({
|
|
44975
|
+
id: v4(),
|
|
44976
|
+
createdAt: new Date().toISOString(),
|
|
44977
|
+
lastModifiedAt: new Date().toISOString(),
|
|
44978
|
+
version: 0
|
|
44979
|
+
});
|
|
44980
|
+
var nestedLookup = (obj, path) => {
|
|
44981
|
+
if (!path || path === "") {
|
|
44982
|
+
return obj;
|
|
44983
|
+
}
|
|
44984
|
+
const parts = path.split(".");
|
|
44985
|
+
let val = obj;
|
|
44986
|
+
for (let i = 0; i < parts.length; i++) {
|
|
44987
|
+
const part = parts[i];
|
|
44988
|
+
if (val == void 0) {
|
|
44989
|
+
return void 0;
|
|
44990
|
+
}
|
|
44991
|
+
val = val[part];
|
|
44992
|
+
}
|
|
44993
|
+
return val;
|
|
44994
|
+
};
|
|
44995
|
+
var QueryParamsAsArray = (input) => {
|
|
44996
|
+
if (input == void 0) {
|
|
44997
|
+
return [];
|
|
44998
|
+
}
|
|
44999
|
+
if (Array.isArray(input)) {
|
|
45000
|
+
return input;
|
|
45001
|
+
}
|
|
45002
|
+
return [input];
|
|
45003
|
+
};
|
|
45004
|
+
var cloneObject = (o) => JSON.parse(JSON.stringify(o));
|
|
45005
|
+
|
|
44948
45006
|
// src/lib/expandParser.ts
|
|
44949
45007
|
var parseExpandClause = (clause) => {
|
|
44950
45008
|
const result = {
|
|
@@ -45235,90 +45293,34 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45235
45293
|
let expr = parser.parse();
|
|
45236
45294
|
if (!Array.isArray(expr)) {
|
|
45237
45295
|
expr = [expr];
|
|
45238
|
-
}
|
|
45239
|
-
return (obj, vars) => {
|
|
45240
|
-
const value = resolveValue(obj, left);
|
|
45241
|
-
if (!Array.isArray(value)) {
|
|
45242
|
-
throw new PredicateError(
|
|
45243
|
-
`The field '${left.value}' does not support this expression.`
|
|
45244
|
-
);
|
|
45245
|
-
}
|
|
45246
|
-
const array = expr.map((item) => resolveSymbol(item, vars));
|
|
45247
|
-
if (keyword.type === "ALL") {
|
|
45248
|
-
return array.every((item) => value.includes(item));
|
|
45249
|
-
} else {
|
|
45250
|
-
return array.some((item) => value.includes(item));
|
|
45251
|
-
}
|
|
45252
|
-
};
|
|
45253
|
-
}).build();
|
|
45254
|
-
const result = parser.parse();
|
|
45255
|
-
if (typeof result !== "function") {
|
|
45256
|
-
const lines = predicate.split("\n");
|
|
45257
|
-
const column = lines[lines.length - 1].length;
|
|
45258
|
-
throw new PredicateError(
|
|
45259
|
-
`Unexpected end of input, expected SphereIdentifierChar, comparison operator, not, in, contains, is, within or matches (line ${lines.length}, column ${column})`
|
|
45260
|
-
);
|
|
45261
|
-
}
|
|
45262
|
-
return result;
|
|
45263
|
-
};
|
|
45264
|
-
|
|
45265
|
-
// src/exceptions.ts
|
|
45266
|
-
var CommercetoolsError = class extends Error {
|
|
45267
|
-
constructor(info, statusCode = 400) {
|
|
45268
|
-
super(info.message);
|
|
45269
|
-
this.info = info;
|
|
45270
|
-
this.statusCode = statusCode || 500;
|
|
45271
|
-
}
|
|
45272
|
-
};
|
|
45273
|
-
|
|
45274
|
-
// node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/wrapper.mjs
|
|
45275
|
-
var import_dist = __toESM(require_dist(), 1);
|
|
45276
|
-
var v1 = import_dist.default.v1;
|
|
45277
|
-
var v3 = import_dist.default.v3;
|
|
45278
|
-
var v4 = import_dist.default.v4;
|
|
45279
|
-
var v5 = import_dist.default.v5;
|
|
45280
|
-
var NIL = import_dist.default.NIL;
|
|
45281
|
-
var version = import_dist.default.version;
|
|
45282
|
-
var validate = import_dist.default.validate;
|
|
45283
|
-
var stringify = import_dist.default.stringify;
|
|
45284
|
-
var parse = import_dist.default.parse;
|
|
45285
|
-
|
|
45286
|
-
// src/helpers.ts
|
|
45287
|
-
var getBaseResourceProperties = () => ({
|
|
45288
|
-
id: v4(),
|
|
45289
|
-
createdAt: new Date().toISOString(),
|
|
45290
|
-
lastModifiedAt: new Date().toISOString(),
|
|
45291
|
-
version: 0
|
|
45292
|
-
});
|
|
45293
|
-
var nestedLookup = (obj, path) => {
|
|
45294
|
-
if (!path || path === "") {
|
|
45295
|
-
return obj;
|
|
45296
|
-
}
|
|
45297
|
-
const parts = path.split(".");
|
|
45298
|
-
let val = obj;
|
|
45299
|
-
for (let i = 0; i < parts.length; i++) {
|
|
45300
|
-
const part = parts[i];
|
|
45301
|
-
if (val == void 0) {
|
|
45302
|
-
return void 0;
|
|
45303
|
-
}
|
|
45304
|
-
val = val[part];
|
|
45305
|
-
}
|
|
45306
|
-
return val;
|
|
45307
|
-
};
|
|
45308
|
-
var QueryParamsAsArray = (input) => {
|
|
45309
|
-
if (input == void 0) {
|
|
45310
|
-
return [];
|
|
45311
|
-
}
|
|
45312
|
-
if (Array.isArray(input)) {
|
|
45313
|
-
return input;
|
|
45296
|
+
}
|
|
45297
|
+
return (obj, vars) => {
|
|
45298
|
+
const value = resolveValue(obj, left);
|
|
45299
|
+
if (!Array.isArray(value)) {
|
|
45300
|
+
throw new PredicateError(
|
|
45301
|
+
`The field '${left.value}' does not support this expression.`
|
|
45302
|
+
);
|
|
45303
|
+
}
|
|
45304
|
+
const array = expr.map((item) => resolveSymbol(item, vars));
|
|
45305
|
+
if (keyword.type === "ALL") {
|
|
45306
|
+
return array.every((item) => value.includes(item));
|
|
45307
|
+
} else {
|
|
45308
|
+
return array.some((item) => value.includes(item));
|
|
45309
|
+
}
|
|
45310
|
+
};
|
|
45311
|
+
}).build();
|
|
45312
|
+
const result = parser.parse();
|
|
45313
|
+
if (typeof result !== "function") {
|
|
45314
|
+
const lines = predicate.split("\n");
|
|
45315
|
+
const column = lines[lines.length - 1].length;
|
|
45316
|
+
throw new PredicateError(
|
|
45317
|
+
`Unexpected end of input, expected SphereIdentifierChar, comparison operator, not, in, contains, is, within or matches (line ${lines.length}, column ${column})`
|
|
45318
|
+
);
|
|
45314
45319
|
}
|
|
45315
|
-
return
|
|
45320
|
+
return result;
|
|
45316
45321
|
};
|
|
45317
|
-
var cloneObject = (o) => JSON.parse(JSON.stringify(o));
|
|
45318
45322
|
|
|
45319
|
-
// src/storage.ts
|
|
45320
|
-
var AbstractStorage = class {
|
|
45321
|
-
};
|
|
45323
|
+
// src/storage/in-memory.ts
|
|
45322
45324
|
var InMemoryStorage = class extends AbstractStorage {
|
|
45323
45325
|
constructor() {
|
|
45324
45326
|
super(...arguments);
|
|
@@ -45414,13 +45416,15 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45414
45416
|
"order-edit": /* @__PURE__ */ new Map(),
|
|
45415
45417
|
payment: /* @__PURE__ */ new Map(),
|
|
45416
45418
|
product: /* @__PURE__ */ new Map(),
|
|
45419
|
+
quote: /* @__PURE__ */ new Map(),
|
|
45420
|
+
"quote-request": /* @__PURE__ */ new Map(),
|
|
45417
45421
|
"product-discount": /* @__PURE__ */ new Map(),
|
|
45418
|
-
"product-price": /* @__PURE__ */ new Map(),
|
|
45419
45422
|
"product-selection": /* @__PURE__ */ new Map(),
|
|
45420
45423
|
"product-type": /* @__PURE__ */ new Map(),
|
|
45421
45424
|
"product-projection": /* @__PURE__ */ new Map(),
|
|
45422
45425
|
review: /* @__PURE__ */ new Map(),
|
|
45423
45426
|
"shipping-method": /* @__PURE__ */ new Map(),
|
|
45427
|
+
"staged-quote": /* @__PURE__ */ new Map(),
|
|
45424
45428
|
state: /* @__PURE__ */ new Map(),
|
|
45425
45429
|
store: /* @__PURE__ */ new Map(),
|
|
45426
45430
|
"shopping-list": /* @__PURE__ */ new Map(),
|
|
@@ -45492,7 +45496,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45492
45496
|
if (!store) {
|
|
45493
45497
|
throw new Error("No type");
|
|
45494
45498
|
}
|
|
45495
|
-
let resources =
|
|
45499
|
+
let resources = this.all(projectKey, typeId);
|
|
45496
45500
|
if (params.where) {
|
|
45497
45501
|
try {
|
|
45498
45502
|
const filterFunc = parseQueryExpression(params.where);
|
|
@@ -45566,7 +45570,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45566
45570
|
console.error(
|
|
45567
45571
|
`No resource found with typeId=${identifier.typeId}, id=${identifier.id}`
|
|
45568
45572
|
);
|
|
45569
|
-
return
|
|
45573
|
+
return null;
|
|
45570
45574
|
}
|
|
45571
45575
|
if (identifier.key) {
|
|
45572
45576
|
const store = this.forProjectKey(projectKey)[identifier.typeId];
|
|
@@ -45583,7 +45587,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45583
45587
|
);
|
|
45584
45588
|
}
|
|
45585
45589
|
}
|
|
45586
|
-
return
|
|
45590
|
+
return null;
|
|
45587
45591
|
}
|
|
45588
45592
|
_resolveReference(projectKey, reference, expand) {
|
|
45589
45593
|
if (reference === void 0)
|
|
@@ -45750,14 +45754,14 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45750
45754
|
|
|
45751
45755
|
// src/projectAPI.ts
|
|
45752
45756
|
var ProjectAPI = class {
|
|
45753
|
-
constructor(projectKey,
|
|
45757
|
+
constructor(projectKey, repositories, storage) {
|
|
45754
45758
|
this.projectKey = projectKey;
|
|
45755
45759
|
this._storage = storage;
|
|
45756
|
-
this.
|
|
45760
|
+
this._repositories = repositories;
|
|
45757
45761
|
}
|
|
45758
45762
|
add(typeId, resource) {
|
|
45759
|
-
const
|
|
45760
|
-
if (
|
|
45763
|
+
const repository = this._repositories[typeId];
|
|
45764
|
+
if (repository) {
|
|
45761
45765
|
this._storage.add(this.projectKey, typeId, {
|
|
45762
45766
|
...getBaseResourceProperties(),
|
|
45763
45767
|
...resource
|
|
@@ -45775,9 +45779,9 @@ ${this.pendingMocks().join("\n")}`
|
|
|
45775
45779
|
);
|
|
45776
45780
|
}
|
|
45777
45781
|
getRepository(typeId) {
|
|
45778
|
-
const
|
|
45779
|
-
if (
|
|
45780
|
-
return
|
|
45782
|
+
const repository = this._repositories[typeId];
|
|
45783
|
+
if (repository !== void 0) {
|
|
45784
|
+
return repository;
|
|
45781
45785
|
}
|
|
45782
45786
|
throw new Error("No such repository");
|
|
45783
45787
|
}
|
|
@@ -46009,14 +46013,14 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46009
46013
|
}
|
|
46010
46014
|
return result;
|
|
46011
46015
|
}
|
|
46012
|
-
postProcessResource(resource) {
|
|
46013
|
-
return resource;
|
|
46014
|
-
}
|
|
46015
46016
|
};
|
|
46016
46017
|
var AbstractResourceRepository = class extends AbstractRepository {
|
|
46017
46018
|
constructor(storage) {
|
|
46018
46019
|
super(storage);
|
|
46019
46020
|
}
|
|
46021
|
+
postProcessResource(resource) {
|
|
46022
|
+
return resource;
|
|
46023
|
+
}
|
|
46020
46024
|
query(context, params = {}) {
|
|
46021
46025
|
const result = this._storage.query(context.projectKey, this.getTypeId(), {
|
|
46022
46026
|
expand: params.expand,
|
|
@@ -46163,11 +46167,13 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46163
46167
|
id: v4(),
|
|
46164
46168
|
productId: product.id,
|
|
46165
46169
|
productKey: product.key,
|
|
46166
|
-
name: product.masterData.current.name,
|
|
46167
46170
|
productSlug: product.masterData.current.slug,
|
|
46168
46171
|
productType: product.productType,
|
|
46172
|
+
name: product.masterData.current.name,
|
|
46169
46173
|
variant,
|
|
46170
46174
|
price,
|
|
46175
|
+
taxedPricePortions: [],
|
|
46176
|
+
perMethodTaxRate: [],
|
|
46171
46177
|
totalPrice: {
|
|
46172
46178
|
...price.value,
|
|
46173
46179
|
centAmount: price.value.centAmount * quantity
|
|
@@ -46314,15 +46320,17 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46314
46320
|
id: v4(),
|
|
46315
46321
|
productId: product.id,
|
|
46316
46322
|
productKey: product.key,
|
|
46317
|
-
name: product.masterData.current.name,
|
|
46318
46323
|
productSlug: product.masterData.current.slug,
|
|
46319
46324
|
productType: product.productType,
|
|
46325
|
+
name: product.masterData.current.name,
|
|
46320
46326
|
variant,
|
|
46321
46327
|
price,
|
|
46322
46328
|
totalPrice: {
|
|
46323
46329
|
...price.value,
|
|
46324
46330
|
centAmount: price.value.centAmount * quant
|
|
46325
46331
|
},
|
|
46332
|
+
taxedPricePortions: [],
|
|
46333
|
+
perMethodTaxRate: [],
|
|
46326
46334
|
quantity: quant,
|
|
46327
46335
|
discountedPricePerQuantity: [],
|
|
46328
46336
|
lineItemMode: "Standard",
|
|
@@ -46347,21 +46355,23 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46347
46355
|
const resource = {
|
|
46348
46356
|
...getBaseResourceProperties(),
|
|
46349
46357
|
cartState: "Active",
|
|
46350
|
-
|
|
46358
|
+
country: draft.country,
|
|
46351
46359
|
customLineItems: [],
|
|
46360
|
+
lineItems,
|
|
46361
|
+
locale: draft.locale,
|
|
46362
|
+
taxCalculationMode: draft.taxCalculationMode ?? "LineItemLevel",
|
|
46363
|
+
taxMode: draft.taxMode ?? "Platform",
|
|
46364
|
+
taxRoundingMode: draft.taxRoundingMode ?? "HalfEven",
|
|
46352
46365
|
totalPrice: {
|
|
46353
46366
|
type: "centPrecision",
|
|
46354
46367
|
centAmount: 0,
|
|
46355
46368
|
currencyCode: draft.currency,
|
|
46356
46369
|
fractionDigits: 0
|
|
46357
46370
|
},
|
|
46358
|
-
|
|
46359
|
-
|
|
46360
|
-
taxCalculationMode: draft.taxCalculationMode ?? "LineItemLevel",
|
|
46361
|
-
refusedGifts: [],
|
|
46362
|
-
locale: draft.locale,
|
|
46363
|
-
country: draft.country,
|
|
46371
|
+
shippingMode: "Single",
|
|
46372
|
+
shipping: [],
|
|
46364
46373
|
origin: draft.origin ?? "Customer",
|
|
46374
|
+
refusedGifts: [],
|
|
46365
46375
|
custom: createCustomFields(
|
|
46366
46376
|
draft.custom,
|
|
46367
46377
|
context.projectKey,
|
|
@@ -46714,10 +46724,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46714
46724
|
}
|
|
46715
46725
|
}
|
|
46716
46726
|
getWithContainerAndKey(context, container, key) {
|
|
46717
|
-
const items = this._storage.all(
|
|
46718
|
-
context.projectKey,
|
|
46719
|
-
this.getTypeId()
|
|
46720
|
-
);
|
|
46727
|
+
const items = this._storage.all(context.projectKey, this.getTypeId());
|
|
46721
46728
|
return items.find(
|
|
46722
46729
|
(item) => item.container === container && item.key === key
|
|
46723
46730
|
);
|
|
@@ -46824,7 +46831,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46824
46831
|
};
|
|
46825
46832
|
}
|
|
46826
46833
|
getTypeId() {
|
|
46827
|
-
return "customer";
|
|
46834
|
+
return "customer-group";
|
|
46828
46835
|
}
|
|
46829
46836
|
create(context, draft) {
|
|
46830
46837
|
const resource = {
|
|
@@ -46909,7 +46916,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
46909
46916
|
};
|
|
46910
46917
|
}
|
|
46911
46918
|
getTypeId() {
|
|
46912
|
-
return "
|
|
46919
|
+
return "discount-code";
|
|
46913
46920
|
}
|
|
46914
46921
|
create(context, draft) {
|
|
46915
46922
|
const resource = {
|
|
@@ -47220,6 +47227,8 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47220
47227
|
refusedGifts: [],
|
|
47221
47228
|
origin: "Customer",
|
|
47222
47229
|
syncInfo: [],
|
|
47230
|
+
shippingMode: cart.shippingMode,
|
|
47231
|
+
shipping: cart.shipping,
|
|
47223
47232
|
store: context.storeKey ? {
|
|
47224
47233
|
key: context.storeKey,
|
|
47225
47234
|
typeId: "store"
|
|
@@ -47248,6 +47257,8 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47248
47257
|
origin: draft.origin || "Customer",
|
|
47249
47258
|
paymentState: draft.paymentState,
|
|
47250
47259
|
refusedGifts: [],
|
|
47260
|
+
shippingMode: "Single",
|
|
47261
|
+
shipping: [],
|
|
47251
47262
|
store: resolveStoreReference(
|
|
47252
47263
|
draft.store,
|
|
47253
47264
|
context.projectKey,
|
|
@@ -47319,6 +47330,8 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47319
47330
|
quantity: draft.quantity,
|
|
47320
47331
|
state: draft.state || [],
|
|
47321
47332
|
taxRate: draft.taxRate,
|
|
47333
|
+
taxedPricePortions: [],
|
|
47334
|
+
perMethodTaxRate: [],
|
|
47322
47335
|
totalPrice: createTypedMoney(draft.price.value),
|
|
47323
47336
|
variant: {
|
|
47324
47337
|
id: variant.id,
|
|
@@ -47340,6 +47353,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47340
47353
|
money: createTypedMoney(draft.money),
|
|
47341
47354
|
name: draft.name,
|
|
47342
47355
|
quantity: draft.quantity,
|
|
47356
|
+
priceMode: draft.priceMode,
|
|
47343
47357
|
slug: draft.slug,
|
|
47344
47358
|
state: [],
|
|
47345
47359
|
totalPrice: createTypedMoney(draft.money)
|
|
@@ -47373,6 +47387,29 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47373
47387
|
}
|
|
47374
47388
|
};
|
|
47375
47389
|
|
|
47390
|
+
// src/repositories/order-edit.ts
|
|
47391
|
+
var OrderEditRepository = class extends AbstractResourceRepository {
|
|
47392
|
+
constructor() {
|
|
47393
|
+
super(...arguments);
|
|
47394
|
+
this.actions = {};
|
|
47395
|
+
}
|
|
47396
|
+
getTypeId() {
|
|
47397
|
+
return "order-edit";
|
|
47398
|
+
}
|
|
47399
|
+
create(context, draft) {
|
|
47400
|
+
const resource = {
|
|
47401
|
+
...getBaseResourceProperties(),
|
|
47402
|
+
stagedActions: draft.stagedActions ?? [],
|
|
47403
|
+
resource: draft.resource,
|
|
47404
|
+
result: {
|
|
47405
|
+
type: "NotProcessed"
|
|
47406
|
+
}
|
|
47407
|
+
};
|
|
47408
|
+
this.saveNew(context, resource);
|
|
47409
|
+
return resource;
|
|
47410
|
+
}
|
|
47411
|
+
};
|
|
47412
|
+
|
|
47376
47413
|
// src/repositories/payment.ts
|
|
47377
47414
|
var PaymentRepository = class extends AbstractResourceRepository {
|
|
47378
47415
|
constructor() {
|
|
@@ -47530,7 +47567,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47530
47567
|
checkForStagedChanges(resource);
|
|
47531
47568
|
return resource;
|
|
47532
47569
|
},
|
|
47533
|
-
|
|
47570
|
+
setDescription: (context, resource, { description, staged }) => {
|
|
47534
47571
|
const onlyStaged = staged !== void 0 ? staged : true;
|
|
47535
47572
|
resource.masterData.staged.description = description;
|
|
47536
47573
|
if (!onlyStaged) {
|
|
@@ -47539,7 +47576,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47539
47576
|
checkForStagedChanges(resource);
|
|
47540
47577
|
return resource;
|
|
47541
47578
|
},
|
|
47542
|
-
|
|
47579
|
+
setKey: (context, resource, { key }) => {
|
|
47543
47580
|
resource.key = key;
|
|
47544
47581
|
return resource;
|
|
47545
47582
|
}
|
|
@@ -47725,18 +47762,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47725
47762
|
}
|
|
47726
47763
|
}
|
|
47727
47764
|
}
|
|
47728
|
-
getWithKey(context, key) {
|
|
47729
|
-
const result = this._storage.query(context.projectKey, this.getTypeId(), {
|
|
47730
|
-
where: [`key="${key}"`]
|
|
47731
|
-
});
|
|
47732
|
-
if (result.count === 1) {
|
|
47733
|
-
return result.results[0];
|
|
47734
|
-
}
|
|
47735
|
-
if (result.count > 1) {
|
|
47736
|
-
throw new Error("Duplicate product discount key");
|
|
47737
|
-
}
|
|
47738
|
-
return;
|
|
47739
|
-
}
|
|
47740
47765
|
};
|
|
47741
47766
|
|
|
47742
47767
|
// src/lib/projectionSearchFilter.ts
|
|
@@ -47984,7 +48009,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
47984
48009
|
this._storage = storage;
|
|
47985
48010
|
}
|
|
47986
48011
|
search(projectKey, params) {
|
|
47987
|
-
let resources = this._storage.all(projectKey, "product").map((r) => this.transform(r, params.staged ?? false)).filter((p) =>
|
|
48012
|
+
let resources = this._storage.all(projectKey, "product").map((r) => this.transform(r, params.staged ?? false)).filter((p) => {
|
|
47988
48013
|
if (!params.staged) {
|
|
47989
48014
|
return p.published;
|
|
47990
48015
|
}
|
|
@@ -48051,8 +48076,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48051
48076
|
}
|
|
48052
48077
|
transform(product, staged) {
|
|
48053
48078
|
const obj = !staged ? product.masterData.current : product.masterData.staged;
|
|
48054
|
-
if (!obj)
|
|
48055
|
-
return null;
|
|
48056
48079
|
return {
|
|
48057
48080
|
id: product.id,
|
|
48058
48081
|
createdAt: product.createdAt,
|
|
@@ -48224,12 +48247,18 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48224
48247
|
throw new Error("No valid action");
|
|
48225
48248
|
}
|
|
48226
48249
|
query(context, params = {}) {
|
|
48227
|
-
|
|
48250
|
+
const response = this._storage.query(context.projectKey, "product", {
|
|
48228
48251
|
expand: params.expand,
|
|
48229
48252
|
where: params.where,
|
|
48230
48253
|
offset: params.offset,
|
|
48231
48254
|
limit: params.limit
|
|
48232
48255
|
});
|
|
48256
|
+
return {
|
|
48257
|
+
...response,
|
|
48258
|
+
results: response.results.map(
|
|
48259
|
+
(r) => this._searchService.transform(r, false)
|
|
48260
|
+
)
|
|
48261
|
+
};
|
|
48233
48262
|
}
|
|
48234
48263
|
search(context, query) {
|
|
48235
48264
|
const results = this._searchService.search(context.projectKey, {
|
|
@@ -48245,6 +48274,27 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48245
48274
|
}
|
|
48246
48275
|
};
|
|
48247
48276
|
|
|
48277
|
+
// src/repositories/product-selection.ts
|
|
48278
|
+
var ProductSelectionRepository = class extends AbstractResourceRepository {
|
|
48279
|
+
constructor() {
|
|
48280
|
+
super(...arguments);
|
|
48281
|
+
this.actions = {};
|
|
48282
|
+
}
|
|
48283
|
+
getTypeId() {
|
|
48284
|
+
return "product-selection";
|
|
48285
|
+
}
|
|
48286
|
+
create(context, draft) {
|
|
48287
|
+
const resource = {
|
|
48288
|
+
...getBaseResourceProperties(),
|
|
48289
|
+
productCount: 0,
|
|
48290
|
+
name: draft.name,
|
|
48291
|
+
type: "individual"
|
|
48292
|
+
};
|
|
48293
|
+
this.saveNew(context, resource);
|
|
48294
|
+
return resource;
|
|
48295
|
+
}
|
|
48296
|
+
};
|
|
48297
|
+
|
|
48248
48298
|
// src/repositories/product-type.ts
|
|
48249
48299
|
var ProductTypeRepository = class extends AbstractResourceRepository {
|
|
48250
48300
|
constructor() {
|
|
@@ -48296,20 +48346,20 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48296
48346
|
this.attributeDefinitionFromAttributeDefinitionDraft(context, attribute)
|
|
48297
48347
|
);
|
|
48298
48348
|
},
|
|
48299
|
-
|
|
48349
|
+
changeAttributeOrderByName: (context, resource, { attributeNames }) => {
|
|
48300
48350
|
var _a;
|
|
48301
48351
|
const attrs = new Map(
|
|
48302
48352
|
(_a = resource.attributes) == null ? void 0 : _a.map((item) => [item.name, item])
|
|
48303
48353
|
);
|
|
48304
48354
|
const result = [];
|
|
48305
48355
|
let current = resource.attributes;
|
|
48306
|
-
|
|
48307
|
-
const attr = attrs.get(
|
|
48356
|
+
attributeNames.forEach((attrName) => {
|
|
48357
|
+
const attr = attrs.get(attrName);
|
|
48308
48358
|
if (attr === void 0) {
|
|
48309
48359
|
throw new Error("New attr");
|
|
48310
48360
|
}
|
|
48311
48361
|
result.push(attr);
|
|
48312
|
-
current = current == null ? void 0 : current.filter((f) => f.name !==
|
|
48362
|
+
current = current == null ? void 0 : current.filter((f) => f.name !== attrName);
|
|
48313
48363
|
});
|
|
48314
48364
|
resource.attributes = result;
|
|
48315
48365
|
if (current) {
|
|
@@ -48357,18 +48407,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48357
48407
|
this.saveNew(context, resource);
|
|
48358
48408
|
return resource;
|
|
48359
48409
|
}
|
|
48360
|
-
getWithKey(context, key) {
|
|
48361
|
-
const result = this._storage.query(context.projectKey, this.getTypeId(), {
|
|
48362
|
-
where: [`key="${key}"`]
|
|
48363
|
-
});
|
|
48364
|
-
if (result.count === 1) {
|
|
48365
|
-
return result.results[0];
|
|
48366
|
-
}
|
|
48367
|
-
if (result.count > 1) {
|
|
48368
|
-
throw new Error("Duplicate product type key");
|
|
48369
|
-
}
|
|
48370
|
-
return;
|
|
48371
|
-
}
|
|
48372
48410
|
};
|
|
48373
48411
|
|
|
48374
48412
|
// src/repositories/project.ts
|
|
@@ -48388,8 +48426,8 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48388
48426
|
changeLanguages: (context, resource, { languages }) => {
|
|
48389
48427
|
resource.languages = languages;
|
|
48390
48428
|
},
|
|
48391
|
-
|
|
48392
|
-
resource.messages.enabled =
|
|
48429
|
+
changeMessagesConfiguration: (context, resource, { messagesConfiguration }) => {
|
|
48430
|
+
resource.messages.enabled = messagesConfiguration.enabled;
|
|
48393
48431
|
},
|
|
48394
48432
|
changeProductSearchIndexingEnabled: (context, resource, { enabled }) => {
|
|
48395
48433
|
var _a;
|
|
@@ -48445,6 +48483,53 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48445
48483
|
}
|
|
48446
48484
|
};
|
|
48447
48485
|
|
|
48486
|
+
// src/repositories/quote.ts
|
|
48487
|
+
var QuoteRepository = class extends AbstractResourceRepository {
|
|
48488
|
+
constructor() {
|
|
48489
|
+
super(...arguments);
|
|
48490
|
+
this.actions = {};
|
|
48491
|
+
}
|
|
48492
|
+
getTypeId() {
|
|
48493
|
+
return "quote";
|
|
48494
|
+
}
|
|
48495
|
+
create(context, draft) {
|
|
48496
|
+
throw new Error("not implemented");
|
|
48497
|
+
}
|
|
48498
|
+
};
|
|
48499
|
+
|
|
48500
|
+
// src/repositories/quote-request.ts
|
|
48501
|
+
var QuoteRequestRepository = class extends AbstractResourceRepository {
|
|
48502
|
+
constructor() {
|
|
48503
|
+
super(...arguments);
|
|
48504
|
+
this.actions = {};
|
|
48505
|
+
}
|
|
48506
|
+
getTypeId() {
|
|
48507
|
+
return "quote-request";
|
|
48508
|
+
}
|
|
48509
|
+
create(context, draft) {
|
|
48510
|
+
throw new Error("not implemented");
|
|
48511
|
+
}
|
|
48512
|
+
};
|
|
48513
|
+
|
|
48514
|
+
// src/repositories/review.ts
|
|
48515
|
+
var ReviewRepository = class extends AbstractResourceRepository {
|
|
48516
|
+
constructor() {
|
|
48517
|
+
super(...arguments);
|
|
48518
|
+
this.actions = {};
|
|
48519
|
+
}
|
|
48520
|
+
getTypeId() {
|
|
48521
|
+
return "review";
|
|
48522
|
+
}
|
|
48523
|
+
create(context, draft) {
|
|
48524
|
+
const resource = {
|
|
48525
|
+
...getBaseResourceProperties(),
|
|
48526
|
+
includedInStatistics: false
|
|
48527
|
+
};
|
|
48528
|
+
this.saveNew(context, resource);
|
|
48529
|
+
return resource;
|
|
48530
|
+
}
|
|
48531
|
+
};
|
|
48532
|
+
|
|
48448
48533
|
// src/repositories/shipping-method.ts
|
|
48449
48534
|
var import_deep_equal3 = __toESM(require_deep_equal());
|
|
48450
48535
|
var ShippingMethodRepository = class extends AbstractResourceRepository {
|
|
@@ -48619,6 +48704,41 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48619
48704
|
}
|
|
48620
48705
|
};
|
|
48621
48706
|
|
|
48707
|
+
// src/repositories/staged-quote.ts
|
|
48708
|
+
var StagedQuoteRepository = class extends AbstractResourceRepository {
|
|
48709
|
+
constructor() {
|
|
48710
|
+
super(...arguments);
|
|
48711
|
+
this.actions = {};
|
|
48712
|
+
}
|
|
48713
|
+
getTypeId() {
|
|
48714
|
+
return "staged-quote";
|
|
48715
|
+
}
|
|
48716
|
+
create(context, draft) {
|
|
48717
|
+
throw new Error("not implemented");
|
|
48718
|
+
}
|
|
48719
|
+
};
|
|
48720
|
+
|
|
48721
|
+
// src/repositories/standalone-price.ts
|
|
48722
|
+
var StandAlonePriceRepository = class extends AbstractResourceRepository {
|
|
48723
|
+
constructor() {
|
|
48724
|
+
super(...arguments);
|
|
48725
|
+
this.actions = {};
|
|
48726
|
+
}
|
|
48727
|
+
getTypeId() {
|
|
48728
|
+
return "standalone-price";
|
|
48729
|
+
}
|
|
48730
|
+
create(context, draft) {
|
|
48731
|
+
const resource = {
|
|
48732
|
+
...getBaseResourceProperties(),
|
|
48733
|
+
active: draft.active,
|
|
48734
|
+
sku: draft.sku,
|
|
48735
|
+
value: draft.value
|
|
48736
|
+
};
|
|
48737
|
+
this.saveNew(context, resource);
|
|
48738
|
+
return resource;
|
|
48739
|
+
}
|
|
48740
|
+
};
|
|
48741
|
+
|
|
48622
48742
|
// src/repositories/state.ts
|
|
48623
48743
|
var StateRepository = class extends AbstractResourceRepository {
|
|
48624
48744
|
constructor() {
|
|
@@ -48739,18 +48859,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48739
48859
|
)
|
|
48740
48860
|
);
|
|
48741
48861
|
}
|
|
48742
|
-
getWithKey(context, key) {
|
|
48743
|
-
const result = this._storage.query(context.projectKey, this.getTypeId(), {
|
|
48744
|
-
where: [`key="${key}"`]
|
|
48745
|
-
});
|
|
48746
|
-
if (result.count === 1) {
|
|
48747
|
-
return result.results[0];
|
|
48748
|
-
}
|
|
48749
|
-
if (result.count > 1) {
|
|
48750
|
-
throw new Error("Duplicate store key");
|
|
48751
|
-
}
|
|
48752
|
-
return;
|
|
48753
|
-
}
|
|
48754
48862
|
};
|
|
48755
48863
|
|
|
48756
48864
|
// src/repositories/subscription.ts
|
|
@@ -48849,18 +48957,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
48849
48957
|
this.saveNew(context, resource);
|
|
48850
48958
|
return resource;
|
|
48851
48959
|
}
|
|
48852
|
-
getWithKey(context, key) {
|
|
48853
|
-
const result = this._storage.query(context.projectKey, this.getTypeId(), {
|
|
48854
|
-
where: [`key="${key}"`]
|
|
48855
|
-
});
|
|
48856
|
-
if (result.count === 1) {
|
|
48857
|
-
return result.results[0];
|
|
48858
|
-
}
|
|
48859
|
-
if (result.count > 1) {
|
|
48860
|
-
throw new Error("Duplicate tax category key");
|
|
48861
|
-
}
|
|
48862
|
-
return;
|
|
48863
|
-
}
|
|
48864
48960
|
};
|
|
48865
48961
|
|
|
48866
48962
|
// src/repositories/type.ts
|
|
@@ -49019,18 +49115,25 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49019
49115
|
"inventory-entry": new InventoryEntryRepository(storage),
|
|
49020
49116
|
"key-value-document": new CustomObjectRepository(storage),
|
|
49021
49117
|
order: new OrderRepository(storage),
|
|
49118
|
+
"order-edit": new OrderEditRepository(storage),
|
|
49022
49119
|
payment: new PaymentRepository(storage),
|
|
49023
49120
|
"my-cart": new CartRepository(storage),
|
|
49024
49121
|
"my-order": new MyOrderRepository(storage),
|
|
49025
49122
|
"my-customer": new CustomerRepository(storage),
|
|
49026
49123
|
"my-payment": new PaymentRepository(storage),
|
|
49027
|
-
"shipping-method": new ShippingMethodRepository(storage),
|
|
49028
|
-
"product-type": new ProductTypeRepository(storage),
|
|
49029
49124
|
product: new ProductRepository(storage),
|
|
49030
|
-
|
|
49125
|
+
"product-type": new ProductTypeRepository(storage),
|
|
49031
49126
|
"product-discount": new ProductDiscountRepository(storage),
|
|
49032
49127
|
"product-projection": new ProductProjectionRepository(storage),
|
|
49128
|
+
"product-selection": new ProductSelectionRepository(storage),
|
|
49129
|
+
project: new ProjectRepository(storage),
|
|
49130
|
+
review: new ReviewRepository(storage),
|
|
49131
|
+
quote: new QuoteRepository(storage),
|
|
49132
|
+
"quote-request": new QuoteRequestRepository(storage),
|
|
49133
|
+
"shipping-method": new ShippingMethodRepository(storage),
|
|
49033
49134
|
"shopping-list": new ShoppingListRepository(storage),
|
|
49135
|
+
"staged-quote": new StagedQuoteRepository(storage),
|
|
49136
|
+
"standalone-price": new StandAlonePriceRepository(storage),
|
|
49034
49137
|
state: new StateRepository(storage),
|
|
49035
49138
|
store: new StoreRepository(storage),
|
|
49036
49139
|
subscription: new SubscriptionRepository(storage),
|
|
@@ -49199,25 +49302,27 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49199
49302
|
return "carts";
|
|
49200
49303
|
}
|
|
49201
49304
|
extraRoutes(parent) {
|
|
49202
|
-
parent.post("/replicate", (
|
|
49203
|
-
|
|
49204
|
-
|
|
49205
|
-
|
|
49206
|
-
|
|
49207
|
-
|
|
49208
|
-
|
|
49209
|
-
|
|
49210
|
-
|
|
49211
|
-
|
|
49212
|
-
|
|
49213
|
-
|
|
49214
|
-
|
|
49215
|
-
|
|
49216
|
-
|
|
49217
|
-
|
|
49218
|
-
|
|
49219
|
-
|
|
49220
|
-
}
|
|
49305
|
+
parent.post("/replicate", this.replicate.bind(this));
|
|
49306
|
+
}
|
|
49307
|
+
replicate(request, response) {
|
|
49308
|
+
const context = getRepositoryContext(request);
|
|
49309
|
+
const cartOrOrder = request.body.reference.typeId === "order" ? this.orderRepository.get(context, request.body.reference.id) : this.repository.get(context, request.body.reference.id);
|
|
49310
|
+
if (!cartOrOrder) {
|
|
49311
|
+
return response.status(400).send();
|
|
49312
|
+
}
|
|
49313
|
+
const cartDraft = {
|
|
49314
|
+
...cartOrOrder,
|
|
49315
|
+
currency: cartOrOrder.totalPrice.currencyCode,
|
|
49316
|
+
discountCodes: [],
|
|
49317
|
+
shipping: [],
|
|
49318
|
+
lineItems: cartOrOrder.lineItems.map((lineItem) => ({
|
|
49319
|
+
...lineItem,
|
|
49320
|
+
variantId: lineItem.variant.id,
|
|
49321
|
+
sku: lineItem.variant.sku
|
|
49322
|
+
}))
|
|
49323
|
+
};
|
|
49324
|
+
const newCart = this.repository.create(context, cartDraft);
|
|
49325
|
+
return response.status(200).send(newCart);
|
|
49221
49326
|
}
|
|
49222
49327
|
};
|
|
49223
49328
|
|
|
@@ -49561,19 +49666,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49561
49666
|
getBasePath() {
|
|
49562
49667
|
return "product-discounts";
|
|
49563
49668
|
}
|
|
49564
|
-
extraRoutes(router) {
|
|
49565
|
-
router.get("/key=:key", this.getWithKey.bind(this));
|
|
49566
|
-
}
|
|
49567
|
-
getWithKey(request, response) {
|
|
49568
|
-
const resource = this.repository.getWithKey(
|
|
49569
|
-
getRepositoryContext(request),
|
|
49570
|
-
request.params.key
|
|
49571
|
-
);
|
|
49572
|
-
if (resource) {
|
|
49573
|
-
return response.status(200).send(resource);
|
|
49574
|
-
}
|
|
49575
|
-
return response.status(404).send("Not found");
|
|
49576
|
-
}
|
|
49577
49669
|
};
|
|
49578
49670
|
|
|
49579
49671
|
// src/services/product-projection.ts
|
|
@@ -49606,19 +49698,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49606
49698
|
getBasePath() {
|
|
49607
49699
|
return "product-types";
|
|
49608
49700
|
}
|
|
49609
|
-
extraRoutes(router) {
|
|
49610
|
-
router.get("/key=:key", this.getWithKey.bind(this));
|
|
49611
|
-
}
|
|
49612
|
-
getWithKey(request, response) {
|
|
49613
|
-
const resource = this.repository.getWithKey(
|
|
49614
|
-
getRepositoryContext(request),
|
|
49615
|
-
request.params.key
|
|
49616
|
-
);
|
|
49617
|
-
if (resource) {
|
|
49618
|
-
return response.status(200).send(resource);
|
|
49619
|
-
}
|
|
49620
|
-
return response.status(404).send("Not found");
|
|
49621
|
-
}
|
|
49622
49701
|
};
|
|
49623
49702
|
|
|
49624
49703
|
// src/services/shipping-method.ts
|
|
@@ -49667,19 +49746,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49667
49746
|
getBasePath() {
|
|
49668
49747
|
return "stores";
|
|
49669
49748
|
}
|
|
49670
|
-
extraRoutes(router) {
|
|
49671
|
-
router.get("/key=:key", this.getWithKey.bind(this));
|
|
49672
|
-
}
|
|
49673
|
-
getWithKey(request, response) {
|
|
49674
|
-
const resource = this.repository.getWithKey(
|
|
49675
|
-
getRepositoryContext(request),
|
|
49676
|
-
request.params.key
|
|
49677
|
-
);
|
|
49678
|
-
if (resource) {
|
|
49679
|
-
return response.status(200).send(resource);
|
|
49680
|
-
}
|
|
49681
|
-
return response.status(404).send("Not found");
|
|
49682
|
-
}
|
|
49683
49749
|
};
|
|
49684
49750
|
|
|
49685
49751
|
// src/services/subscription.ts
|
|
@@ -49702,19 +49768,6 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49702
49768
|
getBasePath() {
|
|
49703
49769
|
return "tax-categories";
|
|
49704
49770
|
}
|
|
49705
|
-
extraRoutes(router) {
|
|
49706
|
-
router.get("/key=:key", this.getWithKey.bind(this));
|
|
49707
|
-
}
|
|
49708
|
-
getWithKey(request, response) {
|
|
49709
|
-
const resource = this.repository.getWithKey(
|
|
49710
|
-
getRepositoryContext(request),
|
|
49711
|
-
request.params.key
|
|
49712
|
-
);
|
|
49713
|
-
if (resource) {
|
|
49714
|
-
return response.status(200).send(resource);
|
|
49715
|
-
}
|
|
49716
|
-
return response.status(404).send("Not found");
|
|
49717
|
-
}
|
|
49718
49771
|
};
|
|
49719
49772
|
|
|
49720
49773
|
// src/services/type.ts
|
|
@@ -49799,8 +49852,8 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49799
49852
|
constructor(options = {}) {
|
|
49800
49853
|
this._nockScopes = { auth: void 0, api: void 0 };
|
|
49801
49854
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
49802
|
-
this._services =
|
|
49803
|
-
this._repositories =
|
|
49855
|
+
this._services = null;
|
|
49856
|
+
this._repositories = null;
|
|
49804
49857
|
this._projectService = void 0;
|
|
49805
49858
|
this._storage = new InMemoryStorage();
|
|
49806
49859
|
this._oauth2 = new OAuth2Server({
|
|
@@ -49827,9 +49880,12 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49827
49880
|
if (!projectKey && !this.options.defaultProjectKey) {
|
|
49828
49881
|
throw new Error("No projectKey passed and no default set");
|
|
49829
49882
|
}
|
|
49883
|
+
if (this._repositories === null) {
|
|
49884
|
+
throw new Error("repositories not initialized yet");
|
|
49885
|
+
}
|
|
49830
49886
|
return new ProjectAPI(
|
|
49831
49887
|
projectKey || this.options.defaultProjectKey,
|
|
49832
|
-
this.
|
|
49888
|
+
this._repositories,
|
|
49833
49889
|
this._storage
|
|
49834
49890
|
);
|
|
49835
49891
|
}
|
|
@@ -49840,6 +49896,7 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49840
49896
|
server.keepAliveTimeout = 60 * 1e3;
|
|
49841
49897
|
}
|
|
49842
49898
|
createApp(options) {
|
|
49899
|
+
this._repositories = createRepositories(this._storage);
|
|
49843
49900
|
const app = (0, import_express6.default)();
|
|
49844
49901
|
const projectRouter = import_express6.default.Router({ mergeParams: true });
|
|
49845
49902
|
projectRouter.use(import_express6.default.json());
|
|
@@ -49858,12 +49915,11 @@ ${this.pendingMocks().join("\n")}`
|
|
|
49858
49915
|
app.use("/:projectKey", projectRouter);
|
|
49859
49916
|
app.use("/:projectKey/in-store/key=:storeKey", projectRouter);
|
|
49860
49917
|
}
|
|
49861
|
-
this.
|
|
49918
|
+
this._services = createServices(projectRouter, this._repositories);
|
|
49862
49919
|
this._projectService = new ProjectService(
|
|
49863
49920
|
projectRouter,
|
|
49864
49921
|
this._repositories.project
|
|
49865
49922
|
);
|
|
49866
|
-
this._services = createServices(projectRouter, this._repositories);
|
|
49867
49923
|
app.use((err, req, resp, next) => {
|
|
49868
49924
|
if (err instanceof CommercetoolsError) {
|
|
49869
49925
|
return resp.status(err.statusCode).send({
|