@etohq/utils 1.3.0 → 1.5.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/LICENSE +21 -0
- package/dist/analytics/abstract-analytics-provider.d.ts +110 -0
- package/dist/analytics/abstract-analytics-provider.d.ts.map +1 -0
- package/dist/analytics/abstract-analytics-provider.js +107 -0
- package/dist/analytics/abstract-analytics-provider.js.map +1 -0
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js +18 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/auth/token.d.ts +5 -3
- package/dist/auth/token.d.ts.map +1 -1
- package/dist/auth/token.js +5 -2
- package/dist/auth/token.js.map +1 -1
- package/dist/bundles.d.ts +1 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +2 -1
- package/dist/bundles.js.map +1 -1
- package/dist/common/api-error.d.ts +205 -0
- package/dist/common/api-error.d.ts.map +1 -0
- package/dist/common/api-error.js +274 -0
- package/dist/common/api-error.js.map +1 -0
- package/dist/common/build-query.d.ts +1 -1
- package/dist/common/build-query.d.ts.map +1 -1
- package/dist/common/compress-name.d.ts +2 -0
- package/dist/common/compress-name.d.ts.map +1 -0
- package/dist/common/compress-name.js +34 -0
- package/dist/common/compress-name.js.map +1 -0
- package/dist/common/container.d.ts +98 -0
- package/dist/common/container.d.ts.map +1 -1
- package/dist/common/container.js +94 -0
- package/dist/common/container.js.map +1 -1
- package/dist/common/create-psql-index-helper.d.ts +1 -1
- package/dist/common/define-config.d.ts +4 -4
- package/dist/common/define-config.d.ts.map +1 -1
- package/dist/common/define-config.js +45 -26
- package/dist/common/define-config.js.map +1 -1
- package/dist/common/errors.d.ts +6 -4
- package/dist/common/errors.d.ts.map +1 -1
- package/dist/common/errors.js +25 -5
- package/dist/common/errors.js.map +1 -1
- package/dist/common/exec-mode.d.ts +2 -0
- package/dist/common/exec-mode.d.ts.map +1 -0
- package/dist/common/exec-mode.js +15 -0
- package/dist/common/exec-mode.js.map +1 -0
- package/dist/common/flatten-object-to-key-value-pairs.d.ts.map +1 -1
- package/dist/common/flatten-object-to-key-value-pairs.js +214 -72
- package/dist/common/flatten-object-to-key-value-pairs.js.map +1 -1
- package/dist/common/get-resolved-plugins.d.ts +4 -0
- package/dist/common/get-resolved-plugins.d.ts.map +1 -0
- package/dist/common/get-resolved-plugins.js +121 -0
- package/dist/common/get-resolved-plugins.js.map +1 -0
- package/dist/common/get-selects-and-relations-from-object-array.d.ts +2 -1
- package/dist/common/get-selects-and-relations-from-object-array.d.ts.map +1 -1
- package/dist/common/get-selects-and-relations-from-object-array.js +7 -5
- package/dist/common/get-selects-and-relations-from-object-array.js.map +1 -1
- package/dist/common/index.d.ts +19 -5
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +19 -5
- package/dist/common/index.js.map +1 -1
- package/dist/common/load-env.d.ts +3 -0
- package/dist/common/load-env.d.ts.map +1 -1
- package/dist/common/load-env.js +7 -4
- package/dist/common/load-env.js.map +1 -1
- package/dist/common/math.d.ts +2 -2
- package/dist/common/math.d.ts.map +1 -1
- package/dist/common/math.js +13 -6
- package/dist/common/math.js.map +1 -1
- package/dist/common/merge-metadata.d.ts +15 -0
- package/dist/common/merge-metadata.d.ts.map +1 -0
- package/dist/common/merge-metadata.js +34 -0
- package/dist/common/merge-metadata.js.map +1 -0
- package/dist/common/normalize-csv-value.d.ts +6 -0
- package/dist/common/normalize-csv-value.d.ts.map +1 -0
- package/dist/common/normalize-csv-value.js +14 -0
- package/dist/common/normalize-csv-value.js.map +1 -0
- package/dist/common/retry-execution.d.ts +18 -0
- package/dist/common/retry-execution.d.ts.map +1 -0
- package/dist/common/retry-execution.js +50 -0
- package/dist/common/retry-execution.js.map +1 -0
- package/dist/common/to-unix-slash.d.ts +2 -0
- package/dist/common/to-unix-slash.d.ts.map +1 -0
- package/dist/common/to-unix-slash.js +11 -0
- package/dist/common/to-unix-slash.js.map +1 -0
- package/dist/common/try-convert-to-boolean.d.ts +7 -0
- package/dist/common/try-convert-to-boolean.d.ts.map +1 -0
- package/dist/common/try-convert-to-boolean.js +15 -0
- package/dist/common/try-convert-to-boolean.js.map +1 -0
- package/dist/common/try-convert-to-number.d.ts +7 -0
- package/dist/common/try-convert-to-number.d.ts.map +1 -0
- package/dist/common/try-convert-to-number.js +10 -0
- package/dist/common/try-convert-to-number.js.map +1 -0
- package/dist/common/unflatten-object-keys.d.ts +29 -0
- package/dist/common/unflatten-object-keys.d.ts.map +1 -0
- package/dist/common/unflatten-object-keys.js +67 -0
- package/dist/common/unflatten-object-keys.js.map +1 -0
- package/dist/common/validate-module-name.d.ts +2 -0
- package/dist/common/validate-module-name.d.ts.map +1 -0
- package/dist/common/validate-module-name.js +27 -0
- package/dist/common/validate-module-name.js.map +1 -0
- package/dist/common/wrap-handler.d.ts +2 -0
- package/dist/common/wrap-handler.d.ts.map +1 -0
- package/dist/common/wrap-handler.js +40 -0
- package/dist/common/wrap-handler.js.map +1 -0
- package/dist/core-flows/events.d.ts +57 -0
- package/dist/core-flows/events.d.ts.map +1 -1
- package/dist/core-flows/events.js +58 -8
- package/dist/core-flows/events.js.map +1 -1
- package/dist/dal/index.d.ts +1 -0
- package/dist/dal/index.d.ts.map +1 -1
- package/dist/dal/index.js +1 -0
- package/dist/dal/index.js.map +1 -1
- package/dist/dal/mikro-orm/big-number-field.d.ts.map +1 -1
- package/dist/dal/mikro-orm/big-number-field.js +36 -21
- package/dist/dal/mikro-orm/big-number-field.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-create-connection.d.ts +10 -4
- package/dist/dal/mikro-orm/mikro-orm-create-connection.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js +53 -11
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.d.ts +3 -6
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.js +16 -21
- package/dist/dal/mikro-orm/mikro-orm-free-text-search-filter.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-repository.d.ts +4 -7
- package/dist/dal/mikro-orm/mikro-orm-repository.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-repository.js +94 -79
- package/dist/dal/mikro-orm/mikro-orm-repository.js.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-serializer.d.ts +7 -3
- package/dist/dal/mikro-orm/mikro-orm-serializer.d.ts.map +1 -1
- package/dist/dal/mikro-orm/mikro-orm-serializer.js +18 -15
- package/dist/dal/mikro-orm/mikro-orm-serializer.js.map +1 -1
- package/dist/dal/mikro-orm/sql-migration-generator.d.ts +6 -4
- package/dist/dal/mikro-orm/sql-migration-generator.d.ts.map +1 -1
- package/dist/dal/mikro-orm/sql-migration-generator.js +120 -70
- package/dist/dal/mikro-orm/sql-migration-generator.js.map +1 -1
- package/dist/dal/mikro-orm/utils.d.ts +14 -1
- package/dist/dal/mikro-orm/utils.d.ts.map +1 -1
- package/dist/dal/mikro-orm/utils.js +82 -38
- package/dist/dal/mikro-orm/utils.js.map +1 -1
- package/dist/defaults/countries.d.ts.map +1 -1
- package/dist/defaults/countries.js +0 -6
- package/dist/defaults/countries.js.map +1 -1
- package/dist/defaults/currencies.d.ts.map +1 -1
- package/dist/defaults/currencies.js +9 -0
- package/dist/defaults/currencies.js.map +1 -1
- package/dist/dml/entity-builder.d.ts.map +1 -1
- package/dist/dml/entity-builder.js.map +1 -1
- package/dist/dml/entity.d.ts +4 -5
- package/dist/dml/entity.d.ts.map +1 -1
- package/dist/dml/entity.js +0 -2
- package/dist/dml/entity.js.map +1 -1
- package/dist/dml/helpers/create-graphql.d.ts.map +1 -1
- package/dist/dml/helpers/create-graphql.js +27 -2
- package/dist/dml/helpers/create-graphql.js.map +1 -1
- package/dist/dml/helpers/create-mikro-orm-entity.d.ts.map +1 -1
- package/dist/dml/helpers/create-mikro-orm-entity.js +9 -6
- package/dist/dml/helpers/create-mikro-orm-entity.js.map +1 -1
- package/dist/dml/helpers/entity-builder/define-property.d.ts.map +1 -1
- package/dist/dml/helpers/entity-builder/define-property.js +9 -7
- package/dist/dml/helpers/entity-builder/define-property.js.map +1 -1
- package/dist/dml/helpers/entity-builder/define-relationship.d.ts +1 -1
- package/dist/dml/helpers/entity-builder/define-relationship.d.ts.map +1 -1
- package/dist/dml/helpers/entity-builder/define-relationship.js +41 -25
- package/dist/dml/helpers/entity-builder/define-relationship.js.map +1 -1
- package/dist/dml/helpers/entity-builder/index.d.ts +1 -0
- package/dist/dml/helpers/entity-builder/index.d.ts.map +1 -1
- package/dist/dml/helpers/entity-builder/index.js +1 -0
- package/dist/dml/helpers/entity-builder/index.js.map +1 -1
- package/dist/dml/helpers/entity-builder/relationship-helpers.d.ts +6 -0
- package/dist/dml/helpers/entity-builder/relationship-helpers.d.ts.map +1 -0
- package/dist/dml/helpers/entity-builder/relationship-helpers.js +12 -0
- package/dist/dml/helpers/entity-builder/relationship-helpers.js.map +1 -0
- package/dist/dml/helpers/graphql-builder/get-attribute.js +2 -2
- package/dist/dml/helpers/graphql-builder/get-attribute.js.map +1 -1
- package/dist/dml/index.d.ts +1 -1
- package/dist/dml/index.d.ts.map +1 -1
- package/dist/dml/index.js +1 -1
- package/dist/dml/index.js.map +1 -1
- package/dist/dml/integration-tests/utils.js +1 -1
- package/dist/dml/integration-tests/utils.js.map +1 -1
- package/dist/dml/properties/autoincrement.d.ts +20 -1
- package/dist/dml/properties/autoincrement.d.ts.map +1 -1
- package/dist/dml/properties/autoincrement.js +19 -0
- package/dist/dml/properties/autoincrement.js.map +1 -1
- package/dist/dml/properties/number.d.ts +20 -1
- package/dist/dml/properties/number.d.ts.map +1 -1
- package/dist/dml/properties/number.js +19 -0
- package/dist/dml/properties/number.js.map +1 -1
- package/dist/event-bus/index.d.ts +1 -1
- package/dist/event-bus/index.d.ts.map +1 -1
- package/dist/event-bus/index.js +5 -6
- package/dist/event-bus/index.js.map +1 -1
- package/dist/event-bus/message-aggregator.js +1 -1
- package/dist/event-bus/message-aggregator.js.map +1 -1
- package/dist/feature-flags/eto-v2.d.ts +3 -0
- package/dist/feature-flags/eto-v2.d.ts.map +1 -0
- package/dist/feature-flags/eto-v2.js +10 -0
- package/dist/feature-flags/eto-v2.js.map +1 -0
- package/dist/feature-flags/many-to-many-inventory.d.ts +3 -0
- package/dist/feature-flags/many-to-many-inventory.d.ts.map +1 -0
- package/dist/feature-flags/many-to-many-inventory.js +10 -0
- package/dist/feature-flags/many-to-many-inventory.js.map +1 -0
- package/dist/feature-flags/order-editing.d.ts +3 -0
- package/dist/feature-flags/order-editing.d.ts.map +1 -0
- package/dist/feature-flags/order-editing.js +10 -0
- package/dist/feature-flags/order-editing.js.map +1 -0
- package/dist/feature-flags/product-categories.d.ts +3 -0
- package/dist/feature-flags/product-categories.d.ts.map +1 -0
- package/dist/feature-flags/product-categories.js +10 -0
- package/dist/feature-flags/product-categories.js.map +1 -0
- package/dist/feature-flags/sales-channels.d.ts +3 -0
- package/dist/feature-flags/sales-channels.d.ts.map +1 -0
- package/dist/feature-flags/sales-channels.js +10 -0
- package/dist/feature-flags/sales-channels.js.map +1 -0
- package/dist/feature-flags/tax-inclusive-pricing.d.ts +3 -0
- package/dist/feature-flags/tax-inclusive-pricing.d.ts.map +1 -0
- package/dist/feature-flags/tax-inclusive-pricing.js +10 -0
- package/dist/feature-flags/tax-inclusive-pricing.js.map +1 -0
- package/dist/file/abstract-file-provider.d.ts +70 -11
- package/dist/file/abstract-file-provider.d.ts.map +1 -1
- package/dist/file/abstract-file-provider.js +73 -11
- package/dist/file/abstract-file-provider.js.map +1 -1
- package/dist/graphql/graphql-to-ts-types.d.ts.map +1 -1
- package/dist/graphql/graphql-to-ts-types.js +23 -2
- package/dist/graphql/graphql-to-ts-types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +8 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +27 -2
- package/dist/migrations/index.js.map +1 -1
- package/dist/modules-sdk/build-query.d.ts.map +1 -1
- package/dist/modules-sdk/build-query.js +14 -13
- package/dist/modules-sdk/build-query.js.map +1 -1
- package/dist/modules-sdk/create-pg-connection.d.ts +2 -1
- package/dist/modules-sdk/create-pg-connection.d.ts.map +1 -1
- package/dist/modules-sdk/create-pg-connection.js +1 -1
- package/dist/modules-sdk/decorators/inject-manager.d.ts.map +1 -1
- package/dist/modules-sdk/decorators/inject-manager.js +6 -0
- package/dist/modules-sdk/decorators/inject-manager.js.map +1 -1
- package/dist/modules-sdk/decorators/inject-transaction-manager.js +5 -5
- package/dist/modules-sdk/decorators/inject-transaction-manager.js.map +1 -1
- package/dist/modules-sdk/define-link.d.ts +2 -0
- package/dist/modules-sdk/define-link.d.ts.map +1 -1
- package/dist/modules-sdk/define-link.js +16 -0
- package/dist/modules-sdk/define-link.js.map +1 -1
- package/dist/modules-sdk/definition.d.ts +9 -0
- package/dist/modules-sdk/definition.d.ts.map +1 -1
- package/dist/modules-sdk/definition.js +5 -2
- package/dist/modules-sdk/definition.js.map +1 -1
- package/dist/modules-sdk/eto-internal-service.d.ts.map +1 -1
- package/dist/modules-sdk/eto-internal-service.js +35 -37
- package/dist/modules-sdk/eto-internal-service.js.map +1 -1
- package/dist/modules-sdk/eto-service.d.ts.map +1 -1
- package/dist/modules-sdk/eto-service.js +25 -41
- package/dist/modules-sdk/eto-service.js.map +1 -1
- package/dist/modules-sdk/event-builder-factory.js +9 -9
- package/dist/modules-sdk/event-builder-factory.js.map +1 -1
- package/dist/modules-sdk/joiner-config-builder.js +1 -1
- package/dist/modules-sdk/joiner-config-builder.js.map +1 -1
- package/dist/modules-sdk/load-module-database-config.d.ts.map +1 -1
- package/dist/modules-sdk/load-module-database-config.js +3 -0
- package/dist/modules-sdk/load-module-database-config.js.map +1 -1
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.d.ts.map +1 -1
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.js +0 -7
- package/dist/modules-sdk/loaders/mikro-orm-connection-loader.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/index.d.ts +1 -0
- package/dist/modules-sdk/migration-scripts/index.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/index.js +1 -0
- package/dist/modules-sdk/migration-scripts/index.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-down.js +2 -2
- package/dist/modules-sdk/migration-scripts/migration-down.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-generate.d.ts.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-generate.js +7 -3
- package/dist/modules-sdk/migration-scripts/migration-generate.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/migration-up.js +2 -2
- package/dist/modules-sdk/migration-scripts/migration-up.js.map +1 -1
- package/dist/modules-sdk/migration-scripts/service-migration-generate.d.ts +7 -0
- package/dist/modules-sdk/migration-scripts/service-migration-generate.d.ts.map +1 -0
- package/dist/modules-sdk/migration-scripts/service-migration-generate.js +49 -0
- package/dist/modules-sdk/migration-scripts/service-migration-generate.js.map +1 -0
- package/dist/modules-sdk/mikro-orm-cli-config-builder.d.ts +0 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.d.ts.map +1 -1
- package/dist/modules-sdk/mikro-orm-cli-config-builder.js +7 -6
- package/dist/modules-sdk/mikro-orm-cli-config-builder.js.map +1 -1
- package/dist/modules-sdk/module.d.ts.map +1 -1
- package/dist/modules-sdk/module.js +12 -14
- package/dist/modules-sdk/module.js.map +1 -1
- package/dist/modules-sdk/modules-to-container-types.d.ts.map +1 -1
- package/dist/modules-sdk/modules-to-container-types.js +30 -3
- package/dist/modules-sdk/modules-to-container-types.js.map +1 -1
- package/dist/modules-sdk/query-context.d.ts +2 -2
- package/dist/modules-sdk/query-context.d.ts.map +1 -1
- package/dist/modules-sdk/query-context.js.map +1 -1
- package/dist/modules-sdk/types/eto-service.d.ts +34 -10
- package/dist/modules-sdk/types/eto-service.d.ts.map +1 -1
- package/dist/notification/abstract-notification-provider.d.ts +10 -0
- package/dist/notification/abstract-notification-provider.d.ts.map +1 -1
- package/dist/notification/abstract-notification-provider.js.map +1 -1
- package/dist/payment/abstract-payment-provider.d.ts +253 -263
- package/dist/payment/abstract-payment-provider.d.ts.map +1 -1
- package/dist/payment/abstract-payment-provider.js +7 -15
- package/dist/payment/abstract-payment-provider.js.map +1 -1
- package/dist/payment/index.d.ts +0 -2
- package/dist/payment/index.d.ts.map +1 -1
- package/dist/payment/index.js +0 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/payment-collection.d.ts +13 -1
- package/dist/payment/payment-collection.d.ts.map +1 -1
- package/dist/payment/payment-collection.js +12 -0
- package/dist/payment/payment-collection.js.map +1 -1
- package/dist/payment/webhook.d.ts +13 -1
- package/dist/payment/webhook.d.ts.map +1 -1
- package/dist/payment/webhook.js +13 -1
- package/dist/payment/webhook.js.map +1 -1
- package/dist/pg/index.d.ts +1 -1
- package/dist/pg/index.d.ts.map +1 -1
- package/dist/totals/big-number.d.ts +23 -0
- package/dist/totals/big-number.d.ts.map +1 -0
- package/dist/totals/big-number.js +115 -0
- package/dist/totals/big-number.js.map +1 -0
- package/dist/totals/create-raw-properties-from-bignumber.d.ts +5 -0
- package/dist/totals/create-raw-properties-from-bignumber.d.ts.map +1 -0
- package/dist/totals/create-raw-properties-from-bignumber.js +52 -0
- package/dist/totals/create-raw-properties-from-bignumber.js.map +1 -0
- package/dist/totals/index.d.ts +6 -0
- package/dist/totals/index.d.ts.map +1 -0
- package/dist/totals/index.js +22 -0
- package/dist/totals/index.js.map +1 -0
- package/dist/totals/math.d.ts +24 -0
- package/dist/totals/math.d.ts.map +1 -0
- package/dist/totals/math.js +106 -0
- package/dist/totals/math.js.map +1 -0
- package/dist/totals/transform-properties-to-bignumber.d.ts +6 -0
- package/dist/totals/transform-properties-to-bignumber.d.ts.map +1 -0
- package/dist/totals/transform-properties-to-bignumber.js +40 -0
- package/dist/totals/transform-properties-to-bignumber.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -38
- package/dist/payment/get-smallest-unit.d.ts +0 -17
- package/dist/payment/get-smallest-unit.d.ts.map +0 -1
- package/dist/payment/get-smallest-unit.js +0 -68
- package/dist/payment/get-smallest-unit.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Etohq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { IAnalyticsProvider, ProviderIdentifyAnalyticsEventDTO, ProviderTrackAnalyticsEventDTO } from "@etohq/types";
|
|
2
|
+
/**
|
|
3
|
+
* ### constructor
|
|
4
|
+
*
|
|
5
|
+
* The constructor allows you to access resources from the module's container using the first parameter,
|
|
6
|
+
* and the module's options using the second parameter.
|
|
7
|
+
*
|
|
8
|
+
* If you're creating a client or establishing a connection with a third-party service, do it in the constructor.
|
|
9
|
+
*
|
|
10
|
+
* #### Example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Logger } from "@etohq/framework/types"
|
|
14
|
+
* import { AbstractAnalyticsProviderService } from "@etohq/framework/utils"
|
|
15
|
+
*
|
|
16
|
+
* type InjectedDependencies = {
|
|
17
|
+
* logger: Logger
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* type Options = {
|
|
21
|
+
* apiKey: string
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
25
|
+
* protected logger_: Logger
|
|
26
|
+
* protected options_: Options
|
|
27
|
+
* static identifier = "my-analytics"
|
|
28
|
+
* // assuming you're initializing a client
|
|
29
|
+
* protected client
|
|
30
|
+
*
|
|
31
|
+
* constructor (
|
|
32
|
+
* { logger }: InjectedDependencies,
|
|
33
|
+
* options: Options
|
|
34
|
+
* ) {
|
|
35
|
+
* super()
|
|
36
|
+
*
|
|
37
|
+
* this.logger_ = logger
|
|
38
|
+
* this.options_ = options
|
|
39
|
+
*
|
|
40
|
+
* // assuming you're initializing a client
|
|
41
|
+
* this.client = new Client(options)
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* export default MyAnalyticsProviderService
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class AbstractAnalyticsProviderService implements IAnalyticsProvider {
|
|
49
|
+
/**
|
|
50
|
+
* Each analytics provider has a unique ID used to identify it. The provider's ID
|
|
51
|
+
* will be stored as `aly_{identifier}_{id}`, where `{id}` is the provider's `id`
|
|
52
|
+
* property in the `eto-config.ts`.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
56
|
+
* static identifier = "my-analytics"
|
|
57
|
+
* // ...
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
static identifier: string;
|
|
61
|
+
/**
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
getIdentifier(): any;
|
|
65
|
+
/**
|
|
66
|
+
* This method tracks an event with the third-party analytics provider. The Analytics Module
|
|
67
|
+
* will use this method in its `track` method if your provider is configured in `eto-config.ts`.
|
|
68
|
+
*
|
|
69
|
+
* You can send the event to the third-party provider based on its semantics.
|
|
70
|
+
*
|
|
71
|
+
* @param {ProviderTrackAnalyticsEventDTO} data - The event's details.
|
|
72
|
+
* @returns {Promise<void>} Resolves when the event is tracked successfully.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
76
|
+
* // ...
|
|
77
|
+
* async track(
|
|
78
|
+
* data: ProviderTrackAnalyticsEventDTO
|
|
79
|
+
* ): Promise<void> {
|
|
80
|
+
* // track event to third-party provider
|
|
81
|
+
* // or using custom logic
|
|
82
|
+
* // for example:
|
|
83
|
+
* this.client.track(data)
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
*/
|
|
87
|
+
track(data: ProviderTrackAnalyticsEventDTO): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* This method identifies an actor or group in the third-party analytics provider. The Analytics Module
|
|
90
|
+
* will use this method in its `identify` method if your provider is configured in `eto-config.ts`.
|
|
91
|
+
*
|
|
92
|
+
* @param {ProviderIdentifyAnalyticsEventDTO} data - The details of the actor or group.
|
|
93
|
+
* @returns {Promise<void>} Resolves when the actor or group is identified successfully.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
97
|
+
* // ...
|
|
98
|
+
* async identify(
|
|
99
|
+
* data: ProviderIdentifyAnalyticsEventDTO
|
|
100
|
+
* ): Promise<void> {
|
|
101
|
+
* // identify actor or group in the analytics provider
|
|
102
|
+
* // or using custom logic
|
|
103
|
+
* // for example:
|
|
104
|
+
* this.client.identify(data)
|
|
105
|
+
* }
|
|
106
|
+
* }
|
|
107
|
+
*/
|
|
108
|
+
identify(data: ProviderIdentifyAnalyticsEventDTO): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=abstract-analytics-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-analytics-provider.d.ts","sourceRoot":"","sources":["../../src/analytics/abstract-analytics-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,gCAAiC,YAAW,kBAAkB;IACzE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,aAAa;IAIb;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,KAAK,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE;;;;;;;;;;;;;;;;;;;OAmBG;IACG,QAAQ,CAAC,IAAI,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractAnalyticsProviderService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ### constructor
|
|
6
|
+
*
|
|
7
|
+
* The constructor allows you to access resources from the module's container using the first parameter,
|
|
8
|
+
* and the module's options using the second parameter.
|
|
9
|
+
*
|
|
10
|
+
* If you're creating a client or establishing a connection with a third-party service, do it in the constructor.
|
|
11
|
+
*
|
|
12
|
+
* #### Example
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { Logger } from "@etohq/framework/types"
|
|
16
|
+
* import { AbstractAnalyticsProviderService } from "@etohq/framework/utils"
|
|
17
|
+
*
|
|
18
|
+
* type InjectedDependencies = {
|
|
19
|
+
* logger: Logger
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* type Options = {
|
|
23
|
+
* apiKey: string
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
27
|
+
* protected logger_: Logger
|
|
28
|
+
* protected options_: Options
|
|
29
|
+
* static identifier = "my-analytics"
|
|
30
|
+
* // assuming you're initializing a client
|
|
31
|
+
* protected client
|
|
32
|
+
*
|
|
33
|
+
* constructor (
|
|
34
|
+
* { logger }: InjectedDependencies,
|
|
35
|
+
* options: Options
|
|
36
|
+
* ) {
|
|
37
|
+
* super()
|
|
38
|
+
*
|
|
39
|
+
* this.logger_ = logger
|
|
40
|
+
* this.options_ = options
|
|
41
|
+
*
|
|
42
|
+
* // assuming you're initializing a client
|
|
43
|
+
* this.client = new Client(options)
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* export default MyAnalyticsProviderService
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
class AbstractAnalyticsProviderService {
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
*/
|
|
54
|
+
getIdentifier() {
|
|
55
|
+
return this.constructor.identifier;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* This method tracks an event with the third-party analytics provider. The Analytics Module
|
|
59
|
+
* will use this method in its `track` method if your provider is configured in `eto-config.ts`.
|
|
60
|
+
*
|
|
61
|
+
* You can send the event to the third-party provider based on its semantics.
|
|
62
|
+
*
|
|
63
|
+
* @param {ProviderTrackAnalyticsEventDTO} data - The event's details.
|
|
64
|
+
* @returns {Promise<void>} Resolves when the event is tracked successfully.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
68
|
+
* // ...
|
|
69
|
+
* async track(
|
|
70
|
+
* data: ProviderTrackAnalyticsEventDTO
|
|
71
|
+
* ): Promise<void> {
|
|
72
|
+
* // track event to third-party provider
|
|
73
|
+
* // or using custom logic
|
|
74
|
+
* // for example:
|
|
75
|
+
* this.client.track(data)
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
*/
|
|
79
|
+
async track(data) {
|
|
80
|
+
throw Error("track must be overridden by the child class");
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* This method identifies an actor or group in the third-party analytics provider. The Analytics Module
|
|
84
|
+
* will use this method in its `identify` method if your provider is configured in `eto-config.ts`.
|
|
85
|
+
*
|
|
86
|
+
* @param {ProviderIdentifyAnalyticsEventDTO} data - The details of the actor or group.
|
|
87
|
+
* @returns {Promise<void>} Resolves when the actor or group is identified successfully.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* class MyAnalyticsProviderService extends AbstractAnalyticsProviderService {
|
|
91
|
+
* // ...
|
|
92
|
+
* async identify(
|
|
93
|
+
* data: ProviderIdentifyAnalyticsEventDTO
|
|
94
|
+
* ): Promise<void> {
|
|
95
|
+
* // identify actor or group in the analytics provider
|
|
96
|
+
* // or using custom logic
|
|
97
|
+
* // for example:
|
|
98
|
+
* this.client.identify(data)
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
*/
|
|
102
|
+
async identify(data) {
|
|
103
|
+
throw Error("identify must be overridden by the child class");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.AbstractAnalyticsProviderService = AbstractAnalyticsProviderService;
|
|
107
|
+
//# sourceMappingURL=abstract-analytics-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-analytics-provider.js","sourceRoot":"","sources":["../../src/analytics/abstract-analytics-provider.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAa,gCAAgC;IAc3C;;OAEG;IACH,aAAa;QACX,OAAQ,IAAI,CAAC,WAAmB,CAAC,UAAU,CAAA;IAC7C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,KAAK,CAAC,IAAoC;QAC9C,MAAM,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAC5D,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAuC;QACpD,MAAM,KAAK,CAAC,gDAAgD,CAAC,CAAA;IAC/D,CAAC;CACF;AAtED,4EAsEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abstract-analytics-provider"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA6C"}
|
package/dist/auth/token.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type Secret, type SignOptions } from "jsonwebtoken";
|
|
1
2
|
export declare const generateJwtToken: (tokenPayload: Record<string, unknown>, jwtConfig: {
|
|
2
|
-
secret
|
|
3
|
-
expiresIn
|
|
4
|
-
|
|
3
|
+
secret?: Secret;
|
|
4
|
+
expiresIn?: number | string;
|
|
5
|
+
jwtOptions?: SignOptions;
|
|
6
|
+
}) => any;
|
|
5
7
|
//# sourceMappingURL=token.d.ts.map
|
package/dist/auth/token.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/auth/token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/auth/token.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAGjE,eAAO,MAAM,gBAAgB,GAC3B,cAAc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,WAAW;IACT,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,QAiBF,CAAA"}
|
package/dist/auth/token.js
CHANGED
|
@@ -7,11 +7,14 @@ exports.generateJwtToken = void 0;
|
|
|
7
7
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const generateJwtToken = (tokenPayload, jwtConfig) => {
|
|
10
|
-
if (!jwtConfig.secret ||
|
|
10
|
+
if (!jwtConfig.secret ||
|
|
11
|
+
(!jwtConfig.expiresIn && !jwtConfig.jwtOptions?.expiresIn)) {
|
|
11
12
|
throw new common_1.EtoError(common_1.EtoError.Types.INVALID_ARGUMENT, "JWT secret and expiresIn must be provided when generating a token");
|
|
12
13
|
}
|
|
14
|
+
const expiresIn = jwtConfig.expiresIn ?? jwtConfig.jwtOptions?.expiresIn;
|
|
13
15
|
return jsonwebtoken_1.default.sign(tokenPayload, jwtConfig.secret, {
|
|
14
|
-
|
|
16
|
+
...jwtConfig.jwtOptions,
|
|
17
|
+
expiresIn,
|
|
15
18
|
});
|
|
16
19
|
};
|
|
17
20
|
exports.generateJwtToken = generateJwtToken;
|
package/dist/auth/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/auth/token.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/auth/token.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAiE;AACjE,sCAAoC;AAE7B,MAAM,gBAAgB,GAAG,CAC9B,YAAqC,EACrC,SAIC,EACD,EAAE;IACF,IACE,CAAC,SAAS,CAAC,MAAM;QACjB,CAAC,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,EAC1D,CAAC;QACD,MAAM,IAAI,iBAAQ,CAChB,iBAAQ,CAAC,KAAK,CAAC,gBAAgB,EAC/B,mEAAmE,CACpE,CAAA;IACH,CAAC;IAED,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,UAAU,EAAE,SAAS,CAAA;IACxE,OAAO,sBAAG,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE;QAC9C,GAAG,SAAS,CAAC,UAAU;QACvB,SAAS;KACV,CAAC,CAAA;AACJ,CAAC,CAAA;AAvBY,QAAA,gBAAgB,oBAuB5B"}
|
package/dist/bundles.d.ts
CHANGED
package/dist/bundles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.d.ts","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,QAAQ,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,aAAa,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,aAAa,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,gBAAgB,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,YAAY,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA;AACnC,OAAO,KAAK,eAAe,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,kBAAkB,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"bundles.d.ts","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,cAAc,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,aAAa,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,aAAa,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,gBAAgB,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,YAAY,MAAM,WAAW,CAAA;AACzC,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA;AACnC,OAAO,KAAK,eAAe,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,kBAAkB,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,QAAQ,CAAA"}
|
package/dist/bundles.js
CHANGED
|
@@ -33,8 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.UserUtils = exports.SearchUtils = exports.OrchestrationUtils = exports.ModulesSdkUtils = exports.LinkUtils = exports.GraphQLUtils = exports.FeatureFlagUtils = exports.EventBusUtils = exports.DMLUtils = exports.DefaultsUtils = exports.DALUtils = exports.ApiKeyUtils = void 0;
|
|
36
|
+
exports.UserUtils = exports.SearchUtils = exports.OrchestrationUtils = exports.ModulesSdkUtils = exports.LinkUtils = exports.GraphQLUtils = exports.FeatureFlagUtils = exports.EventBusUtils = exports.DMLUtils = exports.DefaultsUtils = exports.DALUtils = exports.AnalyticsUtils = exports.ApiKeyUtils = void 0;
|
|
37
37
|
exports.ApiKeyUtils = __importStar(require("./api-key"));
|
|
38
|
+
exports.AnalyticsUtils = __importStar(require("./analytics"));
|
|
38
39
|
exports.DALUtils = __importStar(require("./dal"));
|
|
39
40
|
exports.DefaultsUtils = __importStar(require("./defaults"));
|
|
40
41
|
exports.DMLUtils = __importStar(require("./dml"));
|
package/dist/bundles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAwC;AACxC,kDAAiC;AACjC,4DAA2C;AAC3C,kDAAiC;AACjC,6DAA4C;AAC5C,oEAAmD;AACnD,0DAAyC;AACzC,oDAAmC;AACnC,iEAAgD;AAChD,sEAAqD;AACrD,wDAAuC;AACvC,oDAAmC"}
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAwC;AACxC,8DAA6C;AAC7C,kDAAiC;AACjC,4DAA2C;AAC3C,kDAAiC;AACjC,6DAA4C;AAC5C,oEAAmD;AACnD,0DAAyC;AACzC,oDAAmC;AACnC,iEAAgD;AAChD,sEAAqD;AACrD,wDAAuC;AACvC,oDAAmC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
export declare class APIError extends Error {
|
|
2
|
+
/**
|
|
3
|
+
* The error code.
|
|
4
|
+
*/
|
|
5
|
+
readonly code: ErrCode;
|
|
6
|
+
readonly details?: ErrDetails;
|
|
7
|
+
static canceled(msg: string, cause?: Error): APIError;
|
|
8
|
+
static unknown(msg: string, cause?: Error): APIError;
|
|
9
|
+
static invalidArgument(msg: string, cause?: Error): APIError;
|
|
10
|
+
static deadlineExceeded(msg: string, cause?: Error): APIError;
|
|
11
|
+
static notFound(msg: string, cause?: Error): APIError;
|
|
12
|
+
static alreadyExists(msg: string, cause?: Error): APIError;
|
|
13
|
+
static permissionDenied(msg: string, cause?: Error): APIError;
|
|
14
|
+
static resourceExhausted(msg: string, cause?: Error): APIError;
|
|
15
|
+
static failedPrecondition(msg: string, cause?: Error): APIError;
|
|
16
|
+
static aborted(msg: string, cause?: Error): APIError;
|
|
17
|
+
static outOfRange(msg: string, cause?: Error): APIError;
|
|
18
|
+
static unimplemented(msg: string, cause?: Error): APIError;
|
|
19
|
+
static internal(msg: string, cause?: Error): APIError;
|
|
20
|
+
static unavailable(msg: string, cause?: Error): APIError;
|
|
21
|
+
static dataLoss(msg: string, cause?: Error): APIError;
|
|
22
|
+
static unauthenticated(msg: string, cause?: Error): APIError;
|
|
23
|
+
withDetails(details: ErrDetails): APIError;
|
|
24
|
+
constructor(code: ErrCode, msg: string, cause?: Error, details?: ErrDetails);
|
|
25
|
+
}
|
|
26
|
+
export type ErrDetails = Record<string, any>;
|
|
27
|
+
export declare enum ErrCode {
|
|
28
|
+
/**
|
|
29
|
+
* OK indicates the operation was successful.
|
|
30
|
+
*/
|
|
31
|
+
OK = "ok",
|
|
32
|
+
/**
|
|
33
|
+
* Canceled indicates the operation was canceled (typically by the caller).
|
|
34
|
+
*
|
|
35
|
+
* Encore will generate this error code when cancellation is requested.
|
|
36
|
+
*/
|
|
37
|
+
Canceled = "canceled",
|
|
38
|
+
/**
|
|
39
|
+
* Unknown error. An example of where this error may be returned is
|
|
40
|
+
* if a Status value received from another address space belongs to
|
|
41
|
+
* an error-space that is not known in this address space. Also
|
|
42
|
+
* errors raised by APIs that do not return enough error information
|
|
43
|
+
* may be converted to this error.
|
|
44
|
+
*
|
|
45
|
+
* Encore will generate this error code in the above two mentioned cases.
|
|
46
|
+
*/
|
|
47
|
+
Unknown = "unknown",
|
|
48
|
+
/**
|
|
49
|
+
* InvalidArgument indicates client specified an invalid argument.
|
|
50
|
+
* Note that this differs from FailedPrecondition. It indicates arguments
|
|
51
|
+
* that are problematic regardless of the state of the system
|
|
52
|
+
* (e.g., a malformed file name).
|
|
53
|
+
*
|
|
54
|
+
* This error code will not be generated by the gRPC framework.
|
|
55
|
+
*/
|
|
56
|
+
InvalidArgument = "invalid_argument",
|
|
57
|
+
/**
|
|
58
|
+
* DeadlineExceeded means operation expired before completion.
|
|
59
|
+
* For operations that change the state of the system, this error may be
|
|
60
|
+
* returned even if the operation has completed successfully. For
|
|
61
|
+
* example, a successful response from a server could have been delayed
|
|
62
|
+
* long enough for the deadline to expire.
|
|
63
|
+
*
|
|
64
|
+
* The gRPC framework will generate this error code when the deadline is
|
|
65
|
+
* exceeded.
|
|
66
|
+
*/
|
|
67
|
+
DeadlineExceeded = "deadline_exceeded",
|
|
68
|
+
/**
|
|
69
|
+
* NotFound means some requested entity (e.g., file or directory) was
|
|
70
|
+
* not found.
|
|
71
|
+
*
|
|
72
|
+
* This error code will not be generated by the gRPC framework.
|
|
73
|
+
*/
|
|
74
|
+
NotFound = "not_found",
|
|
75
|
+
/**
|
|
76
|
+
* AlreadyExists means an attempt to create an entity failed because one
|
|
77
|
+
* already exists.
|
|
78
|
+
*
|
|
79
|
+
* This error code will not be generated by the gRPC framework.
|
|
80
|
+
*/
|
|
81
|
+
AlreadyExists = "already_exists",
|
|
82
|
+
/**
|
|
83
|
+
* PermissionDenied indicates the caller does not have permission to
|
|
84
|
+
* execute the specified operation. It must not be used for rejections
|
|
85
|
+
* caused by exhausting some resource (use ResourceExhausted
|
|
86
|
+
* instead for those errors). It must not be
|
|
87
|
+
* used if the caller cannot be identified (use Unauthenticated
|
|
88
|
+
* instead for those errors).
|
|
89
|
+
*
|
|
90
|
+
* This error code will not be generated by the gRPC core framework,
|
|
91
|
+
* but expect authentication middleware to use it.
|
|
92
|
+
*/
|
|
93
|
+
PermissionDenied = "permission_denied",
|
|
94
|
+
/**
|
|
95
|
+
* ResourceExhausted indicates some resource has been exhausted, perhaps
|
|
96
|
+
* a per-user quota, or perhaps the entire file system is out of space.
|
|
97
|
+
*
|
|
98
|
+
* This error code will be generated by the gRPC framework in
|
|
99
|
+
* out-of-memory and server overload situations, or when a message is
|
|
100
|
+
* larger than the configured maximum size.
|
|
101
|
+
*/
|
|
102
|
+
ResourceExhausted = "resource_exhausted",
|
|
103
|
+
/**
|
|
104
|
+
* FailedPrecondition indicates operation was rejected because the
|
|
105
|
+
* system is not in a state required for the operation's execution.
|
|
106
|
+
* For example, directory to be deleted may be non-empty, an rmdir
|
|
107
|
+
* operation is applied to a non-directory, etc.
|
|
108
|
+
*
|
|
109
|
+
* A litmus test that may help a service implementor in deciding
|
|
110
|
+
* between FailedPrecondition, Aborted, and Unavailable:
|
|
111
|
+
* (a) Use Unavailable if the client can retry just the failing call.
|
|
112
|
+
* (b) Use Aborted if the client should retry at a higher-level
|
|
113
|
+
* (e.g., restarting a read-modify-write sequence).
|
|
114
|
+
* (c) Use FailedPrecondition if the client should not retry until
|
|
115
|
+
* the system state has been explicitly fixed. E.g., if an "rmdir"
|
|
116
|
+
* fails because the directory is non-empty, FailedPrecondition
|
|
117
|
+
* should be returned since the client should not retry unless
|
|
118
|
+
* they have first fixed up the directory by deleting files from it.
|
|
119
|
+
* (d) Use FailedPrecondition if the client performs conditional
|
|
120
|
+
* REST Get/Update/Delete on a resource and the resource on the
|
|
121
|
+
* server does not match the condition. E.g., conflicting
|
|
122
|
+
* read-modify-write on the same resource.
|
|
123
|
+
*
|
|
124
|
+
* This error code will not be generated by the gRPC framework.
|
|
125
|
+
*/
|
|
126
|
+
FailedPrecondition = "failed_precondition",
|
|
127
|
+
/**
|
|
128
|
+
* Aborted indicates the operation was aborted, typically due to a
|
|
129
|
+
* concurrency issue like sequencer check failures, transaction aborts,
|
|
130
|
+
* etc.
|
|
131
|
+
*
|
|
132
|
+
* See litmus test above for deciding between FailedPrecondition,
|
|
133
|
+
* Aborted, and Unavailable.
|
|
134
|
+
*/
|
|
135
|
+
Aborted = "aborted",
|
|
136
|
+
/**
|
|
137
|
+
* OutOfRange means operation was attempted past the valid range.
|
|
138
|
+
* E.g., seeking or reading past end of file.
|
|
139
|
+
*
|
|
140
|
+
* Unlike InvalidArgument, this error indicates a problem that may
|
|
141
|
+
* be fixed if the system state changes. For example, a 32-bit file
|
|
142
|
+
* system will generate InvalidArgument if asked to read at an
|
|
143
|
+
* offset that is not in the range [0,2^32-1], but it will generate
|
|
144
|
+
* OutOfRange if asked to read from an offset past the current
|
|
145
|
+
* file size.
|
|
146
|
+
*
|
|
147
|
+
* There is a fair bit of overlap between FailedPrecondition and
|
|
148
|
+
* OutOfRange. We recommend using OutOfRange (the more specific
|
|
149
|
+
* error) when it applies so that callers who are iterating through
|
|
150
|
+
* a space can easily look for an OutOfRange error to detect when
|
|
151
|
+
* they are done.
|
|
152
|
+
*
|
|
153
|
+
* This error code will not be generated by the gRPC framework.
|
|
154
|
+
*/
|
|
155
|
+
OutOfRange = "out_of_range",
|
|
156
|
+
/**
|
|
157
|
+
* Unimplemented indicates operation is not implemented or not
|
|
158
|
+
* supported/enabled in this service.
|
|
159
|
+
*
|
|
160
|
+
* This error code will be generated by the gRPC framework. Most
|
|
161
|
+
* commonly, you will see this error code when a method implementation
|
|
162
|
+
* is missing on the server. It can also be generated for unknown
|
|
163
|
+
* compression algorithms or a disagreement as to whether an RPC should
|
|
164
|
+
* be streaming.
|
|
165
|
+
*/
|
|
166
|
+
Unimplemented = "unimplemented",
|
|
167
|
+
/**
|
|
168
|
+
* Internal errors. Means some invariants expected by underlying
|
|
169
|
+
* system has been broken. If you see one of these errors,
|
|
170
|
+
* something is very broken.
|
|
171
|
+
*
|
|
172
|
+
* This error code will be generated by the gRPC framework in several
|
|
173
|
+
* internal error conditions.
|
|
174
|
+
*/
|
|
175
|
+
Internal = "internal",
|
|
176
|
+
/**
|
|
177
|
+
* Unavailable indicates the service is currently unavailable.
|
|
178
|
+
* This is a most likely a transient condition and may be corrected
|
|
179
|
+
* by retrying with a backoff. Note that it is not always safe to retry
|
|
180
|
+
* non-idempotent operations.
|
|
181
|
+
*
|
|
182
|
+
* See litmus test above for deciding between FailedPrecondition,
|
|
183
|
+
* Aborted, and Unavailable.
|
|
184
|
+
*
|
|
185
|
+
* This error code will be generated by the gRPC framework during
|
|
186
|
+
* abrupt shutdown of a server process or network connection.
|
|
187
|
+
*/
|
|
188
|
+
Unavailable = "unavailable",
|
|
189
|
+
/**
|
|
190
|
+
* DataLoss indicates unrecoverable data loss or corruption.
|
|
191
|
+
*
|
|
192
|
+
* This error code will not be generated by the gRPC framework.
|
|
193
|
+
*/
|
|
194
|
+
DataLoss = "data_loss",
|
|
195
|
+
/**
|
|
196
|
+
* Unauthenticated indicates the request does not have valid
|
|
197
|
+
* authentication credentials for the operation.
|
|
198
|
+
*
|
|
199
|
+
* The gRPC framework will generate this error code when the
|
|
200
|
+
* authentication metadata is invalid or a Credentials callback fails,
|
|
201
|
+
* but also expect authentication middleware to generate it.
|
|
202
|
+
*/
|
|
203
|
+
Unauthenticated = "unauthenticated"
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=api-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../src/common/api-error.ts"],"names":[],"mappings":"AAGA,qBAAa,QAAS,SAAQ,KAAK;IACjC;;OAEG;IACH,SAAgB,IAAI,EAAE,OAAO,CAAA;IAC7B,SAAgB,OAAO,CAAC,EAAE,UAAU,CAAA;IAGpC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK1C,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKzC,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKjD,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKlD,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK1C,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK/C,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKlD,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKnD,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKpD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKzC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK5C,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK/C,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK1C,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK7C,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAK1C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;IAKjD,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,QAAQ;gBAM9B,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU;CAmB5E;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE5C,oBAAY,OAAO;IACjB;;OAEG;IACH,EAAE,OAAO;IAET;;;;OAIG;IACH,QAAQ,aAAa;IAErB;;;;;;;;OAQG;IACH,OAAO,YAAY;IAEnB;;;;;;;OAOG;IACH,eAAe,qBAAqB;IAEpC;;;;;;;;;OASG;IACH,gBAAgB,sBAAsB;IAEtC;;;;;OAKG;IACH,QAAQ,cAAc;IAEtB;;;;;OAKG;IACH,aAAa,mBAAmB;IAEhC;;;;;;;;;;OAUG;IACH,gBAAgB,sBAAsB;IAEtC;;;;;;;OAOG;IACH,iBAAiB,uBAAuB;IAExC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,kBAAkB,wBAAwB;IAE1C;;;;;;;OAOG;IACH,OAAO,YAAY;IAEnB;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,iBAAiB;IAE3B;;;;;;;;;OASG;IACH,aAAa,kBAAkB;IAE/B;;;;;;;OAOG;IACH,QAAQ,aAAa;IAErB;;;;;;;;;;;OAWG;IACH,WAAW,gBAAgB;IAE3B;;;;OAIG;IACH,QAAQ,cAAc;IAEtB;;;;;;;OAOG;IACH,eAAe,oBAAoB;CACpC"}
|