@levo-so/core 0.1.10 → 0.1.11
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/LevoClient.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export type WorkspaceID = `W${string}`;
|
|
2
|
+
export declare const workspaceIdRegex: RegExp;
|
|
1
3
|
export interface ILevoConfig {
|
|
2
|
-
workspace:
|
|
4
|
+
workspace: WorkspaceID | null;
|
|
3
5
|
apiUrl: string;
|
|
4
6
|
insightsUrl: string;
|
|
5
7
|
NODE_ENV: string;
|
|
@@ -13,12 +15,12 @@ export interface ILevoConfig {
|
|
|
13
15
|
declare class LevoClient implements ILevoConfig {
|
|
14
16
|
#private;
|
|
15
17
|
constructor(props: Partial<ILevoConfig>);
|
|
16
|
-
get workspace(): string | null;
|
|
18
|
+
get workspace(): `W${string}` | null;
|
|
17
19
|
get apiUrl(): string;
|
|
18
20
|
get insightsUrl(): string;
|
|
19
21
|
get NODE_ENV(): string;
|
|
20
22
|
get APP_MODE(): "production" | "staging" | undefined;
|
|
21
|
-
updateWorkspace(workspace:
|
|
23
|
+
updateWorkspace(workspace: WorkspaceID): void;
|
|
22
24
|
get fetch(): import("wretch/addons/queryString").QueryStringAddon & import("wretch").Wretch<import("wretch/addons/queryString").QueryStringAddon, unknown, undefined>;
|
|
23
25
|
}
|
|
24
26
|
export { LevoClient, LevoClient as default };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { LevoPlugin } from './chunk-QJSKNLTV.js';
|
|
|
4
4
|
import wretch from 'wretch';
|
|
5
5
|
import QueryStringAddon from 'wretch/addons/queryString';
|
|
6
6
|
|
|
7
|
+
var workspaceIdRegex = /^W[A-Z0-9]{7}$/;
|
|
7
8
|
var LevoClient = class {
|
|
8
9
|
#workspace;
|
|
9
10
|
#apiUrl;
|
|
@@ -18,6 +19,13 @@ var LevoClient = class {
|
|
|
18
19
|
NODE_ENV: "production"
|
|
19
20
|
};
|
|
20
21
|
const finalProps = { ...defaultProps, ...props };
|
|
22
|
+
if (props.workspace) {
|
|
23
|
+
if (!workspaceIdRegex.test(props.workspace)) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Invalid workspace ID: ${props.workspace}. Workspace ID must be a string of the format "W[A-Z0-9]{7}".`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
this.#workspace = finalProps.workspace;
|
|
22
30
|
this.#apiUrl = finalProps.apiUrl;
|
|
23
31
|
this.#insightsUrl = finalProps.insightsUrl;
|
|
@@ -267,4 +275,4 @@ var createSrcSet = (srcSetObj) => {
|
|
|
267
275
|
return Object.entries(srcSetObj).map(([key, value]) => `${formatImagePath(value)} ${key}w`).join(", ");
|
|
268
276
|
};
|
|
269
277
|
|
|
270
|
-
export { FieldInterfaces, FieldInterfacesList, FieldKind, FieldKindList, LevoClient, MediaKind, MediaKindList, createSrcSet, defaultByKinds, formatImagePath, formatsByInterface, interfaceKinds };
|
|
278
|
+
export { FieldInterfaces, FieldInterfacesList, FieldKind, FieldKindList, LevoClient, MediaKind, MediaKindList, createSrcSet, defaultByKinds, formatImagePath, formatsByInterface, interfaceKinds, workspaceIdRegex };
|
package/dist/types/audience.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/types/audience.ts"],"names":[],"mappings":"AAAA,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,cAAc;QAC7B,YAAY,EAAE,OAAO,CAAC;QACtB,SAAS,EAAE,OAAO,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QAEjB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE;YACR,IAAI,EAAE,GAAG,CAAC;YACV,QAAQ,EAAE,GAAG,CAAC;YACd,IAAI,EAAE,GAAG,CAAC;SACX,CAA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