@distilled.cloud/surrealdb 1.0.0-rc.20 → 1.0.0-rc.22
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 +0 -1
- package/lib/_bundle/sdk.js +1 -1
- package/lib/_bundle/sdk.js.map +1 -1
- package/lib/credentials.d.ts +9 -4
- package/lib/credentials.d.ts.map +1 -1
- package/lib/errors.d.ts +7 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.lazy.js.map +1 -1
- package/lib/pagination.d.ts.map +1 -1
- package/lib/protocol.d.ts +9 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/surrealdb.d.ts.map +1 -1
- package/lib/services/surrealdb.js +1 -1
- package/lib/services/surrealdb.js.map +1 -1
- package/lib/traits.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/credentials.ts +24 -16
- package/src/errors.ts +9 -1
- package/src/protocol.ts +17 -23
- package/src/services/surrealdb.ts +33 -17
package/README.md
CHANGED
package/lib/_bundle/sdk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{errors$API_ERRORS as e,errors$BadGateway as t,errors$BadRequest as n,errors$ConfigError as r,errors$Conflict as i,errors$DEFAULT_ERRORS as a,errors$Forbidden as o,errors$GatewayTimeout as ee,errors$HTTP_STATUS_MAP as te,errors$InternalServerError as ne,errors$Locked as re,errors$NotFound as ie,errors$ServiceUnavailable as s,errors$TooManyRequests as c,errors$Unauthorized as l,errors$UnknownErrorFields as u,errors$UnprocessableEntity as d,protocol_rest$RawResponse as f,protocol_rest$RawResponseRoot as p,protocol_rest$SensitiveValue as m,protocol_rest$
|
|
1
|
+
import{errors$API_ERRORS as e,errors$BadGateway as t,errors$BadRequest as n,errors$ConfigError as r,errors$Conflict as i,errors$DEFAULT_ERRORS as a,errors$Forbidden as o,errors$GatewayTimeout as ee,errors$HTTP_STATUS_MAP as te,errors$InternalServerError as ne,errors$Locked as re,errors$NotFound as ie,errors$ServiceUnavailable as s,errors$TooManyRequests as c,errors$Unauthorized as l,errors$UnknownErrorFields as u,errors$UnprocessableEntity as d,protocol_rest$RawResponse as f,protocol_rest$RawResponseRoot as p,protocol_rest$SensitiveValue as m,protocol_rest$rawResponseRootSymbol as h,protocol_rest$rawResponseSymbol as g,protocol_rest$restProtocol as _,protocol_rest$sensitiveValueSymbol as v,protocol_rest$unknownErrorProps as y,schema_lite$Array as b,schema_lite$Boolean as x,schema_lite$Number as S,schema_lite$Record as C,schema_lite$String as w,schema_lite$Struct as T,schema_lite$Unknown as E,schema_lite$at as D,schema_lite$optional as O,schema_lite$suspend as k}from"@distilled.cloud/core/_bundle/rest";import{api$D as A,api$call as j,api$named as M,api$op as N,category$withParseError as P,retry$capped as F,retry$jittered as I,retry$makeDefault as L,retry$throttlingFactory as R,retry$throttlingOptions as z,retry$transientFactory as B,retry$transientOptions as V,schema_lite_typed$TaggedError as H,schema_lite_typed$Unknown as U,trait$Body as W,trait$FormDataFile as G,trait$Header as K,trait$Http as q,trait$HttpBody as J,trait$KeyDictionary as Y,trait$Label as ae,trait$Query as oe,trait$ResponseCode as se,trait$UnionCases as ce,trait$applyErrorMatchers as le,trait$bodySymbol as ue,trait$errorMatchersSymbol as de,trait$formDataFileSymbol as fe,trait$getErrorMatchers as pe,trait$headerSymbol as me,trait$httpBodySymbol as he,trait$httpSymbol as ge,trait$keyDictionarySymbol as _e,trait$labelSymbol as ve,trait$querySymbol as ye,trait$responseCodeSymbol as be,trait$unionCasesSymbol as xe}from"@distilled.cloud/core/_bundle/base";import*as X from"effect/Context";import*as Z from"effect/Effect";import*as Q from"effect/Layer";import*as $ from"effect/Redacted";const Se=`http://127.0.0.1:8000`;var Credentials=class extends (/*@__PURE__*/ X.Service()(`SurrealdbCredentials`)){};const fromApiKey=e=>Q.succeed(Credentials,Z.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl??`http://127.0.0.1:8000`}));const Ce=/*@__PURE__*/ Q.effect(Credentials,/*@__PURE__*/ Z.map(/*@__PURE__*/ Z.gen(function*(){const e=process.env.SURREALDB_API_KEY;if(!e)return yield*new r({message:`SURREALDB_API_KEY environment variable is required`});return{apiKey:$.make(e),apiBaseUrl:process.env.SURREALDB_API_BASE_URL??`http://127.0.0.1:8000`}}),e=>Z.succeed(e)));var UnknownSurrealdbError=class extends (/*@__PURE__*/ H()(`UnknownSurrealdbError`,u)){};var SurrealdbParseError=class extends (/*@__PURE__*/ H()(`SurrealdbParseError`,{body:U,cause:U}).pipe(P)){};const we=e;const Te=/*@__PURE__*/ _({credentials:/*@__PURE__*/ Z.flatten(Credentials),baseUrl:e=>e.apiBaseUrl,headers:e=>({Accept:`application/json`,Authorization:`Bearer ${$.value(e.apiKey)}`}),unknownError:e=>new UnknownSurrealdbError(y(e)),parseError:({body:e,cause:t})=>new SurrealdbParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ X.Service()(`SurrealdbRetry`)){};const policy=e=>Z.provide(Q.succeed(Retry,e));const Ee=/*@__PURE__*/ Z.provide(/*@__PURE__*/ Q.succeed(Retry,{while:()=>false}));const De=/*@__PURE__*/ policy(R);const Oe=/*@__PURE__*/ policy(B);export{b as Zb,x as _b,A as a,j as b,Credentials as credentials$Credentials,Ce as credentials$CredentialsFromEnv,Se as credentials$DEFAULT_API_BASE_URL,fromApiKey as credentials$fromApiKey,e as errors$API_ERRORS,t as errors$BadGateway,n as errors$BadRequest,r as errors$ConfigError,i as errors$Conflict,a as errors$DEFAULT_ERRORS,o as errors$Forbidden,ee as errors$GatewayTimeout,te as errors$HTTP_STATUS_MAP,ne as errors$InternalServerError,re as errors$Locked,ie as errors$NotFound,s as errors$ServiceUnavailable,SurrealdbParseError as errors$SurrealdbParseError,we as errors$SurrealdbServiceErrors,c as errors$TooManyRequests,l as errors$Unauthorized,UnknownSurrealdbError as errors$UnknownSurrealdbError,d as errors$UnprocessableEntity,S as ic,C as jc,M as l,w as lc,T as mc,N as n,Te as protocol$SurrealdbProtocol,E as rc,Retry as retry$Retry,F as retry$capped,I as retry$jittered,L as retry$makeDefault,Ee as retry$none,policy as retry$policy,De as retry$throttling,R as retry$throttlingFactory,z as retry$throttlingOptions,Oe as retry$transient,B as retry$transientFactory,V as retry$transientOptions,D as tc,W as traits$Body,G as traits$FormDataFile,K as traits$Header,q as traits$Http,J as traits$HttpBody,Y as traits$KeyDictionary,ae as traits$Label,oe as traits$Query,f as traits$RawResponse,p as traits$RawResponseRoot,se as traits$ResponseCode,m as traits$SensitiveValue,ce as traits$UnionCases,le as traits$applyErrorMatchers,ue as traits$bodySymbol,de as traits$errorMatchersSymbol,fe as traits$formDataFileSymbol,pe as traits$getErrorMatchers,me as traits$headerSymbol,he as traits$httpBodySymbol,ge as traits$httpSymbol,_e as traits$keyDictionarySymbol,ve as traits$labelSymbol,ye as traits$querySymbol,h as traits$rawResponseRootSymbol,g as traits$rawResponseSymbol,be as traits$responseCodeSymbol,v as traits$sensitiveValueSymbol,xe as traits$unionCasesSymbol,O as yc,k as zc};
|
|
2
2
|
//# sourceMappingURL=sdk.js.map
|
package/lib/_bundle/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","names":["Schema.Unknown","Category.withParseError","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnknownErrorFields","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Schema.Unknown","Category.withParseError","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnknownErrorFields","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","restProtocol","sensitiveValueSymbol","unknownErrorProps","Array","Boolean","Number","Record","String","Struct","Unknown","at","optional","suspend","D","call","named","op","withParseError","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","TaggedError$1","Unknown$1","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","Context","Effect","Layer","Redacted","DEFAULT_API_BASE_URL","config","CredentialsFromEnv","apiKey","SurrealdbServiceErrors","SurrealdbProtocol","creds","info","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"iiEAeA,MAAa8E,GAAuB,wBAOpC,IAAa,YAAb,eACwB,gBAAQ,QAA4C,CAAC,CACzE,sBACF,EAAA,AAAE,CAAC,EAGL,MAAa,WAAc,GAIzBF,EAAM,QACJ,YACAD,EAAO,QAAQ,CACb,OAAQI,EAAO,OACf,WAAYA,EAAO,YAAA,uBACrB,CAAC,CACH,EAQF,MAAaC,GAA0E,gBAAM,OAC3F,YACc,gBAAO,IACL,gBAAO,IAAI,WAAa,CACpC,MAAMC,EAAS,QAAQ,IAAI,kBAE3B,GAAI,CAACA,EACH,OAAO,MAAO,IAAI5E,EAAY,CAC5B,QAAS,oDACX,CAAC,EAGH,MAAO,CACL,OAAQwE,EAAS,KAAKI,CAAM,EAC5B,WAAY,QAAQ,IAAI,wBAAA,uBAC1B,CACF,CAAC,EACA,GAAWN,EAAO,QAAQI,CAAM,CACnC,CACF,EC/BA,IAAa,sBAAb,eACwB,gBAA0C,CAAC,CAC/D,wBACA9D,CACF,EAAA,AAAE,CAAC,EAGL,IAAa,oBAAb,eACwB,gBAAwC,CAAC,CAAC,sBAAuB,CACrF,KAAMjB,EACN,MAAOA,CACT,CAAC,CAAC,CAAC,KAAKC,CAAuB,EAAA,AAAE,CAAC,EAOpC,MAAaiF,GAAyBhF,ECVtC,MAAaiF,GAAkC,gBAAa,CAG1D,YAA2B,gBAAO,QAAQ,WAAW,EACrD,QAAU,GAAUC,EAAM,WAC1B,QAAU,IAAW,CACnB,OAAQ,mBACR,cAAe,UAAUP,EAAS,MAAMO,EAAM,MAAM,GACtD,GAIA,aAAe,GAAS,IAAI,sBAAsB1D,EAAkB2D,CAAI,CAAC,EACzE,YAAa,CAAE,OAAM,WAAY,IAAI,oBAAoB,CAAE,OAAM,OAAM,CAAC,CAC1E,CAAC,ECtBD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,gBAAgB,EAAA,AAAE,CAAC,EAG7F,MAAa,OAAU,GACrBV,EAAO,QAAQC,EAAM,QAAQ,MAAOU,CAAgB,CAAC,EAGvD,MAAaC,GAAqB,gBAAO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAO3C,CAAiB,EAGhE,MAAa4C,GAA0B,qBAAO1C,CAAgB"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigError } from "@distilled.cloud/core/errors";
|
|
|
3
3
|
* SurrealDB credentials -- hand-written.
|
|
4
4
|
*
|
|
5
5
|
* The `Credentials` service holds an *effect* that resolves the current
|
|
6
|
-
* credentials on every request (the protocol
|
|
6
|
+
* credentials on every request (the protocol resolves it per request
|
|
7
7
|
* on the calling fiber). Auth is a JWT or API token sent as
|
|
8
8
|
* `Authorization: Bearer <apiKey>`. Self-hosted instances override the
|
|
9
9
|
* default base URL (`http://127.0.0.1:8000`).
|
|
@@ -17,7 +17,7 @@ export interface Config {
|
|
|
17
17
|
readonly apiKey: Redacted.Redacted<string>;
|
|
18
18
|
readonly apiBaseUrl: string;
|
|
19
19
|
}
|
|
20
|
-
declare const Credentials_base: Context.ServiceClass<Credentials, "SurrealdbCredentials", Effect.Effect<Config,
|
|
20
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "SurrealdbCredentials", Effect.Effect<Config, never, never>>;
|
|
21
21
|
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
22
22
|
}
|
|
23
23
|
/** Layer from a redacted API key + optional base URL. */
|
|
@@ -25,7 +25,12 @@ export declare const fromApiKey: (config: {
|
|
|
25
25
|
readonly apiKey: Redacted.Redacted<string>;
|
|
26
26
|
readonly apiBaseUrl?: string;
|
|
27
27
|
}) => Layer.Layer<Credentials>;
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Reads SURREALDB_API_KEY (required) and SURREALDB_API_BASE_URL (optional).
|
|
30
|
+
*
|
|
31
|
+
* Its configuration is read and checked once, when the layer is built: a
|
|
32
|
+
* problem there fails the layer with `ConfigError`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError>;
|
|
30
35
|
export {};
|
|
31
36
|
//# sourceMappingURL=credentials.d.ts.map
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D;;;;;;;;GAQG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AAEN,yDAAyD;AACzD,eAAO,MAAM,UAAU,WAAY;IACjC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAmBpE,CAAC"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -30,4 +30,11 @@ declare const SurrealdbParseError_base: Schema.TaggedErrorClass<"SurrealdbParseE
|
|
|
30
30
|
/** Schema parse error wrapper. */
|
|
31
31
|
export declare class SurrealdbParseError extends /*@__PURE__*/ SurrealdbParseError_base {
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* The errors declared on the SurrealDB service: any operation can return them,
|
|
35
|
+
* and every generated operation lists them as its `serviceErrors`. Today that
|
|
36
|
+
* is each of core's status classes (401, 403, 404, 429, the 5xx ...).
|
|
37
|
+
*/
|
|
38
|
+
export declare const SurrealdbServiceErrors: readonly [typeof import("@distilled.cloud/core/errors").Unauthorized, typeof import("@distilled.cloud/core/errors").Forbidden, typeof import("@distilled.cloud/core/errors").NotFound, typeof import("@distilled.cloud/core/errors").BadRequest, typeof import("@distilled.cloud/core/errors").Conflict, typeof import("@distilled.cloud/core/errors").UnprocessableEntity, typeof import("@distilled.cloud/core/errors").TooManyRequests, typeof import("@distilled.cloud/core/errors").Locked, typeof import("@distilled.cloud/core/errors").InternalServerError, typeof import("@distilled.cloud/core/errors").BadGateway, typeof import("@distilled.cloud/core/errors").ServiceUnavailable, typeof import("@distilled.cloud/core/errors").GatewayTimeout];
|
|
39
|
+
export type SurrealdbServiceError = InstanceType<(typeof SurrealdbServiceErrors)[number]>;
|
|
33
40
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;AAElE,iFAAiF;AACjF,qBAAa,qBACX,SAAQ,aAAa,CAAC,0BAGrB;CAAG;;;;;;;;;AAEN,kCAAkC;AAClC,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAGU;CAAG;AAErC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,+tBAAa,CAAC;AACjD,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
package/lib/errors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$SurrealdbParseError as SurrealdbParseError, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownSurrealdbError as UnknownSurrealdbError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
|
1
|
+
export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$SurrealdbParseError as SurrealdbParseError, errors$SurrealdbServiceErrors as SurrealdbServiceErrors, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownSurrealdbError as UnknownSurrealdbError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAKhD,cAAc,yBAAyB,CAAC"}
|
package/lib/index.lazy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAkD,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,4EAA4E;AAC5E,qEAAqE;AACrE,wEAAwE;AACxE,yBAAyB;AACzB,cAAc,yBAAyB,CAAC"}
|
package/lib/pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
|
package/lib/protocol.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { API_ERRORS, ConfigError, InvalidInput } from "@distilled.cloud/core/errors";
|
|
3
|
-
import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
1
|
+
import type { ErrorOf } from "@distilled.cloud/core/protocol";
|
|
4
2
|
import type * as HttpClient from "effect/http/HttpClient";
|
|
5
|
-
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
6
|
-
import type * as Layer from "effect/Layer";
|
|
7
3
|
import { Credentials } from "./credentials.ts";
|
|
8
|
-
import { UnknownSurrealdbError, SurrealdbParseError } from "./errors.ts";
|
|
4
|
+
import { UnknownSurrealdbError, SurrealdbParseError, type SurrealdbServiceError } from "./errors.ts";
|
|
9
5
|
/**
|
|
10
|
-
*
|
|
11
|
-
* service
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* What every generated SurrealDB operation fails with besides its own errors:
|
|
7
|
+
* the service's errors, the protocol's, and what resolving the credentials
|
|
8
|
+
* fails with. Generated service files annotate operations with
|
|
9
|
+
* `API.OperationMethod<I, O, SurrealdbOpError, SurrealdbOpContext>` explicitly
|
|
10
|
+
* so the compiler never infers these back out of the schema generics.
|
|
14
11
|
*/
|
|
15
|
-
export type SurrealdbOpError =
|
|
12
|
+
export type SurrealdbOpError = SurrealdbServiceError | ErrorOf<typeof SurrealdbProtocol>;
|
|
16
13
|
/** Context (requirements) shared by every generated SurrealDB operation. */
|
|
17
14
|
export type SurrealdbOpContext = Credentials | HttpClient.HttpClient;
|
|
18
|
-
export declare const SurrealdbProtocol:
|
|
15
|
+
export declare const SurrealdbProtocol: import("@distilled.cloud/core/protocol").Protocol<SurrealdbParseError | UnknownSurrealdbError | import("@distilled.cloud/core/protocol-rest").RestProtocolError, Credentials>;
|
|
19
16
|
//# sourceMappingURL=protocol.d.ts.map
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAqB9D,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,OAAO,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAErE,eAAO,MAAM,iBAAiB,+KAc5B,CAAC"}
|
package/lib/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAuC,MAAM,6BAA6B,CAAC;AAC/F;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;;AAErC,yEAAyE;AACzE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAAkD;CAAG;AAE9F,2EAA2E;AAC3E,eAAO,MAAM,MAAM,qBAAsB,MAAM,sFACS,CAAC;AAEzD,sCAAsC;AACtC,eAAO,MAAM,IAAI,mFAEhB,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,UAAU,mFAA0C,CAAC;AAElE,oFAAoF;AACpF,eAAO,MAAM,SAAS,mFAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../src/services/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surrealdb.d.ts","
|
|
1
|
+
{"version":3,"file":"surrealdb.d.ts","sources":["../../src/services/surrealdb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAKjD,OAAO,EAAqB,KAA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AAkB,CAUjB,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAClD,oRAAoR;AACpR,eAAO,MAAM,aAAa,EAAE,GAAG,CAAC,eAAe,CAC7C,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,CAUjB,CAAC;AAEJ,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AACnD,qRAAqR;AACrR,eAAO,MAAM,cAAc,EAAE,GAAG,CAAC,eAAe,CAC9C,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,CAUjB,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AACrD,6QAA6Q;AAC7Q,eAAO,MAAM,gBAAgB,EAAE,GAAG,CAAC,eAAe,CAChD,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,CAUjB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Zb as e,_b as t,a as n,b as r,errors$SurrealdbServiceErrors as i,ic as a,jc as o,l as s,lc as c,mc as l,n as u,protocol$SurrealdbProtocol as d,rc as f,retry$Retry as p,tc as m,traits$Header as h,traits$Http as g,traits$HttpBody as _,traits$Label as v,traits$Query as y,traits$RawResponseRoot as b,yc as x,zc as S}from"../_bundle/sdk.js";const C={system:`surrealdb-api`,responseHeaders:[{header:`x-request-id`,name:`http.response.header.x-request-id`,transform:`list`},{header:`request-id`,name:`http.response.header.request-id`,transform:`list`}],prefix:`SurrealDB`,service:`Surrealdb`,labels:`surrealdb`,propagate:`w3c`};const w=/*@__PURE__*/ u(e=>e===n?s(`CreateSql`,`{input:#1,output:#8:0,errors:[],serviceErrors:$9,protocol:$10,retry:$11,telemetry:$12,span:"%"};$7(>2)@"%Request";$6({nS:$4($3.pipe($2("NS"))),dB:$4($3.pipe($2("DB"))),body:$3.pipe($5())}).pipe($1({method:"POST",uri:"/sql",code:200}))`,[m,g,h,c,x,_,l,S,__d0,i,d,p,C]):r(w,e));const T=/*@__PURE__*/ u(e=>e===n?s(`DeleteKey`,`{input:#1,output:#8:0,errors:[],serviceErrors:$9,protocol:$10,retry:$11,telemetry:$12,span:"%"};$7(>2)@"%Request";$6({table:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB")))}).pipe($1({method:"DELETE",uri:"/key/{table}",code:200}))`,[m,g,v,c,h,x,l,S,__d0,i,d,p,C]):r(T,e));const E=/*@__PURE__*/ u(e=>e===n?s(`DeleteKeyById`,`{input:#1,output:#8:0,errors:[],serviceErrors:$9,protocol:$10,retry:$11,telemetry:$12,span:"%"};$7(>2)@"%Request";$6({table:$3.pipe($2()),id:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB")))}).pipe($1({method:"DELETE",uri:"/key/{table}/{id}",code:200}))`,[m,g,v,c,h,x,l,S,__d0,i,d,p,C]):r(E,e));const D=/*@__PURE__*/ u(e=>e===n?s(`GetExport`,`{input:#1,output:#7:0,errors:[],serviceErrors:$8,protocol:$9,retry:$10,telemetry:$11,span:"%"};$6(>2)@"%Request";$5({nS:$4($3.pipe($2("NS"))),dB:$4($3.pipe($2("DB")))}).pipe($1({method:"GET",uri:"/export",code:200}))`,[m,g,h,c,x,l,S,__d0,i,d,p,C]):r(D,e));const O=/*@__PURE__*/ u(e=>e===n?s(`GetHealth`,`{input:#1,output:#4:0,errors:[],serviceErrors:$5,protocol:$6,retry:$7,telemetry:$8,span:"%"};$3(>2)@"%Request";$2({}).pipe($1({method:"GET",uri:"/health",code:200}))`,[m,g,l,S,__d0,i,d,p,C]):r(O,e));const k=/*@__PURE__*/ u(e=>e===n?[`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"GetKey"};$9(>2)@"GetKeyRequest";$8({table:$3.pipe($2()),limit:$6($5.pipe($4())),start:$6($5.pipe($4())),fields:$6($3.pipe($4())),nS:$6($3.pipe($7("NS"))),dB:$6($3.pipe($7("DB")))}).pipe($1({method:"GET",uri:"/key/{table}",code:200}))`,[m,g,v,c,y,a,x,h,l,S,__d0,i,d,p,C]]:r(k,e));const A=/*@__PURE__*/ u(a=>a===n?s(`GetKeyById`,`{input:#1,output:#6,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"%"};$7(>7)@"%Request";$7(>8)@"%ResponseBodyItemResultItem";$9(#2);$7(>9)@"%ResponseBodyItem";$9(#4);$7(>10)@"%Response";$6({table:$3.pipe($2()),id:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB")))}).pipe($1({method:"GET",uri:"/key/{table}/{id}",code:200}));$6({id:$5($3),some:$5($8)});$6({result:$5(#3),status:$5($3),time:$5($3)});#5.pipe($10())`,[m,g,v,c,h,x,l,S,t,e,b,i,d,p,C]):r(A,a));const j=/*@__PURE__*/ u(e=>e===n?s(`GetStatus`,`{input:#1,output:#4:0,errors:[],serviceErrors:$5,protocol:$6,retry:$7,telemetry:$8,span:"%"};$3(>2)@"%Request";$2({}).pipe($1({method:"GET",uri:"/status",code:200}))`,[m,g,l,S,__d0,i,d,p,C]):r(j,e));const M=/*@__PURE__*/ u(e=>e===n?s(`GetVersion`,`{input:#1,output:#4:0,errors:[],serviceErrors:$5,protocol:$6,retry:$7,telemetry:$8,span:"%"};$3(>2)@"%Request";$2({}).pipe($1({method:"GET",uri:"/version",code:200}))`,[m,g,l,S,__d0,i,d,p,C]):r(M,e));const N=/*@__PURE__*/ u(e=>e===n?[`{input:#1,output:#8:0,errors:[],serviceErrors:$9,protocol:$10,retry:$11,telemetry:$12,span:"Import"};$7(>2)@"ImportRequest";$6({nS:$4($3.pipe($2("NS"))),dB:$4($3.pipe($2("DB"))),body:$3.pipe($5())}).pipe($1({method:"POST",uri:"/import",code:200}))`,[m,g,h,c,x,_,l,S,__d0,i,d,p,C]]:r(N,e));const P=/*@__PURE__*/ u(e=>e===n?[`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"PutKey"};$9(>2)@"PutKeyRequest";$8({table:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB"))),body:#7:0.pipe($6())}).pipe($1({method:"PUT",uri:"/key/{table}",code:200}))`,[m,g,v,c,h,x,_,__d1,l,S,__d0,i,d,p,C]]:r(P,e));const F=/*@__PURE__*/ u(e=>e===n?s(`PutKeyById`,`{input:#1,output:#11:0,errors:[],serviceErrors:$12,protocol:$13,retry:$14,telemetry:$15,span:"%"};$10(>2)@"%Request";$9({table:$3.pipe($2()),id:$3.pipe($2()),tags:$5($3.pipe($4())),nS:$5($3.pipe($6("NS"))),dB:$5($3.pipe($6("DB"))),body:#8:0.pipe($7())}).pipe($1({method:"PUT",uri:"/key/{table}/{id}",code:200}))`,[m,g,v,c,y,x,h,_,__d1,l,S,__d0,i,d,p,C]):r(F,e));const I=/*@__PURE__*/ u(e=>e===n?s(`UpdateKey`,`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"%"};$9(>2)@"%Request";$8({table:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB"))),body:#7:0.pipe($6())}).pipe($1({method:"POST",uri:"/key/{table}",code:200}))`,[m,g,v,c,h,x,_,__d1,l,S,__d0,i,d,p,C]):r(I,e));const L=/*@__PURE__*/ u(e=>e===n?s(`UpdateKeyById`,`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"%"};$9(>2)@"%Request";$8({table:$3.pipe($2()),id:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB"))),body:#7:0.pipe($6())}).pipe($1({method:"POST",uri:"/key/{table}/{id}",code:200}))`,[m,g,v,c,h,x,_,__d1,l,S,__d0,i,d,p,C]):r(L,e));const R=/*@__PURE__*/ u(e=>e===n?[`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"UpdateKeyById2"};$9(>2)@"UpdateKeyByIdRequest2";$8({table:$3.pipe($2()),id:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB"))),body:#7:0.pipe($6())}).pipe($1({method:"PATCH",uri:"/key/{table}/{id}",code:200}))`,[m,g,v,c,h,x,_,__d1,l,S,__d0,i,d,p,C]]:r(R,e));const z=/*@__PURE__*/ u(e=>e===n?s(`UpdateKeyByTable`,`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"%"};$9(>2)@"%Request";$8({table:$3.pipe($2()),nS:$5($3.pipe($4("NS"))),dB:$5($3.pipe($4("DB"))),body:#7:0.pipe($6())}).pipe($1({method:"PATCH",uri:"/key/{table}",code:200}))`,[m,g,v,c,h,x,_,__d1,l,S,__d0,i,d,p,C]):r(z,e));function __d0(){return[`$2(>1)@"CreateSqlResponse";$1({})`,[m,l,S]]}function __d1(){return[`$3($1,$2)`,[m,c,f,o]]}export{N as Import,w as createSql,T as deleteKey,E as deleteKeyById,D as getExport,O as getHealth,k as getKey,A as getKeyById,j as getStatus,M as getVersion,P as putKey,F as putKeyById,I as updateKey,L as updateKeyById,R as updateKeyById2,z as updateKeyByTable};
|
|
2
2
|
//# sourceMappingURL=surrealdb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surrealdb.js","names":["API.D","API.named","__L.at","T.Http","T.Header","S.String","S.optional","T.HttpBody","S.Struct","S.suspend","Retry.Retry","API.call","T.Label","T.Query","S.Number","S.Boolean","S.Array","T.RawResponseRoot","S.Unknown","S.Record","Array","Boolean","
|
|
1
|
+
{"version":3,"file":"surrealdb.js","names":["API.D","API.named","__L.at","T.Http","T.Header","S.String","S.optional","T.HttpBody","S.Struct","S.suspend","Retry.Retry","API.call","T.Label","T.Query","S.Number","S.Boolean","S.Array","T.RawResponseRoot","S.Unknown","S.Record","Array","Boolean","D","call","SurrealdbServiceErrors","Number","Record","named","String","Struct","op","SurrealdbProtocol","Unknown","Retry","at","Header","Http","HttpBody","Label","Query","RawResponseRoot","optional","suspend","TELEMETRY","createSql","i","deleteKey","deleteKeyById","getExport","getHealth","getKey","getKeyById","getStatus","getVersion","Import","putKey","putKeyById","updateKey","updateKeyById","updateKeyById2","updateKeyByTable"],"sources":["../../src/services/surrealdb.ts"],"mappings":"wVAYA,MAAM2C,EAAY,CAChB,OAAQ,gBACR,gBAAiB,CACf,CAAE,OAAQ,eAAgB,KAAM,oCAAqC,UAAW,MAAO,EACvF,CAAE,OAAQ,aAAc,KAAM,kCAAmC,UAAW,MAAO,CACrF,EACA,OAAQ,YACR,QAAS,YACT,OAAQ,YACR,UAAW,KACb,EAyKA,MAAaC,EAKK,gBAAQ,GAAgBC,IAAM7C,EAAQC,EAAU,YAAa,6OAA8O,CAACC,EAAQC,EAAQC,EAAUC,EAAUC,EAAYC,EAAYC,EAAUC,EAAW,KAAMe,EAAwBO,EAAmBrB,EAAaiC,CAAS,CAAC,EAAIhC,EAASiC,EAAWC,CAAC,CAAC,EAIjf,MAAaC,EAKK,gBAAQ,GAAgBD,IAAM7C,EAAQC,EAAU,YAAa,wPAAyP,CAACC,EAAQC,EAAQS,EAASP,EAAUD,EAAUE,EAAYE,EAAUC,EAAW,KAAMe,EAAwBO,EAAmBrB,EAAaiC,CAAS,CAAC,EAAIhC,EAASmC,EAAWD,CAAC,CAAC,EAIzf,MAAaE,EAKK,gBAAQ,GAAgBF,IAAM7C,EAAQC,EAAU,gBAAiB,8QAA+Q,CAACC,EAAQC,EAAQS,EAASP,EAAUD,EAAUE,EAAYE,EAAUC,EAAW,KAAMe,EAAwBO,EAAmBrB,EAAaiC,CAAS,CAAC,EAAIhC,EAASoC,EAAeF,CAAC,CAAC,EAIvhB,MAAaG,EAKK,gBAAQ,GAAgBH,IAAM7C,EAAQC,EAAU,YAAa,2NAA4N,CAACC,EAAQC,EAAQC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AC,EAAIhC,EAASgD,EAAgBd,CAAC,CAAC,EAIhkB,MAAae,EAKK,gBAAQ,GAAgBf,IAAM7C,EAAQC,EAAU,mBAAoB,8QAA+Q,CAACC,EAAQC,EAAQS,EAASP,EAAUD,EAAUE,EAAYC,EAAY,KAAMC,EAAUC,EAAW,KAAMe,EAAwBO,EAAmBrB,EAAaiC,CAAS,CAAC,EAAIhC,EAASiD,EAAkBf,CAAC,CAAC,EAM/iB,SAAS,MAAY,CACnB,MAAO,CAAC,oCAAqC,CAAC3C,EAAQM,EAAUC,CAAS,CAAC,CAC5E,CACA,SAAS,MAAY,CACnB,MAAO,CAAC,YAAa,CAACP,EAAQG,EAAUa,EAAWC,CAAQ,CAAC,CAC9D"}
|
package/lib/traits.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traits.d.ts","
|
|
1
|
+
{"version":3,"file":"traits.d.ts","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qCAAqC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/surrealdb",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.22",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,18 +66,18 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@distilled.cloud/core": "1.0.0-rc.
|
|
69
|
+
"@distilled.cloud/core": "1.0.0-rc.22"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@distilled.cloud/dev": "0.0.0",
|
|
73
73
|
"@types/node": "26.6.5"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"effect": "
|
|
76
|
+
"effect": "~4.1.7"
|
|
77
77
|
},
|
|
78
78
|
"distilled": {
|
|
79
|
-
"generatedAt": "2026-11-
|
|
80
|
-
"specUpdatedAt": "2026-11-
|
|
79
|
+
"generatedAt": "2026-11-16",
|
|
80
|
+
"specUpdatedAt": "2026-11-26"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "tsrs -b",
|
package/src/credentials.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigError } from "@distilled.cloud/core/errors";
|
|
|
3
3
|
* SurrealDB credentials -- hand-written.
|
|
4
4
|
*
|
|
5
5
|
* The `Credentials` service holds an *effect* that resolves the current
|
|
6
|
-
* credentials on every request (the protocol
|
|
6
|
+
* credentials on every request (the protocol resolves it per request
|
|
7
7
|
* on the calling fiber). Auth is a JWT or API token sent as
|
|
8
8
|
* `Authorization: Bearer <apiKey>`. Self-hosted instances override the
|
|
9
9
|
* default base URL (`http://127.0.0.1:8000`).
|
|
@@ -21,7 +21,7 @@ export interface Config {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export class Credentials
|
|
24
|
-
extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config
|
|
24
|
+
extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
|
|
25
25
|
"SurrealdbCredentials",
|
|
26
26
|
) {}
|
|
27
27
|
|
|
@@ -38,21 +38,29 @@ export const fromApiKey = (config: {
|
|
|
38
38
|
}),
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Reads SURREALDB_API_KEY (required) and SURREALDB_API_BASE_URL (optional).
|
|
43
|
+
*
|
|
44
|
+
* Its configuration is read and checked once, when the layer is built: a
|
|
45
|
+
* problem there fails the layer with `ConfigError`.
|
|
46
|
+
*/
|
|
47
|
+
export const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError> = /*@__PURE__*/ Layer.effect(
|
|
43
48
|
Credentials,
|
|
44
|
-
/*@__PURE__*/ Effect.
|
|
45
|
-
|
|
49
|
+
/*@__PURE__*/ Effect.map(
|
|
50
|
+
/*@__PURE__*/ Effect.gen(function* () {
|
|
51
|
+
const apiKey = process.env.SURREALDB_API_KEY;
|
|
46
52
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
if (!apiKey) {
|
|
54
|
+
return yield* new ConfigError({
|
|
55
|
+
message: "SURREALDB_API_KEY environment variable is required",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
return {
|
|
60
|
+
apiKey: Redacted.make(apiKey),
|
|
61
|
+
apiBaseUrl: process.env.SURREALDB_API_BASE_URL ?? DEFAULT_API_BASE_URL,
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
64
|
+
(config) => Effect.succeed(config),
|
|
65
|
+
),
|
|
58
66
|
);
|
package/src/errors.ts
CHANGED
|
@@ -28,7 +28,7 @@ export {
|
|
|
28
28
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
29
29
|
|
|
30
30
|
import * as Category from "@distilled.cloud/core/category";
|
|
31
|
-
import { UnknownErrorFields } from "@distilled.cloud/core/errors";
|
|
31
|
+
import { API_ERRORS, UnknownErrorFields } from "@distilled.cloud/core/errors";
|
|
32
32
|
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
33
33
|
|
|
34
34
|
/** Unknown SurrealDB error -- returned when nothing else matches the failure. */
|
|
@@ -44,3 +44,11 @@ export class SurrealdbParseError
|
|
|
44
44
|
body: Schema.Unknown,
|
|
45
45
|
cause: Schema.Unknown,
|
|
46
46
|
}).pipe(Category.withParseError) {}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The errors declared on the SurrealDB service: any operation can return them,
|
|
50
|
+
* and every generated operation lists them as its `serviceErrors`. Today that
|
|
51
|
+
* is each of core's status classes (401, 403, 404, 429, the 5xx ...).
|
|
52
|
+
*/
|
|
53
|
+
export const SurrealdbServiceErrors = API_ERRORS;
|
|
54
|
+
export type SurrealdbServiceError = InstanceType<(typeof SurrealdbServiceErrors)[number]>;
|
package/src/protocol.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import
|
|
3
|
-
import { makeRestProtocol, unknownErrorProps } from "@distilled.cloud/core/protocol-rest";
|
|
4
|
-
import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
1
|
+
import type { ErrorOf } from "@distilled.cloud/core/protocol";
|
|
2
|
+
import { restProtocol, unknownErrorProps } from "@distilled.cloud/core/protocol-rest";
|
|
5
3
|
/**
|
|
6
4
|
* SurrealdbProtocol -- hand-written.
|
|
7
5
|
*
|
|
8
6
|
* SurrealDB speaks bearer-authenticated JSON REST (no response envelope),
|
|
9
|
-
* so the whole protocol is one `
|
|
7
|
+
* so the whole protocol is one `restProtocol` call from
|
|
10
8
|
* `core/protocol-rest`:
|
|
11
9
|
*
|
|
12
10
|
* request: credentials -> `Authorization: Bearer <apiKey>` +
|
|
@@ -22,34 +20,30 @@ import type { SdkError } from "@distilled.cloud/core/sdk-error";
|
|
|
22
20
|
*/
|
|
23
21
|
import * as Effect from "effect/Effect";
|
|
24
22
|
import type * as HttpClient from "effect/http/HttpClient";
|
|
25
|
-
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
26
|
-
import type * as Layer from "effect/Layer";
|
|
27
23
|
import * as Redacted from "effect/Redacted";
|
|
28
|
-
import { Credentials
|
|
29
|
-
import {
|
|
24
|
+
import { Credentials } from "./credentials.ts";
|
|
25
|
+
import {
|
|
26
|
+
UnknownSurrealdbError,
|
|
27
|
+
SurrealdbParseError,
|
|
28
|
+
type SurrealdbServiceError,
|
|
29
|
+
} from "./errors.ts";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* service
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* What every generated SurrealDB operation fails with besides its own errors:
|
|
33
|
+
* the service's errors, the protocol's, and what resolving the credentials
|
|
34
|
+
* fails with. Generated service files annotate operations with
|
|
35
|
+
* `API.OperationMethod<I, O, SurrealdbOpError, SurrealdbOpContext>` explicitly
|
|
36
|
+
* so the compiler never infers these back out of the schema generics.
|
|
36
37
|
*/
|
|
37
|
-
export type SurrealdbOpError =
|
|
38
|
-
| InstanceType<(typeof API_ERRORS)[number]>
|
|
39
|
-
| UnknownSurrealdbError
|
|
40
|
-
| ConfigError
|
|
41
|
-
| HttpClientError.HttpClientError
|
|
42
|
-
| SurrealdbParseError
|
|
43
|
-
| InvalidInput
|
|
44
|
-
| SdkError;
|
|
38
|
+
export type SurrealdbOpError = SurrealdbServiceError | ErrorOf<typeof SurrealdbProtocol>;
|
|
45
39
|
|
|
46
40
|
/** Context (requirements) shared by every generated SurrealDB operation. */
|
|
47
41
|
export type SurrealdbOpContext = Credentials | HttpClient.HttpClient;
|
|
48
42
|
|
|
49
|
-
export const SurrealdbProtocol
|
|
43
|
+
export const SurrealdbProtocol = /*@__PURE__*/ restProtocol({
|
|
50
44
|
// The Credentials service holds an effect -- resolving it here (per
|
|
51
45
|
// request, on the calling fiber) picks up context-provided credentials.
|
|
52
|
-
credentials: /*@__PURE__*/ Effect.
|
|
46
|
+
credentials: /*@__PURE__*/ Effect.flatten(Credentials),
|
|
53
47
|
baseUrl: (creds) => creds.apiBaseUrl,
|
|
54
48
|
headers: (creds) => ({
|
|
55
49
|
Accept: "application/json",
|
|
@@ -2,7 +2,7 @@ import * as API from "@distilled.cloud/core/api";
|
|
|
2
2
|
// AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-surrealdb). Do not edit.
|
|
3
3
|
import * as S from "@distilled.cloud/core/schema-lite";
|
|
4
4
|
import * as __L from "@distilled.cloud/core/schema-lite";
|
|
5
|
-
import {
|
|
5
|
+
import { SurrealdbServiceErrors } from "../errors.ts";
|
|
6
6
|
import { SurrealdbProtocol, type SurrealdbOpError, type SurrealdbOpContext } from "../protocol.ts";
|
|
7
7
|
import * as Retry from "../retry.ts";
|
|
8
8
|
import * as T from "../traits.ts";
|
|
@@ -199,7 +199,8 @@ export const createSql: API.OperationMethod<
|
|
|
199
199
|
> = /*@__PURE__*/ API.make(() => ({
|
|
200
200
|
input: __S(0, __c0, 0) as any as S.Schema<CreateSqlRequest>,
|
|
201
201
|
output: __S(8, __c1, 0) as any as S.Schema<CreateSqlResponse>,
|
|
202
|
-
errors: [
|
|
202
|
+
errors: [],
|
|
203
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
203
204
|
protocol: SurrealdbProtocol,
|
|
204
205
|
retry: Retry.Retry,
|
|
205
206
|
telemetry: TELEMETRY,
|
|
@@ -216,7 +217,8 @@ export const deleteKey: API.OperationMethod<
|
|
|
216
217
|
> = /*@__PURE__*/ API.make(() => ({
|
|
217
218
|
input: __S(16, __c2, 0) as any as S.Schema<DeleteKeyRequest>,
|
|
218
219
|
output: __S(8, __c1, 0) as any as S.Schema<DeleteKeyResponse>,
|
|
219
|
-
errors: [
|
|
220
|
+
errors: [],
|
|
221
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
220
222
|
protocol: SurrealdbProtocol,
|
|
221
223
|
retry: Retry.Retry,
|
|
222
224
|
telemetry: TELEMETRY,
|
|
@@ -233,7 +235,8 @@ export const deleteKeyById: API.OperationMethod<
|
|
|
233
235
|
> = /*@__PURE__*/ API.make(() => ({
|
|
234
236
|
input: __S(80, __c10, 0) as any as S.Schema<DeleteKeyByIdRequest>,
|
|
235
237
|
output: __S(8, __c1, 0) as any as S.Schema<DeleteKeyByIdResponse>,
|
|
236
|
-
errors: [
|
|
238
|
+
errors: [],
|
|
239
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
237
240
|
protocol: SurrealdbProtocol,
|
|
238
241
|
retry: Retry.Retry,
|
|
239
242
|
telemetry: TELEMETRY,
|
|
@@ -250,7 +253,8 @@ export const getExport: API.OperationMethod<
|
|
|
250
253
|
> = /*@__PURE__*/ API.make(() => ({
|
|
251
254
|
input: __S(88, __c11, 0) as any as S.Schema<GetExportRequest>,
|
|
252
255
|
output: __S(8, __c1, 0) as any as S.Schema<GetExportResponse>,
|
|
253
|
-
errors: [
|
|
256
|
+
errors: [],
|
|
257
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
254
258
|
protocol: SurrealdbProtocol,
|
|
255
259
|
retry: Retry.Retry,
|
|
256
260
|
telemetry: TELEMETRY,
|
|
@@ -267,7 +271,8 @@ export const getHealth: API.OperationMethod<
|
|
|
267
271
|
> = /*@__PURE__*/ API.make(() => ({
|
|
268
272
|
input: __S(96, __c12, 0) as any as S.Schema<GetHealthRequest>,
|
|
269
273
|
output: __S(8, __c1, 0) as any as S.Schema<GetHealthResponse>,
|
|
270
|
-
errors: [
|
|
274
|
+
errors: [],
|
|
275
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
271
276
|
protocol: SurrealdbProtocol,
|
|
272
277
|
retry: Retry.Retry,
|
|
273
278
|
telemetry: TELEMETRY,
|
|
@@ -284,7 +289,8 @@ export const getKey: API.OperationMethod<
|
|
|
284
289
|
> = /*@__PURE__*/ API.make(() => ({
|
|
285
290
|
input: __S(104, __c13, 0) as any as S.Schema<GetKeyRequest>,
|
|
286
291
|
output: __S(8, __c1, 0) as any as S.Schema<GetKeyResponse>,
|
|
287
|
-
errors: [
|
|
292
|
+
errors: [],
|
|
293
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
288
294
|
protocol: SurrealdbProtocol,
|
|
289
295
|
retry: Retry.Retry,
|
|
290
296
|
telemetry: TELEMETRY,
|
|
@@ -301,7 +307,8 @@ export const getKeyById: API.OperationMethod<
|
|
|
301
307
|
> = /*@__PURE__*/ API.make(() => ({
|
|
302
308
|
input: __S(112, __c14, 0) as any as S.Schema<GetKeyByIdRequest>,
|
|
303
309
|
output: __S(117, __c14, 5) as any as S.Schema<GetKeyByIdResponse>,
|
|
304
|
-
errors: [
|
|
310
|
+
errors: [],
|
|
311
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
305
312
|
protocol: SurrealdbProtocol,
|
|
306
313
|
retry: Retry.Retry,
|
|
307
314
|
telemetry: TELEMETRY,
|
|
@@ -318,7 +325,8 @@ export const getStatus: API.OperationMethod<
|
|
|
318
325
|
> = /*@__PURE__*/ API.make(() => ({
|
|
319
326
|
input: __S(120, __c15, 0) as any as S.Schema<GetStatusRequest>,
|
|
320
327
|
output: __S(8, __c1, 0) as any as S.Schema<GetStatusResponse>,
|
|
321
|
-
errors: [
|
|
328
|
+
errors: [],
|
|
329
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
322
330
|
protocol: SurrealdbProtocol,
|
|
323
331
|
retry: Retry.Retry,
|
|
324
332
|
telemetry: TELEMETRY,
|
|
@@ -335,7 +343,8 @@ export const getVersion: API.OperationMethod<
|
|
|
335
343
|
> = /*@__PURE__*/ API.make(() => ({
|
|
336
344
|
input: __S(128, __c16, 0) as any as S.Schema<GetVersionRequest>,
|
|
337
345
|
output: __S(8, __c1, 0) as any as S.Schema<GetVersionResponse>,
|
|
338
|
-
errors: [
|
|
346
|
+
errors: [],
|
|
347
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
339
348
|
protocol: SurrealdbProtocol,
|
|
340
349
|
retry: Retry.Retry,
|
|
341
350
|
telemetry: TELEMETRY,
|
|
@@ -352,7 +361,8 @@ export const Import: API.OperationMethod<
|
|
|
352
361
|
> = /*@__PURE__*/ API.make(() => ({
|
|
353
362
|
input: __S(136, __c17, 0) as any as S.Schema<ImportRequest>,
|
|
354
363
|
output: __S(8, __c1, 0) as any as S.Schema<ImportResponse>,
|
|
355
|
-
errors: [
|
|
364
|
+
errors: [],
|
|
365
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
356
366
|
protocol: SurrealdbProtocol,
|
|
357
367
|
retry: Retry.Retry,
|
|
358
368
|
telemetry: TELEMETRY,
|
|
@@ -369,7 +379,8 @@ export const putKey: API.OperationMethod<
|
|
|
369
379
|
> = /*@__PURE__*/ API.make(() => ({
|
|
370
380
|
input: __S(24, __c3, 0) as any as S.Schema<PutKeyRequest>,
|
|
371
381
|
output: __S(8, __c1, 0) as any as S.Schema<PutKeyResponse>,
|
|
372
|
-
errors: [
|
|
382
|
+
errors: [],
|
|
383
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
373
384
|
protocol: SurrealdbProtocol,
|
|
374
385
|
retry: Retry.Retry,
|
|
375
386
|
telemetry: TELEMETRY,
|
|
@@ -386,7 +397,8 @@ export const putKeyById: API.OperationMethod<
|
|
|
386
397
|
> = /*@__PURE__*/ API.make(() => ({
|
|
387
398
|
input: __S(40, __c5, 0) as any as S.Schema<PutKeyByIdRequest>,
|
|
388
399
|
output: __S(8, __c1, 0) as any as S.Schema<PutKeyByIdResponse>,
|
|
389
|
-
errors: [
|
|
400
|
+
errors: [],
|
|
401
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
390
402
|
protocol: SurrealdbProtocol,
|
|
391
403
|
retry: Retry.Retry,
|
|
392
404
|
telemetry: TELEMETRY,
|
|
@@ -403,7 +415,8 @@ export const updateKey: API.OperationMethod<
|
|
|
403
415
|
> = /*@__PURE__*/ API.make(() => ({
|
|
404
416
|
input: __S(48, __c6, 0) as any as S.Schema<UpdateKeyRequest>,
|
|
405
417
|
output: __S(8, __c1, 0) as any as S.Schema<UpdateKeyResponse>,
|
|
406
|
-
errors: [
|
|
418
|
+
errors: [],
|
|
419
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
407
420
|
protocol: SurrealdbProtocol,
|
|
408
421
|
retry: Retry.Retry,
|
|
409
422
|
telemetry: TELEMETRY,
|
|
@@ -420,7 +433,8 @@ export const updateKeyById: API.OperationMethod<
|
|
|
420
433
|
> = /*@__PURE__*/ API.make(() => ({
|
|
421
434
|
input: __S(56, __c7, 0) as any as S.Schema<UpdateKeyByIdRequest>,
|
|
422
435
|
output: __S(8, __c1, 0) as any as S.Schema<UpdateKeyByIdResponse>,
|
|
423
|
-
errors: [
|
|
436
|
+
errors: [],
|
|
437
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
424
438
|
protocol: SurrealdbProtocol,
|
|
425
439
|
retry: Retry.Retry,
|
|
426
440
|
telemetry: TELEMETRY,
|
|
@@ -437,7 +451,8 @@ export const updateKeyById2: API.OperationMethod<
|
|
|
437
451
|
> = /*@__PURE__*/ API.make(() => ({
|
|
438
452
|
input: __S(64, __c8, 0) as any as S.Schema<UpdateKeyByIdRequest2>,
|
|
439
453
|
output: __S(8, __c1, 0) as any as S.Schema<UpdateKeyById2Response>,
|
|
440
|
-
errors: [
|
|
454
|
+
errors: [],
|
|
455
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
441
456
|
protocol: SurrealdbProtocol,
|
|
442
457
|
retry: Retry.Retry,
|
|
443
458
|
telemetry: TELEMETRY,
|
|
@@ -454,7 +469,8 @@ export const updateKeyByTable: API.OperationMethod<
|
|
|
454
469
|
> = /*@__PURE__*/ API.make(() => ({
|
|
455
470
|
input: __S(72, __c9, 0) as any as S.Schema<UpdateKeyByTableRequest>,
|
|
456
471
|
output: __S(8, __c1, 0) as any as S.Schema<UpdateKeyByTableResponse>,
|
|
457
|
-
errors: [
|
|
472
|
+
errors: [],
|
|
473
|
+
serviceErrors: SurrealdbServiceErrors,
|
|
458
474
|
protocol: SurrealdbProtocol,
|
|
459
475
|
retry: Retry.Retry,
|
|
460
476
|
telemetry: TELEMETRY,
|