@adminide-stack/core 12.0.1-alpha.7 → 12.0.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -2
- package/lib/index.js +1 -1
- package/lib/utils/generate-uri.d.ts +6 -2
- package/lib/utils/generate-uri.js +5 -3
- package/lib/utils/generate-uri.js.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/preferenceUri.js +4 -2
- package/lib/utils/preferenceUri.js.map +1 -1
- package/lib/utils/resourceUriConversion.d.ts +84 -2
- package/lib/utils/resourceUriConversion.js +174 -54
- package/lib/utils/resourceUriConversion.js.map +1 -1
- package/lib/utils/resourceUriConversion.test.d.ts +1 -1
- package/lib/utils/splitCdecodeUri.d.ts +1 -1
- package/lib/utils/splitCdecodeUri.js +10 -4
- package/lib/utils/splitCdecodeUri.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
## To run tests
|
4
2
|
|
5
3
|
`npm link`
|
@@ -7,3 +5,42 @@
|
|
7
5
|
`yarn install`
|
8
6
|
`tsc`
|
9
7
|
`yarn test`
|
8
|
+
|
9
|
+
## Usage Examples
|
10
|
+
|
11
|
+
### Direct Resource URI Creation
|
12
|
+
|
13
|
+
The `createDirectResourceUri` function provides a streamlined way to create resource URIs without needing to first create a cdecode URI and then convert it:
|
14
|
+
|
15
|
+
```typescript
|
16
|
+
import { createDirectResourceUri, ConfigCollectionName, ConfigFragmentName } from '@adminide-stack/core';
|
17
|
+
|
18
|
+
// Create a URI for a team resource
|
19
|
+
const teamUri = createDirectResourceUri(
|
20
|
+
ConfigCollectionName.Teams,
|
21
|
+
'60a3e1c5f30d3a001c9e8d5e', // team ID
|
22
|
+
'my-organization', // organization name or ID
|
23
|
+
{
|
24
|
+
tenantId: 'default',
|
25
|
+
fragment: ConfigFragmentName.Settings,
|
26
|
+
useOrgNameParam: true, // use 'orgName' parameter (default: true)
|
27
|
+
},
|
28
|
+
);
|
29
|
+
|
30
|
+
// Result: cde-resource://default/teams?_id=60a3e1c5f30d3a001c9e8d5e&orgName=my-organization#settings
|
31
|
+
|
32
|
+
// Create a URI for an organization resource (only needs ID)
|
33
|
+
const orgUri = createDirectResourceUri(
|
34
|
+
ConfigCollectionName.Organizations,
|
35
|
+
'60a3e1c5f30d3a001c9e8d5f', // organization ID
|
36
|
+
null, // no organization parameter needed
|
37
|
+
{
|
38
|
+
tenantId: 'default',
|
39
|
+
fragment: ConfigFragmentName.Settings,
|
40
|
+
},
|
41
|
+
);
|
42
|
+
|
43
|
+
// Result: cde-resource://default/organizations?_id=60a3e1c5f30d3a001c9e8d5f#settings
|
44
|
+
```
|
45
|
+
|
46
|
+
This approach is more efficient than creating and converting cdecode URIs, and it ensures that the parameters are always in the correct order with `_id` first.
|
package/lib/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export{NATS_HEMERA_ADMINIDE_WORKSPACE,NATS_HEMERA_ADMINIDE_WORKSPACE_UPDATER}from'./constants/constants.js';export{DEFAULT_CPU,DEFAULT_HDD,DEFAULT_RAM}from'./constants/default-workspace-config.js';export{DEFAULT_TENANT_ID,GLOBAL_CONFIGURATION_FILE,OVERRIDE_IDENTIFIER_PATTERN,OVERRIDE_PATTERN_WITH_SUBSTITUTION,OVERRIDE_PROPERTY,OVERRIDE_PROPERTY_PATTERN,SETTINGS_OVERRRIDE_NODE_ID,USER_CONFIGURATION_FILE}from'./constants/configuration.js';export{ASANA_WEBHOOK_ENDPOINT,ORG_BASE_PATH,ORG_STD_ROUTES}from'./constants/urls.js';export{IntegrationConfigurationRoute}from'./constants/routes.js';export{BillingPlan}from'./constants/billing-plan.js';export{LOCAL_MACHINE_SCOPES,ORGANIZATION_SCOPES,REMOTE_MACHINE_SCOPES,RESOURCE_SCOPES,USER_SCOPES}from'./interfaces/configuration/configuration.js';export{ApplicationState,IOrganizationContext,IOrganizationResource}from'./interfaces/organization/organization-context.js';export{Extensions}from'@workbench-stack/core/lib/constants/extensions.js';export{LifecyclePhase,ShutdownReason,StartupKind}from'@workbench-stack/core/lib/interfaces/lifecycle/lifecycle.js';export{PermissionBehavior}from'./interfaces/permissions.js';export*from'common/lib/generated/generated-models.js';export{getFilteredRoutes,getFilteredTabs,getTtl}from'./utils/utils.js';export{convertToResourceUri,resourcePath}from'./utils/resourceUriConversion.js';export{generateApplicationUri,generateMachineUri,generateOrgUri,generateProxyUserUri,generateResourceUri,generateUri,generateUserUri}from'./utils/generate-uri.js';export{determineConfigurationTarget,generateCdecodeUri,parseCdecodeUri}from'./utils/cdecodeUri.js';export{generateApplicationRoleResource,generateRegisteredRoleURI}from'./utils/roles-utils.js';export{getScopes}from'./utils/configuration-utils.js';export{omitDeep}from'./utils/omit-deep.js';export{generateSettingsId}from'./utils/generated-settings-id.js';export{validateEmail}from'./utils/validations.js';export{toMilliSeconds}from'./utils/date-utils.js';export{expand,flatten,flattenObject}from'./utils/flatten-utils.js';export{generateUserAlias}from'./utils/generateUserAlias.js';export{getUserAlias}from'./utils/getUserAlias.js';export{getLogger}from'./utils/getLogger.js';export{getDefaultSettingsURI,getEditableSettingsURI,getOpenSettings,parseExtensionFromDefaultSettingsUri}from'./utils/preferenceUri.js';export{reviveUri}from'./utils/reviveUri.js';export{buildNodeContext,buildPermissionNodeContext,buildPolicyNodeContext,buildRoleNodeContext}from'./utils/nodeContext.js';export{splitCdecodeUri,splitOrgUri}from'./utils/splitCdecodeUri.js';export{Disposable,DisposableCollection}from'./core/disposable.js';export{Emitter,Event,WaitUntilEvent}from'./core/event.js';export{Path}from'./core/path.js';export{OrganizationContext,OrganizationResource,toOrganizationResource,toOrganizationResources,toUri}from'./core/organization/organization.js';export{OrganizationConfiguration}from'./core/organization/configuration.js';export{isOrganizationIdentifier,isRawFileOrganizationResource,isRawUriOrganizationResource,isSingleResourceOrganizationIdentifier,isSingleResourceOrganizationInitializationPayload}from'./core/organization/helpers/organization-helpers.js';export{ConfigurationTargetConfigurationMapper,ConfigurationTargetToString,SettingsTypeToConfiguraitonTarget,addToValueTree,getConfigurationValue,getMigratedSettingValue,isConfigurationOverrides,keyFromOverrideIdentifier,merge,overrideIdentifierFromKey,removeFromValueTree,toValuesTree}from'./core/configurations/helpers/configuration.js';export{ConfigurationModel}from'./core/configurations/models/ConfigurationModel.js';export{Configuration,OVERRIDE_PROPERTY_REGEX,compare,overrideIdentifiersFromKey}from'./core/configurations/configuration.js';export{ConfigurationChangeEvent}from'./core/configurations/events/ConfigurationChangeEvent.js';export{CdeCodeProvider}from'./core/in-memory-providers/cde-code-provider.js';export{AuthError}from'./errors/auth-error.js';export{AbstractOrganizationContextService}from'./services/abstract-organization-context-service.js';export{AbstractOrganizationConfigurationClientService}from'./services/abstract-configuration.js';export{PreDefineAccountPermissions}from'./modules/account-api/enums/index.js';export{BillingModules,PreDefineBillingPermissions}from'./modules/billing-api/enums/index.js';export{PreDefineInboxPermissions}from'./modules/inbox/enums/index.js';export{URI,uriToFsPath}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';export{ConfigurationScope}from'common';//# sourceMappingURL=index.js.map
|
1
|
+
export{NATS_HEMERA_ADMINIDE_WORKSPACE,NATS_HEMERA_ADMINIDE_WORKSPACE_UPDATER}from'./constants/constants.js';export{DEFAULT_CPU,DEFAULT_HDD,DEFAULT_RAM}from'./constants/default-workspace-config.js';export{DEFAULT_TENANT_ID,GLOBAL_CONFIGURATION_FILE,OVERRIDE_IDENTIFIER_PATTERN,OVERRIDE_PATTERN_WITH_SUBSTITUTION,OVERRIDE_PROPERTY,OVERRIDE_PROPERTY_PATTERN,SETTINGS_OVERRRIDE_NODE_ID,USER_CONFIGURATION_FILE}from'./constants/configuration.js';export{ASANA_WEBHOOK_ENDPOINT,ORG_BASE_PATH,ORG_STD_ROUTES}from'./constants/urls.js';export{IntegrationConfigurationRoute}from'./constants/routes.js';export{BillingPlan}from'./constants/billing-plan.js';export{LOCAL_MACHINE_SCOPES,ORGANIZATION_SCOPES,REMOTE_MACHINE_SCOPES,RESOURCE_SCOPES,USER_SCOPES}from'./interfaces/configuration/configuration.js';export{ApplicationState,IOrganizationContext,IOrganizationResource}from'./interfaces/organization/organization-context.js';export{Extensions}from'@workbench-stack/core/lib/constants/extensions.js';export{LifecyclePhase,ShutdownReason,StartupKind}from'@workbench-stack/core/lib/interfaces/lifecycle/lifecycle.js';export{PermissionBehavior}from'./interfaces/permissions.js';export*from'common/lib/generated/generated-models.js';export{getFilteredRoutes,getFilteredTabs,getTtl}from'./utils/utils.js';export{configureForCurrentBranch,configureForUpcomingBranch,convertToResourceUri,createDirectResourceUri,createStandardResourceUri,generateHashId,normalizeResourceUri,resourcePath,setupResourceUriConfiguration,strictConvertToResourceUri}from'./utils/resourceUriConversion.js';export{generateApplicationUri,generateMachineUri,generateOrgUri,generateProxyUserUri,generateResourceUri,generateUri,generateUserUri}from'./utils/generate-uri.js';export{determineConfigurationTarget,generateCdecodeUri,parseCdecodeUri}from'./utils/cdecodeUri.js';export{generateApplicationRoleResource,generateRegisteredRoleURI}from'./utils/roles-utils.js';export{getScopes}from'./utils/configuration-utils.js';export{omitDeep}from'./utils/omit-deep.js';export{generateSettingsId}from'./utils/generated-settings-id.js';export{validateEmail}from'./utils/validations.js';export{toMilliSeconds}from'./utils/date-utils.js';export{expand,flatten,flattenObject}from'./utils/flatten-utils.js';export{generateUserAlias}from'./utils/generateUserAlias.js';export{getUserAlias}from'./utils/getUserAlias.js';export{getLogger}from'./utils/getLogger.js';export{getDefaultSettingsURI,getEditableSettingsURI,getOpenSettings,parseExtensionFromDefaultSettingsUri}from'./utils/preferenceUri.js';export{reviveUri}from'./utils/reviveUri.js';export{buildNodeContext,buildPermissionNodeContext,buildPolicyNodeContext,buildRoleNodeContext}from'./utils/nodeContext.js';export{splitCdecodeUri,splitOrgUri}from'./utils/splitCdecodeUri.js';export{Disposable,DisposableCollection}from'./core/disposable.js';export{Emitter,Event,WaitUntilEvent}from'./core/event.js';export{Path}from'./core/path.js';export{OrganizationContext,OrganizationResource,toOrganizationResource,toOrganizationResources,toUri}from'./core/organization/organization.js';export{OrganizationConfiguration}from'./core/organization/configuration.js';export{isOrganizationIdentifier,isRawFileOrganizationResource,isRawUriOrganizationResource,isSingleResourceOrganizationIdentifier,isSingleResourceOrganizationInitializationPayload}from'./core/organization/helpers/organization-helpers.js';export{ConfigurationTargetConfigurationMapper,ConfigurationTargetToString,SettingsTypeToConfiguraitonTarget,addToValueTree,getConfigurationValue,getMigratedSettingValue,isConfigurationOverrides,keyFromOverrideIdentifier,merge,overrideIdentifierFromKey,removeFromValueTree,toValuesTree}from'./core/configurations/helpers/configuration.js';export{ConfigurationModel}from'./core/configurations/models/ConfigurationModel.js';export{Configuration,OVERRIDE_PROPERTY_REGEX,compare,overrideIdentifiersFromKey}from'./core/configurations/configuration.js';export{ConfigurationChangeEvent}from'./core/configurations/events/ConfigurationChangeEvent.js';export{CdeCodeProvider}from'./core/in-memory-providers/cde-code-provider.js';export{AuthError}from'./errors/auth-error.js';export{AbstractOrganizationContextService}from'./services/abstract-organization-context-service.js';export{AbstractOrganizationConfigurationClientService}from'./services/abstract-configuration.js';export{PreDefineAccountPermissions}from'./modules/account-api/enums/index.js';export{BillingModules,PreDefineBillingPermissions}from'./modules/billing-api/enums/index.js';export{PreDefineInboxPermissions}from'./modules/inbox/enums/index.js';export{URI,uriToFsPath}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';export{ConfigurationScope}from'common';//# sourceMappingURL=index.js.map
|
@@ -30,9 +30,13 @@ export declare const generateUserUri: (params: {
|
|
30
30
|
*/
|
31
31
|
export declare const generateApplicationUri: (orgName: string, fragment?: ConfigFragmentName, authority?: string) => URI;
|
32
32
|
export declare const generateResourceUri: (collectionName: ConfigCollectionName, params: {
|
33
|
-
|
33
|
+
alias?: any;
|
34
34
|
name?: string;
|
35
|
-
|
35
|
+
_id?: string;
|
36
|
+
organization?: string;
|
37
|
+
idName?: string;
|
38
|
+
slug?: string;
|
39
|
+
orgName?: string;
|
36
40
|
}, fragment: string, authority?: string, options?: Partial<typeof defaultOptions>) => URI;
|
37
41
|
export declare const generateOrgUri: (name: string, fragment: string, authority?: string) => URI;
|
38
42
|
export declare const generateMachineUri: (name: string, fragment: string, authority?: string) => URI;
|
@@ -63,9 +63,11 @@ const generateApplicationUri = (orgName, fragment = ConfigFragmentName.Settings,
|
|
63
63
|
orgName
|
64
64
|
}, fragment, authority);
|
65
65
|
const generateResourceUri = (collectionName, params, fragment, authority = '', options) => generateUri(collectionName, params, fragment, authority, options);
|
66
|
-
const generateOrgUri = (name, fragment, authority = '') =>
|
67
|
-
|
68
|
-
|
66
|
+
const generateOrgUri = (name, fragment, authority = '') => {
|
67
|
+
return generateUri(ConfigCollectionName.Organizations, {
|
68
|
+
name
|
69
|
+
}, fragment, authority);
|
70
|
+
};
|
69
71
|
const generateMachineUri = (name, fragment, authority = '') => generateUri(ConfigCollectionName.Machines, {
|
70
72
|
name
|
71
73
|
}, fragment, authority);export{generateApplicationUri,generateMachineUri,generateOrgUri,generateProxyUserUri,generateResourceUri,generateUri,generateUserUri};//# sourceMappingURL=generate-uri.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generate-uri.js","sources":["../../src/utils/generate-uri.ts"],"sourcesContent":[null],"names":["queryString","querystring"],"mappings":"
|
1
|
+
{"version":3,"file":"generate-uri.js","sources":["../../src/utils/generate-uri.ts"],"sourcesContent":[null],"names":["queryString","querystring"],"mappings":"yPAMA,SAAS,eAAe,CAAC,GAAQ,EAAA;;MAEzB,OAAA,QAAe,QAAA,OAAe,KAAA,IAAS,EAAA;AACvC,IAAA,OAAA;;;AAGJ,EAAA,IAAA,aAAU,CAAA,GAAW,CAAA,EAAC;AAClB,IAAA,OAAA;;;AAGJ,EAAA,OAAA,aAAc,CAAA,GAAO,CAAA,CAAG,IAAE,CAAA,GACrB,IAAK,GAAE,KAAI,IAAK,IAAI,OAAI,GAAA,KAAU,YAAa,CAAI,KAAM,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BhC;AACI,EAAA,OAAA,WAAkB,CAAA,oBAAqB,CAAA,gBAAgB,EAAA,QAAU,EAAA,SAAU,CAAA;AAC/E;AAEA;;;;;;;;;;;;;;"}
|
package/lib/utils/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export * from './utils';
|
2
|
-
export
|
2
|
+
export { convertToResourceUri, strictConvertToResourceUri, resourcePath, configureForCurrentBranch, configureForUpcomingBranch, createDirectResourceUri, createStandardResourceUri, setupResourceUriConfiguration, normalizeResourceUri, generateHashId, } from './resourceUriConversion';
|
3
3
|
export * from './generate-uri';
|
4
4
|
export * from './cdecodeUri';
|
5
5
|
export * from './roles-utils';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {
|
1
|
+
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {ConfigurationContributionNames}from'common';const KNOWN_SETTINGS_FILES = new Set(['settings.json', 'organizationSettings.json', 'resourceSettings.json', 'machineSettings.json', 'applicationSettings.json', 'organizationsettings.json', 'resourcesettings.json', 'machinesettings.json', 'applicationsettings.json']);
|
2
2
|
function getOpenSettings(target, resource, options) {
|
3
3
|
const editableSettingsResource = getEditableSettingsURI(resource, options);
|
4
4
|
const mergedOptions = {
|
@@ -93,6 +93,7 @@ function getEditableSettingsURI(resource, options = {
|
|
93
93
|
// If there's a subFragment, stitch it into the main fragment
|
94
94
|
fragment = fragment ? fragment.concat(`.${options.subFragment}`) : options.subFragment;
|
95
95
|
}
|
96
|
+
if (!options.query) ;
|
96
97
|
// Fall back to the resource's existing fragment if neither fragment nor subFragment is provided
|
97
98
|
const finalFragment = fragment ?? resource.fragment;
|
98
99
|
// Create a new URI with the possibly updated fragment, make sure to include authority.
|
@@ -104,5 +105,6 @@ function getEditableSettingsURI(resource, options = {
|
|
104
105
|
fragment: finalFragment
|
105
106
|
});
|
106
107
|
// Always convert to resource-based URI
|
107
|
-
return convertToResourceUri(newResource);
|
108
|
+
// return convertToResourceUri(newResource);
|
109
|
+
return newResource;
|
108
110
|
}export{getDefaultSettingsURI,getEditableSettingsURI,getOpenSettings,parseExtensionFromDefaultSettingsUri};//# sourceMappingURL=preferenceUri.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"preferenceUri.js","sources":["../../src/utils/preferenceUri.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"preferenceUri.js","sources":["../../src/utils/preferenceUri.ts"],"sourcesContent":[null],"names":[],"mappings":"0HAIA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAA,eAAA,EAAA,2BAAA,EAAA,uBAAA,EAAA,sBAAA,EAAA,0BAAA,EAAA,2BAAA,EAAA,uBAAA,EAAA,sBAAA,EAAA,0BAAA,CAAA,CAAA;AAClB,SAAA,eAAA,CAAA,MAAA,EAAA,QAAA,EAAA,OAAA,EAAA;QACY,wBAAA,GAAA,sBAAA,CAAA,QAAA,EAAA,OAAA,CAAA;QACJ,aAAA,GAAA;IACvB,GAAsB,OAAA;IACtB,SAA0B,EAAA,wBAAA,CAAA,SAAA;IAC1B,KAA2B,EAAA,wBAAA,CAAA,KAAA;;IAE3B,eAAsB,EAAA,OAAA,EAAA,eAAA,IAAA,wBAAA,CAAA,QAAA;;AAEzB,IAAE,aAAA,EAAA,OAAA,EAAA,aAAA,IAAA,oCAAA,CAAA,wBAAA;AAEH,GAAA;QACU,0BAAwB,GAAG,qBAAsB,CAAA,qBAAoB,CAAA;AAC3E,EAAA,OAAA;AACI,IAAA,qBAAU,EAAA,wBAAA;2BACyB,EAAA;;;AAGnC;;;;;;AAOA;AACA;;AAEP,SAAA,oCAAA,CAAA,QAAA,EAAA;AAED,EAAA,MAAA,YAAA,GAAA,QAAA,CAAA,IAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,MAAA,CAAA,OAAA,CAAA;;;;;;;;AAQG;AACH,IAAM,IAAA,YAA8C,CAAA,MAAA,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,EAAA,IAAA,OAAA,EAAE,WAAA,EAAA;;AAEf,IAAC,QAAA,GAAA,QAAA,GAAA,QAAA,CAAA,MAAA,CAAA,CAAA,CAAA,EAAA,OAAA,CAAA,WAAA,CAAA,CAAA,CAAA,GAAA,OAAA,CAAA,WAAA;AAED;MAIqD,CAAA,OAAA,CAAA,KAAA,EAAA;;QAI7C,wBAA8B,IAAA,SAAO;;AAEzC,EAAA,MAAI,WAAS,GAAK,GAAG,CAAA,IAAA,CAAA;UACuD,EAAA,QAAA,CAAA,MAAA;IAC5E,SAAC,EAAA,QAAA,CAAA,SAAA;IAED,IAAgG,EAAA,QAAA,CAAA,IAAA;AAChG,IAAA,KAAA,gBAAsB;IAEtB,QAAuF,EAAA;AACvF,GAAA,CAAA;;;SAGQ,WAAU;"}
|
@@ -1,4 +1,86 @@
|
|
1
1
|
import { URI, UriComponents } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri';
|
2
|
-
|
2
|
+
/**
|
3
|
+
* Resource URI Conversion Utilities
|
4
|
+
*
|
5
|
+
* This module handles URI conversion between different formats:
|
6
|
+
* - Converting between cdecode:// URIs and cde-resource:// URIs
|
7
|
+
* - Resolving slugs to IDs
|
8
|
+
* - Generating hash IDs for resources
|
9
|
+
*
|
10
|
+
* The core concept is that resource URIs should only contain a hash ID
|
11
|
+
* in their query string, generated from the resource type, ID, and context.
|
12
|
+
*/
|
3
13
|
export declare const resourcePath: (resource: (URI | UriComponents) | string) => string;
|
4
|
-
export declare function convertToResourceUri(resource: URI | string | UriComponents,
|
14
|
+
export declare function convertToResourceUri(resource: URI | string | UriComponents, params?: ResourceUriParams): URI;
|
15
|
+
export type ResourceUriParams = {
|
16
|
+
resourceType: string;
|
17
|
+
resourceId: string;
|
18
|
+
};
|
19
|
+
/**
|
20
|
+
* Configure URI generation for current branch (uses orgName)
|
21
|
+
* @deprecated No longer needed with hash ID approach
|
22
|
+
*/
|
23
|
+
export declare function configureForCurrentBranch(options?: {
|
24
|
+
includePathSegments?: boolean;
|
25
|
+
}): void;
|
26
|
+
/**
|
27
|
+
* Configure URI generation for upcoming branch (uses organization ID)
|
28
|
+
* @deprecated No longer needed with hash ID approach
|
29
|
+
*/
|
30
|
+
export declare function configureForUpcomingBranch(options?: {
|
31
|
+
includePathSegments?: boolean;
|
32
|
+
}): void;
|
33
|
+
/**
|
34
|
+
* Set up resource URI configuration at application startup
|
35
|
+
* @deprecated No longer needed with hash ID approach
|
36
|
+
*/
|
37
|
+
export declare function setupResourceUriConfiguration(isUpcomingBranch?: boolean, options?: {
|
38
|
+
includePathSegments?: boolean;
|
39
|
+
defaultTenantId?: string;
|
40
|
+
}): void;
|
41
|
+
/**
|
42
|
+
* Normalize a resource URI to ensure parameter consistency
|
43
|
+
* @deprecated No longer needed with hash ID approach
|
44
|
+
*/
|
45
|
+
export declare function normalizeResourceUri(uri: URI, forcedOrgParam?: 'orgName' | 'organization'): URI;
|
46
|
+
/**
|
47
|
+
* Generate a consistent hash ID for a resource
|
48
|
+
* @param resourceType Collection name
|
49
|
+
* @param resourceId Resource ID
|
50
|
+
* @param context Optional context parameters
|
51
|
+
* @param fragment Optional fragment/projection
|
52
|
+
* @returns Hash ID string
|
53
|
+
*/
|
54
|
+
export declare function generateHashId(resourceType: string, resourceId: string, context?: Record<string, string>, fragment?: string): string;
|
55
|
+
/**
|
56
|
+
* Strict version of convertToResourceUri that enforces ID-only references
|
57
|
+
* and generates hash IDs
|
58
|
+
*
|
59
|
+
* If params are not provided, they will be extracted from the URI if possible
|
60
|
+
*/
|
61
|
+
export declare function strictConvertToResourceUri(resource: URI | string | UriComponents, params?: ResourceUriParams): URI;
|
62
|
+
/**
|
63
|
+
* Creates a standardized resource URI that strictly follows the global configuration
|
64
|
+
* This ensures all URIs use consistent parameter names across the application
|
65
|
+
*
|
66
|
+
* @param resourceType The type of resource (teams, projects, organizations, etc.)
|
67
|
+
* @param resourceId The resource ID
|
68
|
+
* @param organizationId Organization ID or name (optional, not needed for organization resources)
|
69
|
+
* @param options Additional options for URI creation
|
70
|
+
* @returns A properly formatted resource URI with _id and _hashId in query
|
71
|
+
*/
|
72
|
+
export declare function createStandardResourceUri(resourceType: string, resourceId: string, organizationId?: string, options?: {
|
73
|
+
tenantId?: string;
|
74
|
+
fragment?: string;
|
75
|
+
additionalParams?: Record<string, string>;
|
76
|
+
}): URI;
|
77
|
+
/**
|
78
|
+
* Creates a direct resource URI without needing to create and convert a cdecode URI
|
79
|
+
* @deprecated Use createStandardResourceUri instead for better consistency
|
80
|
+
*/
|
81
|
+
export declare function createDirectResourceUri(resourceType: string, resourceId: string, organizationId?: string, options?: {
|
82
|
+
tenantId?: string;
|
83
|
+
fragment?: string;
|
84
|
+
useOrgNameParam?: boolean;
|
85
|
+
additionalParams?: Record<string, string>;
|
86
|
+
}): URI;
|
@@ -1,4 +1,15 @@
|
|
1
|
-
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import
|
1
|
+
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {Scheme}from'common';import {parseCdecodeUri}from'./cdecodeUri.js';import {reviveUri}from'./reviveUri.js';import crypto from'crypto';/**
|
2
|
+
* Resource URI Conversion Utilities
|
3
|
+
*
|
4
|
+
* This module handles URI conversion between different formats:
|
5
|
+
* - Converting between cdecode:// URIs and cde-resource:// URIs
|
6
|
+
* - Resolving slugs to IDs
|
7
|
+
* - Generating hash IDs for resources
|
8
|
+
*
|
9
|
+
* The core concept is that resource URIs should only contain a hash ID
|
10
|
+
* in their query string, generated from the resource type, ID, and context.
|
11
|
+
*/
|
12
|
+
const resourcePath = resource => {
|
2
13
|
if (typeof resource === 'string') {
|
3
14
|
return resource;
|
4
15
|
}
|
@@ -9,7 +20,86 @@ import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import que
|
|
9
20
|
const fragment = resource.fragment ? `:${resource.fragment}` : '';
|
10
21
|
return `${path}${query}${fragment}`;
|
11
22
|
};
|
12
|
-
|
23
|
+
/**
|
24
|
+
* Creates a consistently ordered query string with resource ID and hash ID.
|
25
|
+
* This ensures consistent parameter ordering regardless of how they're initially provided.
|
26
|
+
*
|
27
|
+
* @param resourceId The resource ID to include in the query
|
28
|
+
* @param hashId The hash ID to include in the query
|
29
|
+
* @returns A sorted query string with _id and _hashId parameters
|
30
|
+
*/
|
31
|
+
function createConsistentQueryString(resourceId, hashId) {
|
32
|
+
// Create an array of parameters and sort them alphabetically to ensure consistent ordering
|
33
|
+
// mongo-queryfilter preserves query string parameter order, which affects the hash
|
34
|
+
const sortedParams = [`_hashId=${encodeURIComponent(hashId)}`, `_id=${encodeURIComponent(resourceId)}`].sort().join('&');
|
35
|
+
return sortedParams;
|
36
|
+
}
|
37
|
+
function convertToResourceUri(resource, params) {
|
38
|
+
// Simply delegate to the strict version for consistent behavior
|
39
|
+
return strictConvertToResourceUri(resource, params);
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Configure URI generation for current branch (uses orgName)
|
43
|
+
* @deprecated No longer needed with hash ID approach
|
44
|
+
*/
|
45
|
+
function configureForCurrentBranch(options) {
|
46
|
+
// This is now a no-op but kept for backward compatibility
|
47
|
+
console.warn('configureForCurrentBranch is deprecated and has no effect with hash ID approach');
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Configure URI generation for upcoming branch (uses organization ID)
|
51
|
+
* @deprecated No longer needed with hash ID approach
|
52
|
+
*/
|
53
|
+
function configureForUpcomingBranch(options) {
|
54
|
+
// This is now a no-op but kept for backward compatibility
|
55
|
+
console.warn('configureForUpcomingBranch is deprecated and has no effect with hash ID approach');
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Set up resource URI configuration at application startup
|
59
|
+
* @deprecated No longer needed with hash ID approach
|
60
|
+
*/
|
61
|
+
function setupResourceUriConfiguration(isUpcomingBranch = false, options) {
|
62
|
+
// This is now a no-op but kept for backward compatibility
|
63
|
+
console.warn('setupResourceUriConfiguration is deprecated and has no effect with hash ID approach');
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* Normalize a resource URI to ensure parameter consistency
|
67
|
+
* @deprecated No longer needed with hash ID approach
|
68
|
+
*/
|
69
|
+
function normalizeResourceUri(uri, forcedOrgParam) {
|
70
|
+
// Just return the URI as is - with hash ID approach, there's no need for normalization
|
71
|
+
return uri;
|
72
|
+
}
|
73
|
+
/**
|
74
|
+
* Generate a consistent hash ID for a resource
|
75
|
+
* @param resourceType Collection name
|
76
|
+
* @param resourceId Resource ID
|
77
|
+
* @param context Optional context parameters
|
78
|
+
* @param fragment Optional fragment/projection
|
79
|
+
* @returns Hash ID string
|
80
|
+
*/
|
81
|
+
function generateHashId(resourceType, resourceId, context = {}, fragment) {
|
82
|
+
// Create a canonical string for consistent hashing
|
83
|
+
let canonicalString = `type:${resourceType}|id:${resourceId}`;
|
84
|
+
// Add all context values to the canonical string in a deterministic order
|
85
|
+
const orderedKeys = Object.keys(context).sort();
|
86
|
+
for (const key of orderedKeys) {
|
87
|
+
canonicalString += `|${key}:${context[key]}`;
|
88
|
+
}
|
89
|
+
if (fragment) {
|
90
|
+
canonicalString += `|proj:${fragment}`;
|
91
|
+
}
|
92
|
+
// Generate a SHA-256 hash and return a shorter version (12 chars)
|
93
|
+
const hash = crypto.createHash('sha256').update(canonicalString).digest('hex');
|
94
|
+
return hash.substring(0, 12);
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Strict version of convertToResourceUri that enforces ID-only references
|
98
|
+
* and generates hash IDs
|
99
|
+
*
|
100
|
+
* If params are not provided, they will be extracted from the URI if possible
|
101
|
+
*/
|
102
|
+
function strictConvertToResourceUri(resource, params) {
|
13
103
|
if (!resource) return null;
|
14
104
|
const isValidUri = uri => 'scheme' in uri && 'path' in uri;
|
15
105
|
if (resource instanceof URI) {
|
@@ -17,59 +107,37 @@ function convertToResourceUri(resource, scope) {
|
|
17
107
|
if (resource.scheme === Scheme.CDECODE) {
|
18
108
|
// Use parseCdecodeUri for cdecode URIs.
|
19
109
|
const parsedUri = parseCdecodeUri(resource);
|
20
|
-
//
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
// Only add orgName to query if it exists in the parsed URI
|
29
|
-
if (parsedUri.pathSegments.organization) {
|
30
|
-
queryData.orgName = parsedUri.pathSegments.organization;
|
31
|
-
}
|
32
|
-
if (parsedUri.pathSegments.resourceId) {
|
33
|
-
let resourceId = parsedUri.pathSegments.resourceId;
|
34
|
-
// Instead of decoding, check for both literal colon ':' and its encoded forms '%3A' or '%3a'.
|
35
|
-
const colonRegex = /(:|%3A)/i;
|
36
|
-
if (colonRegex.test(resourceId)) {
|
37
|
-
// Split using a regex that matches both ':' and its encoded equivalent.
|
38
|
-
const [field, value] = resourceId.split(/(?:%3A|:)/i, 2);
|
39
|
-
queryData[field.trim()] = value.trim();
|
40
|
-
} else {
|
41
|
-
// Default to _id if no field prefix is provided.
|
42
|
-
queryData._id = resourceId;
|
43
|
-
}
|
44
|
-
} else {
|
45
|
-
// When resourceId is absent, use the resourceGroup.
|
46
|
-
queryData.resourceGroup = parsedUri.pathSegments.resourceGroup;
|
47
|
-
}
|
48
|
-
} else if (parsedUri.pathSegments.resourceGroup && (scope ? scope === 3 /* ConfigurationScope.WINDOW */ : true)) {
|
49
|
-
path = `/${ConfigCollectionName.Projects}`;
|
50
|
-
queryData.orgName = parsedUri.pathSegments.organization;
|
51
|
-
queryData.resourceGroup = parsedUri.pathSegments.resourceGroup;
|
52
|
-
} else if (parsedUri.pathSegments.organization && (scope ? scope === 3 /* ConfigurationScope.WINDOW */ : true)) {
|
53
|
-
// console.log('organization---hehehrhe', parsedUri.pathSegments.organization);
|
54
|
-
path = `/${ConfigCollectionName.Organizations}`;
|
55
|
-
queryData.name = parsedUri.pathSegments.organization;
|
56
|
-
} else {
|
57
|
-
// if no organization like in pubngo we still return
|
58
|
-
return URI.from({
|
59
|
-
scheme: Scheme.CDECODE_RESOURCE,
|
60
|
-
authority: parsedUri.authority,
|
61
|
-
path,
|
62
|
-
query: queryString.stringify(queryData),
|
63
|
-
fragment: parsedUri.fragmentData
|
64
|
-
});
|
65
|
-
// throw new Error('not a valid resource');
|
110
|
+
// If params are not provided, extract them from the URI
|
111
|
+
const resourceParams = params || {
|
112
|
+
resourceType: parsedUri.pathSegments.resourceType || '',
|
113
|
+
resourceId: parsedUri.pathSegments.resourceId || ''
|
114
|
+
};
|
115
|
+
// If we don't have the required parameters, return the original URI
|
116
|
+
if (!resourceParams.resourceType || !resourceParams.resourceId) {
|
117
|
+
throw new Error('Required parameter resourceId is missing');
|
66
118
|
}
|
67
|
-
//
|
119
|
+
// Get the resource type and ID from params
|
120
|
+
const {
|
121
|
+
resourceType,
|
122
|
+
resourceId
|
123
|
+
} = resourceParams;
|
124
|
+
const path = `/${resourceType}`;
|
125
|
+
// Extract context for hash generation
|
126
|
+
const contextData = {};
|
127
|
+
// Handle organization ID from path or query
|
128
|
+
if (parsedUri.pathSegments.organization) {
|
129
|
+
contextData.organization = parsedUri.pathSegments.organization;
|
130
|
+
}
|
131
|
+
// Generate the hash ID using the provided resource ID and type
|
132
|
+
const hashId = generateHashId(resourceType, resourceId, contextData, parsedUri.fragmentData);
|
133
|
+
// Create a consistently ordered query string
|
134
|
+
const query = createConsistentQueryString(resourceId, hashId);
|
135
|
+
// Return URI with _id and _hashId in query
|
68
136
|
return URI.from({
|
69
137
|
scheme: Scheme.CDECODE_RESOURCE,
|
70
|
-
authority: parsedUri.authority,
|
138
|
+
authority: parsedUri.authority || 'default',
|
71
139
|
path,
|
72
|
-
query
|
140
|
+
query,
|
73
141
|
fragment: parsedUri.fragmentData
|
74
142
|
});
|
75
143
|
}
|
@@ -80,16 +148,68 @@ function convertToResourceUri(resource, scope) {
|
|
80
148
|
if (typeof resource === 'string') {
|
81
149
|
const parsedUri = URI.parse(resource);
|
82
150
|
if (parsedUri.scheme === Scheme.CDECODE) {
|
83
|
-
return
|
151
|
+
return strictConvertToResourceUri(parsedUri, params);
|
84
152
|
}
|
85
153
|
return parsedUri;
|
86
154
|
}
|
87
155
|
if (typeof resource === 'object') {
|
88
156
|
const revivedUri = reviveUri(resource);
|
89
157
|
if (revivedUri.scheme === Scheme.CDECODE) {
|
90
|
-
return
|
158
|
+
return strictConvertToResourceUri(revivedUri, params);
|
91
159
|
}
|
92
160
|
return revivedUri;
|
93
161
|
}
|
94
162
|
throw new Error('Unsupported resource type');
|
95
|
-
}
|
163
|
+
}
|
164
|
+
/**
|
165
|
+
* Creates a standardized resource URI that strictly follows the global configuration
|
166
|
+
* This ensures all URIs use consistent parameter names across the application
|
167
|
+
*
|
168
|
+
* @param resourceType The type of resource (teams, projects, organizations, etc.)
|
169
|
+
* @param resourceId The resource ID
|
170
|
+
* @param organizationId Organization ID or name (optional, not needed for organization resources)
|
171
|
+
* @param options Additional options for URI creation
|
172
|
+
* @returns A properly formatted resource URI with _id and _hashId in query
|
173
|
+
*/
|
174
|
+
function createStandardResourceUri(resourceType, resourceId, organizationId, options) {
|
175
|
+
// Normalize resource type to lowercase for consistent lookups
|
176
|
+
const normalizedType = resourceType.toLowerCase();
|
177
|
+
// Set defaults
|
178
|
+
const tenantId = options?.tenantId || 'default';
|
179
|
+
const fragment = options?.fragment || '';
|
180
|
+
const additionalParams = options?.additionalParams || {};
|
181
|
+
// Build the path
|
182
|
+
const path = `/${resourceType}`;
|
183
|
+
// Create context for hash generation
|
184
|
+
const context = {
|
185
|
+
...additionalParams
|
186
|
+
};
|
187
|
+
// Add organization if provided and not an organization resource
|
188
|
+
if (organizationId && normalizedType !== 'organizations') {
|
189
|
+
context.organization = organizationId;
|
190
|
+
}
|
191
|
+
// Generate the hash ID
|
192
|
+
const hashId = generateHashId(normalizedType, resourceId, context, fragment);
|
193
|
+
// Create a consistently ordered query string
|
194
|
+
const query = createConsistentQueryString(resourceId, hashId);
|
195
|
+
// Create the URI with _id and _hashId in the query
|
196
|
+
return URI.from({
|
197
|
+
scheme: Scheme.CDECODE_RESOURCE,
|
198
|
+
authority: tenantId,
|
199
|
+
path,
|
200
|
+
query,
|
201
|
+
fragment
|
202
|
+
});
|
203
|
+
}
|
204
|
+
/**
|
205
|
+
* Creates a direct resource URI without needing to create and convert a cdecode URI
|
206
|
+
* @deprecated Use createStandardResourceUri instead for better consistency
|
207
|
+
*/
|
208
|
+
function createDirectResourceUri(resourceType, resourceId, organizationId, options) {
|
209
|
+
// Simply forward to the standardized version
|
210
|
+
return createStandardResourceUri(resourceType, resourceId, organizationId, {
|
211
|
+
tenantId: options?.tenantId,
|
212
|
+
fragment: options?.fragment,
|
213
|
+
additionalParams: options?.additionalParams
|
214
|
+
});
|
215
|
+
}export{configureForCurrentBranch,configureForUpcomingBranch,convertToResourceUri,createDirectResourceUri,createStandardResourceUri,generateHashId,normalizeResourceUri,resourcePath,setupResourceUriConfiguration,strictConvertToResourceUri};//# sourceMappingURL=resourceUriConversion.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"resourceUriConversion.js","sources":["../../src/utils/resourceUriConversion.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"resourceUriConversion.js","sources":["../../src/utils/resourceUriConversion.ts"],"sourcesContent":[null],"names":[],"mappings":"kNAMA;;;;;;;;;;AAUG;AAEU,MAAA,YAAY,GAAG,QAAC,IAA4C;AACrE,EAAA,IAAA,OAAW,QAAA,KAAa,QAAA,EAAQ;AAC5B,IAAA,OAAA;;AAEJ,EAAA,MAAA;AACA,IAAA;AACA,GAAA,GAAA;AACA,EAAA,MAAA,QAAc,cAAW,GAAA,CAAA,CAAA,EAAQ,QAAG,CAAA,KAAA,CAAA,CAAA,GAAA,EAAA;AACxC,EAAE,MAAA,QAAA,GAAA,QAAA,CAAA,QAAA,GAAA,CAAA,CAAA,EAAA,QAAA,CAAA,QAAA,CAAA,CAAA,GAAA,EAAA;AAEF,EAAA,OAAA,CAAA,EAAA,IAAA,CAAA,EAAA,KAAA,CAAA,EAAA,QAAA,CAAA,CAAA;;;;;;;AAOG;AACH;;SAEuF,2BAAA,CAAA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AA,UAAA,EAAA,MAAA,CAAA;;SAEd,GAAA,CAAA,IAAA,CAAA;UACG,EAAA,MAAA,CAAA,gBAAA;AACX,IAAA,SAAE,EAAA,QAAA;AACP,IAAC,IAAA;AAED,IAAA,KAAA;;;AAGG;AACH;;AAYI;;SAEY,uBAAmB,CAAA,YAAA,EAAA,UAAA,EAAA,cAAA,EAAA,OAAA,EAAA;;AAE9B,EAAA,OAAE,yBAAA,CAAA,YAAA,EAAA,UAAA,EAAA,cAAA,EAAA;AACP,IAAC,QAAA,EAAA,OAAA,EAAA,QAAA;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
export {};
|
@@ -36,7 +36,7 @@ export interface SplitOrgUriResult {
|
|
36
36
|
* Splits a given cdecode URI ino an organization URI (orgUri) and, if available, a resource-specific URI (resourceUri).
|
37
37
|
*
|
38
38
|
* - If the incoming URI contains resource-specific segments (i.e. resourceType and resourceId), the organization URI
|
39
|
-
* is recreated without these segments using `generatedCdecodeUri`, and the resource-specific URI is generated via `
|
39
|
+
* is recreated without these segments using `generatedCdecodeUri`, and the resource-specific URI is generated via `strictConvertToResourceUri`.
|
40
40
|
*
|
41
41
|
* - If resource-specific segments are not present, the original URI itself is returned as the organization URI.
|
42
42
|
*
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {ConfigCollectionName,Scheme}from'common';import {parseCdecodeUri,generateCdecodeUri}from'./cdecodeUri.js';import {
|
1
|
+
import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {ConfigCollectionName,Scheme}from'common';import {parseCdecodeUri,generateCdecodeUri}from'./cdecodeUri.js';import {strictConvertToResourceUri}from'./resourceUriConversion.js';/**
|
2
2
|
* Splits a given cdecode URI ino an organization URI (orgUri) and, if available, a resource-specific URI (resourceUri).
|
3
3
|
*
|
4
4
|
* - If the incoming URI contains resource-specific segments (i.e. resourceType and resourceId), the organization URI
|
5
|
-
* is recreated without these segments using `generatedCdecodeUri`, and the resource-specific URI is generated via `
|
5
|
+
* is recreated without these segments using `generatedCdecodeUri`, and the resource-specific URI is generated via `strictConvertToResourceUri`.
|
6
6
|
*
|
7
7
|
* - If resource-specific segments are not present, the original URI itself is returned as the organization URI.
|
8
8
|
*
|
@@ -10,7 +10,6 @@ import {URI}from'@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';import {Co
|
|
10
10
|
* @return An object containing the orgUri and, optionally, the resourceUri.
|
11
11
|
*/
|
12
12
|
function splitCdecodeUri(cdecodeUri) {
|
13
|
-
console.log('---cdecodeUri---->>>>>>>>', cdecodeUri);
|
14
13
|
const parsedUri = parseCdecodeUri(cdecodeUri);
|
15
14
|
// Check if resource-specific segments exist.
|
16
15
|
if (parsedUri.pathSegments.resourceType && parsedUri.pathSegments.resourceId) {
|
@@ -26,8 +25,15 @@ function splitCdecodeUri(cdecodeUri) {
|
|
26
25
|
const orgUri = generateCdecodeUri(cdecodeUri.authority, orgParams, {},
|
27
26
|
// no additional query parameters
|
28
27
|
parsedUri.fragmentData);
|
28
|
+
// Extract the resource ID from resourceId segment which may include a prefix like name:value
|
29
|
+
let resourceId = parsedUri.pathSegments.resourceId;
|
30
|
+
const colonIndex = resourceId.indexOf(':');
|
31
|
+
if (colonIndex > 0) {
|
32
|
+
resourceId = resourceId.substring(colonIndex + 1);
|
33
|
+
}
|
29
34
|
// Generate the resource-specific URI using our conversion utility.
|
30
|
-
|
35
|
+
// With the updated API, we can rely on the function to extract params from the URI
|
36
|
+
const resourceUri = strictConvertToResourceUri(cdecodeUri);
|
31
37
|
return {
|
32
38
|
orgUri,
|
33
39
|
resourceUri
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"splitCdecodeUri.js","sources":["../../src/utils/splitCdecodeUri.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"splitCdecodeUri.js","sources":["../../src/utils/splitCdecodeUri.ts"],"sourcesContent":[null],"names":[],"mappings":"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aAAsB,EAAA;WACZ;;;AAGN;;AAEH,EAAA,MAAE,UAAA,GAAA,aAAA,CAAA,OAAA,CAAA,GAAA,CAAA;QAEI,CAAA,iBAAA,EAAA,eAAA,CAAA,GAAA,UAAA,KAAA,EAAA,GAAA,CAAA,aAAA,CAAA,SAAA,CAAA,CAAA,EAAA,UAAA,CAAA,EAAA,aAAA,CAAA,SAAA,CAAA,UAAA,GAAA,CAAA,CAAA,CAAA,GAAA,CAAA,oBAAA,CAAA,QAAA,EAAA,aAAA,CAAA;;QAEH,gBAAgB,GAAA,GAAA,CAAA,IAAA,CAAA;UACC,EAAA,MAAA,CAAA,gBAAA;aACF,EAAA,MAAA,CAAA,SAAA;QACjB,EAAA,CAAA,CAAA,EAAA,iBAAA,CAAA,CAAA;AACN,IAAC,KAAA,EAAA,CAAA,QAAA,EAAA,YAAA,CAAA,KAAA,EAAA,eAAA,CAAA,CAAA;;;;;;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@adminide-stack/core",
|
3
|
-
"version": "12.0.
|
3
|
+
"version": "12.0.3-alpha.0",
|
4
4
|
"description": "AdminIDE core for higher packages to depend on",
|
5
5
|
"license": "UNLICENSED",
|
6
6
|
"author": "CDMBase LLC",
|
@@ -40,5 +40,5 @@
|
|
40
40
|
"typescript": {
|
41
41
|
"definition": "lib/index.d.ts"
|
42
42
|
},
|
43
|
-
"gitHead": "
|
43
|
+
"gitHead": "918fb1f420d911771115816c96542e53b532b0c6"
|
44
44
|
}
|