joist-orm 2.3.0-next.7 → 2.3.0-next.71
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/build/_virtual/_rolldown/runtime.cjs +23 -0
- package/build/_virtual/_rolldown/runtime.js +5 -0
- package/build/codegen.cjs +19 -0
- package/build/codegen.cjs.map +1 -0
- package/build/codegen.d.cts +1 -0
- package/build/codegen.d.mts +1 -0
- package/build/codegen.js +12 -28
- package/build/codegen.js.map +1 -1
- package/build/drivers/PostgresDriver.cjs +299 -0
- package/build/drivers/PostgresDriver.cjs.map +1 -0
- package/build/drivers/PostgresDriver.d.cts +81 -0
- package/build/drivers/PostgresDriver.d.cts.map +1 -0
- package/build/drivers/PostgresDriver.d.mts +81 -0
- package/build/drivers/PostgresDriver.d.mts.map +1 -0
- package/build/drivers/PostgresDriver.js +262 -274
- package/build/drivers/PostgresDriver.js.map +1 -1
- package/build/drivers/WireRowData.cjs +374 -0
- package/build/drivers/WireRowData.cjs.map +1 -0
- package/build/drivers/WireRowData.d.cts +111 -0
- package/build/drivers/WireRowData.d.cts.map +1 -0
- package/build/drivers/WireRowData.d.mts +111 -0
- package/build/drivers/WireRowData.d.mts.map +1 -0
- package/build/drivers/WireRowData.js +370 -0
- package/build/drivers/WireRowData.js.map +1 -0
- package/build/drivers/binaryParsers.cjs +422 -0
- package/build/drivers/binaryParsers.cjs.map +1 -0
- package/build/drivers/binaryParsers.d.cts +80 -0
- package/build/drivers/binaryParsers.d.cts.map +1 -0
- package/build/drivers/binaryParsers.d.mts +80 -0
- package/build/drivers/binaryParsers.d.mts.map +1 -0
- package/build/drivers/binaryParsers.js +412 -0
- package/build/drivers/binaryParsers.js.map +1 -0
- package/build/drivers/patchPgProtocol.cjs +255 -0
- package/build/drivers/patchPgProtocol.cjs.map +1 -0
- package/build/drivers/patchPgProtocol.d.cts +47 -0
- package/build/drivers/patchPgProtocol.d.cts.map +1 -0
- package/build/drivers/patchPgProtocol.d.mts +47 -0
- package/build/drivers/patchPgProtocol.d.mts.map +1 -0
- package/build/drivers/patchPgProtocol.js +253 -0
- package/build/drivers/patchPgProtocol.js.map +1 -0
- package/build/graphql-codegen-export.cjs +10 -0
- package/build/graphql-codegen-export.d.cts +1 -0
- package/build/graphql-codegen-export.d.mts +1 -0
- package/build/graphql-codegen-export.js +2 -19
- package/build/graphql-export.cjs +10 -0
- package/build/graphql-export.d.cts +1 -0
- package/build/graphql-export.d.mts +1 -0
- package/build/graphql-export.js +2 -19
- package/build/index.cjs +41 -0
- package/build/index.d.cts +3 -0
- package/build/index.d.mts +3 -0
- package/build/index.js +3 -27
- package/build/knex-export.cjs +10 -0
- package/build/knex-export.d.cts +1 -0
- package/build/knex-export.d.mts +1 -0
- package/build/knex-export.js +2 -19
- package/build/pg-export.cjs +13 -0
- package/build/pg-export.d.cts +4 -0
- package/build/pg-export.d.mts +4 -0
- package/build/pg-export.js +4 -9
- package/build/pg-migrate.cjs +22 -0
- package/build/pg-migrate.cjs.map +1 -0
- package/build/pg-migrate.d.cts +1 -0
- package/build/pg-migrate.d.mts +1 -0
- package/build/pg-migrate.js +14 -28
- package/build/pg-migrate.js.map +1 -1
- package/build/seed.cjs +49 -0
- package/build/seed.cjs.map +1 -0
- package/build/{seed.d.ts → seed.d.cts} +5 -2
- package/build/seed.d.cts.map +1 -0
- package/build/seed.d.mts +24 -0
- package/build/seed.d.mts.map +1 -0
- package/build/seed.js +39 -45
- package/build/seed.js.map +1 -1
- package/build/tests-export.cjs +10 -0
- package/build/tests-export.d.cts +1 -0
- package/build/tests-export.d.mts +1 -0
- package/build/tests-export.js +2 -19
- package/package.json +154 -38
- package/build/codegen.d.ts +0 -2
- package/build/codegen.d.ts.map +0 -1
- package/build/drivers/PostgresDriver.d.ts +0 -49
- package/build/drivers/PostgresDriver.d.ts.map +0 -1
- package/build/graphql-codegen-export.d.ts +0 -2
- package/build/graphql-codegen-export.d.ts.map +0 -1
- package/build/graphql-codegen-export.js.map +0 -1
- package/build/graphql-export.d.ts +0 -2
- package/build/graphql-export.d.ts.map +0 -1
- package/build/graphql-export.js.map +0 -1
- package/build/index.d.ts +0 -4
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/build/knex-export.d.ts +0 -2
- package/build/knex-export.d.ts.map +0 -1
- package/build/knex-export.js.map +0 -1
- package/build/pg-export.d.ts +0 -3
- package/build/pg-export.d.ts.map +0 -1
- package/build/pg-export.js.map +0 -1
- package/build/pg-migrate.d.ts +0 -2
- package/build/pg-migrate.d.ts.map +0 -1
- package/build/seed.d.ts.map +0 -1
- package/build/tests-export.d.ts +0 -2
- package/build/tests-export.d.ts.map +0 -1
- package/build/tests-export.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patchPgProtocol.js","names":["#fields"],"sources":["../../src/drivers/patchPgProtocol.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\nconst runtimeRequire = createRequire(import.meta.url);\n\n/**\n * Patches pg-protocol at runtime so that DataRow messages are lazy *and* their bytes are\n * immutable, i.e. so `WireRowData` can retain raw row payloads by reference — no per-cell\n * strings, no per-row copies, no arena.\n *\n * We patch at runtime (instead of shipping a patched pg-protocol) so that installing joist-orm\n * requires no package-manager patch steps; see JS-ROW-STORE-DESIGN.md \"Distribution\". Two\n * prototype methods are replaced, porting brianc/node-postgres#3719 (which may or may not ever\n * land upstream — this patch is how we run its design in production regardless):\n *\n * - `handlePacket` (stable across pg-protocol 1.10-1.15) returns a {@link LazyDataRowMessage}\n * for DataRow packets and delegates every other message type to the original.\n * - `parse` replaces the recycled-scratch buffer management: each socket chunk is parsed *in\n * place*, and only the one message per chunk that straddles a read boundary is reassembled\n * into a buffer of its own, which is handed to that message and never touched again. Every\n * message therefore stays valid for as long as it is held (holding one pins the ~64 KiB chunk\n * it came from) — versus stock pg-protocol, which copies whole chunks into a scratch buffer\n * and compacts it in place over the bytes earlier messages point into.\n *\n * The patch verifies itself by round-tripping synthetic DataRows through a fresh `Parser` —\n * including a message that straddles chunks, retained across later reads that would clobber it\n * under the stock buffer management. On any mismatch (i.e. a future pg-protocol internals\n * rewrite), it un-patches and reports failure so the driver can fall back to classic rows.\n *\n * The lazy message's memoized `fields` getter decodes identically to the original for classic\n * consumers, i.e. pg's own `Result.parseRow(msg.fields)`.\n */\nexport function ensureLazyDataRows(): boolean {\n patched ??= tryPatch() ? \"applied\" : \"failed\";\n return patched === \"applied\";\n}\n\n/** A drop-in `DataRowMessage` that defers cell decoding; lazy consumers read `bytes`/`offset`. */\nexport class LazyDataRowMessage {\n public readonly name = \"dataRow\";\n public readonly fieldCount: number;\n #fields: (string | null)[] | undefined = undefined;\n\n constructor(\n public readonly length: number,\n /** The row's payload bytes; immutable under our `parse` patch, so safe to retain. */\n public readonly bytes: Buffer,\n public readonly offset: number,\n ) {\n this.fieldCount = bytes.readInt16BE(offset);\n }\n\n /** Lazily materializes the per-cell strings for classic consumers, i.e. pg's `Result.parseRow`. */\n get fields(): (string | null)[] {\n let fields = this.#fields;\n if (fields === undefined) {\n const { bytes, fieldCount } = this;\n fields = new Array(fieldCount);\n let pos = this.offset + 2;\n for (let i = 0; i < fieldCount; i++) {\n const len = bytes.readInt32BE(pos);\n pos += 4;\n if (len === -1) {\n fields[i] = null;\n } else {\n fields[i] = bytes.toString(\"utf8\", pos, pos + len);\n pos += len;\n }\n }\n this.#fields = fields;\n }\n return fields;\n }\n}\n\nlet patched: \"applied\" | \"failed\" | undefined;\n\n/** The 'D' message-type byte identifying a DataRow packet. */\nconst DATA_ROW_CODE = 68;\nconst CODE_LENGTH = 1;\nconst HEADER_LENGTH = 5;\n/** Cap on up-front allocation for a straddling message's claimed length, i.e. corrupt streams. */\nconst MAX_EAGER_MESSAGE_LENGTH = 1024 * 1024;\nconst emptyBuffer = Buffer.allocUnsafe(0);\n\n/** Resolves pg's own pg-protocol Parser class and swaps in the lazy/immutable DataRow handling. */\nfunction tryPatch(): boolean {\n try {\n const { Parser, version } = resolvePgProtocol();\n // Only patch the protocol major we've verified `handlePacket`'s shape against (1.10-1.15);\n // anything else fails closed (the driver then uses classic rows) until explicitly vetted\n if (!version.startsWith(\"1.\")) return false;\n const originalHandlePacket = Parser.prototype.handlePacket;\n const originalParse = Parser.prototype.parse;\n if (typeof originalHandlePacket !== \"function\" || typeof originalParse !== \"function\") return false;\n Parser.prototype.handlePacket = function (offset: number, code: number, length: number, bytes: Buffer) {\n if (code === DATA_ROW_CODE) return new LazyDataRowMessage(length, bytes, offset);\n return originalHandlePacket.call(this, offset, code, length, bytes);\n };\n Parser.prototype.parse = patchedParse;\n if (!verifyLazyDataRows(Parser) || !verifyImmutableBytes(Parser)) {\n Parser.prototype.handlePacket = originalHandlePacket;\n Parser.prototype.parse = originalParse;\n return false;\n }\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The ported #3719 `parse`: chunks are parsed in place, and only the message that straddles a\n * read boundary is reassembled into its own buffer (see `completePartial`). Partial state lives\n * on the parser instance under `_joist`-prefixed keys, so the stock fields are simply unused.\n */\nfunction patchedParse(this: any, chunk: Buffer, callback: (msg: any) => void): void {\n const chunkLength = chunk.byteLength;\n // finish the message the previous chunk cut in half, if any, before parsing this one\n let offset = this._joistPartialLength > 0 ? completePartial(this, chunk, callback) : 0;\n while (offset + HEADER_LENGTH <= chunkLength) {\n const code = chunk[offset];\n const length = chunk.readUInt32BE(offset + CODE_LENGTH);\n const fullMessageLength = CODE_LENGTH + length;\n if (fullMessageLength + offset <= chunkLength) {\n const message = this.handlePacket(offset + HEADER_LENGTH, code, length, chunk);\n callback(message);\n offset += fullMessageLength;\n } else {\n break;\n }\n }\n if (offset < chunkLength) {\n startPartial(this, chunk, offset);\n }\n}\n\n/** Copies the trailing bytes of `chunk` that do not yet form a whole message into their own buffer. */\nfunction startPartial(parser: any, chunk: Buffer, offset: number): void {\n const remaining = chunk.byteLength - offset;\n parser._joistPartial = emptyBuffer;\n parser._joistPartialLength = 0;\n // the length is only known once the header is complete\n parser._joistPartialTotal = remaining >= HEADER_LENGTH ? CODE_LENGTH + chunk.readUInt32BE(offset + CODE_LENGTH) : -1;\n growPartial(parser, remaining);\n chunk.copy(parser._joistPartial, 0, offset);\n parser._joistPartialLength = remaining;\n}\n\n/**\n * Fills the straddling message from the head of `chunk` and emits it once whole, returning the\n * offset in `chunk` where parsing continues. The buffer is handed to the message and forgotten,\n * so nothing is ever parsed twice out of the same bytes and the message stays valid when held.\n */\nfunction completePartial(parser: any, chunk: Buffer, callback: (msg: any) => void): number {\n let consumed = 0;\n if (parser._joistPartialTotal === -1) {\n // the header itself was split, so complete it before its length can be read\n consumed = Math.min(HEADER_LENGTH - parser._joistPartialLength, chunk.byteLength);\n chunk.copy(parser._joistPartial, parser._joistPartialLength, 0, consumed);\n parser._joistPartialLength += consumed;\n if (parser._joistPartialLength < HEADER_LENGTH) return consumed;\n parser._joistPartialTotal = CODE_LENGTH + parser._joistPartial.readUInt32BE(CODE_LENGTH);\n }\n if (parser._joistPartialLength < parser._joistPartialTotal) {\n const available = Math.min(parser._joistPartialTotal - parser._joistPartialLength, chunk.byteLength - consumed);\n growPartial(parser, parser._joistPartialLength + available);\n chunk.copy(parser._joistPartial, parser._joistPartialLength, consumed, consumed + available);\n parser._joistPartialLength += available;\n consumed += available;\n if (parser._joistPartialLength < parser._joistPartialTotal) return consumed;\n }\n const partial = parser._joistPartial;\n parser._joistPartial = emptyBuffer;\n parser._joistPartialLength = 0;\n parser._joistPartialTotal = -1;\n const message = parser.handlePacket(HEADER_LENGTH, partial[0], partial.readUInt32BE(CODE_LENGTH), partial);\n callback(message);\n return consumed;\n}\n\n/** Sizes the partial buffer to hold at least `needed` bytes, i.e. the whole message when known. */\nfunction growPartial(parser: any, needed: number): void {\n if (needed <= parser._joistPartial.byteLength) return;\n const total = parser._joistPartialTotal;\n // grow geometrically, jumping straight to the message's full length when known and modest\n const whole = total === -1 ? HEADER_LENGTH : Math.min(total, MAX_EAGER_MESSAGE_LENGTH);\n let capacity = Math.max(needed, whole, parser._joistPartial.byteLength * 2);\n if (total !== -1 && capacity > total) capacity = total;\n const grown = Buffer.allocUnsafe(capacity);\n parser._joistPartial.copy(grown, 0, 0, parser._joistPartialLength);\n parser._joistPartial = grown;\n}\n\n/** Loads the Parser class + version from the pg-protocol instance that `pg` itself resolves to. */\nfunction resolvePgProtocol(): { Parser: any; version: string } {\n // Resolve pg-protocol relative to pg, so that we patch the copy pg's Connections actually\n // use, even if the dependency tree has multiple pg-protocol installs\n const pgPath = runtimeRequire.resolve(\"pg\");\n const parserPath = runtimeRequire.resolve(\"pg-protocol/dist/parser.js\", { paths: [dirname(pgPath)] });\n // An absolute-path require bypasses the package's exports map, so this is always readable\n const { version } = runtimeRequire(join(dirname(parserPath), \"..\", \"package.json\"));\n return { Parser: runtimeRequire(parserPath).Parser, version };\n}\n\n/** Round-trips a synthetic two-cell DataRow (utf8 + NULL) through a fresh patched Parser. */\nfunction verifyLazyDataRows(Parser: any): boolean {\n const cell = Buffer.from(\"wörld\", \"utf8\");\n const payload = Buffer.concat([\n Buffer.from([0, 2]), // int16 fieldCount\n int32(cell.length),\n cell,\n int32(-1), // NULL cell\n ]);\n const frame = Buffer.concat([Buffer.from(\"D\"), int32(payload.length + 4), payload]);\n let ok = false;\n new Parser().parse(frame, (msg: any) => {\n ok =\n msg.name === \"dataRow\" &&\n msg.fieldCount === 2 &&\n msg.bytes !== undefined &&\n typeof msg.offset === \"number\" &&\n msg.fields.length === 2 &&\n msg.fields[0] === \"wörld\" &&\n msg.fields[1] === null;\n });\n return ok;\n}\n\n/**\n * Verifies a straddling DataRow's bytes survive later parser reads.\n *\n * We retain a message that straddles two chunks, drive a third read shaped to trigger the stock\n * parser's move-to-front compaction over its bytes, and only then decode the retained message's\n * cell (the `fields` getter memoizes, so it must not be read earlier). Under our `parse` patch\n * the straddler owns its buffer, so the cell decodes intact.\n */\nfunction verifyImmutableBytes(Parser: any): boolean {\n const cellB = \"b\".repeat(85);\n const frameA = dataRowFrame(\"aaaa\"); // 15 bytes, fully inside chunk1\n const frameB = dataRowFrame(cellB); // 96 bytes, straddles chunk1/chunk2\n const frameC = dataRowFrame(\"c\".repeat(45)); // 56 bytes, straddles chunk2/chunk3\n const chunk1 = Buffer.concat([frameA, frameB.subarray(0, 50)]);\n const chunk2 = Buffer.concat([frameB.subarray(50), frameC.subarray(0, 30)]);\n const chunk3 = Buffer.from(frameC.subarray(30));\n const messages: any[] = [];\n const parser = new Parser();\n function collect(msg: any): void {\n messages.push(msg);\n }\n parser.parse(chunk1, collect);\n parser.parse(chunk2, collect);\n parser.parse(chunk3, collect);\n try {\n return messages.length === 3 && messages[1].name === \"dataRow\" && messages[1].fields[0] === cellB;\n } catch {\n return false;\n }\n}\n\n/** Builds a complete one-cell DataRow frame (code + int32 length + payload) for `cell`. */\nfunction dataRowFrame(cell: string): Buffer {\n const bytes = Buffer.from(cell, \"utf8\");\n const payload = Buffer.concat([Buffer.from([0, 1]), int32(bytes.length), bytes]);\n return Buffer.concat([Buffer.from(\"D\"), int32(payload.length + 4), payload]);\n}\n\n/** Returns a 4-byte big-endian buffer for `value`. */\nfunction int32(value: number): Buffer {\n const buffer = Buffer.alloc(4);\n buffer.writeInt32BE(value);\n return buffer;\n}\n"],"mappings":";;;AAGA,MAAM,iBAAiB,cAAc,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BpD,SAAgB,qBAA8B;CAC5C,YAAY,SAAS,IAAI,YAAY;CACrC,OAAO,YAAY;AACrB;;AAGA,IAAa,qBAAb,MAAgC;CAMZ;CAEA;CACA;CARlB,OAAuB;CACvB;CACA,UAAyC,KAAA;CAEzC,YACE,QAEA,OACA,QACA;EAJgB,KAAA,SAAA;EAEA,KAAA,QAAA;EACA,KAAA,SAAA;EAEhB,KAAK,aAAa,MAAM,YAAY,MAAM;CAC5C;;CAGA,IAAI,SAA4B;EAC9B,IAAI,SAAS,KAAKA;EAClB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,EAAE,OA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AGA,SAAS,MAAM,OAAuB;CACpC,MAAM,SAAS,OAAO,MAAM,CAAC;CAC7B,OAAO,aAAa,KAAK;CACzB,OAAO;AACT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
var joist_graphql_codegen = require("joist-graphql-codegen");
|
|
3
|
+
Object.keys(joist_graphql_codegen).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return joist_graphql_codegen[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-graphql-codegen";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-graphql-codegen";
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// Re-export everything from joist-graphql-codegen
|
|
18
|
-
__exportStar(require("joist-graphql-codegen"), exports);
|
|
19
|
-
//# sourceMappingURL=graphql-codegen-export.js.map
|
|
1
|
+
export * from "joist-graphql-codegen";
|
|
2
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
var joist_graphql_resolver_utils = require("joist-graphql-resolver-utils");
|
|
3
|
+
Object.keys(joist_graphql_resolver_utils).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return joist_graphql_resolver_utils[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-graphql-resolver-utils";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-graphql-resolver-utils";
|
package/build/graphql-export.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// Re-export everything from joist-graphql-resolver-utils
|
|
18
|
-
__exportStar(require("joist-graphql-resolver-utils"), exports);
|
|
19
|
-
//# sourceMappingURL=graphql-export.js.map
|
|
1
|
+
export * from "joist-graphql-resolver-utils";
|
|
2
|
+
export {};
|
package/build/index.cjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let joist_utils = require("joist-utils");
|
|
3
|
+
Object.defineProperty(exports, "Deferred", {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return joist_utils.Deferred;
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports, "groupBy", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return joist_utils.groupBy;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "isPlainObject", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function() {
|
|
18
|
+
return joist_utils.isPlainObject;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "keyBy", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return joist_utils.keyBy;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "newPgConnectionConfig", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return joist_utils.newPgConnectionConfig;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var joist_core = require("joist-core");
|
|
34
|
+
Object.keys(joist_core).forEach(function(k) {
|
|
35
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function() {
|
|
38
|
+
return joist_core[k];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
package/build/index.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.newPgConnectionConfig = exports.keyBy = exports.isPlainObject = exports.groupBy = exports.Deferred = void 0;
|
|
18
|
-
// Re-export everything from joist-core
|
|
19
|
-
__exportStar(require("joist-core"), exports);
|
|
20
|
-
// Re-export from joist-utils (excluding 'fail' which is already exported by joist-core)
|
|
21
|
-
var joist_utils_1 = require("joist-utils");
|
|
22
|
-
Object.defineProperty(exports, "Deferred", { enumerable: true, get: function () { return joist_utils_1.Deferred; } });
|
|
23
|
-
Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return joist_utils_1.groupBy; } });
|
|
24
|
-
Object.defineProperty(exports, "isPlainObject", { enumerable: true, get: function () { return joist_utils_1.isPlainObject; } });
|
|
25
|
-
Object.defineProperty(exports, "keyBy", { enumerable: true, get: function () { return joist_utils_1.keyBy; } });
|
|
26
|
-
Object.defineProperty(exports, "newPgConnectionConfig", { enumerable: true, get: function () { return joist_utils_1.newPgConnectionConfig; } });
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { Deferred, groupBy, isPlainObject, keyBy, newPgConnectionConfig } from "joist-utils";
|
|
2
|
+
export * from "joist-core";
|
|
3
|
+
export { Deferred, groupBy, isPlainObject, keyBy, newPgConnectionConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
var joist_knex = require("joist-knex");
|
|
3
|
+
Object.keys(joist_knex).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return joist_knex[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-knex";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-knex";
|
package/build/knex-export.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// Re-export everything from joist-knex
|
|
18
|
-
__exportStar(require("joist-knex"), exports);
|
|
19
|
-
//# sourceMappingURL=knex-export.js.map
|
|
1
|
+
export * from "joist-knex";
|
|
2
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_drivers_binaryParsers = require("./drivers/binaryParsers.cjs");
|
|
3
|
+
const require_drivers_PostgresDriver = require("./drivers/PostgresDriver.cjs");
|
|
4
|
+
const require_seed = require("./seed.cjs");
|
|
5
|
+
exports.PostgresDriver = require_drivers_PostgresDriver.PostgresDriver;
|
|
6
|
+
exports.binaryArrayParser = require_drivers_binaryParsers.binaryArrayParser;
|
|
7
|
+
exports.binaryTextParser = require_drivers_binaryParsers.binaryTextParser;
|
|
8
|
+
exports.getBinaryTypeParser = require_drivers_binaryParsers.getBinaryTypeParser;
|
|
9
|
+
exports.registerDatabaseBinaryParsers = require_drivers_binaryParsers.registerDatabaseBinaryParsers;
|
|
10
|
+
exports.seed = require_seed.seed;
|
|
11
|
+
exports.setBinaryTypeParser = require_drivers_binaryParsers.setBinaryTypeParser;
|
|
12
|
+
exports.setSessionTimeZone = require_drivers_binaryParsers.setSessionTimeZone;
|
|
13
|
+
exports.setupLatestPgTypes = require_drivers_PostgresDriver.setupLatestPgTypes;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PostgresDriver, PostgresDriverOpts, setupLatestPgTypes } from "./drivers/PostgresDriver.cjs";
|
|
2
|
+
import { BinaryParse, binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, setBinaryTypeParser, setSessionTimeZone } from "./drivers/binaryParsers.cjs";
|
|
3
|
+
import { seed } from "./seed.cjs";
|
|
4
|
+
export { type BinaryParse, PostgresDriver, type PostgresDriverOpts, binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, seed, setBinaryTypeParser, setSessionTimeZone, setupLatestPgTypes };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PostgresDriver, PostgresDriverOpts, setupLatestPgTypes } from "./drivers/PostgresDriver.mjs";
|
|
2
|
+
import { BinaryParse, binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, setBinaryTypeParser, setSessionTimeZone } from "./drivers/binaryParsers.mjs";
|
|
3
|
+
import { seed } from "./seed.mjs";
|
|
4
|
+
export { type BinaryParse, PostgresDriver, type PostgresDriverOpts, binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, seed, setBinaryTypeParser, setSessionTimeZone, setupLatestPgTypes };
|
package/build/pg-export.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "PostgresDriver", { enumerable: true, get: function () { return PostgresDriver_js_1.PostgresDriver; } });
|
|
6
|
-
Object.defineProperty(exports, "setupLatestPgTypes", { enumerable: true, get: function () { return PostgresDriver_js_1.setupLatestPgTypes; } });
|
|
7
|
-
var seed_js_1 = require("./seed.js");
|
|
8
|
-
Object.defineProperty(exports, "seed", { enumerable: true, get: function () { return seed_js_1.seed; } });
|
|
9
|
-
//# sourceMappingURL=pg-export.js.map
|
|
1
|
+
import { binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, setBinaryTypeParser, setSessionTimeZone } from "./drivers/binaryParsers.js";
|
|
2
|
+
import { PostgresDriver, setupLatestPgTypes } from "./drivers/PostgresDriver.js";
|
|
3
|
+
import { seed } from "./seed.js";
|
|
4
|
+
export { PostgresDriver, binaryArrayParser, binaryTextParser, getBinaryTypeParser, registerDatabaseBinaryParsers, seed, setBinaryTypeParser, setSessionTimeZone, setupLatestPgTypes };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let joist_migration_utils = require("joist-migration-utils");
|
|
4
|
+
//#region src/pg-migrate.ts
|
|
5
|
+
if (typeof module !== "undefined" && require.main === module) {
|
|
6
|
+
if (Object.fromEntries === void 0) throw new Error("Joist requires Node v12.4.0+");
|
|
7
|
+
(0, joist_migration_utils.joistMigrate)().catch((err) => {
|
|
8
|
+
console.error(err);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
Object.keys(joist_migration_utils).forEach(function(k) {
|
|
14
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function() {
|
|
17
|
+
return joist_migration_utils[k];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=pg-migrate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-migrate.cjs","names":[],"sources":["../src/pg-migrate.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { joistMigrate } from \"joist-migration-utils\";\n\n// Re-export everything from joist-migration-utils\nexport * from \"joist-migration-utils\";\n\n// If we're being run locally.\nif (typeof module !== \"undefined\" && require.main === module) {\n if (Object.fromEntries === undefined) {\n throw new Error(\"Joist requires Node v12.4.0+\");\n }\n joistMigrate().catch((err) => {\n console.error(err);\n process.exit(1);\n });\n}\n"],"mappings":";;;;AAQA,IAAI,OAAO,WAAW,eAAe,QAAQ,SAAS,QAAQ;CAC5D,IAAI,OAAO,gBAAgB,KAAA,GACzB,MAAM,IAAI,MAAM,8BAA8B;CAEhD,CAAA,GAAA,sBAAA,aAAA,CAAa,CAAC,CAAC,OAAO,QAAQ;EAC5B,QAAQ,MAAM,GAAG;EACjB,QAAQ,KAAK,CAAC;CAChB,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-migration-utils";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-migration-utils";
|
package/build/pg-migrate.js
CHANGED
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const joist_migration_utils_1 = require("joist-migration-utils");
|
|
18
|
-
// Re-export everything from joist-migration-utils
|
|
19
|
-
__exportStar(require("joist-migration-utils"), exports);
|
|
20
|
-
// If we're being run locally.
|
|
21
|
-
if (require.main === module) {
|
|
22
|
-
if (Object.fromEntries === undefined) {
|
|
23
|
-
throw new Error("Joist requires Node v12.4.0+");
|
|
24
|
-
}
|
|
25
|
-
(0, joist_migration_utils_1.joistMigrate)().catch((err) => {
|
|
26
|
-
console.error(err);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { __require } from "./_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { joistMigrate } from "joist-migration-utils";
|
|
4
|
+
export * from "joist-migration-utils";
|
|
5
|
+
//#region src/pg-migrate.ts
|
|
6
|
+
if (typeof module !== "undefined" && __require.main === module) {
|
|
7
|
+
if (Object.fromEntries === void 0) throw new Error("Joist requires Node v12.4.0+");
|
|
8
|
+
joistMigrate().catch((err) => {
|
|
9
|
+
console.error(err);
|
|
10
|
+
process.exit(1);
|
|
11
|
+
});
|
|
29
12
|
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export {};
|
|
15
|
+
|
|
30
16
|
//# sourceMappingURL=pg-migrate.js.map
|
package/build/pg-migrate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-migrate.js","
|
|
1
|
+
{"version":3,"file":"pg-migrate.js","names":[],"sources":["../src/pg-migrate.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { joistMigrate } from \"joist-migration-utils\";\n\n// Re-export everything from joist-migration-utils\nexport * from \"joist-migration-utils\";\n\n// If we're being run locally.\nif (typeof module !== \"undefined\" && require.main === module) {\n if (Object.fromEntries === undefined) {\n throw new Error(\"Joist requires Node v12.4.0+\");\n }\n joistMigrate().catch((err) => {\n console.error(err);\n process.exit(1);\n });\n}\n"],"mappings":";;;;;AAQA,IAAI,OAAO,WAAW,eAAA,UAAuB,SAAS,QAAQ;CAC5D,IAAI,OAAO,gBAAgB,KAAA,GACzB,MAAM,IAAI,MAAM,8BAA8B;CAEhD,aAAa,CAAC,CAAC,OAAO,QAAQ;EAC5B,QAAQ,MAAM,GAAG;EACjB,QAAQ,KAAK,CAAC;CAChB,CAAC;AACH"}
|
package/build/seed.cjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_drivers_PostgresDriver = require("./drivers/PostgresDriver.cjs");
|
|
4
|
+
let joist_core = require("joist-core");
|
|
5
|
+
let pg = require("pg");
|
|
6
|
+
pg = require_runtime.__toESM(pg, 1);
|
|
7
|
+
//#region src/seed.ts
|
|
8
|
+
/**
|
|
9
|
+
* Seeds your local/test database with data created via the factories.
|
|
10
|
+
*
|
|
11
|
+
* Unlike `seed` from `joist-test-utils`, this defaults to the `PostgresDriver`, so you can just
|
|
12
|
+
* `import { seed } from "joist-orm/pg"` and pass only your seeding function.
|
|
13
|
+
*
|
|
14
|
+
* This will delete all data in the database, so is restricted to only `local` and `test`
|
|
15
|
+
* `NODE_ENV`s. We also assume the project does not require a context to seed.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { seed } from "joist-orm/pg";
|
|
20
|
+
*
|
|
21
|
+
* seed(async (em) => {
|
|
22
|
+
* // create your data via factories here
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function seed(fn) {
|
|
27
|
+
const env = process.env.NODE_ENV;
|
|
28
|
+
if (env !== "local" && env !== "test") throw new Error("seed will only run with NODE_ENV=local or NODE_ENV=test because it resets the database");
|
|
29
|
+
const pool = new pg.default.Pool((0, joist_core.newPgConnectionConfig)());
|
|
30
|
+
run(pool, fn).then(async () => {
|
|
31
|
+
console.log("Seeded!");
|
|
32
|
+
await pool.end();
|
|
33
|
+
}).catch(async (err) => {
|
|
34
|
+
console.error(err);
|
|
35
|
+
await pool.end();
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** Flushes the database and runs `fn` against a fresh `EntityManager`. */
|
|
40
|
+
async function run(pool, fn) {
|
|
41
|
+
await pool.query("SELECT flush_database()");
|
|
42
|
+
const em = new joist_core.EntityManager({}, { driver: new require_drivers_PostgresDriver.PostgresDriver(pool) });
|
|
43
|
+
await fn(em);
|
|
44
|
+
await em.flush();
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.seed = seed;
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=seed.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.cjs","names":["newPgConnectionConfig","EntityManager","PostgresDriver"],"sources":["../src/seed.ts"],"sourcesContent":["import { EntityManager, newPgConnectionConfig } from \"joist-core\";\nimport pg from \"pg\";\n\nimport { PostgresDriver } from \"./drivers/PostgresDriver.ts\";\n\n/**\n * Seeds your local/test database with data created via the factories.\n *\n * Unlike `seed` from `joist-test-utils`, this defaults to the `PostgresDriver`, so you can just\n * `import { seed } from \"joist-orm/pg\"` and pass only your seeding function.\n *\n * This will delete all data in the database, so is restricted to only `local` and `test`\n * `NODE_ENV`s. We also assume the project does not require a context to seed.\n *\n * @example\n * ```ts\n * import { seed } from \"joist-orm/pg\";\n *\n * seed(async (em) => {\n * // create your data via factories here\n * });\n * ```\n */\nexport function seed<E extends EntityManager = EntityManager>(fn: (em: E) => Promise<void>): void {\n const env = process.env.NODE_ENV;\n if (env !== \"local\" && env !== \"test\") {\n throw new Error(\"seed will only run with NODE_ENV=local or NODE_ENV=test because it resets the database\");\n }\n\n const pool = new pg.Pool(newPgConnectionConfig());\n\n run<E>(pool, fn)\n .then(async () => {\n console.log(\"Seeded!\");\n await pool.end();\n })\n .catch(async (err) => {\n console.error(err);\n await pool.end();\n process.exit(1);\n });\n}\n\n/** Flushes the database and runs `fn` against a fresh `EntityManager`. */\nasync function run<E extends EntityManager>(pool: pg.Pool, fn: (em: E) => Promise<void>): Promise<void> {\n await pool.query(\"SELECT flush_database()\");\n const em = new EntityManager({}, { driver: new PostgresDriver(pool) }) as E;\n await fn(em);\n await em.flush();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,KAA8C,IAAoC;CAChG,MAAM,MAAM,QAAQ,IAAI;CACxB,IAAI,QAAQ,WAAW,QAAQ,QAC7B,MAAM,IAAI,MAAM,wFAAwF;CAG1G,MAAM,OAAO,IAAI,GAAA,QAAG,MAAA,GAAKA,WAAAA,sBAAAA,CAAsB,CAAC;CAEhD,IAAO,MAAM,EAAE,CAAC,CACb,KAAK,YAAY;EAChB,QAAQ,IAAI,SAAS;EACrB,MAAM,KAAK,IAAI;CACjB,CAAC,CAAC,CACD,MAAM,OAAO,QAAQ;EACpB,QAAQ,MAAM,GAAG;EACjB,MAAM,KAAK,IAAI;EACf,QAAQ,KAAK,CAAC;CAChB,CAAC;AACL;;AAGA,eAAe,IAA6B,MAAe,IAA6C;CACtG,MAAM,KAAK,MAAM,yBAAyB;CAC1C,MAAM,KAAK,IAAIC,WAAAA,cAAc,CAAC,GAAG,EAAE,QAAQ,IAAIC,+BAAAA,eAAe,IAAI,EAAE,CAAC;CACrE,MAAM,GAAG,EAAE;CACX,MAAM,GAAG,MAAM;AACjB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityManager } from "joist-core";
|
|
2
|
+
//#region src/seed.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* Seeds your local/test database with data created via the factories.
|
|
4
5
|
*
|
|
@@ -17,5 +18,7 @@ import { EntityManager } from "joist-core";
|
|
|
17
18
|
* });
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
//#
|
|
21
|
+
declare function seed<E extends EntityManager = EntityManager>(fn: (em: E) => Promise<void>): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { seed };
|
|
24
|
+
//# sourceMappingURL=seed.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.d.cts","names":[],"sources":["../src/seed.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAuBgB,KAAK,UAAU,gBAAgB,eAAe,KAAK,IAAI,MAAM"}
|
package/build/seed.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EntityManager } from "joist-core";
|
|
2
|
+
//#region src/seed.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Seeds your local/test database with data created via the factories.
|
|
5
|
+
*
|
|
6
|
+
* Unlike `seed` from `joist-test-utils`, this defaults to the `PostgresDriver`, so you can just
|
|
7
|
+
* `import { seed } from "joist-orm/pg"` and pass only your seeding function.
|
|
8
|
+
*
|
|
9
|
+
* This will delete all data in the database, so is restricted to only `local` and `test`
|
|
10
|
+
* `NODE_ENV`s. We also assume the project does not require a context to seed.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { seed } from "joist-orm/pg";
|
|
15
|
+
*
|
|
16
|
+
* seed(async (em) => {
|
|
17
|
+
* // create your data via factories here
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function seed<E extends EntityManager = EntityManager>(fn: (em: E) => Promise<void>): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { seed };
|
|
24
|
+
//# sourceMappingURL=seed.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.d.mts","names":[],"sources":["../src/seed.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAuBgB,KAAK,UAAU,gBAAgB,eAAe,KAAK,IAAI,MAAM"}
|
package/build/seed.js
CHANGED
|
@@ -1,52 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.seed = seed;
|
|
7
|
-
const joist_core_1 = require("joist-core");
|
|
8
|
-
const pg_1 = __importDefault(require("pg"));
|
|
9
|
-
const PostgresDriver_js_1 = require("./drivers/PostgresDriver.js");
|
|
1
|
+
import { PostgresDriver } from "./drivers/PostgresDriver.js";
|
|
2
|
+
import { EntityManager, newPgConnectionConfig } from "joist-core";
|
|
3
|
+
import pg from "pg";
|
|
4
|
+
//#region src/seed.ts
|
|
10
5
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
* Seeds your local/test database with data created via the factories.
|
|
7
|
+
*
|
|
8
|
+
* Unlike `seed` from `joist-test-utils`, this defaults to the `PostgresDriver`, so you can just
|
|
9
|
+
* `import { seed } from "joist-orm/pg"` and pass only your seeding function.
|
|
10
|
+
*
|
|
11
|
+
* This will delete all data in the database, so is restricted to only `local` and `test`
|
|
12
|
+
* `NODE_ENV`s. We also assume the project does not require a context to seed.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { seed } from "joist-orm/pg";
|
|
17
|
+
*
|
|
18
|
+
* seed(async (em) => {
|
|
19
|
+
* // create your data via factories here
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
28
23
|
function seed(fn) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.error(err);
|
|
41
|
-
await pool.end();
|
|
42
|
-
process.exit(1);
|
|
43
|
-
});
|
|
24
|
+
const env = process.env.NODE_ENV;
|
|
25
|
+
if (env !== "local" && env !== "test") throw new Error("seed will only run with NODE_ENV=local or NODE_ENV=test because it resets the database");
|
|
26
|
+
const pool = new pg.Pool(newPgConnectionConfig());
|
|
27
|
+
run(pool, fn).then(async () => {
|
|
28
|
+
console.log("Seeded!");
|
|
29
|
+
await pool.end();
|
|
30
|
+
}).catch(async (err) => {
|
|
31
|
+
console.error(err);
|
|
32
|
+
await pool.end();
|
|
33
|
+
process.exit(1);
|
|
34
|
+
});
|
|
44
35
|
}
|
|
45
36
|
/** Flushes the database and runs `fn` against a fresh `EntityManager`. */
|
|
46
37
|
async function run(pool, fn) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
await pool.query("SELECT flush_database()");
|
|
39
|
+
const em = new EntityManager({}, { driver: new PostgresDriver(pool) });
|
|
40
|
+
await fn(em);
|
|
41
|
+
await em.flush();
|
|
51
42
|
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { seed };
|
|
45
|
+
|
|
52
46
|
//# sourceMappingURL=seed.js.map
|
package/build/seed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.js","
|
|
1
|
+
{"version":3,"file":"seed.js","names":[],"sources":["../src/seed.ts"],"sourcesContent":["import { EntityManager, newPgConnectionConfig } from \"joist-core\";\nimport pg from \"pg\";\n\nimport { PostgresDriver } from \"./drivers/PostgresDriver.ts\";\n\n/**\n * Seeds your local/test database with data created via the factories.\n *\n * Unlike `seed` from `joist-test-utils`, this defaults to the `PostgresDriver`, so you can just\n * `import { seed } from \"joist-orm/pg\"` and pass only your seeding function.\n *\n * This will delete all data in the database, so is restricted to only `local` and `test`\n * `NODE_ENV`s. We also assume the project does not require a context to seed.\n *\n * @example\n * ```ts\n * import { seed } from \"joist-orm/pg\";\n *\n * seed(async (em) => {\n * // create your data via factories here\n * });\n * ```\n */\nexport function seed<E extends EntityManager = EntityManager>(fn: (em: E) => Promise<void>): void {\n const env = process.env.NODE_ENV;\n if (env !== \"local\" && env !== \"test\") {\n throw new Error(\"seed will only run with NODE_ENV=local or NODE_ENV=test because it resets the database\");\n }\n\n const pool = new pg.Pool(newPgConnectionConfig());\n\n run<E>(pool, fn)\n .then(async () => {\n console.log(\"Seeded!\");\n await pool.end();\n })\n .catch(async (err) => {\n console.error(err);\n await pool.end();\n process.exit(1);\n });\n}\n\n/** Flushes the database and runs `fn` against a fresh `EntityManager`. */\nasync function run<E extends EntityManager>(pool: pg.Pool, fn: (em: E) => Promise<void>): Promise<void> {\n await pool.query(\"SELECT flush_database()\");\n const em = new EntityManager({}, { driver: new PostgresDriver(pool) }) as E;\n await fn(em);\n await em.flush();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,KAA8C,IAAoC;CAChG,MAAM,MAAM,QAAQ,IAAI;CACxB,IAAI,QAAQ,WAAW,QAAQ,QAC7B,MAAM,IAAI,MAAM,wFAAwF;CAG1G,MAAM,OAAO,IAAI,GAAG,KAAK,sBAAsB,CAAC;CAEhD,IAAO,MAAM,EAAE,CAAC,CACb,KAAK,YAAY;EAChB,QAAQ,IAAI,SAAS;EACrB,MAAM,KAAK,IAAI;CACjB,CAAC,CAAC,CACD,MAAM,OAAO,QAAQ;EACpB,QAAQ,MAAM,GAAG;EACjB,MAAM,KAAK,IAAI;EACf,QAAQ,KAAK,CAAC;CAChB,CAAC;AACL;;AAGA,eAAe,IAA6B,MAAe,IAA6C;CACtG,MAAM,KAAK,MAAM,yBAAyB;CAC1C,MAAM,KAAK,IAAI,cAAc,CAAC,GAAG,EAAE,QAAQ,IAAI,eAAe,IAAI,EAAE,CAAC;CACrE,MAAM,GAAG,EAAE;CACX,MAAM,GAAG,MAAM;AACjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
var joist_test_utils = require("joist-test-utils");
|
|
3
|
+
Object.keys(joist_test_utils).forEach(function(k) {
|
|
4
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return joist_test_utils[k];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-test-utils";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "joist-test-utils";
|