@intlayer/api 5.8.1 → 6.0.0-canary.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.
Files changed (82) hide show
  1. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +3 -12
  2. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  3. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +3 -16
  4. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  5. package/dist/cjs/distantDictionary/index.cjs +3 -3
  6. package/dist/cjs/distantDictionary/index.cjs.map +1 -1
  7. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  8. package/dist/cjs/getIntlayerAPI/dictionary.cjs +8 -2
  9. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  10. package/dist/cjs/getIntlayerAPI/editor.cjs +2 -2
  11. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  12. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  14. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  16. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  18. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  19. package/dist/cjs/index.cjs +2 -2
  20. package/dist/cjs/index.cjs.map +1 -1
  21. package/dist/cjs/proxy.cjs +123 -0
  22. package/dist/cjs/proxy.cjs.map +1 -0
  23. package/dist/cjs/types.cjs.map +1 -1
  24. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +3 -12
  25. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  26. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +3 -16
  27. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  28. package/dist/esm/distantDictionary/index.mjs +1 -1
  29. package/dist/esm/distantDictionary/index.mjs.map +1 -1
  30. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  31. package/dist/esm/getIntlayerAPI/dictionary.mjs +8 -2
  32. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  33. package/dist/esm/getIntlayerAPI/editor.mjs +2 -2
  34. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  35. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  36. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  37. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  38. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  39. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  40. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  41. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  42. package/dist/esm/index.mjs +1 -1
  43. package/dist/esm/index.mjs.map +1 -1
  44. package/dist/esm/proxy.mjs +99 -0
  45. package/dist/esm/proxy.mjs.map +1 -0
  46. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
  47. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
  48. package/dist/types/distantDictionary/index.d.ts +1 -1
  49. package/dist/types/distantDictionary/index.d.ts.map +1 -1
  50. package/dist/types/getIntlayerAPI/ai.d.ts +1 -1
  51. package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
  52. package/dist/types/getIntlayerAPI/dictionary.d.ts +3 -2
  53. package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
  54. package/dist/types/getIntlayerAPI/editor.d.ts +3 -3
  55. package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
  56. package/dist/types/getIntlayerAPI/newsletter.d.ts +1 -1
  57. package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
  58. package/dist/types/getIntlayerAPI/organization.d.ts +1 -1
  59. package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
  60. package/dist/types/getIntlayerAPI/project.d.ts +1 -1
  61. package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
  62. package/dist/types/getIntlayerAPI/search.d.ts +1 -1
  63. package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
  64. package/dist/types/getIntlayerAPI/stripe.d.ts +1 -1
  65. package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
  66. package/dist/types/getIntlayerAPI/tag.d.ts +1 -1
  67. package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
  68. package/dist/types/getIntlayerAPI/user.d.ts +1 -1
  69. package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
  70. package/dist/types/index.d.ts +1 -1
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/dist/types/proxy.d.ts +14 -0
  73. package/dist/types/proxy.d.ts.map +1 -0
  74. package/dist/types/types.d.ts +2 -2
  75. package/dist/types/types.d.ts.map +1 -1
  76. package/package.json +10 -13
  77. package/dist/cjs/IntlayerEventListener.cjs +0 -127
  78. package/dist/cjs/IntlayerEventListener.cjs.map +0 -1
  79. package/dist/esm/IntlayerEventListener.mjs +0 -93
  80. package/dist/esm/IntlayerEventListener.mjs.map +0 -1
  81. package/dist/types/IntlayerEventListener.d.ts +0 -63
  82. package/dist/types/IntlayerEventListener.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/proxy.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/config/client';\nimport type { FetcherOptions } from './fetcher';\nimport { getIntlayerAPI } from './getIntlayerAPI';\nimport type { IntlayerAPI } from './getIntlayerAPI/index';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\n\ntype OAuthTokenLike = {\n accessToken?: string;\n accessTokenExpiresAt?: string | Date;\n expires_in?: number;\n expiresIn?: number;\n expiresAt?: string | Date;\n};\n\nconst ONE_MINUTE_MS = 60_000;\n\n/**\n * Returns the expiration timestamp in ms from an OAuth token-like object.\n */\nconst getExpiryTimestamp = (\n token: OAuthTokenLike | undefined\n): number | undefined => {\n if (!token) return undefined;\n const dateLike = (token.accessTokenExpiresAt ?? token.expiresAt) as\n | string\n | Date\n | undefined;\n if (dateLike) {\n const ts =\n typeof dateLike === 'string'\n ? Date.parse(dateLike)\n : dateLike.getTime?.();\n if (typeof ts === 'number' && Number.isFinite(ts)) return ts;\n }\n const seconds = token.expires_in ?? token.expiresIn;\n if (typeof seconds === 'number' && Number.isFinite(seconds)) {\n return Date.now() + seconds * 1000;\n }\n return undefined;\n};\n\nlet currentAccessToken: string | undefined;\nlet currentExpiryTs: number | undefined;\nlet pendingRefresh: Promise<void> | undefined;\n\n/**\n * Build an auto-auth proxy around getIntlayerAPI that:\n * - Fetches an OAuth2 token when needed\n * - Injects Authorization header for each request\n * - Refreshes token proactively when near expiry\n *\n * The returned API matches the shape of getIntlayerAPI.\n */\nexport const getIntlayerAPIProxy = (\n _baseAuthOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPI => {\n // Use a shared mutable auth options object captured by the API closures\n const authOptionsRef: FetcherOptions = { ..._baseAuthOptions };\n const baseApi = getIntlayerAPI(authOptionsRef, intlayerConfig);\n\n const needsRefresh = (): boolean => {\n if (!currentAccessToken) return true;\n if (!currentExpiryTs) return false; // If unknown, assume usable until failure\n return Date.now() + ONE_MINUTE_MS >= currentExpiryTs; // refresh 1 min before expiry\n };\n\n const refreshToken = async (): Promise<void> => {\n const doRefresh = async () => {\n const authApi = getOAuthAPI(intlayerConfig);\n const res = await authApi.getOAuth2AccessToken();\n const tokenData = res?.data as OAuthTokenLike | undefined;\n currentAccessToken = tokenData?.accessToken;\n currentExpiryTs = getExpiryTimestamp(tokenData);\n };\n\n if (!pendingRefresh) {\n pendingRefresh = doRefresh().finally(() => {\n pendingRefresh = undefined;\n });\n }\n await pendingRefresh;\n };\n\n const ensureValidToken = async () => {\n if (needsRefresh()) {\n await refreshToken();\n }\n };\n\n const applyAuthHeaderToRef = () => {\n if (!currentAccessToken) return;\n authOptionsRef.headers = {\n ...(authOptionsRef.headers ?? {}),\n Authorization: `Bearer ${currentAccessToken}`,\n } as HeadersInit;\n };\n\n const wrapSection = <T extends Record<string, unknown>>(\n section: T,\n skipAuth = false\n ): T => {\n return new Proxy(section, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n if (typeof value === 'function') {\n // Wrap section method to inject token and headers\n return async (...args: unknown[]) => {\n if (!skipAuth) {\n await ensureValidToken();\n applyAuthHeaderToRef();\n }\n\n try {\n return await value.apply(target, args);\n } catch (err) {\n // Best-effort retry: if token might be stale, refresh once and retry\n if (!skipAuth) {\n await refreshToken();\n applyAuthHeaderToRef();\n return await value.apply(target, args);\n }\n throw err;\n }\n };\n }\n return value;\n },\n });\n };\n\n return {\n organization: wrapSection(baseApi.organization),\n project: wrapSection(baseApi.project),\n user: wrapSection(baseApi.user),\n oAuth: wrapSection(baseApi.oAuth, true), // do NOT inject auth for token endpoint\n dictionary: wrapSection(baseApi.dictionary),\n stripe: wrapSection(baseApi.stripe),\n ai: wrapSection(baseApi.ai),\n tag: wrapSection(baseApi.tag),\n search: wrapSection(baseApi.search),\n editor: wrapSection(baseApi.editor),\n newsletter: wrapSection(baseApi.newsletter),\n } as IntlayerAPI;\n};\n\nexport type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;\n"],"mappings":"AAEA,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB;AAU5B,MAAM,gBAAgB;AAKtB,MAAM,qBAAqB,CACzB,UACuB;AACvB,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,WAAY,MAAM,wBAAwB,MAAM;AAItD,MAAI,UAAU;AACZ,UAAM,KACJ,OAAO,aAAa,WAChB,KAAK,MAAM,QAAQ,IACnB,SAAS,UAAU;AACzB,QAAI,OAAO,OAAO,YAAY,OAAO,SAAS,EAAE,EAAG,QAA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AM,QAAQ;AAChD,YAAI,OAAO,UAAU,YAAY;AAE/B,iBAAO,UAAU,SAAoB;AACnC,gBAAI,CAAC,UAAU;AACb,oBAAM,iBAAiB;AACvB,mCAAqB;AAAA,YACvB;AAEA,gBAAI;AACF,qBAAO,MAAM,MAAM,MAAM,QAAQ,IAAI;AAAA,YACvC,SAAS,KAAK;AAEZ,kBAAI,CAAC,UAAU;AACb,sBAAM,aAAa;AACnB,qCAAqB;AACrB,uBAAO,MAAM,MAAM,MAAM,QAAQ,IAAI;AAAA,cACvC;AACA,oBAAM;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,cAAc,YAAY,QAAQ,YAAY;AAAA,IAC9C,SAAS,YAAY,QAAQ,OAAO;AAAA,IACpC,MAAM,YAAY,QAAQ,IAAI;AAAA,IAC9B,OAAO,YAAY,QAAQ,OAAO,IAAI;AAAA;AAAA,IACtC,YAAY,YAAY,QAAQ,UAAU;AAAA,IAC1C,QAAQ,YAAY,QAAQ,MAAM;AAAA,IAClC,IAAI,YAAY,QAAQ,EAAE;AAAA,IAC1B,KAAK,YAAY,QAAQ,GAAG;AAAA,IAC5B,QAAQ,YAAY,QAAQ,MAAM;AAAA,IAClC,QAAQ,YAAY,QAAQ,MAAM;AAAA,IAClC,YAAY,YAAY,QAAQ,UAAU;AAAA,EAC5C;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,CA8B5C,CAAC"}
