Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Occhialini <[email protected]>
  • Loading branch information
littlespex committed Dec 14, 2023
1 parent 7231685 commit d73d8e2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
8 changes: 7 additions & 1 deletion lib/config/common-media-library.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ export const CMSD_V1 = 1;
export type CmsdCustomKey = CmCustomKey;

// @beta
export interface CmsdDynamic {
export type CmsdDynamic = {
value: string;
params: CmsdDynamicParams;
};

// @beta
export interface CmsdDynamicParams {
[index: CmsdCustomKey]: CmsdValue;
du?: boolean;
etp?: number;
Expand Down
3 changes: 1 addition & 2 deletions lib/src/cmsd/CmsdDynamic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SfItem } from '../structuredfield/SfItem';
import { CmsdDynamicParams } from './CmsdDynamicParams';

/**
Expand All @@ -10,4 +9,4 @@ import { CmsdDynamicParams } from './CmsdDynamicParams';
*
* @beta
*/
export type CmsdDynamic = SfItem<string, CmsdDynamicParams>;
export type CmsdDynamic = { value: string, params: CmsdDynamicParams };
2 changes: 1 addition & 1 deletion lib/src/cmsd/decodeCmsdDynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export function decodeCmsdDynamic(cmsd: string): CmsdDynamic[] {

const sfDict = decodeSfList(cmsd);

return sfDict as any;
return sfDict as CmsdDynamic[];
}
10 changes: 5 additions & 5 deletions lib/src/structuredfield/SfItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { SfParameters } from './SfParameters.js';
*
* @beta
*/
export class SfItem<V = SfBareItem, P = SfParameters> {
export class SfItem {

value: V;
value: SfBareItem;

params?: P;
params?: SfParameters;

constructor(value: any, params?: P) {
constructor(value: any, params?: SfParameters) {
if (Array.isArray(value)) {
value = value.map((v) => (v instanceof SfItem) ? v : new SfItem<V, P>(v));
value = value.map((v) => (v instanceof SfItem) ? v : new SfItem(v));
}

this.value = value;
Expand Down

0 comments on commit d73d8e2

Please sign in to comment.