@auth0/ai 3.3.0 → 3.4.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/cjs/authorizers/ciba/CIBAAuthorizationRequest.js.map +1 -1
- package/dist/cjs/stores/SubStore.js +6 -3
- package/dist/cjs/stores/SubStore.js.map +1 -1
- package/dist/esm/authorizers/ciba/CIBAAuthorizationRequest.d.ts +1 -1
- package/dist/esm/authorizers/ciba/CIBAAuthorizationRequest.js.map +1 -1
- package/dist/esm/stores/SubStore.d.ts +3 -1
- package/dist/esm/stores/SubStore.js +6 -3
- package/dist/esm/stores/SubStore.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CIBAAuthorizationRequest.js","sourceRoot":"","sources":["../../../../src/authorizers/ciba/CIBAAuthorizationRequest.ts"],"names":[],"mappings":"","sourcesContent":["export type CIBAAuthorizationRequest = {\n /**\n * The authorization request ID.\n * Use this ID to check the status of the authorization request.\n */\n id: string;\n\n /**\n * The time the authorization request was made.\n */\n requestedAt: number;\n\n /**\n * The time in seconds for the authorization request to expire.\n */\n expiresIn: number;\n\n /**\n * The interval to use when polling the status.\n */\n interval: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"CIBAAuthorizationRequest.js","sourceRoot":"","sources":["../../../../src/authorizers/ciba/CIBAAuthorizationRequest.ts"],"names":[],"mappings":"","sourcesContent":["export type CIBAAuthorizationRequest = {\n /**\n * The authorization request ID.\n * Use this ID to check the status of the authorization request.\n */\n id: string;\n\n /**\n * The time the authorization request was made.\n */\n requestedAt: number;\n\n /**\n * The time in seconds for the authorization request to expire.\n */\n expiresIn: number;\n\n /**\n * The interval in seconds to use when polling the status.\n */\n interval: number;\n};\n"]}
|
|
@@ -21,11 +21,14 @@ class SubStore {
|
|
|
21
21
|
}
|
|
22
22
|
return namespace;
|
|
23
23
|
}
|
|
24
|
+
getParentStore() {
|
|
25
|
+
return typeof this.parent === "function" ? this.parent() : this.parent;
|
|
26
|
+
}
|
|
24
27
|
get(namespace, key) {
|
|
25
|
-
return this.
|
|
28
|
+
return this.getParentStore().get(this.getFullNamespace(namespace), key);
|
|
26
29
|
}
|
|
27
30
|
delete(namespace, key) {
|
|
28
|
-
return this.
|
|
31
|
+
return this.getParentStore().delete(this.getFullNamespace(namespace), key);
|
|
29
32
|
}
|
|
30
33
|
put(namespace, key, value, options) {
|
|
31
34
|
const expiresIn = (options === null || options === void 0 ? void 0 : options.expiresIn)
|
|
@@ -34,7 +37,7 @@ class SubStore {
|
|
|
34
37
|
? this.options.getTTL(value)
|
|
35
38
|
: undefined;
|
|
36
39
|
const fullNS = this.getFullNamespace(namespace);
|
|
37
|
-
return this.
|
|
40
|
+
return this.getParentStore().put(fullNS, key, value, {
|
|
38
41
|
expiresIn,
|
|
39
42
|
});
|
|
40
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubStore.js","sourceRoot":"","sources":["../../../src/stores/SubStore.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SubStore.js","sourceRoot":"","sources":["../../../src/stores/SubStore.ts"],"names":[],"mappings":";;;AAeA;;;;;GAKG;AACH,MAAa,QAAQ;IACnB,YACmB,MAA2B,EAC3B,UAA6B,EAAE;QAD/B,WAAM,GAAN,MAAM,CAAqB;QAC3B,YAAO,GAAP,OAAO,CAAwB;QAEhD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,SAAmB;QAC1C,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,SAAS,CAAC,CAAC;QACvD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,cAAc;QACp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,aAAa,EAAE,OAAO,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,IAAI,QAAQ,CAAO,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF;AAxDD,4BAwDC","sourcesContent":["import { Store } from \"./Store\";\n\ntype StoreOrFactory<T> = Store<T> | (() => Store<T>);\n\n/**\n * Parameters for configuring a SubStore.\n * @template T The type of values to be stored in the SubStore.\n * @property {string[]} [baseNamespace] - An optional base namespace for the SubStore, used to organize keys in a hierarchical structure.\n * @property {(value: T) => number | undefined} [getTTL] - An optional function that returns the expiry time for a value in milliseconds since epoch, or undefined if the value doesn't expire.\n */\ntype SubStoreParams<T> = {\n baseNamespace?: string[];\n getTTL?: (value: T) => number | undefined;\n};\n\n/**\n * A store implementation that delegates operations to a parent store with optional namespace prefixing.\n *\n * @template T - The type of values stored in this SubStore\n * @implements {Store<T>}\n */\nexport class SubStore<T = any> implements Store<T> {\n constructor(\n private readonly parent: StoreOrFactory<any>,\n private readonly options: SubStoreParams<T> = {}\n ) {\n if (typeof parent === \"undefined\") {\n throw new Error(\"Parent store is required\");\n }\n }\n\n private getFullNamespace(namespace: string[]) {\n if (this.options.baseNamespace) {\n return [...this.options.baseNamespace, ...namespace];\n }\n return namespace;\n }\n\n private getParentStore() {\n return typeof this.parent === \"function\" ? this.parent() : this.parent;\n }\n\n get(namespace: string[], key: string) {\n return this.getParentStore().get(this.getFullNamespace(namespace), key);\n }\n\n delete(namespace: string[], key: string) {\n return this.getParentStore().delete(this.getFullNamespace(namespace), key);\n }\n\n put(\n namespace: string[],\n key: string,\n value: T,\n options?: { expiresIn?: number }\n ): Promise<void> {\n const expiresIn = options?.expiresIn\n ? options.expiresIn\n : this.options.getTTL\n ? this.options.getTTL(value)\n : undefined;\n\n const fullNS = this.getFullNamespace(namespace);\n\n return this.getParentStore().put(fullNS, key, value, {\n expiresIn,\n });\n }\n\n createSubStore<TNew>(options: string | string[] | SubStoreParams<TNew> = {}) {\n if (typeof options === \"string\") {\n options = { baseNamespace: [options] };\n } else if (Array.isArray(options)) {\n options = { baseNamespace: options };\n }\n return new SubStore<TNew>(this, options);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CIBAAuthorizationRequest.js","sourceRoot":"","sources":["../../../../src/authorizers/ciba/CIBAAuthorizationRequest.ts"],"names":[],"mappings":"","sourcesContent":["export type CIBAAuthorizationRequest = {\n /**\n * The authorization request ID.\n * Use this ID to check the status of the authorization request.\n */\n id: string;\n\n /**\n * The time the authorization request was made.\n */\n requestedAt: number;\n\n /**\n * The time in seconds for the authorization request to expire.\n */\n expiresIn: number;\n\n /**\n * The interval to use when polling the status.\n */\n interval: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"CIBAAuthorizationRequest.js","sourceRoot":"","sources":["../../../../src/authorizers/ciba/CIBAAuthorizationRequest.ts"],"names":[],"mappings":"","sourcesContent":["export type CIBAAuthorizationRequest = {\n /**\n * The authorization request ID.\n * Use this ID to check the status of the authorization request.\n */\n id: string;\n\n /**\n * The time the authorization request was made.\n */\n requestedAt: number;\n\n /**\n * The time in seconds for the authorization request to expire.\n */\n expiresIn: number;\n\n /**\n * The interval in seconds to use when polling the status.\n */\n interval: number;\n};\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Store } from "./Store";
|
|
2
|
+
type StoreOrFactory<T> = Store<T> | (() => Store<T>);
|
|
2
3
|
/**
|
|
3
4
|
* Parameters for configuring a SubStore.
|
|
4
5
|
* @template T The type of values to be stored in the SubStore.
|
|
@@ -18,8 +19,9 @@ type SubStoreParams<T> = {
|
|
|
18
19
|
export declare class SubStore<T = any> implements Store<T> {
|
|
19
20
|
private readonly parent;
|
|
20
21
|
private readonly options;
|
|
21
|
-
constructor(parent:
|
|
22
|
+
constructor(parent: StoreOrFactory<any>, options?: SubStoreParams<T>);
|
|
22
23
|
private getFullNamespace;
|
|
24
|
+
private getParentStore;
|
|
23
25
|
get(namespace: string[], key: string): Promise<any>;
|
|
24
26
|
delete(namespace: string[], key: string): Promise<void>;
|
|
25
27
|
put(namespace: string[], key: string, value: T, options?: {
|
|
@@ -18,11 +18,14 @@ export class SubStore {
|
|
|
18
18
|
}
|
|
19
19
|
return namespace;
|
|
20
20
|
}
|
|
21
|
+
getParentStore() {
|
|
22
|
+
return typeof this.parent === "function" ? this.parent() : this.parent;
|
|
23
|
+
}
|
|
21
24
|
get(namespace, key) {
|
|
22
|
-
return this.
|
|
25
|
+
return this.getParentStore().get(this.getFullNamespace(namespace), key);
|
|
23
26
|
}
|
|
24
27
|
delete(namespace, key) {
|
|
25
|
-
return this.
|
|
28
|
+
return this.getParentStore().delete(this.getFullNamespace(namespace), key);
|
|
26
29
|
}
|
|
27
30
|
put(namespace, key, value, options) {
|
|
28
31
|
const expiresIn = (options === null || options === void 0 ? void 0 : options.expiresIn)
|
|
@@ -31,7 +34,7 @@ export class SubStore {
|
|
|
31
34
|
? this.options.getTTL(value)
|
|
32
35
|
: undefined;
|
|
33
36
|
const fullNS = this.getFullNamespace(namespace);
|
|
34
|
-
return this.
|
|
37
|
+
return this.getParentStore().put(fullNS, key, value, {
|
|
35
38
|
expiresIn,
|
|
36
39
|
});
|
|
37
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubStore.js","sourceRoot":"","sources":["../../../src/stores/SubStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubStore.js","sourceRoot":"","sources":["../../../src/stores/SubStore.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IACnB,YACmB,MAA2B,EAC3B,UAA6B,EAAE;QAD/B,WAAM,GAAN,MAAM,CAAqB;QAC3B,YAAO,GAAP,OAAO,CAAwB;QAEhD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAEO,gBAAgB,CAA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E;QACzE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,GAAG,EAAE,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,OAAO,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,IAAI,QAAQ,CAAO,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import { Store } from \"./Store\";\n\ntype StoreOrFactory<T> = Store<T> | (() => Store<T>);\n\n/**\n * Parameters for configuring a SubStore.\n * @template T The type of values to be stored in the SubStore.\n * @property {string[]} [baseNamespace] - An optional base namespace for the SubStore, used to organize keys in a hierarchical structure.\n * @property {(value: T) => number | undefined} [getTTL] - An optional function that returns the expiry time for a value in milliseconds since epoch, or undefined if the value doesn't expire.\n */\ntype SubStoreParams<T> = {\n baseNamespace?: string[];\n getTTL?: (value: T) => number | undefined;\n};\n\n/**\n * A store implementation that delegates operations to a parent store with optional namespace prefixing.\n *\n * @template T - The type of values stored in this SubStore\n * @implements {Store<T>}\n */\nexport class SubStore<T = any> implements Store<T> {\n constructor(\n private readonly parent: StoreOrFactory<any>,\n private readonly options: SubStoreParams<T> = {}\n ) {\n if (typeof parent === \"undefined\") {\n throw new Error(\"Parent store is required\");\n }\n }\n\n private getFullNamespace(namespace: string[]) {\n if (this.options.baseNamespace) {\n return [...this.options.baseNamespace, ...namespace];\n }\n return namespace;\n }\n\n private getParentStore() {\n return typeof this.parent === \"function\" ? this.parent() : this.parent;\n }\n\n get(namespace: string[], key: string) {\n return this.getParentStore().get(this.getFullNamespace(namespace), key);\n }\n\n delete(namespace: string[], key: string) {\n return this.getParentStore().delete(this.getFullNamespace(namespace), key);\n }\n\n put(\n namespace: string[],\n key: string,\n value: T,\n options?: { expiresIn?: number }\n ): Promise<void> {\n const expiresIn = options?.expiresIn\n ? options.expiresIn\n : this.options.getTTL\n ? this.options.getTTL(value)\n : undefined;\n\n const fullNS = this.getFullNamespace(namespace);\n\n return this.getParentStore().put(fullNS, key, value, {\n expiresIn,\n });\n }\n\n createSubStore<TNew>(options: string | string[] | SubStoreParams<TNew> = {}) {\n if (typeof options === \"string\") {\n options = { baseNamespace: [options] };\n } else if (Array.isArray(options)) {\n options = { baseNamespace: options };\n }\n return new SubStore<TNew>(this, options);\n }\n}\n"]}
|