1
+ {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,CAsB5C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionary.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,eAAe,MAAM,EACrB,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,GAAG,SAAS,CAuCnC,CAAC"}
1
+ {"version":3,"file":"fetchDistantDictionary.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,eAAe,MAAM,EACrB,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,GAAG,SAAS,CA2BnC,CAAC"}
@@ -1,3 +1,3 @@
1
- export * from './fetchDistantDictionary';
2
1
  export * from './fetchDistantDictionaries';
2
+ export * from './fetchDistantDictionary';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC"}
@@ -1,6 +1,6 @@
1
- import type { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CustomQueryBody, CustomQueryResult, TranslateJSONBody, TranslateJSONResult } from '../types';
2
1
  import type { IntlayerConfig } from '@intlayer/config/client';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CustomQueryBody, CustomQueryResult, TranslateJSONBody, TranslateJSONResult } from '../types';
4
4
  export type AskDocQuestionBody = {
5
5
  messages: ChatCompletionRequestMessage[];
6
6
  discutionId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM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G;IAC/B,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC,eAAO,MAAM,QAAQ,GACnB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;yBAmBtB,eAAe,iBACR,cAAc;2BAkBrB,iBAAiB,iBACV,cAAc;qCAkBrB,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;4BAgCrB,kBAAkB,iBACX,cAAc;0BAuFrB,gBAAgB,iBACT,cAAc;CAsB/B,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, PushDictionariesBody, PushDictionariesResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionariesUpdateTimestampResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, PushDictionariesBody, PushDictionariesResult, UpdateDictionaryBody, UpdateDictionaryResult } from '../types';
