@surfside/ads-core 2.0.8 → 2.0.9
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/lib/cjs/Api.js +4 -5
- package/lib/cjs/Api.js.map +1 -1
- package/lib/cjs/helpers/RequestBuilder.js +1 -1
- package/lib/cjs/helpers/response/ProductCard.js +39 -15
- package/lib/cjs/helpers/response/ProductCard.js.map +1 -1
- package/lib/cjs/models/rtb/NativeRequest.js +2 -2
- package/lib/cjs/services/Configuration.js +17 -7
- package/lib/cjs/services/Configuration.js.map +1 -1
- package/lib/cjs/services/Dynamic.js +1 -0
- package/lib/cjs/services/Dynamic.js.map +1 -1
- package/lib/cjs/services/Logger.js +22 -16
- package/lib/cjs/services/Logger.js.map +1 -1
- package/lib/cjs/services/Memo.js +41 -0
- package/lib/cjs/services/Memo.js.map +1 -0
- package/lib/cjs/services/Product.js +30 -32
- package/lib/cjs/services/Product.js.map +1 -1
- package/lib/cjs/services/Result.js +43 -7
- package/lib/cjs/services/Result.js.map +1 -1
- package/lib/cjs/services/index.js +1 -1
- package/lib/esm/Api.js +5 -6
- package/lib/esm/Api.js.map +1 -1
- package/lib/esm/helpers/RequestBuilder.js +1 -1
- package/lib/esm/helpers/response/ProductCard.js +39 -15
- package/lib/esm/helpers/response/ProductCard.js.map +1 -1
- package/lib/esm/models/rtb/NativeRequest.js +2 -2
- package/lib/esm/services/Dynamic.js +1 -0
- package/lib/esm/services/Dynamic.js.map +1 -1
- package/lib/esm/services/Logger.js +22 -16
- package/lib/esm/services/Logger.js.map +1 -1
- package/lib/esm/services/Memo.js +36 -0
- package/lib/esm/services/Memo.js.map +1 -0
- package/lib/esm/services/Product.js +26 -29
- package/lib/esm/services/Product.js.map +1 -1
- package/lib/esm/services/Result.js +38 -6
- package/lib/esm/services/Result.js.map +1 -1
- package/lib/esm/services/index.js +1 -1
- package/lib/types/Api.d.ts +1 -7
- package/lib/types/helpers/response/ProductCard.d.ts +2 -2
- package/lib/types/models/rtb/BidRequest.d.ts +1 -1
- package/lib/types/models/rtb/NativeRequest.d.ts +2 -2
- package/lib/types/services/Logger.d.ts +1 -1
- package/lib/types/services/Memo.d.ts +2 -0
- package/lib/types/services/Product.d.ts +5 -1
- package/lib/types/services/Result.d.ts +15 -3
- package/lib/types/services/index.d.ts +1 -1
- package/package.json +2 -2
- package/lib/cjs/services/mock/Bidder.js +0 -3
- package/lib/cjs/services/mock/Bidder.js.map +0 -1
- package/lib/cjs/services/mock/index.js +0 -18
- package/lib/cjs/services/mock/index.js.map +0 -1
- package/lib/esm/services/mock/Bidder.js +0 -2
- package/lib/esm/services/mock/Bidder.js.map +0 -1
- package/lib/esm/services/mock/index.js +0 -2
- package/lib/esm/services/mock/index.js.map +0 -1
- package/lib/types/services/mock/Bidder.d.ts +0 -1
- package/lib/types/services/mock/index.d.ts +0 -1
|
@@ -1,55 +1,50 @@
|
|
|
1
1
|
import { Ctx } from './Logger';
|
|
2
2
|
import { Err, Ok } from './Result';
|
|
3
|
-
export async
|
|
3
|
+
export const GetAllSponsoredProducts = async (logger, url, accountId, locationId, nativeId) => {
|
|
4
4
|
const log = Ctx(logger)?.with('GetSponsoredProduct').with(accountId).with(locationId).with(nativeId);
|
|
5
5
|
log?.info('Getting sponsored product');
|
|
6
6
|
try {
|
|
7
7
|
const rawResponse = await fetch(`${url}/native/${accountId}/${locationId}/${nativeId}.json`);
|
|
8
8
|
if (rawResponse.status !== 200) {
|
|
9
9
|
log?.error('product feed service returned with non-200 response', rawResponse.status);
|
|
10
|
-
return;
|
|
10
|
+
return Err(new NoNativeError(nativeId));
|
|
11
11
|
}
|
|
12
|
-
const products = rawResponse;
|
|
12
|
+
const products = (await rawResponse.json());
|
|
13
13
|
log?.debug('response', products);
|
|
14
|
+
/* This should never actually be an array here, but there have been API changes in the past which incorrectly
|
|
15
|
+
* returned arrays of products for product-level carousels, so I'm going to leave it here to be safe. But this
|
|
16
|
+
* will probably never be hit */
|
|
14
17
|
if (Array.isArray(products)) {
|
|
15
18
|
log?.debug('Brand level creative');
|
|
16
19
|
const productArr = products;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
+
const mapResponseToProductInfoLogged = mapResponseToProductInfo.bind(undefined, log);
|
|
21
|
+
return Ok(productArr.map(mapResponseToProductInfoLogged));
|
|
20
22
|
}
|
|
21
23
|
else {
|
|
22
24
|
log?.debug('Individual product creative');
|
|
23
25
|
const product = products;
|
|
24
|
-
return mapResponseToProductInfo(log, product);
|
|
26
|
+
return Ok([mapResponseToProductInfo(log, product)]);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
catch (err) {
|
|
28
30
|
log?.error(err);
|
|
31
|
+
return Err(err);
|
|
29
32
|
}
|
|
30
|
-
}
|
|
31
|
-
export const
|
|
32
|
-
const log = Ctx(logger)?.with('
|
|
33
|
-
log?.info('Getting sponsored product');
|
|
33
|
+
};
|
|
34
|
+
export const GetAllSponsoredBrandProducts = async (logger, url, accountId, locationId, nativeId) => {
|
|
35
|
+
const log = Ctx(logger)?.with('GetSponsoredBrandProducts').with(accountId).with(locationId).with(nativeId);
|
|
36
|
+
log?.info('Getting sponsored brand-level product responses');
|
|
34
37
|
try {
|
|
35
|
-
const rawResponse = await fetch(`${url}/native/${accountId}/${locationId}/${nativeId}.json`);
|
|
38
|
+
const rawResponse = await fetch(`${url}/native/v2/brand/${accountId}/${locationId}/${nativeId}.json`);
|
|
36
39
|
if (rawResponse.status !== 200) {
|
|
37
|
-
log?.error('product feed service returned with non-200 response', rawResponse.status);
|
|
38
40
|
return Err(new NoNativeError(nativeId));
|
|
39
41
|
}
|
|
40
42
|
const products = (await rawResponse.json());
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
log?.debug('Brand level creative');
|
|
44
|
-
const productArr = products;
|
|
45
|
-
const mapResponseToProductInfoLogged = mapResponseToProductInfo.bind(undefined, log);
|
|
46
|
-
return Ok(productArr.map(mapResponseToProductInfoLogged));
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
log?.debug('Individual product creative');
|
|
50
|
-
const product = products;
|
|
51
|
-
return Ok([mapResponseToProductInfo(log, product)]);
|
|
43
|
+
if (!Array.isArray(products)) {
|
|
44
|
+
return Err(new MalformedBrandResponseError(nativeId));
|
|
52
45
|
}
|
|
46
|
+
const mapResponseToProductInfoLogged = mapResponseToProductInfo.bind(undefined, log);
|
|
47
|
+
return Ok(products.map(mapResponseToProductInfoLogged));
|
|
53
48
|
}
|
|
54
49
|
catch (err) {
|
|
55
50
|
log?.error(err);
|
|
@@ -113,9 +108,11 @@ export class NoNativeError extends Error {
|
|
|
113
108
|
this.nativeId = nativeId;
|
|
114
109
|
}
|
|
115
110
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
export class MalformedBrandResponseError extends Error {
|
|
112
|
+
nativeId;
|
|
113
|
+
constructor(nativeId) {
|
|
114
|
+
super('Brand-level native was not an array');
|
|
115
|
+
this.nativeId = nativeId;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
121
118
|
//# sourceMappingURL=Product.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Product.js","sourceRoot":"src/","sources":["services/Product.ts"],"names":[],"mappings":"AACA,OAAO,EACH,GAAG,EAEN,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,GAAG,EACH,EAAE,EAGL,MAAM,UAAU,CAAC;AAMlB,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"Product.js","sourceRoot":"src/","sources":["services/Product.ts"],"names":[],"mappings":"AACA,OAAO,EACH,GAAG,EAEN,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,GAAG,EACH,EAAE,EAGL,MAAM,UAAU,CAAC;AAMlB,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EACxC,MAA2B,EAC3B,GAAW,EACX,SAAiB,EACjB,UAAkB,EAClB,QAAgB,EACsB,EAAE;IACxC,MAAM,GAAG,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,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,OAAO,aAAc,SAAQ,KAAK;IACjB;IAAnB,YAAmB,QAAgB;QAC/B,KAAK,CAAC,2CAA2C,GAAG,QAAQ,CAAC,CAAC;QAD/C,aAAQ,GAAR,QAAQ,CAAQ;IAEnC,CAAC;CACJ;AAED,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAC/B;IAAnB,YAAmB,QAAgB;QAC/B,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAD9B,aAAQ,GAAR,QAAQ,CAAQ;IAEnC,CAAC;CACJ"}
|
|
@@ -30,13 +30,21 @@ export const TryDoAsync = async (fn) => {
|
|
|
30
30
|
return Err(err);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
+
export const TryDoFlatAsync = async (fn) => {
|
|
34
|
+
try {
|
|
35
|
+
return await fn();
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
return Err(err);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
33
41
|
export const GetValue = (result) => result?.ok === true ? result.value : undefined;
|
|
34
42
|
export const ValueOr = (result, or) => result?.ok === true ? result.value : or;
|
|
35
|
-
export const GetValueOrThrow = (result) => {
|
|
43
|
+
export const GetValueOrThrow = (result, error) => {
|
|
36
44
|
if (result.ok) {
|
|
37
45
|
return result.value;
|
|
38
46
|
}
|
|
39
|
-
throw result.error;
|
|
47
|
+
throw error ?? result.error;
|
|
40
48
|
};
|
|
41
49
|
export const WrapValue = (value) => {
|
|
42
50
|
if (value === undefined || value === null) {
|
|
@@ -57,6 +65,10 @@ export const Some = (results) => {
|
|
|
57
65
|
const success = results.filter(res => res.ok).map(res => res.value);
|
|
58
66
|
return Ok(success);
|
|
59
67
|
};
|
|
68
|
+
export const First = (first, ...rest) => {
|
|
69
|
+
const results = [first, ...rest];
|
|
70
|
+
return results.find(r => r.ok) ?? results.find(r => !r.ok);
|
|
71
|
+
};
|
|
60
72
|
export const Filter = (...results) => {
|
|
61
73
|
const success = Some(results).value.map(val => Ok(val));
|
|
62
74
|
const failed = results.filter(res => !res.ok);
|
|
@@ -99,16 +111,36 @@ const pipeValueOrThrow = (result) => () => {
|
|
|
99
111
|
}
|
|
100
112
|
throw result.error;
|
|
101
113
|
};
|
|
102
|
-
export
|
|
103
|
-
|
|
114
|
+
export class CancellationToken {
|
|
115
|
+
_cancelled = false;
|
|
116
|
+
get cancelled() {
|
|
117
|
+
return this._cancelled;
|
|
118
|
+
}
|
|
119
|
+
cancel() {
|
|
120
|
+
this._cancelled = true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export class CancelledError extends Error {
|
|
124
|
+
cancellationToken;
|
|
125
|
+
constructor(cancellationToken) {
|
|
126
|
+
super('Pipeline was cancelled');
|
|
127
|
+
this.cancellationToken = cancellationToken;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export const AsyncPipe = (result, cancellationToken) => ({
|
|
131
|
+
cancellationToken,
|
|
132
|
+
then: asyncPipeThen(cancellationToken, result),
|
|
104
133
|
result: asyncPipeResult(result),
|
|
105
134
|
value: asyncPipeValue(result),
|
|
106
135
|
valueOr: asyncPipeValueOr(result),
|
|
107
136
|
valueOrThrow: asyncPipeValueOrThrow(result)
|
|
108
137
|
});
|
|
109
|
-
const asyncPipeThen = (result) => (fn) => {
|
|
138
|
+
const asyncPipeThen = (cancellationToken, result) => (fn) => {
|
|
110
139
|
const asyncResult = result;
|
|
111
140
|
const wrappedPromiseResult = asyncResult.then(unwrappedResult => {
|
|
141
|
+
if (cancellationToken?.cancelled === true) {
|
|
142
|
+
return Err(new CancelledError(cancellationToken));
|
|
143
|
+
}
|
|
112
144
|
if (unwrappedResult.ok) {
|
|
113
145
|
try {
|
|
114
146
|
const fnRes = fn(unwrappedResult.value);
|
|
@@ -123,7 +155,7 @@ const asyncPipeThen = (result) => (fn) => {
|
|
|
123
155
|
return unwrappedResult;
|
|
124
156
|
}
|
|
125
157
|
});
|
|
126
|
-
return AsyncPipe(wrappedPromiseResult);
|
|
158
|
+
return AsyncPipe(wrappedPromiseResult, cancellationToken);
|
|
127
159
|
};
|
|
128
160
|
const asyncPipeResult = (result) => () => result;
|
|
129
161
|
const asyncPipeValue = (result) => async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Result.js","sourceRoot":"src/","sources":["services/Result.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,CAAI,EAAe,EAAE,CAAC,CAAC;IACzC,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,CAAC;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAY,CAAI,EAAgB,EAAE,CAAC,CAAC;IACnD,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,CAAC;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAe,EAAW,EAAgB,EAAE;IAC7D,IAAI,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,GAAQ,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAe,EAAsB,EAAgB,EAAE;IAC5E,IAAI,CAAC;QACD,OAAO,EAAE,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,GAAQ,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAgB,EAAoB,EAAqB,EAAE;IACtF,IAAI,CAAC;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,GAAQ,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC;AAEF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H,MAAM,aAAa,GAAG,CAAO,OAAuB,EAAG,EAAE,CAAC,CAAI,EAAK,EAAW,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAEjH,MAAM,kBAAkB,GAAG,CAAO,OAAuB,EAAE,EAAE,CAAC,GAAQ,EAAE;IACpE,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QACb,OAAO,OAAO,CAAC,KAAK,CAAC;IACzB,CAAC;SAAM,CAAC;QACJ,MAAM,OAAO,CAAC,KAAK,CAAC;IACxB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,OAAO,YAAa,SAAQ,KAAK;IACP;IAA5B,YAA4B,KAAuB;QAC/C,KAAK,CAAC,6BAA6B,CAAC,CAAC;QADb,UAAK,GAAL,KAAK,CAAkB;IAEnD,CAAC;CACJ;AAAA,CAAC"}
|
|
@@ -6,7 +6,7 @@ export * from './Configuration';
|
|
|
6
6
|
export * from './Bidder';
|
|
7
7
|
export * from './Product';
|
|
8
8
|
export * from './Recommender';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './Memo';
|
|
10
10
|
export * from './Template';
|
|
11
11
|
export * from './Dynamic';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
package/lib/types/Api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { INativeTemplateDelegateWindow, ICompiledPublisherConfiguration, IDevice, IGeoContext } from './models';
|
|
2
|
-
import { type AsyncResult, type INavigator, type IScreen, type RequestBidsFn, type ILogger, type
|
|
2
|
+
import { type AsyncResult, type INavigator, type IScreen, type RequestBidsFn, type ILogger, type PersonalRecommenderFn, type NonPersonalRecommenderFn, type GetConfigurationFn, type GetGeoFn, type GetDeviceFn, type GetRecommendedProductFromProductIdFn, type GetAllSponsoredProductFromNativeIdFn } from './services';
|
|
3
3
|
import { type BuildAllSponsoredProductCardResponsesFn, type GenerateSponsoredProductCardResponseFn, type NativeRequestBuilderFn, type RequestBuilderFn } from './helpers';
|
|
4
4
|
import Handlebars from 'handlebars/runtime';
|
|
5
5
|
import { type BuildHybridCarouselFn, type BuildHybridCarouselFromInitialBidFn, type BuildRecommendedCarouselFn, type BuildSponsoredCarouselFn, type BuildSponsoredCarouselFromInitialBidFn } from './helpers/response/Carousel';
|
|
@@ -63,11 +63,6 @@ export interface ISurfsideApi {
|
|
|
63
63
|
* Builds an OpenRTB Native 1.2 request with initial fields, such as site, app, and trackers
|
|
64
64
|
*/
|
|
65
65
|
defaultNative: NativeRequestBuilderFn;
|
|
66
|
-
/**
|
|
67
|
-
* Creates a sponsored product generator from the given Native Creative ID. One native creative ID can generate
|
|
68
|
-
* multiple products
|
|
69
|
-
*/
|
|
70
|
-
getSponsoredProduct: GetSponsoredProductFromNativeIdFn;
|
|
71
66
|
/**
|
|
72
67
|
* Gets all sponsored products from the native creative ID. One native creative ID can generate multiple products
|
|
73
68
|
*/
|
|
@@ -134,7 +129,6 @@ export declare function InitSurfAdsCoreInternal(internalApiDto: {
|
|
|
134
129
|
getConfiguration: GetConfigurationFn;
|
|
135
130
|
getGeo: GetGeoFn;
|
|
136
131
|
getDevice: GetDeviceFn;
|
|
137
|
-
getSponsoredProduct: GetSponsoredProductFromNativeIdFn;
|
|
138
132
|
getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn;
|
|
139
133
|
getRecommendedProduct: GetRecommendedProductFromProductIdFn;
|
|
140
134
|
generateTopProducts: NonPersonalRecommenderFn;
|
|
@@ -29,8 +29,8 @@ export interface IBuiltProductCardResponse {
|
|
|
29
29
|
clickthrough: string;
|
|
30
30
|
sponsored: boolean;
|
|
31
31
|
}
|
|
32
|
-
export declare const BuildAllSponsoredProductCardResponses: (logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
33
|
-
export declare function GenerateSponsoredProductCardResponse(logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]): AsyncGenerator<IBuiltProductCardBidResponse>;
|
|
32
|
+
export declare const BuildAllSponsoredProductCardResponses: (logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]) => AsyncResult<IBuiltProductCardBidResponse[]>;
|
|
33
|
+
export declare function GenerateSponsoredProductCardResponse(logger: ILogger | undefined, getAllSponsoredProducts: GetAllSponsoredProductFromNativeIdFn, getAllSponsoredBrandProducts: GetAllSponsoredProductFromNativeIdFn, windowInfo: INativeTemplateDelegateWindow, configuration: ICompiledPublisherConfiguration, bids: IBid[]): AsyncGenerator<IBuiltProductCardBidResponse>;
|
|
34
34
|
export declare class MissingBidsError extends Error {
|
|
35
35
|
constructor();
|
|
36
36
|
}
|
|
@@ -35,7 +35,7 @@ export declare const NativeDataTypes: {
|
|
|
35
35
|
readonly SurfTHC: 501;
|
|
36
36
|
readonly SurfCBD: 502;
|
|
37
37
|
readonly SurfCategory: 503;
|
|
38
|
-
readonly SurfMetaBrand:
|
|
38
|
+
readonly SurfMetaBrand: 509;
|
|
39
39
|
readonly SurfMetaProduct: 599;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
@@ -56,7 +56,7 @@ export declare const NativeAssetId: {
|
|
|
56
56
|
readonly SurfTHC: 501;
|
|
57
57
|
readonly SurfCBD: 502;
|
|
58
58
|
readonly SurfCategory: 503;
|
|
59
|
-
readonly SurfMetaBrand:
|
|
59
|
+
readonly SurfMetaBrand: 509;
|
|
60
60
|
readonly SurfMetaProduct: 599;
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
@@ -10,5 +10,5 @@ export interface ILogger {
|
|
|
10
10
|
export interface IContextLogger extends ILogger {
|
|
11
11
|
with: ContextFn;
|
|
12
12
|
}
|
|
13
|
-
export declare const InitLogger: () => IContextLogger;
|
|
13
|
+
export declare const InitLogger: (rich?: boolean) => IContextLogger;
|
|
14
14
|
export declare const Ctx: (logger: ILogger | undefined) => IContextLogger | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const Memoize: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
2
|
+
export declare const MemoizeAsync: <TArgs extends readonly unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>) => (...args: TArgs) => Promise<TReturn>;
|
|
@@ -4,10 +4,14 @@ import { type Result, type AsyncResult } from './Result';
|
|
|
4
4
|
export type GetSponsoredProductFromNativeIdFn = (nativeId: string) => AsyncGenerator<IProductInformation>;
|
|
5
5
|
export type GetAllSponsoredProductFromNativeIdFn = (nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
6
6
|
export type GetRecommendedProductFromProductIdFn = (productId: string) => AsyncResult<IProductInformation>;
|
|
7
|
-
export declare function GetSponsoredProduct(logger: ILogger | undefined, url: string, accountId: string, locationId: string, nativeId: string): AsyncGenerator<IProductInformation>;
|
|
8
7
|
export declare const GetAllSponsoredProducts: (logger: ILogger | undefined, url: string, accountId: string, locationId: string, nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
8
|
+
export declare const GetAllSponsoredBrandProducts: (logger: ILogger | undefined, url: string, accountId: string, locationId: string, nativeId: string) => Promise<Result<IProductInformation[]>>;
|
|
9
9
|
export declare const GetRecommendedProduct: (logger: ILogger | undefined, url: string, accountId: string, locationId: string, productId: string) => AsyncResult<IProductInformation>;
|
|
10
10
|
export declare class NoNativeError extends Error {
|
|
11
11
|
nativeId: string;
|
|
12
12
|
constructor(nativeId: string);
|
|
13
13
|
}
|
|
14
|
+
export declare class MalformedBrandResponseError extends Error {
|
|
15
|
+
nativeId: string;
|
|
16
|
+
constructor(nativeId: string);
|
|
17
|
+
}
|
|
@@ -13,13 +13,15 @@ export declare const Err: <E = Error>(e: E) => ErrResult<E>;
|
|
|
13
13
|
export declare const TryDo: <T, E = Error>(fn: () => T) => Result<T, E>;
|
|
14
14
|
export declare const TryDoFlat: <T, E = Error>(fn: () => Result<T, E>) => Result<T, E>;
|
|
15
15
|
export declare const TryDoAsync: <T, E = Error>(fn: () => Promise<T>) => AsyncResult<T, E>;
|
|
16
|
+
export declare const TryDoFlatAsync: <T, E = Error>(fn: () => AsyncResult<T, E>) => AsyncResult<T, E>;
|
|
16
17
|
export declare const GetValue: <T, E = Error>(result: Result<T, E> | undefined) => T | undefined;
|
|
17
18
|
export declare const ValueOr: <T, E = Error, U = T>(result: Result<T, E> | undefined, or: U) => T | U;
|
|
18
|
-
export declare const GetValueOrThrow: <T>(result: Result<T, Error
|
|
19
|
+
export declare const GetValueOrThrow: <T>(result: Result<T, Error>, error?: Error) => T;
|
|
19
20
|
export declare const WrapValue: <T>(value: T | undefined | null) => Result<T>;
|
|
20
|
-
export declare const AssertValue: <T>(result: Result<T, Error
|
|
21
|
+
export declare const AssertValue: <T>(result: Result<T, Error>, error?: Error) => T;
|
|
21
22
|
export declare const AllOrNone: <T>(results: Result<T, Error>[]) => Result<T[]>;
|
|
22
23
|
export declare const Some: <T>(results: Result<T, Error>[]) => OkResult<T[]>;
|
|
24
|
+
export declare const First: <T>(first: Result<T, Error>, ...rest: Result<T, Error>[]) => Result<T>;
|
|
23
25
|
export declare const Filter: <T>(...results: Result<T, Error>[]) => [OkResult<T>[], ErrResult[]];
|
|
24
26
|
export declare const AnyFailed: (...results: Result<any, Error>[]) => [true, Error[]] | [false];
|
|
25
27
|
export declare class MultipleErrorsError extends Error {
|
|
@@ -35,13 +37,23 @@ export interface IResultPipe<T, E = Error> {
|
|
|
35
37
|
}
|
|
36
38
|
export declare const Pipe: <T, E = Error>(result: Result<T, E>) => IResultPipe<T, E>;
|
|
37
39
|
export interface IAsyncResultPipe<T, E = Error> {
|
|
40
|
+
cancellationToken?: CancellationToken;
|
|
38
41
|
then: <U>(fn: (t: T) => AsyncResult<U> | Result<U>) => IAsyncResultPipe<U, E>;
|
|
39
42
|
result: () => AsyncResult<T, E>;
|
|
40
43
|
value: () => Promise<T | undefined>;
|
|
41
44
|
valueOr: <U>(or: U) => Promise<T | U>;
|
|
42
45
|
valueOrThrow: () => Promise<T>;
|
|
43
46
|
}
|
|
44
|
-
export declare
|
|
47
|
+
export declare class CancellationToken {
|
|
48
|
+
private _cancelled;
|
|
49
|
+
get cancelled(): boolean;
|
|
50
|
+
cancel(): void;
|
|
51
|
+
}
|
|
52
|
+
export declare class CancelledError extends Error {
|
|
53
|
+
cancellationToken: CancellationToken;
|
|
54
|
+
constructor(cancellationToken: CancellationToken);
|
|
55
|
+
}
|
|
56
|
+
export declare const AsyncPipe: <T, E>(result: AsyncResult<T, E>, cancellationToken?: CancellationToken) => IAsyncResultPipe<T, E>;
|
|
45
57
|
export type IResultStream<T, E = Error> = {
|
|
46
58
|
map: <U>(fn: (t: T) => U) => IResultStream<U, E>;
|
|
47
59
|
filter: (fn: (t: T) => boolean) => IResultStream<T, E>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surfside/ads-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"types": "./lib/types/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"jest": "^29.7.0",
|
|
27
27
|
"ts-jest": "^29.3.2",
|
|
28
28
|
"typedoc": "^0.28.5",
|
|
29
|
-
"typescript-eslint": "^8.
|
|
29
|
+
"typescript-eslint": "^8.41.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"typescript": "^5.8.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bidder.js","sourceRoot":"src/","sources":["services/mock/Bidder.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Bidder"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["services/mock/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Bidder.js","sourceRoot":"src/","sources":["services/mock/Bidder.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["services/mock/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Bidder';
|