@strivacity/sdk-core 3.0.3 → 4.0.0-beta.0
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 +1873 -340
- package/dist/assets/oidc.cjs +2 -0
- package/dist/assets/oidc.cjs.map +1 -0
- package/dist/assets/oidc.mjs +2 -0
- package/dist/assets/oidc.mjs.map +1 -0
- package/dist/assets/server.cjs +2 -0
- package/dist/assets/server.cjs.map +1 -0
- package/dist/assets/server.mjs +2 -0
- package/dist/assets/server.mjs.map +1 -0
- package/dist/flows/base.cjs +2 -0
- package/dist/flows/base.cjs.map +1 -0
- package/dist/flows/base.d.ts +26 -0
- package/dist/flows/base.mjs +2 -0
- package/dist/flows/base.mjs.map +1 -0
- package/dist/flows/embedded.cjs +2 -0
- package/dist/flows/embedded.cjs.map +1 -0
- package/dist/flows/embedded.d.ts +9 -0
- package/dist/flows/embedded.mjs +2 -0
- package/dist/flows/embedded.mjs.map +1 -0
- package/dist/flows/index.cjs +1 -0
- package/dist/flows/index.d.ts +5 -0
- package/dist/flows/index.mjs +1 -0
- package/dist/flows/native.cjs +2 -0
- package/dist/flows/native.cjs.map +1 -0
- package/dist/flows/native.d.ts +9 -0
- package/dist/flows/native.mjs +2 -0
- package/dist/flows/native.mjs.map +1 -0
- package/dist/flows/popup.cjs +2 -0
- package/dist/flows/popup.cjs.map +1 -0
- package/dist/flows/popup.d.ts +9 -0
- package/dist/flows/popup.mjs +2 -0
- package/dist/flows/popup.mjs.map +1 -0
- package/dist/flows/redirect.cjs +2 -0
- package/dist/flows/redirect.cjs.map +1 -0
- package/dist/flows/redirect.d.ts +9 -0
- package/dist/flows/redirect.mjs +2 -0
- package/dist/flows/redirect.mjs.map +1 -0
- package/dist/handlers/embedded.cjs +2 -0
- package/dist/handlers/embedded.cjs.map +1 -0
- package/dist/handlers/embedded.d.ts +37 -0
- package/dist/handlers/embedded.mjs +2 -0
- package/dist/handlers/embedded.mjs.map +1 -0
- package/dist/handlers/index.cjs +1 -0
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.mjs +1 -0
- package/dist/handlers/native.cjs +2 -0
- package/dist/handlers/native.cjs.map +1 -0
- package/dist/handlers/native.d.ts +56 -0
- package/dist/handlers/native.mjs +2 -0
- package/dist/handlers/native.mjs.map +1 -0
- package/dist/handlers/popup.cjs +2 -0
- package/dist/handlers/popup.cjs.map +1 -0
- package/dist/handlers/popup.d.ts +21 -0
- package/dist/handlers/popup.mjs +2 -0
- package/dist/handlers/popup.mjs.map +1 -0
- package/dist/handlers/redirect.cjs +2 -0
- package/dist/handlers/redirect.cjs.map +1 -0
- package/dist/handlers/redirect.d.ts +18 -0
- package/dist/handlers/redirect.mjs +2 -0
- package/dist/handlers/redirect.mjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -21
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/server/base.cjs +2 -0
- package/dist/server/base.cjs.map +1 -0
- package/dist/server/base.d.ts +15 -0
- package/dist/server/base.mjs +2 -0
- package/dist/server/base.mjs.map +1 -0
- package/dist/server/index.cjs +1 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.mjs +1 -0
- package/dist/storages/cache.cjs +2 -0
- package/dist/storages/cache.cjs.map +1 -0
- package/dist/storages/cache.d.ts +11 -0
- package/dist/storages/cache.mjs +2 -0
- package/dist/storages/cache.mjs.map +1 -0
- package/dist/storages/index.cjs +1 -0
- package/dist/storages/index.d.ts +7 -0
- package/dist/storages/index.mjs +1 -0
- package/dist/storages/indexeddb.cjs +2 -0
- package/dist/storages/indexeddb.cjs.map +1 -0
- package/dist/storages/indexeddb.d.ts +10 -0
- package/dist/storages/indexeddb.mjs +2 -0
- package/dist/storages/indexeddb.mjs.map +1 -0
- package/dist/storages/local.cjs +2 -0
- package/dist/storages/local.cjs.map +1 -0
- package/dist/storages/local.d.ts +7 -0
- package/dist/storages/local.mjs +2 -0
- package/dist/storages/local.mjs.map +1 -0
- package/dist/storages/memory.cjs +2 -0
- package/dist/storages/memory.cjs.map +1 -0
- package/dist/storages/memory.d.ts +8 -0
- package/dist/storages/memory.mjs +2 -0
- package/dist/storages/memory.mjs.map +1 -0
- package/dist/storages/server.cjs +1 -0
- package/dist/storages/server.d.ts +39 -0
- package/dist/storages/server.mjs +1 -0
- package/dist/storages/session.cjs +2 -0
- package/dist/storages/session.cjs.map +1 -0
- package/dist/storages/session.d.ts +7 -0
- package/dist/storages/session.mjs +2 -0
- package/dist/storages/session.mjs.map +1 -0
- package/dist/storages/worker.cjs +2 -0
- package/dist/storages/worker.cjs.map +1 -0
- package/dist/storages/worker.d.ts +46 -0
- package/dist/storages/worker.mjs +2 -0
- package/dist/storages/worker.mjs.map +1 -0
- package/dist/types/common.cjs +0 -0
- package/dist/types/common.d.ts +145 -0
- package/dist/types/common.mjs +0 -0
- package/dist/types/embedded.cjs +0 -0
- package/dist/types/embedded.d.ts +103 -0
- package/dist/types/embedded.mjs +0 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/native.cjs +0 -0
- package/dist/types/native.d.ts +385 -0
- package/dist/types/native.mjs +0 -0
- package/dist/types/oidc.cjs +2 -0
- package/dist/types/oidc.cjs.map +1 -0
- package/dist/types/oidc.d.ts +768 -0
- package/dist/types/oidc.mjs +2 -0
- package/dist/types/oidc.mjs.map +1 -0
- package/dist/types/popup.cjs +0 -0
- package/dist/types/popup.d.ts +69 -0
- package/dist/types/popup.mjs +0 -0
- package/dist/types/redirect.cjs +0 -0
- package/dist/types/redirect.d.ts +21 -0
- package/dist/types/redirect.mjs +0 -0
- package/dist/types/server.cjs +0 -0
- package/dist/types/server.d.ts +200 -0
- package/dist/types/server.mjs +0 -0
- package/dist/utils/base64url.cjs +2 -0
- package/dist/utils/base64url.cjs.map +1 -0
- package/dist/utils/base64url.d.ts +14 -0
- package/dist/utils/base64url.mjs +2 -0
- package/dist/utils/base64url.mjs.map +1 -0
- package/dist/utils/common.cjs +2 -0
- package/dist/utils/common.cjs.map +1 -0
- package/dist/utils/common.d.ts +23 -0
- package/dist/utils/common.mjs +2 -0
- package/dist/utils/common.mjs.map +1 -0
- package/dist/utils/credentials.cjs +2 -2
- package/dist/utils/credentials.cjs.map +1 -1
- package/dist/utils/credentials.d.ts +19 -3
- package/dist/utils/credentials.mjs +2 -2
- package/dist/utils/credentials.mjs.map +1 -1
- package/dist/utils/crypto.cjs +2 -2
- package/dist/utils/crypto.cjs.map +1 -1
- package/dist/utils/crypto.d.ts +16 -26
- package/dist/utils/crypto.mjs +2 -2
- package/dist/utils/crypto.mjs.map +1 -1
- package/dist/utils/dom.cjs +2 -0
- package/dist/utils/dom.cjs.map +1 -0
- package/dist/utils/dom.d.ts +7 -0
- package/dist/utils/dom.mjs +2 -0
- package/dist/utils/dom.mjs.map +1 -0
- package/dist/utils/errors.cjs +2 -2
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.d.ts +62 -1
- package/dist/utils/errors.mjs +2 -2
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/httpClient.cjs +2 -0
- package/dist/utils/httpClient.cjs.map +1 -0
- package/dist/utils/httpClient.d.ts +2 -0
- package/dist/utils/httpClient.mjs +2 -0
- package/dist/utils/httpClient.mjs.map +1 -0
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.mjs +1 -0
- package/dist/utils/logging.cjs +2 -0
- package/dist/utils/logging.cjs.map +1 -0
- package/dist/utils/logging.d.ts +2 -0
- package/dist/utils/logging.mjs +2 -0
- package/dist/utils/logging.mjs.map +1 -0
- package/dist/utils/oidc.cjs +1 -0
- package/dist/utils/oidc.d.ts +264 -0
- package/dist/utils/oidc.mjs +1 -0
- package/dist/utils/server.cjs +1 -0
- package/dist/utils/server.d.ts +72 -0
- package/dist/utils/server.mjs +1 -0
- package/dist/utils/session.cjs +2 -0
- package/dist/utils/session.cjs.map +1 -0
- package/dist/utils/session.d.ts +29 -0
- package/dist/utils/session.mjs +2 -0
- package/dist/utils/session.mjs.map +1 -0
- package/dist/utils/state.cjs +1 -0
- package/dist/utils/state.d.ts +23 -0
- package/dist/utils/state.mjs +1 -0
- package/package.json +53 -1
- package/testing/tests/flows/base.spec.ts +1030 -0
- package/testing/tests/flows/embedded.spec.ts +443 -0
- package/testing/tests/flows/index.spec.ts +8 -0
- package/testing/tests/flows/native.spec.ts +487 -0
- package/testing/tests/flows/popup.spec.ts +400 -0
- package/testing/tests/flows/redirect.spec.ts +369 -0
- package/testing/tests/handlers/embedded.spec.ts +199 -0
- package/testing/tests/handlers/index.spec.ts +8 -0
- package/testing/tests/handlers/native.spec.ts +283 -0
- package/testing/tests/handlers/popup.spec.ts +206 -0
- package/testing/tests/handlers/redirect.spec.ts +70 -0
- package/testing/tests/index.spec.ts +78 -0
- package/testing/tests/server/base.spec.ts +846 -0
- package/testing/tests/server/index.spec.ts +15 -0
- package/testing/tests/storages/cache.spec.ts +107 -0
- package/testing/tests/storages/index.spec.ts +22 -0
- package/testing/tests/storages/indexeddb.spec.ts +113 -0
- package/testing/tests/storages/local.spec.ts +46 -0
- package/testing/tests/storages/memory.spec.ts +51 -0
- package/testing/tests/storages/server.spec.ts +435 -0
- package/testing/tests/storages/session.spec.ts +46 -0
- package/testing/tests/storages/worker.spec.ts +106 -0
- package/testing/tests/utils/common.spec.ts +77 -0
- package/testing/tests/utils/credentials.spec.ts +195 -0
- package/testing/tests/utils/dom.spec.ts +37 -0
- package/testing/tests/utils/index.spec.ts +71 -0
- package/testing/tests/utils/logging.spec.ts +82 -0
- package/testing/tests/utils/oidc.spec.ts +744 -0
- package/testing/tests/utils/server.spec.ts +235 -0
- package/dist/flows/BaseFlow.cjs +0 -2
- package/dist/flows/BaseFlow.cjs.map +0 -1
- package/dist/flows/BaseFlow.d.ts +0 -191
- package/dist/flows/BaseFlow.mjs +0 -2
- package/dist/flows/BaseFlow.mjs.map +0 -1
- package/dist/flows/EmbeddedFlow.cjs +0 -2
- package/dist/flows/EmbeddedFlow.cjs.map +0 -1
- package/dist/flows/EmbeddedFlow.d.ts +0 -26
- package/dist/flows/EmbeddedFlow.mjs +0 -2
- package/dist/flows/EmbeddedFlow.mjs.map +0 -1
- package/dist/flows/NativeFlow.cjs +0 -2
- package/dist/flows/NativeFlow.cjs.map +0 -1
- package/dist/flows/NativeFlow.d.ts +0 -34
- package/dist/flows/NativeFlow.mjs +0 -2
- package/dist/flows/NativeFlow.mjs.map +0 -1
- package/dist/flows/PopupFlow.cjs +0 -2
- package/dist/flows/PopupFlow.cjs.map +0 -1
- package/dist/flows/PopupFlow.d.ts +0 -36
- package/dist/flows/PopupFlow.mjs +0 -2
- package/dist/flows/PopupFlow.mjs.map +0 -1
- package/dist/flows/RedirectFlow.cjs +0 -2
- package/dist/flows/RedirectFlow.cjs.map +0 -1
- package/dist/flows/RedirectFlow.d.ts +0 -38
- package/dist/flows/RedirectFlow.mjs +0 -2
- package/dist/flows/RedirectFlow.mjs.map +0 -1
- package/dist/handlers/BaseFlowHandler.cjs +0 -2
- package/dist/handlers/BaseFlowHandler.cjs.map +0 -1
- package/dist/handlers/BaseFlowHandler.d.ts +0 -61
- package/dist/handlers/BaseFlowHandler.mjs +0 -2
- package/dist/handlers/BaseFlowHandler.mjs.map +0 -1
- package/dist/handlers/EmbeddedFlowHandler.cjs +0 -2
- package/dist/handlers/EmbeddedFlowHandler.cjs.map +0 -1
- package/dist/handlers/EmbeddedFlowHandler.d.ts +0 -28
- package/dist/handlers/EmbeddedFlowHandler.mjs +0 -2
- package/dist/handlers/EmbeddedFlowHandler.mjs.map +0 -1
- package/dist/handlers/NativeFlowHandler.cjs +0 -2
- package/dist/handlers/NativeFlowHandler.cjs.map +0 -1
- package/dist/handlers/NativeFlowHandler.d.ts +0 -31
- package/dist/handlers/NativeFlowHandler.mjs +0 -2
- package/dist/handlers/NativeFlowHandler.mjs.map +0 -1
- package/dist/storages/LocalStorage.cjs +0 -2
- package/dist/storages/LocalStorage.cjs.map +0 -1
- package/dist/storages/LocalStorage.d.ts +0 -23
- package/dist/storages/LocalStorage.mjs +0 -2
- package/dist/storages/LocalStorage.mjs.map +0 -1
- package/dist/storages/SessionStorage.cjs +0 -2
- package/dist/storages/SessionStorage.cjs.map +0 -1
- package/dist/storages/SessionStorage.d.ts +0 -23
- package/dist/storages/SessionStorage.mjs +0 -2
- package/dist/storages/SessionStorage.mjs.map +0 -1
- package/dist/types.cjs +0 -2
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.ts +0 -1263
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
- package/dist/utils/HttpClient.cjs +0 -2
- package/dist/utils/HttpClient.cjs.map +0 -1
- package/dist/utils/HttpClient.d.ts +0 -4
- package/dist/utils/HttpClient.mjs +0 -2
- package/dist/utils/HttpClient.mjs.map +0 -1
- package/dist/utils/Logging.cjs +0 -2
- package/dist/utils/Logging.cjs.map +0 -1
- package/dist/utils/Logging.d.ts +0 -8
- package/dist/utils/Logging.mjs +0 -2
- package/dist/utils/Logging.mjs.map +0 -1
- package/dist/utils/Metadata.cjs +0 -2
- package/dist/utils/Metadata.cjs.map +0 -1
- package/dist/utils/Metadata.d.ts +0 -98
- package/dist/utils/Metadata.mjs +0 -2
- package/dist/utils/Metadata.mjs.map +0 -1
- package/dist/utils/Session.cjs +0 -2
- package/dist/utils/Session.cjs.map +0 -1
- package/dist/utils/Session.d.ts +0 -82
- package/dist/utils/Session.mjs +0 -2
- package/dist/utils/Session.mjs.map +0 -1
- package/dist/utils/State.cjs +0 -2
- package/dist/utils/State.cjs.map +0 -1
- package/dist/utils/State.d.ts +0 -43
- package/dist/utils/State.mjs +0 -2
- package/dist/utils/State.mjs.map +0 -1
- package/dist/utils/base64Url.cjs +0 -2
- package/dist/utils/base64Url.cjs.map +0 -1
- package/dist/utils/base64Url.d.ts +0 -27
- package/dist/utils/base64Url.mjs +0 -2
- package/dist/utils/base64Url.mjs.map +0 -1
- package/dist/utils/date.cjs +0 -2
- package/dist/utils/date.cjs.map +0 -1
- package/dist/utils/date.d.ts +0 -6
- package/dist/utils/date.mjs +0 -2
- package/dist/utils/date.mjs.map +0 -1
- package/dist/utils/handlers.cjs +0 -2
- package/dist/utils/handlers.cjs.map +0 -1
- package/dist/utils/handlers.d.ts +0 -35
- package/dist/utils/handlers.mjs +0 -2
- package/dist/utils/handlers.mjs.map +0 -1
- package/dist/utils/jwt.cjs +0 -2
- package/dist/utils/jwt.cjs.map +0 -1
- package/dist/utils/jwt.d.ts +0 -34
- package/dist/utils/jwt.mjs +0 -2
- package/dist/utils/jwt.mjs.map +0 -1
- package/dist/utils/object.cjs +0 -2
- package/dist/utils/object.cjs.map +0 -1
- package/dist/utils/object.d.ts +0 -1
- package/dist/utils/object.mjs +0 -2
- package/dist/utils/object.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexeddb.mjs","names":[],"sources":["../../src/storages/indexeddb.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\nconst DEFAULT_DB_NAME = 'sdk-storage';\nconst DEFAULT_STORE_NAME = 'kv';\nconst DB_VERSION = 1;\n\nfunction openDB(dbName: string, storeName: string): Promise<IDBDatabase> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst request = indexedDB.open(dbName, DB_VERSION);\n\n\t\trequest.onupgradeneeded = (event) => {\n\t\t\tconst db = (event.target as IDBOpenDBRequest).result;\n\n\t\t\tif (!db.objectStoreNames.contains(storeName)) {\n\t\t\t\tdb.createObjectStore(storeName);\n\t\t\t}\n\t\t};\n\n\t\trequest.onsuccess = (event) => resolve((event.target as IDBOpenDBRequest).result);\n\t\trequest.onerror = (event) => reject((event.target as IDBOpenDBRequest).error);\n\t});\n}\n\nfunction tx(db: IDBDatabase, storeName: string, mode: IDBTransactionMode): IDBObjectStore {\n\treturn db.transaction(storeName, mode).objectStore(storeName);\n}\n\n/**\n * Creates a storage adapter that uses the browser's `IndexedDB` API.\n * Works in both the main thread and in Service Workers.\n *\n * @param {string} [dbName='sdk-storage'] - The name of the IndexedDB database.\n * @param {string} [storeName='kv'] - The name of the object store within the database.\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createIndexedDBStorage(dbName = DEFAULT_DB_NAME, storeName = DEFAULT_STORE_NAME): SDKStorage {\n\tlet dbPromise: Promise<IDBDatabase> | null = null;\n\n\tfunction getDB(): Promise<IDBDatabase> {\n\t\tif (!dbPromise) {\n\t\t\tdbPromise = openDB(dbName, storeName);\n\t\t}\n\n\t\treturn dbPromise;\n\t}\n\n\treturn {\n\t\tget: async (key) => {\n\t\t\tconst db = await getDB();\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst request = tx(db, storeName, 'readonly').get(key);\n\n\t\t\t\trequest.onsuccess = (event) => resolve((event.target as IDBRequest<string | undefined>).result ?? null);\n\t\t\t\trequest.onerror = (event) => reject((event.target as IDBRequest).error);\n\t\t\t});\n\t\t},\n\t\tset: async (key, value) => {\n\t\t\tconst db = await getDB();\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst request = tx(db, storeName, 'readwrite').put(value, key);\n\n\t\t\t\trequest.onsuccess = () => resolve();\n\t\t\t\trequest.onerror = (event) => reject((event.target as IDBRequest).error);\n\t\t\t});\n\t\t},\n\t\tdelete: async (key) => {\n\t\t\tconst db = await getDB();\n\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tconst request = tx(db, storeName, 'readwrite').delete(key);\n\n\t\t\t\trequest.onsuccess = () => resolve();\n\t\t\t\trequest.onerror = (event) => reject((event.target as IDBRequest).error);\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":"AAMA,SAAS,EAAO,EAAgB,EAAyC,CACxE,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAU,UAAU,KAAK,EAAQ,CAAU,EAEjD,EAAQ,gBAAmB,GAAU,CACpC,IAAM,EAAM,EAAM,OAA4B,OAEzC,EAAG,iBAAiB,SAAS,CAAS,GAC1C,EAAG,kBAAkB,CAAS,CAEhC,EAEA,EAAQ,UAAa,GAAU,EAAS,EAAM,OAA4B,MAAM,EAChF,EAAQ,QAAW,GAAU,EAAQ,EAAM,OAA4B,KAAK,CAC7E,CAAC,CACF,CAEA,SAAS,EAAG,EAAiB,EAAmB,EAA0C,CACzF,OAAO,EAAG,YAAY,EAAW,CAAI,CAAC,CAAC,YAAY,CAAS,CAC7D,CAUA,SAAgB,EAAuB,EAAS,cAAiB,EAAY,KAAgC,CAC5G,IAAI,EAAyC,KAE7C,SAAS,GAA8B,CAKtC,MAJA,CACC,IAAY,EAAO,EAAQ,CAAS,EAG9B,CACR,CAEA,MAAO,CACN,IAAK,KAAO,IAAQ,CACnB,IAAM,EAAK,MAAM,EAAM,EAEvB,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAU,EAAG,EAAI,EAAW,UAAU,CAAC,CAAC,IAAI,CAAG,EAErD,EAAQ,UAAa,GAAU,EAAS,EAAM,OAA0C,QAAU,IAAI,EACtG,EAAQ,QAAW,GAAU,EAAQ,EAAM,OAAsB,KAAK,CACvE,CAAC,CACF,EACA,IAAK,MAAO,EAAK,IAAU,CAC1B,IAAM,EAAK,MAAM,EAAM,EAEvB,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAU,EAAG,EAAI,EAAW,WAAW,CAAC,CAAC,IAAI,EAAO,CAAG,EAE7D,EAAQ,cAAkB,EAAQ,EAClC,EAAQ,QAAW,GAAU,EAAQ,EAAM,OAAsB,KAAK,CACvE,CAAC,CACF,EACA,OAAQ,KAAO,IAAQ,CACtB,IAAM,EAAK,MAAM,EAAM,EAEvB,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAU,EAAG,EAAI,EAAW,WAAW,CAAC,CAAC,OAAO,CAAG,EAEzD,EAAQ,cAAkB,EAAQ,EAClC,EAAQ,QAAW,GAAU,EAAQ,EAAM,OAAsB,KAAK,CACvE,CAAC,CACF,CACD,CACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){return{get:e=>Promise.resolve(globalThis.localStorage?.getItem(e)??null),set:(e,t)=>(globalThis.localStorage?.setItem(e,t),Promise.resolve()),delete:e=>(globalThis.localStorage?.removeItem(e),Promise.resolve())}}exports.createLocalStorage=e;
|
|
2
|
+
//# sourceMappingURL=local.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.cjs","names":[],"sources":["../../src/storages/local.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * Creates a storage adapter that uses the browser's `localStorage` API.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createLocalStorage(): SDKStorage {\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(globalThis.localStorage?.getItem(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tglobalThis.localStorage?.setItem(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tglobalThis.localStorage?.removeItem(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"mEAOA,SAAgB,GAAiC,CAChD,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,WAAW,cAAc,QAAQ,CAAG,GAAK,IAAI,EAErE,KAAM,EAAK,KACV,WAAW,cAAc,QAAQ,EAAK,CAAK,EAEpC,QAAQ,QAAQ,GAExB,OAAS,IACR,WAAW,cAAc,WAAW,CAAG,EAEhC,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SDKStorage } from '../types/common';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a storage adapter that uses the browser's `localStorage` API.
|
|
4
|
+
*
|
|
5
|
+
* @returns {SDKStorage} An object implementing the SDKStorage interface.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createLocalStorage(): SDKStorage;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(){return{get:e=>Promise.resolve(globalThis.localStorage?.getItem(e)??null),set:(e,t)=>(globalThis.localStorage?.setItem(e,t),Promise.resolve()),delete:e=>(globalThis.localStorage?.removeItem(e),Promise.resolve())}}export{e as createLocalStorage};
|
|
2
|
+
//# sourceMappingURL=local.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.mjs","names":[],"sources":["../../src/storages/local.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * Creates a storage adapter that uses the browser's `localStorage` API.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createLocalStorage(): SDKStorage {\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(globalThis.localStorage?.getItem(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tglobalThis.localStorage?.setItem(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tglobalThis.localStorage?.removeItem(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"AAOA,SAAgB,GAAiC,CAChD,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,WAAW,cAAc,QAAQ,CAAG,GAAK,IAAI,EAErE,KAAM,EAAK,KACV,WAAW,cAAc,QAAQ,EAAK,CAAK,EAEpC,QAAQ,QAAQ,GAExB,OAAS,IACR,WAAW,cAAc,WAAW,CAAG,EAEhC,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){let e=new Map;return{get:t=>Promise.resolve(e.get(t)??null),set:(t,n)=>(e.set(t,n),Promise.resolve()),delete:t=>(e.delete(t),Promise.resolve())}}exports.createMemoryStorage=e;
|
|
2
|
+
//# sourceMappingURL=memory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.cjs","names":[],"sources":["../../src/storages/memory.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * In-memory storage adapter for session data.\n * Not recommended for production use, as session data will be lost on page reload.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createMemoryStorage(): SDKStorage {\n\tconst store = new Map<string, string>();\n\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(store.get(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tstore.set(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tstore.delete(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"mEAQA,SAAgB,GAAkC,CACjD,IAAM,EAAQ,IAAI,IAElB,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,EAAM,IAAI,CAAG,GAAK,IAAI,EAE9C,KAAM,EAAK,KACV,EAAM,IAAI,EAAK,CAAK,EAEb,QAAQ,QAAQ,GAExB,OAAS,IACR,EAAM,OAAO,CAAG,EAET,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SDKStorage } from '../types/common';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory storage adapter for session data.
|
|
4
|
+
* Not recommended for production use, as session data will be lost on page reload.
|
|
5
|
+
*
|
|
6
|
+
* @returns {SDKStorage} An object implementing the SDKStorage interface.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMemoryStorage(): SDKStorage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.mjs","names":[],"sources":["../../src/storages/memory.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * In-memory storage adapter for session data.\n * Not recommended for production use, as session data will be lost on page reload.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createMemoryStorage(): SDKStorage {\n\tconst store = new Map<string, string>();\n\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(store.get(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tstore.set(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tstore.delete(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"AAQA,SAAgB,GAAkC,CACjD,IAAM,EAAQ,IAAI,IAElB,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,EAAM,IAAI,CAAG,GAAK,IAAI,EAE9C,KAAM,EAAK,KACV,EAAM,IAAI,EAAK,CAAK,EAEb,QAAQ,QAAQ,GAExB,OAAS,IACR,EAAM,OAAO,CAAG,EAET,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../assets/server.cjs");exports.COOKIE_CHUNK_SIZE=e.f,exports.COOKIE_CONTEXT=e.p,exports.createEncryptedCookieStorage=e.m,exports.createServerMemoryStorage=e.h,exports.createServerStateStorage=e.g,exports.createSessionIdCookieStorage=e._;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SDKStorage } from '../types/common';
|
|
2
|
+
import { EncryptedCookieStorageOptions, ServerAdapter, ServerStorage, SessionIdCookieStorageOptions } from '../types/server';
|
|
3
|
+
export declare const COOKIE_CONTEXT = "strivacity-session-v1";
|
|
4
|
+
export declare const COOKIE_CHUNK_SIZE = 3900;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a simple in-memory state storage implementation, shared across all server adapters.
|
|
7
|
+
*
|
|
8
|
+
* @returns {SDKStorage} An object implementing the SDKStorage interface.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createServerStateStorage(): SDKStorage;
|
|
11
|
+
/**
|
|
12
|
+
* In-memory global storage adapter for session data.
|
|
13
|
+
* Not recommended for production use, as session data will be lost on server restart.
|
|
14
|
+
*
|
|
15
|
+
* @returns {ServerStorage} An object implementing the ServerStorage interface.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createServerMemoryStorage(): ServerStorage;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a session storage that puts a session-id value cookie on the client and keeping the actual session data in the given `storage`.
|
|
20
|
+
*
|
|
21
|
+
* @param {ServerAdapter<TEvent>} adapter - The framework adapter used to read the incoming request.
|
|
22
|
+
* @param {ServerStorage<TEvent>} storage - The storage used to persist session data, keyed by a randomly generated session id.
|
|
23
|
+
* @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.
|
|
24
|
+
* @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
|
|
25
|
+
* @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.
|
|
26
|
+
* @returns {ServerStorage<TEvent>} An object implementing the `ServerStorage` interface for managing sessions indexed by a session-id cookie.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createSessionIdCookieStorage<TEvent = unknown>(adapter: ServerAdapter<TEvent>, storage: ServerStorage, options?: SessionIdCookieStorageOptions): ServerStorage<TEvent>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates an encrypted session storage backed by cookies.
|
|
31
|
+
* Built entirely on top of `adapter.toRequest`'s `Request` (reading the `cookie` header) and the outgoing cookie jar (writing `set-cookie` headers).
|
|
32
|
+
*
|
|
33
|
+
* @param {string} secret - The secret key used for encryption and decryption.
|
|
34
|
+
* @param {ServerAdapter<TEvent>} adapter - The framework adapter used to read the incoming request.
|
|
35
|
+
* @param {EncryptedCookieStorageOptions} [options] - Cookie attributes (maxAge, sameSite, etc.). `path` defaults to `'/'`.
|
|
36
|
+
* @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
|
|
37
|
+
* @returns {ServerStorage<TEvent>} An object implementing the `ServerStorage` interface for managing encrypted session cookies.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createEncryptedCookieStorage<TEvent = unknown>(secret: string, adapter: ServerAdapter<TEvent>, options?: EncryptedCookieStorageOptions): ServerStorage<TEvent>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,f as t,g as n,h as r,m as i,p as a}from"../assets/server.mjs";export{t as COOKIE_CHUNK_SIZE,a as COOKIE_CONTEXT,i as createEncryptedCookieStorage,r as createServerMemoryStorage,n as createServerStateStorage,e as createSessionIdCookieStorage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){return{get:e=>Promise.resolve(globalThis.sessionStorage?.getItem(e)??null),set:(e,t)=>(globalThis.sessionStorage?.setItem(e,t),Promise.resolve()),delete:e=>(globalThis.sessionStorage?.removeItem(e),Promise.resolve())}}exports.createSessionStorage=e;
|
|
2
|
+
//# sourceMappingURL=session.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.cjs","names":[],"sources":["../../src/storages/session.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * Creates a storage adapter that uses the browser's `sessionStorage` API.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createSessionStorage(): SDKStorage {\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(globalThis.sessionStorage?.getItem(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tglobalThis.sessionStorage?.setItem(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tglobalThis.sessionStorage?.removeItem(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"mEAOA,SAAgB,GAAmC,CAClD,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,WAAW,gBAAgB,QAAQ,CAAG,GAAK,IAAI,EAEvE,KAAM,EAAK,KACV,WAAW,gBAAgB,QAAQ,EAAK,CAAK,EAEtC,QAAQ,QAAQ,GAExB,OAAS,IACR,WAAW,gBAAgB,WAAW,CAAG,EAElC,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SDKStorage } from '../types/common';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a storage adapter that uses the browser's `sessionStorage` API.
|
|
4
|
+
*
|
|
5
|
+
* @returns {SDKStorage} An object implementing the SDKStorage interface.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createSessionStorage(): SDKStorage;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(){return{get:e=>Promise.resolve(globalThis.sessionStorage?.getItem(e)??null),set:(e,t)=>(globalThis.sessionStorage?.setItem(e,t),Promise.resolve()),delete:e=>(globalThis.sessionStorage?.removeItem(e),Promise.resolve())}}export{e as createSessionStorage};
|
|
2
|
+
//# sourceMappingURL=session.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.mjs","names":[],"sources":["../../src/storages/session.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\n/**\n * Creates a storage adapter that uses the browser's `sessionStorage` API.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createSessionStorage(): SDKStorage {\n\treturn {\n\t\tget: (key) => {\n\t\t\treturn Promise.resolve(globalThis.sessionStorage?.getItem(key) ?? null);\n\t\t},\n\t\tset: (key, value) => {\n\t\t\tglobalThis.sessionStorage?.setItem(key, value);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t\tdelete: (key) => {\n\t\t\tglobalThis.sessionStorage?.removeItem(key);\n\n\t\t\treturn Promise.resolve();\n\t\t},\n\t};\n}\n"],"mappings":"AAOA,SAAgB,GAAmC,CAClD,MAAO,CACN,IAAM,GACE,QAAQ,QAAQ,WAAW,gBAAgB,QAAQ,CAAG,GAAK,IAAI,EAEvE,KAAM,EAAK,KACV,WAAW,gBAAgB,QAAQ,EAAK,CAAK,EAEtC,QAAQ,QAAQ,GAExB,OAAS,IACR,WAAW,gBAAgB,WAAW,CAAG,EAElC,QAAQ,QAAQ,EAEzB,CACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){let t=0,n=new Map;e.addEventListener(`message`,e=>{let{requestId:t,result:r,error:i}=e.data,a=n.get(t);a&&(n.delete(t),i===void 0?a.resolve(r??null):a.reject(Error(i)))});function r(r,i,a){return new Promise((o,s)=>{let c=`${r}:${++t}`;n.set(c,{resolve:o,reject:s}),e.postMessage({requestId:c,type:r,key:i,value:a})})}return{get:async e=>await r(`get`,e),set:async(e,t)=>{await r(`set`,e,t)},delete:async e=>{await r(`delete`,e)}}}function t(e){self.addEventListener(`message`,t=>void(async()=>{let{requestId:n,type:r,key:i,value:a}=t.data;if(!(!n||!r||!i))try{let t;r===`get`?t=await e.get(i):r===`set`?await e.set(i,a):r===`delete`&&await e.delete(i),self.postMessage({requestId:n,result:t})}catch(e){let t=e instanceof Error?e.message:String(e);self.postMessage({requestId:n,error:t})}})())}exports.createWorkerStorage=e,exports.handleWorkerStorageRequests=t;
|
|
2
|
+
//# sourceMappingURL=worker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.cjs","names":[],"sources":["../../src/storages/worker.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\nexport type WorkerStorageRequestType = 'get' | 'set' | 'delete';\n\nexport type WorkerStorageRequest = {\n\trequestId: string;\n\ttype: WorkerStorageRequestType;\n\tkey: string;\n\tvalue?: string;\n};\n\nexport type WorkerStorageResponse = {\n\trequestId: string;\n\tresult?: string | null;\n\terror?: string;\n};\n\n/**\n * Creates a storage adapter that delegates all operations to a `Worker` via `postMessage`.\n *\n * The Worker must be initialized with {@link handleWorkerStorageRequests} to handle the incoming messages.\n *\n * @example\n * ```ts\n * const worker = new Worker(new URL('./storage.worker.ts', import.meta.url), { type: 'module' });\n * const storage = createWorkerStorage(worker);\n * ```\n *\n * @param {Worker} worker - The Worker instance to communicate with.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createWorkerStorage(worker: Worker): SDKStorage {\n\tlet counter = 0;\n\tconst pending = new Map<string, { resolve: (value: string | null) => void; reject: (reason: Error) => void }>();\n\n\tworker.addEventListener('message', (event: MessageEvent<WorkerStorageResponse>) => {\n\t\tconst { requestId, result, error } = event.data;\n\t\tconst deferred = pending.get(requestId);\n\n\t\tif (!deferred) {\n\t\t\treturn;\n\t\t}\n\n\t\tpending.delete(requestId);\n\n\t\tif (error !== undefined) {\n\t\t\tdeferred.reject(new Error(error));\n\t\t} else {\n\t\t\tdeferred.resolve(result ?? null);\n\t\t}\n\t});\n\n\tfunction sendMessage(type: WorkerStorageRequestType, key: string, value?: string): Promise<string | null> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst requestId = `${type}:${++counter}`;\n\n\t\t\tpending.set(requestId, { resolve, reject });\n\t\t\tworker.postMessage({ requestId, type, key, value } satisfies WorkerStorageRequest);\n\t\t});\n\t}\n\n\treturn {\n\t\tget: async (key) => {\n\t\t\treturn await sendMessage('get', key);\n\t\t},\n\t\tset: async (key, value) => {\n\t\t\tawait sendMessage('set', key, value);\n\t\t},\n\t\tdelete: async (key) => {\n\t\t\tawait sendMessage('delete', key);\n\t\t},\n\t};\n}\n\n/**\n * Sets up a message listener inside a Worker that handles storage requests sent by {@link createWorkerStorage}.\n *\n * Call this once at the top level of your Worker script. The provided `storage` can be any `SDKStorage`\n * implementation - `createIndexedDBStorage` and `createCacheAPIStorage` are the recommended choices\n * because they are natively available inside Workers.\n *\n * @example\n * ```ts\n * import { handleWorkerStorageRequests, createIndexedDBStorage } from '@strivacity/sdk-core/types';\n *\n * handleWorkerStorageRequests(createIndexedDBStorage());\n * ```\n *\n * @param {SDKStorage} storage - The underlying storage to use inside the Worker.\n */\nexport function handleWorkerStorageRequests(storage: SDKStorage): void {\n\t(self as unknown as Worker).addEventListener(\n\t\t'message',\n\t\t(event: MessageEvent<WorkerStorageRequest>) =>\n\t\t\tvoid (async () => {\n\t\t\t\tconst { requestId, type, key, value } = event.data;\n\n\t\t\t\tif (!requestId || !type || !key) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tlet result: string | null | undefined;\n\n\t\t\t\t\tif (type === 'get') {\n\t\t\t\t\t\tresult = await storage.get(key);\n\t\t\t\t\t} else if (type === 'set') {\n\t\t\t\t\t\tawait storage.set(key, value!);\n\t\t\t\t\t} else if (type === 'delete') {\n\t\t\t\t\t\tawait storage.delete(key);\n\t\t\t\t\t}\n\n\t\t\t\t\t(self as unknown as Worker).postMessage({ requestId, result } satisfies WorkerStorageResponse);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst error = err instanceof Error ? err.message : String(err);\n\n\t\t\t\t\t(self as unknown as Worker).postMessage({ requestId, error } satisfies WorkerStorageResponse);\n\t\t\t\t}\n\t\t\t})(),\n\t);\n}\n"],"mappings":"mEAgCA,SAAgB,EAAoB,EAA4B,CAC/D,IAAI,EAAU,EACR,EAAU,IAAI,IAEpB,EAAO,iBAAiB,UAAY,GAA+C,CAClF,GAAM,CAAE,YAAW,SAAQ,SAAU,EAAM,KACrC,EAAW,EAAQ,IAAI,CAAS,EAEjC,IAIL,EAAQ,OAAO,CAAS,EAEpB,IAAU,IAAA,GAGb,EAAS,QAAQ,GAAU,IAAI,EAF/B,EAAS,OAAW,MAAM,CAAK,CAAC,EAIlC,CAAC,EAED,SAAS,EAAY,EAAgC,EAAa,EAAwC,CACzG,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAY,GAAG,EAAK,GAAG,EAAE,IAE/B,EAAQ,IAAI,EAAW,CAAE,UAAS,QAAO,CAAC,EAC1C,EAAO,YAAY,CAAE,YAAW,OAAM,MAAK,OAAM,CAAgC,CAClF,CAAC,CACF,CAEA,MAAO,CACN,IAAK,KAAO,IACJ,MAAM,EAAY,MAAO,CAAG,EAEpC,IAAK,MAAO,EAAK,IAAU,CAC1B,MAAM,EAAY,MAAO,EAAK,CAAK,CACpC,EACA,OAAQ,KAAO,IAAQ,CACtB,MAAM,EAAY,SAAU,CAAG,CAChC,CACD,CACD,CAkBA,SAAgB,EAA4B,EAA2B,CACtE,KAA4B,iBAC3B,UACC,GACA,KAAM,SAAY,CACjB,GAAM,CAAE,YAAW,OAAM,MAAK,SAAU,EAAM,KAE1C,MAAC,GAAa,CAAC,GAAQ,CAAC,GAI5B,GAAI,CACH,IAAI,EAEA,IAAS,MACZ,EAAS,MAAM,EAAQ,IAAI,CAAG,EACpB,IAAS,MACnB,MAAM,EAAQ,IAAI,EAAK,CAAM,EACnB,IAAS,UACnB,MAAM,EAAQ,OAAO,CAAG,EAGzB,KAA4B,YAAY,CAAE,YAAW,QAAO,CAAiC,CAC9F,OAAS,EAAK,CACb,IAAM,EAAQ,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,EAE7D,KAA4B,YAAY,CAAE,YAAW,OAAM,CAAiC,CAC7F,CACD,EAAA,CAAG,CACL,CACD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SDKStorage } from '../types/common';
|
|
2
|
+
export type WorkerStorageRequestType = 'get' | 'set' | 'delete';
|
|
3
|
+
export type WorkerStorageRequest = {
|
|
4
|
+
requestId: string;
|
|
5
|
+
type: WorkerStorageRequestType;
|
|
6
|
+
key: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
};
|
|
9
|
+
export type WorkerStorageResponse = {
|
|
10
|
+
requestId: string;
|
|
11
|
+
result?: string | null;
|
|
12
|
+
error?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates a storage adapter that delegates all operations to a `Worker` via `postMessage`.
|
|
16
|
+
*
|
|
17
|
+
* The Worker must be initialized with {@link handleWorkerStorageRequests} to handle the incoming messages.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const worker = new Worker(new URL('./storage.worker.ts', import.meta.url), { type: 'module' });
|
|
22
|
+
* const storage = createWorkerStorage(worker);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param {Worker} worker - The Worker instance to communicate with.
|
|
26
|
+
*
|
|
27
|
+
* @returns {SDKStorage} An object implementing the SDKStorage interface.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createWorkerStorage(worker: Worker): SDKStorage;
|
|
30
|
+
/**
|
|
31
|
+
* Sets up a message listener inside a Worker that handles storage requests sent by {@link createWorkerStorage}.
|
|
32
|
+
*
|
|
33
|
+
* Call this once at the top level of your Worker script. The provided `storage` can be any `SDKStorage`
|
|
34
|
+
* implementation - `createIndexedDBStorage` and `createCacheAPIStorage` are the recommended choices
|
|
35
|
+
* because they are natively available inside Workers.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { handleWorkerStorageRequests, createIndexedDBStorage } from '@strivacity/sdk-core/types';
|
|
40
|
+
*
|
|
41
|
+
* handleWorkerStorageRequests(createIndexedDBStorage());
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param {SDKStorage} storage - The underlying storage to use inside the Worker.
|
|
45
|
+
*/
|
|
46
|
+
export declare function handleWorkerStorageRequests(storage: SDKStorage): void;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){let t=0,n=new Map;e.addEventListener(`message`,e=>{let{requestId:t,result:r,error:i}=e.data,a=n.get(t);a&&(n.delete(t),i===void 0?a.resolve(r??null):a.reject(Error(i)))});function r(r,i,a){return new Promise((o,s)=>{let c=`${r}:${++t}`;n.set(c,{resolve:o,reject:s}),e.postMessage({requestId:c,type:r,key:i,value:a})})}return{get:async e=>await r(`get`,e),set:async(e,t)=>{await r(`set`,e,t)},delete:async e=>{await r(`delete`,e)}}}function t(e){self.addEventListener(`message`,t=>void(async()=>{let{requestId:n,type:r,key:i,value:a}=t.data;if(!(!n||!r||!i))try{let t;r===`get`?t=await e.get(i):r===`set`?await e.set(i,a):r===`delete`&&await e.delete(i),self.postMessage({requestId:n,result:t})}catch(e){let t=e instanceof Error?e.message:String(e);self.postMessage({requestId:n,error:t})}})())}export{e as createWorkerStorage,t as handleWorkerStorageRequests};
|
|
2
|
+
//# sourceMappingURL=worker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.mjs","names":[],"sources":["../../src/storages/worker.ts"],"sourcesContent":["import type { SDKStorage } from '../types/common';\n\nexport type WorkerStorageRequestType = 'get' | 'set' | 'delete';\n\nexport type WorkerStorageRequest = {\n\trequestId: string;\n\ttype: WorkerStorageRequestType;\n\tkey: string;\n\tvalue?: string;\n};\n\nexport type WorkerStorageResponse = {\n\trequestId: string;\n\tresult?: string | null;\n\terror?: string;\n};\n\n/**\n * Creates a storage adapter that delegates all operations to a `Worker` via `postMessage`.\n *\n * The Worker must be initialized with {@link handleWorkerStorageRequests} to handle the incoming messages.\n *\n * @example\n * ```ts\n * const worker = new Worker(new URL('./storage.worker.ts', import.meta.url), { type: 'module' });\n * const storage = createWorkerStorage(worker);\n * ```\n *\n * @param {Worker} worker - The Worker instance to communicate with.\n *\n * @returns {SDKStorage} An object implementing the SDKStorage interface.\n */\nexport function createWorkerStorage(worker: Worker): SDKStorage {\n\tlet counter = 0;\n\tconst pending = new Map<string, { resolve: (value: string | null) => void; reject: (reason: Error) => void }>();\n\n\tworker.addEventListener('message', (event: MessageEvent<WorkerStorageResponse>) => {\n\t\tconst { requestId, result, error } = event.data;\n\t\tconst deferred = pending.get(requestId);\n\n\t\tif (!deferred) {\n\t\t\treturn;\n\t\t}\n\n\t\tpending.delete(requestId);\n\n\t\tif (error !== undefined) {\n\t\t\tdeferred.reject(new Error(error));\n\t\t} else {\n\t\t\tdeferred.resolve(result ?? null);\n\t\t}\n\t});\n\n\tfunction sendMessage(type: WorkerStorageRequestType, key: string, value?: string): Promise<string | null> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst requestId = `${type}:${++counter}`;\n\n\t\t\tpending.set(requestId, { resolve, reject });\n\t\t\tworker.postMessage({ requestId, type, key, value } satisfies WorkerStorageRequest);\n\t\t});\n\t}\n\n\treturn {\n\t\tget: async (key) => {\n\t\t\treturn await sendMessage('get', key);\n\t\t},\n\t\tset: async (key, value) => {\n\t\t\tawait sendMessage('set', key, value);\n\t\t},\n\t\tdelete: async (key) => {\n\t\t\tawait sendMessage('delete', key);\n\t\t},\n\t};\n}\n\n/**\n * Sets up a message listener inside a Worker that handles storage requests sent by {@link createWorkerStorage}.\n *\n * Call this once at the top level of your Worker script. The provided `storage` can be any `SDKStorage`\n * implementation - `createIndexedDBStorage` and `createCacheAPIStorage` are the recommended choices\n * because they are natively available inside Workers.\n *\n * @example\n * ```ts\n * import { handleWorkerStorageRequests, createIndexedDBStorage } from '@strivacity/sdk-core/types';\n *\n * handleWorkerStorageRequests(createIndexedDBStorage());\n * ```\n *\n * @param {SDKStorage} storage - The underlying storage to use inside the Worker.\n */\nexport function handleWorkerStorageRequests(storage: SDKStorage): void {\n\t(self as unknown as Worker).addEventListener(\n\t\t'message',\n\t\t(event: MessageEvent<WorkerStorageRequest>) =>\n\t\t\tvoid (async () => {\n\t\t\t\tconst { requestId, type, key, value } = event.data;\n\n\t\t\t\tif (!requestId || !type || !key) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tlet result: string | null | undefined;\n\n\t\t\t\t\tif (type === 'get') {\n\t\t\t\t\t\tresult = await storage.get(key);\n\t\t\t\t\t} else if (type === 'set') {\n\t\t\t\t\t\tawait storage.set(key, value!);\n\t\t\t\t\t} else if (type === 'delete') {\n\t\t\t\t\t\tawait storage.delete(key);\n\t\t\t\t\t}\n\n\t\t\t\t\t(self as unknown as Worker).postMessage({ requestId, result } satisfies WorkerStorageResponse);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst error = err instanceof Error ? err.message : String(err);\n\n\t\t\t\t\t(self as unknown as Worker).postMessage({ requestId, error } satisfies WorkerStorageResponse);\n\t\t\t\t}\n\t\t\t})(),\n\t);\n}\n"],"mappings":"AAgCA,SAAgB,EAAoB,EAA4B,CAC/D,IAAI,EAAU,EACR,EAAU,IAAI,IAEpB,EAAO,iBAAiB,UAAY,GAA+C,CAClF,GAAM,CAAE,YAAW,SAAQ,SAAU,EAAM,KACrC,EAAW,EAAQ,IAAI,CAAS,EAEjC,IAIL,EAAQ,OAAO,CAAS,EAEpB,IAAU,IAAA,GAGb,EAAS,QAAQ,GAAU,IAAI,EAF/B,EAAS,OAAW,MAAM,CAAK,CAAC,EAIlC,CAAC,EAED,SAAS,EAAY,EAAgC,EAAa,EAAwC,CACzG,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,IAAM,EAAY,GAAG,EAAK,GAAG,EAAE,IAE/B,EAAQ,IAAI,EAAW,CAAE,UAAS,QAAO,CAAC,EAC1C,EAAO,YAAY,CAAE,YAAW,OAAM,MAAK,OAAM,CAAgC,CAClF,CAAC,CACF,CAEA,MAAO,CACN,IAAK,KAAO,IACJ,MAAM,EAAY,MAAO,CAAG,EAEpC,IAAK,MAAO,EAAK,IAAU,CAC1B,MAAM,EAAY,MAAO,EAAK,CAAK,CACpC,EACA,OAAQ,KAAO,IAAQ,CACtB,MAAM,EAAY,SAAU,CAAG,CAChC,CACD,CACD,CAkBA,SAAgB,EAA4B,EAA2B,CACtE,KAA4B,iBAC3B,UACC,GACA,KAAM,SAAY,CACjB,GAAM,CAAE,YAAW,OAAM,MAAK,SAAU,EAAM,KAE1C,MAAC,GAAa,CAAC,GAAQ,CAAC,GAI5B,GAAI,CACH,IAAI,EAEA,IAAS,MACZ,EAAS,MAAM,EAAQ,IAAI,CAAG,EACpB,IAAS,MACnB,MAAM,EAAQ,IAAI,EAAK,CAAM,EACnB,IAAS,UACnB,MAAM,EAAQ,OAAO,CAAG,EAGzB,KAA4B,YAAY,CAAE,YAAW,QAAO,CAAiC,CAC9F,OAAS,EAAK,CACb,IAAM,EAAQ,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,EAE7D,KAA4B,YAAY,CAAE,YAAW,OAAM,CAAiC,CAC7F,CACD,EAAA,CAAG,CACL,CACD"}
|
|
File without changes
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export type PartialRecord<K extends keyof any, T> = {
|
|
2
|
+
[P in K]?: T;
|
|
3
|
+
};
|
|
4
|
+
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
5
|
+
export type CookieOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* The maximum age of the cookie in seconds. If not specified, the cookie will be a session cookie.
|
|
8
|
+
*/
|
|
9
|
+
maxAge?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The path attribute of the cookie. Defaults to '/'.
|
|
12
|
+
*
|
|
13
|
+
* @default '/'
|
|
14
|
+
*/
|
|
15
|
+
path?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The domain attribute of the cookie. If not specified, the cookie will be valid for the current domain.
|
|
18
|
+
*/
|
|
19
|
+
domain?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The SameSite attribute of the cookie. Can be 'strict', 'lax', or 'none'. Defaults to 'lax'.
|
|
22
|
+
*
|
|
23
|
+
* @default 'lax'
|
|
24
|
+
*/
|
|
25
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
26
|
+
/**
|
|
27
|
+
* Whether the cookie is secure. If true, the cookie will only be sent over HTTPS. Defaults to true.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
secure?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type SDKLogging = {
|
|
34
|
+
xEventId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Logs a debug message with optional context.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} message - The debug message to log.
|
|
39
|
+
*/
|
|
40
|
+
debug: (message: string) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Logs an informational message with optional context.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} message - The informational message to log.
|
|
45
|
+
*/
|
|
46
|
+
info: (message: string) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Logs a warning message with optional context.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} message - The warning message to log.
|
|
51
|
+
*/
|
|
52
|
+
warn: (message: string) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Logs an error message along with an Error object for additional context.
|
|
55
|
+
*
|
|
56
|
+
* @param {string} message - The error message to log.
|
|
57
|
+
* @param {Error} error - The Error object containing additional information about the error.
|
|
58
|
+
*/
|
|
59
|
+
error: (message: string, error: Error) => void;
|
|
60
|
+
};
|
|
61
|
+
export type SDKStorage<GetArgs extends unknown[] = [], SetArgs extends unknown[] = [], DeleteArgs extends unknown[] = []> = {
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves an item from the storage by key.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} key - The key of the item to retrieve.
|
|
66
|
+
* @returns {string | null} The value associated with the key, or `null` if not found.
|
|
67
|
+
*/
|
|
68
|
+
get(key: string, ...args: GetArgs): Promise<string | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Deletes an item from the storage by key.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} key - The key of the item to delete.
|
|
73
|
+
*/
|
|
74
|
+
delete(key: string, ...args: DeleteArgs): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets an item in the storage with the specified key and value.
|
|
77
|
+
*
|
|
78
|
+
* @param {string} key - The key to associate with the value.
|
|
79
|
+
* @param {string} value - The value to store.
|
|
80
|
+
*/
|
|
81
|
+
set(key: string, value: string, ...args: SetArgs): Promise<void>;
|
|
82
|
+
};
|
|
83
|
+
export type SDKHttpClient = {
|
|
84
|
+
/**
|
|
85
|
+
* An optional logger instance for logging HTTP requests and responses.
|
|
86
|
+
*/
|
|
87
|
+
logger?: SDKLogging;
|
|
88
|
+
/**
|
|
89
|
+
* Makes an HTTP request to the specified URL with the given options and returns a response of type T.
|
|
90
|
+
*
|
|
91
|
+
* @param {string | URL} url - The URL to which the request is sent.
|
|
92
|
+
* @param {RequestInit} [options] - Optional configuration for the HTTP request, such as method, headers, and body.
|
|
93
|
+
* @returns {Promise<HttpClientResponse<T>>} A promise that resolves to the HTTP response containing data of type T.
|
|
94
|
+
* @throws Will throw an error if the request fails or if the response is not successful (status code not in the range 200-299).
|
|
95
|
+
*/
|
|
96
|
+
request<T>(url: string | URL, options?: RequestInit): Promise<HttpClientResponse<T>>;
|
|
97
|
+
/**
|
|
98
|
+
* Sends a token request to the specified URL with the provided data and returns a response of type T.
|
|
99
|
+
*
|
|
100
|
+
* @param {string | URL} url - The URL to which the token request is sent.
|
|
101
|
+
* @param {Record<string, string>} data - The data to be sent in the request body, typically including parameters like grant_type, client_id, etc.
|
|
102
|
+
* @returns {Promise<HttpClientResponse<T>>} A promise that resolves to the HTTP response containing data of type T.
|
|
103
|
+
* @throws Will throw an error if the request fails or if the response is not successful (status code not in the range 200-299).
|
|
104
|
+
*/
|
|
105
|
+
sendTokenRequest<T>(url: string | URL, data: Record<string, string>): Promise<HttpClientResponse<T>>;
|
|
106
|
+
};
|
|
107
|
+
export type HttpClientResponse<T> = {
|
|
108
|
+
/**
|
|
109
|
+
* The headers returned in the HTTP response. This is a Headers object that provides access to the response headers.
|
|
110
|
+
*/
|
|
111
|
+
readonly headers: Headers;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates whether the HTTP response was successful (status code in the range 200-299).
|
|
114
|
+
*/
|
|
115
|
+
readonly ok: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* The HTTP status code returned by the server. This is a numeric value that indicates the result of the HTTP request (e.g., 200 for success, 404 for not found).
|
|
118
|
+
*/
|
|
119
|
+
readonly status: number;
|
|
120
|
+
/**
|
|
121
|
+
* A textual description of the HTTP status code. This provides a human-readable explanation of the status code (e.g., "OK" for 200, "Not Found" for 404).
|
|
122
|
+
*/
|
|
123
|
+
readonly statusText: string;
|
|
124
|
+
/**
|
|
125
|
+
* The URL of the response. This is the final URL after any redirects that may have occurred during the HTTP request.
|
|
126
|
+
*/
|
|
127
|
+
readonly url: string;
|
|
128
|
+
/**
|
|
129
|
+
* The raw response body as a ReadableStream, if available. Not supported on all platforms (e.g. native).
|
|
130
|
+
*/
|
|
131
|
+
readonly body?: ReadableStream | null;
|
|
132
|
+
/**
|
|
133
|
+
* Parses the response body as JSON and returns a promise that resolves to the parsed object of type T.
|
|
134
|
+
*
|
|
135
|
+
* @returns {Promise<T>} A promise that resolves to the parsed JSON object of type T.
|
|
136
|
+
*/
|
|
137
|
+
json(): Promise<T>;
|
|
138
|
+
/**
|
|
139
|
+
* Returns a promise that resolves to the response body as a string.
|
|
140
|
+
*
|
|
141
|
+
* @returns {Promise<string>} A promise that resolves to the response body as a string.
|
|
142
|
+
*/
|
|
143
|
+
text(): Promise<string>;
|
|
144
|
+
};
|
|
145
|
+
export type HttpClientData<T extends (...args: any) => any> = Awaited<ReturnType<T>> extends HttpClientResponse<infer U> ? U : never;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EntryResponse, ExtraRequestArgs, SDK } from './oidc';
|
|
2
|
+
export declare class LanguageSelectorComponent extends HTMLElement {
|
|
3
|
+
}
|
|
4
|
+
export declare class NotificationComponent extends HTMLElement {
|
|
5
|
+
}
|
|
6
|
+
export declare class LandingComponent extends HTMLElement {
|
|
7
|
+
activeBlock: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
lazy: boolean;
|
|
10
|
+
lang: string;
|
|
11
|
+
debug: boolean;
|
|
12
|
+
initialized?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class LoginComponent extends HTMLElement {
|
|
15
|
+
mode: string;
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
sessionId?: string | null;
|
|
18
|
+
shortAppId?: string | null;
|
|
19
|
+
lazy: boolean;
|
|
20
|
+
params: EmbeddedParams;
|
|
21
|
+
lang: string;
|
|
22
|
+
debug: boolean;
|
|
23
|
+
initialized?: boolean;
|
|
24
|
+
start(params?: EmbeddedParams): Promise<void>;
|
|
25
|
+
updatePageTitle(data?: string | {
|
|
26
|
+
text: string;
|
|
27
|
+
values: Record<string, unknown>;
|
|
28
|
+
}): void;
|
|
29
|
+
}
|
|
30
|
+
export type EmbeddedParams = ExtraRequestArgs & {
|
|
31
|
+
language?: string;
|
|
32
|
+
};
|
|
33
|
+
export type EmbeddedLoginFlow = {
|
|
34
|
+
/**
|
|
35
|
+
* The session ID of the current embedded login flow, or `null` if no session has been started.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Use `sdk.sessionId` instead of accessing this via the login flow instance.
|
|
38
|
+
*/
|
|
39
|
+
sessionId: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The short application ID associated with the current embedded login flow, or `null` if not yet available.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated Use `sdk.shortAppId` instead of accessing this via the login flow instance.
|
|
44
|
+
*/
|
|
45
|
+
shortAppId: string | null;
|
|
46
|
+
/**
|
|
47
|
+
* The language code used for the embedded login flow UI.
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Use `sdk.language` instead of accessing this via the login flow instance.
|
|
50
|
+
*/
|
|
51
|
+
language: string;
|
|
52
|
+
/**
|
|
53
|
+
* Starts the embedded login session.
|
|
54
|
+
*
|
|
55
|
+
* @deprecated Use `sdk.startSession()` instead of calling this via the login flow instance.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
*/
|
|
59
|
+
startSession(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Finalizes the embedded login session by processing the callback URL.
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use `sdk.finalizeSession()` instead of calling this via the login flow instance.
|
|
64
|
+
*
|
|
65
|
+
* @param {string | URL} url - The callback URL returned after authentication.
|
|
66
|
+
* @returns {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
finalizeSession(url: string | URL): Promise<void>;
|
|
69
|
+
};
|
|
70
|
+
export type EmbeddedFlow = Omit<SDK<EmbeddedParams, Promise<EntryResponse>>, 'login' | 'register'> & {
|
|
71
|
+
/**
|
|
72
|
+
* Starts the embedded authentication session with the given parameters.
|
|
73
|
+
*
|
|
74
|
+
* @param {EmbeddedParams} params - The parameters to use when starting the session.
|
|
75
|
+
* @returns {Promise<void>}
|
|
76
|
+
*/
|
|
77
|
+
startSession(params?: EmbeddedParams): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Finalizes the embedded authentication session by processing the callback URL.
|
|
80
|
+
*
|
|
81
|
+
* @param {string | URL} url - The callback URL returned after authentication.
|
|
82
|
+
* @returns {Promise<void>}
|
|
83
|
+
*/
|
|
84
|
+
finalizeSession(url: string | URL): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Initiates the embedded login flow and returns an `EmbeddedLoginFlow` instance to drive the process.
|
|
87
|
+
*
|
|
88
|
+
* @deprecated Use `startSession` and `finalizeSession` directly instead.
|
|
89
|
+
*
|
|
90
|
+
* @param {EmbeddedParams} [params] - Optional parameters for the login request.
|
|
91
|
+
* @returns {EmbeddedLoginFlow} Embedded login flow instance to drive the process.
|
|
92
|
+
*/
|
|
93
|
+
login(params?: EmbeddedParams): EmbeddedLoginFlow;
|
|
94
|
+
/**
|
|
95
|
+
* Initiates the embedded registration flow and returns an `EmbeddedLoginFlow` instance to drive the process.
|
|
96
|
+
*
|
|
97
|
+
* @deprecated Use `startSession` and `finalizeSession` directly instead.
|
|
98
|
+
*
|
|
99
|
+
* @param {EmbeddedParams} [params] - Optional parameters for the registration request.
|
|
100
|
+
* @returns {EmbeddedLoginFlow} Embedded login flow instance to drive the process.
|
|
101
|
+
*/
|
|
102
|
+
register(params?: EmbeddedParams): EmbeddedLoginFlow;
|
|
103
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("./common.cjs"),require("./embedded.cjs"),require("./native.cjs");const e=require("./oidc.cjs");require("./popup.cjs"),require("./redirect.cjs"),require("./server.cjs"),exports.AlgorithmTypeList=e.AlgorithmTypeList,exports.GrantTypeList=e.GrantTypeList,exports.ResponseModeList=e.ResponseModeList,exports.ResponseTypeList=e.ResponseTypeList,exports.SubjectTypeList=e.SubjectTypeList,exports.TokenEndpointAuthMethodList=e.TokenEndpointAuthMethodList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./common.mjs";import"./embedded.mjs";import"./native.mjs";import{AlgorithmTypeList as e,GrantTypeList as t,ResponseModeList as n,ResponseTypeList as r,SubjectTypeList as i,TokenEndpointAuthMethodList as a}from"./oidc.mjs";import"./popup.mjs";import"./redirect.mjs";import"./server.mjs";export{e as AlgorithmTypeList,t as GrantTypeList,n as ResponseModeList,r as ResponseTypeList,i as SubjectTypeList,a as TokenEndpointAuthMethodList};
|
|
File without changes
|