@lark-apaas/dataloom 0.1.1-alpha.0 → 0.1.1-alpha.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.
@@ -1,15 +1,15 @@
1
1
  import RateLimiter from './RateLimiter';
2
2
  import DataloomService from './service';
3
3
  import { StorageClient } from './storage';
4
- import type { Fetch, SupabaseClientOptions } from './utils/types';
4
+ import type { DataloomClientOptions, Fetch } from './utils/types';
5
5
  /**
6
6
  * Dataloom Client.
7
7
  *
8
8
  * An isomorphic Javascript client for interacting with Dataloom service and storage.
9
9
  */
10
10
  export default class DataloomClient {
11
- protected supabaseUrl: string;
12
- protected supabaseKey: string;
11
+ protected dataloomUrl: string;
12
+ protected dataloomKey: string;
13
13
  protected workspaceId: string;
14
14
  service: DataloomService;
15
15
  storage: StorageClient;
@@ -20,12 +20,12 @@ export default class DataloomClient {
20
20
  protected headers: Record<string, string>;
21
21
  /**
22
22
  * Create a new client for use in the browser.
23
- * @param supabaseUrl The unique Dataloom URL which is supplied when you create a new project.
24
- * @param supabaseKey The unique Dataloom Key which is supplied when you create a new project.
23
+ * @param dataloomUrl The unique Dataloom URL which is supplied when you create a new project.
24
+ * @param dataloomKey The unique Dataloom Key which is supplied when you create a new project.
25
25
  * @param workspaceId The unique workspace id which is supplied when you create a new workspace.
26
26
  * @param options.global.fetch A custom fetch implementation.
27
27
  * @param options.global.headers Any additional headers to send with each network request.
28
28
  */
29
- constructor(supabaseUrl: string, supabaseKey: string, workspaceId: string, options?: SupabaseClientOptions);
29
+ constructor(dataloomUrl: string, dataloomKey: string, workspaceId: string, options?: DataloomClientOptions);
30
30
  }
31
31
  //# sourceMappingURL=DataloomClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataloomClient.d.ts","sourceRoot":"","sources":["../src/DataloomClient.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,eAAe,MAAM,WAAW,CAAC;AACxC,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O,EAAE,aAAa,CAAC;IAEvB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACxB,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACpC,SAAS,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAE/C,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;;;;OAOG;gBAES,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAC7B,OAAO,CAAC,EAAE,qBAAqB;CAoDlC"}
@@ -5,12 +5,12 @@ import { DEFAULT_GLOBAL_OPTIONS } from "./utils/constants.js";
5
5
  import { fetchWithAuth } from "./utils/fetch.js";
6
6
  import { applySettingDefaults, stripTrailingSlash } from "./utils/helpers.js";
7
7
  class DataloomClient {
8
- constructor(supabaseUrl, supabaseKey, workspaceId, options){
9
- this.supabaseUrl = supabaseUrl;
10
- this.supabaseKey = supabaseKey;
8
+ constructor(dataloomUrl, dataloomKey, workspaceId, options){
9
+ this.dataloomUrl = dataloomUrl;
10
+ this.dataloomKey = dataloomKey;
11
11
  this.workspaceId = workspaceId;
12
- const _supabaseUrl = stripTrailingSlash(supabaseUrl);
13
- this.storageUrl = `${_supabaseUrl}/storage`;
12
+ const normalizedDataloomUrl = stripTrailingSlash(dataloomUrl);
13
+ this.storageUrl = `${normalizedDataloomUrl}/storage`;
14
14
  const DEFAULTS = {
15
15
  global: DEFAULT_GLOBAL_OPTIONS
16
16
  };
@@ -20,7 +20,7 @@ class DataloomClient {
20
20
  if (settings.global.onError) settings.global.onError(error, this);
21
21
  };
22
22
  if (settings.global.requestRateLimit && settings.global.requestRateLimit > 0) this.rateLimiter = new RateLimiter(settings.global.requestRateLimit);
23
- this.fetch = fetchWithAuth(supabaseKey, this.rateLimiter, settings.global.fetch);
23
+ this.fetch = fetchWithAuth(dataloomKey, this.rateLimiter, settings.global.fetch);
24
24
  this.service = new service({
25
25
  headers: this.headers,
26
26
  fetch: this.fetch,
package/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import DataloomClient from './DataloomClient';
2
- import type { SupabaseClientOptions } from './utils/types';
2
+ import type { DataloomClientOptions } from './utils/types';
3
3
  export { default as DataloomClient } from './DataloomClient';
4
- export type { SupabaseClientOptions } from './utils/types';
4
+ export type { DataloomClientOptions } from './utils/types';
5
5
  /**
6
6
  * Creates a new Dataloom Client.
7
7
  */
8
- export declare const createClient: (dataloomUrl: string, dataloomKey: string, workspaceId: string, options?: SupabaseClientOptions) => DataloomClient;
8
+ export declare const createClient: (dataloomUrl: string, dataloomKey: string, workspaceId: string, options?: DataloomClientOptions) => DataloomClient;
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -67,7 +67,7 @@ export interface SortBy {
67
67
  }
68
68
  export interface FileOptions {
69
69
  /**
70
- * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
70
+ * The number of seconds the asset is cached in the browser and in the Dataloom CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
71
71
  */
72
72
  cacheControl?: string | number;
73
73
  /**
@@ -97,7 +97,7 @@ export interface FileOptionsV2 {
97
97
  */
98
98
  filePath?: string;
99
99
  /**
100
- * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header.
100
+ * The number of seconds the asset is cached in the browser and in the Dataloom CDN. This is set in the `Cache-Control: max-age=<seconds>` header.
101
101
  */
102
102
  cacheControl?: string | number;
103
103
  /**
@@ -1,6 +1,6 @@
1
1
  import type RateLimiter from '../RateLimiter';
2
2
  type Fetch = typeof fetch;
3
3
  export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
4
- export declare const fetchWithAuth: (supabaseKey: string, rateLimiter?: RateLimiter, customFetch?: Fetch) => Fetch;
4
+ export declare const fetchWithAuth: (dataloomKey: string, rateLimiter?: RateLimiter, customFetch?: Fetch) => Fetch;
5
5
  export {};
6
6
  //# sourceMappingURL=fetch.d.ts.map
@@ -3,7 +3,7 @@ const resolveFetch = (customFetch)=>{
3
3
  _fetch = customFetch ? customFetch : fetch;
4
4
  return (...args)=>_fetch(...args);
5
5
  };
6
- const fetchWithAuth = (supabaseKey, rateLimiter, customFetch)=>{
6
+ const fetchWithAuth = (dataloomKey, rateLimiter, customFetch)=>{
7
7
  const resolvedFetch = resolveFetch(customFetch);
8
8
  return async (input, init)=>{
9
9
  if (rateLimiter && !rateLimiter.canRequest()) return Promise.resolve(new Response(`{"limit": ${rateLimiter.maxRequests}}`, {
@@ -11,8 +11,8 @@ const fetchWithAuth = (supabaseKey, rateLimiter, customFetch)=>{
11
11
  statusText: 'Too Many Requests'
12
12
  }));
13
13
  const headers = new Headers(init?.headers);
14
- if (!supabaseKey) console.warn('[Dataloom] api key is missing');
15
- if (!headers.has('apikey') && supabaseKey) headers.set('apikey', supabaseKey);
14
+ if (!dataloomKey) console.warn('[Dataloom] api key is missing');
15
+ if (!headers.has('apikey') && dataloomKey) headers.set('apikey', dataloomKey);
16
16
  return resolvedFetch(input, {
17
17
  ...init,
18
18
  headers
@@ -1,5 +1,5 @@
1
- import type { SupabaseClientOptions } from './types';
1
+ import type { DataloomClientOptions } from './types';
2
2
  export declare function stripTrailingSlash(url: string): string;
3
3
  export declare const isBrowser: () => boolean;
4
- export declare function applySettingDefaults(options: SupabaseClientOptions, defaults: SupabaseClientOptions): Required<SupabaseClientOptions>;
4
+ export declare function applySettingDefaults(options: DataloomClientOptions, defaults: DataloomClientOptions): Required<DataloomClientOptions>;
5
5
  //# sourceMappingURL=helpers.d.ts.map
@@ -1,5 +1,5 @@
1
1
  export type Fetch = typeof fetch;
2
- export type SupabaseClientOptions = {
2
+ export type DataloomClientOptions = {
3
3
  global?: {
4
4
  /**
5
5
  * The brand name of the dataloom client. Used for specialized configuration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/dataloom",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.1-alpha.1",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [