@rocicorp/zero 0.25.5 → 0.25.6
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/out/zero/package.json.js
CHANGED
|
@@ -17,12 +17,13 @@ function createRunnableBuilder(delegate, schema) {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
function createBuilderWithQueryFactory(schema, queryFactory) {
|
|
20
|
+
const target = Object.assign(
|
|
21
|
+
/* @__PURE__ */ Object.create(null),
|
|
22
|
+
schema.tables
|
|
23
|
+
);
|
|
20
24
|
return recordProxy(
|
|
21
|
-
|
|
22
|
-
(_tableSchema, prop) => queryFactory(prop)
|
|
23
|
-
(prop) => {
|
|
24
|
-
throw new Error(`Table ${prop} does not exist in schema`);
|
|
25
|
-
}
|
|
25
|
+
target,
|
|
26
|
+
(_tableSchema, prop) => queryFactory(prop)
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
29
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-builder.js","sources":["../../../../../zql/src/query/create-builder.ts"],"sourcesContent":["import {recordProxy} from '../../../shared/src/record-proxy.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport type {QueryDelegate} from './query-delegate.ts';\nimport {newQuery} from './query-impl.ts';\nimport type {Query} from './query.ts';\nimport {newRunnableQuery} from './runnable-query-impl.ts';\nimport type {ConditionalSchemaQuery, SchemaQuery} from './schema-query.ts';\n\n/**\n * Returns a set of query builders for the given schema.\n */\nexport function createBuilder<S extends Schema>(schema: S): SchemaQuery<S> {\n return createBuilderWithQueryFactory(schema, table =>\n newQuery(schema, table),\n );\n}\n\n/** @deprecated Use {@linkcode createBuilder} with `tx.run(zql.table.where(...))` instead. */\nexport function createRunnableBuilder<S extends Schema>(\n delegate: QueryDelegate,\n schema: S,\n): ConditionalSchemaQuery<S> {\n if (!schema.enableLegacyQueries) {\n return undefined as ConditionalSchemaQuery<S>;\n }\n\n return createBuilderWithQueryFactory(schema, table =>\n newRunnableQuery(delegate, schema, table),\n ) as ConditionalSchemaQuery<S>;\n}\n\nfunction createBuilderWithQueryFactory<S extends Schema>(\n schema: S,\n queryFactory: (table: keyof S['tables'] & string) => Query<string, S>,\n): SchemaQuery<S> {\n return
|
|
1
|
+
{"version":3,"file":"create-builder.js","sources":["../../../../../zql/src/query/create-builder.ts"],"sourcesContent":["import {recordProxy} from '../../../shared/src/record-proxy.ts';\nimport type {Schema} from '../../../zero-types/src/schema.ts';\nimport type {QueryDelegate} from './query-delegate.ts';\nimport {newQuery} from './query-impl.ts';\nimport type {Query} from './query.ts';\nimport {newRunnableQuery} from './runnable-query-impl.ts';\nimport type {ConditionalSchemaQuery, SchemaQuery} from './schema-query.ts';\n\n/**\n * Returns a set of query builders for the given schema.\n */\nexport function createBuilder<S extends Schema>(schema: S): SchemaQuery<S> {\n return createBuilderWithQueryFactory(schema, table =>\n newQuery(schema, table),\n );\n}\n\n/** @deprecated Use {@linkcode createBuilder} with `tx.run(zql.table.where(...))` instead. */\nexport function createRunnableBuilder<S extends Schema>(\n delegate: QueryDelegate,\n schema: S,\n): ConditionalSchemaQuery<S> {\n if (!schema.enableLegacyQueries) {\n return undefined as ConditionalSchemaQuery<S>;\n }\n\n return createBuilderWithQueryFactory(schema, table =>\n newRunnableQuery(delegate, schema, table),\n ) as ConditionalSchemaQuery<S>;\n}\n\nfunction createBuilderWithQueryFactory<S extends Schema>(\n schema: S,\n queryFactory: (table: keyof S['tables'] & string) => Query<string, S>,\n): SchemaQuery<S> {\n // Create a target with no prototype so accessing unknown properties returns\n // undefined instead of inherited Object.prototype methods (e.g., toString).\n // This fixes React 19 dev mode compatibility where accessing $$typeof should\n // return undefined rather than throwing.\n const target = Object.assign(\n Object.create(null),\n schema.tables,\n ) as Record<string, unknown>;\n\n // No onMissing handler needed - unknown properties return undefined due to\n // null prototype, which is the desired behavior for normal JS object semantics.\n return recordProxy(target, (_tableSchema, prop) =>\n queryFactory(prop),\n ) as SchemaQuery<S>;\n}\n"],"names":[],"mappings":";;;AAWO,SAAS,cAAgC,QAA2B;AACzE,SAAO;AAAA,IAA8B;AAAA,IAAQ,CAAA,UAC3C,SAAS,QAAQ,KAAK;AAAA,EAAA;AAE1B;AAGO,SAAS,sBACd,UACA,QAC2B;AAC3B,MAAI,CAAC,OAAO,qBAAqB;AAC/B,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IAA8B;AAAA,IAAQ,CAAA,UAC3C,iBAAiB,UAAU,QAAQ,KAAK;AAAA,EAAA;AAE5C;AAEA,SAAS,8BACP,QACA,cACgB;AAKhB,QAAM,SAAS,OAAO;AAAA,IACpB,uBAAO,OAAO,IAAI;AAAA,IAClB,OAAO;AAAA,EAAA;AAKT,SAAO;AAAA,IAAY;AAAA,IAAQ,CAAC,cAAc,SACxC,aAAa,IAAI;AAAA,EAAA;AAErB;"}
|