4
4
  export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  getDictionaries: (filters?: GetDictionariesParams, otherOptions?: FetcherOptions) => Promise<GetDictionariesResult>;
6
6
  getDictionariesKeys: (otherOptions?: FetcherOptions) => Promise<GetDictionariesKeysResult>;
7
+ getDictionariesUpdateTimestamp: (otherOptions?: FetcherOptions) => Promise<GetDictionariesUpdateTimestampResult>;
7
8
  getDictionary: (dictionaryKey: GetDictionaryParams["dictionaryKey"], version?: GetDictionaryQuery["version"], otherOptions?: FetcherOptions) => Promise<GetDictionaryResult>;
8
9
  pushDictionaries: (dictionaries: PushDictionariesBody["dictionaries"], otherOptions?: FetcherOptions) => Promise<PushDictionariesResult>;
9
10
  addDictionary: (body: AddDictionaryBody, otherOptions?: FetcherOptions) => Promise<AddDictionaryResult>;
10
- updateDictionary: (dictionaryId: UpdateDictionaryParam["dictionaryId"], dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
11
+ updateDictionary: (dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
11
12
  deleteDictionary: (id: DeleteDictionaryParam["dictionaryId"], otherOptions?: FetcherOptions) => Promise<DeleteDictionaryResult>;
12
13
  };
13
14
  //# sourceMappingURL=dictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/dictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,gBAAgB,GAC3B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;gCAkBnB,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;0BAftB,iBAAiB,iBACT,cAAc;qCA+Bd,qBAAqB,CAAC,cAAc,CAAC,cACvC,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAoB/B,CAAC"}
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/dictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oCAAoC,EACpC,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,gBAAgB,GAC3B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;gCAkBnB,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;oDAW/C,cAAc;mCAcb,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;0BAftB,iBAAiB,iBACT,cAAc;mCA+BhB,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAqB/B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
2
  import { type FetcherOptions } from '../fetcher';
3
- import type { GetConfigurationResult, WriteContentDeclarationBody, WriteContentDeclarationResult } from '../types';
3
+ import type { GetConfigurationResult, GetEditorDictionariesResult, WriteContentDeclarationBody, WriteContentDeclarationResult } from '../types';
4
4
  export declare const getEditorAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
- getDictionaries: (otherOptions?: FetcherOptions) => Promise<Record<string, any>>;
5
+ getDictionaries: (otherOptions?: FetcherOptions) => Promise<GetEditorDictionariesResult>;
6
6
  getConfiguration: (otherOptions?: FetcherOptions) => Promise<GetConfigurationResult>;
7
- writeDictionary: (dictionary: WriteContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<WriteContentDeclarationResult>;
7
+ writeDictionary: (body: WriteContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<WriteContentDeclarationResult>;
8
8
  };
9
9
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/editor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;qCA8Bf,cAAc,KAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;sCAhBf,cAAc,KAC3B,OAAO,CAAC,sBAAsB,CAAC;kCA8BpB,2BAA2B,iBACzB,cAAc;CAiB/B,CAAC"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/editor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;qCA8Bf,cAAc,KAC3B,OAAO,CAAC,2BAA2B,CAAC;sCAhBvB,cAAc,KAC3B,OAAO,CAAC,sBAAsB,CAAC;4BA8B1B,2BAA2B,iBACnB,cAAc;CAiB/B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody } from '../types';
4
4
  export declare const getNewsletterAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  subscribeToNewsletter: (body: NewsletterSubscriptionBody, otherOptions?: FetcherOptions) => Promise<NewsletterSubscriptionResult>;
6
6
  unsubscribeFromNewsletter: (body: NewsletterUnsubscriptionBody, otherOptions?: FetcherOptions) => Promise<NewsletterSubscriptionResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"newsletter.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/newsletter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,gBAAgB,GAC3B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;kCAmBvB,0BAA0B,iBAClB,cAAc;sCAkBtB,4BAA4B,iBACpB,cAAc;yCAgBmB,cAAc;CAehE,CAAC"}
1
+ {"version":3,"file":"newsletter.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/newsletter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,gBAAgB,GAC3B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;kCAmBvB,0BAA0B,iBAClB,cAAc;sCAkBtB,4BAA4B,iBACpB,cAAc;yCAgBmB,cAAc;CAehE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, DeleteOrganizationResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, SelectOrganizationParam, SelectOrganizationResult, UnselectOrganizationResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, DeleteOrganizationResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, SelectOrganizationParam, SelectOrganizationResult, UnselectOrganizationResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult } from '../types';
4
4
  export declare const getOrganizationAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  getOrganizations: (filters?: GetOrganizationsParams, otherOptions?: FetcherOptions) => Promise<GetOrganizationsResult>;
6
6
  getOrganization: (organizationId: GetOrganizationParam["organizationId"], otherOptions?: FetcherOptions) => Promise<GetOrganizationResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/organization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,kBAAkB,GAC7B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;iCAkBnB,sBAAsB,iBAClB,cAAc;sCAgBZ,oBAAoB,CAAC,gBAAgB,CAAC,iBACxC,cAAc;oCAad,mBAAmB,iBACnB,cAAc;kCAqDtB,yBAAyB,iBACjB,cAAc;uCArCd,sBAAsB,iBACtB,cAAc;sCAiBtB,6BAA6B,iBACrB,cAAc;wCAkCkB,cAAc;yCAe5C,uBAAuB,CAAC,gBAAgB,CAAC,iBAC3C,cAAc;0CAeoB,cAAc;CAqBjE,CAAC"}
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/organization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC7B,+BAA+B,EAC/B,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,kBAAkB,GAC7B,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;iCAkBnB,sBAAsB,iBAClB,cAAc;sCAgBZ,oBAAoB,CAAC,gBAAgB,CAAC,iBACxC,cAAc;oCAad,mBAAmB,iBACnB,cAAc;kCAqDtB,yBAAyB,iBACjB,cAAc;uCArCd,sBAAsB,iBACtB,cAAc;sCAiBtB,6BAA6B,iBACrB,cAAc;wCAkCkB,cAAc;yCAe5C,uBAAuB,CAAC,gBAAgB,CAAC,iBAC3C,cAAc;0CAeoB,cAAc;CAqBjE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { AddNewAccessKeyBody, AddNewAccessKeyResponse, AddProjectBody, AddProjectResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteProjectResult, GetProjectsParams, GetProjectsResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, SelectProjectParam, SelectProjectResult, UnselectProjectResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { AddNewAccessKeyBody, AddNewAccessKeyResponse, AddProjectBody, AddProjectResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteProjectResult, GetProjectsParams, GetProjectsResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, SelectProjectParam, SelectProjectResult, UnselectProjectResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult } from '../types';
4
4
  export declare const getProjectAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  getProjects: (filters?: GetProjectsParams, otherOptions?: FetcherOptions) => Promise<GetProjectsResult>;
6
6
  addProject: (project: AddProjectBody, otherOptions?: FetcherOptions) => Promise<AddProjectResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/project.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,aAAa,GACxB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;4BAkBnB,iBAAiB,iBACb,cAAc;0BAgBnB,cAAc,iBACT,cAAc;6BAiBnB,iBAAiB,iBACZ,cAAc;iCAiBtB,wBAAwB,iBAChB,cAAc;qDAgBN,4BAA4B,iBACpC,cAAc;mCAgBa,cAAc;+BAe5C,kBAAkB,CAAC,WAAW,CAAC,iBAC5B,cAAc;qCAee,cAAc;iCAiB9C,mBAAmB,iBAChB,cAAc;gCAmBlB,mBAAmB,CAAC,UAAU,CAAC,iBAC3B,cAAc;iCAmBlB,oBAAoB,CAAC,UAAU,CAAC,iBAC5B,cAAc;CAyB/B,CAAC"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/project.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,aAAa,GACxB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;4BAkBnB,iBAAiB,iBACb,cAAc;0BAgBnB,cAAc,iBACT,cAAc;6BAiBnB,iBAAiB,iBACZ,cAAc;iCAiBtB,wBAAwB,iBAChB,cAAc;qDAgBN,4BAA4B,iBACpC,cAAc;mCAgBa,cAAc;+BAe5C,kBAAkB,CAAC,WAAW,CAAC,iBAC5B,cAAc;qCAee,cAAc;iCAiB9C,mBAAmB,iBAChB,cAAc;gCAmBlB,mBAAmB,CAAC,UAAU,CAAC,iBAC3B,cAAc;iCAmBlB,oBAAoB,CAAC,UAAU,CAAC,iBAC5B,cAAc;CAyB/B,CAAC"}
@@ -1,6 +1,6 @@
1
- import type { SearchDocUtilParams, SearchDocUtilResult } from '../types';
2
1
  import type { IntlayerConfig } from '@intlayer/config/client';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { SearchDocUtilParams, SearchDocUtilResult } from '../types';
4
4
  export declare const getSearchAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  searchDoc: (params?: SearchDocUtilParams, otherOptions?: FetcherOptions) => Promise<SearchDocUtilResult>;
6
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;yBAmBpB,mBAAmB,iBACd,cAAc;CAe/B,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEzE,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;yBAmBpB,mBAAmB,iBACd,cAAc;CAe/B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { GetCheckoutSessionBody, GetCheckoutSessionResult, GetPricingBody, GetPricingResult } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { GetCheckoutSessionBody, GetCheckoutSessionResult, GetPricingBody, GetPricingResult } from '../types';
4
4
  export declare const getStripeAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  getPricing: (body?: GetPricingBody, otherOptions?: FetcherOptions) => Promise<GetPricingResult>;
6
6
  getSubscription: (body?: GetCheckoutSessionBody, otherOptions?: FetcherOptions) => Promise<GetCheckoutSessionResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/stripe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;wBAkBtB,cAAc,iBACP,cAAc;6BAiBrB,sBAAsB,iBACf,cAAc;wCAgBkB,cAAc;CAe/D,CAAC"}
1
+ {"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/stripe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,YAAY,GACvB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;wBAkBtB,cAAc,iBACP,cAAc;6BAiBrB,sBAAsB,iBACf,cAAc;wCAgBkB,cAAc;CAe/D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { IntlayerConfig } from '@intlayer/config/client';
2
- import type { AddTagBody, AddTagResult, DeleteTagParams, DeleteTagResult, GetTagsParams, GetTagsResult, UpdateTagBody, UpdateTagParams, UpdateTagResult } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { AddTagBody, AddTagResult, DeleteTagParams, DeleteTagResult, GetTagsParams, GetTagsResult, UpdateTagBody, UpdateTagParams, UpdateTagResult } from '../types';
4
4
  export declare const getTagAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  getTags: (filters?: GetTagsParams, otherOptions?: FetcherOptions) => Promise<GetTagsResult>;
6
6
  addTag: (tag: AddTagBody, otherOptions?: FetcherOptions) => Promise<AddTagResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/tag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,SAAS,GACpB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;wBAkBnB,aAAa,iBACT,cAAc;kBAeH,UAAU,iBAAgB,cAAc;uBAgB1D,eAAe,CAAC,OAAO,CAAC,OAC1B,aAAa,iBACJ,cAAc;uBAiBrB,eAAe,CAAC,OAAO,CAAC,iBAEjB,cAAc;CAiB/B,CAAC"}
1
+ {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/tag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,SAAS,GACpB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;wBAkBnB,aAAa,iBACT,cAAc;kBAeH,UAAU,iBAAgB,cAAc;uBAgB1D,eAAe,CAAC,OAAO,CAAC,OAC1B,aAAa,iBACJ,cAAc;uBAiBrB,eAAe,CAAC,OAAO,CAAC,iBAEjB,cAAc;CAiB/B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type IntlayerConfig } from '@intlayer/config/client';
2
- import type { CreateUserBody, CreateUserResult, GetUserByAccountParams, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, UpdateUserBody, UpdateUserResult, UserAPI } from '../types';
3
2
  import { type FetcherOptions } from '../fetcher';
3
+ import type { CreateUserBody, CreateUserResult, GetUserByAccountParams, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, UpdateUserBody, UpdateUserResult, UserAPI } from '../types';
4
4
  export declare const getUserAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
5
  createUser: (user: CreateUserBody, otherOptions?: FetcherOptions) => Promise<CreateUserResult>;
6
6
  getUsers: (filters?: GetUsersParams, otherOptions?: FetcherOptions) => Promise<GetUsersResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EAEtB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,UAAU,GACrB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;uBAmFvB,cAAc,iBACN,cAAc;yBAjElB,cAAc,iBACV,cAAc;0BAiBpB,iBAAiB,CAAC,QAAQ,CAAC,iBACrB,cAAc;0CA6BT,sBAAsB,CAAC,mBAAmB,CAAC,YACpD,sBAAsB,CAAC,UAAU,CAAC,iBAC9B,cAAc;4BAjBrB,oBAAoB,CAAC,OAAO,CAAC,iBACtB,cAAc;uBAiDtB,cAAc,iBACN,cAAc;yBAkBpB,MAAM,iBACA,cAAc;sCAgBW,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAahE,CAAC"}
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/user.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EAEtB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,UAAU,GACrB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;uBAmFvB,cAAc,iBACN,cAAc;yBAjElB,cAAc,iBACV,cAAc;0BAiBpB,iBAAiB,CAAC,QAAQ,CAAC,iBACrB,cAAc;0CA6BT,sBAAsB,CAAC,mBAAmB,CAAC,YACpD,sBAAsB,CAAC,UAAU,CAAC,iBAC9B,cAAc;4BAjBrB,oBAAoB,CAAC,OAAO,CAAC,iBACtB,cAAc;uBAiDtB,cAAc,iBACN,cAAc;yBAkBpB,MAAM,iBACA,cAAc;sCAgBW,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAahE,CAAC"}
@@ -10,6 +10,6 @@ export * from './getIntlayerAPI/project';
10
10
  export * from './getIntlayerAPI/stripe';
11
11
  export * from './getIntlayerAPI/tag';
12
12
  export * from './getIntlayerAPI/user';
13
- export * from './IntlayerEventListener';
13
+ export * from './proxy';
14
14
  export * from './types';
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { IntlayerConfig } from '@intlayer/config/client';
2
+ import type { FetcherOptions } from './fetcher';
3
+ import type { IntlayerAPI } from './getIntlayerAPI/index';
4
+ /**
5
+ * Build an auto-auth proxy around getIntlayerAPI that:
6
+ * - Fetches an OAuth2 token when needed
7
+ * - Injects Authorization header for each request
8
+ * - Refreshes token proactively when near expiry
9
+ *
10
+ * The returned API matches the shape of getIntlayerAPI.
11
+ */
12
+ export declare const getIntlayerAPIProxy: (_baseAuthOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => IntlayerAPI;
13
+ export type IntlayerAPIProxy = ReturnType<typeof getIntlayerAPIProxy>;
14
+ //# sourceMappingURL=proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA0C1D;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,mBAAkB,cAAmB,EACrC,iBAAiB,cAAc,KAC9B,WAwFF,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -2,8 +2,8 @@
2
2
  * This file re-exports all types to allow non-blocking build because
3
3
  * the backend and intlayer-editor are not built yet.
4
4
  */
5
- export type { AIOptions, AIProvider, AddDictionaryBody, AddDictionaryResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, AddProjectBody, AddProjectResult, AddTagBody, AddTagResult, AskDocQuestionResult, AskResetPasswordBody, AskResetPasswordResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AuthClient, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CheckIfUserHasPasswordResult, CreateSessionBody, CreateSessionResult, CreateUserBody, CreateUserResult, CustomQueryBody, CustomQueryResult, DefinePasswordBody, DefinePasswordResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteDictionaryParam, DeleteDictionaryResult, DeleteOrganizationResult, DeleteProjectResult, DeleteTagParams, DeleteTagResult, GetCheckoutSessionBody, GetCheckoutSessionResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetOAuth2TokenBody, GetOAuth2TokenBody, GetOAuth2TokenResult, GetOAuth2TokenResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, GetPricingBody, GetPricingResult, GetProjectsParams, GetProjectsResult, GetSessionInformationQuery, GetSessionInformationResult, GetTagsParams, GetTagsResult, GetUserByAccountParams, GetUserByAccountResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, GithubLoginQueryParams, GoogleLoginQueryParams, LoginBody, LoginResult, Messages, NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, PushDictionariesBody, PushDictionariesResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, RegisterBody, RegisterQuery, RegisterResult, SearchDocUtilParams, SearchDocUtilResult, SelectOrganizationParam, SelectOrganizationResult, SelectProjectParam, SelectProjectResult, SetCSRFTokenResult, TranslateJSONBody, TranslateJSONResult, UnselectOrganizationResult, UnselectProjectResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult, UpdatePasswordBody, UpdatePasswordResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult, UpdateTagBody, UpdateTagParams, UpdateTagResult, UpdateUserBody, UpdateUserResult, UserAPI, ValidEmailParams, ValidEmailResult, } from '@intlayer/backend';
6
- export type { GetConfigurationResult, WriteContentDeclarationBody, WriteContentDeclarationResult, } from 'intlayer-editor';
5
+ export type { AIOptions, AIProvider, AddDictionaryBody, AddDictionaryResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, AddProjectBody, AddProjectResult, AddTagBody, AddTagResult, AskDocQuestionResult, AskResetPasswordBody, AskResetPasswordResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AuthClient, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CheckIfUserHasPasswordResult, CreateSessionBody, CreateSessionResult, CreateUserBody, CreateUserResult, CustomQueryBody, CustomQueryResult, DefinePasswordBody, DefinePasswordResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteDictionaryParam, DeleteDictionaryResult, DeleteOrganizationResult, DeleteProjectResult, DeleteTagParams, DeleteTagResult, GetCheckoutSessionBody, GetCheckoutSessionResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionariesUpdateTimestampResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetOAuth2TokenBody, GetOAuth2TokenBody, GetOAuth2TokenResult, GetOAuth2TokenResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, GetPricingBody, GetPricingResult, GetProjectsParams, GetProjectsResult, GetSessionInformationQuery, GetSessionInformationResult, GetTagsParams, GetTagsResult, GetUserByAccountParams, GetUserByAccountResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, GithubLoginQueryParams, GoogleLoginQueryParams, LoginBody, LoginResult, Messages, NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, PushDictionariesBody, PushDictionariesResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, RegisterBody, RegisterQuery, RegisterResult, SearchDocUtilParams, SearchDocUtilResult, SelectOrganizationParam, SelectOrganizationResult, SelectProjectParam, SelectProjectResult, SetCSRFTokenResult, TranslateJSONBody, TranslateJSONResult, UnselectOrganizationResult, UnselectProjectResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult, UpdatePasswordBody, UpdatePasswordResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult, UpdateTagBody, UpdateTagParams, UpdateTagResult, UpdateUserBody, UpdateUserResult, UserAPI, ValidEmailParams, ValidEmailResult, } from '@intlayer/backend';
6
+ export type { GetConfigurationResult, GetEditorDictionariesResult, WriteContentDeclarationBody, WriteContentDeclarationResult, } from 'intlayer-editor';
7
7
  export type AutocompleteBody = {
8
8
  text: string;
9
9
  aiOptions?: AIOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,YAAY,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EAC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AAM,CAAC;IACb,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,YAAY,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oCAAoC,EACpC,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EAC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": "6.0.0-canary.1",
4
4
  "private": false,
5
5
  "description": "SDK for interacting with the Intlayer API, enabling content auditing, and managing organizations, projects, and users.",
6
6
  "keywords": [
@@ -50,15 +50,12 @@
50
50
  ]
51
51
  }
52
52
  },
53
- "bin": {
54
- "intlayer": "./dist/cjs/cli.cjs"
55
- },
56
53
  "files": [
57
54
  "./dist",
58
55
  "./package.json"
59
56
  ],
60
57
  "dependencies": {
61
- "@intlayer/config": "5.8.1"
58
+ "@intlayer/config": "6.0.0-canary.1"
62
59
  },
63
60
  "devDependencies": {
64
61
  "@changesets/changelog-github": "0.5.1",
@@ -66,22 +63,22 @@
66
63
  "@types/node": "^24.2.1",
67
64
  "@typescript-eslint/parser": "^8.33.1",
68
65
  "concurrently": "^9.1.2",
69
- "eslint": "^9.33.0",
70
- "prettier": "^3.5.3",
66
+ "eslint": "^9.34.0",
67
+ "prettier": "^3.6.2",
71
68
  "rimraf": "^6.0.1",
72
69
  "tsc-alias": "^1.8.16",
73
70
  "tsup": "^8.5.0",
74
71
  "typescript": "^5.9.2",
75
- "vitest": "^3.2.2",
76
- "@intlayer/backend": "5.8.1",
77
- "@utils/eslint-config": "1.0.4",
72
+ "vitest": "^3.2.4",
78
73
  "@utils/ts-config": "1.0.4",
79
- "@utils/ts-config-types": "1.0.4",
80
74
  "@utils/tsup-config": "1.0.4",
81
- "intlayer-editor": "5.8.1"
75
+ "@utils/ts-config-types": "1.0.4",
76
+ "@utils/eslint-config": "1.0.4"
82
77
  },
83
78
  "peerDependencies": {
84
- "@intlayer/config": "5.8.1"
79
+ "@intlayer/config": "6.0.0-canary.1",
80
+ "@intlayer/backend": "6.0.0-canary.1",
81
+ "intlayer-editor": "6.0.0-canary.1"
85
82
  },
86
83
  "engines": {
87
84
  "node": ">=14.18"
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var IntlayerEventListener_exports = {};
30
- __export(IntlayerEventListener_exports, {
31
- IntlayerEventListener: () => IntlayerEventListener
32
- });
33
- module.exports = __toCommonJS(IntlayerEventListener_exports);
34
- var import_built = __toESM(require("@intlayer/config/built"));
35
- var import_oAuth = require('./getIntlayerAPI/oAuth.cjs');
36
- class IntlayerEventListener {
37
- constructor(intlayerConfig = import_built.default) {
38
- this.intlayerConfig = intlayerConfig;
39
- }
40
- eventSource = null;
41
- /**
42
- * Callback triggered when a Dictionary is ADDED.
43
- */
44
- onDictionaryAdded;
45
- /**
46
- * Callback triggered when a Dictionary is UPDATED.
47
- */
48
- onDictionaryChange;
49
- /**
50
- * Callback triggered when a Dictionary is DELETED.
51
- */
52
- onDictionaryDeleted;
53
- /**
54
- * Initializes the EventSource connection using the given intlayerConfig
55
- * (or the default config if none was provided).
56
- */
57
- async initialize() {
58
- const backendURL = this.intlayerConfig.editor.backendURL;
59
- const accessToken = await (0, import_oAuth.getOAuthAPI)(
60
- this.intlayerConfig
61
- ).getOAuth2AccessToken();
62
- if (!accessToken) {
63
- throw new Error("Failed to retrieve access token");
64
- }
65
- const API_ROUTE = `${backendURL}/api/event-listener`;
66
- const url = `${API_ROUTE}/${accessToken}`;
67
- this.eventSource = new EventSource(url);
68
- this.eventSource.onmessage = (event) => this.handleMessage(event);
69
- this.eventSource.onerror = (event) => this.handleError(event);
70
- }
71
- /**
72
- * Cleans up (closes) the EventSource connection.
73
- */
74
- cleanup() {
75
- if (this.eventSource) {
76
- this.eventSource.close();
77
- this.eventSource = null;
78
- }
79
- }
80
- /**
81
- * Handles incoming SSE messages, parses the event data,
82
- * and invokes the appropriate callback.
83
- */
84
- async handleMessage(event) {
85
- try {
86
- const { data } = event;
87
- const dataJSON = JSON.parse(data);
88
- for (const dataEl of dataJSON) {
89
- switch (dataEl.object) {
90
- case "DICTIONARY":
91
- switch (dataEl.status) {
92
- case "ADDED":
93
- await this.onDictionaryAdded?.(dataEl.data);
94
- break;
95
- case "UPDATED":
96
- await this.onDictionaryChange?.(dataEl.data);
97
- break;
98
- case "DELETED":
99
- await this.onDictionaryDeleted?.(dataEl.data);
100
- break;
101
- default:
102
- console.error("Unhandled dictionary status:", dataEl.status);
103
- break;
104
- }
105
- break;
106
- default:
107
- console.error("Unknown object type:", dataEl.object);
108
- break;
109
- }
110
- }
111
- } catch (error) {
112
- console.error("Error processing dictionary update:", error);
113
- }
114
- }
115
- /**
116
- * Handles any SSE errors and then performs cleanup.
117
- */
118
- handleError(event) {
119
- console.error("EventSource error:", event);
120
- this.cleanup();
121
- }
122
- }
123
- // Annotate the CommonJS export names for ESM import in node:
124
- 0 && (module.exports = {
125
- IntlayerEventListener
126
- });
127
- //# sourceMappingURL=IntlayerEventListener.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private eventSource: EventSource | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n constructor(private intlayerConfig: IntlayerConfig = configuration) {}\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token\n const accessToken = await getOAuthAPI(\n this.intlayerConfig\n ).getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n const url = `${API_ROUTE}/${accessToken}`;\n\n this.eventSource = new EventSource(url);\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n console.error('Unhandled dictionary status:', dataEl.status);\n break;\n }\n break;\n default:\n console.error('Unknown object type:', dataEl.object);\n break;\n }\n }\n } catch (error) {\n console.error('Error processing dictionary update:', error);\n }\n }\n\n /**\n * Handles any SSE errors and then performs cleanup.\n */\n private handleError(event: Event): void {\n console.error('EventSource error:', event);\n this.cleanup();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAE1B,mBAA4B;AA4BrB,MAAM,sBAAsB;AAAA,EAkBjC,YAAoB,iBAAiC,aAAAA,SAAe;AAAhD;AAAA,EAAiD;AAAA,EAjB7D,cAAkC;AAAA;AAAA;AAAA;AAAA,EAKnC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP,MAAa,aAA4B;AACvC,UAAM,aAAa,KAAK,eAAe,OAAO;AAG9C,UAAM,cAAc,UAAM;AAAA,MACxB,KAAK;AAAA,IACP,EAAE,qBAAqB;AAEvB,QAAI,CAAC,aAAa;AAChB,YAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAEA,UAAM,YAAY,GAAG,UAAU;AAC/B,UAAM,MAAM,GAAG,SAAS,IAAI,WAAW;AAEvC,SAAK,cAAc,IAAI,YAAY,GAAG;AACtC,SAAK,YAAY,YAAY,CAAC,UAAU,KAAK,cAAc,KAAK;AAChE,SAAK,YAAY,UAAU,CAAC,UAAU,KAAK,YAAY,KAAK;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA,EAKO,UAAgB;AACrB,QAAI,KAAK,aAAa;AACpB,WAAK,YAAY,MAAM;AACvB,WAAK,cAAc;AAAA,IACrB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAc,cAAc,OAA4C;AACtE,QAAI;AACF,YAAM,EAAE,KAAK,IAAI;AAEjB,YAAM,WAA+B,KAAK,MAAM,IAAI;AAEpD,iBAAW,UAAU,UAAU;AAC7B,gBAAQ,OAAO,QAAQ;AAAA,UACrB,KAAK;AACH,oBAAQ,OAAO,QAAQ;AAAA,cACrB,KAAK;AACH,sBAAM,KAAK,oBAAoB,OAAO,IAAI;AAC1C;AAAA,cACF,KAAK;AACH,sBAAM,KAAK,qBAAqB,OAAO,IAAI;AAC3C;AAAA,cACF,KAAK;AACH,sBAAM,KAAK,sBAAsB,OAAO,IAAI;AAC5C;AAAA,cACF;AACE,wBAAQ,MAAM,gCAAgC,OAAO,MAAM;AAC3D;AAAA,YACJ;AACA;AAAA,UACF;AACE,oBAAQ,MAAM,wBAAwB,OAAO,MAAM;AACnD;AAAA,QACJ;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,cAAQ,MAAM,uCAAuC,KAAK;AAAA,IAC5D;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKQ,YAAY,OAAoB;AACtC,YAAQ,MAAM,sBAAsB,KAAK;AACzC,SAAK,QAAQ;AAAA,EACf;AACF;","names":["configuration"]}
@@ -1,93 +0,0 @@
1
- import configuration from "@intlayer/config/built";
2
- import { getOAuthAPI } from "./getIntlayerAPI/oAuth.mjs";
3
- class IntlayerEventListener {
4
- constructor(intlayerConfig = configuration) {
5
- this.intlayerConfig = intlayerConfig;
6
- }
7
- eventSource = null;
8
- /**
9
- * Callback triggered when a Dictionary is ADDED.
10
- */
11
- onDictionaryAdded;
12
- /**
13
- * Callback triggered when a Dictionary is UPDATED.
14
- */
15
- onDictionaryChange;
16
- /**
17
- * Callback triggered when a Dictionary is DELETED.
18
- */
19
- onDictionaryDeleted;
20
- /**
21
- * Initializes the EventSource connection using the given intlayerConfig
22
- * (or the default config if none was provided).
23
- */
24
- async initialize() {
25
- const backendURL = this.intlayerConfig.editor.backendURL;
26
- const accessToken = await getOAuthAPI(
27
- this.intlayerConfig
28
- ).getOAuth2AccessToken();
29
- if (!accessToken) {
30
- throw new Error("Failed to retrieve access token");
31
- }
32
- const API_ROUTE = `${backendURL}/api/event-listener`;
33
- const url = `${API_ROUTE}/${accessToken}`;
34
- this.eventSource = new EventSource(url);
35
- this.eventSource.onmessage = (event) => this.handleMessage(event);
36
- this.eventSource.onerror = (event) => this.handleError(event);
37
- }
38
- /**
39
- * Cleans up (closes) the EventSource connection.
40
- */
41
- cleanup() {
42
- if (this.eventSource) {
43
- this.eventSource.close();
44
- this.eventSource = null;
45
- }
46
- }
47
- /**
48
- * Handles incoming SSE messages, parses the event data,
49
- * and invokes the appropriate callback.
50
- */
51
- async handleMessage(event) {
52
- try {
53
- const { data } = event;
54
- const dataJSON = JSON.parse(data);
55
- for (const dataEl of dataJSON) {
56
- switch (dataEl.object) {
57
- case "DICTIONARY":
58
- switch (dataEl.status) {
59
- case "ADDED":
60
- await this.onDictionaryAdded?.(dataEl.data);
61
- break;
62
- case "UPDATED":
63
- await this.onDictionaryChange?.(dataEl.data);
64
- break;
65
- case "DELETED":
66
- await this.onDictionaryDeleted?.(dataEl.data);
67
- break;
68
- default:
69
- console.error("Unhandled dictionary status:", dataEl.status);
70
- break;
71
- }
72
- break;
73
- default:
74
- console.error("Unknown object type:", dataEl.object);
75
- break;
76
- }
77
- }
78
- } catch (error) {
79
- console.error("Error processing dictionary update:", error);
80
- }
81
- }
82
- /**
83
- * Handles any SSE errors and then performs cleanup.
84
- */
85
- handleError(event) {
86
- console.error("EventSource error:", event);
87
- this.cleanup();
88
- }
89
- }
90
- export {
91
- IntlayerEventListener
92
- };
93
- //# sourceMappingURL=IntlayerEventListener.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getOAuthAPI } from './getIntlayerAPI/oAuth';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private eventSource: EventSource | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n constructor(private intlayerConfig: IntlayerConfig = configuration) {}\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token\n const accessToken = await getOAuthAPI(\n this.intlayerConfig\n ).getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n const url = `${API_ROUTE}/${accessToken}`;\n\n this.eventSource = new EventSource(url);\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n console.error('Unhandled dictionary status:', dataEl.status);\n break;\n }\n break;\n default:\n console.error('Unknown object type:', dataEl.object);\n break;\n }\n }\n } catch (error) {\n console.error('Error processing dictionary update:', error);\n }\n }\n\n /**\n * Handles any SSE errors and then performs cleanup.\n */\n private handleError(event: Event): void {\n console.error('EventSource error:', event);\n this.cleanup();\n }\n}\n"],"mappings":"AAEA,OAAO,mBAAmB;AAE1B,SAAS,mBAAmB;AA4BrB,MAAM,sBAAsB;AAAA,EAkBjC,YAAoB,iBAAiC,eAAe;AAAhD;AAAA,EAAiD;AAAA,EAjB7D,cAAkC;AAAA;AAAA;AAAA;AAAA,EAKnC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQP,MAAa,aAA4B;AACvC,UA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