@lockerverse/sdk 0.2.109-dev.1 → 0.2.111-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/public-events.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ type LockerversePublicEvent = {
|
|
|
10
10
|
startAt: string;
|
|
11
11
|
endAt: string;
|
|
12
12
|
};
|
|
13
|
+
type LockerversePastEventsPage = {
|
|
14
|
+
events: LockerversePublicEvent[];
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
};
|
|
13
17
|
type CreateLockerversePublicEventsOptions = LockerverseResourceEnvironmentOptions & {
|
|
14
18
|
communitySlug: string;
|
|
15
19
|
fetch?: typeof globalThis.fetch;
|
|
@@ -19,10 +23,14 @@ type CreateLockerversePublicEventsOptions = LockerverseResourceEnvironmentOption
|
|
|
19
23
|
};
|
|
20
24
|
type LockerversePublicEventsClient = {
|
|
21
25
|
list: () => Promise<LockerversePublicEvent[]>;
|
|
26
|
+
listPast: (options?: {
|
|
27
|
+
limit?: number;
|
|
28
|
+
offset?: number;
|
|
29
|
+
}) => Promise<LockerversePastEventsPage>;
|
|
22
30
|
};
|
|
23
31
|
//#endregion
|
|
24
32
|
//#region src/public-events-client.d.ts
|
|
25
33
|
declare function createLockerversePublicEventsClient(options: CreateLockerversePublicEventsOptions): LockerversePublicEventsClient;
|
|
26
34
|
//#endregion
|
|
27
|
-
export { type CreateLockerversePublicEventsOptions, type LockerverseEnvironment, type LockerversePublicEvent, type LockerversePublicEventsClient, LockerverseSdkError, createLockerversePublicEventsClient };
|
|
35
|
+
export { type CreateLockerversePublicEventsOptions, type LockerverseEnvironment, type LockerversePastEventsPage, type LockerversePublicEvent, type LockerversePublicEventsClient, LockerverseSdkError, createLockerversePublicEventsClient };
|
|
28
36
|
//# sourceMappingURL=public-events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-events.d.ts","names":[],"sources":["../src/public-events-types.ts","../src/public-events-client.ts"],"mappings":";;KAKY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,uCACV;EACE;EACA,eAAe,WAAW;EAC1B,WAAW,OAAO;EAClB;EACA;;KAGQ;EACV,YAAY,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"public-events.d.ts","names":[],"sources":["../src/public-events-types.ts","../src/public-events-client.ts"],"mappings":";;KAKY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV,QAAQ;EACR;;KAGU,uCACV;EACE;EACA,eAAe,WAAW;EAC1B,WAAW,OAAO;EAClB;EACA;;KAGQ;EACV,YAAY,QAAQ;EACpB,WAAW;IACT;IACA;QACI,QAAQ;;;;iBCrBA,oCACd,SAAS,uCACR"}
|
package/dist/public-events.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e,n as t,o as n,t as r}from"./transport.js";import{n as i}from"./types.js";import{array as a,
|
|
1
|
+
import{i as e,n as t,o as n,t as r}from"./transport.js";import{n as i}from"./types.js";import{array as a,boolean as o,isoTimestamp as s,nullable as c,object as l,optional as u,parse as d,pipe as f,string as p}from"valibot";const m=l({description:c(p()),endAt:f(p(),s()),id:p(),imageUrl:u(c(p()),null),link:c(p()),location:c(p()),name:p(),startAt:f(p(),s())}),h=e=>d(a(m),e),g=e=>d(l({events:a(m),hasMore:o()}),e);function _(a){let o=e(a,`communitySlug`),s=t({communitySlug:o.communitySlugValue,environment:o.environment,getContext:()=>({}),onError:o.onError,resourceContextName:`lockerverse_public_events`,sentryDsn:o.sentryDsn}),{requestJson:c}=r(o.fetchImplementation,s,o.requestTimeoutMs),l={code:`public_events_load_failed`,message:`Unable to load Lockerverse events.`,operation:`list_public_events`};return{async list(){try{let e=await c(`${o.apiBaseUrl}/community/${o.communitySlug}/events`,void 0,h,{...l,report:!1},{...l,report:!1});if(!e.ok)throw new i({...l,reportable:e.response.status>=500,status:e.response.status});return n(e.value)}catch(e){throw e instanceof i?s(e):s(new i({...l,reportable:!0}))}},async listPast({limit:e=20,offset:t=0}={}){try{let r=new URLSearchParams({limit:String(e),offset:String(t)}),a=await c(`${o.apiBaseUrl}/community/${o.communitySlug}/events/past?${r}`,void 0,g,{...l,report:!1},{...l,report:!1});if(!a.ok)throw new i({...l,reportable:a.response.status>=500,status:a.response.status});return n(a.value)}catch(e){throw e instanceof i?s(e):s(new i({...l,reportable:!0}))}}}}export{i as LockerverseSdkError,_ as createLockerversePublicEventsClient};
|
|
2
2
|
//# sourceMappingURL=public-events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-events.js","names":[],"sources":["../src/public-events-schemas.ts","../src/public-events-client.ts"],"sourcesContent":["import {\n array,\n isoTimestamp,\n nullable,\n object,\n optional,\n parse,\n pipe,\n string,\n} from \"valibot\";\n\nconst publicEventSchema = object({\n description: nullable(string()),\n endAt: pipe(string(), isoTimestamp()),\n id: string(),\n imageUrl: optional(nullable(string()), null),\n link: nullable(string()),\n location: nullable(string()),\n name: string(),\n startAt: pipe(string(), isoTimestamp()),\n});\n\nexport const parsePublicEvents = <Value>(value: Value) =>\n parse(array(publicEventSchema), value);\n","import { deepFreeze } from \"./deep-freeze.ts\";\nimport { resolveResourceEnvironment } from \"./environment.ts\";\nimport { createSdkErrorReporter } from \"./error-reporting.ts\";\nimport {
|
|
1
|
+
{"version":3,"file":"public-events.js","names":[],"sources":["../src/public-events-schemas.ts","../src/public-events-client.ts"],"sourcesContent":["import {\n array,\n boolean,\n isoTimestamp,\n nullable,\n object,\n optional,\n parse,\n pipe,\n string,\n} from \"valibot\";\n\nconst publicEventSchema = object({\n description: nullable(string()),\n endAt: pipe(string(), isoTimestamp()),\n id: string(),\n imageUrl: optional(nullable(string()), null),\n link: nullable(string()),\n location: nullable(string()),\n name: string(),\n startAt: pipe(string(), isoTimestamp()),\n});\n\nexport const parsePublicEvents = <Value>(value: Value) =>\n parse(array(publicEventSchema), value);\n\nexport const parsePastEventsPage = <Value>(value: Value) =>\n parse(\n object({ events: array(publicEventSchema), hasMore: boolean() }),\n value\n );\n","import { deepFreeze } from \"./deep-freeze.ts\";\nimport { resolveResourceEnvironment } from \"./environment.ts\";\nimport { createSdkErrorReporter } from \"./error-reporting.ts\";\nimport {\n parsePastEventsPage,\n parsePublicEvents,\n} from \"./public-events-schemas.ts\";\nimport type {\n CreateLockerversePublicEventsOptions,\n LockerversePublicEventsClient,\n} from \"./public-events-types.ts\";\nimport { createTransport } from \"./transport.ts\";\nimport { LockerverseSdkError } from \"./types.ts\";\n\nexport function createLockerversePublicEventsClient(\n options: CreateLockerversePublicEventsOptions\n): LockerversePublicEventsClient {\n const runtime = resolveResourceEnvironment(options, \"communitySlug\");\n const reportError = createSdkErrorReporter({\n communitySlug: runtime.communitySlugValue,\n environment: runtime.environment,\n getContext: () => ({}),\n onError: runtime.onError,\n resourceContextName: \"lockerverse_public_events\",\n sentryDsn: runtime.sentryDsn,\n });\n const { requestJson } = createTransport(\n runtime.fetchImplementation,\n reportError,\n runtime.requestTimeoutMs\n );\n const context = {\n code: \"public_events_load_failed\" as const,\n message: \"Unable to load Lockerverse events.\",\n operation: \"list_public_events\" as const,\n };\n\n return {\n async list() {\n try {\n const response = await requestJson(\n `${runtime.apiBaseUrl}/community/${runtime.communitySlug}/events`,\n undefined,\n parsePublicEvents,\n { ...context, report: false },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n return deepFreeze(response.value);\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw reportError(error);\n }\n throw reportError(\n new LockerverseSdkError({ ...context, reportable: true })\n );\n }\n },\n async listPast({ limit = 20, offset = 0 } = {}) {\n try {\n const query = new URLSearchParams({\n limit: String(limit),\n offset: String(offset),\n });\n const response = await requestJson(\n `${runtime.apiBaseUrl}/community/${runtime.communitySlug}/events/past?${query}`,\n undefined,\n parsePastEventsPage,\n { ...context, report: false },\n { ...context, report: false }\n );\n if (!response.ok) {\n throw new LockerverseSdkError({\n ...context,\n reportable: response.response.status >= 500,\n status: response.response.status,\n });\n }\n return deepFreeze(response.value);\n } catch (error) {\n if (error instanceof LockerverseSdkError) {\n throw reportError(error);\n }\n throw reportError(\n new LockerverseSdkError({ ...context, reportable: true })\n );\n }\n },\n };\n}\n"],"mappings":"+NAYA,MAAM,EAAoB,EAAO,CAC/B,YAAa,EAAS,EAAO,CAAC,EAC9B,MAAO,EAAK,EAAO,EAAG,EAAa,CAAC,EACpC,GAAI,EAAO,EACX,SAAU,EAAS,EAAS,EAAO,CAAC,EAAG,IAAI,EAC3C,KAAM,EAAS,EAAO,CAAC,EACvB,SAAU,EAAS,EAAO,CAAC,EAC3B,KAAM,EAAO,EACb,QAAS,EAAK,EAAO,EAAG,EAAa,CAAC,CACxC,CAAC,EAEY,EAA4B,GACvC,EAAM,EAAM,CAAiB,EAAG,CAAK,EAE1B,EAA8B,GACzC,EACE,EAAO,CAAE,OAAQ,EAAM,CAAiB,EAAG,QAAS,EAAQ,CAAE,CAAC,EAC/D,CACF,EChBF,SAAgB,EACd,EAC+B,CAC/B,IAAM,EAAU,EAA2B,EAAS,eAAe,EAC7D,EAAc,EAAuB,CACzC,cAAe,EAAQ,mBACvB,YAAa,EAAQ,YACrB,gBAAmB,CAAC,GACpB,QAAS,EAAQ,QACjB,oBAAqB,4BACrB,UAAW,EAAQ,SACrB,CAAC,EACK,CAAE,eAAgB,EACtB,EAAQ,oBACR,EACA,EAAQ,gBACV,EACM,EAAU,CACd,KAAM,4BACN,QAAS,qCACT,UAAW,oBACb,EAEA,MAAO,CACL,MAAM,MAAO,CACX,GAAI,CACF,IAAM,EAAW,MAAM,EACrB,GAAG,EAAQ,WAAW,aAAa,EAAQ,cAAc,SACzD,IAAA,GACA,EACA,CAAE,GAAG,EAAS,OAAQ,EAAM,EAC5B,CAAE,GAAG,EAAS,OAAQ,EAAM,CAC9B,EACA,GAAI,CAAC,EAAS,GACZ,MAAM,IAAI,EAAoB,CAC5B,GAAG,EACH,WAAY,EAAS,SAAS,QAAU,IACxC,OAAQ,EAAS,SAAS,MAC5B,CAAC,EAEH,OAAO,EAAW,EAAS,KAAK,CAClC,OAAS,EAAO,CAId,MAHI,aAAiB,EACb,EAAY,CAAK,EAEnB,EACJ,IAAI,EAAoB,CAAE,GAAG,EAAS,WAAY,EAAK,CAAC,CAC1D,CACF,CACF,EACA,MAAM,SAAS,CAAE,QAAQ,GAAI,SAAS,GAAM,CAAC,EAAG,CAC9C,GAAI,CACF,IAAM,EAAQ,IAAI,gBAAgB,CAChC,MAAO,OAAO,CAAK,EACnB,OAAQ,OAAO,CAAM,CACvB,CAAC,EACK,EAAW,MAAM,EACrB,GAAG,EAAQ,WAAW,aAAa,EAAQ,cAAc,eAAe,IACxE,IAAA,GACA,EACA,CAAE,GAAG,EAAS,OAAQ,EAAM,EAC5B,CAAE,GAAG,EAAS,OAAQ,EAAM,CAC9B,EACA,GAAI,CAAC,EAAS,GACZ,MAAM,IAAI,EAAoB,CAC5B,GAAG,EACH,WAAY,EAAS,SAAS,QAAU,IACxC,OAAQ,EAAS,SAAS,MAC5B,CAAC,EAEH,OAAO,EAAW,EAAS,KAAK,CAClC,OAAS,EAAO,CAId,MAHI,aAAiB,EACb,EAAY,CAAK,EAEnB,EACJ,IAAI,EAAoB,CAAE,GAAG,EAAS,WAAY,EAAK,CAAC,CAC1D,CACF,CACF,CACF,CACF"}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=`0.2.
|
|
1
|
+
const e=`0.2.111-dev.1`;var t=class extends Error{code;operation;reportable;recoveryRecommended;sdkVersion;serverCode;status;constructor({code:t,message:n,operation:r,reportable:i,recoveryRecommended:a=!1,serverCode:o,status:s}){super(n),this.name=`LockerverseSdkError`,this.code=t,this.operation=r,this.reportable=i,this.recoveryRecommended=a,this.sdkVersion=e,this.serverCode=o,this.status=s}};export{t as n,e as t};
|
|
2
2
|
//# sourceMappingURL=types.js.map
|