@bleedingdev/modern-js-utils 3.9.0-ultramodern.3 → 3.9.0-ultramodern.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/universal/index.js +5 -25
- package/dist/esm/universal/index.mjs +0 -2
- package/dist/esm-node/universal/index.mjs +0 -2
- package/dist/types/universal/index.d.ts +0 -2
- package/package.json +2 -2
- package/dist/cjs/universal/backend-federation-contract/build-artifact.js +0 -185
- package/dist/cjs/universal/backend-federation-contract/constants.js +0 -92
- package/dist/cjs/universal/backend-federation-contract/delivery-unit.js +0 -130
- package/dist/cjs/universal/backend-federation-contract/index.js +0 -137
- package/dist/cjs/universal/backend-federation-contract/metadata.js +0 -133
- package/dist/cjs/universal/backend-federation-contract/types.js +0 -18
- package/dist/cjs/universal/backend-federation-contract/validation-core.js +0 -85
- package/dist/cjs/universal/surface-resolution/env-static-provider.js +0 -318
- package/dist/cjs/universal/surface-resolution/index.js +0 -69
- package/dist/cjs/universal/surface-resolution/surface-ref.js +0 -132
- package/dist/cjs/universal/surface-resolution/types.js +0 -18
- package/dist/cjs/universal/surface-resolution/validation.js +0 -202
- package/dist/esm/universal/backend-federation-contract/build-artifact.mjs +0 -135
- package/dist/esm/universal/backend-federation-contract/constants.mjs +0 -18
- package/dist/esm/universal/backend-federation-contract/delivery-unit.mjs +0 -74
- package/dist/esm/universal/backend-federation-contract/index.mjs +0 -5
- package/dist/esm/universal/backend-federation-contract/metadata.mjs +0 -80
- package/dist/esm/universal/backend-federation-contract/types.mjs +0 -0
- package/dist/esm/universal/backend-federation-contract/validation-core.mjs +0 -29
- package/dist/esm/universal/surface-resolution/env-static-provider.mjs +0 -274
- package/dist/esm/universal/surface-resolution/index.mjs +0 -3
- package/dist/esm/universal/surface-resolution/surface-ref.mjs +0 -88
- package/dist/esm/universal/surface-resolution/types.mjs +0 -0
- package/dist/esm/universal/surface-resolution/validation.mjs +0 -155
- package/dist/esm-node/universal/backend-federation-contract/build-artifact.mjs +0 -136
- package/dist/esm-node/universal/backend-federation-contract/constants.mjs +0 -19
- package/dist/esm-node/universal/backend-federation-contract/delivery-unit.mjs +0 -75
- package/dist/esm-node/universal/backend-federation-contract/index.mjs +0 -6
- package/dist/esm-node/universal/backend-federation-contract/metadata.mjs +0 -81
- package/dist/esm-node/universal/backend-federation-contract/types.mjs +0 -1
- package/dist/esm-node/universal/backend-federation-contract/validation-core.mjs +0 -30
- package/dist/esm-node/universal/surface-resolution/env-static-provider.mjs +0 -275
- package/dist/esm-node/universal/surface-resolution/index.mjs +0 -4
- package/dist/esm-node/universal/surface-resolution/surface-ref.mjs +0 -89
- package/dist/esm-node/universal/surface-resolution/types.mjs +0 -1
- package/dist/esm-node/universal/surface-resolution/validation.mjs +0 -156
- package/dist/types/universal/backend-federation-contract/build-artifact.d.ts +0 -9
- package/dist/types/universal/backend-federation-contract/constants.d.ts +0 -14
- package/dist/types/universal/backend-federation-contract/delivery-unit.d.ts +0 -9
- package/dist/types/universal/backend-federation-contract/index.d.ts +0 -7
- package/dist/types/universal/backend-federation-contract/metadata.d.ts +0 -7
- package/dist/types/universal/backend-federation-contract/types.d.ts +0 -60
- package/dist/types/universal/backend-federation-contract/validation-core.d.ts +0 -8
- package/dist/types/universal/surface-resolution/env-static-provider.d.ts +0 -107
- package/dist/types/universal/surface-resolution/index.d.ts +0 -4
- package/dist/types/universal/surface-resolution/surface-ref.d.ts +0 -72
- package/dist/types/universal/surface-resolution/types.d.ts +0 -102
- package/dist/types/universal/surface-resolution/validation.d.ts +0 -53
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
backendFederationExposeNames: ()=>backendFederationExposeNames,
|
|
32
|
-
backendFederationMetadata: ()=>backendFederationMetadata,
|
|
33
|
-
backendFederationVersionBoundary: ()=>backendFederationVersionBoundary,
|
|
34
|
-
toBackendFederationExposeNames: ()=>toBackendFederationExposeNames,
|
|
35
|
-
validateBackendFederationManifest: ()=>validateBackendFederationManifest,
|
|
36
|
-
validateBackendFederationMetadata: ()=>validateBackendFederationMetadata
|
|
37
|
-
});
|
|
38
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
39
|
-
const external_delivery_unit_js_namespaceObject = require("./delivery-unit.js");
|
|
40
|
-
const external_validation_core_js_namespaceObject = require("./validation-core.js");
|
|
41
|
-
const toBackendFederationExposeNames = (value)=>{
|
|
42
|
-
const names = [];
|
|
43
|
-
if (Array.isArray(value)) for (const expose of value){
|
|
44
|
-
const name = (0, external_validation_core_js_namespaceObject.nonEmptyString)(expose) ?? ((0, external_validation_core_js_namespaceObject.isRecord)(expose) ? (0, external_validation_core_js_namespaceObject.nonEmptyString)(expose.name) : void 0);
|
|
45
|
-
if (name) names.push(name);
|
|
46
|
-
}
|
|
47
|
-
else if ((0, external_validation_core_js_namespaceObject.isRecord)(value)) names.push(...Object.keys(value).filter((name)=>name.length > 0));
|
|
48
|
-
return Array.from(new Set(names));
|
|
49
|
-
};
|
|
50
|
-
const backendFederationExposeNames = (value)=>{
|
|
51
|
-
if (!(0, external_validation_core_js_namespaceObject.isRecord)(value)) return [];
|
|
52
|
-
const exposes = toBackendFederationExposeNames(value.exposes);
|
|
53
|
-
const expose = (0, external_validation_core_js_namespaceObject.nonEmptyString)(value.expose);
|
|
54
|
-
return Array.from(new Set([
|
|
55
|
-
...exposes,
|
|
56
|
-
...expose ? [
|
|
57
|
-
expose
|
|
58
|
-
] : []
|
|
59
|
-
]));
|
|
60
|
-
};
|
|
61
|
-
const backendFederationMetadata = (value)=>(0, external_validation_core_js_namespaceObject.isRecord)(value) ? (0, external_validation_core_js_namespaceObject.recordField)(value, 'backendFederation') : void 0;
|
|
62
|
-
const backendFederationVersionBoundary = (value)=>(0, external_validation_core_js_namespaceObject.recordField)(backendFederationMetadata(value), 'versionBoundary');
|
|
63
|
-
const validateBackendFederationMetadata = (value, options = {})=>{
|
|
64
|
-
const path = options.path ?? 'backendFederation';
|
|
65
|
-
const errors = [];
|
|
66
|
-
if (!(0, external_validation_core_js_namespaceObject.isRecord)(value)) {
|
|
67
|
-
(0, external_validation_core_js_namespaceObject.addError)(errors, path, 'must be an object.');
|
|
68
|
-
return (0, external_validation_core_js_namespaceObject.validationResult)(errors);
|
|
69
|
-
}
|
|
70
|
-
if (options.requireEffectRuntime && 'effect' !== value.runtimeFramework) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.runtimeFramework`, 'must be "effect".');
|
|
71
|
-
if (options.requireEffectRuntime && true !== value.strictEffectApproach) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.strictEffectApproach`, 'must be true.');
|
|
72
|
-
(0, external_validation_core_js_namespaceObject.validateVersionField)(errors, value, 'contractVersion', options.expectedContractVersion ?? external_constants_js_namespaceObject.BACKEND_FEDERATION_CONTRACT_VERSION, path, options.requireVersionFields ?? false);
|
|
73
|
-
(0, external_validation_core_js_namespaceObject.validateVersionField)(errors, value, 'nodeAdapterVersion', options.expectedNodeAdapterVersion ?? external_constants_js_namespaceObject.BACKEND_FEDERATION_NODE_ADAPTER_VERSION, path, options.requireVersionFields ?? false);
|
|
74
|
-
if (options.requireEffectExpose && !backendFederationExposeNames(value).includes(external_constants_js_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE)) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.expose`, `must include "${external_constants_js_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE}".`);
|
|
75
|
-
if (options.validateDeliveryUnit ?? true) {
|
|
76
|
-
const deliveryUnit = (0, external_validation_core_js_namespaceObject.recordField)(value, 'deliveryUnit');
|
|
77
|
-
if (deliveryUnit) errors.push(...(0, external_delivery_unit_js_namespaceObject.validateDeliveryUnitContractBlock)(deliveryUnit, {
|
|
78
|
-
path: `${path}.deliveryUnit`
|
|
79
|
-
}).errors);
|
|
80
|
-
const versionBoundary = (0, external_validation_core_js_namespaceObject.recordField)(value, 'versionBoundary');
|
|
81
|
-
const versionBoundaryDeliveryUnit = (0, external_validation_core_js_namespaceObject.recordField)(versionBoundary, 'deliveryUnit');
|
|
82
|
-
if (versionBoundaryDeliveryUnit) errors.push(...(0, external_delivery_unit_js_namespaceObject.validateDeliveryUnitBoundaryIdentity)(versionBoundaryDeliveryUnit, `${path}.versionBoundary.deliveryUnit`));
|
|
83
|
-
if (deliveryUnit && versionBoundaryDeliveryUnit) for (const field of external_constants_js_namespaceObject.DELIVERY_UNIT_IDENTITY_FIELDS){
|
|
84
|
-
const deliveryUnitValue = (0, external_delivery_unit_js_namespaceObject.deliveryUnitIdentityFieldValue)(deliveryUnit, field);
|
|
85
|
-
const versionBoundaryDeliveryUnitValue = (0, external_delivery_unit_js_namespaceObject.deliveryUnitIdentityFieldValue)(versionBoundaryDeliveryUnit, field);
|
|
86
|
-
if (deliveryUnitValue && versionBoundaryDeliveryUnitValue && deliveryUnitValue !== versionBoundaryDeliveryUnitValue) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.versionBoundary.deliveryUnit.${field}`, `must match ${path}.deliveryUnit.${field}.`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return (0, external_validation_core_js_namespaceObject.validationResult)(errors);
|
|
90
|
-
};
|
|
91
|
-
const validateBackendFederationManifest = (value, options = {})=>{
|
|
92
|
-
const path = options.path ?? 'manifest';
|
|
93
|
-
const errors = [];
|
|
94
|
-
if (!(0, external_validation_core_js_namespaceObject.isRecord)(value)) {
|
|
95
|
-
(0, external_validation_core_js_namespaceObject.addError)(errors, path, 'must be an object.');
|
|
96
|
-
return (0, external_validation_core_js_namespaceObject.validationResult)(errors);
|
|
97
|
-
}
|
|
98
|
-
if (void 0 !== value.schemaVersion && value.schemaVersion !== external_constants_js_namespaceObject.DELIVERY_UNIT_SCHEMA_VERSION) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.schemaVersion`, `must be ${external_constants_js_namespaceObject.DELIVERY_UNIT_SCHEMA_VERSION}.`);
|
|
99
|
-
const metadata = backendFederationMetadata(value);
|
|
100
|
-
if (metadata) errors.push(...validateBackendFederationMetadata(metadata, {
|
|
101
|
-
...options,
|
|
102
|
-
path: `${path}.backendFederation`,
|
|
103
|
-
requireEffectExpose: false
|
|
104
|
-
}).errors);
|
|
105
|
-
else if (options.requireBackendFederation ?? true) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.backendFederation`, 'must be an object.');
|
|
106
|
-
if (options.requireEffectExpose) {
|
|
107
|
-
const topLevelExposeNames = toBackendFederationExposeNames(value.exposes);
|
|
108
|
-
const metadataExposeNames = backendFederationExposeNames(metadata);
|
|
109
|
-
const exposeNames = new Set([
|
|
110
|
-
...topLevelExposeNames,
|
|
111
|
-
...metadataExposeNames
|
|
112
|
-
]);
|
|
113
|
-
if (!exposeNames.has(external_constants_js_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE)) (0, external_validation_core_js_namespaceObject.addError)(errors, `${path}.exposes`, `must include "${external_constants_js_namespaceObject.BACKEND_FEDERATION_EFFECT_EXPOSE}".`);
|
|
114
|
-
}
|
|
115
|
-
return (0, external_validation_core_js_namespaceObject.validationResult)(errors);
|
|
116
|
-
};
|
|
117
|
-
exports.backendFederationExposeNames = __webpack_exports__.backendFederationExposeNames;
|
|
118
|
-
exports.backendFederationMetadata = __webpack_exports__.backendFederationMetadata;
|
|
119
|
-
exports.backendFederationVersionBoundary = __webpack_exports__.backendFederationVersionBoundary;
|
|
120
|
-
exports.toBackendFederationExposeNames = __webpack_exports__.toBackendFederationExposeNames;
|
|
121
|
-
exports.validateBackendFederationManifest = __webpack_exports__.validateBackendFederationManifest;
|
|
122
|
-
exports.validateBackendFederationMetadata = __webpack_exports__.validateBackendFederationMetadata;
|
|
123
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
124
|
-
"backendFederationExposeNames",
|
|
125
|
-
"backendFederationMetadata",
|
|
126
|
-
"backendFederationVersionBoundary",
|
|
127
|
-
"toBackendFederationExposeNames",
|
|
128
|
-
"validateBackendFederationManifest",
|
|
129
|
-
"validateBackendFederationMetadata"
|
|
130
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
131
|
-
Object.defineProperty(exports, '__esModule', {
|
|
132
|
-
value: true
|
|
133
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.r = (exports1)=>{
|
|
5
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
-
value: 'Module'
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
var __webpack_exports__ = {};
|
|
14
|
-
__webpack_require__.r(__webpack_exports__);
|
|
15
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
-
Object.defineProperty(exports, '__esModule', {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
|
|
31
|
-
const nonEmptyString = (value)=>'string' == typeof value && value.trim().length > 0 ? value : void 0;
|
|
32
|
-
const validationResult = (errors)=>({
|
|
33
|
-
ok: 0 === errors.length,
|
|
34
|
-
errors
|
|
35
|
-
});
|
|
36
|
-
const addError = (errors, path, message)=>{
|
|
37
|
-
errors.push({
|
|
38
|
-
path,
|
|
39
|
-
message
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const recordField = (value, field)=>{
|
|
43
|
-
const fieldValue = value?.[field];
|
|
44
|
-
return isRecord(fieldValue) ? fieldValue : void 0;
|
|
45
|
-
};
|
|
46
|
-
const formatBackendFederationValidationErrors = (errors)=>errors.map((error)=>`${error.path}: ${error.message}`).join('; ');
|
|
47
|
-
const validateVersionField = (errors, record, field, expected, path, required)=>{
|
|
48
|
-
const compatibility = recordField(record, 'compatibility');
|
|
49
|
-
const executionSurfaces = recordField(record, 'executionSurfaces');
|
|
50
|
-
const nodeSurface = recordField(executionSurfaces, 'node');
|
|
51
|
-
const actual = nonEmptyString(record[field]) ?? nonEmptyString(compatibility?.[field]) ?? ('nodeAdapterVersion' === field ? nonEmptyString(nodeSurface?.adapterVersion) : void 0);
|
|
52
|
-
if (!actual) {
|
|
53
|
-
if (required) addError(errors, `${path}.${field}`, 'must be a non-empty string.');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (false !== expected && actual !== expected) addError(errors, `${path}.${field}`, `must be "${expected}".`);
|
|
57
|
-
};
|
|
58
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
59
|
-
addError: addError,
|
|
60
|
-
formatBackendFederationValidationErrors: formatBackendFederationValidationErrors,
|
|
61
|
-
isRecord: isRecord,
|
|
62
|
-
nonEmptyString: nonEmptyString,
|
|
63
|
-
recordField: recordField,
|
|
64
|
-
validateVersionField: validateVersionField,
|
|
65
|
-
validationResult: validationResult
|
|
66
|
-
});
|
|
67
|
-
exports.addError = __webpack_exports__.addError;
|
|
68
|
-
exports.formatBackendFederationValidationErrors = __webpack_exports__.formatBackendFederationValidationErrors;
|
|
69
|
-
exports.isRecord = __webpack_exports__.isRecord;
|
|
70
|
-
exports.nonEmptyString = __webpack_exports__.nonEmptyString;
|
|
71
|
-
exports.recordField = __webpack_exports__.recordField;
|
|
72
|
-
exports.validateVersionField = __webpack_exports__.validateVersionField;
|
|
73
|
-
exports.validationResult = __webpack_exports__.validationResult;
|
|
74
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
75
|
-
"addError",
|
|
76
|
-
"formatBackendFederationValidationErrors",
|
|
77
|
-
"isRecord",
|
|
78
|
-
"nonEmptyString",
|
|
79
|
-
"recordField",
|
|
80
|
-
"validateVersionField",
|
|
81
|
-
"validationResult"
|
|
82
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
83
|
-
Object.defineProperty(exports, '__esModule', {
|
|
84
|
-
value: true
|
|
85
|
-
});
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
DEFAULT_LOCAL_ENVIRONMENTS: ()=>DEFAULT_LOCAL_ENVIRONMENTS,
|
|
32
|
-
ENV_STATIC_PROVIDER_NAME: ()=>ENV_STATIC_PROVIDER_NAME,
|
|
33
|
-
createEnvStaticSurfaceResolutionProvider: ()=>createEnvStaticSurfaceResolutionProvider
|
|
34
|
-
});
|
|
35
|
-
const external_surface_ref_js_namespaceObject = require("./surface-ref.js");
|
|
36
|
-
const external_validation_js_namespaceObject = require("./validation.js");
|
|
37
|
-
const DEFAULT_LOCAL_ENVIRONMENTS = [
|
|
38
|
-
'development',
|
|
39
|
-
'local'
|
|
40
|
-
];
|
|
41
|
-
const ENV_STATIC_PROVIDER_NAME = 'env-static';
|
|
42
|
-
function trimTrailingSlashes(value) {
|
|
43
|
-
return value.replace(/\/+$/u, '');
|
|
44
|
-
}
|
|
45
|
-
function envValue(env, name) {
|
|
46
|
-
const value = env[name]?.trim();
|
|
47
|
-
return void 0 !== value && value.length > 0 ? value : void 0;
|
|
48
|
-
}
|
|
49
|
-
function stripMfNamePrefix(value, mfName) {
|
|
50
|
-
return value.startsWith(`${mfName}@`) ? value.slice(mfName.length + 1) : value;
|
|
51
|
-
}
|
|
52
|
-
function createEnvContext(env, allowLocalFallback) {
|
|
53
|
-
return {
|
|
54
|
-
env,
|
|
55
|
-
allowLocalFallback,
|
|
56
|
-
cloudflareDeployEnabled: 'cloudflare' === env.MODERNJS_DEPLOY,
|
|
57
|
-
workersDevSubdomain: envValue(env, 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN'),
|
|
58
|
-
requireCloudflarePublicUrls: 'true' === env.ULTRAMODERN_CLOUDFLARE_REQUIRE_PUBLIC_URLS
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function resolveBaseUrl(context, unit) {
|
|
62
|
-
const publicUrlEnv = `ULTRAMODERN_PUBLIC_URL_${unit.envSegment}`;
|
|
63
|
-
const configuredPublicUrl = envValue(context.env, publicUrlEnv);
|
|
64
|
-
if (void 0 !== configuredPublicUrl) return {
|
|
65
|
-
ok: true,
|
|
66
|
-
baseUrl: trimTrailingSlashes(configuredPublicUrl)
|
|
67
|
-
};
|
|
68
|
-
if (context.cloudflareDeployEnabled && void 0 !== context.workersDevSubdomain && void 0 !== unit.workerName) return {
|
|
69
|
-
ok: true,
|
|
70
|
-
baseUrl: `https://${unit.workerName}.${context.workersDevSubdomain}.workers.dev`
|
|
71
|
-
};
|
|
72
|
-
if (context.cloudflareDeployEnabled && context.requireCloudflarePublicUrls) return {
|
|
73
|
-
ok: false,
|
|
74
|
-
reason: `Cloudflare deploy requires ${publicUrlEnv} (or a configured manifest env / ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN with a worker name)`,
|
|
75
|
-
details: {
|
|
76
|
-
publicUrlEnv
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
if (void 0 !== unit.port && context.allowLocalFallback) return {
|
|
80
|
-
ok: true,
|
|
81
|
-
baseUrl: `http://localhost:${unit.port}`
|
|
82
|
-
};
|
|
83
|
-
if (void 0 !== unit.port) return {
|
|
84
|
-
ok: false,
|
|
85
|
-
reason: `No base URL available: set ${publicUrlEnv} (localhost fallback is disabled outside designated local environments)`,
|
|
86
|
-
details: {
|
|
87
|
-
publicUrlEnv
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
return {
|
|
91
|
-
ok: false,
|
|
92
|
-
reason: `No base URL available: set ${publicUrlEnv} or configure a localhost port`,
|
|
93
|
-
details: {
|
|
94
|
-
publicUrlEnv
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function resolveBrowserMfManifest(context, unit) {
|
|
99
|
-
const manifestEnv = `VERTICAL_${unit.envSegment}_MF_MANIFEST`;
|
|
100
|
-
const configuredManifest = envValue(context.env, manifestEnv);
|
|
101
|
-
if (void 0 !== configuredManifest) return {
|
|
102
|
-
ok: true,
|
|
103
|
-
location: {
|
|
104
|
-
platform: 'browser-mf-manifest',
|
|
105
|
-
manifestUrl: stripMfNamePrefix(configuredManifest, unit.mfName)
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const base = resolveBaseUrl(context, unit);
|
|
109
|
-
if (!base.ok) return {
|
|
110
|
-
ok: false,
|
|
111
|
-
reason: `browser-mf-manifest unavailable (${manifestEnv} unset; ${base.reason})`,
|
|
112
|
-
details: {
|
|
113
|
-
manifestEnv,
|
|
114
|
-
...base.details
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
return {
|
|
118
|
-
ok: true,
|
|
119
|
-
location: {
|
|
120
|
-
platform: 'browser-mf-manifest',
|
|
121
|
-
manifestUrl: `${base.baseUrl}/mf-manifest.json`
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
function resolveNodeMfManifest(context, unit) {
|
|
126
|
-
const manifestEnv = `VERTICAL_${unit.envSegment}_BACKEND_MF_MANIFEST`;
|
|
127
|
-
const configuredManifest = envValue(context.env, manifestEnv);
|
|
128
|
-
if (void 0 !== configuredManifest) return {
|
|
129
|
-
ok: true,
|
|
130
|
-
location: {
|
|
131
|
-
platform: 'node-mf-manifest',
|
|
132
|
-
manifestRef: configuredManifest
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
if (void 0 !== unit.port && context.allowLocalFallback) return {
|
|
136
|
-
ok: true,
|
|
137
|
-
location: {
|
|
138
|
-
platform: 'node-mf-manifest',
|
|
139
|
-
manifestRef: `http://localhost:${unit.port}/backend-mf-manifest.json`
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
if (void 0 !== unit.port) return {
|
|
143
|
-
ok: false,
|
|
144
|
-
reason: `node-mf-manifest unavailable: set ${manifestEnv} (localhost fallback is disabled outside designated local environments)`,
|
|
145
|
-
details: {
|
|
146
|
-
manifestEnv
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
return {
|
|
150
|
-
ok: false,
|
|
151
|
-
reason: `node-mf-manifest unavailable: set ${manifestEnv} or configure a localhost port`,
|
|
152
|
-
details: {
|
|
153
|
-
manifestEnv
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
function resolveHttpApi(context, unit, config) {
|
|
158
|
-
const base = resolveBaseUrl(context, unit);
|
|
159
|
-
if (!base.ok) return {
|
|
160
|
-
ok: false,
|
|
161
|
-
reason: `http-api unavailable (${base.reason})`,
|
|
162
|
-
details: base.details
|
|
163
|
-
};
|
|
164
|
-
return {
|
|
165
|
-
ok: true,
|
|
166
|
-
location: {
|
|
167
|
-
platform: 'http-api',
|
|
168
|
-
baseUrl: base.baseUrl,
|
|
169
|
-
prefix: config.prefix
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
function resolveCloudflareServiceBinding(config) {
|
|
174
|
-
if (0 === config.serviceBinding.length) return {
|
|
175
|
-
ok: false,
|
|
176
|
-
reason: 'cloudflare-service-binding unavailable: empty serviceBinding'
|
|
177
|
-
};
|
|
178
|
-
return {
|
|
179
|
-
ok: true,
|
|
180
|
-
location: {
|
|
181
|
-
platform: 'cloudflare-service-binding',
|
|
182
|
-
serviceBinding: config.serviceBinding,
|
|
183
|
-
...void 0 === config.dispatchNamespace ? {} : {
|
|
184
|
-
dispatchNamespace: config.dispatchNamespace
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function resolveSurfaceLocations(context, unit, surface) {
|
|
190
|
-
const outcomes = [];
|
|
191
|
-
if (surface.platforms.browserMfManifest) outcomes.push(resolveBrowserMfManifest(context, unit));
|
|
192
|
-
if (surface.platforms.nodeMfManifest) outcomes.push(resolveNodeMfManifest(context, unit));
|
|
193
|
-
if (void 0 !== surface.platforms.httpApi) outcomes.push(resolveHttpApi(context, unit, surface.platforms.httpApi));
|
|
194
|
-
if (void 0 !== surface.platforms.cloudflareServiceBinding) outcomes.push(resolveCloudflareServiceBinding(surface.platforms.cloudflareServiceBinding));
|
|
195
|
-
const failure = outcomes.find((outcome)=>!outcome.ok);
|
|
196
|
-
if (void 0 !== failure && !failure.ok) return {
|
|
197
|
-
ok: false,
|
|
198
|
-
reason: `surface ${surface.surfaceId}: ${failure.reason}`,
|
|
199
|
-
details: failure.details
|
|
200
|
-
};
|
|
201
|
-
const locations = outcomes.flatMap((outcome)=>outcome.ok ? [
|
|
202
|
-
outcome.location
|
|
203
|
-
] : []);
|
|
204
|
-
if (0 === locations.length) return {
|
|
205
|
-
ok: false,
|
|
206
|
-
reason: `surface ${surface.surfaceId} declares no platform locations`
|
|
207
|
-
};
|
|
208
|
-
return {
|
|
209
|
-
ok: true,
|
|
210
|
-
surface: {
|
|
211
|
-
surfaceId: surface.surfaceId,
|
|
212
|
-
kind: surface.kind,
|
|
213
|
-
locations
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
function createEnvStaticSurfaceResolutionProvider(options) {
|
|
218
|
-
const env = options.env ?? {};
|
|
219
|
-
const localEnvironments = new Set(options.localEnvironments ?? DEFAULT_LOCAL_ENVIRONMENTS);
|
|
220
|
-
const identityVerification = options.identityVerification ?? 'static-trust';
|
|
221
|
-
const unitsById = new Map(options.units.map((unit)=>[
|
|
222
|
-
unit.unitId,
|
|
223
|
-
unit
|
|
224
|
-
]));
|
|
225
|
-
return {
|
|
226
|
-
name: ENV_STATIC_PROVIDER_NAME,
|
|
227
|
-
resolve (ref, environment) {
|
|
228
|
-
const refString = (0, external_surface_ref_js_namespaceObject.formatSurfaceRef)(ref);
|
|
229
|
-
const unit = unitsById.get(ref.unitId);
|
|
230
|
-
if (void 0 === unit) return {
|
|
231
|
-
ok: false,
|
|
232
|
-
error: (0, external_validation_js_namespaceObject.createDiscoveryError)('unknown-unit', refString, `No statically configured delivery unit ${ref.unitId}.`, {
|
|
233
|
-
environment,
|
|
234
|
-
knownUnits: [
|
|
235
|
-
...unitsById.keys()
|
|
236
|
-
]
|
|
237
|
-
})
|
|
238
|
-
};
|
|
239
|
-
if (!unit.surfaces.some((surface)=>surface.surfaceId === ref.surfaceId)) return {
|
|
240
|
-
ok: false,
|
|
241
|
-
error: (0, external_validation_js_namespaceObject.createDiscoveryError)('unknown-surface', refString, `Unit ${unit.unitId} does not declare surface ${ref.surfaceId}.`, {
|
|
242
|
-
environment,
|
|
243
|
-
availableSurfaces: unit.surfaces.map((surface)=>surface.surfaceId)
|
|
244
|
-
})
|
|
245
|
-
};
|
|
246
|
-
let effectiveUnit = unit;
|
|
247
|
-
if (void 0 !== ref.major) {
|
|
248
|
-
const majorConfig = (unit.majors ?? []).find((candidate)=>candidate.major === ref.major);
|
|
249
|
-
if (void 0 === majorConfig) return {
|
|
250
|
-
ok: false,
|
|
251
|
-
error: (0, external_validation_js_namespaceObject.createDiscoveryError)('major-not-published', refString, `Unit ${unit.unitId} has no materialization for external major v${ref.major}.`, {
|
|
252
|
-
environment,
|
|
253
|
-
publishedMajors: (unit.majors ?? []).map((candidate)=>candidate.major)
|
|
254
|
-
})
|
|
255
|
-
};
|
|
256
|
-
effectiveUnit = {
|
|
257
|
-
...unit,
|
|
258
|
-
envSegment: majorConfig.envSegment ?? `${unit.envSegment}_V${majorConfig.major}`,
|
|
259
|
-
port: majorConfig.port,
|
|
260
|
-
workerName: majorConfig.workerName
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const context = createEnvContext(env, localEnvironments.has(environment));
|
|
264
|
-
const surfaces = [];
|
|
265
|
-
for (const surfaceConfig of unit.surfaces){
|
|
266
|
-
const resolved = resolveSurfaceLocations(context, effectiveUnit, surfaceConfig);
|
|
267
|
-
if (!resolved.ok) return {
|
|
268
|
-
ok: false,
|
|
269
|
-
error: (0, external_validation_js_namespaceObject.createDiscoveryError)('provider-unavailable', refString, `env-static provider cannot assemble a complete record for ${unit.unitId}: ${resolved.reason}.`, {
|
|
270
|
-
environment,
|
|
271
|
-
...resolved.details
|
|
272
|
-
})
|
|
273
|
-
};
|
|
274
|
-
surfaces.push(void 0 === ref.major ? resolved.surface : {
|
|
275
|
-
...resolved.surface,
|
|
276
|
-
servedMajor: ref.major
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
const record = {
|
|
280
|
-
unitId: unit.unitId,
|
|
281
|
-
buildMarker: unit.buildMarker,
|
|
282
|
-
sourceRevision: unit.sourceRevision,
|
|
283
|
-
baselineCohortId: unit.baselineCohortId,
|
|
284
|
-
surfaces,
|
|
285
|
-
compatibility: {
|
|
286
|
-
status: 'compatible',
|
|
287
|
-
baselineCohortId: unit.baselineCohortId,
|
|
288
|
-
...'static-trust' === identityVerification ? {
|
|
289
|
-
reason: 'static-identity-unverified'
|
|
290
|
-
} : {}
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
const validation = (0, external_validation_js_namespaceObject.validateResolvedDeliveryUnit)(record);
|
|
294
|
-
if (!validation.ok) return {
|
|
295
|
-
ok: false,
|
|
296
|
-
error: (0, external_validation_js_namespaceObject.createDiscoveryError)('provider-unavailable', refString, `env-static provider assembled an invalid record for ${unit.unitId}.`, {
|
|
297
|
-
environment,
|
|
298
|
-
issues: validation.issues
|
|
299
|
-
})
|
|
300
|
-
};
|
|
301
|
-
return {
|
|
302
|
-
ok: true,
|
|
303
|
-
unit: record
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
exports.DEFAULT_LOCAL_ENVIRONMENTS = __webpack_exports__.DEFAULT_LOCAL_ENVIRONMENTS;
|
|
309
|
-
exports.ENV_STATIC_PROVIDER_NAME = __webpack_exports__.ENV_STATIC_PROVIDER_NAME;
|
|
310
|
-
exports.createEnvStaticSurfaceResolutionProvider = __webpack_exports__.createEnvStaticSurfaceResolutionProvider;
|
|
311
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
312
|
-
"DEFAULT_LOCAL_ENVIRONMENTS",
|
|
313
|
-
"ENV_STATIC_PROVIDER_NAME",
|
|
314
|
-
"createEnvStaticSurfaceResolutionProvider"
|
|
315
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
316
|
-
Object.defineProperty(exports, '__esModule', {
|
|
317
|
-
value: true
|
|
318
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
DEFAULT_LOCAL_ENVIRONMENTS: ()=>external_env_static_provider_js_namespaceObject.DEFAULT_LOCAL_ENVIRONMENTS,
|
|
32
|
-
ENV_STATIC_PROVIDER_NAME: ()=>external_env_static_provider_js_namespaceObject.ENV_STATIC_PROVIDER_NAME,
|
|
33
|
-
createDiscoveryError: ()=>external_validation_js_namespaceObject.createDiscoveryError,
|
|
34
|
-
createEnvStaticSurfaceResolutionProvider: ()=>external_env_static_provider_js_namespaceObject.createEnvStaticSurfaceResolutionProvider,
|
|
35
|
-
formatSurfaceRef: ()=>external_surface_ref_js_namespaceObject.formatSurfaceRef,
|
|
36
|
-
matchDeliveryUnitIdentity: ()=>external_validation_js_namespaceObject.matchDeliveryUnitIdentity,
|
|
37
|
-
parseSurfaceRef: ()=>external_surface_ref_js_namespaceObject.parseSurfaceRef,
|
|
38
|
-
selectResolvedSurface: ()=>external_validation_js_namespaceObject.selectResolvedSurface,
|
|
39
|
-
validateResolvedDeliveryUnit: ()=>external_validation_js_namespaceObject.validateResolvedDeliveryUnit,
|
|
40
|
-
validateSurfaceRef: ()=>external_surface_ref_js_namespaceObject.validateSurfaceRef
|
|
41
|
-
});
|
|
42
|
-
const external_env_static_provider_js_namespaceObject = require("./env-static-provider.js");
|
|
43
|
-
const external_surface_ref_js_namespaceObject = require("./surface-ref.js");
|
|
44
|
-
const external_validation_js_namespaceObject = require("./validation.js");
|
|
45
|
-
exports.DEFAULT_LOCAL_ENVIRONMENTS = __webpack_exports__.DEFAULT_LOCAL_ENVIRONMENTS;
|
|
46
|
-
exports.ENV_STATIC_PROVIDER_NAME = __webpack_exports__.ENV_STATIC_PROVIDER_NAME;
|
|
47
|
-
exports.createDiscoveryError = __webpack_exports__.createDiscoveryError;
|
|
48
|
-
exports.createEnvStaticSurfaceResolutionProvider = __webpack_exports__.createEnvStaticSurfaceResolutionProvider;
|
|
49
|
-
exports.formatSurfaceRef = __webpack_exports__.formatSurfaceRef;
|
|
50
|
-
exports.matchDeliveryUnitIdentity = __webpack_exports__.matchDeliveryUnitIdentity;
|
|
51
|
-
exports.parseSurfaceRef = __webpack_exports__.parseSurfaceRef;
|
|
52
|
-
exports.selectResolvedSurface = __webpack_exports__.selectResolvedSurface;
|
|
53
|
-
exports.validateResolvedDeliveryUnit = __webpack_exports__.validateResolvedDeliveryUnit;
|
|
54
|
-
exports.validateSurfaceRef = __webpack_exports__.validateSurfaceRef;
|
|
55
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
56
|
-
"DEFAULT_LOCAL_ENVIRONMENTS",
|
|
57
|
-
"ENV_STATIC_PROVIDER_NAME",
|
|
58
|
-
"createDiscoveryError",
|
|
59
|
-
"createEnvStaticSurfaceResolutionProvider",
|
|
60
|
-
"formatSurfaceRef",
|
|
61
|
-
"matchDeliveryUnitIdentity",
|
|
62
|
-
"parseSurfaceRef",
|
|
63
|
-
"selectResolvedSurface",
|
|
64
|
-
"validateResolvedDeliveryUnit",
|
|
65
|
-
"validateSurfaceRef"
|
|
66
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
67
|
-
Object.defineProperty(exports, '__esModule', {
|
|
68
|
-
value: true
|
|
69
|
-
});
|