Skip to content

Commit

Permalink
Bump version and omit services (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtth authored Mar 30, 2024
1 parent dd82783 commit b3966cb
Show file tree
Hide file tree
Showing 21 changed files with 245 additions and 10,113 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,20 @@ jobs:
strategy:
matrix:
node:
- '19'
- '18'
- '17'
- '16'
- '14'
- '12'
- '11'
- '10'
- '9'
- '8'
- '7'
- '6'
name: Test using node ${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Node ${{ matrix.node }}
shell: bash -eo pipefail -l {0}
run: |
nvm install --default ${{ matrix.node }}
if [[ "${{ matrix.node }}" == 0.* ]]; then
npm config set strict-ssl false
fi
dirname "$(nvm which ${{ matrix.node }})" >> "$GITHUB_PATH"
- name: Install
run: |
npm i
node -e 'import(".").catch(() => {});' 2>/dev/null || npm i mocha@~7.1.0
node -e 'const a = {}; const b = {...a};' 2>/dev/null || npm i mocha@~3.5.3 tmp@~0.0.33
run: npm i
- name: Test
run: npm t
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ specification](https://avro.apache.org/docs/current/spec.html).
+ Blazingly [fast and compact][benchmarks] serialization! Typically faster than
JSON with much smaller encodings.
+ All the Avro goodness and more: [type inference][type-inference], [schema
evolution][schema-evolution], and [remote procedure calls][rpc].
evolution][schema-evolution]...
+ Support for [serializing arbitrary JavaScript objects][logical-types].
+ Unopinionated [64-bit integer compatibility][custom-long].

Expand All @@ -20,8 +20,6 @@ specification](https://avro.apache.org/docs/current/spec.html).
$ npm install avsc
```

`avsc` is compatible with all versions of [node.js][] since `0.11`.


## Documentation

Expand All @@ -34,8 +32,6 @@ $ npm install avsc

## Examples

Inside a node.js module, or using browserify:

```javascript
const avro = require('avsc');
```
Expand Down Expand Up @@ -85,28 +81,6 @@ const avro = require('avsc');
.on('data', function (val) { /* Do something with the decoded value. */ });
```

+ Implement a TCP server for an [IDL-defined][idl] protocol:

```javascript
// We first generate a protocol from its IDL specification.
const protocol = avro.readProtocol(`
protocol LengthService {
/** Endpoint which returns the length of the input string. */
int stringLength(string str);
}
`);
// We then create a corresponding server, implementing our endpoint.
const server = avro.Service.forProtocol(protocol)
.createServer()
.onStringLength(function (str, cb) { cb(null, str.length); });
// Finally, we use our server to respond to incoming TCP connections!
require('net').createServer()
.on('connection', (con) => { server.createChannel(con); })
.listen(24950);
```


[benchmarks]: https://github.com/mtth/avsc/wiki/Benchmarks
[browser-support]: https://github.com/mtth/avsc/wiki#browser-support
Expand All @@ -117,7 +91,6 @@ const avro = require('avsc');
[logical-types]: https://github.com/mtth/avsc/wiki/Advanced-usage#logical-types
[node.js]: https://nodejs.org/en/
[readable-stream]: https://nodejs.org/api/stream.html#stream_class_stream_readable
[rpc]: https://github.com/mtth/avsc/wiki/Quickstart#services
[schema-evolution]: https://github.com/mtth/avsc/wiki/Advanced-usage#schema-evolution
[snappy]: https://avro.apache.org/docs/current/spec.html#snappy
[type-inference]: https://github.com/mtth/avsc/wiki/Advanced-usage#type-inference
18 changes: 0 additions & 18 deletions etc/browser/avsc-protocols.js

This file was deleted.

33 changes: 0 additions & 33 deletions etc/browser/avsc-services.js

This file was deleted.

21 changes: 0 additions & 21 deletions etc/browser/avsc-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,7 @@
let types = require('../../lib/types');


/** Basic parse method, only supporting JSON parsing. */
function parse(any, opts) {
let schema;
if (typeof any == 'string') {
try {
schema = JSON.parse(any);
} catch (err) {
schema = any;
}
} else {
schema = any;
}
return types.Type.forSchema(schema, opts);
}


module.exports = {
Type: types.Type,
parse,
types: types.builtins,
// Deprecated exports (not using `util.deprecate` since it causes stack
// overflow errors in the browser).
combine: types.Type.forTypes,
infer: types.Type.forValue
};
5 changes: 1 addition & 4 deletions etc/browser/avsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* read and write blobs.
*/

let avroServices = require('./avsc-services'),
containers = require('../../lib/containers'),
let containers = require('../../lib/containers'),
utils = require('../../lib/utils'),
stream = require('stream');

Expand Down Expand Up @@ -109,5 +108,3 @@ module.exports = {
createBlobEncoder,
streams: containers.streams
};

utils.copyOwnProperties(avroServices, module.exports);
19 changes: 0 additions & 19 deletions etc/scripts/dist

This file was deleted.

2 changes: 1 addition & 1 deletion lib/containers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let types = require('./types'),
stream = require('stream');

let Buffer = buffer.Buffer;
let OPTS = {namespace: 'org.apache.avro.file'};
let OPTS = {namespace: 'org.apache.avro.file', registry: {}};

let LONG_TYPE = types.Type.forSchema('long', OPTS);

Expand Down
27 changes: 0 additions & 27 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
*/

let containers = require('./containers'),
platform = require('./platform'),
services = require('./services'),
specs = require('./specs'),
types = require('./types'),
utils = require('./utils'),
Expand All @@ -19,14 +17,6 @@ let containers = require('./containers'),

let Buffer = buffer.Buffer;

/** Parse a schema and return the corresponding type or service. */
function parse(any, opts) {
let schemaOrProtocol = specs.read(any);
return schemaOrProtocol.protocol ?
services.Service.forProtocol(schemaOrProtocol, opts) :
types.Type.forSchema(schemaOrProtocol, opts);
}

/** Extract a container file's header synchronously. */
function extractFileHeader(path, opts) {
opts = opts || {};
Expand Down Expand Up @@ -87,30 +77,13 @@ function createFileEncoder(path, schema, opts) {


module.exports = {
Service: services.Service,
Type: types.Type,
assembleProtocol: specs.assembleProtocol,
createFileDecoder,
createFileEncoder,
discoverProtocol: services.discoverProtocol,
extractFileHeader,
parse,
readProtocol: specs.readProtocol,
readSchema: specs.readSchema,
streams: containers.streams,
types: types.builtins,
// Deprecated exports.
Protocol: services.Service,
assemble: platform.deprecate(
specs.assembleProtocol,
'use `assembleProtocol` instead'
),
combine: platform.deprecate(
types.Type.forTypes,
'use `Type.forTypes` intead'
),
infer: platform.deprecate(
types.Type.forValue,
'use `Type.forValue` instead'
)
};
1 change: 0 additions & 1 deletion lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ function getHash(str, algorithm) {

module.exports = {
getHash,
deprecate: util.deprecate,
debuglog: util.debuglog
};
Loading

0 comments on commit b3966cb

Please sign in to comment.