@abloatai/transaction 0.52.0 → 0.53.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/auth/apiKey.d.ts +0 -6
- package/dist/auth/apiKey.d.ts.map +1 -1
- package/dist/auth/apiKey.js +13 -60
- package/dist/auth/apiKey.js.map +1 -1
- package/dist/auth/baseUrl.d.ts +38 -0
- package/dist/auth/baseUrl.d.ts.map +1 -0
- package/dist/auth/baseUrl.js +126 -0
- package/dist/auth/baseUrl.js.map +1 -0
- package/dist/auth/index.d.ts +9 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +10 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/branches.d.ts +31 -30
- package/dist/branches.d.ts.map +1 -1
- package/dist/branches.js +2 -4
- package/dist/branches.js.map +1 -1
- package/dist/errorCodes.d.ts +4 -1
- package/dist/errorCodes.d.ts.map +1 -1
- package/dist/errorCodes.js +4 -1
- package/dist/errorCodes.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/httpResources.d.ts +32 -0
- package/dist/resources/httpResources.d.ts.map +1 -1
- package/dist/resources/httpResources.js +10 -1
- package/dist/resources/httpResources.js.map +1 -1
- package/dist/resources/modelOperations.d.ts +12 -0
- package/dist/resources/modelOperations.d.ts.map +1 -1
- package/dist/resources/modelOperations.js.map +1 -1
- package/dist/resources/where.d.ts +67 -2
- package/dist/resources/where.d.ts.map +1 -1
- package/dist/resources/where.js +73 -0
- package/dist/resources/where.js.map +1 -1
- package/dist/schema/openapi.d.ts.map +1 -1
- package/dist/schema/openapi.js +59 -14
- package/dist/schema/openapi.js.map +1 -1
- package/dist/server/adapter.d.ts +2 -0
- package/dist/server/adapter.d.ts.map +1 -1
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/readConfig.d.ts +109 -57
- package/dist/server/readConfig.d.ts.map +1 -1
- package/dist/server/readConfig.js +19 -5
- package/dist/server/readConfig.js.map +1 -1
- package/dist/transport/httpClient.d.ts +7 -2
- package/dist/transport/httpClient.d.ts.map +1 -1
- package/dist/transport/httpClient.js +4 -2
- package/dist/transport/httpClient.js.map +1 -1
- package/dist/transport/httpTransport.d.ts.map +1 -1
- package/dist/transport/httpTransport.js +29 -7
- package/dist/transport/httpTransport.js.map +1 -1
- package/dist/wire/accountResponses.d.ts +18 -13
- package/dist/wire/accountResponses.d.ts.map +1 -1
- package/dist/wire/accountResponses.js +3 -9
- package/dist/wire/accountResponses.js.map +1 -1
- package/dist/wire/claims.d.ts +1 -0
- package/dist/wire/claims.d.ts.map +1 -1
- package/dist/wire/claims.js +7 -1
- package/dist/wire/claims.js.map +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +1 -1
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/listEnvelope.d.ts +20 -0
- package/dist/wire/listEnvelope.d.ts.map +1 -1
- package/dist/wire/listEnvelope.js +20 -0
- package/dist/wire/listEnvelope.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/apiKey.ts +13 -61
- package/src/auth/baseUrl.ts +144 -0
- package/src/auth/index.ts +11 -1
- package/src/branches.ts +2 -4
- package/src/errorCodes.ts +19 -1
- package/src/index.ts +2 -0
- package/src/resources/httpResources.ts +42 -0
- package/src/resources/modelOperations.ts +12 -0
- package/src/resources/where.ts +70 -4
- package/src/schema/openapi.ts +60 -14
- package/src/server/adapter.ts +2 -0
- package/src/server/index.ts +8 -2
- package/src/server/readConfig.ts +111 -57
- package/src/transport/httpClient.ts +17 -4
- package/src/transport/httpTransport.ts +29 -7
- package/src/wire/accountResponses.ts +3 -9
- package/src/wire/claims.ts +7 -1
- package/src/wire/index.ts +7 -1
- package/src/wire/listEnvelope.ts +23 -0
package/dist/wire/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,OAAO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AAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EAClC,gCAAgC,EAChC,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,WAAW,CAAC"}
|
package/dist/wire/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* typed error and serialize it back out.
|
|
17
17
|
*/
|
|
18
18
|
export { errorEnvelopeSchema, errorEnvelope, statusForType, INTERNAL_ERROR_PUBLIC_MESSAGE, } from './errorEnvelope.js';
|
|
19
|
-
export { listEnvelopeSchema, listEnvelope } from './listEnvelope.js';
|
|
19
|
+
export { listEnvelopeSchema, listEnvelope, CURSOR_PARAM, CURSOR_PARAM_ALIAS, CURSOR_PARAM_NAMES, } from './listEnvelope.js';
|
|
20
20
|
// The `GET /v1/logs` feed — the two arms, their envelope, and the cursor that
|
|
21
21
|
// carries a position in each.
|
|
22
22
|
export { claimEventSchema } from './claimEvent.js';
|
package/dist/wire/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wire/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,8EAA8E;AAC9E,8BAA8B;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,cAAc;AACd,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,2EAA2E;AAC3E,8EAA8E;AAC9E,gFAAgF;AAChF,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAY9B,4EAA4E;AAC5E,8EAA8E;AAC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ACxB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EAClC,gCAAgC,EAChC,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,0BAA0B,CAAC;AAclC,4EAA4E;AAC5E,8BAA8B;AAC9B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAS5B,+EAA+E;AAC/E,qDAAqD;AACrD,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,WAAW,CAAC"}
|
|
@@ -9,6 +9,26 @@
|
|
|
9
9
|
* generic type parameter carries the row type of `data`.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
/**
|
|
13
|
+
* The query parameter a caller resumes a collection with, and the single alias
|
|
14
|
+
* retained for it.
|
|
15
|
+
*
|
|
16
|
+
* Declared beside the envelope that issues `next_cursor`, because the parameter
|
|
17
|
+
* and the field it consumes are one contract and both planes read them: the
|
|
18
|
+
* server to know which names are taken, the spec generator to document them,
|
|
19
|
+
* the client to send one. When the name lived in each of those separately, this
|
|
20
|
+
* spec described `starting_after` for a model list and `cursor` for a commit
|
|
21
|
+
* record list — the same concept under two names, in one document.
|
|
22
|
+
*
|
|
23
|
+
* `starting_after` is the spelling used through 0.52.0. It borrowed a name whose
|
|
24
|
+
* established meaning elsewhere is a row id, while this value has always been an
|
|
25
|
+
* opaque token bound to the sort it was issued for.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CURSOR_PARAM = "cursor";
|
|
28
|
+
/** @deprecated The pre-0.53.0 spelling of {@link CURSOR_PARAM}. */
|
|
29
|
+
export declare const CURSOR_PARAM_ALIAS = "starting_after";
|
|
30
|
+
/** Both names a cursor may arrive under, for reserving them in a query string. */
|
|
31
|
+
export declare const CURSOR_PARAM_NAMES: readonly string[];
|
|
12
32
|
/**
|
|
13
33
|
* Builds the authoritative list-envelope schema for a row schema. Keeping the
|
|
14
34
|
* item validator generic lets every endpoint share the same envelope contract
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listEnvelope.d.ts","sourceRoot":"","sources":["../../src/wire/listEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;kBAO7D;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAC5C,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACzC,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAC3D,YAAY,CAAC,CAAC,CAAC,CAOjB"}
|
|
1
|
+
{"version":3,"file":"listEnvelope.d.ts","sourceRoot":"","sources":["../../src/wire/listEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAAuC,CAAC;AAExF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;kBAO7D;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAC5C,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACzC,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GAC3D,YAAY,CAAC,CAAC,CAAC,CAOjB"}
|
|
@@ -9,6 +9,26 @@
|
|
|
9
9
|
* generic type parameter carries the row type of `data`.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
/**
|
|
13
|
+
* The query parameter a caller resumes a collection with, and the single alias
|
|
14
|
+
* retained for it.
|
|
15
|
+
*
|
|
16
|
+
* Declared beside the envelope that issues `next_cursor`, because the parameter
|
|
17
|
+
* and the field it consumes are one contract and both planes read them: the
|
|
18
|
+
* server to know which names are taken, the spec generator to document them,
|
|
19
|
+
* the client to send one. When the name lived in each of those separately, this
|
|
20
|
+
* spec described `starting_after` for a model list and `cursor` for a commit
|
|
21
|
+
* record list — the same concept under two names, in one document.
|
|
22
|
+
*
|
|
23
|
+
* `starting_after` is the spelling used through 0.52.0. It borrowed a name whose
|
|
24
|
+
* established meaning elsewhere is a row id, while this value has always been an
|
|
25
|
+
* opaque token bound to the sort it was issued for.
|
|
26
|
+
*/
|
|
27
|
+
export const CURSOR_PARAM = 'cursor';
|
|
28
|
+
/** @deprecated The pre-0.53.0 spelling of {@link CURSOR_PARAM}. */
|
|
29
|
+
export const CURSOR_PARAM_ALIAS = 'starting_after';
|
|
30
|
+
/** Both names a cursor may arrive under, for reserving them in a query string. */
|
|
31
|
+
export const CURSOR_PARAM_NAMES = [CURSOR_PARAM, CURSOR_PARAM_ALIAS];
|
|
12
32
|
/**
|
|
13
33
|
* Builds the authoritative list-envelope schema for a row schema. Keeping the
|
|
14
34
|
* item validator generic lets every endpoint share the same envelope contract
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listEnvelope.js","sourceRoot":"","sources":["../../src/wire/listEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAI,UAAwB;IAC5D,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;QACpC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;QACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC;AACL,CAAC;AAMD;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAkB,EAClB,OAA0D,EAAE;IAE5D,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI;QACJ,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK;QAC/B,WAAW,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI;KACrC,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"listEnvelope.js","sourceRoot":"","sources":["../../src/wire/listEnvelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;AAErC,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,kFAAkF;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAExF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAI,UAAwB;IAC5D,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;QACpC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;QACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC;AACL,CAAC;AAMD;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAkB,EAClB,OAA0D,EAAE;IAE5D,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI;QACJ,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK;QAC/B,WAAW,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI;KACrC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abloatai/transaction",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "The headless Ablo transaction client and canonical contracts for reads, commits, confirmation, claims, and durable observation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
package/src/auth/apiKey.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
import { AbloAuthenticationError, AbloValidationError } from '../errors.js';
|
|
16
16
|
import { classifyCredentialKind } from './credentialKind.js';
|
|
17
|
-
import {
|
|
17
|
+
import { ABLO_DEFAULT_BASE_URL } from './hostedEndpoints.js';
|
|
18
|
+
import { normalizeAbloBaseUrl } from './baseUrl.js';
|
|
18
19
|
import type { KeyEnvironment } from '../environment.js';
|
|
19
20
|
import { isCredentialEndpoint, createEndpointCredentialResolver } from './credentialEndpoint.js';
|
|
20
21
|
import {
|
|
@@ -393,55 +394,8 @@ export async function warnIfCliKeyMismatch(
|
|
|
393
394
|
// re-exported here so existing import paths keep working.
|
|
394
395
|
export { ABLO_HOSTED_API_DOMAIN, ABLO_HOSTED_HTTP_BASE_URL, ABLO_DEFAULT_BASE_URL } from './hostedEndpoints.js';
|
|
395
396
|
|
|
396
|
-
const LEGACY_HOSTED_API_HOSTS = new Set([
|
|
397
|
-
'mesh.ablo.finance',
|
|
398
|
-
'mesh-staging.ablo.finance',
|
|
399
|
-
'api.ablo.finance',
|
|
400
|
-
'sync-staging.ablo.finance',
|
|
401
|
-
]);
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Normalizes older hosted host names to the current public API domain.
|
|
405
|
-
* Self-hosted or custom URLs pass through unchanged; only the retired
|
|
406
|
-
* first-party host names are rewritten.
|
|
407
|
-
*/
|
|
408
|
-
export function normalizeAbloHostedBaseUrl(rawUrl: string): string {
|
|
409
|
-
const trimmed = rawUrl.trim();
|
|
410
|
-
if (!trimmed) return trimmed;
|
|
411
|
-
|
|
412
|
-
// A scheme-less value (e.g. `api-staging.abloatai.com`) is treated as a
|
|
413
|
-
// relative URL: `new URL()` throws on it, and a later `fetch` would resolve it
|
|
414
|
-
// against the current page — producing a 404 from the app's own origin.
|
|
415
|
-
// Prepending a scheme makes the base absolute. `https` matches
|
|
416
|
-
// {@link ABLO_HOSTED_HTTP_BASE_URL}; the socket layer derives `wss` from it.
|
|
417
|
-
// An existing scheme (ws, wss, http, or https) is preserved untouched.
|
|
418
|
-
const schemed = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
419
|
-
|
|
420
|
-
try {
|
|
421
|
-
const url = new URL(schemed);
|
|
422
|
-
// Canonicalize the scheme to the HTTP family: accept all four schemes
|
|
423
|
-
// (http, https, ws, wss), normalize at this single entry point, and let
|
|
424
|
-
// each layer derive its own protocol (the socket layer maps http to ws and
|
|
425
|
-
// https to wss; fetch uses the URL as-is). Without this, a `ws://` base URL
|
|
426
|
-
// reaches HTTP consumers un-normalized and the client fails at startup
|
|
427
|
-
// instead of connecting.
|
|
428
|
-
if (url.protocol === 'ws:') url.protocol = 'http:';
|
|
429
|
-
if (url.protocol === 'wss:') url.protocol = 'https:';
|
|
430
|
-
|
|
431
|
-
if (!LEGACY_HOSTED_API_HOSTS.has(url.hostname)) {
|
|
432
|
-
return url.toString().replace(/\/+$/, '');
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
url.hostname = ABLO_HOSTED_API_DOMAIN;
|
|
436
|
-
if (url.protocol === 'http:') url.protocol = 'https:';
|
|
437
|
-
return url.toString().replace(/\/+$/, '');
|
|
438
|
-
} catch {
|
|
439
|
-
return schemed;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
397
|
export function resolveBaseURL(input: AuthResolveInput): string {
|
|
444
|
-
return
|
|
398
|
+
return normalizeAbloBaseUrl(input.options.baseURL ?? ABLO_DEFAULT_BASE_URL);
|
|
445
399
|
}
|
|
446
400
|
|
|
447
401
|
/**
|
|
@@ -499,17 +453,15 @@ export function resolveBootstrapBaseUrl(input: {
|
|
|
499
453
|
readonly url: string;
|
|
500
454
|
readonly bootstrapBaseUrl?: string;
|
|
501
455
|
}): string {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
const url = normalizeAbloHostedBaseUrl(input.url);
|
|
512
|
-
return ensureApiSuffix(url.replace(/^ws/, 'http'));
|
|
456
|
+
// Both paths go through `normalizeAbloBaseUrl`, which canonicalizes ws to
|
|
457
|
+
// http and wss to https. That matters most on the override, which legitimately
|
|
458
|
+
// arrives with a WebSocket scheme when a caller derives it as `${baseUrl}/api`
|
|
459
|
+
// from a WebSocket base URL: this URL is used for HTTP fetches (identity
|
|
460
|
+
// resolution, credential exchange, and bootstrap), and `fetch` rejects ws and
|
|
461
|
+
// wss outright.
|
|
462
|
+
// `||`, not `??`: an empty override is an absent override, and should fall
|
|
463
|
+
// through to the client's own URL rather than to the hosted default.
|
|
464
|
+
return ensureApiSuffix(normalizeAbloBaseUrl(input.bootstrapBaseUrl || input.url));
|
|
513
465
|
}
|
|
514
466
|
|
|
515
467
|
/**
|
|
@@ -533,7 +485,7 @@ function ensureApiSuffix(httpBase: string): string {
|
|
|
533
485
|
u.pathname = `${u.pathname.replace(/\/+$/, '')}/api`;
|
|
534
486
|
return u.toString().replace(/\/+$/, '');
|
|
535
487
|
} catch {
|
|
536
|
-
// Should be unreachable after `
|
|
488
|
+
// Should be unreachable after `normalizeAbloBaseUrl`, which yields an
|
|
537
489
|
// absolute URL, but fall back to a string check rather than throwing.
|
|
538
490
|
return trimmed.endsWith("/api") ? trimmed : `${trimmed}/api`;
|
|
539
491
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base URL every credential is sent to, and the rules it has to satisfy.
|
|
3
|
+
*
|
|
4
|
+
* `baseURL` is the only client option that decides *where* an API key travels.
|
|
5
|
+
* Every request the SDK makes attaches the resolved credential as a bearer
|
|
6
|
+
* token against this origin, so an unchecked value here is an exfiltration
|
|
7
|
+
* primitive: one stray environment variable and a live `sk_` is posted to
|
|
8
|
+
* somebody else's host, in cleartext if the scheme says so.
|
|
9
|
+
*
|
|
10
|
+
* That check belongs beside the option, not in each application that sets it.
|
|
11
|
+
* A consumer who has to re-derive "must be HTTPS, must not embed credentials,
|
|
12
|
+
* must not carry a query" writes it once per codebase at best, and never at
|
|
13
|
+
* worst. Normalization and validation are therefore the same pass, at the one
|
|
14
|
+
* point both transports funnel through.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { AbloValidationError } from '../errors.js';
|
|
18
|
+
import { ABLO_DEFAULT_BASE_URL } from './hostedEndpoints.js';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Is this host the local machine?
|
|
22
|
+
*
|
|
23
|
+
* Loopback is the one place plaintext carries no risk: the request never
|
|
24
|
+
* reaches a network, so there is nothing between the process and the server to
|
|
25
|
+
* read the token. This is the same boundary browsers draw when they decide
|
|
26
|
+
* which plaintext origins count as trustworthy, which is why `ablo dev` can
|
|
27
|
+
* serve `http://127.0.0.1:8080` without an override while any other host has
|
|
28
|
+
* to prove itself with TLS.
|
|
29
|
+
*
|
|
30
|
+
* `.localhost` names are included because they are reserved to resolve to the
|
|
31
|
+
* loopback interface and are a common local-development convention.
|
|
32
|
+
*/
|
|
33
|
+
function isLoopbackHostname(hostname: string): boolean {
|
|
34
|
+
const host = hostname.toLowerCase();
|
|
35
|
+
if (host === 'localhost' || host.endsWith('.localhost')) return true;
|
|
36
|
+
if (host === '[::1]' || host === '::1') return true;
|
|
37
|
+
// The whole 127.0.0.0/8 block is loopback, not just 127.0.0.1.
|
|
38
|
+
return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function reject(message: string): never {
|
|
42
|
+
throw new AbloValidationError(message, {
|
|
43
|
+
code: 'invalid_options',
|
|
44
|
+
param: 'baseURL',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Resolves a caller-supplied base URL to the absolute origin the SDK will send
|
|
50
|
+
* credentials to, refusing the values that would leak one.
|
|
51
|
+
*
|
|
52
|
+
* Accepted: an absolute `http`, `https`, `ws`, or `wss` URL, or a bare host
|
|
53
|
+
* name that is treated as `https`. A path prefix is preserved, so a
|
|
54
|
+
* self-hosted deployment mounted at `https://internal.example/ablo` works.
|
|
55
|
+
*
|
|
56
|
+
* Refused, each because the request that followed would be wrong rather than
|
|
57
|
+
* merely unusual:
|
|
58
|
+
*
|
|
59
|
+
* - an unparseable value, which today fails later as an opaque fetch error;
|
|
60
|
+
* - a scheme outside the HTTP family;
|
|
61
|
+
* - plaintext `http` to anywhere but the local machine, which puts the key
|
|
62
|
+
* on the wire in clear;
|
|
63
|
+
* - an embedded `user:password`, which is both a credential in the wrong
|
|
64
|
+
* place and the shape a lookalike host uses to read as a familiar one;
|
|
65
|
+
* - a query string or fragment, which cannot survive having a path appended;
|
|
66
|
+
* - a trailing-dot host, which reaches the same server as the name without it
|
|
67
|
+
* while comparing unequal to every check that names the host.
|
|
68
|
+
*/
|
|
69
|
+
export function normalizeAbloBaseUrl(rawUrl: string): string {
|
|
70
|
+
const trimmed = rawUrl.trim();
|
|
71
|
+
// An empty override is an unset override. Returning it verbatim would hand
|
|
72
|
+
// the transports a base no request can be built against.
|
|
73
|
+
if (!trimmed) return ABLO_DEFAULT_BASE_URL;
|
|
74
|
+
|
|
75
|
+
// A scheme-less value (e.g. `api-staging.abloatai.com`) is treated as a
|
|
76
|
+
// relative URL: `new URL()` throws on it, and a later `fetch` would resolve it
|
|
77
|
+
// against the current page, producing a 404 from the app's own origin.
|
|
78
|
+
// Prepending a scheme makes the base absolute, and `https` is the only safe
|
|
79
|
+
// guess; the socket layer derives `wss` from it. An existing scheme (ws, wss,
|
|
80
|
+
// http, or https) is preserved untouched.
|
|
81
|
+
const schemed = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
82
|
+
|
|
83
|
+
let url: URL;
|
|
84
|
+
try {
|
|
85
|
+
url = new URL(schemed);
|
|
86
|
+
} catch {
|
|
87
|
+
reject(
|
|
88
|
+
`\`baseURL\` is not a valid URL: ${JSON.stringify(rawUrl)}. ` +
|
|
89
|
+
`Pass an absolute origin such as ${ABLO_DEFAULT_BASE_URL}.`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Canonicalize the scheme to the HTTP family: accept all four schemes
|
|
94
|
+
// (http, https, ws, wss), normalize at this single entry point, and let
|
|
95
|
+
// each layer derive its own protocol (the socket layer maps http to ws and
|
|
96
|
+
// https to wss; fetch uses the URL as-is). Without this, a `ws://` base URL
|
|
97
|
+
// reaches HTTP consumers un-normalized and the client fails at startup
|
|
98
|
+
// instead of connecting.
|
|
99
|
+
if (url.protocol === 'ws:') url.protocol = 'http:';
|
|
100
|
+
if (url.protocol === 'wss:') url.protocol = 'https:';
|
|
101
|
+
|
|
102
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
103
|
+
reject(
|
|
104
|
+
`\`baseURL\` must be an https URL. ${JSON.stringify(rawUrl)} uses ` +
|
|
105
|
+
`${url.protocol.replace(':', '')}, which Ablo cannot send a request over.`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (url.username || url.password) {
|
|
110
|
+
reject(
|
|
111
|
+
'`baseURL` must not embed a username or password. Ablo authenticates ' +
|
|
112
|
+
'with the credential you pass as `apiKey`; a URL that carries its own ' +
|
|
113
|
+
'is either a mistake or a host impersonating a familiar one.',
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (url.search || url.hash) {
|
|
118
|
+
reject(
|
|
119
|
+
'`baseURL` must not carry a query string or fragment. Ablo appends its ' +
|
|
120
|
+
'own path to this value, so anything after it would be discarded or ' +
|
|
121
|
+
'would swallow the path. Pass the origin, and the path prefix if you ' +
|
|
122
|
+
'self-host behind one.',
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (url.hostname.endsWith('.')) {
|
|
127
|
+
reject(
|
|
128
|
+
'`baseURL` must not end its host in a dot. That name reaches the same ' +
|
|
129
|
+
'server as the one without it, but compares unequal everywhere the ' +
|
|
130
|
+
'host is checked.',
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (url.protocol === 'http:' && !isLoopbackHostname(url.hostname)) {
|
|
135
|
+
reject(
|
|
136
|
+
`\`baseURL\` must use https. Ablo sends your API key with every ` +
|
|
137
|
+
`request, and ${url.hostname} over plain http would expose it to ` +
|
|
138
|
+
`anything on the path. Plain http is accepted only for the local ` +
|
|
139
|
+
`machine during development.`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return url.toString().replace(/\/+$/, '');
|
|
144
|
+
}
|
package/src/auth/index.ts
CHANGED
|
@@ -29,7 +29,17 @@ export {
|
|
|
29
29
|
ABLO_HOSTED_API_DOMAIN,
|
|
30
30
|
ABLO_HOSTED_HTTP_BASE_URL,
|
|
31
31
|
} from './hostedEndpoints.js';
|
|
32
|
-
export {
|
|
32
|
+
export { normalizeAbloBaseUrl } from './baseUrl.js';
|
|
33
|
+
// A re-export does not bind the name in this module; the alias below needs it.
|
|
34
|
+
import { normalizeAbloBaseUrl } from './baseUrl.js';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Renamed to {@link normalizeAbloBaseUrl}. Removed in 0.54.0.
|
|
38
|
+
* The "hosted" spelling named a rewrite of retired hosted hostnames that no
|
|
39
|
+
* longer exists; both spellings resolve through the one function, so a caller
|
|
40
|
+
* on the old name gets the same refusals of unsafe credential destinations.
|
|
41
|
+
*/
|
|
42
|
+
export const normalizeAbloHostedBaseUrl = normalizeAbloBaseUrl;
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
45
|
* @deprecated Use {@link CapabilityMintResponse}. This is a type-only,
|
package/src/branches.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { listEnvelopeSchema } from './wire/listEnvelope.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A branch handle is for people and URLs. Durable routing always uses the
|
|
@@ -47,10 +48,7 @@ export const branchResponseSchema = z.object({
|
|
|
47
48
|
});
|
|
48
49
|
export type BranchResponse = z.infer<typeof branchResponseSchema>;
|
|
49
50
|
|
|
50
|
-
export const branchListResponseSchema =
|
|
51
|
-
object: z.literal('list'),
|
|
52
|
-
data: z.array(branchResponseSchema).readonly(),
|
|
53
|
-
});
|
|
51
|
+
export const branchListResponseSchema = listEnvelopeSchema(branchResponseSchema);
|
|
54
52
|
export type BranchListResponse = z.infer<typeof branchListResponseSchema>;
|
|
55
53
|
|
|
56
54
|
export const createBranchRequestSchema = z.object({
|
package/src/errorCodes.ts
CHANGED
|
@@ -39,7 +39,7 @@ import { z } from 'zod';
|
|
|
39
39
|
* error documentation and returned on the `Ablo-Version` response header, so a
|
|
40
40
|
* consumer can detect when its expected contract has drifted from the server's.
|
|
41
41
|
*/
|
|
42
|
-
export const ERROR_CONTRACT_VERSION = '2026-08-
|
|
42
|
+
export const ERROR_CONTRACT_VERSION = '2026-08-15';
|
|
43
43
|
|
|
44
44
|
/** A coarse grouping of error codes, used to organize metrics and documentation. */
|
|
45
45
|
export type ErrorCategory =
|
|
@@ -870,6 +870,12 @@ export const ERROR_CODES = {
|
|
|
870
870
|
false,
|
|
871
871
|
'A structured (JSON) value was written to a column whose database type cannot hold it. Ablo adapts a json field to either a jsonb column (native) or a text column (serialized) — but a scalar column (integer, boolean, uuid, timestamp, …) cannot store a JSON object or array. Use a jsonb or text column for this field. Ablo adapts to your column; it does not alter your schema.'
|
|
872
872
|
),
|
|
873
|
+
column_value_out_of_range: wire(
|
|
874
|
+
'validation',
|
|
875
|
+
400,
|
|
876
|
+
false,
|
|
877
|
+
'A stored value is outside the range the field was declared to hold. A number field reads back as a JavaScript number, which represents integers exactly only up to 9,007,199,254,740,991; a bigint column holding more than that would come back rounded. Declare the field as text to read those values digit for digit.'
|
|
878
|
+
),
|
|
873
879
|
|
|
874
880
|
// ── tenant / unknown model (400) ───────────────────────────────────
|
|
875
881
|
server_execute_unknown_model: wire(
|
|
@@ -1617,6 +1623,18 @@ export const ERROR_CODES = {
|
|
|
1617
1623
|
false,
|
|
1618
1624
|
'The query contained an invalid identifier.'
|
|
1619
1625
|
),
|
|
1626
|
+
query_relation_expansion_too_large: wire(
|
|
1627
|
+
'validation',
|
|
1628
|
+
400,
|
|
1629
|
+
false,
|
|
1630
|
+
'A requested relation expansion exceeds the bounded nested-row budget. Query the related model as its own paginated collection instead.'
|
|
1631
|
+
),
|
|
1632
|
+
organization_disabled: wire(
|
|
1633
|
+
'permission',
|
|
1634
|
+
403,
|
|
1635
|
+
false,
|
|
1636
|
+
'This organization has been disabled by an operator. Contact support before retrying.'
|
|
1637
|
+
),
|
|
1620
1638
|
org_id_required: wire(
|
|
1621
1639
|
'validation',
|
|
1622
1640
|
400,
|
package/src/index.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type {
|
|
|
35
35
|
HttpModelClient,
|
|
36
36
|
HttpModelMutationParams,
|
|
37
37
|
} from './transport/httpClient.js';
|
|
38
|
+
/** What `ablo.<model>.list()` resolves to: the rows, and where the page ends. */
|
|
39
|
+
export type { ModelList } from './resources/httpResources.js';
|
|
38
40
|
export type {
|
|
39
41
|
FunctionalUpdateOptions,
|
|
40
42
|
/** @deprecated Use `FunctionalUpdateOptions`. */
|
|
@@ -101,9 +101,51 @@ export interface HttpTransportRead<T = Record<string, unknown>> {
|
|
|
101
101
|
/** @internal Exact collection envelope retained until the typed facade captures evidence. */
|
|
102
102
|
export interface HttpTransportList<T = Record<string, unknown>> {
|
|
103
103
|
readonly data: readonly T[];
|
|
104
|
+
/**
|
|
105
|
+
* Whether the collection continues past this page. A list read is always a
|
|
106
|
+
* page — the server applies a default size and caps the largest one — so a
|
|
107
|
+
* caller that treats `data` as the whole set is right only while this is
|
|
108
|
+
* `false`. It used to be dropped on the floor here, which made a truncated
|
|
109
|
+
* read indistinguishable from a complete one.
|
|
110
|
+
*/
|
|
111
|
+
readonly hasMore: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* The cursor to pass back as `cursor` for the next page, or `null` at the end
|
|
114
|
+
* of the collection.
|
|
115
|
+
*/
|
|
116
|
+
readonly nextCursor: string | null;
|
|
104
117
|
readonly evidence?: readonly ModelListEvidence[];
|
|
105
118
|
}
|
|
106
119
|
|
|
120
|
+
/**
|
|
121
|
+
* What a collection read hands back: the rows, and where the collection stands.
|
|
122
|
+
*
|
|
123
|
+
* It is an array, so it maps, filters, spreads, and iterates like the rows it
|
|
124
|
+
* always was. `hasMore` and `nextCursor` ride along as non-enumerable
|
|
125
|
+
* properties, which keeps `JSON.stringify` and a spread producing exactly the
|
|
126
|
+
* array they produced before.
|
|
127
|
+
*
|
|
128
|
+
* They ride along because a list read is a page: the server applies a default
|
|
129
|
+
* size and caps the largest one. Returning only the rows made a truncated read
|
|
130
|
+
* and a complete one the same value, so the caller with 500 matching rows got
|
|
131
|
+
* 20 and no way to find out.
|
|
132
|
+
*/
|
|
133
|
+
export type ModelList<T> = T[] & Pick<HttpTransportList<T>, 'hasMore' | 'nextCursor'>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Attach the page state to the rows. Non-enumerable so the result stays
|
|
137
|
+
* indistinguishable from a plain array everywhere the properties aren't read.
|
|
138
|
+
*/
|
|
139
|
+
export function modelList<T>(
|
|
140
|
+
rows: readonly T[],
|
|
141
|
+
page: Pick<HttpTransportList<unknown>, 'hasMore' | 'nextCursor'>,
|
|
142
|
+
): ModelList<T> {
|
|
143
|
+
return Object.defineProperties([...rows], {
|
|
144
|
+
hasMore: { value: page.hasMore, enumerable: false },
|
|
145
|
+
nextCursor: { value: page.nextCursor, enumerable: false },
|
|
146
|
+
}) as ModelList<T>;
|
|
147
|
+
}
|
|
148
|
+
|
|
107
149
|
export type IfClaimedPolicy = 'return' | 'fail';
|
|
108
150
|
|
|
109
151
|
export interface ClaimedOptions {
|
|
@@ -205,7 +205,19 @@ export interface ServerReadOptions<T> {
|
|
|
205
205
|
*/
|
|
206
206
|
where?: LoadWhere<T>;
|
|
207
207
|
orderBy?: { [K in keyof T]?: 'asc' | 'desc' };
|
|
208
|
+
/**
|
|
209
|
+
* Rows per page. The server has its own ceiling and applies a default when
|
|
210
|
+
* this is omitted, so a collection larger than one page always comes back as
|
|
211
|
+
* a page: read `hasMore` on the result before treating it as the whole set.
|
|
212
|
+
*/
|
|
208
213
|
limit?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Where to resume: the `nextCursor` from the previous page. Pass it back with
|
|
216
|
+
* the same `where` and `orderBy` to walk a collection; the cursor encodes the
|
|
217
|
+
* sort position it was issued for, so it is an opaque token rather than a row
|
|
218
|
+
* id, and a read that changes either starts a new walk.
|
|
219
|
+
*/
|
|
220
|
+
cursor?: string;
|
|
209
221
|
/**
|
|
210
222
|
* `complete` waits for the server. `unknown` returns whatever is local
|
|
211
223
|
* immediately and refreshes in the background.
|
package/src/resources/where.ts
CHANGED
|
@@ -18,7 +18,13 @@ import { z } from 'zod';
|
|
|
18
18
|
import { AbloValidationError } from '../errors.js';
|
|
19
19
|
|
|
20
20
|
/** Primitive operand types allowed in a where clause. */
|
|
21
|
-
export
|
|
21
|
+
export const wherePrimitiveSchema = z.union([
|
|
22
|
+
z.string(),
|
|
23
|
+
z.number(),
|
|
24
|
+
z.boolean(),
|
|
25
|
+
z.null(),
|
|
26
|
+
]);
|
|
27
|
+
export type WherePrimitive = z.infer<typeof wherePrimitiveSchema>;
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* The comparison operators a {@link WhereClause} may use: equality and
|
|
@@ -93,6 +99,22 @@ export const WHERE_LIKE_OPS: ReadonlySet<WhereOp> = new Set<WhereOp>([
|
|
|
93
99
|
* Returns the classification the caller needs next, so the check and the branch
|
|
94
100
|
* are the same statement rather than two that can disagree.
|
|
95
101
|
*/
|
|
102
|
+
/**
|
|
103
|
+
* Whether an operand is the array form the set operators take.
|
|
104
|
+
*
|
|
105
|
+
* `Array.isArray` answers this at runtime but not in the type system: its
|
|
106
|
+
* signature narrows to `any[]`, which drops both the `readonly` and the element
|
|
107
|
+
* type, so a compiler that reached for it lost the operand type it had just
|
|
108
|
+
* finished validating and handed `any` to everything downstream. Declared here
|
|
109
|
+
* because operand shape is this module's vocabulary — the same reason
|
|
110
|
+
* {@link classifyWhereOperand} lives here rather than in either plane.
|
|
111
|
+
*/
|
|
112
|
+
export function isWhereOperandList(
|
|
113
|
+
value: WherePrimitive | readonly WherePrimitive[] | undefined,
|
|
114
|
+
): value is readonly WherePrimitive[] {
|
|
115
|
+
return Array.isArray(value);
|
|
116
|
+
}
|
|
117
|
+
|
|
96
118
|
export function classifyWhereOperand(
|
|
97
119
|
op: WhereOp,
|
|
98
120
|
value: unknown,
|
|
@@ -134,10 +156,27 @@ export function classifyWhereOperand(
|
|
|
134
156
|
*
|
|
135
157
|
* The value is a single primitive for scalar operators and an array of
|
|
136
158
|
* primitives for IN/NOT IN.
|
|
159
|
+
*
|
|
160
|
+
* This is a schema rather than a bare type because the grammar crosses a
|
|
161
|
+
* boundary: a filtered read arrives at the collection route as text, and the
|
|
162
|
+
* route has to decide whether what it received is a clause before compiling it
|
|
163
|
+
* to SQL. Declaring the shape twice — once to check at the edge, once to type
|
|
164
|
+
* the interior — is how the two planes came to disagree about `IN`.
|
|
137
165
|
*/
|
|
138
|
-
export
|
|
139
|
-
|
|
140
|
-
|
|
166
|
+
export const whereClauseSchema = z.union([
|
|
167
|
+
z.tuple([z.string(), wherePrimitiveSchema]).readonly(),
|
|
168
|
+
z
|
|
169
|
+
.tuple([
|
|
170
|
+
z.string(),
|
|
171
|
+
whereOpSchema,
|
|
172
|
+
z.union([wherePrimitiveSchema, z.array(wherePrimitiveSchema).readonly()]),
|
|
173
|
+
])
|
|
174
|
+
.readonly(),
|
|
175
|
+
]);
|
|
176
|
+
export type WhereClause = z.infer<typeof whereClauseSchema>;
|
|
177
|
+
|
|
178
|
+
/** A whole filter as it travels: the AND-combined list of conditions. */
|
|
179
|
+
export const whereClausesSchema = z.array(whereClauseSchema).readonly();
|
|
141
180
|
|
|
142
181
|
/**
|
|
143
182
|
* Client-facing where shape for `load({where})` and `deleteMany({where})`.
|
|
@@ -158,3 +197,30 @@ export type LoadWhere<T> =
|
|
|
158
197
|
| Partial<T>
|
|
159
198
|
| { [K in keyof T]?: T[K] | readonly T[K][] }
|
|
160
199
|
| readonly WhereClause[];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Collapse either accepted {@link LoadWhere} form to the canonical clause list.
|
|
203
|
+
* Tuple input passes through; object input becomes one `['col', '=', val]` per
|
|
204
|
+
* key, or `['col', 'IN', vals]` where the value is an array.
|
|
205
|
+
*
|
|
206
|
+
* Detection: an array is tuple form, an object is object form.
|
|
207
|
+
*
|
|
208
|
+
* Every transport funnels through this. It used to live beside the WebSocket
|
|
209
|
+
* loader, which left the HTTP transport to walk `Object.entries` itself — and
|
|
210
|
+
* that copy dropped any value it found to be an object, so an `IN` filter and
|
|
211
|
+
* every tuple-form clause were discarded in silence and the read came back
|
|
212
|
+
* unfiltered.
|
|
213
|
+
*/
|
|
214
|
+
export function normalizeWhere(where: unknown): readonly WhereClause[] {
|
|
215
|
+
if (where == null) return [];
|
|
216
|
+
// Tuple form — assumed to already use server-side column names.
|
|
217
|
+
if (Array.isArray(where)) return where as readonly WhereClause[];
|
|
218
|
+
if (typeof where === 'object') {
|
|
219
|
+
return Object.entries(where as Record<string, unknown>).map(([key, value]) =>
|
|
220
|
+
Array.isArray(value)
|
|
221
|
+
? ([key, 'IN', value as readonly WherePrimitive[]] as WhereClause)
|
|
222
|
+
: ([key, value as WherePrimitive] as WhereClause),
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return [];
|
|
226
|
+
}
|