spoclip-kit 1.0.18 → 1.0.19
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/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/libs.cjs +4 -0
- package/dist/libs.cjs.map +1 -1
- package/dist/libs.d.cts +14 -1
- package/dist/libs.d.ts +14 -1
- package/dist/libs.js +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
getClipVideoDownloadCost: () => getClipVideoDownloadCost,
|
|
24
|
+
getRawVideoDownloadCost: () => getRawVideoDownloadCost,
|
|
23
25
|
getVideoDownloadCost: () => getVideoDownloadCost
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -60,6 +62,8 @@ function getRawVideoDownloadCost() {
|
|
|
60
62
|
}
|
|
61
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
64
|
0 && (module.exports = {
|
|
65
|
+
getClipVideoDownloadCost,
|
|
66
|
+
getRawVideoDownloadCost,
|
|
63
67
|
getVideoDownloadCost
|
|
64
68
|
});
|
|
65
69
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/libs/cost.ts"],"sourcesContent":["// Main entry point for spoclip-kit\nexport * from './libs';\nexport * from './types';\n","import type { TicketCode } from '@/types/membership';\n\nconst CLIP_COST_PER_SECOND = 1 / 60;\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\n\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return getRawVideoDownloadCost();\n }\n\n return getClipVideoDownloadCost({\n duration,\n ticketCode,\n remainingFreeDownloads,\n });\n}\n\ntype GetClipVideoDownloadCostParams = {\n duration: number;\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n};\n\nexport function getClipVideoDownloadCost({\n duration,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetClipVideoDownloadCostParams) {\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const cost = Math.round(durationInSeconds * CLIP_COST_PER_SECOND * 10) / 10;\n return { cost, isPlusFree: false };\n}\n\nexport function getRawVideoDownloadCost() {\n return { cost: 20, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,uBAAuB,IAAI;AA2B1B,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,wBAAwB;AAAA,EACjC;AAEA,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAQO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAAmC;AACjC,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,OAAO,KAAK,MAAM,oBAAoB,uBAAuB,EAAE,IAAI;AACzE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;AAEO,SAAS,0BAA0B;AACxC,SAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AACvC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/libs/cost.ts"],"sourcesContent":["// Main entry point for spoclip-kit\nexport * from './libs';\nexport * from './types';\n","import type { TicketCode } from '@/types/membership';\n\nconst CLIP_COST_PER_SECOND = 1 / 60;\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\n\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return getRawVideoDownloadCost();\n }\n\n return getClipVideoDownloadCost({\n duration,\n ticketCode,\n remainingFreeDownloads,\n });\n}\n\ntype GetClipVideoDownloadCostParams = {\n duration: number;\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n};\n\nexport function getClipVideoDownloadCost({\n duration,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetClipVideoDownloadCostParams) {\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const cost = Math.round(durationInSeconds * CLIP_COST_PER_SECOND * 10) / 10;\n return { cost, isPlusFree: false };\n}\n\nexport function getRawVideoDownloadCost() {\n return { cost: 20, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,uBAAuB,IAAI;AA2B1B,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,wBAAwB;AAAA,EACjC;AAEA,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAQO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAAmC;AACjC,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,OAAO,KAAK,MAAM,oBAAoB,uBAAuB,EAAE,IAAI;AACzE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;AAEO,SAAS,0BAA0B;AACxC,SAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AACvC;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getVideoDownloadCost } from './libs.cjs';
|
|
1
|
+
export { getClipVideoDownloadCost, getRawVideoDownloadCost, getVideoDownloadCost } from './libs.cjs';
|
|
2
2
|
export { TicketCode } from './types.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getVideoDownloadCost } from './libs.js';
|
|
1
|
+
export { getClipVideoDownloadCost, getRawVideoDownloadCost, getVideoDownloadCost } from './libs.js';
|
|
2
2
|
export { TicketCode } from './types.js';
|
package/dist/index.js
CHANGED
package/dist/libs.cjs
CHANGED
|
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/libs/index.ts
|
|
21
21
|
var libs_exports = {};
|
|
22
22
|
__export(libs_exports, {
|
|
23
|
+
getClipVideoDownloadCost: () => getClipVideoDownloadCost,
|
|
24
|
+
getRawVideoDownloadCost: () => getRawVideoDownloadCost,
|
|
23
25
|
getVideoDownloadCost: () => getVideoDownloadCost
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(libs_exports);
|
|
@@ -60,6 +62,8 @@ function getRawVideoDownloadCost() {
|
|
|
60
62
|
}
|
|
61
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
64
|
0 && (module.exports = {
|
|
65
|
+
getClipVideoDownloadCost,
|
|
66
|
+
getRawVideoDownloadCost,
|
|
63
67
|
getVideoDownloadCost
|
|
64
68
|
});
|
|
65
69
|
//# sourceMappingURL=libs.cjs.map
|
package/dist/libs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/libs/index.ts","../src/libs/cost.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../src/libs/index.ts","../src/libs/cost.ts"],"sourcesContent":["export * from './cost';\n","import type { TicketCode } from '@/types/membership';\n\nconst CLIP_COST_PER_SECOND = 1 / 60;\n\n/**\n * 비디오 다운로드 비용을 계산합니다.\n *\n * @description\n * - 전체 시간 4K 다운로드 시 티켓 상관없이 20톨\n * - 1분 미만인 경우, remainingFreeDownloads > 0 이면 무료\n * - 1분 미만인 경우, remainingFreeDownloads <= 0 이면 1톨부터 시작\n * - 55초부터는 1.92xx 이므로 반올림 시 1.9톨\n * - 59초부터는 1.98xx 이므로 반올림 시 2톨\n * - 60초부터는 2.00xx 이므로 반올림 시 2톨\n * - 62초부터는 2.03xx 이므로 반올림 시 2톨\n * - 63초부터는 2.05xx 이므로 반올림 시 2.1톨\n *\n */\n\ntype GetVideoDownloadCostParams = {\n duration: number;\n quality: '2K' | '4K';\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n\n /** @deprecated 이 파라미터는 더이상 사용되지 않습니다. */\n isFullTime?: boolean;\n};\n\nexport function getVideoDownloadCost({\n duration,\n quality,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetVideoDownloadCostParams) {\n if (quality === '4K') {\n return getRawVideoDownloadCost();\n }\n\n return getClipVideoDownloadCost({\n duration,\n ticketCode,\n remainingFreeDownloads,\n });\n}\n\ntype GetClipVideoDownloadCostParams = {\n duration: number;\n ticketCode?: TicketCode;\n remainingFreeDownloads?: number;\n};\n\nexport function getClipVideoDownloadCost({\n duration,\n ticketCode = 'FREE',\n remainingFreeDownloads = 0,\n}: GetClipVideoDownloadCostParams) {\n const durationInSeconds = duration / 1000;\n const isUnder61 = durationInSeconds < 61;\n const isPlus = ticketCode === 'PLUS';\n\n if (isPlus && remainingFreeDownloads > 0 && isUnder61) {\n return { cost: 0, isPlusFree: true };\n }\n\n const cost = Math.round(durationInSeconds * CLIP_COST_PER_SECOND * 10) / 10;\n return { cost, isPlusFree: false };\n}\n\nexport function getRawVideoDownloadCost() {\n return { cost: 20, isPlusFree: false };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,uBAAuB,IAAI;AA2B1B,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAA+B;AAC7B,MAAI,YAAY,MAAM;AACpB,WAAO,wBAAwB;AAAA,EACjC;AAEA,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAQO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA,aAAa;AAAA,EACb,yBAAyB;AAC3B,GAAmC;AACjC,QAAM,oBAAoB,WAAW;AACrC,QAAM,YAAY,oBAAoB;AACtC,QAAM,SAAS,eAAe;AAE9B,MAAI,UAAU,yBAAyB,KAAK,WAAW;AACrD,WAAO,EAAE,MAAM,GAAG,YAAY,KAAK;AAAA,EACrC;AAEA,QAAM,OAAO,KAAK,MAAM,oBAAoB,uBAAuB,EAAE,IAAI;AACzE,SAAO,EAAE,MAAM,YAAY,MAAM;AACnC;AAEO,SAAS,0BAA0B;AACxC,SAAO,EAAE,MAAM,IAAI,YAAY,MAAM;AACvC;","names":[]}
|
package/dist/libs.d.cts
CHANGED
|
@@ -26,5 +26,18 @@ declare function getVideoDownloadCost({ duration, quality, ticketCode, remaining
|
|
|
26
26
|
cost: number;
|
|
27
27
|
isPlusFree: boolean;
|
|
28
28
|
};
|
|
29
|
+
type GetClipVideoDownloadCostParams = {
|
|
30
|
+
duration: number;
|
|
31
|
+
ticketCode?: TicketCode;
|
|
32
|
+
remainingFreeDownloads?: number;
|
|
33
|
+
};
|
|
34
|
+
declare function getClipVideoDownloadCost({ duration, ticketCode, remainingFreeDownloads, }: GetClipVideoDownloadCostParams): {
|
|
35
|
+
cost: number;
|
|
36
|
+
isPlusFree: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare function getRawVideoDownloadCost(): {
|
|
39
|
+
cost: number;
|
|
40
|
+
isPlusFree: boolean;
|
|
41
|
+
};
|
|
29
42
|
|
|
30
|
-
export { getVideoDownloadCost };
|
|
43
|
+
export { getClipVideoDownloadCost, getRawVideoDownloadCost, getVideoDownloadCost };
|
package/dist/libs.d.ts
CHANGED
|
@@ -26,5 +26,18 @@ declare function getVideoDownloadCost({ duration, quality, ticketCode, remaining
|
|
|
26
26
|
cost: number;
|
|
27
27
|
isPlusFree: boolean;
|
|
28
28
|
};
|
|
29
|
+
type GetClipVideoDownloadCostParams = {
|
|
30
|
+
duration: number;
|
|
31
|
+
ticketCode?: TicketCode;
|
|
32
|
+
remainingFreeDownloads?: number;
|
|
33
|
+
};
|
|
34
|
+
declare function getClipVideoDownloadCost({ duration, ticketCode, remainingFreeDownloads, }: GetClipVideoDownloadCostParams): {
|
|
35
|
+
cost: number;
|
|
36
|
+
isPlusFree: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare function getRawVideoDownloadCost(): {
|
|
39
|
+
cost: number;
|
|
40
|
+
isPlusFree: boolean;
|
|
41
|
+
};
|
|
29
42
|
|
|
30
|
-
export { getVideoDownloadCost };
|
|
43
|
+
export { getClipVideoDownloadCost, getRawVideoDownloadCost, getVideoDownloadCost };
|
package/dist/libs.js
CHANGED