@suss/recognize 0.11.0 → 0.13.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/README.md +294 -2
- package/dist/ast.d.cts +1 -1
- package/dist/ast.d.ts +1 -1
- package/dist/chain-BaxjT_-k.d.cts +530 -0
- package/dist/chain-BaxjT_-k.d.ts +530 -0
- package/dist/index.cjs +385 -85
- package/dist/index.d.cts +141 -40
- package/dist/index.d.ts +141 -40
- package/dist/index.js +383 -85
- package/package.json +4 -3
- package/dist/chain-DTSij2Mn.d.cts +0 -197
- package/dist/chain-DTSij2Mn.d.ts +0 -197
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InvocationRecognizer, PatternPack } from '@suss/extractor';
|
|
1
|
+
import { InvocationRecognizer, PatternPack, PackDeclarations } from '@suss/extractor';
|
|
2
2
|
export { DeclaredMatch, PackDeclarations, PatternPack } from '@suss/extractor';
|
|
3
|
-
import { a as Chain, S as StorageMethod, L as LinkFunction, C as CallOps,
|
|
4
|
-
export {
|
|
3
|
+
import { a as Chain, M as MethodMeaning, S as SqlMethod, I as InterpolatesLink, R as ReceiverOrigin, b as CallStep, c as StorageMethod, A as ArgumentPick, L as LinkFunction, C as CallOps, O as OneArgument } from './chain-BaxjT_-k.cjs';
|
|
4
|
+
export { d as AccessKind, e as AccessPathLink, f as ArgumentsFrom, g as ConstructedFrom, h as ContainerArgument, i as ContainerLink, j as ContainerRule, k as ContainersLink, D as DeclaredBy, E as Ending, F as FromReceiver, l as InputLink, m as InputRule, K as KindAsAsked, n as Link, o as MatchStart, p as MethodsLink, q as OpsCarrier, r as SqlEnding, s as StartLink, t as StatedInputs, u as StatedRule, v as StorageEnding, w as SubjectLink, T as ToArgument, x as ToReceiver, U as UnsettledName, V as ValueEntry, y as ValueOps, z as constructedFrom, B as declaredBy, G as opsIn } from './chain-BaxjT_-k.cjs';
|
|
5
5
|
import { Effect } from '@suss/behavioral-ir';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -13,10 +13,14 @@ import { Effect } from '@suss/behavioral-ir';
|
|
|
13
13
|
* says which questions to ask, not the order to ask them in. A link
|
|
14
14
|
* that changes what the receiver is, the way Prisma's model property
|
|
15
15
|
* does, will need that order back, and the note here is where to start.
|
|
16
|
+
*
|
|
17
|
+
* A chain that states a subject asks its questions of a call next to
|
|
18
|
+
* the one in hand, so the walk lives here. The README beside this file
|
|
19
|
+
* says what each step reaches and why the walk is bounded.
|
|
16
20
|
*/
|
|
17
21
|
|
|
18
22
|
/** A chain, as the hook the adapter dispatches to on every call. */
|
|
19
|
-
declare function compile(chain: Chain<
|
|
23
|
+
declare function compile(chain: Chain<MethodMeaning>, recognition: string): InvocationRecognizer;
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Running the example that comes with every declaration.
|
|
@@ -49,6 +53,109 @@ declare function runExamples(pack: PatternPack, run: RunOverCode): RanExample[];
|
|
|
49
53
|
/** The declarations a pack shipped without a line of code to run. */
|
|
50
54
|
declare function examplesMissing(pack: PatternPack): string[];
|
|
51
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Assembling declared chains into the pack the adapters load.
|
|
58
|
+
*
|
|
59
|
+
* Everything a `PatternPack` needs beyond the chains is either already
|
|
60
|
+
* in them or the same for every declared pack: the modules the client
|
|
61
|
+
* came from are the import gate, the store's wire is the protocol, and
|
|
62
|
+
* a pack of recognizers discovers nothing. What is left is the pack's
|
|
63
|
+
* own name, the languages it runs on, and the name its effects are
|
|
64
|
+
* recognized under, which is the npm package callers install.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* One thing a pack matches, as whichever entry point built it hands it
|
|
69
|
+
* over. `storageCalls` and `sqlStatements` both come out as this.
|
|
70
|
+
*/
|
|
71
|
+
interface Match {
|
|
72
|
+
readonly declared: Chain<MethodMeaning>;
|
|
73
|
+
}
|
|
74
|
+
/** What a pack says about itself, beyond the calls it matches. */
|
|
75
|
+
interface PackSpec {
|
|
76
|
+
/** The languages the pack runs on, as the adapters name them. */
|
|
77
|
+
languages: string[];
|
|
78
|
+
/**
|
|
79
|
+
* The name effects from this pack are recorded under, which is the
|
|
80
|
+
* npm package a user installs.
|
|
81
|
+
*/
|
|
82
|
+
recognizedAs: string;
|
|
83
|
+
/**
|
|
84
|
+
* What the pack calls this build of itself. The extraction cache keys
|
|
85
|
+
* on it, so a pack that never stamps one serves an earlier build's
|
|
86
|
+
* results after an edit.
|
|
87
|
+
*/
|
|
88
|
+
version?: string;
|
|
89
|
+
/**
|
|
90
|
+
* What the pack itself speaks, when that is not the wire its accesses
|
|
91
|
+
* record. An S3 access goes over the AWS SDK and says so on every
|
|
92
|
+
* effect, while the pack speaks S3.
|
|
93
|
+
*/
|
|
94
|
+
protocol?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Further modules whose presence makes a file worth reading, beyond
|
|
97
|
+
* the ones the chains match on. A helper a project reaches by a
|
|
98
|
+
* relative path gives the gate nothing; the library that helper
|
|
99
|
+
* imports gives it something.
|
|
100
|
+
*/
|
|
101
|
+
requiresImport?: string[];
|
|
102
|
+
}
|
|
103
|
+
/** A pack, assembled from the calls it says it matches. */
|
|
104
|
+
declare function pack(name: string, matches: readonly Match[], spec: PackSpec): PatternPack;
|
|
105
|
+
/**
|
|
106
|
+
* What a set of chains cost, for a pack that assembles itself. A pack
|
|
107
|
+
* part way through the migration still has a hand-rolled walk beside
|
|
108
|
+
* its declarations, and this is how the part that moved is priced.
|
|
109
|
+
*/
|
|
110
|
+
declare function declarationsIn(matches: readonly Match[]): PackDeclarations;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The entry point for a pack whose calls hand the store a statement
|
|
114
|
+
* written as SQL.
|
|
115
|
+
*
|
|
116
|
+
* A typed client says what it reached in its arguments, so the chain
|
|
117
|
+
* asks the call. A raw statement says it in the text, so the chain
|
|
118
|
+
* hands the text to `@suss/sql` and the parse settles the container,
|
|
119
|
+
* the kind, the fields and the selector of every table the statement
|
|
120
|
+
* touches. The links up to that point are the same ones every chain
|
|
121
|
+
* states, which is why this is an ending rather than a grammar of its
|
|
122
|
+
* own.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/** What a pack says about the store its statements reach. */
|
|
126
|
+
interface SqlStatementsSpec {
|
|
127
|
+
/** The store, in the words OpenTelemetry's semantic conventions use. */
|
|
128
|
+
system: string;
|
|
129
|
+
/** The wire, when it differs from the store's own name. */
|
|
130
|
+
transport?: string;
|
|
131
|
+
/** Which of the store's namespaces the calls reach. Defaults to "default". */
|
|
132
|
+
scope?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Which dialect the statements are written in. Wherever the store is
|
|
135
|
+
* the database this is the store's own name again, and a pack says it
|
|
136
|
+
* anyway: a store whose statements are somebody else's SQL is common
|
|
137
|
+
* enough that a default here would read the wrong tables quietly.
|
|
138
|
+
*/
|
|
139
|
+
dialect: string;
|
|
140
|
+
/** How the pack pins down the client its calls are on. */
|
|
141
|
+
client?: ReceiverOrigin;
|
|
142
|
+
}
|
|
143
|
+
/** A chain over statements, and the links that can still be added. */
|
|
144
|
+
interface SqlStatements {
|
|
145
|
+
/** Which methods take a statement, and where each one states it. */
|
|
146
|
+
methods(table: Readonly<Record<string, SqlMethod>>, options?: {
|
|
147
|
+
ignoringCase?: boolean;
|
|
148
|
+
}): SqlStatements;
|
|
149
|
+
/** What the values a statement interpolates come to. */
|
|
150
|
+
interpolating(says: Omit<InterpolatesLink, "asks">): SqlStatements;
|
|
151
|
+
/** A line of code this matches, which the pack's tests run. */
|
|
152
|
+
example(code: string): SqlStatements;
|
|
153
|
+
/** The links and the ending, as data. */
|
|
154
|
+
readonly declared: Chain<SqlMethod>;
|
|
155
|
+
}
|
|
156
|
+
/** A pack that recognizes statements written as SQL. */
|
|
157
|
+
declare function sqlStatements(spec: SqlStatementsSpec): SqlStatements;
|
|
158
|
+
|
|
52
159
|
/**
|
|
53
160
|
* The entry point for a pack that recognizes storage calls, and the
|
|
54
161
|
* chain it builds.
|
|
@@ -67,8 +174,12 @@ interface StorageCallsSpec {
|
|
|
67
174
|
transport?: string;
|
|
68
175
|
/** Which of the store's namespaces the calls reach. Defaults to "default". */
|
|
69
176
|
scope?: string;
|
|
70
|
-
/**
|
|
71
|
-
|
|
177
|
+
/**
|
|
178
|
+
* How the pack pins down the client its calls are on. A pack that
|
|
179
|
+
* matches a helper a project lists in its own config leaves this out,
|
|
180
|
+
* because the name that project gave is the whole of what it has.
|
|
181
|
+
*/
|
|
182
|
+
client?: ReceiverOrigin;
|
|
72
183
|
/**
|
|
73
184
|
* What a reader gives back for a name nothing settles. Defaults to
|
|
74
185
|
* "reference", which says which value to go and ask about.
|
|
@@ -77,15 +188,35 @@ interface StorageCallsSpec {
|
|
|
77
188
|
}
|
|
78
189
|
/** A storage chain, and the links that can still be added to it. */
|
|
79
190
|
interface StorageCalls {
|
|
191
|
+
/**
|
|
192
|
+
* Which call the chain is about, when it is not the one in hand. The
|
|
193
|
+
* steps run from the call in hand, and every other link is asked of
|
|
194
|
+
* what they reach.
|
|
195
|
+
*/
|
|
196
|
+
about(...of: readonly CallStep[]): StorageCalls;
|
|
80
197
|
/** Which methods count, and what each one reads or writes. */
|
|
81
198
|
methods(table: Readonly<Record<string, StorageMethod>>, options?: {
|
|
82
199
|
ignoringCase?: boolean;
|
|
83
200
|
}): StorageCalls;
|
|
84
201
|
/**
|
|
85
|
-
* Which container a call's selector belongs to
|
|
86
|
-
* first name a call reached is
|
|
202
|
+
* Which container a call's selector belongs to, as an argument or as
|
|
203
|
+
* the pack's own rule. Without this the first name a call reached is
|
|
204
|
+
* the container.
|
|
205
|
+
*/
|
|
206
|
+
container(says: ArgumentPick | LinkFunction<[readonly string[], CallOps], string | null>): StorageCalls;
|
|
207
|
+
/** Which way into the container the call took, when it states one. */
|
|
208
|
+
accessPath(says: ArgumentPick): StorageCalls;
|
|
209
|
+
/**
|
|
210
|
+
* Where a call that reaches several containers at once states them.
|
|
211
|
+
* Each entry becomes one effect, against the container its key says.
|
|
212
|
+
*/
|
|
213
|
+
containersIn(says: OneArgument): StorageCalls;
|
|
214
|
+
/**
|
|
215
|
+
* Where a call states its inputs, when it states them as one object.
|
|
216
|
+
* A call that states none does not match, and a rule the pack wrote
|
|
217
|
+
* over the inputs is handed the object.
|
|
87
218
|
*/
|
|
88
|
-
|
|
219
|
+
input(says: OneArgument): StorageCalls;
|
|
89
220
|
/** A line of code this matches, which the pack's tests run. */
|
|
90
221
|
example(code: string): StorageCalls;
|
|
91
222
|
/** The links and the ending, as data. */
|
|
@@ -94,34 +225,4 @@ interface StorageCalls {
|
|
|
94
225
|
/** A pack that recognizes calls against a store. */
|
|
95
226
|
declare function storageCalls(spec: StorageCallsSpec): StorageCalls;
|
|
96
227
|
|
|
97
|
-
|
|
98
|
-
* Assembling declared chains into the pack the adapters load.
|
|
99
|
-
*
|
|
100
|
-
* Everything a `PatternPack` needs beyond the chains is either already
|
|
101
|
-
* in them or the same for every declared pack: the modules the client
|
|
102
|
-
* came from are the import gate, the store's wire is the protocol, and
|
|
103
|
-
* a pack of recognizers discovers nothing. What is left is the pack's
|
|
104
|
-
* own name, the languages it runs on, and the name its effects are
|
|
105
|
-
* recognized under, which is the npm package callers install.
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
/** What a pack says about itself, beyond the calls it matches. */
|
|
109
|
-
interface PackSpec {
|
|
110
|
-
/** The languages the pack runs on, as the adapters name them. */
|
|
111
|
-
languages: string[];
|
|
112
|
-
/**
|
|
113
|
-
* The name effects from this pack are recorded under, which is the
|
|
114
|
-
* npm package a user installs.
|
|
115
|
-
*/
|
|
116
|
-
recognizedAs: string;
|
|
117
|
-
/**
|
|
118
|
-
* What the pack calls this build of itself. The extraction cache keys
|
|
119
|
-
* on it, so a pack that never stamps one serves an earlier build's
|
|
120
|
-
* results after an edit.
|
|
121
|
-
*/
|
|
122
|
-
version?: string;
|
|
123
|
-
}
|
|
124
|
-
/** A pack, assembled from the calls it says it matches. */
|
|
125
|
-
declare function pack(name: string, matches: readonly StorageCalls[], spec: PackSpec): PatternPack;
|
|
126
|
-
|
|
127
|
-
export { CallOps, Chain, LinkFunction, type PackSpec, type RanExample, ReceiverOrigin, type RunOverCode, type StorageCalls, type StorageCallsSpec, StorageMethod, compile, examplesMissing, pack, runExamples, storageCalls };
|
|
228
|
+
export { ArgumentPick, CallOps, CallStep, Chain, InterpolatesLink, LinkFunction, type Match, MethodMeaning, OneArgument, type PackSpec, type RanExample, ReceiverOrigin, type RunOverCode, SqlMethod, type SqlStatements, type SqlStatementsSpec, type StorageCalls, type StorageCallsSpec, StorageMethod, compile, declarationsIn, examplesMissing, pack, runExamples, sqlStatements, storageCalls };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InvocationRecognizer, PatternPack } from '@suss/extractor';
|
|
1
|
+
import { InvocationRecognizer, PatternPack, PackDeclarations } from '@suss/extractor';
|
|
2
2
|
export { DeclaredMatch, PackDeclarations, PatternPack } from '@suss/extractor';
|
|
3
|
-
import { a as Chain, S as StorageMethod, L as LinkFunction, C as CallOps,
|
|
4
|
-
export {
|
|
3
|
+
import { a as Chain, M as MethodMeaning, S as SqlMethod, I as InterpolatesLink, R as ReceiverOrigin, b as CallStep, c as StorageMethod, A as ArgumentPick, L as LinkFunction, C as CallOps, O as OneArgument } from './chain-BaxjT_-k.js';
|
|
4
|
+
export { d as AccessKind, e as AccessPathLink, f as ArgumentsFrom, g as ConstructedFrom, h as ContainerArgument, i as ContainerLink, j as ContainerRule, k as ContainersLink, D as DeclaredBy, E as Ending, F as FromReceiver, l as InputLink, m as InputRule, K as KindAsAsked, n as Link, o as MatchStart, p as MethodsLink, q as OpsCarrier, r as SqlEnding, s as StartLink, t as StatedInputs, u as StatedRule, v as StorageEnding, w as SubjectLink, T as ToArgument, x as ToReceiver, U as UnsettledName, V as ValueEntry, y as ValueOps, z as constructedFrom, B as declaredBy, G as opsIn } from './chain-BaxjT_-k.js';
|
|
5
5
|
import { Effect } from '@suss/behavioral-ir';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -13,10 +13,14 @@ import { Effect } from '@suss/behavioral-ir';
|
|
|
13
13
|
* says which questions to ask, not the order to ask them in. A link
|
|
14
14
|
* that changes what the receiver is, the way Prisma's model property
|
|
15
15
|
* does, will need that order back, and the note here is where to start.
|
|
16
|
+
*
|
|
17
|
+
* A chain that states a subject asks its questions of a call next to
|
|
18
|
+
* the one in hand, so the walk lives here. The README beside this file
|
|
19
|
+
* says what each step reaches and why the walk is bounded.
|
|
16
20
|
*/
|
|
17
21
|
|
|
18
22
|
/** A chain, as the hook the adapter dispatches to on every call. */
|
|
19
|
-
declare function compile(chain: Chain<
|
|
23
|
+
declare function compile(chain: Chain<MethodMeaning>, recognition: string): InvocationRecognizer;
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Running the example that comes with every declaration.
|
|
@@ -49,6 +53,109 @@ declare function runExamples(pack: PatternPack, run: RunOverCode): RanExample[];
|
|
|
49
53
|
/** The declarations a pack shipped without a line of code to run. */
|
|
50
54
|
declare function examplesMissing(pack: PatternPack): string[];
|
|
51
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Assembling declared chains into the pack the adapters load.
|
|
58
|
+
*
|
|
59
|
+
* Everything a `PatternPack` needs beyond the chains is either already
|
|
60
|
+
* in them or the same for every declared pack: the modules the client
|
|
61
|
+
* came from are the import gate, the store's wire is the protocol, and
|
|
62
|
+
* a pack of recognizers discovers nothing. What is left is the pack's
|
|
63
|
+
* own name, the languages it runs on, and the name its effects are
|
|
64
|
+
* recognized under, which is the npm package callers install.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* One thing a pack matches, as whichever entry point built it hands it
|
|
69
|
+
* over. `storageCalls` and `sqlStatements` both come out as this.
|
|
70
|
+
*/
|
|
71
|
+
interface Match {
|
|
72
|
+
readonly declared: Chain<MethodMeaning>;
|
|
73
|
+
}
|
|
74
|
+
/** What a pack says about itself, beyond the calls it matches. */
|
|
75
|
+
interface PackSpec {
|
|
76
|
+
/** The languages the pack runs on, as the adapters name them. */
|
|
77
|
+
languages: string[];
|
|
78
|
+
/**
|
|
79
|
+
* The name effects from this pack are recorded under, which is the
|
|
80
|
+
* npm package a user installs.
|
|
81
|
+
*/
|
|
82
|
+
recognizedAs: string;
|
|
83
|
+
/**
|
|
84
|
+
* What the pack calls this build of itself. The extraction cache keys
|
|
85
|
+
* on it, so a pack that never stamps one serves an earlier build's
|
|
86
|
+
* results after an edit.
|
|
87
|
+
*/
|
|
88
|
+
version?: string;
|
|
89
|
+
/**
|
|
90
|
+
* What the pack itself speaks, when that is not the wire its accesses
|
|
91
|
+
* record. An S3 access goes over the AWS SDK and says so on every
|
|
92
|
+
* effect, while the pack speaks S3.
|
|
93
|
+
*/
|
|
94
|
+
protocol?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Further modules whose presence makes a file worth reading, beyond
|
|
97
|
+
* the ones the chains match on. A helper a project reaches by a
|
|
98
|
+
* relative path gives the gate nothing; the library that helper
|
|
99
|
+
* imports gives it something.
|
|
100
|
+
*/
|
|
101
|
+
requiresImport?: string[];
|
|
102
|
+
}
|
|
103
|
+
/** A pack, assembled from the calls it says it matches. */
|
|
104
|
+
declare function pack(name: string, matches: readonly Match[], spec: PackSpec): PatternPack;
|
|
105
|
+
/**
|
|
106
|
+
* What a set of chains cost, for a pack that assembles itself. A pack
|
|
107
|
+
* part way through the migration still has a hand-rolled walk beside
|
|
108
|
+
* its declarations, and this is how the part that moved is priced.
|
|
109
|
+
*/
|
|
110
|
+
declare function declarationsIn(matches: readonly Match[]): PackDeclarations;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The entry point for a pack whose calls hand the store a statement
|
|
114
|
+
* written as SQL.
|
|
115
|
+
*
|
|
116
|
+
* A typed client says what it reached in its arguments, so the chain
|
|
117
|
+
* asks the call. A raw statement says it in the text, so the chain
|
|
118
|
+
* hands the text to `@suss/sql` and the parse settles the container,
|
|
119
|
+
* the kind, the fields and the selector of every table the statement
|
|
120
|
+
* touches. The links up to that point are the same ones every chain
|
|
121
|
+
* states, which is why this is an ending rather than a grammar of its
|
|
122
|
+
* own.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/** What a pack says about the store its statements reach. */
|
|
126
|
+
interface SqlStatementsSpec {
|
|
127
|
+
/** The store, in the words OpenTelemetry's semantic conventions use. */
|
|
128
|
+
system: string;
|
|
129
|
+
/** The wire, when it differs from the store's own name. */
|
|
130
|
+
transport?: string;
|
|
131
|
+
/** Which of the store's namespaces the calls reach. Defaults to "default". */
|
|
132
|
+
scope?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Which dialect the statements are written in. Wherever the store is
|
|
135
|
+
* the database this is the store's own name again, and a pack says it
|
|
136
|
+
* anyway: a store whose statements are somebody else's SQL is common
|
|
137
|
+
* enough that a default here would read the wrong tables quietly.
|
|
138
|
+
*/
|
|
139
|
+
dialect: string;
|
|
140
|
+
/** How the pack pins down the client its calls are on. */
|
|
141
|
+
client?: ReceiverOrigin;
|
|
142
|
+
}
|
|
143
|
+
/** A chain over statements, and the links that can still be added. */
|
|
144
|
+
interface SqlStatements {
|
|
145
|
+
/** Which methods take a statement, and where each one states it. */
|
|
146
|
+
methods(table: Readonly<Record<string, SqlMethod>>, options?: {
|
|
147
|
+
ignoringCase?: boolean;
|
|
148
|
+
}): SqlStatements;
|
|
149
|
+
/** What the values a statement interpolates come to. */
|
|
150
|
+
interpolating(says: Omit<InterpolatesLink, "asks">): SqlStatements;
|
|
151
|
+
/** A line of code this matches, which the pack's tests run. */
|
|
152
|
+
example(code: string): SqlStatements;
|
|
153
|
+
/** The links and the ending, as data. */
|
|
154
|
+
readonly declared: Chain<SqlMethod>;
|
|
155
|
+
}
|
|
156
|
+
/** A pack that recognizes statements written as SQL. */
|
|
157
|
+
declare function sqlStatements(spec: SqlStatementsSpec): SqlStatements;
|
|
158
|
+
|
|
52
159
|
/**
|
|
53
160
|
* The entry point for a pack that recognizes storage calls, and the
|
|
54
161
|
* chain it builds.
|
|
@@ -67,8 +174,12 @@ interface StorageCallsSpec {
|
|
|
67
174
|
transport?: string;
|
|
68
175
|
/** Which of the store's namespaces the calls reach. Defaults to "default". */
|
|
69
176
|
scope?: string;
|
|
70
|
-
/**
|
|
71
|
-
|
|
177
|
+
/**
|
|
178
|
+
* How the pack pins down the client its calls are on. A pack that
|
|
179
|
+
* matches a helper a project lists in its own config leaves this out,
|
|
180
|
+
* because the name that project gave is the whole of what it has.
|
|
181
|
+
*/
|
|
182
|
+
client?: ReceiverOrigin;
|
|
72
183
|
/**
|
|
73
184
|
* What a reader gives back for a name nothing settles. Defaults to
|
|
74
185
|
* "reference", which says which value to go and ask about.
|
|
@@ -77,15 +188,35 @@ interface StorageCallsSpec {
|
|
|
77
188
|
}
|
|
78
189
|
/** A storage chain, and the links that can still be added to it. */
|
|
79
190
|
interface StorageCalls {
|
|
191
|
+
/**
|
|
192
|
+
* Which call the chain is about, when it is not the one in hand. The
|
|
193
|
+
* steps run from the call in hand, and every other link is asked of
|
|
194
|
+
* what they reach.
|
|
195
|
+
*/
|
|
196
|
+
about(...of: readonly CallStep[]): StorageCalls;
|
|
80
197
|
/** Which methods count, and what each one reads or writes. */
|
|
81
198
|
methods(table: Readonly<Record<string, StorageMethod>>, options?: {
|
|
82
199
|
ignoringCase?: boolean;
|
|
83
200
|
}): StorageCalls;
|
|
84
201
|
/**
|
|
85
|
-
* Which container a call's selector belongs to
|
|
86
|
-
* first name a call reached is
|
|
202
|
+
* Which container a call's selector belongs to, as an argument or as
|
|
203
|
+
* the pack's own rule. Without this the first name a call reached is
|
|
204
|
+
* the container.
|
|
205
|
+
*/
|
|
206
|
+
container(says: ArgumentPick | LinkFunction<[readonly string[], CallOps], string | null>): StorageCalls;
|
|
207
|
+
/** Which way into the container the call took, when it states one. */
|
|
208
|
+
accessPath(says: ArgumentPick): StorageCalls;
|
|
209
|
+
/**
|
|
210
|
+
* Where a call that reaches several containers at once states them.
|
|
211
|
+
* Each entry becomes one effect, against the container its key says.
|
|
212
|
+
*/
|
|
213
|
+
containersIn(says: OneArgument): StorageCalls;
|
|
214
|
+
/**
|
|
215
|
+
* Where a call states its inputs, when it states them as one object.
|
|
216
|
+
* A call that states none does not match, and a rule the pack wrote
|
|
217
|
+
* over the inputs is handed the object.
|
|
87
218
|
*/
|
|
88
|
-
|
|
219
|
+
input(says: OneArgument): StorageCalls;
|
|
89
220
|
/** A line of code this matches, which the pack's tests run. */
|
|
90
221
|
example(code: string): StorageCalls;
|
|
91
222
|
/** The links and the ending, as data. */
|
|
@@ -94,34 +225,4 @@ interface StorageCalls {
|
|
|
94
225
|
/** A pack that recognizes calls against a store. */
|
|
95
226
|
declare function storageCalls(spec: StorageCallsSpec): StorageCalls;
|
|
96
227
|
|
|
97
|
-
|
|
98
|
-
* Assembling declared chains into the pack the adapters load.
|
|
99
|
-
*
|
|
100
|
-
* Everything a `PatternPack` needs beyond the chains is either already
|
|
101
|
-
* in them or the same for every declared pack: the modules the client
|
|
102
|
-
* came from are the import gate, the store's wire is the protocol, and
|
|
103
|
-
* a pack of recognizers discovers nothing. What is left is the pack's
|
|
104
|
-
* own name, the languages it runs on, and the name its effects are
|
|
105
|
-
* recognized under, which is the npm package callers install.
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
/** What a pack says about itself, beyond the calls it matches. */
|
|
109
|
-
interface PackSpec {
|
|
110
|
-
/** The languages the pack runs on, as the adapters name them. */
|
|
111
|
-
languages: string[];
|
|
112
|
-
/**
|
|
113
|
-
* The name effects from this pack are recorded under, which is the
|
|
114
|
-
* npm package a user installs.
|
|
115
|
-
*/
|
|
116
|
-
recognizedAs: string;
|
|
117
|
-
/**
|
|
118
|
-
* What the pack calls this build of itself. The extraction cache keys
|
|
119
|
-
* on it, so a pack that never stamps one serves an earlier build's
|
|
120
|
-
* results after an edit.
|
|
121
|
-
*/
|
|
122
|
-
version?: string;
|
|
123
|
-
}
|
|
124
|
-
/** A pack, assembled from the calls it says it matches. */
|
|
125
|
-
declare function pack(name: string, matches: readonly StorageCalls[], spec: PackSpec): PatternPack;
|
|
126
|
-
|
|
127
|
-
export { CallOps, Chain, LinkFunction, type PackSpec, type RanExample, ReceiverOrigin, type RunOverCode, type StorageCalls, type StorageCallsSpec, StorageMethod, compile, examplesMissing, pack, runExamples, storageCalls };
|
|
228
|
+
export { ArgumentPick, CallOps, CallStep, Chain, InterpolatesLink, LinkFunction, type Match, MethodMeaning, OneArgument, type PackSpec, type RanExample, ReceiverOrigin, type RunOverCode, SqlMethod, type SqlStatements, type SqlStatementsSpec, type StorageCalls, type StorageCallsSpec, StorageMethod, compile, declarationsIn, examplesMissing, pack, runExamples, sqlStatements, storageCalls };
|