@distilled.cloud/axiom 1.0.0-rc.15 → 1.0.0-rc.17
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/lib/.lazy.json +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +4 -4
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +1 -56
- package/lib/edge-ingest.d.ts +1 -1
- package/lib/edge-ingest.js +1 -7
- package/lib/edge-ingest.lazy.js +1 -0
- package/lib/edge-query.d.ts +1 -1
- package/lib/edge-query.js +1 -7
- package/lib/edge-query.lazy.js +1 -0
- package/lib/errors.d.ts +15 -15
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -26
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -25
- package/lib/index.lazy.js +8 -0
- package/lib/{index.js.map → index.lazy.js.map} +1 -1
- package/lib/protocol.d.ts +1 -1
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +1 -87
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -32
- package/lib/services/edge_ingest.d.ts +7 -11
- package/lib/services/edge_ingest.d.ts.map +1 -1
- package/lib/services/edge_ingest.js +1 -53
- package/lib/services/edge_ingest.js.map +1 -1
- package/lib/services/edge_query.d.ts +0 -9
- package/lib/services/edge_query.d.ts.map +1 -1
- package/lib/services/edge_query.js +1 -76
- package/lib/services/edge_query.js.map +1 -1
- package/lib/services/index.js +0 -2
- package/lib/services/v2.d.ts +18 -475
- package/lib/services/v2.d.ts.map +1 -1
- package/lib/services/v2.js +113 -2235
- package/lib/services/v2.js.map +1 -1
- package/lib/services.lazy/edge_ingest.js +1 -0
- package/lib/services.lazy/edge_query.js +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/v2.js +4 -0
- package/lib/traits.d.ts +1 -1
- package/lib/traits.js +1 -11
- package/package.json +11 -7
- package/src/credentials.ts +17 -16
- package/src/edge-ingest.ts +1 -1
- package/src/edge-query.ts +1 -1
- package/src/errors.ts +14 -15
- package/src/index.ts +2 -2
- package/src/protocol.ts +10 -13
- package/src/retry.ts +6 -4
- package/src/services/edge_ingest.ts +46 -35
- package/src/services/edge_query.ts +90 -88
- package/src/services/v2.ts +1847 -2856
- package/src/traits.ts +1 -1
- package/lib/credentials.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/protocol.js.map +0 -1
- package/lib/retry.js.map +0 -1
- package/lib/services/index.js.map +0 -1
- package/lib/traits.js.map +0 -1
- /package/lib/{edge-ingest.js.map → edge-ingest.lazy.js.map} +0 -0
- /package/lib/{edge-query.js.map → edge-query.lazy.js.map} +0 -0
package/lib/.lazy.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"serviceDirs":["services"],"twins":["edge-ingest.js","edge-query.js","index.js"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as ee,api$op as te,category$withAuthError as i,category$withBadRequestError as a,category$withConflictError as o,category$withParseError as s,category$withServerError as ne,config$String as c,config$all as re,config$option as l,config$withDefault as ie,retry$capped as ae,retry$jittered as oe,retry$makeDefault as se,retry$throttlingFactory as u,retry$throttlingOptions as d,retry$transientFactory as f,retry$transientOptions as p,trait$Body as m,trait$FormDataFile as h,trait$Header as g,trait$Http as _,trait$HttpBody as v,trait$KeyDictionary as y,trait$Label as b,trait$Query as x,trait$ResponseCode as S,trait$UnionCases as C,trait$applyErrorMatchers as w,trait$bodySymbol as T,trait$errorMatchersSymbol as E,trait$formDataFileSymbol as D,trait$getErrorMatchers as O,trait$headerSymbol as k,trait$httpBodySymbol as A,trait$httpSymbol as j,trait$keyDictionarySymbol as M,trait$labelSymbol as N,trait$querySymbol as P,trait$responseCodeSymbol as F,trait$unionCasesSymbol as I}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as L,errors$BadGateway as R,errors$BadRequest as z,errors$ConfigError as B,errors$Conflict as V,errors$DEFAULT_ERRORS as H,errors$Forbidden as U,errors$GatewayTimeout as W,errors$HTTP_STATUS_MAP as G,errors$InternalServerError as K,errors$Locked as ce,errors$NotFound as le,errors$ServiceUnavailable as ue,errors$TooManyRequests as de,errors$Unauthorized as fe,errors$UnprocessableEntity as pe,protocol_rest$RawResponse as me,protocol_rest$RawResponseRoot as he,protocol_rest$SensitiveValue as ge,protocol_rest$makeRestProtocol as _e,protocol_rest$rawResponseRootSymbol as ve,protocol_rest$rawResponseSymbol as ye,protocol_rest$sensitiveValueSymbol as be,schema_lite$Array as xe,schema_lite$Boolean as Se,schema_lite$NullOr as Ce,schema_lite$Number as we,schema_lite$Record as Te,schema_lite$String as Ee,schema_lite$Struct as De,schema_lite$TaggedError as Oe,schema_lite$Unknown as ke,schema_lite$at as Ae,schema_lite$optional as je,schema_lite$suspend as Me}from"@distilled.cloud/core/_bundle/rest";import*as q from"effect/Context";import*as J from"effect/Effect";import*as Y from"effect/Layer";import*as X from"effect/Option";import*as Z from"effect/Redacted";import*as Q from"@distilled.cloud/core/schema-lite-typed";const $=`https://api.axiom.co`;var Credentials=class extends (/*@__PURE__*/ q.Service()(`AxiomCredentials`)){};const fromApiKey=e=>Y.succeed(Credentials,J.succeed({apiKey:e.apiKey,apiBaseUrl:e.apiBaseUrl??`https://api.axiom.co`,orgId:e.orgId}));const Ne=/*@__PURE__*/ re({apiToken:/*@__PURE__*/ l(/*@__PURE__*/ c(`AXIOM_TOKEN`)),apiKey:/*@__PURE__*/ l(/*@__PURE__*/ c(`AXIOM_API_KEY`)),apiBaseUrl:/*@__PURE__*/ c(`AXIOM_URL`).pipe(/*@__PURE__*/ ie($)),orgId:/*@__PURE__*/ l(/*@__PURE__*/ c(`AXIOM_ORG_ID`))});const Pe=/*@__PURE__*/ Y.succeed(Credentials,/*@__PURE__*/ J.gen(function*(){const e=yield*Ne.pipe(J.mapError(()=>new B({message:`AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required`})));const t=X.getOrUndefined(e.apiToken)??X.getOrUndefined(e.apiKey);if(!t)return yield*new B({message:`AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required`});return{apiKey:Z.make(t),apiBaseUrl:e.apiBaseUrl,orgId:X.getOrUndefined(e.orgId)}}).pipe(J.orDie));var UnknownAxiomError=class extends (/*@__PURE__*/ Q.TaggedError()(`UnknownAxiomError`,{code:/*@__PURE__*/ Q.optional(Q.String),message:/*@__PURE__*/ Q.optional(Q.String),body:Q.Unknown}).pipe(ne)){};var AxiomParseError=class extends (/*@__PURE__*/ Q.TaggedError()(`AxiomParseError`,{body:Q.Unknown,cause:Q.Unknown}).pipe(s)){};const stripNulls=e=>{if(Array.isArray(e))return e.map(stripNulls);if(e&&typeof e===`object`){const t={};for(const[n,r]of Object.entries(e)){if(r===null)continue;t[n]=stripNulls(r)}return t}return e};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;const n=typeof t.error===`string`?t.error:void 0;return{code:typeof t.code===`string`||typeof t.code===`number`?t.code:n,message:typeof t.message===`string`?t.message:n}};const Fe=/*@__PURE__*/ _e({credentials:/*@__PURE__*/ J.flatMap(Credentials,e=>e),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:`Bearer ${Z.value(e.apiKey)}`,...e.orgId?{"X-Axiom-Org-ID":e.orgId}:{}}),errorEnvelope,transformResponse:stripNulls,unknownError:({code:e,message:t,body:n})=>new UnknownAxiomError({code:typeof e===`number`?String(e):e,message:t,body:n}),parseError:({body:e,cause:t})=>new AxiomParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ q.Service()(`AxiomRetry`)){};const policy=e=>J.provide(Y.succeed(Retry,e));const Ie=/*@__PURE__*/ J.provide(/*@__PURE__*/ Y.succeed(Retry,{while:()=>false}));const Le=/*@__PURE__*/ policy(u);const Re=/*@__PURE__*/ policy(f);export{ee as _,Te as a,a as b,Oe as c,Credentials as credentials$Credentials,Pe as credentials$CredentialsFromEnv,$ as credentials$DEFAULT_API_BASE_URL,fromApiKey as credentials$fromApiKey,je as d,L as errors$API_ERRORS,AxiomParseError as errors$AxiomParseError,R as errors$BadGateway,z as errors$BadRequest,B as errors$ConfigError,V as errors$Conflict,H as errors$DEFAULT_ERRORS,U as errors$Forbidden,W as errors$GatewayTimeout,G as errors$HTTP_STATUS_MAP,K as errors$InternalServerError,ce as errors$Locked,le as errors$NotFound,ue as errors$ServiceUnavailable,de as errors$TooManyRequests,fe as errors$Unauthorized,UnknownAxiomError as errors$UnknownAxiomError,pe as errors$UnprocessableEntity,Me as f,r as g,n as h,we as i,ke as l,t as m,Se as n,Ee as o,e as p,Fe as protocol$AxiomProtocol,stripNulls as protocol$stripNulls,Ce as r,Retry as retry$Retry,ae as retry$capped,oe as retry$jittered,se as retry$makeDefault,Ie as retry$none,policy as retry$policy,Le as retry$throttling,u as retry$throttlingFactory,d as retry$throttlingOptions,Re as retry$transient,f as retry$transientFactory,p as retry$transientOptions,De as s,xe as t,m as traits$Body,h as traits$FormDataFile,g as traits$Header,_ as traits$Http,v as traits$HttpBody,y as traits$KeyDictionary,b as traits$Label,x as traits$Query,me as traits$RawResponse,he as traits$RawResponseRoot,S as traits$ResponseCode,ge as traits$SensitiveValue,C as traits$UnionCases,w as traits$applyErrorMatchers,T as traits$bodySymbol,E as traits$errorMatchersSymbol,D as traits$formDataFileSymbol,O as traits$getErrorMatchers,k as traits$headerSymbol,A as traits$httpBodySymbol,j as traits$httpSymbol,M as traits$keyDictionarySymbol,N as traits$labelSymbol,P as traits$querySymbol,ve as traits$rawResponseRootSymbol,ye as traits$rawResponseSymbol,F as traits$responseCodeSymbol,be as traits$sensitiveValueSymbol,I as traits$unionCasesSymbol,Ae as u,te as v,o as x,i as y};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Category.withServerError","Category.withParseError","D","call","error","named","newError","op","withAuthError","withBadRequestError","withConflictError","withParseError","withServerError","String$2","all$1","option","withDefault","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnprocessableEntity","RawResponse","RawResponseRoot","SensitiveValue","makeRestProtocol","rawResponseRootSymbol","rawResponseSymbol","sensitiveValueSymbol","Array$1","Boolean","NullOr","Number","Record","String$1","Struct","TaggedError","Unknown","at","optional","suspend","Context","Effect","Layer","Option","Redacted","Schema","DEFAULT_API_BASE_URL","config","envConfig","CredentialsFromEnv","apiKey","value","out","k","v","body","b","AxiomProtocol","resolve","creds","code","optionsOrFactory","none","throttling","transient"],"sources":["../../src/credentials.ts","../../src/errors.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"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"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface Config {
|
|
|
15
15
|
readonly orgId?: string;
|
|
16
16
|
}
|
|
17
17
|
declare const Credentials_base: Context.ServiceClass<Credentials, "AxiomCredentials", Effect.Effect<Config, never, never>>;
|
|
18
|
-
export declare class Credentials extends Credentials_base {
|
|
18
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
19
19
|
}
|
|
20
20
|
/** Layer from a redacted API token + optional base URL / org ID. */
|
|
21
21
|
export declare const fromApiKey: (config: {
|
|
@@ -26,10 +26,10 @@ export declare const fromApiKey: (config: {
|
|
|
26
26
|
/**
|
|
27
27
|
* Build {@link Credentials} from environment variables.
|
|
28
28
|
*
|
|
29
|
-
* - `AXIOM_TOKEN` or `AXIOM_API_KEY` (required)
|
|
30
|
-
* - `AXIOM_URL` (optional)
|
|
29
|
+
* - `AXIOM_TOKEN` or `AXIOM_API_KEY` (required) -- Axiom API token or PAT.
|
|
30
|
+
* - `AXIOM_URL` (optional) -- override the API base URL (for self-hosted or
|
|
31
31
|
* regional edge deployments). Defaults to `https://api.axiom.co`.
|
|
32
|
-
* - `AXIOM_ORG_ID` (optional)
|
|
32
|
+
* - `AXIOM_ORG_ID` (optional) -- organization ID, required for PATs.
|
|
33
33
|
*/
|
|
34
34
|
export declare const CredentialsFromEnv: Layer.Layer<Credentials>;
|
|
35
35
|
export {};
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;;AAED,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAAyE;CAAG;AAEpG,oEAAoE;AACpE,eAAO,MAAM,UAAU,WAAY;IACjC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAQxB,CAAC;AAWJ;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAyBvD,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Axiom credentials — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* API-compatible port of the distilled v0 axiom credentials module: the
|
|
6
|
-
* `Credentials` service holds an *effect* that resolves the current
|
|
7
|
-
* credentials on every request (the protocol layer resolves it per request
|
|
8
|
-
* on the calling fiber).
|
|
9
|
-
*/
|
|
10
|
-
import * as EffectConfig from "effect/Config";
|
|
11
|
-
import * as Context from "effect/Context";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
|
-
import * as Layer from "effect/Layer";
|
|
14
|
-
import * as Option from "effect/Option";
|
|
15
|
-
import * as Redacted from "effect/Redacted";
|
|
16
|
-
/** Default base URL for Axiom Cloud. Self-hosted users can override via AXIOM_URL. */
|
|
17
|
-
export const DEFAULT_API_BASE_URL = "https://api.axiom.co";
|
|
18
|
-
export class Credentials extends Context.Service()("AxiomCredentials") {
|
|
19
|
-
}
|
|
20
|
-
/** Layer from a redacted API token + optional base URL / org ID. */
|
|
21
|
-
export const fromApiKey = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
22
|
-
apiKey: config.apiKey,
|
|
23
|
-
apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
24
|
-
orgId: config.orgId,
|
|
25
|
-
}));
|
|
26
|
-
const envConfig = EffectConfig.all({
|
|
27
|
-
apiToken: EffectConfig.option(EffectConfig.String("AXIOM_TOKEN")),
|
|
28
|
-
apiKey: EffectConfig.option(EffectConfig.String("AXIOM_API_KEY")),
|
|
29
|
-
apiBaseUrl: EffectConfig.String("AXIOM_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
|
|
30
|
-
orgId: EffectConfig.option(EffectConfig.String("AXIOM_ORG_ID")),
|
|
31
|
-
});
|
|
32
|
-
/**
|
|
33
|
-
* Build {@link Credentials} from environment variables.
|
|
34
|
-
*
|
|
35
|
-
* - `AXIOM_TOKEN` or `AXIOM_API_KEY` (required) — Axiom API token or PAT.
|
|
36
|
-
* - `AXIOM_URL` (optional) — override the API base URL (for self-hosted or
|
|
37
|
-
* regional edge deployments). Defaults to `https://api.axiom.co`.
|
|
38
|
-
* - `AXIOM_ORG_ID` (optional) — organization ID, required for PATs.
|
|
39
|
-
*/
|
|
40
|
-
export const CredentialsFromEnv = Layer.succeed(Credentials, Effect.gen(function* () {
|
|
41
|
-
const config = yield* envConfig.pipe(Effect.mapError(() => new ConfigError({
|
|
42
|
-
message: "AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required",
|
|
43
|
-
})));
|
|
44
|
-
const apiKey = Option.getOrUndefined(config.apiToken) ?? Option.getOrUndefined(config.apiKey);
|
|
45
|
-
if (!apiKey) {
|
|
46
|
-
return yield* new ConfigError({
|
|
47
|
-
message: "AXIOM_TOKEN (or AXIOM_API_KEY) environment variable is required",
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
apiKey: Redacted.make(apiKey),
|
|
52
|
-
apiBaseUrl: config.apiBaseUrl,
|
|
53
|
-
orgId: Option.getOrUndefined(config.orgId),
|
|
54
|
-
};
|
|
55
|
-
}).pipe(Effect.orDie));
|
|
56
|
-
//# sourceMappingURL=credentials.js.map
|
|
1
|
+
export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL, credentials$fromApiKey as fromApiKey } from "./_bundle/sdk.js";
|
package/lib/edge-ingest.d.ts
CHANGED
package/lib/edge-ingest.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* `@distilled.cloud/axiom/edge-ingest` — the v1 edge ingest API
|
|
3
|
-
* (`ingestToDataset`), served from the same canonical host
|
|
4
|
-
* (https://api.axiom.co) under the `/v1` prefix.
|
|
5
|
-
*/
|
|
6
|
-
export * from "./services/edge_ingest.js";
|
|
7
|
-
//# sourceMappingURL=edge-ingest.js.map
|
|
1
|
+
import{BadRequest as e,NotFound as t,UnprocessableEntity as n,ingestToDataset as r}from"./services/edge_ingest.js";export{e as BadRequest,t as NotFound,n as UnprocessableEntity,r as ingestToDataset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BadRequest as e,NotFound as t,UnprocessableEntity as n,ingestToDataset as r}from"./services.lazy/edge_ingest.js";export{e as BadRequest,t as NotFound,n as UnprocessableEntity,r as ingestToDataset};
|
package/lib/edge-query.d.ts
CHANGED
package/lib/edge-query.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* `@distilled.cloud/axiom/edge-query` — the v1 edge query API (`queryApl`),
|
|
3
|
-
* served from the same canonical host (https://api.axiom.co) under the `/v1`
|
|
4
|
-
* prefix.
|
|
5
|
-
*/
|
|
6
|
-
export * from "./services/edge_query.js";
|
|
7
|
-
//# sourceMappingURL=edge-query.js.map
|
|
1
|
+
import{queryApl as e}from"./services/edge_query.js";export{e as queryApl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{queryApl as e}from"./services.lazy/edge_query.js";export{e as queryApl};
|
package/lib/errors.d.ts
CHANGED
|
@@ -3,34 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the common HTTP errors from core and adds the Axiom fallback
|
|
5
5
|
* errors. Note the generated service modules additionally define their own
|
|
6
|
-
* per-status matcher classes (BadRequest/NotFound
|
|
7
|
-
* operation declares
|
|
6
|
+
* per-status matcher classes (BadRequest/NotFound/...) for the statuses each
|
|
7
|
+
* operation declares -- those share `_tag`s with the core classes here, so
|
|
8
8
|
* `catchTag` works against either.
|
|
9
9
|
*/
|
|
10
10
|
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
11
11
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
12
|
-
import * as Schema from "
|
|
13
|
-
declare const UnknownAxiomError_base: Schema.
|
|
14
|
-
readonly code: Schema.optional<Schema.String>;
|
|
15
|
-
readonly message: Schema.optional<Schema.String>;
|
|
16
|
-
readonly body: Schema.Unknown;
|
|
17
|
-
}
|
|
12
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
13
|
+
declare const UnknownAxiomError_base: Schema.TaggedErrorClass<"UnknownAxiomError", {
|
|
14
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
15
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
16
|
+
readonly body: import("effect/Schema").Unknown;
|
|
17
|
+
}> & (new (...args: any[]) => {
|
|
18
18
|
"@distilled.cloud/error/categories": {
|
|
19
19
|
ServerError: true;
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
|
-
/** Unknown Axiom error
|
|
23
|
-
export declare class UnknownAxiomError extends UnknownAxiomError_base {
|
|
22
|
+
/** Unknown Axiom error -- returned when nothing else matches the failure. */
|
|
23
|
+
export declare class UnknownAxiomError extends /*@__PURE__*/ UnknownAxiomError_base {
|
|
24
24
|
}
|
|
25
|
-
declare const AxiomParseError_base: Schema.
|
|
26
|
-
readonly body: Schema.Unknown;
|
|
27
|
-
readonly cause: Schema.Unknown;
|
|
28
|
-
}
|
|
25
|
+
declare const AxiomParseError_base: Schema.TaggedErrorClass<"AxiomParseError", {
|
|
26
|
+
readonly body: import("effect/Schema").Unknown;
|
|
27
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
28
|
+
}> & (new (...args: any[]) => {
|
|
29
29
|
"@distilled.cloud/error/categories": {
|
|
30
30
|
ParseError: true;
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
/** Schema parse error wrapper (kept for v0 surface parity). */
|
|
34
|
-
export declare class AxiomParseError extends AxiomParseError_base {
|
|
34
|
+
export declare class AxiomParseError extends /*@__PURE__*/ AxiomParseError_base {
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=errors.d.ts.map
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","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;AAGlE,OAAO,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","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;AAGlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;;;AAElE,6EAA6E;AAC7E,qBAAa,iBACX,SAAQ,aAAa,CAAC,sBAIW;CAAG;;;;;;;;;AAEtC,+DAA+D;AAC/D,qBAAa,eACX,SAAQ,aAAa,CAAC,oBAGU;CAAG"}
|
package/lib/errors.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Axiom-specific error types.
|
|
3
|
-
*
|
|
4
|
-
* Re-exports the common HTTP errors from core and adds the Axiom fallback
|
|
5
|
-
* errors. Note the generated service modules additionally define their own
|
|
6
|
-
* per-status matcher classes (BadRequest/NotFound/…) for the statuses each
|
|
7
|
-
* operation declares — those share `_tag`s with the core classes here, so
|
|
8
|
-
* `catchTag` works against either.
|
|
9
|
-
*/
|
|
10
|
-
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
11
|
-
import * as Category from "@distilled.cloud/core/category";
|
|
12
|
-
import * as Schema from "effect/Schema";
|
|
13
|
-
/** Unknown Axiom error — returned when nothing else matches the failure. */
|
|
14
|
-
export class UnknownAxiomError extends Schema.TaggedError()("UnknownAxiomError", {
|
|
15
|
-
code: Schema.optional(Schema.String),
|
|
16
|
-
message: Schema.optional(Schema.String),
|
|
17
|
-
body: Schema.Unknown,
|
|
18
|
-
}).pipe(Category.withServerError) {
|
|
19
|
-
}
|
|
20
|
-
/** Schema parse error wrapper (kept for v0 surface parity). */
|
|
21
|
-
export class AxiomParseError extends Schema.TaggedError()("AxiomParseError", {
|
|
22
|
-
body: Schema.Unknown,
|
|
23
|
-
cause: Schema.Unknown,
|
|
24
|
-
}).pipe(Category.withParseError) {
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=errors.js.map
|
|
1
|
+
export { errors$API_ERRORS as API_ERRORS, errors$AxiomParseError as AxiomParseError, 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$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownAxiomError as UnknownAxiomError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @distilled.cloud/axiom — Axiom SDK for Effect.
|
|
3
|
-
*
|
|
4
|
-
* `./services` is generated by `scripts/generate.ts` from the Smithy models
|
|
5
|
-
* in `.generated-specs` (written by `scripts/convert.ts` from the three
|
|
6
|
-
* OpenAPI specs in specs/docs/restapi/versions). Everything else in this
|
|
7
|
-
* folder is hand-written.
|
|
8
|
-
*
|
|
9
|
-
* The v2 control-plane API lives under `v2`; the v1 edge APIs are
|
|
10
|
-
* also available under their own subpath imports:
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import * as Axiom from "@distilled.cloud/axiom";
|
|
15
|
-
* import * as EdgeIngest from "@distilled.cloud/axiom/edge-ingest";
|
|
16
|
-
* import * as EdgeQuery from "@distilled.cloud/axiom/edge-query";
|
|
17
|
-
*
|
|
18
|
-
* const datasets = yield* Axiom.v2.getDatasets({});
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
export * from "./credentials.js";
|
|
22
2
|
export * from "./errors.js";
|
|
23
3
|
export * as T from "./traits.js";
|
|
24
4
|
export { AxiomProtocol, stripNulls } from "./protocol.js";
|
|
25
5
|
export * as Retry from "./retry.js";
|
|
26
6
|
export * from "./services/index.js";
|
|
27
|
-
// v0-parity surface: the v2 control-plane operations live on the package
|
|
28
|
-
// root (edge-ingest / edge-query stay behind their subpath exports).
|
|
29
|
-
// The service-local typed error classes shadow the same-named shared ones
|
|
30
|
-
// from ./errors.ts — the ops actually raise the service-local classes.
|
|
31
7
|
export * from "./services/v2.js";
|
|
32
8
|
export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services/v2.js";
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./credentials.js";
|
|
2
|
+
export * from "./errors.js";
|
|
3
|
+
export * as T from "./traits.js";
|
|
4
|
+
export { AxiomProtocol, stripNulls } from "./protocol.js";
|
|
5
|
+
export * as Retry from "./retry.js";
|
|
6
|
+
export * from "./services.lazy/index.js";
|
|
7
|
+
export * from "./services.lazy/v2.js";
|
|
8
|
+
export { BadRequest, Conflict, Forbidden, NotFound, UnprocessableEntity } from "./services.lazy/v2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,UAAU,EAA0C,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,UAAU,EAA0C,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,yEAAyE;AACzE,qEAAqE;AACrE,0EAA0E;AAC1E,wEAAwE;AACxE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/lib/protocol.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type AxiomOpContext = Credentials | HttpClient.HttpClient;
|
|
|
20
20
|
* (value or absent), so `null` trips decoding. Recursively drop explicit
|
|
21
21
|
* `null` properties before decoding so optional fields are treated as
|
|
22
22
|
* absent. Keys that are genuinely nullable in the API are patched to
|
|
23
|
-
* nullable in the spec
|
|
23
|
+
* nullable in the spec -- this hook exists for the far more common "Go nil
|
|
24
24
|
* slice" case.
|
|
25
25
|
*/
|
|
26
26
|
export declare const stripNulls: (value: unknown) => unknown;
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAyB5E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,iBAAiB,GACjB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,eAAe,CAAC;AAEpB,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAEjE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,OAW3C,CAAC;AAiBF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAyB5E,OAAO,KAAK,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GACzC,iBAAiB,GACjB,WAAW,GACX,eAAe,CAAC,eAAe,GAC/B,eAAe,CAAC;AAEpB,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAEjE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,OAW3C,CAAC;AAiBF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAkBlD,CAAC"}
|
package/lib/protocol.js
CHANGED
|
@@ -1,87 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* AxiomProtocol — hand-written.
|
|
4
|
-
*
|
|
5
|
-
* Axiom speaks plain bearer-authenticated JSON REST (no response envelope),
|
|
6
|
-
* so the whole protocol is one `makeRestProtocol` call from
|
|
7
|
-
* `core/protocol-rest`:
|
|
8
|
-
*
|
|
9
|
-
* request: credentials → `Authorization: Bearer <apiKey>` (+ optional
|
|
10
|
-
* `X-Axiom-Org-ID` for Personal Access Tokens) + base URL
|
|
11
|
-
* (default https://api.axiom.co), resolved from the calling
|
|
12
|
-
* fiber on every request
|
|
13
|
-
*
|
|
14
|
-
* response: 2xx JSON is the payload, with explicit JSON `null` properties
|
|
15
|
-
* recursively dropped first ({@link stripNulls} — Axiom's Go
|
|
16
|
-
* backend serializes nil slices/omitted optionals as `null`);
|
|
17
|
-
* non-2xx bodies map to the operation's typed error classes by
|
|
18
|
-
* status, then the shared HTTP-status classes, then
|
|
19
|
-
* {@link UnknownAxiomError}. Axiom returns two error envelope
|
|
20
|
-
* shapes — `{ code, message }` (control-plane / edge-ingest) and
|
|
21
|
-
* `{ error, message }` (edge-query) — unified by a lenient
|
|
22
|
-
* extractor; the HTTP status stays the authoritative signal.
|
|
23
|
-
*/
|
|
24
|
-
import * as Effect from "effect/Effect";
|
|
25
|
-
import * as Redacted from "effect/Redacted";
|
|
26
|
-
import { Credentials } from "./credentials.js";
|
|
27
|
-
import { UnknownAxiomError, AxiomParseError } from "./errors.js";
|
|
28
|
-
/**
|
|
29
|
-
* Axiom's backend (Go) serializes nil slices and omitted optional fields as
|
|
30
|
-
* JSON `null`. The generated output schemas model these as optional members
|
|
31
|
-
* (value or absent), so `null` trips decoding. Recursively drop explicit
|
|
32
|
-
* `null` properties before decoding so optional fields are treated as
|
|
33
|
-
* absent. Keys that are genuinely nullable in the API are patched to
|
|
34
|
-
* nullable in the spec — this hook exists for the far more common "Go nil
|
|
35
|
-
* slice" case.
|
|
36
|
-
*/
|
|
37
|
-
export const stripNulls = (value) => {
|
|
38
|
-
if (Array.isArray(value))
|
|
39
|
-
return value.map(stripNulls);
|
|
40
|
-
if (value && typeof value === "object") {
|
|
41
|
-
const out = {};
|
|
42
|
-
for (const [k, v] of Object.entries(value)) {
|
|
43
|
-
if (v === null)
|
|
44
|
-
continue;
|
|
45
|
-
out[k] = stripNulls(v);
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
return value;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Unify Axiom's two error envelope shapes (`{ code, message }` and
|
|
53
|
-
* `{ error, message }`, some endpoints plain `{ message }`) into one
|
|
54
|
-
* `{ code?, message? }` pair — v0 semantics: `message ?? error`,
|
|
55
|
-
* `code ?? error`.
|
|
56
|
-
*/
|
|
57
|
-
const errorEnvelope = (body) => {
|
|
58
|
-
if (body === null || typeof body !== "object")
|
|
59
|
-
return undefined;
|
|
60
|
-
const b = body;
|
|
61
|
-
const error = typeof b.error === "string" ? b.error : undefined;
|
|
62
|
-
const code = typeof b.code === "string" || typeof b.code === "number" ? b.code : error;
|
|
63
|
-
const message = typeof b.message === "string" ? b.message : error;
|
|
64
|
-
return { code, message };
|
|
65
|
-
};
|
|
66
|
-
export const AxiomProtocol = makeRestProtocol({
|
|
67
|
-
// The Credentials service holds an effect — resolving it here (per
|
|
68
|
-
// request, on the calling fiber) picks up context-provided credentials.
|
|
69
|
-
credentials: Effect.gen(function* () {
|
|
70
|
-
const resolve = yield* Credentials;
|
|
71
|
-
return yield* resolve;
|
|
72
|
-
}),
|
|
73
|
-
baseUrl: (creds) => creds.apiBaseUrl,
|
|
74
|
-
headers: (creds) => ({
|
|
75
|
-
Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
|
|
76
|
-
...(creds.orgId ? { "X-Axiom-Org-ID": creds.orgId } : {}),
|
|
77
|
-
}),
|
|
78
|
-
errorEnvelope,
|
|
79
|
-
transformResponse: stripNulls,
|
|
80
|
-
unknownError: ({ code, message, body }) => new UnknownAxiomError({
|
|
81
|
-
code: typeof code === "number" ? String(code) : code,
|
|
82
|
-
message,
|
|
83
|
-
body,
|
|
84
|
-
}),
|
|
85
|
-
parseError: ({ body, cause }) => new AxiomParseError({ body, cause }),
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=protocol.js.map
|
|
1
|
+
export { protocol$AxiomProtocol as AxiomProtocol, protocol$stripNulls as stripNulls } from "./_bundle/sdk.js";
|
package/lib/retry.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import * as Effect from "effect/Effect";
|
|
|
19
19
|
export { type Options, type Factory, type Policy, makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
|
|
20
20
|
declare const Retry_base: Context.ServiceClass<Retry, "AxiomRetry", Policy>;
|
|
21
21
|
/** Context tag for configuring retry behavior of Axiom API calls. */
|
|
22
|
-
export declare class Retry extends Retry_base {
|
|
22
|
+
export declare class Retry extends /*@__PURE__*/ Retry_base {
|
|
23
23
|
}
|
|
24
24
|
/** Provides a custom retry policy to every Axiom API call below it. */
|
|
25
25
|
export declare const policy: (optionsOrFactory: Policy) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
package/lib/retry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","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,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,UAA8C;CAAG;
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","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,qEAAqE;AACrE,qBAAa,KAAM,SAAQ,aAAa,CAAC,UAA8C;CAAG;AAE1F,uEAAuE;AACvE,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"}
|
package/lib/retry.js
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Axiom retry configuration.
|
|
4
|
-
*
|
|
5
|
-
* Defines the per-SDK `Retry` Context.Service tag that generated operations
|
|
6
|
-
* wire into `API.make`. Callers can install a blanket retry policy at the
|
|
7
|
-
* layer level and have every Axiom API call below it pick it up:
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import * as Axiom from "@distilled.cloud/axiom";
|
|
12
|
-
*
|
|
13
|
-
* myEffect.pipe(Axiom.Retry.transient);
|
|
14
|
-
* Effect.provide(myEffect, Layer.succeed(Axiom.Retry.Retry, customPolicy));
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
import * as Context from "effect/Context";
|
|
18
|
-
import * as Effect from "effect/Effect";
|
|
19
|
-
import * as Layer from "effect/Layer";
|
|
20
|
-
export { makeDefault, jittered, capped, throttlingOptions, transientOptions, throttlingFactory, transientFactory, } from "@distilled.cloud/core/retry";
|
|
21
|
-
/** Context tag for configuring retry behavior of Axiom API calls. */
|
|
22
|
-
export class Retry extends Context.Service()("AxiomRetry") {
|
|
23
|
-
}
|
|
24
|
-
/** Provides a custom retry policy to every Axiom API call below it. */
|
|
25
|
-
export const policy = (optionsOrFactory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
26
|
-
/** Disables all automatic retries. */
|
|
27
|
-
export const none = Effect.provide(Layer.succeed(Retry, { while: () => false }));
|
|
28
|
-
/** Apply the throttling retry policy (retries throttling errors indefinitely). */
|
|
29
|
-
export const throttling = policy(throttlingFactory);
|
|
30
|
-
/** Apply the transient retry policy (retries all transient errors indefinitely). */
|
|
31
|
-
export const transient = policy(transientFactory);
|
|
32
|
-
//# sourceMappingURL=retry.js.map
|
|
1
|
+
export { retry$Retry as Retry, retry$capped as capped, retry$jittered as jittered, retry$makeDefault as makeDefault, retry$none as none, retry$policy as policy, retry$throttling as throttling, retry$throttlingFactory as throttlingFactory, retry$throttlingOptions as throttlingOptions, retry$transient as transient, retry$transientFactory as transientFactory, retry$transientOptions as transientOptions } from "./_bundle/sdk.js";
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import * as API from "@distilled.cloud/core/api";
|
|
2
|
-
import * as S from "@distilled.cloud/core/schema";
|
|
2
|
+
import * as S from "@distilled.cloud/core/schema-lite";
|
|
3
3
|
import { type AxiomOpError, type AxiomOpContext } from "../protocol.ts";
|
|
4
4
|
export type { AxiomOpError, AxiomOpContext };
|
|
5
|
-
declare const BadRequest_base: S.
|
|
5
|
+
declare const BadRequest_base: S.TaggedErrorClass<"BadRequest", {
|
|
6
6
|
readonly code: any;
|
|
7
7
|
readonly message: any;
|
|
8
|
-
}
|
|
8
|
+
}> & (new (...args: any[]) => {
|
|
9
9
|
"@distilled.cloud/error/categories": {
|
|
10
10
|
BadRequestError: true;
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
13
|
export declare class BadRequest extends /*@__PURE__*/ BadRequest_base {
|
|
14
14
|
}
|
|
15
|
-
declare const NotFound_base: S.
|
|
15
|
+
declare const NotFound_base: S.TaggedErrorClass<"NotFound", {
|
|
16
16
|
readonly code: any;
|
|
17
17
|
readonly message: any;
|
|
18
|
-
}
|
|
18
|
+
}> & (new (...args: any[]) => {
|
|
19
19
|
"@distilled.cloud/error/categories": {
|
|
20
20
|
BadRequestError: true;
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
export declare class NotFound extends /*@__PURE__*/ NotFound_base {
|
|
24
24
|
}
|
|
25
|
-
declare const UnprocessableEntity_base: S.
|
|
25
|
+
declare const UnprocessableEntity_base: S.TaggedErrorClass<"UnprocessableEntity", {
|
|
26
26
|
readonly code: any;
|
|
27
27
|
readonly message: any;
|
|
28
|
-
}
|
|
28
|
+
}> & (new (...args: any[]) => {
|
|
29
29
|
"@distilled.cloud/error/categories": {
|
|
30
30
|
BadRequestError: true;
|
|
31
31
|
};
|
|
@@ -42,14 +42,11 @@ export interface IngestToDatasetRequest {
|
|
|
42
42
|
csv_delimiter?: string;
|
|
43
43
|
body: string;
|
|
44
44
|
}
|
|
45
|
-
export declare const IngestToDatasetRequest: S.Schema<IngestToDatasetRequest>;
|
|
46
45
|
export interface IngestFailure {
|
|
47
46
|
error: string;
|
|
48
47
|
timestamp: string;
|
|
49
48
|
}
|
|
50
|
-
export declare const IngestFailure: S.Schema<IngestFailure>;
|
|
51
49
|
export type IngestStatusFailuresList = Array<IngestFailure>;
|
|
52
|
-
export declare const IngestStatusFailuresList: S.Schema<IngestStatusFailuresList>;
|
|
53
50
|
export interface IngestStatus {
|
|
54
51
|
blocksCreated: number;
|
|
55
52
|
failed: number;
|
|
@@ -58,7 +55,6 @@ export interface IngestStatus {
|
|
|
58
55
|
processedBytes: number;
|
|
59
56
|
walLength: number;
|
|
60
57
|
}
|
|
61
|
-
export declare const IngestStatus: S.Schema<IngestStatus>;
|
|
62
58
|
export type IngestToDatasetError = BadRequest | NotFound | UnprocessableEntity | AxiomOpError;
|
|
63
59
|
export declare const ingestToDataset: API.OperationMethod<IngestToDatasetRequest, IngestStatus, IngestToDatasetError, AxiomOpContext>;
|
|
64
60
|
//# sourceMappingURL=edge_ingest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge_ingest.d.ts","sourceRoot":"","sources":["../../src/services/edge_ingest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAGjD,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"edge_ingest.d.ts","sourceRoot":"","sources":["../../src/services/edge_ingest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAGjD,OAAO,KAAK,CAAC,MAAM,mCAAmC,CAAC;AAGvD,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;;;;;;;;;AAE7C,qBAAa,UACX,SAAQ,aAAa,CAAC,eAMrB;CAAG;;;;;;;;;AAEN,qBAAa,QACX,SAAQ,aAAa,CAAC,aAMrB;CAAG;;;;;;;;;AAEN,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAMrB;CAAG;AAEN,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,uIAAuI;IACvI,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qKAAqK;IACrK,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kGAAkG;IAClG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAC5D,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,QAAQ,GAAG,mBAAmB,GAAG,YAAY,CAAC;AAC9F,eAAO,MAAM,eAAe,EAAE,GAAG,CAAC,eAAe,CAC/C,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,cAAc,CAOb,CAAC"}
|
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as C from "@distilled.cloud/core/category";
|
|
3
|
-
// AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/docs restapi/versions). Do not edit.
|
|
4
|
-
import * as S from "@distilled.cloud/core/schema";
|
|
5
|
-
import { UnknownAxiomError } from "../errors.js";
|
|
6
|
-
import { AxiomProtocol } from "../protocol.js";
|
|
7
|
-
import * as Retry from "../retry.js";
|
|
8
|
-
import * as T from "../traits.js";
|
|
9
|
-
export class BadRequest extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
|
|
10
|
-
/*@__PURE__*/ S.TaggedError()("BadRequest", {
|
|
11
|
-
code: S.Number,
|
|
12
|
-
message: S.String,
|
|
13
|
-
}).pipe(C.withBadRequestError), [{ status: 400 }]) {
|
|
14
|
-
}
|
|
15
|
-
export class NotFound extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
|
|
16
|
-
/*@__PURE__*/ S.TaggedError()("NotFound", {
|
|
17
|
-
code: S.Number,
|
|
18
|
-
message: S.String,
|
|
19
|
-
}).pipe(C.withBadRequestError), [{ status: 404 }]) {
|
|
20
|
-
}
|
|
21
|
-
export class UnprocessableEntity extends /*@__PURE__*/ /*@__PURE__*/ T.applyErrorMatchers(
|
|
22
|
-
/*@__PURE__*/ S.TaggedError()("UnprocessableEntity", {
|
|
23
|
-
code: S.Number,
|
|
24
|
-
message: S.String,
|
|
25
|
-
}).pipe(C.withBadRequestError), [{ status: 422 }]) {
|
|
26
|
-
}
|
|
27
|
-
export const IngestToDatasetRequest = /*@__PURE__*/ S.suspend(() => S.Struct({
|
|
28
|
-
dataset_id: S.String.pipe(T.Label()),
|
|
29
|
-
timestamp_field: S.optional(S.String.pipe(T.Query("timestamp-field"))),
|
|
30
|
-
timestamp_format: S.optional(S.String.pipe(T.Query("timestamp-format"))),
|
|
31
|
-
csv_delimiter: S.optional(S.String.pipe(T.Query("csv-delimiter"))),
|
|
32
|
-
body: S.String.pipe(T.HttpBody()),
|
|
33
|
-
}).pipe(T.Http({ method: "POST", uri: "/v1/datasets/{dataset_id}/ingest", code: 200 }))).annotate({ identifier: "IngestToDatasetRequest" });
|
|
34
|
-
export const IngestFailure = /*@__PURE__*/ S.suspend(() => S.Struct({
|
|
35
|
-
error: S.String,
|
|
36
|
-
timestamp: S.String,
|
|
37
|
-
})).annotate({ identifier: "IngestFailure" });
|
|
38
|
-
export const IngestStatusFailuresList = /*@__PURE__*/ S.Array(IngestFailure);
|
|
39
|
-
export const IngestStatus = /*@__PURE__*/ S.suspend(() => S.Struct({
|
|
40
|
-
blocksCreated: S.Number,
|
|
41
|
-
failed: S.Number,
|
|
42
|
-
failures: S.optional(IngestStatusFailuresList),
|
|
43
|
-
ingested: S.Number,
|
|
44
|
-
processedBytes: S.Number,
|
|
45
|
-
walLength: S.Number,
|
|
46
|
-
})).annotate({ identifier: "IngestStatus" });
|
|
47
|
-
export const ingestToDataset = /*@__PURE__*/ API.make(() => ({
|
|
48
|
-
input: IngestToDatasetRequest,
|
|
49
|
-
output: IngestStatus,
|
|
50
|
-
errors: [BadRequest, NotFound, UnprocessableEntity, UnknownAxiomError],
|
|
51
|
-
protocol: AxiomProtocol,
|
|
52
|
-
retry: Retry.Retry,
|
|
53
|
-
}));
|
|
1
|
+
import{_ as e,b as t,c as n,d as r,errors$UnknownAxiomError as i,f as a,h as o,i as s,m as c,o as l,p as u,protocol$AxiomProtocol as d,retry$Retry as f,s as p,t as m,traits$Http as h,traits$HttpBody as g,traits$Label as _,traits$Query as v,traits$applyErrorMatchers as y,u as b,v as x}from"../_bundle/sdk.js";const S=/*@__PURE__*/ o(function BadRequest(r){return e(r,new.target,[`$5($4()("BadRequest",{code:$2,message:$3}).pipe($1),[{status:400}])`,[b,t,s,l,n,y]])});const C=/*@__PURE__*/ o(function NotFound(r){return e(r,new.target,[`$5($4()("NotFound",{code:$2,message:$3}).pipe($1),[{status:404}])`,[b,t,s,l,n,y]])});const w=/*@__PURE__*/ o(function UnprocessableEntity(r){return e(r,new.target,[`$5($4()("UnprocessableEntity",{code:$2,message:$3}).pipe($1),[{status:422}])`,[b,t,s,l,n,y]])});const T=/*@__PURE__*/ x(e=>e===u?[`{input:#1,output:#4,errors:[$11,$12,$13,$14],protocol:$15,retry:$16};$8(>5)@"IngestToDatasetRequest";$8(>6)@"IngestFailure";$9(#2);$8(>7)@"IngestStatus";$7({dataset_id:$3.pipe($2()),timestamp_field:$5($3.pipe($4("timestamp-field"))),timestamp_format:$5($3.pipe($4("timestamp-format"))),csv_delimiter:$5($3.pipe($4("csv-delimiter"))),body:$3.pipe($6())}).pipe($1({method:"POST",uri:"/v1/datasets/{dataset_id}/ingest",code:200}));$7({error:$3,timestamp:$3});$7({blocksCreated:$10,failed:$10,failures:$5(#3),ingested:$10,processedBytes:$10,walLength:$10})`,[b,h,_,l,v,r,g,p,a,m,s,S,C,w,i,d,f]]:c(T,e));export{S as BadRequest,C as NotFound,w as UnprocessableEntity,T as ingestToDataset};
|
|
54
2
|
//# sourceMappingURL=edge_ingest.js.map
|