@synet/encoder 1.0.0 → 1.0.1

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.
@@ -85,10 +85,8 @@ export interface ValidationResult {
85
85
  readonly suggestions: string[];
86
86
  }
87
87
  /**
88
- * Encoder Implementation
88
+ * Encoder Unit Implementation
89
89
  *
90
- * Doctrine #1: ZERO DEPENDENCY (only Node.js/browser native APIs)
91
- * Doctrine #17: VALUE OBJECT FOUNDATION (immutable with identity and capabilities)
92
90
  */
93
91
  export declare class Encoder extends Unit<EncoderProps> {
94
92
  protected constructor(props: EncoderProps);
@@ -24,10 +24,8 @@ exports.Encoder = void 0;
24
24
  const unit_1 = require("@synet/unit");
25
25
  const result_js_1 = require("./result.js");
26
26
  /**
27
- * Encoder Implementation
27
+ * Encoder Unit Implementation
28
28
  *
29
- * Doctrine #1: ZERO DEPENDENCY (only Node.js/browser native APIs)
30
- * Doctrine #17: VALUE OBJECT FOUNDATION (immutable with identity and capabilities)
31
29
  */
32
30
  class Encoder extends unit_1.Unit {
33
31
  // Doctrine #4: CREATE NOT CONSTRUCT (protected constructor)
@@ -114,20 +112,16 @@ I TEACH:
114
112
 
115
113
  `);
116
114
  }
117
- // Doctrine #2: TEACH/LEARN PARADIGM (every unit must teach)
118
- // Doctrine #9: ALWAYS TEACH (explicit capability binding)
119
- // Doctrine #19: CAPABILITY LEAKAGE PREVENTION (teach only native capabilities)
120
115
  teach() {
121
116
  return {
122
- // Doctrine #12: NAMESPACE EVERYTHING (unitId for namespacing)
123
117
  unitId: this.dna.id,
124
118
  capabilities: {
125
119
  // Native encoding capabilities only - wrapped for unknown[] compatibility
126
- encode: ((...args) => this.encode(args[0], args[1])),
127
- decode: ((...args) => this.decode(args[0], args[1])),
128
- detect: ((...args) => this.detect(args[0])),
129
- validate: ((...args) => this.validate(args[0], args[1])),
130
- chain: ((...args) => this.chain(args[0], args[1])),
120
+ encode: (...args) => this.encode(args[0], args[1]),
121
+ decode: (...args) => this.decode(args[0], args[1]),
122
+ detect: (...args) => this.detect(args[0]),
123
+ validate: (...args) => this.validate(args[0], args[1]),
124
+ chain: (...args) => this.chain(args[0], args[1]),
131
125
  // Metadata access
132
126
  getDefaultFormat: (() => this.props.defaultFormat),
133
127
  isStrictMode: (() => this.props.strictMode),
@@ -135,7 +129,6 @@ I TEACH:
135
129
  }
136
130
  };
137
131
  }
138
- // Doctrine #14: ERROR BOUNDARY CLARITY (Result for complex operations)
139
132
  /**
140
133
  * Encode data to specified format (Result - complex validation operation)
141
134
  */
@@ -268,7 +261,6 @@ I TEACH:
268
261
  return result_js_1.Result.fail(`Reverse chain failed: ${error instanceof Error ? error.message : String(error)}`, error);
269
262
  }
270
263
  }
271
- // Doctrine #14: ERROR BOUNDARY CLARITY (throws for simple operations)
272
264
  /**
273
265
  * Auto-detect encoding format (throw on error - simple classification operation)
274
266
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synet/encoder",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Unit Architecture compliant encoding/decoding operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -96,10 +96,8 @@ export interface ValidationResult {
96
96
  }
97
97
 
98
98
  /**
99
- * Encoder Implementation
99
+ * Encoder Unit Implementation
100
100
  *
101
- * Doctrine #1: ZERO DEPENDENCY (only Node.js/browser native APIs)
102
- * Doctrine #17: VALUE OBJECT FOUNDATION (immutable with identity and capabilities)
103
101
  */
104
102
  export class Encoder extends Unit<EncoderProps> {
105
103
 
@@ -191,21 +189,18 @@ I TEACH:
191
189
  `);
192
190
  }
193
191
 
194
- // Doctrine #2: TEACH/LEARN PARADIGM (every unit must teach)
195
- // Doctrine #9: ALWAYS TEACH (explicit capability binding)
196
- // Doctrine #19: CAPABILITY LEAKAGE PREVENTION (teach only native capabilities)
197
- teach(): TeachingContract {
192
+ teach(): TeachingContract {
198
193
  return {
199
- // Doctrine #12: NAMESPACE EVERYTHING (unitId for namespacing)
194
+
200
195
  unitId: this.dna.id,
201
196
  capabilities: {
202
197
  // Native encoding capabilities only - wrapped for unknown[] compatibility
203
- encode: ((...args: unknown[]) => this.encode(args[0] as string, args[1] as EncodingFormat)) as (...args: unknown[]) => unknown,
204
- decode: ((...args: unknown[]) => this.decode(args[0] as string, args[1] as EncodingFormat)) as (...args: unknown[]) => unknown,
205
- detect: ((...args: unknown[]) => this.detect(args[0] as string)) as (...args: unknown[]) => unknown,
206
- validate: ((...args: unknown[]) => this.validate(args[0] as string, args[1] as EncodingFormat)) as (...args: unknown[]) => unknown,
207
- chain: ((...args: unknown[]) => this.chain(args[0] as string, args[1] as EncodingFormat[])) as (...args: unknown[]) => unknown,
208
-
198
+ encode: (...args: unknown[]) => this.encode(args[0] as string, args[1] as EncodingFormat),
199
+ decode: (...args: unknown[]) => this.decode(args[0] as string, args[1] as EncodingFormat),
200
+ detect: (...args: unknown[]) => this.detect(args[0] as string),
201
+ validate: (...args: unknown[]) => this.validate(args[0] as string, args[1] as EncodingFormat),
202
+ chain: (...args: unknown[]) => this.chain(args[0] as string, args[1] as EncodingFormat[]),
203
+
209
204
  // Metadata access
210
205
  getDefaultFormat: (() => this.props.defaultFormat) as (...args: unknown[]) => unknown,
211
206
  isStrictMode: (() => this.props.strictMode) as (...args: unknown[]) => unknown,
@@ -213,9 +208,6 @@ I TEACH:
213
208
  }
214
209
  };
215
210
  }
216
-
217
- // Doctrine #14: ERROR BOUNDARY CLARITY (Result for complex operations)
218
-
219
211
  /**
220
212
  * Encode data to specified format (Result - complex validation operation)
221
213
  */
@@ -377,8 +369,6 @@ I TEACH:
377
369
  }
378
370
  }
379
371
 
380
- // Doctrine #14: ERROR BOUNDARY CLARITY (throws for simple operations)
381
-
382
372
  /**
383
373
  * Auto-detect encoding format (throw on error - simple classification operation)
384
374
  */