This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation updateUser( | |
details: UpdateUserInput! | |
): UpdateUserResult | |
union UpdateUserResult = | |
UpdateUserSuccess | | |
FormValidationError | |
type UpdateUserSuccess {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Kafka, logLevel, KafkaConfig, SASLOptions } from "kafkajs"; | |
const options: KafkaConfig = { | |
clientId: "my-client", | |
brokers: (process.env.KAFKA_BROKERS && | |
process.env.KAFKA_BROKERS.split(",")) || ["localhost:9092"] | |
}; | |
if ( | |
process.env.KAFKA_AUTH_MECHANISM && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Kafka, Consumer, Producer, KafkaMessage } from "kafkajs"; | |
import { Logger } from "pino"; | |
import { EventEmitter } from "events"; | |
import uuidv4 from "uuid/v4"; | |
type Options = { | |
groupId: string; | |
topicPrefix: string; | |
logger: Logger; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Key { | |
constructor(identifier) | |
unlock(): Promise<void> | |
lock(): Promise()<void> | |
decrypt(value: ArrayBuffer): Promise<ArrayBuffer> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Key { | |
constructor(identifier) | |
unlock(): Promise<void> | |
lock(): Promise()<void> | |
decrypt(value: ArrayBuffer): Promise<ArrayBuffer> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From the initiating client (owner) | |
1. create a short-code (say 12 lowercase hex characters) | |
2. Using the dat archives public key, encrypt that value, let that be token | |
3. poll a DHT for token's value | |
4. Once we receive a value for that token, encrypt the archive private key with the received public key & save as a file | |
From the new client: | |
1. Ask the user to input the short-code from the same dat archive | |
2. Using the archives public-key, encrypt that value | |
3. Create a new public/private key pair |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs").promises; | |
const createReadStream = require("fs").createReadStream; | |
const debug = require("debug"); | |
class MessageLogDB { | |
constructor(filename, separator) { | |
this.separator = separator || "\r\n"; | |
this.separator_length = Buffer.byteLength(this.separator, "utf8"); | |
this.filename = filename; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs").promises; | |
const path = require("path"); | |
const execa = require("execa"); | |
const assert = require("assert"); | |
const gitUrlParse = require("git-url-parse"); | |
const fse = require("fs-extra"); | |
async function findRepos(workingDirectory) { | |
const nodes = await fs.readdir(workingDirectory, { withFileTypes: true }); | |
const directories = nodes.filter(node => node.isDirectory()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-app", | |
"version": "1.0.0", | |
"registries": { | |
"npm": { "url": "registry.npmjs.org", "default": true }, | |
"tidelift": { "url": "registry.tidelift.org" }, | |
"acme-corp": { "url": "verdaccio.acme.corp" } | |
}, | |
"dependencies": { | |
"express": "^4.0.x", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run test | |
> node-fetch@2.2.0 test /Users/emelia/Work/HighSnobiety/repos/node-fetch | |
> cross-env BABEL_ENV=test mocha --require babel-register test/test.js | |
node-fetch | |
✓ should return a promise | |
✓ should allow custom promise |