@vibeorm/runtime 2.1.0 → 2.3.0
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/dist/adapter-kit/index.d.ts +6 -3
- package/dist/adapter-kit/index.d.ts.map +1 -1
- package/dist/adapter-kit/index.js +178 -19
- package/dist/adapter-kit/index.js.map +8 -5
- package/dist/adapter-kit/nested-options.d.ts +22 -0
- package/dist/adapter-kit/nested-options.d.ts.map +1 -0
- package/dist/adapter-kit/savepoint-gate.d.ts +31 -0
- package/dist/adapter-kit/savepoint-gate.d.ts.map +1 -1
- package/dist/adapter-kit/session.d.ts +9 -0
- package/dist/adapter-kit/session.d.ts.map +1 -0
- package/dist/adapter-kit/sqlite-session.d.ts +8 -0
- package/dist/adapter-kit/sqlite-session.d.ts.map +1 -0
- package/dist/adapter.d.ts +34 -27
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bulk-upsert.d.ts +5 -3
- package/dist/bulk-upsert.d.ts.map +1 -1
- package/dist/client-types.d.ts +14 -0
- package/dist/client-types.d.ts.map +1 -0
- package/dist/client.d.ts +29 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/codecs.d.ts +5 -0
- package/dist/codecs.d.ts.map +1 -1
- package/dist/database-module.d.ts +27 -0
- package/dist/database-module.d.ts.map +1 -0
- package/dist/diagnostics/index.d.ts +3 -1
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/diagnostics/plan.d.ts +39 -1
- package/dist/diagnostics/plan.d.ts.map +1 -1
- package/dist/diagnostics/preview.d.ts +3 -1
- package/dist/diagnostics/preview.d.ts.map +1 -1
- package/dist/diagnostics/statement-diagnostics.d.ts +176 -0
- package/dist/diagnostics/statement-diagnostics.d.ts.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1362 -566
- package/dist/index.js.map +24 -21
- package/dist/module-context.d.ts +20 -0
- package/dist/module-context.d.ts.map +1 -0
- package/dist/nested-writes.d.ts.map +1 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/query-builder.d.ts +11 -0
- package/dist/query-builder.d.ts.map +1 -1
- package/dist/read-only.d.ts.map +1 -1
- package/dist/relation-loader.d.ts +12 -0
- package/dist/relation-loader.d.ts.map +1 -1
- package/dist/relation-plan.d.ts +14 -0
- package/dist/relation-plan.d.ts.map +1 -1
- package/dist/rls-readiness.d.ts.map +1 -1
- package/dist/scoped.d.ts.map +1 -1
- package/dist/sql-access.d.ts +18 -2
- package/dist/sql-access.d.ts.map +1 -1
- package/dist/telemetry/statement.d.ts +7 -0
- package/dist/telemetry/statement.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Statement diagnostics — the always-on slow-statement log with an automatic
|
|
3
|
+
* `EXPLAIN` (`ClientOptions.diagnostics`, or `VIBEORM_DIAGNOSTICS` for a run).
|
|
4
|
+
*
|
|
5
|
+
* What it is for: an agent or a developer switches ONE option on and every
|
|
6
|
+
* statement over a threshold shows up in the sink with its duration and, on
|
|
7
|
+
* PostgreSQL, a one-line plan summary. No hand replay, no separate CLI run.
|
|
8
|
+
*
|
|
9
|
+
* What it must never do:
|
|
10
|
+
*
|
|
11
|
+
* - delay the caller: the report is built after the statement resolved and
|
|
12
|
+
* the EXPLAIN runs in a macrotask AFTER the caller's promise has settled;
|
|
13
|
+
* - run on the caller's connection: the EXPLAIN takes its own pooled
|
|
14
|
+
* connection through the adapter's `transaction()`; a statement that ran
|
|
15
|
+
* inside `$transaction` is reported with `explainSkipped: "in-transaction"`;
|
|
16
|
+
* - execute a write: `analyze` re-executes the statement, so only single
|
|
17
|
+
* read statements qualify ({@link isExecutableRead}), inside a `READ ONLY`
|
|
18
|
+
* transaction — defence in depth, not a proof of safety;
|
|
19
|
+
* - fail the caller: a failing EXPLAIN or a throwing sink is reported (or
|
|
20
|
+
* swallowed), never propagated;
|
|
21
|
+
* - wait forever in its flush hook: `$disconnect()` waits up to the flush
|
|
22
|
+
* bound. Expiration does not cancel EXPLAIN or pool acquisition; an adapter's
|
|
23
|
+
* own disconnect may still wait for that work.
|
|
24
|
+
*/
|
|
25
|
+
import type { DatabaseAdapter } from "../adapter.ts";
|
|
26
|
+
import type { SqlDialect } from "@vibeorm/sql";
|
|
27
|
+
import type { ExplainMode, ParsedPlan } from "./types.ts";
|
|
28
|
+
/** `off` logs duration only; `estimate` adds `EXPLAIN`; `analyze` adds `EXPLAIN (ANALYZE, BUFFERS)` — which EXECUTES the statement again. */
|
|
29
|
+
export type StatementExplainMode = "off" | ExplainMode;
|
|
30
|
+
/** Why a report carries no plan. */
|
|
31
|
+
export type ExplainSkipReason = "not-a-read" | "dialect" | "in-transaction" | "overload" | "error";
|
|
32
|
+
/** `ClientOptions.diagnostics`. */
|
|
33
|
+
export type StatementDiagnosticsOptions = {
|
|
34
|
+
/** Statements slower than this (ms) are reported. Default 0 = every statement. */
|
|
35
|
+
readonly slowerThanMs?: number;
|
|
36
|
+
/**
|
|
37
|
+
* `"off"` (default) logs duration only; `"estimate"` adds `EXPLAIN (FORMAT
|
|
38
|
+
* JSON)`; `"analyze"` adds `EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)` — which
|
|
39
|
+
* EXECUTES the statement again. PostgreSQL and PGlite only; read statements
|
|
40
|
+
* only; never inside a transaction.
|
|
41
|
+
*/
|
|
42
|
+
readonly explain?: StatementExplainMode;
|
|
43
|
+
/** Where reports go. Default: `console.warn`, one line per statement. */
|
|
44
|
+
readonly sink?: (report: StatementDiagnostic) => void;
|
|
45
|
+
/** Bound literals in plan conditions are redacted unless true. Does not redact statement SQL text. */
|
|
46
|
+
readonly showLiterals?: boolean;
|
|
47
|
+
};
|
|
48
|
+
/** The plan half of a report — the one-liner plus the parsed tree it came from. */
|
|
49
|
+
export type StatementDiagnosticPlan = {
|
|
50
|
+
/** Root node, execution ms, the hottest loop and buffers — what an agent reads first. */
|
|
51
|
+
readonly summary: string;
|
|
52
|
+
readonly nodes: ParsedPlan;
|
|
53
|
+
readonly executionMs?: number;
|
|
54
|
+
readonly planningMs?: number;
|
|
55
|
+
/** Shared buffer hits at the root, `analyze` only. */
|
|
56
|
+
readonly buffersShared?: number;
|
|
57
|
+
/** Every node that ran more than once, hottest first. */
|
|
58
|
+
readonly loops?: readonly {
|
|
59
|
+
readonly node: string;
|
|
60
|
+
readonly loops: number;
|
|
61
|
+
readonly rows: number;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
/** One reported statement. */
|
|
65
|
+
export type StatementDiagnostic = {
|
|
66
|
+
readonly model: string | null;
|
|
67
|
+
readonly method: string;
|
|
68
|
+
/** Original SQL, potentially containing sensitive inline literals. Exclude from exported logs. */
|
|
69
|
+
readonly text: string;
|
|
70
|
+
readonly durationMs: number;
|
|
71
|
+
readonly parameterCount: number;
|
|
72
|
+
readonly inTransaction: boolean;
|
|
73
|
+
readonly plan?: StatementDiagnosticPlan;
|
|
74
|
+
readonly explainSkipped?: ExplainSkipReason;
|
|
75
|
+
/** The `VibeError` code when `explainSkipped` is `"error"`. */
|
|
76
|
+
readonly explainError?: string;
|
|
77
|
+
};
|
|
78
|
+
/** Every one of these is a bound or a default, not a preference. */
|
|
79
|
+
export declare const STATEMENT_DIAGNOSTICS_DEFAULTS: {
|
|
80
|
+
readonly slowerThanMs: number;
|
|
81
|
+
readonly explain: StatementExplainMode;
|
|
82
|
+
/** Server-side statement timeout for the EXPLAIN where the adapter can enforce one, and the bound `$disconnect()` waits for outstanding explains. */
|
|
83
|
+
readonly explainTimeoutMs: number;
|
|
84
|
+
/** Hard admission cap, including scheduled work and connection acquisition. No backlog is queued. */
|
|
85
|
+
readonly maxOutstandingExplains: number;
|
|
86
|
+
/** `analyze` below this threshold re-executes (nearly) every read; the client warns once. */
|
|
87
|
+
readonly analyzeWarnBelowMs: number;
|
|
88
|
+
readonly envVariable: string;
|
|
89
|
+
};
|
|
90
|
+
/** The option with every default applied. */
|
|
91
|
+
export type ResolvedStatementDiagnostics = {
|
|
92
|
+
readonly slowerThanMs: number;
|
|
93
|
+
readonly explain: StatementExplainMode;
|
|
94
|
+
readonly sink: (report: StatementDiagnostic) => void;
|
|
95
|
+
readonly showLiterals: boolean;
|
|
96
|
+
/** True when the configuration came (at least partly) from the environment. */
|
|
97
|
+
readonly fromEnvironment: boolean;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Parse `VIBEORM_DIAGNOSTICS=<explain>[:<slowerThanMs>]` — e.g. `analyze:5`,
|
|
101
|
+
* `estimate`, `off:20`. An empty or unset variable means "not configured".
|
|
102
|
+
*
|
|
103
|
+
* @throws VibeError `VIBE_CONFIG` on anything else — a typo must not silently
|
|
104
|
+
* run a session without the diagnostics the operator thinks are on.
|
|
105
|
+
*/
|
|
106
|
+
export declare function parseDiagnosticsEnv(params: {
|
|
107
|
+
value: string | undefined;
|
|
108
|
+
}): {
|
|
109
|
+
explain: StatementExplainMode;
|
|
110
|
+
slowerThanMs: number;
|
|
111
|
+
} | undefined;
|
|
112
|
+
/** The default sink: one `console.warn` line per statement. */
|
|
113
|
+
export declare function formatStatementDiagnostic(params: {
|
|
114
|
+
report: StatementDiagnostic;
|
|
115
|
+
}): string;
|
|
116
|
+
/**
|
|
117
|
+
* Merge the explicit option over the environment switch. Returns `undefined`
|
|
118
|
+
* when neither is present — the client then installs NO hook at all.
|
|
119
|
+
*
|
|
120
|
+
* @throws VibeError `VIBE_CONFIG` on an invalid mode, threshold or env value.
|
|
121
|
+
*/
|
|
122
|
+
export declare function resolveStatementDiagnostics(params: {
|
|
123
|
+
options: StatementDiagnosticsOptions | undefined;
|
|
124
|
+
env: string | undefined;
|
|
125
|
+
}): ResolvedStatementDiagnostics | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Turn a parsed plan into the one line an agent needs: root node type,
|
|
128
|
+
* execution ms (or the planner's cost units for an estimate), the node with
|
|
129
|
+
* the most loops and its loops × rows, and shared buffer hits.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* "Nested Loop Left Join 60.2 ms · Index Scan on OrderItem loops=12000 rows=2 · shared hit 23,647"
|
|
133
|
+
*/
|
|
134
|
+
export declare function summarizePlan(params: {
|
|
135
|
+
plan: ParsedPlan;
|
|
136
|
+
mode: ExplainMode;
|
|
137
|
+
}): StatementDiagnosticPlan;
|
|
138
|
+
/**
|
|
139
|
+
* What `runStatement` hands the hook after the adapter resolved. `values` are
|
|
140
|
+
* the RENDERED values — the same the `onQuery` observers see, before the
|
|
141
|
+
* client bound scalar lists through `adapter.formatArrayParam` — and `raw`
|
|
142
|
+
* says which adapter path ran them, because the two paths serialize a bare JS
|
|
143
|
+
* array differently (LEARNINGS: ORM-path vs raw-path array params).
|
|
144
|
+
*/
|
|
145
|
+
export type ObservedStatement = {
|
|
146
|
+
readonly model: string | null;
|
|
147
|
+
readonly method: string;
|
|
148
|
+
/** Original SQL, potentially containing sensitive inline literals. Exclude from exported logs. */
|
|
149
|
+
readonly text: string;
|
|
150
|
+
readonly values: readonly unknown[];
|
|
151
|
+
readonly durationMs: number;
|
|
152
|
+
readonly inTransaction: boolean;
|
|
153
|
+
/** True for `$queryRaw*` / `$executeRaw*` statements (the adapter's raw path). */
|
|
154
|
+
readonly raw: boolean;
|
|
155
|
+
};
|
|
156
|
+
/** One client's diagnostics hook; shared by every transaction engine. */
|
|
157
|
+
export type StatementDiagnosticsHook = {
|
|
158
|
+
readonly config: ResolvedStatementDiagnostics;
|
|
159
|
+
/** Synchronous and non-throwing: filters, reports, and schedules the EXPLAIN. */
|
|
160
|
+
readonly observe: (statement: ObservedStatement) => void;
|
|
161
|
+
/** Wait (bounded) for scheduled EXPLAINs; expiration does not cancel work or connection acquisition. */
|
|
162
|
+
readonly flush: () => Promise<void>;
|
|
163
|
+
/** Scheduled explains not yet settled — for tests and shutdown accounting. */
|
|
164
|
+
readonly outstanding: () => number;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Build the hook over the POOL adapter. `adapter` must be the client's root
|
|
168
|
+
* adapter — never a transaction's — because the EXPLAIN takes its own
|
|
169
|
+
* connection through `adapter.transaction()`.
|
|
170
|
+
*/
|
|
171
|
+
export declare function createStatementDiagnostics(params: {
|
|
172
|
+
config: ResolvedStatementDiagnostics;
|
|
173
|
+
adapter: DatabaseAdapter;
|
|
174
|
+
dialect: SqlDialect;
|
|
175
|
+
}): StatementDiagnosticsHook;
|
|
176
|
+
//# sourceMappingURL=statement-diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement-diagnostics.d.ts","sourceRoot":"","sources":["../../src/diagnostics/statement-diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAY,MAAM,YAAY,CAAC;AAIpE,6IAA6I;AAC7I,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,WAAW,CAAC;AAEvD,oCAAoC;AACpC,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,SAAS,GAAG,gBAAgB,GAAG,UAAU,GAAG,OAAO,CAAC;AAEnG,mCAAmC;AACnC,MAAM,MAAM,2BAA2B,GAAG;IACxC,kFAAkF;IAClF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IACxC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACtD,sGAAsG;IACtG,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,uBAAuB,GAAG;IACpC,yFAAyF;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,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kGAAkG;IAClG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAC9C,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACzD,wGAAwG;IACxG,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;CACpC,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,MAAM,EAAE,4BAA4B,CAAC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,UAAU,CAAC;CACrB,GAAG,wBAAwB,CAgI3B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { dbNow, isDbNow } from "./db-now.ts";
|
|
|
13
13
|
export type { DbNow } from "./db-now.ts";
|
|
14
14
|
export { compileAdvisoryLock } from "./advisory-lock.ts";
|
|
15
15
|
export type { AdvisoryLockMethod, AdvisoryLockOptions } from "./advisory-lock.ts";
|
|
16
|
-
export type { DatabaseAdapter, IsolationLevel, QueryResult, SqlExecutor, TransactionOptions, } from "./adapter.ts";
|
|
16
|
+
export type { DatabaseAdapter, IsolationLevel, QueryResult, SessionRunner, SqlExecutor, TransactionOptions, } from "./adapter.ts";
|
|
17
17
|
export type { AdapterBudgetSupport, StatementTimeoutSupport, TransactionDeadline, TransactionDeadlineEnforcement, TransactionDeadlineSupport, } from "./adapter.ts";
|
|
18
18
|
export { buildRuntimeMeta, generateCuid, generateDefaultValue, generateNanoid, generateUlid, generateUuid, getFieldMeta, getModelMeta, toClientName, } from "./model-meta.ts";
|
|
19
19
|
export type { ComputedFieldMeta, DefaultOrigin, ExtensionOperatorFn, FieldMeta, ModelMeta, RuntimeMeta, } from "./model-meta.ts";
|
|
@@ -21,8 +21,8 @@ export { DIALECT_CODECS, MYSQL_CODECS, POSTGRES_CODECS, SQLITE_CODECS, decodeAgg
|
|
|
21
21
|
export type { CodecTable, ScalarCodec, WireFidelity } from "./codecs.ts";
|
|
22
22
|
export { COUNT_ALIAS, buildQuery, compileOrderBy, compileSelect, compileWhere, lateralColumnAlias, resolveResultShape, } from "./query-builder.ts";
|
|
23
23
|
export type { AggregateKey, AggregateSelection, AggregateSpec, BuilderClientOptions, QueryMethod, QueryPlan, RelationStrategy, } from "./query-builder.ts";
|
|
24
|
-
export { DIAGNOSTIC_THRESHOLDS, PLAN_DEFAULTS, analyzeOperationTelemetry, explainOperation, explainSql, parameterTypeTag, parsePostgresPlan, previewOperation, readWorkloadStatistics, recommendFromPlan, } from "./diagnostics/index.ts";
|
|
25
|
-
export type { DiagnosticFinding, DiagnosticFindingCode, ExplainMode, IndexCandidate, IndexFacts, OperationPreview, ParsedPlan, PlanContext, PlanNode, PreviewLimitation, PreviewLimitationCode, PreviewStatement, QueryPlanReport, SlowOperation, SuspectedPattern, TableFacts, TelemetryDiagnosticReport, WorkloadAvailability, WorkloadReport, WorkloadStatement, } from "./diagnostics/index.ts";
|
|
24
|
+
export { DIAGNOSTIC_THRESHOLDS, PLAN_DEFAULTS, STATEMENT_DIAGNOSTICS_DEFAULTS, analyzeOperationTelemetry, createStatementDiagnostics, explainOnSession, explainOperation, explainSql, formatStatementDiagnostic, isExecutableRead, parameterTypeTag, parseDiagnosticsEnv, parsePostgresPlan, previewOperation, readWorkloadStatistics, recommendFromPlan, resolveStatementDiagnostics, summarizePlan, } from "./diagnostics/index.ts";
|
|
25
|
+
export type { DiagnosticFinding, DiagnosticFindingCode, ExplainMode, ExplainSkipReason, ObservedStatement, ResolvedStatementDiagnostics, StatementDiagnostic, StatementDiagnosticPlan, StatementDiagnosticsHook, StatementDiagnosticsOptions, StatementExplainMode, IndexCandidate, IndexFacts, OperationPreview, ParsedPlan, PlanContext, PlanNode, PreviewLimitation, PreviewLimitationCode, PreviewStatement, QueryPlanReport, SlowOperation, SuspectedPattern, TableFacts, TelemetryDiagnosticReport, WorkloadAvailability, WorkloadReport, WorkloadStatement, } from "./diagnostics/index.ts";
|
|
26
26
|
export { resolveRelationLink, resolveRelationSelection } from "./relation-plan.ts";
|
|
27
27
|
export type { RelationArgs, RelationKind, RelationLink, RelationSelection, RelationTreeNode, } from "./relation-plan.ts";
|
|
28
28
|
export { attachLateralRelations, attachRelations } from "./relation-loader.ts";
|
|
@@ -43,6 +43,9 @@ export type { RewrittenScopedCall, ScopeRewriter, ScopeValue, ScopedClientConfig
|
|
|
43
43
|
export type { DefineViewFn, ViewClientShape, ViewDefinition, ViewModelDelegate } from "./views.ts";
|
|
44
44
|
export { assertNativeRlsReady, formatNativeRlsReport, inspectNativeRls, inspectNativeRlsTransaction } from "./rls-readiness.ts";
|
|
45
45
|
export type { NativeRlsCheck, NativeRlsCheckName, NativeRlsCheckStatus, NativeRlsReport, NativeRlsUnsafeObject } from "./rls-readiness.ts";
|
|
46
|
+
export type { ClientContext, QueryOperation } from "./client-types.ts";
|
|
47
|
+
export { defineDatabaseModule } from "./database-module.ts";
|
|
48
|
+
export type { DatabaseModule } from "./database-module.ts";
|
|
46
49
|
export { createClient } from "./client.ts";
|
|
47
50
|
export type { BatchResult, ClientOptions, ClientRow, DynamicClient, ModelDelegate, QueryEvent, ReadOnlyClient, ReadOnlyModelDelegate, } from "./client.ts";
|
|
48
51
|
export { CLIENT_MEMBER_ACCESS, DELEGATE_METHOD_ACCESS, READ_DELEGATE_METHODS, WRITE_DELEGATE_METHODS, attachReadOnly, clientMemberAccess, delegateMethodAccess, inheritReadOnly, readOnlyRefusal, } from "./read-only.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClF,YAAY,EACV,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,SA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