@bernierllc/content-type-audio 1.5.0 → 2.0.0

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 CHANGED
@@ -491,6 +491,10 @@ console.log('Artist:', validation.metadata.artist);
491
491
  - [@bernierllc/content-type-video](https://www.npmjs.com/package/@bernierllc/content-type-video) - Video content type management
492
492
  - [@bernierllc/content-type-image](https://www.npmjs.com/package/@bernierllc/content-type-image) - Image content type management
493
493
 
494
+ ## Migration: zod 4 (breaking)
495
+
496
+ This release moves the package to zod 4 (`zod@^4.6.7`) to fix the zod 3.x advisory. Exported `AudioContentSchema` and `AudioContentTypeManager.getSchema()` are now zod 4 types. Consumers still on zod 3 must upgrade to zod 4 to compose these exports.
497
+
494
498
  ## License
495
499
 
496
500
  Copyright (c) 2025 Bernier LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/content-type-audio",
3
- "version": "1.5.0",
3
+ "version": "2.0.0",
4
4
  "description": "Base audio content type with file upload, local storage, and streaming URL capabilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "author": "Bernier LLC",
22
22
  "license": "SEE LICENSE IN LICENSE",
23
23
  "dependencies": {
24
- "zod": "^3.22.4",
25
- "@bernierllc/content-type-registry": "1.6.0"
24
+ "zod": "^4.6.7",
25
+ "@bernierllc/content-type-registry": "2.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/jest": "^29.5.0",
@@ -1,47 +0,0 @@
1
- import { z } from 'zod';
2
- import { ContentTypeRegistry } from '@bernierllc/content-type-registry';
3
- import { AudioContentTypeConfig, AudioMetadata, AudioContentType, AudioValidationResult, PackageResult } from './types';
4
- /**
5
- * Audio content type manager
6
- */
7
- export declare class AudioContentTypeManager {
8
- private config;
9
- constructor(config?: Partial<AudioContentTypeConfig>);
10
- /**
11
- * Register audio content type with registry
12
- */
13
- register(registry: ContentTypeRegistry): void;
14
- /**
15
- * Get Zod schema for audio content type
16
- */
17
- getSchema(): z.ZodSchema;
18
- /**
19
- * Validate audio content
20
- */
21
- validate(content: unknown): AudioValidationResult;
22
- /**
23
- * Create audio content type instance
24
- */
25
- create(metadata: AudioMetadata, options?: {
26
- filePath?: string;
27
- fileUrl?: string;
28
- streamingUrl?: string;
29
- }): AudioContentType;
30
- /**
31
- * Parse audio duration from various formats
32
- */
33
- parseDuration(duration: string | number): number;
34
- /**
35
- * Format duration to human-readable string
36
- */
37
- formatDuration(seconds: number): string;
38
- /**
39
- * Calculate bitrate from file size and duration
40
- */
41
- calculateBitrate(fileSize: number, duration: number): number;
42
- }
43
- /**
44
- * Wrapper for validation with error handling
45
- */
46
- export declare function validateAudio(manager: AudioContentTypeManager, content: unknown): PackageResult<AudioValidationResult>;
47
- //# sourceMappingURL=AudioContentTypeManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioContentTypeManager.d.ts","sourceRoot":"","sources":["../src/AudioContentTypeManager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,mBAAmB,EAGpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACd,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,MAAM,CAAyB;gBAE3B,MAAM,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAapD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAgC7C;;OAEG;IACH,SAAS,IAAI,CAAC,CAAC,SAAS;IAIxB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,qBAAqB;IAuDjD;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GACA,gBAAgB;IAsBnB;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAIhD;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIvC;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,OAAO,GACf,aAAa,CAAC,qBAAqB,CAAC,CA4BtC"}
@@ -1,196 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AudioContentTypeManager = void 0;
11
- exports.validateAudio = validateAudio;
12
- const zod_1 = require("zod");
13
- const content_type_registry_1 = require("@bernierllc/content-type-registry");
14
- const schemas_1 = require("./schemas");
15
- const types_1 = require("./types");
16
- const utils_1 = require("./utils");
17
- /**
18
- * Audio content type manager
19
- */
20
- class AudioContentTypeManager {
21
- config;
22
- constructor(config) {
23
- this.config = {
24
- baseType: 'audio',
25
- editor: 'file-upload-with-player',
26
- storage: 'file',
27
- publishing: 'streaming-url',
28
- maxFileSize: 100 * 1024 * 1024, // 100MB
29
- allowedFormats: Object.values(types_1.AudioFormat),
30
- requireMetadata: false,
31
- ...config
32
- };
33
- }
34
- /**
35
- * Register audio content type with registry
36
- */
37
- register(registry) {
38
- const definition = {
39
- id: 'audio',
40
- name: 'Audio',
41
- description: 'Base audio content type with file upload and streaming',
42
- baseType: content_type_registry_1.BaseContentType.AUDIO,
43
- icon: '🎵',
44
- schema: this.getSchema(),
45
- editor: {
46
- component: this.config.editor,
47
- settings: {
48
- maxFileSize: this.config.maxFileSize,
49
- allowedFormats: this.config.allowedFormats,
50
- requireMetadata: this.config.requireMetadata
51
- }
52
- },
53
- storage: {
54
- method: this.config.storage
55
- },
56
- publishing: {
57
- methods: [this.config.publishing],
58
- defaultMethod: this.config.publishing
59
- },
60
- metadata: {
61
- version: '1.0.0',
62
- author: 'Bernier LLC'
63
- }
64
- };
65
- registry.register(definition);
66
- }
67
- /**
68
- * Get Zod schema for audio content type
69
- */
70
- getSchema() {
71
- return schemas_1.AudioContentSchema;
72
- }
73
- /**
74
- * Validate audio content
75
- */
76
- validate(content) {
77
- try {
78
- const schema = this.getSchema();
79
- const validated = schema.parse(content);
80
- // Additional validation
81
- const errors = [];
82
- // Check file size
83
- if (this.config.maxFileSize && validated.metadata.size > this.config.maxFileSize) {
84
- errors.push(`File size ${validated.metadata.size} exceeds maximum ${this.config.maxFileSize}`);
85
- }
86
- // Check allowed formats
87
- if (this.config.allowedFormats &&
88
- !this.config.allowedFormats.includes(validated.metadata.mimeType)) {
89
- errors.push(`Audio format ${validated.metadata.mimeType} not allowed`);
90
- }
91
- // Check metadata requirements
92
- if (this.config.requireMetadata && !validated.metadata.title) {
93
- errors.push('Title is required');
94
- }
95
- if (errors.length > 0) {
96
- return {
97
- valid: false,
98
- errors,
99
- metadata: validated.metadata
100
- };
101
- }
102
- return {
103
- valid: true,
104
- metadata: validated.metadata
105
- };
106
- }
107
- catch (error) {
108
- if (error instanceof zod_1.z.ZodError) {
109
- return {
110
- valid: false,
111
- errors: error.errors.map((e) => `${e.path.join('.')}: ${e.message}`)
112
- };
113
- }
114
- return {
115
- valid: false,
116
- errors: [error instanceof Error ? error.message : 'Unknown validation error']
117
- };
118
- }
119
- }
120
- /**
121
- * Create audio content type instance
122
- */
123
- create(metadata, options) {
124
- const content = {
125
- id: (0, utils_1.generateAudioId)(),
126
- type: 'audio',
127
- metadata,
128
- createdAt: new Date(),
129
- updatedAt: new Date()
130
- };
131
- if (options?.filePath) {
132
- content.filePath = options.filePath;
133
- }
134
- if (options?.fileUrl) {
135
- content.fileUrl = options.fileUrl;
136
- }
137
- if (options?.streamingUrl) {
138
- content.streamingUrl = options.streamingUrl;
139
- }
140
- return content;
141
- }
142
- /**
143
- * Parse audio duration from various formats
144
- */
145
- parseDuration(duration) {
146
- return (0, utils_1.parseDuration)(duration);
147
- }
148
- /**
149
- * Format duration to human-readable string
150
- */
151
- formatDuration(seconds) {
152
- return (0, utils_1.formatDuration)(seconds);
153
- }
154
- /**
155
- * Calculate bitrate from file size and duration
156
- */
157
- calculateBitrate(fileSize, duration) {
158
- return (0, utils_1.calculateBitrate)(fileSize, duration);
159
- }
160
- }
161
- exports.AudioContentTypeManager = AudioContentTypeManager;
162
- /**
163
- * Wrapper for validation with error handling
164
- */
165
- function validateAudio(manager, content) {
166
- try {
167
- const result = manager.validate(content);
168
- if (result.valid) {
169
- return {
170
- success: true,
171
- data: result
172
- };
173
- }
174
- else {
175
- const errorMessage = result.errors?.join(', ');
176
- if (errorMessage) {
177
- return {
178
- success: false,
179
- data: result,
180
- error: errorMessage
181
- };
182
- }
183
- return {
184
- success: false,
185
- data: result
186
- };
187
- }
188
- }
189
- catch (error) {
190
- return {
191
- success: false,
192
- error: error instanceof Error ? error.message : 'Unknown error'
193
- };
194
- }
195
- }
196
- //# sourceMappingURL=AudioContentTypeManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioContentTypeManager.js","sourceRoot":"","sources":["../src/AudioContentTypeManager.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAwMF,sCA+BC;AArOD,6BAAwB;AACxB,6EAI2C;AAC3C,uCAA+C;AAC/C,mCAOiB;AACjB,mCAKiB;AAEjB;;GAEG;AACH,MAAa,uBAAuB;IAC1B,MAAM,CAAyB;IAEvC,YAAY,MAAwC;QAClD,IAA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AC,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,QAAgB,EAAE,QAAgB;QACjD,OAAO,IAAA,wBAAgB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;CACF;AAxKD,0DAwKC;AAED;;GAEG;AACH,SAAgB,aAAa,CAC3B,OAAgC,EAChC,OAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;YACJ,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,MAAM;aACb,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/errors.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export type AudioContentTypeErrorCode = 'AUDIO_CONTENT_TYPE_ERROR' | 'INVALID_INPUT' | 'OPERATION_FAILED';
2
- export interface AudioContentTypeErrorOptions {
3
- cause?: Error;
4
- code?: AudioContentTypeErrorCode;
5
- context?: Record<string, unknown>;
6
- }
7
- export declare class AudioContentTypeError extends Error {
8
- readonly code: AudioContentTypeErrorCode;
9
- readonly context?: Record<string, unknown>;
10
- constructor(message: string, options?: AudioContentTypeErrorOptions);
11
- }
12
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,yBAAyB,GACjC,0BAA0B,GAC1B,eAAe,GACf,kBAAkB,CAAC;AAEvB,MAAM,WAAW,4BAA4B;IAC3C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,yBAAyB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B;CASpE"}
package/dist/errors.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code only within the scope of the project it was delivered for.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AudioContentTypeError = void 0;
11
- class AudioContentTypeError extends Error {
12
- code;
13
- context;
14
- constructor(message, options) {
15
- super(message, options?.cause ? { cause: options.cause } : undefined);
16
- this.name = 'AudioContentTypeError';
17
- this.code = options?.code ?? 'AUDIO_CONTENT_TYPE_ERROR';
18
- if (options?.context !== undefined) {
19
- this.context = options.context;
20
- }
21
- Error.captureStackTrace?.(this, this.constructor);
22
- }
23
- }
24
- exports.AudioContentTypeError = AudioContentTypeError;
25
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAaF,MAAa,qBAAsB,SAAQ,KAAK;IACrC,IAAI,CAA4B;IAChC,OAAO,CAA2B;IAE3C,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,0BAA0B,CAAC;QACxD,IAAI,OAAO,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;CACF;AAbD,sDAaC"}
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export { AudioFormat, type AudioMetadata, type AudioContentTypeConfig, type AudioContentType, type AudioValidationResult, type PackageResult } from './types';
2
- export { AudioContentSchema, type AudioContent } from './schemas';
3
- export { parseDuration, formatDuration, calculateBitrate, generateAudioId } from './utils';
4
- export { AudioContentTypeManager, validateAudio } from './AudioContentTypeManager';
5
- export { AudioContentTypeError, type AudioContentTypeErrorCode, type AudioContentTypeErrorOptions } from './errors';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlE,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAGnF,OAAO,EACL,qBAAqB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,UAAU,CAAC"}
package/dist/index.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AudioContentTypeError = exports.validateAudio = exports.AudioContentTypeManager = exports.generateAudioId = exports.calculateBitrate = exports.formatDuration = exports.parseDuration = exports.AudioContentSchema = exports.AudioFormat = void 0;
11
- // Export types
12
- var types_1 = require("./types");
13
- Object.defineProperty(exports, "AudioFormat", { enumerable: true, get: function () { return types_1.AudioFormat; } });
14
- // Export schemas
15
- var schemas_1 = require("./schemas");
16
- Object.defineProperty(exports, "AudioContentSchema", { enumerable: true, get: function () { return schemas_1.AudioContentSchema; } });
17
- // Export utilities
18
- var utils_1 = require("./utils");
19
- Object.defineProperty(exports, "parseDuration", { enumerable: true, get: function () { return utils_1.parseDuration; } });
20
- Object.defineProperty(exports, "formatDuration", { enumerable: true, get: function () { return utils_1.formatDuration; } });
21
- Object.defineProperty(exports, "calculateBitrate", { enumerable: true, get: function () { return utils_1.calculateBitrate; } });
22
- Object.defineProperty(exports, "generateAudioId", { enumerable: true, get: function () { return utils_1.generateAudioId; } });
23
- // Export manager
24
- var AudioContentTypeManager_1 = require("./AudioContentTypeManager");
25
- Object.defineProperty(exports, "AudioContentTypeManager", { enumerable: true, get: function () { return AudioContentTypeManager_1.AudioContentTypeManager; } });
26
- Object.defineProperty(exports, "validateAudio", { enumerable: true, get: function () { return AudioContentTypeManager_1.validateAudio; } });
27
- // Export errors
28
- var errors_1 = require("./errors");
29
- Object.defineProperty(exports, "AudioContentTypeError", { enumerable: true, get: function () { return errors_1.AudioContentTypeError; } });
30
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF,eAAe;AACf,iCAOiB;AANf,oGAAA,WAAW,OAAA;AAQb,iBAAiB;AACjB,qCAAkE;AAAzD,6GAAA,kBAAkB,OAAA;AAE3B,mBAAmB;AACnB,iCAKiB;AAJf,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AAGjB,iBAAiB;AACjB,qEAAmF;AAA1E,kIAAA,uBAAuB,OAAA;AAAE,wHAAA,aAAa,OAAA;AAE/C,gBAAgB;AAChB,mCAIkB;AAHhB,+GAAA,qBAAqB,OAAA"}
package/dist/schemas.d.ts DELETED
@@ -1,103 +0,0 @@
1
- import { z } from 'zod';
2
- import { AudioFormat } from './types';
3
- /**
4
- * Zod schema for audio content type validation
5
- */
6
- export declare const AudioContentSchema: z.ZodObject<{
7
- id: z.ZodString;
8
- type: z.ZodLiteral<"audio">;
9
- metadata: z.ZodObject<{
10
- filename: z.ZodString;
11
- mimeType: z.ZodNativeEnum<typeof AudioFormat>;
12
- size: z.ZodNumber;
13
- duration: z.ZodNumber;
14
- bitrate: z.ZodNumber;
15
- sampleRate: z.ZodOptional<z.ZodNumber>;
16
- channels: z.ZodOptional<z.ZodNumber>;
17
- title: z.ZodOptional<z.ZodString>;
18
- artist: z.ZodOptional<z.ZodString>;
19
- album: z.ZodOptional<z.ZodString>;
20
- year: z.ZodOptional<z.ZodNumber>;
21
- coverArt: z.ZodOptional<z.ZodString>;
22
- }, "strip", z.ZodTypeAny, {
23
- filename: string;
24
- mimeType: AudioFormat;
25
- size: number;
26
- duration: number;
27
- bitrate: number;
28
- sampleRate?: number | undefined;
29
- channels?: number | undefined;
30
- title?: string | undefined;
31
- artist?: string | undefined;
32
- album?: string | undefined;
33
- year?: number | undefined;
34
- coverArt?: string | undefined;
35
- }, {
36
- filename: string;
37
- mimeType: AudioFormat;
38
- size: number;
39
- duration: number;
40
- bitrate: number;
41
- sampleRate?: number | undefined;
42
- channels?: number | undefined;
43
- title?: string | undefined;
44
- artist?: string | undefined;
45
- album?: string | undefined;
46
- year?: number | undefined;
47
- coverArt?: string | undefined;
48
- }>;
49
- filePath: z.ZodOptional<z.ZodString>;
50
- fileUrl: z.ZodOptional<z.ZodString>;
51
- streamingUrl: z.ZodOptional<z.ZodString>;
52
- createdAt: z.ZodDate;
53
- updatedAt: z.ZodDate;
54
- }, "strip", z.ZodTypeAny, {
55
- id: string;
56
- type: "audio";
57
- metadata: {
58
- filename: string;
59
- mimeType: AudioFormat;
60
- size: number;
61
- duration: number;
62
- bitrate: number;
63
- sampleRate?: number | undefined;
64
- channels?: number | undefined;
65
- title?: string | undefined;
66
- artist?: string | undefined;
67
- album?: string | undefined;
68
- year?: number | undefined;
69
- coverArt?: string | undefined;
70
- };
71
- createdAt: Date;
72
- updatedAt: Date;
73
- filePath?: string | undefined;
74
- fileUrl?: string | undefined;
75
- streamingUrl?: string | undefined;
76
- }, {
77
- id: string;
78
- type: "audio";
79
- metadata: {
80
- filename: string;
81
- mimeType: AudioFormat;
82
- size: number;
83
- duration: number;
84
- bitrate: number;
85
- sampleRate?: number | undefined;
86
- channels?: number | undefined;
87
- title?: string | undefined;
88
- artist?: string | undefined;
89
- album?: string | undefined;
90
- year?: number | undefined;
91
- coverArt?: string | undefined;
92
- };
93
- createdAt: Date;
94
- updatedAt: Date;
95
- filePath?: string | undefined;
96
- fileUrl?: string | undefined;
97
- streamingUrl?: string | undefined;
98
- }>;
99
- /**
100
- * Type inferred from schema
101
- */
102
- export type AudioContent = z.infer<typeof AudioContentSchema>;
103
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB7B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/dist/schemas.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AudioContentSchema = void 0;
11
- const zod_1 = require("zod");
12
- const types_1 = require("./types");
13
- /**
14
- * Zod schema for audio content type validation
15
- */
16
- exports.AudioContentSchema = zod_1.z.object({
17
- id: zod_1.z.string(),
18
- type: zod_1.z.literal('audio'),
19
- metadata: zod_1.z.object({
20
- filename: zod_1.z.string(),
21
- mimeType: zod_1.z.nativeEnum(types_1.AudioFormat),
22
- size: zod_1.z.number().positive(),
23
- duration: zod_1.z.number().nonnegative(),
24
- bitrate: zod_1.z.number().positive(),
25
- sampleRate: zod_1.z.number().positive().optional(),
26
- channels: zod_1.z.number().int().min(1).max(8).optional(),
27
- title: zod_1.z.string().optional(),
28
- artist: zod_1.z.string().optional(),
29
- album: zod_1.z.string().optional(),
30
- year: zod_1.z.number().int().min(1900).max(2100).optional(),
31
- coverArt: zod_1.z.string().optional()
32
- }),
33
- filePath: zod_1.z.string().optional(),
34
- fileUrl: zod_1.z.string().url().optional(),
35
- streamingUrl: zod_1.z.string().url().optional(),
36
- createdAt: zod_1.z.date(),
37
- updatedAt: zod_1.z.date()
38
- });
39
- //# sourceMappingURL=schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF,6BAAwB;AACxB,mCAAsC;AAEtC;;GAEG;AACU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;QACjB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,OAAC,CAAC,UAAU,CAAC,mBAAW,CAAC;QACnC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE;QAClC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC5C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrD,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAChC,CAAC;IACF,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACzC,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE;IACnB,SAAS,EAAE,OAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,70 +0,0 @@
1
- /**
2
- * Audio format enumeration
3
- */
4
- export declare enum AudioFormat {
5
- MP3 = "audio/mpeg",
6
- WAV = "audio/wav",
7
- AAC = "audio/aac",
8
- OGG = "audio/ogg",
9
- FLAC = "audio/flac",
10
- M4A = "audio/mp4"
11
- }
12
- /**
13
- * Audio metadata interface
14
- */
15
- export interface AudioMetadata {
16
- filename: string;
17
- mimeType: AudioFormat;
18
- size: number;
19
- duration: number;
20
- bitrate: number;
21
- sampleRate?: number;
22
- channels?: number;
23
- title?: string;
24
- artist?: string;
25
- album?: string;
26
- year?: number;
27
- coverArt?: string;
28
- }
29
- /**
30
- * Audio content type configuration
31
- */
32
- export interface AudioContentTypeConfig {
33
- baseType: 'audio';
34
- editor: 'file-upload-with-player';
35
- storage: 'file' | 'cloud' | 'custom';
36
- publishing: 'streaming-url' | 'download' | 'custom';
37
- maxFileSize?: number;
38
- allowedFormats?: AudioFormat[];
39
- requireMetadata?: boolean;
40
- }
41
- /**
42
- * Audio content type interface
43
- */
44
- export interface AudioContentType {
45
- id: string;
46
- type: 'audio';
47
- metadata: AudioMetadata;
48
- filePath?: string;
49
- fileUrl?: string;
50
- streamingUrl?: string;
51
- createdAt: Date;
52
- updatedAt: Date;
53
- }
54
- /**
55
- * Audio validation result
56
- */
57
- export interface AudioValidationResult {
58
- valid: boolean;
59
- errors?: string[];
60
- metadata?: Partial<AudioMetadata>;
61
- }
62
- /**
63
- * Package result interface for error handling
64
- */
65
- export interface PackageResult<T = unknown> {
66
- success: boolean;
67
- data?: T;
68
- error?: string;
69
- }
70
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,oBAAY,WAAW;IACrB,GAAG,eAAe;IAClB,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,GAAG,cAAc;IACjB,IAAI,eAAe;IACnB,GAAG,cAAc;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,yBAAyB,CAAC;IAClC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrC,UAAU,EAAE,eAAe,GAAG,UAAU,GAAG,QAAQ,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
package/dist/types.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AudioFormat = void 0;
11
- /**
12
- * Audio format enumeration
13
- */
14
- var AudioFormat;
15
- (function (AudioFormat) {
16
- AudioFormat["MP3"] = "audio/mpeg";
17
- AudioFormat["WAV"] = "audio/wav";
18
- AudioFormat["AAC"] = "audio/aac";
19
- AudioFormat["OGG"] = "audio/ogg";
20
- AudioFormat["FLAC"] = "audio/flac";
21
- AudioFormat["M4A"] = "audio/mp4";
22
- })(AudioFormat || (exports.AudioFormat = AudioFormat = {}));
23
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;;AAEF;;GAEG;AACH,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,iCAAkB,CAAA;IAClB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AACnB,CAAC,EAPW,WAAW,2BAAX,WAAW,QAOtB"}
package/dist/utils.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * Parse audio duration from various formats
3
- * @param duration - Duration as string ("1:23:45", "23:45", "123") or number
4
- * @returns Duration in seconds
5
- */
6
- export declare function parseDuration(duration: string | number): number;
7
- /**
8
- * Format duration to human-readable string
9
- * @param seconds - Duration in seconds
10
- * @returns Formatted string (e.g., "1:23:45" or "23:45")
11
- */
12
- export declare function formatDuration(seconds: number): string;
13
- /**
14
- * Calculate bitrate from file size and duration
15
- * @param fileSize - File size in bytes
16
- * @param duration - Duration in seconds
17
- * @returns Bitrate in kbps
18
- */
19
- export declare function calculateBitrate(fileSize: number, duration: number): number;
20
- /**
21
- * Generate unique ID for audio content
22
- * @returns Unique identifier
23
- */
24
- export declare function generateAudioId(): string;
25
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CA8B/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAStD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI3E;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
package/dist/utils.js DELETED
@@ -1,81 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (c) 2025 Bernier LLC
4
-
5
- This file is licensed to the client under a limited-use license.
6
- The client may use and modify this code *only within the scope of the project it was delivered for*.
7
- Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.parseDuration = parseDuration;
11
- exports.formatDuration = formatDuration;
12
- exports.calculateBitrate = calculateBitrate;
13
- exports.generateAudioId = generateAudioId;
14
- /**
15
- * Parse audio duration from various formats
16
- * @param duration - Duration as string ("1:23:45", "23:45", "123") or number
17
- * @returns Duration in seconds
18
- */
19
- function parseDuration(duration) {
20
- if (typeof duration === 'number') {
21
- return duration;
22
- }
23
- // Parse formats: "1:23:45", "23:45", "123"
24
- const parts = duration.split(':').map(Number);
25
- // Check if all parts are valid numbers
26
- if (parts.some(part => isNaN(part))) {
27
- return 0;
28
- }
29
- if (parts.length === 1) {
30
- const part = parts[0];
31
- return part !== undefined ? part : 0; // seconds
32
- }
33
- else if (parts.length === 2) {
34
- const part0 = parts[0];
35
- const part1 = parts[1];
36
- return (part0 !== undefined && part1 !== undefined) ? part0 * 60 + part1 : 0; // mm:ss
37
- }
38
- else if (parts.length === 3) {
39
- const part0 = parts[0];
40
- const part1 = parts[1];
41
- const part2 = parts[2];
42
- return (part0 !== undefined && part1 !== undefined && part2 !== undefined)
43
- ? part0 * 3600 + part1 * 60 + part2
44
- : 0; // hh:mm:ss
45
- }
46
- return 0;
47
- }
48
- /**
49
- * Format duration to human-readable string
50
- * @param seconds - Duration in seconds
51
- * @returns Formatted string (e.g., "1:23:45" or "23:45")
52
- */
53
- function formatDuration(seconds) {
54
- const hours = Math.floor(seconds / 3600);
55
- const minutes = Math.floor((seconds % 3600) / 60);
56
- const secs = Math.floor(seconds % 60);
57
- if (hours > 0) {
58
- return `${hours}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
59
- }
60
- return `${minutes}:${String(secs).padStart(2, '0')}`;
61
- }
62
- /**
63
- * Calculate bitrate from file size and duration
64
- * @param fileSize - File size in bytes
65
- * @param duration - Duration in seconds
66
- * @returns Bitrate in kbps
67
- */
68
- function calculateBitrate(fileSize, duration) {
69
- if (duration === 0)
70
- return 0;
71
- // (fileSize in bytes * 8 bits/byte) / (duration in seconds) / 1000 = kbps
72
- return Math.round((fileSize * 8) / duration / 1000);
73
- }
74
- /**
75
- * Generate unique ID for audio content
76
- * @returns Unique identifier
77
- */
78
- function generateAudioId() {
79
- return `audio_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
80
- }
81
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;EAME;;AAOF,sCA8BC;AAOD,wCASC;AAQD,4CAIC;AAMD,0CAEC;AAvED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAyB;IACrD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,2CAA2C;IAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE9C,uCAAuC;IACvC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAA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