@contentful/optimization-node 0.1.0-alpha9 → 1.0.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/README.md +245 -252
- package/THIRD_PARTY_NOTICES.txt +2096 -0
- package/dist/260.mjs +1 -1
- package/dist/260.mjs.map +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/core-sdk.cjs +15 -2
- package/dist/core-sdk.cjs.map +1 -1
- package/dist/core-sdk.d.cts +13 -0
- package/dist/core-sdk.d.mts +13 -0
- package/dist/core-sdk.d.ts +13 -0
- package/dist/core-sdk.mjs +1 -0
- package/dist/index.cjs +24 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -16
- package/dist/index.d.mts +36 -16
- package/dist/index.d.ts +36 -16
- package/dist/index.mjs +23 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -4
package/dist/260.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const OPTIMIZATION_NODE_SDK_VERSION = "0.1
|
|
1
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "1.0.1";
|
|
2
2
|
const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
|
|
3
3
|
export { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from "@contentful/optimization-core/constants";
|
|
4
4
|
export { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION };
|
package/dist/260.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"260.mjs","sources":["../src/constants.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking
|
|
1
|
+
{"version":3,"file":"260.mjs","sources":["../src/constants.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking optimization and insights\n * events when no explicit profile is known.\n *\n * @example\n * ```ts\n * import { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-node/constants'\n * const cookieId = request.cookies[ANONYMOUS_ID_COOKIE]\n * const storageId = localStorage.getItem(ANONYMOUS_ID_KEY)\n * ```\n *\n * @see {@link ANONYMOUS_ID_COOKIE} and {@link ANONYMOUS_ID_KEY} in\n * `@contentful/optimization-core` for the\n * authoritative definition and documentation.\n *\n * @public\n */\nexport { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-core/constants'\n"],"names":["OPTIMIZATION_NODE_SDK_VERSION","__OPTIMIZATION_VERSION__","OPTIMIZATION_NODE_SDK_NAME","__OPTIMIZATION_PACKAGE_NAME__"],"mappings":"AAYO,MAAMA,gCACoCC;AAS1C,MAAMC,6BAEPC"}
|
package/dist/constants.cjs
CHANGED
|
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
|
|
31
31
|
});
|
|
32
32
|
const constants_namespaceObject = require("@contentful/optimization-core/constants");
|
|
33
|
-
const OPTIMIZATION_NODE_SDK_VERSION = "0.1
|
|
33
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "1.0.1";
|
|
34
34
|
const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
|
|
35
35
|
exports.ANONYMOUS_ID_COOKIE = __webpack_exports__.ANONYMOUS_ID_COOKIE;
|
|
36
36
|
exports.ANONYMOUS_ID_KEY = __webpack_exports__.ANONYMOUS_ID_KEY;
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../src/constants.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../src/constants.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking optimization and insights\n * events when no explicit profile is known.\n *\n * @example\n * ```ts\n * import { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-node/constants'\n * const cookieId = request.cookies[ANONYMOUS_ID_COOKIE]\n * const storageId = localStorage.getItem(ANONYMOUS_ID_KEY)\n * ```\n *\n * @see {@link ANONYMOUS_ID_COOKIE} and {@link ANONYMOUS_ID_KEY} in\n * `@contentful/optimization-core` for the\n * authoritative definition and documentation.\n *\n * @public\n */\nexport { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-core/constants'\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","OPTIMIZATION_NODE_SDK_VERSION","__OPTIMIZATION_VERSION__","OPTIMIZATION_NODE_SDK_NAME","__OPTIMIZATION_PACKAGE_NAME__"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;ACMO,MAAMI,gCACoCC;AAS1C,MAAMC,6BAEPC"}
|
package/dist/core-sdk.cjs
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
3
|
"@contentful/optimization-core" (module) {
|
|
4
4
|
module.exports = require("@contentful/optimization-core");
|
|
5
|
+
},
|
|
6
|
+
"@contentful/optimization-core/entry-source" (module) {
|
|
7
|
+
module.exports = require("@contentful/optimization-core/entry-source");
|
|
5
8
|
}
|
|
6
9
|
};
|
|
7
10
|
var __webpack_module_cache__ = {};
|
|
@@ -47,12 +50,22 @@ function __webpack_require__(moduleId) {
|
|
|
47
50
|
var __webpack_exports__ = {};
|
|
48
51
|
(()=>{
|
|
49
52
|
__webpack_require__.r(__webpack_exports__);
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
+
prefetchManagedEntries: ()=>_contentful_optimization_core_entry_source__rspack_import_1.prefetchManagedEntries
|
|
55
|
+
});
|
|
50
56
|
var _contentful_optimization_core__rspack_import_0 = __webpack_require__("@contentful/optimization-core");
|
|
51
57
|
var __rspack_reexport = {};
|
|
52
|
-
for(const __rspack_import_key in _contentful_optimization_core__rspack_import_0)if (
|
|
58
|
+
for(const __rspack_import_key in _contentful_optimization_core__rspack_import_0)if ([
|
|
59
|
+
"prefetchManagedEntries",
|
|
60
|
+
"default"
|
|
61
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_contentful_optimization_core__rspack_import_0[__rspack_import_key];
|
|
53
62
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
63
|
+
var _contentful_optimization_core_entry_source__rspack_import_1 = __webpack_require__("@contentful/optimization-core/entry-source");
|
|
54
64
|
})();
|
|
55
|
-
|
|
65
|
+
exports.prefetchManagedEntries = __webpack_exports__.prefetchManagedEntries;
|
|
66
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
67
|
+
"prefetchManagedEntries"
|
|
68
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
56
69
|
Object.defineProperty(exports, '__esModule', {
|
|
57
70
|
value: true
|
|
58
71
|
});
|
package/dist/core-sdk.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-sdk.cjs","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object"],"sourcesContent":["// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol"],"mappings":"
|
|
1
|
+
{"version":3,"file":"core-sdk.cjs","sources":["webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object"],"sourcesContent":["// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};"],"names":["__webpack_require__","module","getter","definition","key","Object","obj","prop","Symbol"],"mappings":";;;;;;;;;;;;;;;;;;;;IACAA,oBAAoB,CAAC,GAAG,CAACC;QACxB,IAAIC,SAASD,UAAUA,OAAO,UAAU,GACvC,IAAOA,MAAM,CAAC,UAAU,GACxB,IAAOA;QACRD,oBAAoB,CAAC,CAACE,QAAQ;YAAE,GAAGA;QAAO;QAC1C,OAAOA;IACR;;;ICPAF,oBAAoB,CAAC,GAAG,CAAC,UAASG;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGH,oBAAoB,CAAC,CAACG,YAAYC,QAAQ,CAACJ,oBAAoB,CAAC,CAAC,UAASI,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAJ,oBAAoB,CAAC,GAAG,CAACM,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFP,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOQ,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D"}
|
package/dist/core-sdk.d.cts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { ManagedEntryDescriptor } from '@contentful/optimization-core/entry-source';
|
|
2
|
+
import { ManagedEntryHandoff } from '@contentful/optimization-core/entry-source';
|
|
3
|
+
import { ManagedEntryPrefetchRuntime } from '@contentful/optimization-core/entry-source';
|
|
4
|
+
import { prefetchManagedEntries } from '@contentful/optimization-core/entry-source';
|
|
5
|
+
|
|
6
|
+
export { ManagedEntryDescriptor }
|
|
7
|
+
|
|
8
|
+
export { ManagedEntryHandoff }
|
|
9
|
+
|
|
10
|
+
export { ManagedEntryPrefetchRuntime }
|
|
11
|
+
|
|
12
|
+
export { prefetchManagedEntries }
|
|
13
|
+
|
|
1
14
|
|
|
2
15
|
export * from "@contentful/optimization-core";
|
|
3
16
|
|
package/dist/core-sdk.d.mts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { ManagedEntryDescriptor } from '@contentful/optimization-core/entry-source';
|
|
2
|
+
import { ManagedEntryHandoff } from '@contentful/optimization-core/entry-source';
|
|
3
|
+
import { ManagedEntryPrefetchRuntime } from '@contentful/optimization-core/entry-source';
|
|
4
|
+
import { prefetchManagedEntries } from '@contentful/optimization-core/entry-source';
|
|
5
|
+
|
|
6
|
+
export { ManagedEntryDescriptor }
|
|
7
|
+
|
|
8
|
+
export { ManagedEntryHandoff }
|
|
9
|
+
|
|
10
|
+
export { ManagedEntryPrefetchRuntime }
|
|
11
|
+
|
|
12
|
+
export { prefetchManagedEntries }
|
|
13
|
+
|
|
1
14
|
|
|
2
15
|
export * from "@contentful/optimization-core";
|
|
3
16
|
|
package/dist/core-sdk.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import { ManagedEntryDescriptor } from '@contentful/optimization-core/entry-source';
|
|
2
|
+
import { ManagedEntryHandoff } from '@contentful/optimization-core/entry-source';
|
|
3
|
+
import { ManagedEntryPrefetchRuntime } from '@contentful/optimization-core/entry-source';
|
|
4
|
+
import { prefetchManagedEntries } from '@contentful/optimization-core/entry-source';
|
|
5
|
+
|
|
6
|
+
export { ManagedEntryDescriptor }
|
|
7
|
+
|
|
8
|
+
export { ManagedEntryHandoff }
|
|
9
|
+
|
|
10
|
+
export { ManagedEntryPrefetchRuntime }
|
|
11
|
+
|
|
12
|
+
export { prefetchManagedEntries }
|
|
13
|
+
|
|
1
14
|
|
|
2
15
|
export * from "@contentful/optimization-core";
|
|
3
16
|
|
package/dist/core-sdk.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var __webpack_modules__ = {
|
|
|
6
6
|
OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
|
|
7
7
|
});
|
|
8
8
|
require("@contentful/optimization-core/constants");
|
|
9
|
-
const OPTIMIZATION_NODE_SDK_VERSION = "0.1
|
|
9
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "1.0.1";
|
|
10
10
|
const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -50,30 +50,33 @@ var __webpack_exports__ = {};
|
|
|
50
50
|
default: ()=>src
|
|
51
51
|
});
|
|
52
52
|
const optimization_core_namespaceObject = require("@contentful/optimization-core");
|
|
53
|
-
const external_es_toolkit_namespaceObject = require("es-toolkit");
|
|
54
53
|
var constants = __webpack_require__("./src/constants.ts");
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
const DEFAULT_NODE_ALLOWED_EVENT_TYPES = [
|
|
55
|
+
'identify',
|
|
56
|
+
'page'
|
|
57
|
+
];
|
|
58
|
+
class ContentfulOptimization extends optimization_core_namespaceObject.CoreStateless {
|
|
59
|
+
constructor({ app, allowedEventTypes, eventBuilder, ...config }){
|
|
60
|
+
const { library, ...eventBuilderConfig } = eventBuilder ?? {};
|
|
61
|
+
super({
|
|
62
|
+
...config,
|
|
63
|
+
allowedEventTypes: allowedEventTypes ?? DEFAULT_NODE_ALLOWED_EVENT_TYPES,
|
|
64
|
+
eventBuilder: {
|
|
65
|
+
app,
|
|
66
|
+
channel: 'server',
|
|
67
|
+
...eventBuilderConfig,
|
|
68
|
+
library: {
|
|
69
|
+
name: constants.OPTIMIZATION_NODE_SDK_NAME,
|
|
70
|
+
version: constants.OPTIMIZATION_NODE_SDK_VERSION,
|
|
71
|
+
...library
|
|
72
|
+
},
|
|
73
|
+
getConsent: ()=>false
|
|
64
74
|
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return (0, external_es_toolkit_namespaceObject.merge)(defaultConfig, restConfig);
|
|
68
|
-
}
|
|
69
|
-
class Optimization extends optimization_core_namespaceObject.CoreStateless {
|
|
70
|
-
constructor(config){
|
|
71
|
-
const mergedConfig = mergeConfig(config);
|
|
72
|
-
super(mergedConfig);
|
|
75
|
+
});
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
const
|
|
76
|
-
const src =
|
|
78
|
+
const src_ContentfulOptimization = ContentfulOptimization;
|
|
79
|
+
const src = src_ContentfulOptimization;
|
|
77
80
|
})();
|
|
78
81
|
exports.OPTIMIZATION_NODE_SDK_NAME = __webpack_exports__.OPTIMIZATION_NODE_SDK_NAME;
|
|
79
82
|
exports.OPTIMIZATION_NODE_SDK_VERSION = __webpack_exports__.OPTIMIZATION_NODE_SDK_VERSION;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/constants.ts","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../src/
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/constants.ts","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../src/ContentfulOptimization.ts","../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_VERSION__: string | undefined\n// eslint-disable-next-line @typescript-eslint/naming-convention -- Replaced at build-time\ndeclare const __OPTIMIZATION_PACKAGE_NAME__: string | undefined\n\n/**\n * The current version of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'0.0.0'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_VERSION =\n typeof __OPTIMIZATION_VERSION__ === 'string' ? __OPTIMIZATION_VERSION__ : '0.0.0'\n\n/**\n * The package name of the Optimization Node SDK, injected at build-time.\n *\n * @defaultValue `'@contentful/optimization-node'` when the build-time replacement is unavailable.\n *\n * @public\n */\nexport const OPTIMIZATION_NODE_SDK_NAME =\n typeof __OPTIMIZATION_PACKAGE_NAME__ === 'string'\n ? __OPTIMIZATION_PACKAGE_NAME__\n : '@contentful/optimization-node'\n\n/**\n * Re-exports of anonymous identifier constants used by the Optimization Core.\n *\n * @remarks\n * This constant is surfaced here to provide a stable import path for Node SDK\n * consumers. It represents the cookie key used by the Optimization Framework\n * to persist an anonymous identifier for tracking optimization and insights\n * events when no explicit profile is known.\n *\n * @example\n * ```ts\n * import { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-node/constants'\n * const cookieId = request.cookies[ANONYMOUS_ID_COOKIE]\n * const storageId = localStorage.getItem(ANONYMOUS_ID_KEY)\n * ```\n *\n * @see {@link ANONYMOUS_ID_COOKIE} and {@link ANONYMOUS_ID_KEY} in\n * `@contentful/optimization-core` for the\n * authoritative definition and documentation.\n *\n * @public\n */\nexport { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from '@contentful/optimization-core/constants'\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n CoreStateless,\n type CoreStatelessConfig,\n type EventType,\n} from '@contentful/optimization-core'\nimport type { App } from '@contentful/optimization-core/api-schemas'\nimport { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION } from './constants'\n\nconst DEFAULT_NODE_ALLOWED_EVENT_TYPES: EventType[] = ['identify', 'page']\n\n/**\n * Public Node event-builder overrides accepted by {@link OptimizationNodeConfig.eventBuilder}.\n *\n * @remarks\n * Request-scoped consent is bound with {@link ContentfulOptimization.forRequest}, so `getConsent`\n * is intentionally omitted from singleton SDK configuration.\n *\n * @public\n */\nexport type PublicNodeEventBuilderConfig = Partial<\n Omit<NonNullable<CoreStatelessConfig['eventBuilder']>, 'app' | 'getConsent'>\n>\n\n/**\n * Configuration for the Node-specific ContentfulOptimization SDK.\n *\n * @remarks\n * This configuration extends {@link CoreStatelessConfig} but allows partial\n * overrides of the event-builder configuration. SDKs commonly inject their own\n * library metadata or channel definitions.\n *\n * @see {@link CoreStatelessConfig}\n *\n * @public\n */\nexport interface OptimizationNodeConfig extends Omit<CoreStatelessConfig, 'eventBuilder'> {\n /**\n * The application definition used to attribute events to a specific consumer app.\n *\n * @remarks\n * When not provided, events will not contain app metadata in their context.\n */\n app?: App\n\n /**\n * Partial overrides for the event builder configuration.\n *\n * @remarks\n * Any provided fields are merged with the default Node SDK metadata.\n * Request-scoped consent should be bound with `forRequest()`, not configured\n * on the SDK singleton.\n *\n * This differs from {@link CoreStatelessConfig} eventBuilder, which expects\n * a full configuration object.\n */\n eventBuilder?: PublicNodeEventBuilderConfig\n}\n\n/**\n * Node-specific ContentfulOptimization SDK built on {@link CoreStateless}.\n *\n * @remarks\n * This class adapts the stateless ContentfulOptimization Core for Node runtimes by\n * applying environment-appropriate defaults (e.g., server channel, Node SDK\n * library metadata). No core runtime behavior is modified; only configuration\n * defaults differ.\n *\n * @example\n * ```ts\n * import ContentfulOptimization from '@contentful/optimization-node'\n *\n * const sdk = new ContentfulOptimization({\n * clientId: 'abc-123',\n * environment: 'main',\n * logLevel: 'info',\n * })\n *\n * const requestOptimization = sdk.forRequest({\n * consent: true,\n * locale: 'fr-CA',\n * profile: { id: 'profile-id' },\n * })\n *\n * const { accepted, data } = await requestOptimization.page()\n * ```\n *\n * @see {@link CoreStateless}\n *\n * @public\n */\nclass ContentfulOptimization extends CoreStateless {\n /**\n * Create an instance of the Node SDK with merged defaults.\n *\n * @param config - Partial Node-specific configuration. Any eventBuilder\n * fields provided are merged with Node's defaults.\n *\n * @example\n * ```ts\n * import ContentfulOptimization from '@contentful/optimization-node'\n *\n * const optimization = new ContentfulOptimization({ clientId: 'my-client-id' })\n * ```\n */\n constructor({ app, allowedEventTypes, eventBuilder, ...config }: OptimizationNodeConfig) {\n const { library, ...eventBuilderConfig } = eventBuilder ?? {}\n\n super({\n ...config,\n allowedEventTypes: allowedEventTypes ?? DEFAULT_NODE_ALLOWED_EVENT_TYPES,\n eventBuilder: {\n app,\n channel: 'server',\n ...eventBuilderConfig,\n library: {\n name: OPTIMIZATION_NODE_SDK_NAME,\n version: OPTIMIZATION_NODE_SDK_VERSION,\n ...library,\n },\n getConsent: () => false,\n },\n })\n }\n}\n\nexport default ContentfulOptimization\n","/**\n * Contentful ContentfulOptimization Node SDK.\n *\n * @remarks\n * Adds Node-specific defaults via the {@link ContentfulOptimization} class.\n * Core and transitive API exports are available from dedicated entrypoints:\n * `@contentful/optimization-node/core-sdk`,\n * `@contentful/optimization-node/api-client`,\n * and `@contentful/optimization-node/api-schemas`.\n *\n * @packageDocumentation\n */\n\nimport ContentfulOptimization from './ContentfulOptimization'\n\nexport { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION } from './constants'\nexport * from './ContentfulOptimization'\n\nexport default ContentfulOptimization\n"],"names":["OPTIMIZATION_NODE_SDK_VERSION","__OPTIMIZATION_VERSION__","OPTIMIZATION_NODE_SDK_NAME","__OPTIMIZATION_PACKAGE_NAME__","__webpack_require__","definition","key","Object","obj","prop","Symbol","DEFAULT_NODE_ALLOWED_EVENT_TYPES","ContentfulOptimization","CoreStateless","app","allowedEventTypes","eventBuilder","config","library","eventBuilderConfig"],"mappings":";;;;;;;;QAYO,MAAMA,gCACoCC;QAS1C,MAAMC,6BAEPC;;;;;;;;;;;;;;ICxBNC,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,MAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;ICEA,MAAMI,mCAAgD;QAAC;QAAY;KAAO;IAkF1E,MAAMC,+BAA+BC,kCAAAA,aAAaA;QAchD,YAAY,EAAEC,GAAG,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGC,QAAgC,CAAE;YACvF,MAAM,EAAEC,OAAO,EAAE,GAAGC,oBAAoB,GAAGH,gBAAgB,CAAC;YAE5D,KAAK,CAAC;gBACJ,GAAGC,MAAM;gBACT,mBAAmBF,qBAAqBJ;gBACxC,cAAc;oBACZG;oBACA,SAAS;oBACT,GAAGK,kBAAkB;oBACrB,SAAS;wBACP,MAAMjB,UAAAA,0BAA0BA;wBAChC,SAASF,UAAAA,6BAA6BA;wBACtC,GAAGkB,OAAO;oBACZ;oBACA,YAAY,IAAM;gBACpB;YACF;QACF;IACF;IAEA,mCAAeN;IC3Gf,YAAeA"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contentful
|
|
2
|
+
* Contentful ContentfulOptimization Node SDK.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Adds Node-specific defaults via the {@link
|
|
5
|
+
* Adds Node-specific defaults via the {@link ContentfulOptimization} class.
|
|
6
6
|
* Core and transitive API exports are available from dedicated entrypoints:
|
|
7
7
|
* `@contentful/optimization-node/core-sdk`,
|
|
8
8
|
* `@contentful/optimization-node/api-client`,
|
|
@@ -16,32 +16,38 @@ import { CoreStateless } from '@contentful/optimization-core';
|
|
|
16
16
|
import { CoreStatelessConfig } from '@contentful/optimization-core';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Node-specific
|
|
19
|
+
* Node-specific ContentfulOptimization SDK built on {@link CoreStateless}.
|
|
20
20
|
*
|
|
21
21
|
* @remarks
|
|
22
|
-
* This class adapts the stateless
|
|
22
|
+
* This class adapts the stateless ContentfulOptimization Core for Node runtimes by
|
|
23
23
|
* applying environment-appropriate defaults (e.g., server channel, Node SDK
|
|
24
|
-
* library metadata). No
|
|
25
|
-
*
|
|
24
|
+
* library metadata). No core runtime behavior is modified; only configuration
|
|
25
|
+
* defaults differ.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
29
|
-
* import
|
|
29
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
30
30
|
*
|
|
31
|
-
* const sdk = new
|
|
31
|
+
* const sdk = new ContentfulOptimization({
|
|
32
32
|
* clientId: 'abc-123',
|
|
33
33
|
* environment: 'main',
|
|
34
34
|
* logLevel: 'info',
|
|
35
35
|
* })
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* const requestOptimization = sdk.forRequest({
|
|
38
|
+
* consent: true,
|
|
39
|
+
* locale: 'fr-CA',
|
|
40
|
+
* profile: { id: 'profile-id' },
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* const { accepted, data } = await requestOptimization.page()
|
|
38
44
|
* ```
|
|
39
45
|
*
|
|
40
46
|
* @see {@link CoreStateless}
|
|
41
47
|
*
|
|
42
48
|
* @public
|
|
43
49
|
*/
|
|
44
|
-
declare class
|
|
50
|
+
declare class ContentfulOptimization extends CoreStateless {
|
|
45
51
|
/**
|
|
46
52
|
* Create an instance of the Node SDK with merged defaults.
|
|
47
53
|
*
|
|
@@ -50,14 +56,14 @@ declare class Optimization extends CoreStateless {
|
|
|
50
56
|
*
|
|
51
57
|
* @example
|
|
52
58
|
* ```ts
|
|
53
|
-
* import
|
|
59
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
54
60
|
*
|
|
55
|
-
* const optimization = new
|
|
61
|
+
* const optimization = new ContentfulOptimization({ clientId: 'my-client-id' })
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
|
-
constructor(config: OptimizationNodeConfig);
|
|
64
|
+
constructor({ app, allowedEventTypes, eventBuilder, ...config }: OptimizationNodeConfig);
|
|
59
65
|
}
|
|
60
|
-
export default
|
|
66
|
+
export default ContentfulOptimization;
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* The package name of the Optimization Node SDK, injected at build-time.
|
|
@@ -78,7 +84,7 @@ export declare const OPTIMIZATION_NODE_SDK_NAME: string;
|
|
|
78
84
|
export declare const OPTIMIZATION_NODE_SDK_VERSION: string;
|
|
79
85
|
|
|
80
86
|
/**
|
|
81
|
-
* Configuration for the Node-specific
|
|
87
|
+
* Configuration for the Node-specific ContentfulOptimization SDK.
|
|
82
88
|
*
|
|
83
89
|
* @remarks
|
|
84
90
|
* This configuration extends {@link CoreStatelessConfig} but allows partial
|
|
@@ -102,10 +108,24 @@ export declare interface OptimizationNodeConfig extends Omit<CoreStatelessConfig
|
|
|
102
108
|
*
|
|
103
109
|
* @remarks
|
|
104
110
|
* Any provided fields are merged with the default Node SDK metadata.
|
|
111
|
+
* Request-scoped consent should be bound with `forRequest()`, not configured
|
|
112
|
+
* on the SDK singleton.
|
|
113
|
+
*
|
|
105
114
|
* This differs from {@link CoreStatelessConfig} eventBuilder, which expects
|
|
106
115
|
* a full configuration object.
|
|
107
116
|
*/
|
|
108
|
-
eventBuilder?:
|
|
117
|
+
eventBuilder?: PublicNodeEventBuilderConfig;
|
|
109
118
|
}
|
|
110
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Public Node event-builder overrides accepted by {@link OptimizationNodeConfig.eventBuilder}.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Request-scoped consent is bound with {@link ContentfulOptimization.forRequest}, so `getConsent`
|
|
125
|
+
* is intentionally omitted from singleton SDK configuration.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export declare type PublicNodeEventBuilderConfig = Partial<Omit<NonNullable<CoreStatelessConfig['eventBuilder']>, 'app' | 'getConsent'>>;
|
|
130
|
+
|
|
111
131
|
export { }
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contentful
|
|
2
|
+
* Contentful ContentfulOptimization Node SDK.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Adds Node-specific defaults via the {@link
|
|
5
|
+
* Adds Node-specific defaults via the {@link ContentfulOptimization} class.
|
|
6
6
|
* Core and transitive API exports are available from dedicated entrypoints:
|
|
7
7
|
* `@contentful/optimization-node/core-sdk`,
|
|
8
8
|
* `@contentful/optimization-node/api-client`,
|
|
@@ -16,32 +16,38 @@ import { CoreStateless } from '@contentful/optimization-core';
|
|
|
16
16
|
import { CoreStatelessConfig } from '@contentful/optimization-core';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Node-specific
|
|
19
|
+
* Node-specific ContentfulOptimization SDK built on {@link CoreStateless}.
|
|
20
20
|
*
|
|
21
21
|
* @remarks
|
|
22
|
-
* This class adapts the stateless
|
|
22
|
+
* This class adapts the stateless ContentfulOptimization Core for Node runtimes by
|
|
23
23
|
* applying environment-appropriate defaults (e.g., server channel, Node SDK
|
|
24
|
-
* library metadata). No
|
|
25
|
-
*
|
|
24
|
+
* library metadata). No core runtime behavior is modified; only configuration
|
|
25
|
+
* defaults differ.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
29
|
-
* import
|
|
29
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
30
30
|
*
|
|
31
|
-
* const sdk = new
|
|
31
|
+
* const sdk = new ContentfulOptimization({
|
|
32
32
|
* clientId: 'abc-123',
|
|
33
33
|
* environment: 'main',
|
|
34
34
|
* logLevel: 'info',
|
|
35
35
|
* })
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* const requestOptimization = sdk.forRequest({
|
|
38
|
+
* consent: true,
|
|
39
|
+
* locale: 'fr-CA',
|
|
40
|
+
* profile: { id: 'profile-id' },
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* const { accepted, data } = await requestOptimization.page()
|
|
38
44
|
* ```
|
|
39
45
|
*
|
|
40
46
|
* @see {@link CoreStateless}
|
|
41
47
|
*
|
|
42
48
|
* @public
|
|
43
49
|
*/
|
|
44
|
-
declare class
|
|
50
|
+
declare class ContentfulOptimization extends CoreStateless {
|
|
45
51
|
/**
|
|
46
52
|
* Create an instance of the Node SDK with merged defaults.
|
|
47
53
|
*
|
|
@@ -50,14 +56,14 @@ declare class Optimization extends CoreStateless {
|
|
|
50
56
|
*
|
|
51
57
|
* @example
|
|
52
58
|
* ```ts
|
|
53
|
-
* import
|
|
59
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
54
60
|
*
|
|
55
|
-
* const optimization = new
|
|
61
|
+
* const optimization = new ContentfulOptimization({ clientId: 'my-client-id' })
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
|
-
constructor(config: OptimizationNodeConfig);
|
|
64
|
+
constructor({ app, allowedEventTypes, eventBuilder, ...config }: OptimizationNodeConfig);
|
|
59
65
|
}
|
|
60
|
-
export default
|
|
66
|
+
export default ContentfulOptimization;
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* The package name of the Optimization Node SDK, injected at build-time.
|
|
@@ -78,7 +84,7 @@ export declare const OPTIMIZATION_NODE_SDK_NAME: string;
|
|
|
78
84
|
export declare const OPTIMIZATION_NODE_SDK_VERSION: string;
|
|
79
85
|
|
|
80
86
|
/**
|
|
81
|
-
* Configuration for the Node-specific
|
|
87
|
+
* Configuration for the Node-specific ContentfulOptimization SDK.
|
|
82
88
|
*
|
|
83
89
|
* @remarks
|
|
84
90
|
* This configuration extends {@link CoreStatelessConfig} but allows partial
|
|
@@ -102,10 +108,24 @@ export declare interface OptimizationNodeConfig extends Omit<CoreStatelessConfig
|
|
|
102
108
|
*
|
|
103
109
|
* @remarks
|
|
104
110
|
* Any provided fields are merged with the default Node SDK metadata.
|
|
111
|
+
* Request-scoped consent should be bound with `forRequest()`, not configured
|
|
112
|
+
* on the SDK singleton.
|
|
113
|
+
*
|
|
105
114
|
* This differs from {@link CoreStatelessConfig} eventBuilder, which expects
|
|
106
115
|
* a full configuration object.
|
|
107
116
|
*/
|
|
108
|
-
eventBuilder?:
|
|
117
|
+
eventBuilder?: PublicNodeEventBuilderConfig;
|
|
109
118
|
}
|
|
110
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Public Node event-builder overrides accepted by {@link OptimizationNodeConfig.eventBuilder}.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Request-scoped consent is bound with {@link ContentfulOptimization.forRequest}, so `getConsent`
|
|
125
|
+
* is intentionally omitted from singleton SDK configuration.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export declare type PublicNodeEventBuilderConfig = Partial<Omit<NonNullable<CoreStatelessConfig['eventBuilder']>, 'app' | 'getConsent'>>;
|
|
130
|
+
|
|
111
131
|
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contentful
|
|
2
|
+
* Contentful ContentfulOptimization Node SDK.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* Adds Node-specific defaults via the {@link
|
|
5
|
+
* Adds Node-specific defaults via the {@link ContentfulOptimization} class.
|
|
6
6
|
* Core and transitive API exports are available from dedicated entrypoints:
|
|
7
7
|
* `@contentful/optimization-node/core-sdk`,
|
|
8
8
|
* `@contentful/optimization-node/api-client`,
|
|
@@ -16,32 +16,38 @@ import { CoreStateless } from '@contentful/optimization-core';
|
|
|
16
16
|
import { CoreStatelessConfig } from '@contentful/optimization-core';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Node-specific
|
|
19
|
+
* Node-specific ContentfulOptimization SDK built on {@link CoreStateless}.
|
|
20
20
|
*
|
|
21
21
|
* @remarks
|
|
22
|
-
* This class adapts the stateless
|
|
22
|
+
* This class adapts the stateless ContentfulOptimization Core for Node runtimes by
|
|
23
23
|
* applying environment-appropriate defaults (e.g., server channel, Node SDK
|
|
24
|
-
* library metadata). No
|
|
25
|
-
*
|
|
24
|
+
* library metadata). No core runtime behavior is modified; only configuration
|
|
25
|
+
* defaults differ.
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```ts
|
|
29
|
-
* import
|
|
29
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
30
30
|
*
|
|
31
|
-
* const sdk = new
|
|
31
|
+
* const sdk = new ContentfulOptimization({
|
|
32
32
|
* clientId: 'abc-123',
|
|
33
33
|
* environment: 'main',
|
|
34
34
|
* logLevel: 'info',
|
|
35
35
|
* })
|
|
36
36
|
*
|
|
37
|
-
*
|
|
37
|
+
* const requestOptimization = sdk.forRequest({
|
|
38
|
+
* consent: true,
|
|
39
|
+
* locale: 'fr-CA',
|
|
40
|
+
* profile: { id: 'profile-id' },
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* const { accepted, data } = await requestOptimization.page()
|
|
38
44
|
* ```
|
|
39
45
|
*
|
|
40
46
|
* @see {@link CoreStateless}
|
|
41
47
|
*
|
|
42
48
|
* @public
|
|
43
49
|
*/
|
|
44
|
-
declare class
|
|
50
|
+
declare class ContentfulOptimization extends CoreStateless {
|
|
45
51
|
/**
|
|
46
52
|
* Create an instance of the Node SDK with merged defaults.
|
|
47
53
|
*
|
|
@@ -50,14 +56,14 @@ declare class Optimization extends CoreStateless {
|
|
|
50
56
|
*
|
|
51
57
|
* @example
|
|
52
58
|
* ```ts
|
|
53
|
-
* import
|
|
59
|
+
* import ContentfulOptimization from '@contentful/optimization-node'
|
|
54
60
|
*
|
|
55
|
-
* const optimization = new
|
|
61
|
+
* const optimization = new ContentfulOptimization({ clientId: 'my-client-id' })
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
|
-
constructor(config: OptimizationNodeConfig);
|
|
64
|
+
constructor({ app, allowedEventTypes, eventBuilder, ...config }: OptimizationNodeConfig);
|
|
59
65
|
}
|
|
60
|
-
export default
|
|
66
|
+
export default ContentfulOptimization;
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* The package name of the Optimization Node SDK, injected at build-time.
|
|
@@ -78,7 +84,7 @@ export declare const OPTIMIZATION_NODE_SDK_NAME: string;
|
|
|
78
84
|
export declare const OPTIMIZATION_NODE_SDK_VERSION: string;
|
|
79
85
|
|
|
80
86
|
/**
|
|
81
|
-
* Configuration for the Node-specific
|
|
87
|
+
* Configuration for the Node-specific ContentfulOptimization SDK.
|
|
82
88
|
*
|
|
83
89
|
* @remarks
|
|
84
90
|
* This configuration extends {@link CoreStatelessConfig} but allows partial
|
|
@@ -102,10 +108,24 @@ export declare interface OptimizationNodeConfig extends Omit<CoreStatelessConfig
|
|
|
102
108
|
*
|
|
103
109
|
* @remarks
|
|
104
110
|
* Any provided fields are merged with the default Node SDK metadata.
|
|
111
|
+
* Request-scoped consent should be bound with `forRequest()`, not configured
|
|
112
|
+
* on the SDK singleton.
|
|
113
|
+
*
|
|
105
114
|
* This differs from {@link CoreStatelessConfig} eventBuilder, which expects
|
|
106
115
|
* a full configuration object.
|
|
107
116
|
*/
|
|
108
|
-
eventBuilder?:
|
|
117
|
+
eventBuilder?: PublicNodeEventBuilderConfig;
|
|
109
118
|
}
|
|
110
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Public Node event-builder overrides accepted by {@link OptimizationNodeConfig.eventBuilder}.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Request-scoped consent is bound with {@link ContentfulOptimization.forRequest}, so `getConsent`
|
|
125
|
+
* is intentionally omitted from singleton SDK configuration.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export declare type PublicNodeEventBuilderConfig = Partial<Omit<NonNullable<CoreStatelessConfig['eventBuilder']>, 'app' | 'getConsent'>>;
|
|
130
|
+
|
|
111
131
|
export { }
|